private void createMetaTargets(final AntBuildFileBase buildFile) { Arrays.stream(metaTargets).forEach(meta -> { final ExecuteCompositeTargetEvent event = new ExecuteCompositeTargetEvent(meta); if (antConfiguration.getTargetForEvent(event) == null) { antConfiguration.setTargetForEvent(buildFile, event.getMetaTargetName(), event); } }); }
public SaveMetaTargetDialog(final Component parent, final ExecuteCompositeTargetEvent event, final AntConfigurationBase antConfiguration, final AntBuildFile buildFile) { super(parent, true); myInitialEvent = event; myAntConfiguration = antConfiguration; myBuildFile = buildFile; setModal(true); init(); }
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()); } }
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; }
public void actionPerformed(AnActionEvent e) { final AntBuildFile buildFile = getCurrentBuildFile(); final String[] targets = getTargetNamesFromPaths(myTree.getSelectionPaths()); final ExecuteCompositeTargetEvent event = new ExecuteCompositeTargetEvent(targets); final SaveMetaTargetDialog dialog = new SaveMetaTargetDialog(myTree, event, AntConfigurationBase.getInstance(myProject), buildFile); dialog.setTitle(e.getPresentation().getText()); dialog.show(); if (dialog.isOK()) { myBuilder.queueUpdate(); myTree.repaint(); } }
private void doAction() { final TreePath[] paths = myTree.getSelectionPaths(); if (paths == null) { return; } try { // try to remove build file if (paths.length == 1) { final DefaultMutableTreeNode node = (DefaultMutableTreeNode)paths[0].getLastPathComponent(); if (node.getUserObject() instanceof AntBuildFileNodeDescriptor) { final AntBuildFileNodeDescriptor descriptor = (AntBuildFileNodeDescriptor)node.getUserObject(); if (descriptor.getBuildFile().equals(getCurrentBuildFile())) { removeBuildFile(); return; } } } // try to remove meta targets final AntBuildTarget[] targets = getTargetObjectsFromPaths(paths); final AntConfigurationBase antConfiguration = AntConfigurationBase.getInstance(myProject); for (final AntBuildTarget buildTarget : targets) { if (buildTarget instanceof MetaTarget) { for (final ExecutionEvent event : antConfiguration.getEventsForTarget(buildTarget)) { if (event instanceof ExecuteCompositeTargetEvent) { antConfiguration.clearTargetForEvent(event); } } } } } finally { myBuilder.queueUpdate(); myTree.repaint(); } }