Lines 44-50
Link Here
|
44 |
|
44 |
|
45 |
package org.netbeans.modules.apisupport.project.ui; |
45 |
package org.netbeans.modules.apisupport.project.ui; |
46 |
|
46 |
|
47 |
import java.awt.event.ActionEvent; |
|
|
48 |
import java.io.IOException; |
47 |
import java.io.IOException; |
49 |
import java.util.ArrayList; |
48 |
import java.util.ArrayList; |
50 |
import java.util.Arrays; |
49 |
import java.util.Arrays; |
Lines 60-66
Link Here
|
60 |
import java.util.Set; |
59 |
import java.util.Set; |
61 |
import java.util.regex.Pattern; |
60 |
import java.util.regex.Pattern; |
62 |
import javax.lang.model.element.TypeElement; |
61 |
import javax.lang.model.element.TypeElement; |
63 |
import javax.swing.AbstractAction; |
|
|
64 |
import javax.swing.Action; |
62 |
import javax.swing.Action; |
65 |
import org.apache.tools.ant.module.api.support.ActionUtils; |
63 |
import org.apache.tools.ant.module.api.support.ActionUtils; |
66 |
import org.netbeans.api.annotations.common.CheckForNull; |
64 |
import org.netbeans.api.annotations.common.CheckForNull; |
Lines 70-75
Link Here
|
70 |
import org.netbeans.api.java.project.runner.JavaRunner; |
68 |
import org.netbeans.api.java.project.runner.JavaRunner; |
71 |
import org.netbeans.api.java.source.ElementHandle; |
69 |
import org.netbeans.api.java.source.ElementHandle; |
72 |
import org.netbeans.api.java.source.SourceUtils; |
70 |
import org.netbeans.api.java.source.SourceUtils; |
|
|
71 |
import org.netbeans.api.project.Project; |
73 |
import org.netbeans.api.project.ProjectManager; |
72 |
import org.netbeans.api.project.ProjectManager; |
74 |
import org.netbeans.modules.apisupport.project.NbModuleProject; |
73 |
import org.netbeans.modules.apisupport.project.NbModuleProject; |
75 |
import org.netbeans.modules.apisupport.project.NbModuleType; |
74 |
import org.netbeans.modules.apisupport.project.NbModuleType; |
Lines 88-98
Link Here
|
88 |
import org.netbeans.spi.project.support.ant.GeneratedFilesHelper; |
87 |
import org.netbeans.spi.project.support.ant.GeneratedFilesHelper; |
89 |
import org.netbeans.spi.project.ui.support.CommonProjectActions; |
88 |
import org.netbeans.spi.project.ui.support.CommonProjectActions; |
90 |
import org.netbeans.spi.project.ui.support.DefaultProjectOperations; |
89 |
import org.netbeans.spi.project.ui.support.DefaultProjectOperations; |
|
|
90 |
import org.netbeans.spi.project.ui.support.ProjectActionPerformer; |
91 |
import org.netbeans.spi.project.ui.support.ProjectSensitiveActions; |
91 |
import org.netbeans.spi.project.ui.support.ProjectSensitiveActions; |
92 |
import org.openide.DialogDisplayer; |
92 |
import org.openide.DialogDisplayer; |
93 |
import org.openide.ErrorManager; |
93 |
import org.openide.ErrorManager; |
94 |
import org.openide.NotifyDescriptor; |
94 |
import org.openide.NotifyDescriptor; |
95 |
import org.openide.actions.FindAction; |
95 |
import org.openide.awt.DynamicMenuContent; |
96 |
import org.openide.filesystems.FileObject; |
96 |
import org.openide.filesystems.FileObject; |
97 |
import org.openide.filesystems.FileUtil; |
97 |
import org.openide.filesystems.FileUtil; |
98 |
import org.openide.util.Exceptions; |
98 |
import org.openide.util.Exceptions; |
Lines 102-108
Link Here
|
102 |
import org.openide.util.RequestProcessor; |
102 |
import org.openide.util.RequestProcessor; |
103 |
import org.openide.util.Task; |
103 |
import org.openide.util.Task; |
104 |
import org.openide.util.Utilities; |
104 |
import org.openide.util.Utilities; |
105 |
import org.openide.util.actions.SystemAction; |
105 |
import org.openide.util.lookup.Lookups; |
106 |
|
106 |
|
107 |
public final class ModuleActions implements ActionProvider, ExecProject { |
107 |
public final class ModuleActions implements ActionProvider, ExecProject { |
108 |
static final String TEST_USERDIR_LOCK_PROP_NAME = "run.args.ide"; // NOI18N |
108 |
static final String TEST_USERDIR_LOCK_PROP_NAME = "run.args.ide"; // NOI18N |
Lines 115-120
Link Here
|
115 |
|
115 |
|
116 |
private static final RequestProcessor RP = new RequestProcessor(ModuleActions.class); |
116 |
private static final RequestProcessor RP = new RequestProcessor(ModuleActions.class); |
117 |
|
117 |
|
|
|
118 |
final public static class ActionFactory { |
119 |
public static Action unitTestAction() { |
120 |
Action a = ProjectSensitiveActions.projectSensitiveAction(new ProjectActionPerformer() { |
121 |
|
122 |
@Override |
123 |
public boolean enable(Project project) { |
124 |
if (!(project instanceof NbModuleProject)) return false; |
125 |
if (!((NbModuleProject)project).supportedTestTypes().contains("unit")) return false; // NOI18N |
126 |
|
127 |
ActionProvider ap = project.getLookup().lookup(ActionProvider.class); |
128 |
if (ap == null) return false; |
129 |
|
130 |
return ap.isActionEnabled(ActionProvider.COMMAND_TEST, Lookups.singleton(project)); |
131 |
} |
132 |
|
133 |
@Override |
134 |
public void perform(Project project) { |
135 |
assert project != null; |
136 |
|
137 |
ActionProvider ap = project.getLookup().lookup(ActionProvider.class); |
138 |
if (ap != null) { |
139 |
ap.invokeAction(ActionProvider.COMMAND_TEST, Lookups.singleton(project)); |
140 |
} |
141 |
} |
142 |
}, NbBundle.getMessage(ModuleActions.class, "ACTION_test"), null); // NOi18N |
143 |
|
144 |
a.putValue(DynamicMenuContent.HIDE_WHEN_DISABLED, true); |
145 |
|
146 |
return a; |
147 |
} |
148 |
|
149 |
public static Action checkBundleAction() { |
150 |
final Action[] as = new Action[1]; |
151 |
Action a = ProjectSensitiveActions.projectSensitiveAction(new ProjectActionPerformer() { |
152 |
|
153 |
@Override |
154 |
public boolean enable(Project project) { |
155 |
if (!(project instanceof NbModuleProject)) return false; |
156 |
|
157 |
NbModuleProject nProject = (NbModuleProject)project; |
158 |
|
159 |
if (as[0] != null) { |
160 |
as[0].putValue(DynamicMenuContent.HIDE_WHEN_DISABLED, nProject.getModuleType() != NbModuleType.NETBEANS_ORG); |
161 |
} |
162 |
|
163 |
return findMonitorXml(nProject) != null && |
164 |
nProject.getPathWithinNetBeansOrg() != null; |
165 |
} |
166 |
|
167 |
@Override |
168 |
public void perform(Project project) { |
169 |
assert project != null; |
170 |
assert project instanceof NbModuleProject; |
171 |
|
172 |
Properties props = new Properties(); |
173 |
|
174 |
NbModuleProject nProject = (NbModuleProject)project; |
175 |
props.put("modules", nProject.getPathWithinNetBeansOrg()); // NOI18N |
176 |
props.put("fixedmodules", ""); // NOI18N |
177 |
try { |
178 |
ActionUtils.runTarget(findMonitorXml(nProject), new String[] {"check-bundle-usage"}, props); // NOI18N |
179 |
} catch (IOException e) { |
180 |
Util.err.notify(e); |
181 |
} |
182 |
} |
183 |
|
184 |
private FileObject findMonitorXml(NbModuleProject project) { |
185 |
return project.getNbrootFileObject("nbbuild/monitor.xml"); // NOI18N |
186 |
} |
187 |
}, NbBundle.getMessage(ModuleActions.class, "ACTION_unused_bundle_keys"), null); |
188 |
|
189 |
as[0] = a; |
190 |
return a; |
191 |
} |
192 |
|
193 |
public static Action reloadAction() { |
194 |
Action a = ProjectSensitiveActions.projectSensitiveAction(new ProjectActionPerformer() { |
195 |
|
196 |
@Override |
197 |
public boolean enable(Project project) { |
198 |
if (!(project instanceof NbModuleProject)) return false; |
199 |
|
200 |
NbModuleProject nProject = (NbModuleProject)project; |
201 |
|
202 |
if (findBuildXml(nProject) == null) { |
203 |
return false; |
204 |
} |
205 |
if (Boolean.parseBoolean(nProject.evaluator().getProperty("is.autoload")) || Boolean.parseBoolean(nProject.evaluator().getProperty("is.eager"))) { // NOI18N |
206 |
return false; // #86395 |
207 |
} |
208 |
return nProject.getTestUserDirLockFile().isFile(); |
209 |
} |
210 |
|
211 |
@Override |
212 |
public void perform(Project project) { |
213 |
assert project != null; |
214 |
assert project instanceof NbModuleProject; |
215 |
|
216 |
NbModuleProject nProject = (NbModuleProject)project; |
217 |
|
218 |
if (!verifySufficientlyNewHarness(nProject)) { |
219 |
return; |
220 |
} |
221 |
|
222 |
try { |
223 |
ActionUtils.runTarget(findBuildXml(nProject), new String[]{"reload"}, null); |
224 |
} catch (IOException e) { |
225 |
Util.err.notify(e); |
226 |
} |
227 |
} |
228 |
}, NbBundle.getMessage(ModuleActions.class, "ACTION_reload"), null); |
229 |
|
230 |
return a; |
231 |
} |
232 |
|
233 |
public static Action reloadInIdeAction() { |
234 |
Action a = ProjectSensitiveActions.projectSensitiveAction(new ProjectActionPerformer() { |
235 |
|
236 |
@Override |
237 |
public boolean enable(Project project) { |
238 |
if (!(project instanceof NbModuleProject)) return false; |
239 |
|
240 |
NbModuleProject nProject = (NbModuleProject)project; |
241 |
if (findBuildXml(nProject) == null) { |
242 |
return false; |
243 |
} |
244 |
if (Boolean.parseBoolean(nProject.evaluator().getProperty("is.autoload")) || Boolean.parseBoolean(nProject.evaluator().getProperty("is.eager"))) { // NOI18N |
245 |
return false; // #86395 |
246 |
} |
247 |
NbModuleType type = nProject.getModuleType(); |
248 |
if (type == NbModuleType.NETBEANS_ORG) { |
249 |
return true; |
250 |
} else if (type == NbModuleType.STANDALONE) { |
251 |
NbPlatform p = nProject.getPlatform(false); |
252 |
return p != null && p.isDefault(); |
253 |
} else { |
254 |
assert type == NbModuleType.SUITE_COMPONENT : type; |
255 |
try { |
256 |
SuiteProject suite = SuiteUtils.findSuite(project); |
257 |
if (suite == null) { |
258 |
return false; |
259 |
} |
260 |
NbPlatform p = suite.getPlatform(false); |
261 |
if (/* #67148 */p == null || !p.isDefault()) { |
262 |
return false; |
263 |
} |
264 |
return SuiteProperties.getArrayProperty(suite.getEvaluator(), SuiteProperties.ENABLED_CLUSTERS_PROPERTY).length == 0 && |
265 |
SuiteProperties.getArrayProperty(suite.getEvaluator(), SuiteProperties.DISABLED_CLUSTERS_PROPERTY).length == 0 && |
266 |
SuiteProperties.getArrayProperty(suite.getEvaluator(), SuiteProperties.DISABLED_MODULES_PROPERTY).length == 0; |
267 |
} catch (IOException e) { |
268 |
Util.err.notify(ErrorManager.INFORMATIONAL, e); |
269 |
return false; |
270 |
} |
271 |
} |
272 |
} |
273 |
|
274 |
@Override |
275 |
public void perform(Project project) { |
276 |
assert project != null; |
277 |
assert project instanceof NbModuleProject; |
278 |
|
279 |
NbModuleProject nProject = (NbModuleProject)project; |
280 |
|
281 |
if (!verifySufficientlyNewHarness(nProject)) { |
282 |
return; |
283 |
} |
284 |
if (ModuleUISettings.getDefault().getConfirmReloadInIDE()) { |
285 |
NotifyDescriptor d = new NotifyDescriptor.Confirmation( |
286 |
NbBundle.getMessage(ModuleActions.class, "LBL_reload_in_ide_confirm"), |
287 |
NbBundle.getMessage(ModuleActions.class, "LBL_reload_in_ide_confirm_title"), |
288 |
NotifyDescriptor.OK_CANCEL_OPTION); |
289 |
if (DialogDisplayer.getDefault().notify(d) != NotifyDescriptor.OK_OPTION) { |
290 |
return; |
291 |
} |
292 |
ModuleUISettings.getDefault().setConfirmReloadInIDE(false); // do not ask again |
293 |
} |
294 |
try { |
295 |
ActionUtils.runTarget(findBuildXml(nProject), new String[]{"reload-in-ide"}, null); |
296 |
} catch (IOException e) { |
297 |
Util.err.notify(e); |
298 |
} |
299 |
} |
300 |
}, NbBundle.getMessage(ModuleActions.class, "ACTION_reload_in_ide"), null); |
301 |
|
302 |
return a; |
303 |
} |
304 |
|
305 |
public static Action createNbmAction() { |
306 |
Action a = ProjectSensitiveActions.projectSensitiveAction(new ProjectActionPerformer() { |
307 |
@Override |
308 |
public boolean enable(Project project) { |
309 |
if (!(project instanceof NbModuleProject)) return false; |
310 |
|
311 |
return findBuildXml((NbModuleProject)project) != null; |
312 |
} |
313 |
|
314 |
@Override |
315 |
public void perform(Project project) { |
316 |
assert project != null; |
317 |
assert project instanceof NbModuleProject; |
318 |
|
319 |
NbModuleProject nProject = (NbModuleProject)project; |
320 |
|
321 |
if (!verifySufficientlyNewHarness(nProject)) { |
322 |
return; |
323 |
} |
324 |
try { |
325 |
ActionUtils.runTarget(findBuildXml(nProject), new String[]{"nbm"}, null); |
326 |
} catch (IOException e) { |
327 |
Util.err.notify(e); |
328 |
} |
329 |
} |
330 |
}, NbBundle.getMessage(ModuleActions.class, "ACTION_nbm"), null); |
331 |
return a; |
332 |
} |
333 |
|
334 |
public static Action archAction() { |
335 |
Action a = ProjectSensitiveActions.projectSensitiveAction(new ProjectActionPerformer() { |
336 |
@Override |
337 |
public boolean enable(Project project) { |
338 |
if (!(project instanceof NbModuleProject)) return false; |
339 |
|
340 |
return findBuildXml((NbModuleProject)project) != null; |
341 |
} |
342 |
|
343 |
@Override |
344 |
public void perform(Project project) { |
345 |
assert project != null; |
346 |
assert project instanceof NbModuleProject; |
347 |
|
348 |
final NbModuleProject nProject = (NbModuleProject)project; |
349 |
|
350 |
if (!verifySufficientlyNewHarness(nProject)) { |
351 |
return; |
352 |
} |
353 |
ProjectManager.mutex().writeAccess(new Mutex.Action<Void>() { |
354 |
public Void run() { |
355 |
String prop = "javadoc.arch"; // NOI18N |
356 |
if (nProject.evaluator().getProperty(prop) == null) { |
357 |
// User has not yet configured an arch desc. Assume we should just do it for them. |
358 |
EditableProperties props = nProject.getHelper().getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH); |
359 |
props.setProperty(prop, "${basedir}/arch.xml"); // NOI18N |
360 |
nProject.getHelper().putProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH, props); |
361 |
try { |
362 |
ProjectManager.getDefault().saveProject(nProject); |
363 |
} catch (IOException e) { |
364 |
Util.err.notify(e); |
365 |
} |
366 |
} |
367 |
return null; |
368 |
} |
369 |
}); |
370 |
try { |
371 |
ActionUtils.runTarget(findBuildXml(nProject), new String[] {"arch-nb"}, null); // NOI18N |
372 |
} catch (IOException e) { |
373 |
Util.err.notify(e); |
374 |
} |
375 |
} |
376 |
}, NbBundle.getMessage(ModuleActions.class, "ACTION_arch"), null); |
377 |
|
378 |
return a; |
379 |
} |
380 |
} |
381 |
|
118 |
@Override |
382 |
@Override |
119 |
public Task execute(String... args) throws IOException { |
383 |
public Task execute(String... args) throws IOException { |
120 |
StringBuilder sb = new StringBuilder(); |
384 |
StringBuilder sb = new StringBuilder(); |
Lines 128-175
Link Here
|
128 |
} |
392 |
} |
129 |
|
393 |
|
130 |
static Action[] getProjectActions(NbModuleProject project) { |
394 |
static Action[] getProjectActions(NbModuleProject project) { |
131 |
List<Action> actions = new ArrayList<Action>(); |
395 |
return CommonProjectActions.forType("org-netbeans-modules-apisupport-project"); |
132 |
actions.add(CommonProjectActions.newFileAction()); |
|
|
133 |
actions.add(null); |
134 |
actions.add(ProjectSensitiveActions.projectCommandAction(ActionProvider.COMMAND_BUILD, NbBundle.getMessage(ModuleActions.class, "ACTION_build"), null)); |
135 |
actions.add(ProjectSensitiveActions.projectCommandAction(ActionProvider.COMMAND_REBUILD, NbBundle.getMessage(ModuleActions.class, "ACTION_rebuild"), null)); |
136 |
actions.add(ProjectSensitiveActions.projectCommandAction(ActionProvider.COMMAND_CLEAN, NbBundle.getMessage(ModuleActions.class, "ACTION_clean"), null)); |
137 |
actions.add(null); |
138 |
actions.add(ProjectSensitiveActions.projectCommandAction(ActionProvider.COMMAND_RUN, NbBundle.getMessage(ModuleActions.class, "ACTION_run"), null)); |
139 |
actions.add(ProjectSensitiveActions.projectCommandAction(ActionProvider.COMMAND_DEBUG, NbBundle.getMessage(ModuleActions.class, "ACTION_debug"), null)); |
140 |
actions.addAll(Utilities.actionsForPath("Projects/Profiler_Actions_temporary")); //NOI18N |
141 |
if (project.supportedTestTypes().contains("unit")) { // NOI18N |
142 |
actions.add(ProjectSensitiveActions.projectCommandAction(ActionProvider.COMMAND_TEST, NbBundle.getMessage(ModuleActions.class, "ACTION_test"), null)); |
143 |
} |
144 |
actions.add(null); |
145 |
boolean isNetBeansOrg = project.getModuleType() == NbModuleType.NETBEANS_ORG; |
146 |
if (isNetBeansOrg) { |
147 |
actions.add(createCheckBundleAction(project, NbBundle.getMessage(ModuleActions.class, "ACTION_unused_bundle_keys"))); |
148 |
actions.add(null); |
149 |
} |
150 |
actions.add(createReloadAction(project, new String[] {"reload"}, NbBundle.getMessage(ModuleActions.class, "ACTION_reload"), false)); |
151 |
actions.add(createReloadAction(project, new String[] {"reload-in-ide"}, NbBundle.getMessage(ModuleActions.class, "ACTION_reload_in_ide"), true)); |
152 |
actions.add(createSimpleAction(project, new String[] {"nbm"}, NbBundle.getMessage(ModuleActions.class, "ACTION_nbm"))); |
153 |
actions.add(null); |
154 |
actions.add(ProjectSensitiveActions.projectCommandAction(JavaProjectConstants.COMMAND_JAVADOC, NbBundle.getMessage(ModuleActions.class, "ACTION_javadoc"), null)); |
155 |
actions.add(createArchAction(project)); |
156 |
actions.add(null); |
157 |
actions.add(CommonProjectActions.setAsMainProjectAction()); |
158 |
actions.add(CommonProjectActions.openSubprojectsAction()); |
159 |
actions.add(CommonProjectActions.closeProjectAction()); |
160 |
actions.add(null); |
161 |
actions.add(CommonProjectActions.renameProjectAction()); |
162 |
actions.add(CommonProjectActions.moveProjectAction()); |
163 |
actions.add(CommonProjectActions.copyProjectAction()); |
164 |
actions.add(CommonProjectActions.deleteProjectAction()); |
165 |
|
166 |
actions.add(null); |
167 |
actions.add(SystemAction.get(FindAction.class)); |
168 |
// Honor #57874 contract: |
169 |
actions.addAll(Utilities.actionsForPath("Projects/Actions")); // NOI18N |
170 |
actions.add(null); |
171 |
actions.add(CommonProjectActions.customizeProjectAction()); |
172 |
return actions.toArray(new Action[actions.size()]); |
173 |
} |
396 |
} |
174 |
|
397 |
|
175 |
private final NbModuleProject project; |
398 |
private final NbModuleProject project; |
Lines 634-773
Link Here
|
634 |
|
857 |
|
635 |
return false; |
858 |
return false; |
636 |
} |
859 |
} |
637 |
|
|
|
638 |
private static Action createSimpleAction(final NbModuleProject project, final String[] targetNames, String displayName) { |
639 |
return new AbstractAction(displayName) { |
640 |
public @Override boolean isEnabled() { |
641 |
return findBuildXml(project) != null; |
642 |
} |
643 |
public void actionPerformed(ActionEvent ignore) { |
644 |
if (!verifySufficientlyNewHarness(project)) { |
645 |
return; |
646 |
} |
647 |
try { |
648 |
ActionUtils.runTarget(findBuildXml(project), targetNames, null); |
649 |
} catch (IOException e) { |
650 |
Util.err.notify(e); |
651 |
} |
652 |
} |
653 |
}; |
654 |
} |
655 |
|
656 |
private static Action createCheckBundleAction(final NbModuleProject project, String displayName) { |
657 |
return new AbstractAction(displayName) { |
658 |
public @Override boolean isEnabled() { |
659 |
return findMonitorXml() != null && project.getPathWithinNetBeansOrg() != null; |
660 |
} |
661 |
public void actionPerformed(ActionEvent ignore) { |
662 |
Properties props = new Properties(); |
663 |
props.put("modules", project.getPathWithinNetBeansOrg()); // NOI18N |
664 |
props.put("fixedmodules", ""); // NOI18N |
665 |
try { |
666 |
ActionUtils.runTarget(findMonitorXml(), new String[] {"check-bundle-usage"}, props); // NOI18N |
667 |
} catch (IOException e) { |
668 |
Util.err.notify(e); |
669 |
} |
670 |
} |
671 |
private FileObject findMonitorXml() { |
672 |
return project.getNbrootFileObject("nbbuild/monitor.xml"); // NOI18N |
673 |
} |
674 |
}; |
675 |
} |
676 |
|
677 |
private static Action createReloadAction(final NbModuleProject project, final String[] targetNames, String displayName, final boolean inIDE) { |
678 |
return new AbstractAction(displayName) { |
679 |
public @Override boolean isEnabled() { |
680 |
if (findBuildXml(project) == null) { |
681 |
return false; |
682 |
} |
683 |
if (Boolean.parseBoolean(project.evaluator().getProperty("is.autoload")) || Boolean.parseBoolean(project.evaluator().getProperty("is.eager"))) { // NOI18N |
684 |
return false; // #86395 |
685 |
} |
686 |
if (!inIDE) { |
687 |
return project.getTestUserDirLockFile().isFile(); |
688 |
} |
689 |
NbModuleType type = project.getModuleType(); |
690 |
if (type == NbModuleType.NETBEANS_ORG) { |
691 |
return true; |
692 |
} else if (type == NbModuleType.STANDALONE) { |
693 |
NbPlatform p = project.getPlatform(false); |
694 |
return p != null && p.isDefault(); |
695 |
} else { |
696 |
assert type == NbModuleType.SUITE_COMPONENT : type; |
697 |
try { |
698 |
SuiteProject suite = SuiteUtils.findSuite(project); |
699 |
if (suite == null) { |
700 |
return false; |
701 |
} |
702 |
NbPlatform p = suite.getPlatform(false); |
703 |
if (/* #67148 */p == null || !p.isDefault()) { |
704 |
return false; |
705 |
} |
706 |
return SuiteProperties.getArrayProperty(suite.getEvaluator(), SuiteProperties.ENABLED_CLUSTERS_PROPERTY).length == 0 && |
707 |
SuiteProperties.getArrayProperty(suite.getEvaluator(), SuiteProperties.DISABLED_CLUSTERS_PROPERTY).length == 0 && |
708 |
SuiteProperties.getArrayProperty(suite.getEvaluator(), SuiteProperties.DISABLED_MODULES_PROPERTY).length == 0; |
709 |
} catch (IOException e) { |
710 |
Util.err.notify(ErrorManager.INFORMATIONAL, e); |
711 |
return false; |
712 |
} |
713 |
} |
714 |
} |
715 |
public void actionPerformed(ActionEvent ignore) { |
716 |
if (!verifySufficientlyNewHarness(project)) { |
717 |
return; |
718 |
} |
719 |
if (inIDE && ModuleUISettings.getDefault().getConfirmReloadInIDE()) { |
720 |
NotifyDescriptor d = new NotifyDescriptor.Confirmation( |
721 |
NbBundle.getMessage(ModuleActions.class, "LBL_reload_in_ide_confirm"), |
722 |
NbBundle.getMessage(ModuleActions.class, "LBL_reload_in_ide_confirm_title"), |
723 |
NotifyDescriptor.OK_CANCEL_OPTION); |
724 |
if (DialogDisplayer.getDefault().notify(d) != NotifyDescriptor.OK_OPTION) { |
725 |
return; |
726 |
} |
727 |
ModuleUISettings.getDefault().setConfirmReloadInIDE(false); // do not ask again |
728 |
} |
729 |
try { |
730 |
ActionUtils.runTarget(findBuildXml(project), targetNames, null); |
731 |
} catch (IOException e) { |
732 |
Util.err.notify(e); |
733 |
} |
734 |
} |
735 |
}; |
736 |
} |
737 |
|
738 |
private static Action createArchAction(final NbModuleProject project) { |
739 |
return new AbstractAction(NbBundle.getMessage(ModuleActions.class, "ACTION_arch")) { |
740 |
public @Override boolean isEnabled() { |
741 |
return findBuildXml(project) != null; |
742 |
} |
743 |
public void actionPerformed(ActionEvent ignore) { |
744 |
if (!verifySufficientlyNewHarness(project)) { |
745 |
return; |
746 |
} |
747 |
ProjectManager.mutex().writeAccess(new Mutex.Action<Void>() { |
748 |
public Void run() { |
749 |
String prop = "javadoc.arch"; // NOI18N |
750 |
if (project.evaluator().getProperty(prop) == null) { |
751 |
// User has not yet configured an arch desc. Assume we should just do it for them. |
752 |
EditableProperties props = project.getHelper().getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH); |
753 |
props.setProperty(prop, "${basedir}/arch.xml"); // NOI18N |
754 |
project.getHelper().putProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH, props); |
755 |
try { |
756 |
ProjectManager.getDefault().saveProject(project); |
757 |
} catch (IOException e) { |
758 |
Util.err.notify(e); |
759 |
} |
760 |
} |
761 |
return null; |
762 |
} |
763 |
}); |
764 |
try { |
765 |
ActionUtils.runTarget(findBuildXml(project), new String[] {"arch-nb"}, null); // NOI18N |
766 |
} catch (IOException e) { |
767 |
Util.err.notify(e); |
768 |
} |
769 |
} |
770 |
}; |
771 |
} |
772 |
|
773 |
} |
860 |
} |