Java 类com.intellij.lang.ant.config.impl.MetaTarget 实例源码

项目:intellij-ce-playground    文件:AntExplorerTreeStructure.java   
@Override
@Nullable
public Object getParentElement(Object element) {
  if (element instanceof AntBuildTarget) {
    if (element instanceof MetaTarget) {
      return ((MetaTarget)element).getBuildFile();
    }
    return ((AntBuildTarget)element).getModel().getBuildFile();
  }

  if (element instanceof AntBuildFile) {
    return myRoot;
  }

  return null;
}
项目:intellij-ce-playground    文件:AntBuildGroup.java   
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);
  }
}
项目:tools-idea    文件:AntExplorerTreeStructure.java   
@Override
@Nullable
public Object getParentElement(Object element) {
  if (element instanceof AntBuildTarget) {
    if (element instanceof MetaTarget) {
      return ((MetaTarget)element).getBuildFile();
    }
    return ((AntBuildTarget)element).getModel().getBuildFile();
  }

  if (element instanceof AntBuildFile) {
    return myRoot;
  }

  return null;
}
项目:tools-idea    文件:AntBuildGroup.java   
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);
  }
}
项目:consulo-apache-ant    文件:AntExplorer.java   
private static String[] getTargetNamesFromPaths(TreePath[] paths) {
  final List<String> targets = new ArrayList<String>();
  for (final TreePath path : paths) {
    final Object userObject = ((DefaultMutableTreeNode)path.getLastPathComponent()).getUserObject();
    if (!(userObject instanceof AntTargetNodeDescriptor)) {
      continue;
    }
    final AntBuildTarget target = ((AntTargetNodeDescriptor)userObject).getTarget();
    if (target instanceof MetaTarget) {
      ContainerUtil.addAll(targets, ((MetaTarget)target).getTargetNames());
    }
    else {
      targets.add(target.getName());
    }
  }
  return ArrayUtil.toStringArray(targets);
}
项目:consulo-apache-ant    文件:AntExplorerTreeStructure.java   
@Override
@Nullable
public Object getParentElement(Object element) {
  if (element instanceof AntBuildTarget) {
    if (element instanceof MetaTarget) {
      return ((MetaTarget)element).getBuildFile();
    }
    return ((AntBuildTarget)element).getModel().getBuildFile();
  }

  if (element instanceof AntBuildFile) {
    return myRoot;
  }

  return null;
}
项目:consulo-apache-ant    文件:AntBuildActionGroup.java   
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);
  }
}
项目:consulo-apache-ant    文件:AntExplorer.java   
public void setSelected(AnActionEvent event, boolean state) {
  final AntConfigurationBase antConfiguration = AntConfigurationBase.getInstance(myProject);
  if (state) {
    final AntBuildFileBase buildFile =
      (AntBuildFileBase)((myTarget instanceof MetaTarget) ? ((MetaTarget)myTarget).getBuildFile() : myTarget.getModel().getBuildFile());
    antConfiguration.setTargetForEvent(buildFile, myTarget.getName(), myExecutionEvent);
  }
  else {
    antConfiguration.clearTargetForEvent(myExecutionEvent);
  }
  myBuilder.queueUpdate();
}
项目:consulo-apache-ant    文件:AntExplorer.java   
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();
  }
}