Skip to content

Commit

Permalink
feat(vcs): add Shirefeat VCS single(vcs): action
Browse files Browse the repository at this point in the history
Add a add Sh new singleire VCS single action for Sh action

Addire VCS with commit functionality. a new single action for Shire VCS with commit functionality.
  • Loading branch information
phodal committed Jul 3, 2024
1 parent a2d7d50 commit e982cec
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class ShireVcsActionGroup : ActionGroup() {
override fun getActionUpdateThread() = ActionUpdateThread.BGT

override fun update(e: AnActionEvent) {
// e.presentation.isPopupGroup = shireActionConfigs().size > 1
val isMultipleActions = shireActionConfigs().size > 1
e.presentation.isVisible = isMultipleActions
e.presentation.isPopupGroup = true
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.phodal.shirelang.actions.vcs

import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.project.DumbAwareAction
import com.phodal.shirecore.action.ShireActionLocation
import com.phodal.shirelang.actions.ShireRunFileAction
import com.phodal.shirelang.actions.dynamic.DynamicShireActionService

class ShireVcsSingleAction : DumbAwareAction() {
private fun shireActionConfigs() =
DynamicShireActionService.getInstance().getAction(ShireActionLocation.COMMIT_MENU)

override fun update(e: AnActionEvent) {
e.presentation.isEnabled = shireActionConfigs().size == 1
}

override fun actionPerformed(e: AnActionEvent) {
val project = e.project ?: return

val config = shireActionConfigs().first()
ShireRunFileAction.executeShireFile(project, config, null)
}
}
10 changes: 9 additions & 1 deletion shirelang/src/main/resources/com.phodal.shirelang.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,19 @@
<group id="ShireVcsActionGroup"
class="com.phodal.shirelang.actions.vcs.ShireVcsActionGroup"
icon="com.phodal.shirelang.ShireIcons.DEFAULT"
description="Ask AI generate commit message">
description="Shire VCS Action">

<add-to-group group-id="Vcs.MessageActionGroup"/>
</group>

<action id="autodev.Vcs.CommitMessage"
class="com.phodal.shirelang.actions.vcs.ShireVcsSingleAction"
icon="com.phodal.shirelang.ShireIcons.DEFAULT"
description="Shire VCS Action">

<add-to-group group-id="Vcs.MessageActionGroup"/>
</action>

<!-- Shire Intentions Action Group -->
<group id="ShireIntentionsActionGroup" class="com.phodal.shirelang.actions.intention.ShireIntentionsActionGroup"
icon="com.phodal.shirelang.ShireIcons.DEFAULT" searchable="false">
Expand Down

0 comments on commit e982cec

Please sign in to comment.