"Build All artifacts" action added

This commit is contained in:
nik
2009-12-21 16:19:56 +03:00
parent e4349f7b88
commit 856c443114
4 changed files with 66 additions and 6 deletions
@@ -0,0 +1,57 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.compiler.actions;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.compiler.CompilerManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.packaging.artifacts.Artifact;
import com.intellij.packaging.artifacts.ArtifactManager;
import com.intellij.packaging.impl.compiler.ArtifactCompileScope;
import java.util.ArrayList;
import java.util.List;
/**
* @author nik
*/
public class BuildAllArtifactsAction extends AnAction {
public BuildAllArtifactsAction() {
super("Build All Artifacts", "Build all configured artifacts", null);
}
@Override
public void update(AnActionEvent e) {
e.getPresentation().setEnabled(e.getData(PlatformDataKeys.PROJECT) != null);
}
@Override
public void actionPerformed(AnActionEvent e) {
final Project project = e.getData(PlatformDataKeys.PROJECT);
if (project == null) return;
List<Artifact> toBuild = new ArrayList<Artifact>();
for (Artifact artifact : ArtifactManager.getInstance(project).getSortedArtifacts()) {
if (!StringUtil.isEmpty(artifact.getOutputPath())) {
toBuild.add(artifact);
}
}
CompilerManager.getInstance(project).make(ArtifactCompileScope.createArtifactsScope(project, toBuild), null);
}
}
@@ -15,10 +15,7 @@
*/
package com.intellij.compiler.actions;
import com.intellij.openapi.actionSystem.ActionGroup;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.packaging.artifacts.Artifact;
@@ -50,6 +47,11 @@ public class BuildArtifactActionGroup extends ActionGroup {
actions.add(new BuildArtifactAction(project, artifact));
}
}
if (actions.size() > 1) {
actions.add(0, new BuildAllArtifactsAction());
actions.add(1, Separator.getInstance());
}
return actions.toArray(new AnAction[actions.size()]);
}
}
@@ -556,9 +556,8 @@ action.RunAPT.text=Process {0} _Annotations
action.RunAPT.description=Run Annotation Processors on the selected scope
action.GenerateAntBuild.text=_Generate Ant Build...
action.GenerateAntBuild.description=Generate Ant Build File from the Project
action.BuildAllArtifacts.text=Build All Artifacts
group.BuildArtifactsGroup.text=Build Artifact
action.BuildJar.text=Build _Jars...
action.BuildJar.description=Archive module output directories into jar files
group.RunMenu.text=R_un
group.RunnerActions.text=Run/Debug
action.editRunConfigurations.text=Edit Configu_rations
+2
View File
@@ -182,6 +182,8 @@
<add-to-group group-id="RefactoringMenu" anchor="after" relative-to-action="ReplaceMethodWithMethodObject"/>
</action>
<action id="BuildAllArtifacts" class="com.intellij.compiler.actions.BuildAllArtifactsAction"/>
<group id="BuildMenu" popup="true">
<action id="CompileDirty" class="com.intellij.compiler.actions.CompileDirtyAction" icon="/actions/compile.png"/>
<action id="MakeModule" class="com.intellij.compiler.actions.MakeModuleAction"/>