use of com.intellij.openapi.actionSystem.AnAction in project intellij-community by JetBrains.
the class CheckoutActionGroup method computeChildren.
@NotNull
@Override
protected AnAction[] computeChildren(@NotNull ActionManager manager) {
CheckoutProvider[] providers = CheckoutProvider.EXTENSION_POINT_NAME.getExtensions();
if (providers.length == 0) {
return EMPTY_ARRAY;
}
Arrays.sort(providers, new CheckoutProvider.CheckoutProviderComparator());
AnAction[] children = new AnAction[providers.length];
for (int i = 0; i < providers.length; i++) {
CheckoutProvider provider = providers[i];
children[i] = createAction(provider);
}
return children;
}
use of com.intellij.openapi.actionSystem.AnAction in project intellij-community by JetBrains.
the class XEvaluateInConsoleFromEditorActionHandler method getConsoleExecuteAction.
@Nullable
public static ConsoleExecuteAction getConsoleExecuteAction(@Nullable ConsoleView consoleView) {
if (!(consoleView instanceof LanguageConsoleView)) {
return null;
}
List<AnAction> actions = ActionUtil.getActions(((LanguageConsoleView) consoleView).getConsoleEditor().getComponent());
ConsoleExecuteAction action = ContainerUtil.findInstance(actions, ConsoleExecuteAction.class);
return action == null || !action.isEnabled() ? null : action;
}
use of com.intellij.openapi.actionSystem.AnAction in project intellij-community by JetBrains.
the class AbstractLanguageInjectionSupport method createDefaultAddAction.
public static AnAction createDefaultAddAction(final Project project, final Consumer<BaseInjection> consumer, final AbstractLanguageInjectionSupport support) {
final String supportTitle = StringUtil.capitalize(support.getId());
Icon icon = FileTypeManager.getInstance().getFileTypeByExtension(support.getId()).getIcon();
return new AnAction("Generic " + supportTitle, null, icon) {
@Override
public void actionPerformed(AnActionEvent e) {
final BaseInjection injection = new BaseInjection(support.getId());
injection.setDisplayName("New " + supportTitle + " Injection");
final BaseInjection newInjection = showDefaultInjectionUI(project, injection);
if (newInjection != null) {
consumer.consume(injection);
}
}
};
}
use of com.intellij.openapi.actionSystem.AnAction in project intellij-community by JetBrains.
the class AntConfigurationImpl method updateRegisteredActions.
private void updateRegisteredActions() {
final Project project = getProject();
if (project.isDisposed()) {
return;
}
final List<Pair<String, AnAction>> actionList = new ArrayList<>();
for (final AntBuildFile buildFile : myBuildFiles) {
final AntBuildModelBase model = (AntBuildModelBase) buildFile.getModel();
String defaultTargetActionId = model.getDefaultTargetActionId();
if (defaultTargetActionId != null) {
final TargetAction action = new TargetAction(buildFile, TargetAction.DEFAULT_TARGET_NAME, new String[] { TargetAction.DEFAULT_TARGET_NAME }, null);
actionList.add(new Pair<>(defaultTargetActionId, action));
}
collectTargetActions(model.getFilteredTargets(), actionList, buildFile);
collectTargetActions(getMetaTargets(buildFile), actionList, buildFile);
}
//noinspection SynchronizeOnThis
synchronized (this) {
// unregister Ant actions
ActionManagerEx actionManager = ActionManagerEx.getInstanceEx();
final String[] oldIds = actionManager.getActionIds(AntConfiguration.getActionIdPrefix(project));
for (String oldId : oldIds) {
actionManager.unregisterAction(oldId);
}
final Set<String> registeredIds = StringSetSpinAllocator.alloc();
try {
for (Pair<String, AnAction> pair : actionList) {
if (!registeredIds.contains(pair.first)) {
registeredIds.add(pair.first);
actionManager.registerAction(pair.first, pair.second);
}
}
} finally {
StringSetSpinAllocator.dispose(registeredIds);
}
}
}
use of com.intellij.openapi.actionSystem.AnAction in project intellij-community by JetBrains.
the class ImportTree method createIncludeAction.
public AnAction createIncludeAction() {
return new AnAction(CvsBundle.message("import.wizard.include.to.import.action.name"), null, IconUtil.getAddIcon()) {
public void update(AnActionEvent e) {
final VirtualFile[] selectedFiles = myFileSystemTree.getSelectedFiles();
final Presentation presentation = e.getPresentation();
presentation.setEnabled(isAtLeastOneFileExcluded(selectedFiles));
}
public void actionPerformed(AnActionEvent e) {
final VirtualFile[] selectedFiles = myFileSystemTree.getSelectedFiles();
for (VirtualFile selectedFile : selectedFiles) {
include(selectedFile);
}
myWizard.updateStep();
myFileSystemTree.getTree().repaint();
}
};
}
Aggregations