private static void addGroupOfTargets(final AntBuildFile buildFile, final AntBuildTarget[] targets, final Set<String> addedTargetNames, final DefaultActionGroup group) { final DefaultActionGroup subgroup = new DefaultActionGroup(); for (final AntBuildTarget target : targets) { final String displayName = target.getName(); if (addedTargetNames.contains(displayName)) { continue; } addedTargetNames.add(displayName); final String[] targetsToRun = (target instanceof MetaTarget) ? ((MetaTarget)target).getTargetNames() : new String[]{displayName}; subgroup.add(getOrCreateAction(buildFile, displayName, targetsToRun, target.getNotEmptyDescription(), ((AntBuildTargetBase)target).getActionId())); } if (subgroup.getChildrenCount() > 0) { group.add(subgroup); } }
public BuildTask(final AntBuildTargetBase target, final AntDomElement task) { myTarget = target; myName = task.getXmlElementName(); final DomTarget domTarget = DomTarget.getTarget(task); if (domTarget != null) { myOffset = domTarget.getTextOffset(); } else { myOffset = task.getXmlTag().getTextOffset(); } }
private static AntBuildTarget[] getTargetObjectsFromPaths(TreePath[] paths) { final List<AntBuildTargetBase> targets = new ArrayList<AntBuildTargetBase>(); for (final TreePath path : paths) { final Object userObject = ((DefaultMutableTreeNode)path.getLastPathComponent()).getUserObject(); if (!(userObject instanceof AntTargetNodeDescriptor)) { continue; } final AntBuildTargetBase target = ((AntTargetNodeDescriptor)userObject).getTarget(); targets.add(target); } return targets.toArray(new AntBuildTargetBase[targets.size()]); }
private void popupInvoked(final Component comp, final int x, final int y) { Object userObject = null; final TreePath path = myTree.getSelectionPath(); if (path != null) { final DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent(); if (node != null) { userObject = node.getUserObject(); } } final DefaultActionGroup group = new DefaultActionGroup(); group.add(new RunAction()); group.add(new CreateMetaTargetAction()); group.add(new RemoveMetaTargetsOrBuildFileAction()); group.add(ActionManager.getInstance().getAction(IdeActions.ACTION_EDIT_SOURCE)); group.add(new AntGroupManagerActionGroup(null, myTree)); group.add(new RemoveGroupsAction(myTree)); if (userObject instanceof AntBuildFileNodeDescriptor) { group.add(new RemoveBuildFileAction(this)); } if (userObject instanceof AntTargetNodeDescriptor) { final AntBuildTargetBase target = ((AntTargetNodeDescriptor)userObject).getTarget(); final DefaultActionGroup executeOnGroup = new DefaultActionGroup(AntBundle.message("ant.explorer.execute.on.action.group.name"), true); executeOnGroup.add(new ExecuteOnEventAction(target, ExecuteBeforeCompilationEvent.getInstance())); executeOnGroup.add(new ExecuteOnEventAction(target, ExecuteAfterCompilationEvent.getInstance())); executeOnGroup.addSeparator(); executeOnGroup.add(new ExecuteBeforeRunAction(target)); group.add(executeOnGroup); group.add(new AssignShortcutAction(target.getActionId())); } group.add(myAntBuildFilePropertiesAction); final ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.ANT_EXPLORER_POPUP, group); popupMenu.getComponent().show(comp, x, y); }
@Nullable private OpenFileDescriptor getDescriptorForTargetNode(MessageNode node) { final String targetName = node.getText()[0]; final AntBuildTargetBase target = (AntBuildTargetBase)myBuildFile.getModel().findTarget(targetName); return (target == null) ? null : target.getOpenFileDescriptor(); }
public AntTargetNodeDescriptor(final Project project, final NodeDescriptor parentDescriptor, final AntBuildTargetBase target) { super(project, parentDescriptor); myTarget = target; myHighlightedText = new CompositeAppearance(); }
public AntBuildTargetBase getTarget() { return myTarget; }
public ExecuteOnEventAction(final AntBuildTargetBase target, final ExecutionEvent executionEvent) { super(executionEvent.getPresentableName()); myTarget = target; myExecutionEvent = executionEvent; }