Lines 44-50
Link Here
|
44 |
import java.awt.event.ActionEvent; |
44 |
import java.awt.event.ActionEvent; |
45 |
import java.io.IOException; |
45 |
import java.io.IOException; |
46 |
import java.util.ArrayList; |
46 |
import java.util.ArrayList; |
47 |
import java.util.Collection; |
|
|
48 |
import java.util.HashMap; |
47 |
import java.util.HashMap; |
49 |
import java.util.HashSet; |
48 |
import java.util.HashSet; |
50 |
import java.util.List; |
49 |
import java.util.List; |
Lines 54-60
Link Here
|
54 |
import java.util.regex.Pattern; |
53 |
import java.util.regex.Pattern; |
55 |
import javax.swing.AbstractAction; |
54 |
import javax.swing.AbstractAction; |
56 |
import javax.swing.Action; |
55 |
import javax.swing.Action; |
57 |
import javax.swing.JSeparator; |
|
|
58 |
import org.apache.tools.ant.module.api.support.ActionUtils; |
56 |
import org.apache.tools.ant.module.api.support.ActionUtils; |
59 |
import org.netbeans.api.java.project.JavaProjectConstants; |
57 |
import org.netbeans.api.java.project.JavaProjectConstants; |
60 |
import org.netbeans.api.project.ProjectManager; |
58 |
import org.netbeans.api.project.ProjectManager; |
Lines 79-89
Link Here
|
79 |
import org.openide.actions.FindAction; |
77 |
import org.openide.actions.FindAction; |
80 |
import org.openide.filesystems.FileObject; |
78 |
import org.openide.filesystems.FileObject; |
81 |
import org.openide.filesystems.FileUtil; |
79 |
import org.openide.filesystems.FileUtil; |
|
|
80 |
import org.openide.nodes.NodeOp; |
82 |
import org.openide.util.Lookup; |
81 |
import org.openide.util.Lookup; |
83 |
import org.openide.util.Mutex; |
82 |
import org.openide.util.Mutex; |
84 |
import org.openide.util.NbBundle; |
83 |
import org.openide.util.NbBundle; |
85 |
import org.openide.util.actions.SystemAction; |
84 |
import org.openide.util.actions.SystemAction; |
86 |
import org.openide.util.lookup.Lookups; |
|
|
87 |
|
85 |
|
88 |
public final class ModuleActions implements ActionProvider { |
86 |
public final class ModuleActions implements ActionProvider { |
89 |
|
87 |
|
Lines 104-110
Link Here
|
104 |
actions.add(createSimpleAction(project, new String[] {"run"}, NbBundle.getMessage(ModuleActions.class, "ACTION_run"))); |
102 |
actions.add(createSimpleAction(project, new String[] {"run"}, NbBundle.getMessage(ModuleActions.class, "ACTION_run"))); |
105 |
} |
103 |
} |
106 |
actions.add(ProjectSensitiveActions.projectCommandAction(ActionProvider.COMMAND_DEBUG, NbBundle.getMessage(ModuleActions.class, "ACTION_debug"), null)); |
104 |
actions.add(ProjectSensitiveActions.projectCommandAction(ActionProvider.COMMAND_DEBUG, NbBundle.getMessage(ModuleActions.class, "ACTION_debug"), null)); |
107 |
addFromLayers(actions, "Projects/Profiler_Actions_temporary"); //NOI18N |
105 |
actions.addAll(NodeOp.actionsForPath("Projects/Profiler_Actions_temporary")); //NOI18N |
108 |
if (project.supportsUnitTests()) { |
106 |
if (project.supportsUnitTests()) { |
109 |
actions.add(ProjectSensitiveActions.projectCommandAction(ActionProvider.COMMAND_TEST, NbBundle.getMessage(ModuleActions.class, "ACTION_test"), null)); |
107 |
actions.add(ProjectSensitiveActions.projectCommandAction(ActionProvider.COMMAND_TEST, NbBundle.getMessage(ModuleActions.class, "ACTION_test"), null)); |
110 |
} |
108 |
} |
Lines 132-163
Link Here
|
132 |
actions.add(null); |
130 |
actions.add(null); |
133 |
actions.add(SystemAction.get(FindAction.class)); |
131 |
actions.add(SystemAction.get(FindAction.class)); |
134 |
// Honor #57874 contract: |
132 |
// Honor #57874 contract: |
135 |
Collection<? extends Object> res = Lookups.forPath("Projects/Actions").lookupAll(Object.class); // NOI18N |
133 |
actions.addAll(NodeOp.actionsForPath("Projects/Actions")); // NOI18N |
136 |
if (!res.isEmpty()) { |
|
|
137 |
actions.add(null); |
138 |
for (Object next : res) { |
139 |
if (next instanceof Action) { |
140 |
actions.add((Action) next); |
141 |
} else if (next instanceof JSeparator) { |
142 |
actions.add(null); |
143 |
} |
144 |
} |
145 |
} |
146 |
|
147 |
actions.add(null); |
134 |
actions.add(null); |
148 |
actions.add(CommonProjectActions.customizeProjectAction()); |
135 |
actions.add(CommonProjectActions.customizeProjectAction()); |
149 |
return actions.toArray(new Action[actions.size()]); |
136 |
return actions.toArray(new Action[actions.size()]); |
150 |
} |
|
|
151 |
|
152 |
private static void addFromLayers(List<Action> actions, String path) { |
153 |
Lookup look = Lookups.forPath(path); |
154 |
for (Object next : look.lookupAll(Object.class)) { |
155 |
if (next instanceof Action) { |
156 |
actions.add((Action) next); |
157 |
} else if (next instanceof JSeparator) { |
158 |
actions.add(null); |
159 |
} |
160 |
} |
161 |
} |
137 |
} |
162 |
|
138 |
|
163 |
private final NbModuleProject project; |
139 |
private final NbModuleProject project; |