cleanup
[fedora-idea.git] / java / compiler / impl / src / com / intellij / compiler / actions / BuildArtifactActionGroup.java
blobcae981933a703c43063caf92dd6abd9e018b7674
1 /*
2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package com.intellij.compiler.actions;
18 import com.intellij.openapi.actionSystem.ActionGroup;
19 import com.intellij.openapi.actionSystem.AnAction;
20 import com.intellij.openapi.actionSystem.AnActionEvent;
21 import com.intellij.openapi.actionSystem.PlatformDataKeys;
22 import com.intellij.openapi.project.Project;
23 import com.intellij.openapi.util.text.StringUtil;
24 import com.intellij.packaging.artifacts.Artifact;
25 import com.intellij.packaging.artifacts.ArtifactManager;
26 import org.jetbrains.annotations.NotNull;
27 import org.jetbrains.annotations.Nullable;
29 import java.util.ArrayList;
30 import java.util.List;
32 /**
33 * @author nik
35 public class BuildArtifactActionGroup extends ActionGroup {
36 public BuildArtifactActionGroup() {
37 super("Build Artifact", true);
40 @NotNull
41 public AnAction[] getChildren(@Nullable AnActionEvent e) {
42 if (e == null) return EMPTY_ARRAY;
43 final Project project = e.getData(PlatformDataKeys.PROJECT);
44 if (project == null) return EMPTY_ARRAY;
46 final Artifact[] artifacts = ArtifactManager.getInstance(project).getSortedArtifacts();
47 List<AnAction> actions = new ArrayList<AnAction>();
48 for (Artifact artifact : artifacts) {
49 if (!StringUtil.isEmpty(artifact.getOutputPath())) {
50 actions.add(new BuildArtifactAction(project, artifact));
53 return actions.toArray(new AnAction[actions.size()]);