use of com.intellij.openapi.actionSystem.DefaultActionGroup in project intellij-community by JetBrains.
the class ChangeSchemaCombo method createPopupActionGroup.
@NotNull
@Override
protected DefaultActionGroup createPopupActionGroup(JComponent button) {
DefaultActionGroup group = new DefaultActionGroup(new ChangeSchemaAction(FileTemplatesScheme.DEFAULT));
FileTemplatesScheme scheme = myConfigurable.getManager().getProjectScheme();
if (scheme != null) {
group.add(new ChangeSchemaAction(scheme));
}
return group;
}
use of com.intellij.openapi.actionSystem.DefaultActionGroup in project intellij-community by JetBrains.
the class ArtifactsStructureConfigurable method createAddArtifactAction.
private AnAction createAddArtifactAction(@NotNull final ArtifactType type) {
final List<? extends ArtifactTemplate> templates = type.getNewArtifactTemplates(myPackagingEditorContext);
final ArtifactTemplate emptyTemplate = new ArtifactTemplate() {
@Override
public String getPresentableName() {
return "Empty";
}
@Override
public NewArtifactConfiguration createArtifact() {
final String name = "unnamed";
return new NewArtifactConfiguration(type.createRootElement(name), name, type);
}
};
if (templates.isEmpty()) {
return new AddArtifactAction(type, emptyTemplate, type.getPresentableName(), type.getIcon());
}
final DefaultActionGroup group = new DefaultActionGroup(type.getPresentableName(), true);
group.getTemplatePresentation().setIcon(type.getIcon());
group.add(new AddArtifactAction(type, emptyTemplate, emptyTemplate.getPresentableName(), null));
group.addSeparator();
for (ArtifactTemplate template : templates) {
group.add(new AddArtifactAction(type, template, template.getPresentableName(), null));
}
return group;
}
use of com.intellij.openapi.actionSystem.DefaultActionGroup in project intellij-community by JetBrains.
the class ProjectJdksConfigurable method createActions.
@Override
@Nullable
protected ArrayList<AnAction> createActions(final boolean fromPopup) {
if (myProjectJdksModel == null) {
return null;
}
final ArrayList<AnAction> actions = new ArrayList<>();
DefaultActionGroup group = new DefaultActionGroup(ProjectBundle.message("add.new.jdk.text"), true);
group.getTemplatePresentation().setIcon(IconUtil.getAddIcon());
myProjectJdksModel.createAddActions(group, myTree, projectJdk -> {
addNode(new MyNode(new JdkConfigurable(((ProjectJdkImpl) projectJdk), myProjectJdksModel, TREE_UPDATER, myHistory, myProject), false), myRoot);
selectNodeInTree(findNodeByObject(myRoot, projectJdk));
});
actions.add(new MyActionGroupWrapper(group));
actions.add(new MyDeleteAction(Conditions.<Object[]>alwaysTrue()));
return actions;
}
use of com.intellij.openapi.actionSystem.DefaultActionGroup in project intellij-community by JetBrains.
the class GroovyDocGenerationPanel method getActionGroup.
private ActionGroup getActionGroup() {
if (myActionGroup == null) {
initActions();
myActionGroup = new DefaultActionGroup();
myActionGroup.add(myAddPackageAction);
myActionGroup.add(myReducePackageAction);
}
return myActionGroup;
}
use of com.intellij.openapi.actionSystem.DefaultActionGroup in project intellij-community by JetBrains.
the class GradleRunnerUtil method attachTaskExecutionView.
public static DuplexConsoleView attachTaskExecutionView(@NotNull final Project project, @NotNull final ConsoleView consoleView, final boolean isTaskConsoleEnabledByDefault, @Nullable final String stateStorageKey, @NotNull final ProcessHandler processHandler, @NotNull final ExternalSystemTaskId taskId) {
final String tripleStateStorageKey = stateStorageKey != null ? stateStorageKey + "_str" : null;
if (stateStorageKey != null && isTaskConsoleEnabledByDefault && !PropertiesComponent.getInstance().isValueSet(tripleStateStorageKey)) {
PropertiesComponent.getInstance().setValue(tripleStateStorageKey, Boolean.TRUE.toString());
PropertiesComponent.getInstance().setValue(stateStorageKey, Boolean.TRUE);
}
final TaskExecutionView gradleExecutionConsole = new TaskExecutionView(project);
final Ref<DuplexConsoleView> duplexConsoleViewRef = Ref.create();
final DuplexConsoleView duplexConsoleView = new DuplexConsoleView<ConsoleView, ConsoleView>(gradleExecutionConsole, consoleView, stateStorageKey) {
@Override
public void enableConsole(boolean primary) {
super.enableConsole(primary);
if (stateStorageKey != null) {
PropertiesComponent.getInstance().setValue(tripleStateStorageKey, Boolean.toString(primary));
}
}
@NotNull
@Override
public AnAction[] createConsoleActions() {
final DefaultActionGroup textActionGroup = new DefaultActionGroup() {
@Override
public void update(AnActionEvent e) {
super.update(e);
if (duplexConsoleViewRef.get() != null) {
e.getPresentation().setVisible(!duplexConsoleViewRef.get().isPrimaryConsoleEnabled());
}
}
};
final AnAction[] consoleActions = consoleView.createConsoleActions();
for (AnAction anAction : consoleActions) {
textActionGroup.add(anAction);
}
final List<AnAction> anActions = ContainerUtil.newArrayList(super.createConsoleActions());
anActions.add(textActionGroup);
return ArrayUtil.toObjectArray(anActions, AnAction.class);
}
};
duplexConsoleViewRef.set(duplexConsoleView);
duplexConsoleView.setDisableSwitchConsoleActionOnProcessEnd(false);
duplexConsoleView.getSwitchConsoleActionPresentation().setIcon(AllIcons.Actions.ChangeView);
duplexConsoleView.getSwitchConsoleActionPresentation().setText(GradleBundle.message("gradle.runner.toggle.tree.text.action.name"));
final ExternalSystemProgressNotificationManager progressManager = ServiceManager.getService(ExternalSystemProgressNotificationManager.class);
final ExternalSystemTaskNotificationListenerAdapter taskListener = new ExternalSystemTaskNotificationListenerAdapter() {
@Override
public void onStatusChange(@NotNull final ExternalSystemTaskNotificationEvent event) {
if (event instanceof ExternalSystemTaskExecutionEvent) {
UIUtil.invokeLaterIfNeeded(() -> {
if (((ExternalSystemTaskExecutionEvent) event).getProgressEvent() instanceof ExternalSystemProgressEventUnsupported) {
duplexConsoleView.enableConsole(false);
}
gradleExecutionConsole.onStatusChange((ExternalSystemTaskExecutionEvent) event);
});
}
}
@Override
public void onQueued(@NotNull ExternalSystemTaskId id, final String workingDir) {
UIUtil.invokeLaterIfNeeded(() -> gradleExecutionConsole.setWorkingDir(workingDir));
}
@Override
public void onFailure(@NotNull ExternalSystemTaskId id, @NotNull final Exception e) {
UIUtil.invokeLaterIfNeeded(() -> gradleExecutionConsole.onFailure(e));
}
@Override
public void onEnd(@NotNull ExternalSystemTaskId id) {
progressManager.removeNotificationListener(this);
}
};
progressManager.addNotificationListener(taskId, taskListener);
return duplexConsoleView;
}
Aggregations