diff --git a/java/compiler/impl/src/com/intellij/compiler/actions/BuildAllArtifactsAction.java b/java/compiler/impl/src/com/intellij/compiler/actions/BuildAllArtifactsAction.java new file mode 100644 index 000000000000..e21e4183ed7f --- /dev/null +++ b/java/compiler/impl/src/com/intellij/compiler/actions/BuildAllArtifactsAction.java @@ -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 toBuild = new ArrayList(); + for (Artifact artifact : ArtifactManager.getInstance(project).getSortedArtifacts()) { + if (!StringUtil.isEmpty(artifact.getOutputPath())) { + toBuild.add(artifact); + } + } + CompilerManager.getInstance(project).make(ArtifactCompileScope.createArtifactsScope(project, toBuild), null); + } +} diff --git a/java/compiler/impl/src/com/intellij/compiler/actions/BuildArtifactActionGroup.java b/java/compiler/impl/src/com/intellij/compiler/actions/BuildArtifactActionGroup.java index cae981933a70..521e1d2dbbaa 100644 --- a/java/compiler/impl/src/com/intellij/compiler/actions/BuildArtifactActionGroup.java +++ b/java/compiler/impl/src/com/intellij/compiler/actions/BuildArtifactActionGroup.java @@ -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()]); } + } diff --git a/platform/platform-resources-en/src/messages/ActionsBundle.properties b/platform/platform-resources-en/src/messages/ActionsBundle.properties index f865108d50b6..c7471702fe8a 100644 --- a/platform/platform-resources-en/src/messages/ActionsBundle.properties +++ b/platform/platform-resources-en/src/messages/ActionsBundle.properties @@ -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 diff --git a/resources/src/idea/IdeaActions.xml b/resources/src/idea/IdeaActions.xml index eb8474183030..25b0ceb66668 100644 --- a/resources/src/idea/IdeaActions.xml +++ b/resources/src/idea/IdeaActions.xml @@ -182,6 +182,8 @@ + +