use of com.intellij.lang.ant.config.actions.TargetAction 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.lang.ant.config.actions.TargetAction in project intellij-community by JetBrains.
the class AntConfigurationImpl method collectTargetActions.
private static void collectTargetActions(final AntBuildTarget[] targets, final List<Pair<String, AnAction>> actionList, final AntBuildFile buildFile) {
for (final AntBuildTarget target : targets) {
final String actionId = ((AntBuildTargetBase) target).getActionId();
if (actionId != null) {
final TargetAction action = new TargetAction(buildFile, target.getName(), new String[] { target.getName() }, target.getNotEmptyDescription());
actionList.add(new Pair<>(actionId, action));
}
}
}
Aggregations