use of com.intellij.lang.ant.config.impl.ExecuteCompositeTargetEvent in project intellij-community by JetBrains.
the class AntTargetNodeDescriptor method update.
public boolean update() {
final CompositeAppearance oldText = myHighlightedText;
final boolean isMeta = myTarget instanceof MetaTarget;
setIcon(isMeta ? AntIcons.MetaTarget : AntIcons.Target);
myHighlightedText = new CompositeAppearance();
final AntBuildFile buildFile = isMeta ? ((MetaTarget) myTarget).getBuildFile() : myTarget.getModel().getBuildFile();
final Color color = buildFile.isTargetVisible(myTarget) ? UIUtil.getLabelForeground() : UIUtil.getLabelDisabledForeground();
TextAttributes nameAttributes = new TextAttributes(color, null, null, EffectType.BOXED, myTarget.isDefault() ? Font.BOLD : Font.PLAIN);
myHighlightedText.getEnding().addText(myTarget.getDisplayName(), nameAttributes);
AntConfigurationBase antConfiguration = AntConfigurationBase.getInstance(myProject);
final ArrayList<String> addedNames = new ArrayList<>(4);
for (final ExecutionEvent event : antConfiguration.getEventsForTarget(myTarget)) {
final String presentableName;
if ((event instanceof ExecuteCompositeTargetEvent)) {
presentableName = ((ExecuteCompositeTargetEvent) event).getMetaTargetName();
if (presentableName.equals(myTarget.getName())) {
continue;
}
} else {
presentableName = event.getPresentableName();
}
if (!addedNames.contains(presentableName)) {
addedNames.add(presentableName);
myHighlightedText.getEnding().addText(" (" + presentableName + ')', ourPostfixAttributes);
}
}
final RunManagerEx runManager = RunManagerEx.getInstanceEx(myProject);
final VirtualFile vFile = buildFile.getVirtualFile();
if (vFile != null) {
for (AntBeforeRunTask task : runManager.getBeforeRunTasks(AntBeforeRunTaskProvider.ID)) {
if (task.isRunningTarget(myTarget)) {
myHighlightedText.getEnding().addText(" (Before Run/Debug)", ourPostfixAttributes);
break;
}
}
}
myName = myHighlightedText.getText();
final AntBuildTargetBase target = getTarget();
if (!addShortcutText(target.getActionId())) {
if (target.isDefault()) {
addShortcutText(((AntBuildModelBase) target.getModel()).getDefaultTargetActionId());
}
}
return !Comparing.equal(myHighlightedText, oldText);
}
use of com.intellij.lang.ant.config.impl.ExecuteCompositeTargetEvent in project intellij-community by JetBrains.
the class SaveMetaTargetDialog method doOKAction.
protected void doOKAction() {
final ExecuteCompositeTargetEvent eventObject = createEventObject();
if (myAntConfiguration.getTargetForEvent(eventObject) == null) {
myAntConfiguration.setTargetForEvent(myBuildFile, eventObject.getMetaTargetName(), eventObject);
super.doOKAction();
} else {
Messages.showInfoMessage(getContentPane(), AntBundle.message("save.meta.data.such.sequence.of.targets.already.exists.error.message"), getTitle());
}
}
use of com.intellij.lang.ant.config.impl.ExecuteCompositeTargetEvent in project intellij-community by JetBrains.
the class SaveMetaTargetDialog method createEventObject.
private ExecuteCompositeTargetEvent createEventObject() {
final ListModel model = myTargetList.getModel();
final int size = model.getSize();
final String[] names = ArrayUtil.newStringArray(size);
for (int idx = 0; idx < size; idx++) {
names[idx] = (String) model.getElementAt(idx);
}
final ExecuteCompositeTargetEvent event = new ExecuteCompositeTargetEvent(names);
event.setPresentableName(myTfName.getText().trim());
return event;
}
Aggregations