Search in sources :

Example 6 with AntBuildFile

use of com.intellij.lang.ant.config.AntBuildFile in project intellij-community by JetBrains.

the class AntWorkspaceConfiguration method writeExternal.

public void writeExternal(Element parentNode) throws WriteExternalException {
    DefaultJDOMExternalizer.writeExternal(this, parentNode);
    for (final AntBuildFile buildFile : AntConfiguration.getInstance(myProject).getBuildFileList()) {
        Element element = new Element(BUILD_FILE);
        element.setAttribute(URL, buildFile.getVirtualFile().getUrl());
        ((AntBuildFileBase) buildFile).writeWorkspaceProperties(element);
        parentNode.addContent(element);
    }
}
Also used : AntBuildFile(com.intellij.lang.ant.config.AntBuildFile) AntBuildFileBase(com.intellij.lang.ant.config.AntBuildFileBase) Element(org.jdom.Element)

Example 7 with AntBuildFile

use of com.intellij.lang.ant.config.AntBuildFile in project intellij-community by JetBrains.

the class GlobalAntConfiguration method findTarget.

public AntBuildTarget findTarget(Project project, String fileUrl, String targetName) {
    if (fileUrl == null || targetName == null || project == null) {
        return null;
    }
    final VirtualFile vFile = VirtualFileManager.getInstance().findFileByUrl(fileUrl);
    if (vFile == null) {
        return null;
    }
    final AntConfigurationImpl antConfiguration = (AntConfigurationImpl) AntConfiguration.getInstance(project);
    for (AntBuildFile buildFile : antConfiguration.getBuildFileList()) {
        if (vFile.equals(buildFile.getVirtualFile())) {
            final AntBuildTarget target = buildFile.getModel().findTarget(targetName);
            if (target != null) {
                return target;
            }
            for (AntBuildTarget metaTarget : antConfiguration.getMetaTargets(buildFile)) {
                if (targetName.equals(metaTarget.getName())) {
                    return metaTarget;
                }
            }
            return null;
        }
    }
    return null;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) AntBuildFile(com.intellij.lang.ant.config.AntBuildFile) AntBuildTarget(com.intellij.lang.ant.config.AntBuildTarget)

Example 8 with AntBuildFile

use of com.intellij.lang.ant.config.AntBuildFile in project intellij-community by JetBrains.

the class TargetAction method actionPerformed.

public void actionPerformed(AnActionEvent e) {
    Project project = e.getProject();
    if (project == null)
        return;
    for (final AntBuildFile buildFile : AntConfiguration.getInstance(project).getBuildFileList()) {
        final String name = buildFile.getPresentableName();
        if (name != null && myBuildName.equals(name)) {
            String[] targets = myTargets.length == 1 && DEFAULT_TARGET_NAME.equals(myTargets[0]) ? ArrayUtil.EMPTY_STRING_ARRAY : myTargets;
            ExecutionHandler.runBuild((AntBuildFileBase) buildFile, targets, null, e.getDataContext(), Collections.emptyList(), AntBuildListener.NULL);
            return;
        }
    }
}
Also used : Project(com.intellij.openapi.project.Project) AntBuildFile(com.intellij.lang.ant.config.AntBuildFile)

Aggregations

AntBuildFile (com.intellij.lang.ant.config.AntBuildFile)8 AntConfiguration (com.intellij.lang.ant.config.AntConfiguration)3 VirtualFile (com.intellij.openapi.vfs.VirtualFile)3 AntBuildFileBase (com.intellij.lang.ant.config.AntBuildFileBase)2 AntBuildTarget (com.intellij.lang.ant.config.AntBuildTarget)2 Project (com.intellij.openapi.project.Project)2 Element (org.jdom.Element)2 AntBuildModel (com.intellij.lang.ant.config.AntBuildModel)1 AntNoFileException (com.intellij.lang.ant.config.AntNoFileException)1 ActionManagerEx (com.intellij.openapi.actionSystem.ex.ActionManagerEx)1 KeymapGroup (com.intellij.openapi.keymap.KeymapGroup)1 Tree (com.intellij.ui.treeStructure.Tree)1 HashMap (com.intellij.util.containers.HashMap)1 HashSet (java.util.HashSet)1 TreeSelectionEvent (javax.swing.event.TreeSelectionEvent)1 TreeSelectionListener (javax.swing.event.TreeSelectionListener)1 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)1 TreePath (javax.swing.tree.TreePath)1 NonNls (org.jetbrains.annotations.NonNls)1 Nullable (org.jetbrains.annotations.Nullable)1