-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: refresh capability on commands
- Loading branch information
Showing
4 changed files
with
85 additions
and
14 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
src/main/java/io/stouder/adonis/action/RefreshCommandsAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package io.stouder.adonis.action; | ||
|
||
import com.intellij.openapi.actionSystem.AnAction; | ||
import com.intellij.openapi.actionSystem.AnActionEvent; | ||
import com.intellij.openapi.project.Project; | ||
import io.stouder.adonis.AdonisBundle; | ||
import io.stouder.adonis.cli.json.ace.Command; | ||
import io.stouder.adonis.notifier.AdonisRcUpdateNotifier; | ||
import io.stouder.adonis.service.AdonisAceService; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Optional; | ||
|
||
public class RefreshCommandsAction extends AnAction { | ||
|
||
@Override | ||
public void actionPerformed(@NotNull AnActionEvent e) { | ||
Project project = e.getProject(); | ||
assert project != null; | ||
|
||
e.getPresentation().setEnabled(false); | ||
AdonisRcUpdateNotifier publisher = project.getMessageBus().syncPublisher(AdonisRcUpdateNotifier.ADONIS_RC_UPDATE_TOPIC); | ||
Map<String, Optional<Command[]>> commands = AdonisAceService.getInstance(project).runAceGetCommandOnEveryRoots( | ||
AdonisBundle.message("adonis.actions.refresh.commands"), | ||
List.of("list", "--json"), | ||
Command[].class | ||
); | ||
publisher.commands(commands); | ||
e.getPresentation().setEnabled(true); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters