This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 182488
Collapse All | Expand All

(-)a/ant.freeform/src/org/netbeans/modules/ant/freeform/Actions.java (-22 / +52 lines)
Lines 63-68 Link Here
63
import java.util.regex.PatternSyntaxException;
63
import java.util.regex.PatternSyntaxException;
64
import javax.swing.AbstractAction;
64
import javax.swing.AbstractAction;
65
import javax.swing.Action;
65
import javax.swing.Action;
66
import javax.swing.JComponent;
67
import javax.swing.JMenuItem;
68
import javax.swing.JSeparator;
66
import org.apache.tools.ant.module.api.support.ActionUtils;
69
import org.apache.tools.ant.module.api.support.ActionUtils;
67
import org.netbeans.modules.ant.freeform.spi.support.Util;
70
import org.netbeans.modules.ant.freeform.spi.support.Util;
68
import org.netbeans.modules.ant.freeform.ui.TargetMappingPanel;
71
import org.netbeans.modules.ant.freeform.ui.TargetMappingPanel;
Lines 76-87 Link Here
76
import org.openide.ErrorManager;
79
import org.openide.ErrorManager;
77
import org.openide.NotifyDescriptor;
80
import org.openide.NotifyDescriptor;
78
import org.openide.actions.FindAction;
81
import org.openide.actions.FindAction;
82
import org.openide.awt.DynamicMenuContent;
79
import org.openide.filesystems.FileObject;
83
import org.openide.filesystems.FileObject;
80
import org.openide.filesystems.FileUtil;
84
import org.openide.filesystems.FileUtil;
81
import org.openide.loaders.DataObject;
85
import org.openide.loaders.DataObject;
86
import org.openide.util.ContextAwareAction;
82
import org.openide.util.Lookup;
87
import org.openide.util.Lookup;
83
import org.openide.util.NbBundle;
88
import org.openide.util.NbBundle;
84
import org.openide.util.Utilities;
89
import org.openide.util.Utilities;
90
import org.openide.util.actions.Presenter;
85
import org.openide.util.actions.SystemAction;
91
import org.openide.util.actions.SystemAction;
86
import org.w3c.dom.Element;
92
import org.w3c.dom.Element;
87
93
Lines 443-458 Link Here
443
        }
449
        }
444
        TARGET_RUNNER.runTarget(scriptFile, targetNameArray, props);
450
        TARGET_RUNNER.runTarget(scriptFile, targetNameArray, props);
445
    }
451
    }
452
453
    public static final class Custom extends AbstractAction implements ContextAwareAction {
454
        public Custom() {
455
            setEnabled(false);
456
            putValue(DynamicMenuContent.HIDE_WHEN_DISABLED, true);
457
        }
458
        public @Override void actionPerformed(ActionEvent e) {
459
            assert false;
460
        }
461
        public @Override Action createContextAwareInstance(Lookup actionContext) {
462
            Collection<? extends FreeformProject> projects = actionContext.lookupAll(FreeformProject.class);
463
            if (projects.size() != 1) {
464
                return this;
465
            }
466
            final FreeformProject p = projects.iterator().next();
467
            class A extends AbstractAction implements Presenter.Popup {
468
                public @Override void actionPerformed(ActionEvent e) {
469
                    assert false;
470
                }
471
                public @Override JMenuItem getPopupPresenter() {
472
                    class M extends JMenuItem implements DynamicMenuContent {
473
                        public @Override JComponent[] getMenuPresenters() {
474
                            Action[] actions = contextMenuCustomActions(p);
475
                            JComponent[] comps = new JComponent[actions.length];
476
                            for (int i = 0; i < actions.length; i++) {
477
                                if (actions[i] != null) {
478
                                    JMenuItem item = new JMenuItem();
479
                                    org.openide.awt.Actions.connect(item, actions[i], true);
480
                                    comps[i] = item;
481
                                } else {
482
                                    comps[i] = new JSeparator();
483
                                }
484
                            }
485
                            return comps;
486
                        }
487
                        public @Override JComponent[] synchMenuPresenters(JComponent[] items) {
488
                            return getMenuPresenters();
489
                        }
490
                    }
491
                    return new M();
492
                }
493
            }
494
            return new A();
495
        }
496
    }
446
    
497
    
447
    /**
498
    /**
448
     * Build the context menu for a project.
499
     * Build the context menu for a project.
449
     * @param p a freeform project
500
     * @param p a freeform project
450
     * @return a list of actions (or null for separators)
501
     * @return a list of actions (or null for separators)
451
     */
502
     */
452
    public static Action[] createContextMenu(FreeformProject p) {
503
    private static Action[] contextMenuCustomActions(FreeformProject p) {
453
        List<Action> actions = new ArrayList<Action>();
504
        List<Action> actions = new ArrayList<Action>();
454
        actions.add(CommonProjectActions.newFileAction());
455
        // Requested actions.
456
        Element genldata = p.getPrimaryConfigurationData();
505
        Element genldata = p.getPrimaryConfigurationData();
457
        Element viewEl = Util.findElement(genldata, "view", FreeformProjectType.NS_GENERAL); // NOI18N
506
        Element viewEl = Util.findElement(genldata, "view", FreeformProjectType.NS_GENERAL); // NOI18N
458
        if (viewEl != null) {
507
        if (viewEl != null) {
Lines 479-503 Link Here
479
                }
528
                }
480
            }
529
            }
481
        }
530
        }
482
        actions.addAll(Utilities.actionsForPath("Projects/Profiler_Actions_temporary")); //NOI18N
483
        // Back to generic actions.
484
        actions.add(null);
485
        actions.add(CommonProjectActions.setAsMainProjectAction());
486
        actions.add(CommonProjectActions.openSubprojectsAction());
487
        actions.add(CommonProjectActions.closeProjectAction());
488
        actions.add(null);
489
        actions.add(CommonProjectActions.renameProjectAction());
490
        actions.add(CommonProjectActions.moveProjectAction());
491
        actions.add(CommonProjectActions.copyProjectAction());
492
        actions.add(CommonProjectActions.deleteProjectAction());
493
        actions.add(null);
494
        actions.add(SystemAction.get(FindAction.class));
495
        
496
        // honor #57874 contract, see #58624:
497
        actions.addAll(Utilities.actionsForPath("Projects/Actions"));
498
        
499
        actions.add(null);
500
        actions.add(CommonProjectActions.customizeProjectAction());
501
        return actions.toArray(new Action[actions.size()]);
531
        return actions.toArray(new Action[actions.size()]);
502
    }
532
    }
503
    
533
    
(-)a/ant.freeform/src/org/netbeans/modules/ant/freeform/resources/layer.xml (+78 lines)
Lines 58-63 Link Here
58
                    <attr name="position" intvalue="1000"/>
58
                    <attr name="position" intvalue="1000"/>
59
                </file>
59
                </file>
60
            </folder>
60
            </folder>
61
            <folder name="Actions">
62
                <file name="org-netbeans-modules-project-ui-NewFile$WithSubMenu.shadow">
63
                    <attr name="originalFile" stringvalue="Actions/Project/org-netbeans-modules-project-ui-NewFile$WithSubMenu.instance"/>
64
                    <attr name="position" intvalue="100"/>
65
                </file>
66
                <file name="sep-1.instance">
67
                    <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
68
                    <attr name="position" intvalue="200"/>
69
                </file>
70
                <file name="org-netbeans-modules-ant-freeform-Actions$Custom.instance">
71
                    <attr name="misplaced.action.allowed" boolvalue="true"/>
72
                    <attr name="position" intvalue="300"/>
73
                </file>
74
                <file name="sep-2.instance">
75
                    <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
76
                    <attr name="position" intvalue="400"/>
77
                </file>
78
                <file name="org-netbeans-modules-profiler-actions-ProfileProjectActionPopup.shadow">
79
                    <attr name="originalFile" stringvalue="Actions/Profile/org-netbeans-modules-profiler-actions-ProfileProjectActionPopup.instance"/>
80
                    <attr name="position" intvalue="500"/>
81
                </file>
82
                <file name="sep-3.instance">
83
                    <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
84
                    <attr name="position" intvalue="600"/>
85
                </file>
86
                <file name="org-netbeans-modules-project-ui-SetMainProject.shadow">
87
                    <attr name="originalFile" stringvalue="Actions/Project/org-netbeans-modules-project-ui-SetMainProject.instance"/>
88
                    <attr name="position" intvalue="700"/>
89
                </file>
90
                <file name="org-netbeans-modules-project-ui-actions-OpenSubprojects.shadow">
91
                    <attr name="originalFile" stringvalue="Actions/Project/org-netbeans-modules-project-ui-actions-OpenSubprojects.instance"/>
92
                    <attr name="position" intvalue="800"/>
93
                </file>
94
                <file name="org-netbeans-modules-project-ui-CloseProject.shadow">
95
                    <attr name="originalFile" stringvalue="Actions/Project/org-netbeans-modules-project-ui-CloseProject.instance"/>
96
                    <attr name="position" intvalue="900"/>
97
                </file>
98
                <file name="sep-4.instance">
99
                    <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
100
                    <attr name="position" intvalue="1000"/>
101
                </file>
102
                <file name="org-netbeans-modules-project-ui-RenameProject.shadow">
103
                    <attr name="originalFile" stringvalue="Actions/Project/org-netbeans-modules-project-ui-RenameProject.instance"/>
104
                    <attr name="position" intvalue="1100"/>
105
                </file>
106
                <file name="org-netbeans-modules-project-ui-MoveProject.shadow">
107
                    <attr name="originalFile" stringvalue="Actions/Project/org-netbeans-modules-project-ui-MoveProject.instance"/>
108
                    <attr name="position" intvalue="1200"/>
109
                </file>
110
                <file name="org-netbeans-modules-project-ui-CopyProject.shadow">
111
                    <attr name="originalFile" stringvalue="Actions/Project/org-netbeans-modules-project-ui-CopyProject.instance"/>
112
                    <attr name="position" intvalue="1300"/>
113
                </file>
114
                <file name="org-netbeans-modules-project-ui-DeleteProject.shadow">
115
                    <attr name="originalFile" stringvalue="Actions/Project/org-netbeans-modules-project-ui-DeleteProject.instance"/>
116
                    <attr name="position" intvalue="1400"/>
117
                </file>
118
                <file name="sep-5.instance">
119
                    <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
120
                    <attr name="position" intvalue="1500"/>
121
                </file>
122
                <file name="org-openide-actions-FindAction.shadow">
123
                    <attr name="originalFile" stringvalue="Actions/Edit/org-openide-actions-FindAction.instance"/>
124
                    <attr name="position" intvalue="1600"/>
125
                </file>
126
                <file name="general.shadow">
127
                    <attr name="originalFile" stringvalue="Projects/Actions"/>
128
                    <attr name="position" intvalue="1700"/>
129
                </file>
130
                <file name="sep-6.instance">
131
                    <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
132
                    <attr name="position" intvalue="1800"/>
133
                </file>
134
                <file name="org-netbeans-modules-project-ui-CustomizeProject.shadow">
135
                    <attr name="originalFile" stringvalue="Actions/Project/org-netbeans-modules-project-ui-CustomizeProject.instance"/>
136
                    <attr name="position" intvalue="1900"/>
137
                </file>
138
            </folder>
61
        </folder>
139
        </folder>
62
    </folder>
140
    </folder>
63
</filesystem>
141
</filesystem>
(-)a/ant.freeform/src/org/netbeans/modules/ant/freeform/ui/View.java (-3 / +2 lines)
Lines 47-56 Link Here
47
import java.util.StringTokenizer;
47
import java.util.StringTokenizer;
48
import javax.swing.Action;
48
import javax.swing.Action;
49
import org.netbeans.api.project.ProjectUtils;
49
import org.netbeans.api.project.ProjectUtils;
50
import org.netbeans.modules.ant.freeform.Actions;
51
import org.netbeans.modules.ant.freeform.FreeformProject;
50
import org.netbeans.modules.ant.freeform.FreeformProject;
52
import org.netbeans.modules.ant.freeform.spi.ProjectNature;
51
import org.netbeans.modules.ant.freeform.spi.ProjectNature;
53
import org.netbeans.spi.project.ui.LogicalViewProvider;
52
import org.netbeans.spi.project.ui.LogicalViewProvider;
53
import org.netbeans.spi.project.ui.support.CommonProjectActions;
54
import org.netbeans.spi.project.ui.support.DefaultProjectOperations;
54
import org.netbeans.spi.project.ui.support.DefaultProjectOperations;
55
import org.netbeans.spi.project.ui.support.NodeFactorySupport;
55
import org.netbeans.spi.project.ui.support.NodeFactorySupport;
56
import org.openide.filesystems.FileObject;
56
import org.openide.filesystems.FileObject;
Lines 65-71 Link Here
65
import org.openide.util.Lookup;
65
import org.openide.util.Lookup;
66
import org.openide.util.NbBundle;
66
import org.openide.util.NbBundle;
67
import org.openide.util.NbCollections;
67
import org.openide.util.NbCollections;
68
import org.openide.util.Utilities;
69
import org.openide.util.lookup.Lookups;
68
import org.openide.util.lookup.Lookups;
70
69
71
/**
70
/**
Lines 158-164 Link Here
158
        
157
        
159
        @Override
158
        @Override
160
        public Action[] getActions(boolean context) {
159
        public Action[] getActions(boolean context) {
161
            return Actions.createContextMenu(p);
160
            return CommonProjectActions.forType("org-netbeans-modules-ant-freeform"); // NOI18N
162
        }
161
        }
163
        
162
        
164
        @Override
163
        @Override
(-)a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/J2SEProject.java (-5 / +2 lines)
Lines 92-98 Link Here
92
import org.netbeans.spi.java.project.support.LookupMergerSupport;
92
import org.netbeans.spi.java.project.support.LookupMergerSupport;
93
import org.netbeans.spi.java.project.support.ui.BrokenReferencesSupport;
93
import org.netbeans.spi.java.project.support.ui.BrokenReferencesSupport;
94
import org.netbeans.spi.project.AuxiliaryConfiguration;
94
import org.netbeans.spi.project.AuxiliaryConfiguration;
95
import org.netbeans.spi.project.SubprojectProvider;
96
import org.netbeans.spi.project.ant.AntArtifactProvider;
95
import org.netbeans.spi.project.ant.AntArtifactProvider;
97
import org.netbeans.spi.project.ant.AntBuildExtenderFactory;
96
import org.netbeans.spi.project.ant.AntBuildExtenderFactory;
98
import org.netbeans.spi.project.support.LookupProviderSupport;
97
import org.netbeans.spi.project.support.LookupProviderSupport;
Lines 122-128 Link Here
122
import org.openide.filesystems.FileObject;
121
import org.openide.filesystems.FileObject;
123
import org.openide.filesystems.FileSystem;
122
import org.openide.filesystems.FileSystem;
124
import org.openide.filesystems.FileUtil;
123
import org.openide.filesystems.FileUtil;
125
import org.openide.modules.InstalledFileLocator;
126
import org.openide.util.ChangeSupport;
124
import org.openide.util.ChangeSupport;
127
import org.openide.util.Exceptions;
125
import org.openide.util.Exceptions;
128
import org.openide.util.ImageUtilities;
126
import org.openide.util.ImageUtilities;
Lines 315-321 Link Here
315
313
316
    private Lookup createLookup(final AuxiliaryConfiguration aux,
314
    private Lookup createLookup(final AuxiliaryConfiguration aux,
317
            final J2SEActionProvider actionProvider) {
315
            final J2SEActionProvider actionProvider) {
318
        final SubprojectProvider spp = refHelper.createSubprojectProvider();        
319
        FileEncodingQueryImplementation encodingQuery = QuerySupport.createFileEncodingQuery(evaluator(), J2SEProjectProperties.SOURCE_ENCODING);
316
        FileEncodingQueryImplementation encodingQuery = QuerySupport.createFileEncodingQuery(evaluator(), J2SEProjectProperties.SOURCE_ENCODING);
320
        @SuppressWarnings("deprecation") Object cpe = new org.netbeans.modules.java.api.common.classpath.ClassPathExtender(
317
        @SuppressWarnings("deprecation") Object cpe = new org.netbeans.modules.java.api.common.classpath.ClassPathExtender(
321
            cpMod, ProjectProperties.JAVAC_CLASSPATH, null);
318
            cpMod, ProjectProperties.JAVAC_CLASSPATH, null);
Lines 326-334 Link Here
326
            aux,
323
            aux,
327
            helper.createCacheDirectoryProvider(),
324
            helper.createCacheDirectoryProvider(),
328
            helper.createAuxiliaryProperties(),
325
            helper.createAuxiliaryProperties(),
329
            spp,
326
            refHelper.createSubprojectProvider(),
330
            actionProvider,
327
            actionProvider,
331
            new J2SELogicalViewProvider(this, this.updateHelper, evaluator(), spp, refHelper),
328
            new J2SELogicalViewProvider(this, this.updateHelper, evaluator(), refHelper),
332
            // new J2SECustomizerProvider(this, this.updateHelper, evaluator(), refHelper),
329
            // new J2SECustomizerProvider(this, this.updateHelper, evaluator(), refHelper),
333
            new CustomizerProviderImpl(this, this.updateHelper, evaluator(), refHelper, this.genFilesHelper),        
330
            new CustomizerProviderImpl(this, this.updateHelper, evaluator(), refHelper, this.genFilesHelper),        
334
            LookupMergerSupport.createClassPathProviderMerger(cpProvider),
331
            LookupMergerSupport.createClassPathProviderMerger(cpProvider),
(-)a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/Bundle.properties (-6 lines)
Lines 38-49 Link Here
38
# made subject to such option by the copyright holder.
38
# made subject to such option by the copyright holder.
39
39
40
#Actions
40
#Actions
41
LBL_CleanAction_Name=Clean
42
LBL_BuildAction_Name=Build
43
LBL_RebuildAction_Name=Clean and Build
44
LBL_RunAction_Name=Run
45
LBL_JavadocAction_Name=Generate Javadoc
46
LBL_TestAction_Name=Test
47
LBL_Properties_Action=Properties
41
LBL_Properties_Action=Properties
48
LBL_AddProject_Action=Add Project...
42
LBL_AddProject_Action=Add Project...
49
LBL_AddLibrary_Action=Add Library...
43
LBL_AddLibrary_Action=Add Library...
(-)a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/J2SELogicalViewProvider.java (-164 / +117 lines)
Lines 48-63 Link Here
48
import java.io.CharConversionException;
48
import java.io.CharConversionException;
49
import java.io.IOException;
49
import java.io.IOException;
50
import java.net.URL;
50
import java.net.URL;
51
import java.util.ArrayList;
51
import java.util.Collection;
52
import java.util.List;
53
import java.util.ResourceBundle;
54
import javax.swing.AbstractAction;
52
import javax.swing.AbstractAction;
55
import javax.swing.Action;
53
import javax.swing.Action;
56
import javax.swing.event.ChangeEvent;
54
import javax.swing.event.ChangeEvent;
57
import javax.swing.event.ChangeListener;
55
import javax.swing.event.ChangeListener;
58
import org.netbeans.api.java.platform.JavaPlatform;
56
import org.netbeans.api.java.platform.JavaPlatform;
59
import org.netbeans.api.java.platform.JavaPlatformManager;
57
import org.netbeans.api.java.platform.JavaPlatformManager;
60
import org.netbeans.api.java.project.JavaProjectConstants;
61
import org.netbeans.api.project.FileOwnerQuery;
58
import org.netbeans.api.project.FileOwnerQuery;
62
import org.netbeans.api.project.Project;
59
import org.netbeans.api.project.Project;
63
import org.netbeans.api.project.ProjectUtils;
60
import org.netbeans.api.project.ProjectUtils;
Lines 70-98 Link Here
70
import org.netbeans.modules.java.j2seproject.J2SEProject;
67
import org.netbeans.modules.java.j2seproject.J2SEProject;
71
import org.netbeans.spi.java.project.support.ui.BrokenReferencesSupport;
68
import org.netbeans.spi.java.project.support.ui.BrokenReferencesSupport;
72
import org.netbeans.spi.java.project.support.ui.PackageView;
69
import org.netbeans.spi.java.project.support.ui.PackageView;
73
import org.netbeans.spi.project.ActionProvider;
74
import org.netbeans.spi.project.SubprojectProvider;
75
import org.netbeans.spi.project.support.ant.PropertyEvaluator;
70
import org.netbeans.spi.project.support.ant.PropertyEvaluator;
76
import org.netbeans.spi.project.support.ant.ReferenceHelper;
71
import org.netbeans.spi.project.support.ant.ReferenceHelper;
77
import org.netbeans.spi.project.ui.support.CommonProjectActions;
72
import org.netbeans.spi.project.ui.support.CommonProjectActions;
78
import org.netbeans.spi.project.ui.support.NodeFactorySupport;
73
import org.netbeans.spi.project.ui.support.NodeFactorySupport;
79
import org.netbeans.spi.project.ui.support.DefaultProjectOperations;
74
import org.netbeans.spi.project.ui.support.DefaultProjectOperations;
80
import org.netbeans.spi.project.ui.support.ProjectSensitiveActions;
81
import org.openide.ErrorManager;
75
import org.openide.ErrorManager;
82
import org.openide.actions.FindAction;
76
import org.openide.awt.DynamicMenuContent;
83
import org.openide.filesystems.FileObject;
77
import org.openide.filesystems.FileObject;
84
import org.openide.filesystems.FileUtil;
78
import org.openide.filesystems.FileUtil;
85
import org.openide.modules.SpecificationVersion;
79
import org.openide.modules.SpecificationVersion;
86
import org.openide.nodes.AbstractNode;
80
import org.openide.nodes.AbstractNode;
87
import org.openide.nodes.Node;
81
import org.openide.nodes.Node;
88
import org.openide.util.ChangeSupport;
82
import org.openide.util.ChangeSupport;
83
import org.openide.util.ContextAwareAction;
89
import org.openide.util.HelpCtx;
84
import org.openide.util.HelpCtx;
90
import org.openide.util.ImageUtilities;
85
import org.openide.util.ImageUtilities;
86
import org.openide.util.Lookup;
91
import org.openide.util.NbBundle;
87
import org.openide.util.NbBundle;
92
import org.openide.util.RequestProcessor;
88
import org.openide.util.RequestProcessor;
93
import org.openide.util.Utilities;
94
import org.openide.util.WeakListeners;
89
import org.openide.util.WeakListeners;
95
import org.openide.util.actions.SystemAction;
96
import org.openide.util.lookup.Lookups;
90
import org.openide.util.lookup.Lookups;
97
import org.openide.xml.XMLUtil;
91
import org.openide.xml.XMLUtil;
98
92
Lines 107-127 Link Here
107
    private final J2SEProject project;
101
    private final J2SEProject project;
108
    private final UpdateHelper helper;
102
    private final UpdateHelper helper;
109
    private final PropertyEvaluator evaluator;
103
    private final PropertyEvaluator evaluator;
110
    private final SubprojectProvider spp;
111
    private final ReferenceHelper resolver;
104
    private final ReferenceHelper resolver;
112
    private final ChangeSupport changeSupport = new ChangeSupport(this);
105
    private final ChangeSupport changeSupport = new ChangeSupport(this);
106
    private final PropertyChangeListener pcl;
113
    
107
    
114
    public J2SELogicalViewProvider(J2SEProject project, UpdateHelper helper, PropertyEvaluator evaluator, SubprojectProvider spp, ReferenceHelper resolver) {
108
    public J2SELogicalViewProvider(J2SEProject project, UpdateHelper helper, PropertyEvaluator evaluator, ReferenceHelper resolver) {
115
        this.project = project;
109
        this.project = project;
116
        assert project != null;
110
        assert project != null;
117
        this.helper = helper;
111
        this.helper = helper;
118
        assert helper != null;
112
        assert helper != null;
119
        this.evaluator = evaluator;
113
        this.evaluator = evaluator;
120
        assert evaluator != null;
114
        assert evaluator != null;
121
        this.spp = spp;
122
        assert spp != null;
123
        this.resolver = resolver;
115
        this.resolver = resolver;
124
        assert resolver != null;
116
        assert resolver != null;
117
        pcl = new PropertyChangeListener() {
118
            public @Override void propertyChange(PropertyChangeEvent evt) {
119
                testBroken();
120
            }
121
        };
122
        evaluator.addPropertyChangeListener(pcl);
123
        // When evaluator fires changes that platform properties were
124
        // removed the platform still exists in JavaPlatformManager.
125
        // That's why I have to listen here also on JPM:
126
        JavaPlatformManager.getDefault().addPropertyChangeListener(WeakListeners.propertyChange(pcl, JavaPlatformManager.getDefault()));
125
    }
127
    }
126
    
128
    
127
    public Node createLogicalView() {
129
    public Node createLogicalView() {
Lines 174-186 Link Here
174
        changeSupport.removeChangeListener(l);
176
        changeSupport.removeChangeListener(l);
175
    }
177
    }
176
    
178
    
179
    private final RequestProcessor.Task task = RP.create(new Runnable() {
180
        public @Override void run() {
181
            boolean old = broken;
182
            boolean _broken = hasBrokenLinks();
183
            if (old != _broken) {
184
                setBroken(_broken);
185
            }
186
            old = illegalState;
187
            boolean _illegalState = hasInvalidJdkVersion();
188
            if (old != _illegalState) {
189
                setIllegalState(_illegalState);
190
            }
191
            old = compileOnSaveDisabled;
192
            boolean _compileOnSaveDisabled = isCompileOnSaveDisabled();
193
            if (old != _compileOnSaveDisabled) {
194
                setCompileOnSaveDisabled(_compileOnSaveDisabled);
195
            }
196
        }
197
    });
198
177
    /**
199
    /**
178
     * Used by J2SEProjectCustomizer to mark the project as broken when it warns user
200
     * Used by J2SEProjectCustomizer to mark the project as broken when it warns user
179
     * about project's broken references and advices him to use BrokenLinksAction to correct it.
201
     * about project's broken references and advises him to use BrokenLinksAction to correct it.
180
     *
181
     */
202
     */
182
    public void testBroken() {
203
    public @Override void testBroken() {
183
        changeSupport.fireChange();
204
        task.schedule(100);
184
    }
205
    }
185
    
206
    
186
    
207
    
Lines 201-207 Link Here
201
                new String[] {J2SEProjectProperties.JAVA_PLATFORM});
222
                new String[] {J2SEProjectProperties.JAVA_PLATFORM});
202
    }
223
    }
203
    
224
    
204
    public boolean hasInvalidJdkVersion () {
225
    private boolean hasInvalidJdkVersion () {
205
        String javaSource = this.evaluator.getProperty("javac.source");     //NOI18N
226
        String javaSource = this.evaluator.getProperty("javac.source");     //NOI18N
206
        String javaTarget = this.evaluator.getProperty("javac.target");    //NOI18N
227
        String javaTarget = this.evaluator.getProperty("javac.target");    //NOI18N
207
        if (javaSource == null && javaTarget == null) {
228
        if (javaSource == null && javaTarget == null) {
Lines 250-265 Link Here
250
        String compileOnSaveDisabledTP = "<img src=\"" + errorBadgeIconURL + "\">&nbsp;" + NbBundle.getMessage(J2SELogicalViewProvider.class, "TP_CompileOnSaveDisabled");
271
        String compileOnSaveDisabledTP = "<img src=\"" + errorBadgeIconURL + "\">&nbsp;" + NbBundle.getMessage(J2SELogicalViewProvider.class, "TP_CompileOnSaveDisabled");
251
        compileOnSaveDisabledBadge = ImageUtilities.assignToolTipToImage(ImageUtilities.loadImage(COMPILE_ON_SAVE_DISABLED_BADGE_PATH), compileOnSaveDisabledTP); // NOI18N
272
        compileOnSaveDisabledBadge = ImageUtilities.assignToolTipToImage(ImageUtilities.loadImage(COMPILE_ON_SAVE_DISABLED_BADGE_PATH), compileOnSaveDisabledTP); // NOI18N
252
    }
273
    }
253
    
274
254
    /** Filter node containin additional features for the J2SE physical
275
    private final class J2SELogicalViewRootNode extends AbstractNode implements ChangeListener {
255
     */
256
    private final class J2SELogicalViewRootNode extends AbstractNode {
257
        
276
        
258
        private Action brokenLinksAction;
277
        @SuppressWarnings("LeakingThisInConstructor")
259
        private boolean broken;         //Represents a state where project has a broken reference repairable by broken reference support
260
        private boolean illegalState;   //Represents a state where project is not in legal state, eg invalid source/target level
261
        private boolean compileOnSaveDisabled;  //true iff Compile-on-Save is disabled
262
        
263
        public J2SELogicalViewRootNode() {
278
        public J2SELogicalViewRootNode() {
264
            super(NodeFactorySupport.createCompositeChildren(project, "Projects/org-netbeans-modules-java-j2seproject/Nodes"), 
279
            super(NodeFactorySupport.createCompositeChildren(project, "Projects/org-netbeans-modules-java-j2seproject/Nodes"), 
265
                  Lookups.singleton(project));
280
                  Lookups.singleton(project));
Lines 272-278 Link Here
272
                illegalState = true;
287
                illegalState = true;
273
            }
288
            }
274
            compileOnSaveDisabled = isCompileOnSaveDisabled();
289
            compileOnSaveDisabled = isCompileOnSaveDisabled();
275
            brokenLinksAction = new BrokenLinksAction();
290
            addChangeListener(WeakListeners.change(this, J2SELogicalViewProvider.this));
276
        }
291
        }
277
292
278
        @Override
293
        @Override
Lines 315-323 Link Here
315
            }
330
            }
316
        }
331
        }
317
        
332
        
333
        public @Override void stateChanged(ChangeEvent e) {
334
            fireIconChange();
335
            fireOpenedIconChange();
336
            fireDisplayNameChange(null, null);
337
        }
338
318
        @Override
339
        @Override
319
        public Action[] getActions( boolean context ) {
340
        public Action[] getActions( boolean context ) {
320
            return getAdditionalActions();
341
            return CommonProjectActions.forType("org-netbeans-modules-java-j2seproject"); // NOI18N
321
        }
342
        }
322
        
343
        
323
        @Override
344
        @Override
Lines 334-478 Link Here
334
        public HelpCtx getHelpCtx() {
355
        public HelpCtx getHelpCtx() {
335
            return new HelpCtx(J2SELogicalViewRootNode.class);
356
            return new HelpCtx(J2SELogicalViewRootNode.class);
336
        }
357
        }
337
        
358
338
        // Private methods -------------------------------------------------
359
    }
339
        
360
340
        private Action[] getAdditionalActions() {
361
    private boolean broken;         //Represents a state where project has a broken reference repairable by broken reference support
341
            
362
    private boolean illegalState;   //Represents a state where project is not in legal state, eg invalid source/target level
342
            ResourceBundle bundle = NbBundle.getBundle(J2SELogicalViewProvider.class);
363
    private boolean compileOnSaveDisabled;  //true iff Compile-on-Save is disabled
343
            
364
344
            List<Action> actions = new ArrayList<Action>();
365
    // Private methods -------------------------------------------------
345
            
366
346
            actions.add(CommonProjectActions.newFileAction());
367
    private void setBroken(boolean broken) {
347
            actions.add(null);
368
        this.broken = broken;
348
            actions.add(ProjectSensitiveActions.projectCommandAction(ActionProvider.COMMAND_BUILD, bundle.getString("LBL_BuildAction_Name"), null)); // NOI18N
369
        changeSupport.fireChange();
349
            actions.add(ProjectSensitiveActions.projectCommandAction(ActionProvider.COMMAND_REBUILD, bundle.getString("LBL_RebuildAction_Name"), null)); // NOI18N
370
    }
350
            actions.add(ProjectSensitiveActions.projectCommandAction(ActionProvider.COMMAND_CLEAN, bundle.getString("LBL_CleanAction_Name"), null)); // NOI18N
371
351
            actions.add(ProjectSensitiveActions.projectCommandAction(JavaProjectConstants.COMMAND_JAVADOC, bundle.getString("LBL_JavadocAction_Name"), null)); // NOI18N
372
    private void setIllegalState (boolean illegalState) {
352
            actions.add(null);
373
        this.illegalState = illegalState;
353
            actions.add(ProjectSensitiveActions.projectCommandAction(ActionProvider.COMMAND_RUN, bundle.getString("LBL_RunAction_Name"), null)); // NOI18N
374
        changeSupport.fireChange();
354
            actions.addAll(Utilities.actionsForPath("Projects/Debugger_Actions_temporary")); //NOI18N
375
    }
355
            actions.addAll(Utilities.actionsForPath("Projects/Profiler_Actions_temporary")); //NOI18N
376
356
            actions.add(ProjectSensitiveActions.projectCommandAction(ActionProvider.COMMAND_TEST, bundle.getString("LBL_TestAction_Name"), null)); // NOI18N
377
    private void setCompileOnSaveDisabled (boolean value) {
357
            actions.add(CommonProjectActions.setProjectConfigurationAction());
378
        this.compileOnSaveDisabled = value;
358
            actions.add(null);
379
        changeSupport.fireChange();
359
            actions.add(CommonProjectActions.setAsMainProjectAction());
380
    }
360
            actions.add(CommonProjectActions.openSubprojectsAction());
381
361
            actions.add(CommonProjectActions.closeProjectAction());
382
    public static final class BrokenLinksActionFactory extends AbstractAction implements ContextAwareAction {
362
            actions.add(null);
383
363
            actions.add(CommonProjectActions.renameProjectAction());
384
        /** for layer registration */
364
            actions.add(CommonProjectActions.moveProjectAction());
385
        public BrokenLinksActionFactory() {
365
            actions.add(CommonProjectActions.copyProjectAction());
386
            setEnabled(false);
366
            actions.add(CommonProjectActions.deleteProjectAction());
387
            putValue(DynamicMenuContent.HIDE_WHEN_DISABLED, true);
367
            actions.add(null);
368
            actions.add(SystemAction.get(FindAction.class));
369
            
370
            // honor 57874 contact
371
            actions.addAll(Utilities.actionsForPath("Projects/Actions")); //NOI18N
372
            
373
            actions.add(null);
374
            if (broken) {
375
                actions.add(brokenLinksAction);
376
            }
377
            actions.add(CommonProjectActions.customizeProjectAction());
378
            
379
            return actions.toArray(new Action[actions.size()]);
380
            
381
        }
382
        
383
        private void setBroken(boolean broken) {
384
            this.broken = broken;
385
            brokenLinksAction.setEnabled(broken);
386
            fireIconChange();
387
            fireOpenedIconChange();
388
            fireDisplayNameChange(null, null);
389
        }
390
        
391
        private void setIllegalState (boolean illegalState) {
392
            this.illegalState = illegalState;
393
            fireIconChange();
394
            fireOpenedIconChange();
395
            fireDisplayNameChange(null, null);
396
        }
397
        
398
        private void setCompileOnSaveDisabled (boolean value) {
399
            this.compileOnSaveDisabled = value;
400
            fireIconChange();
401
            fireOpenedIconChange();
402
            fireDisplayNameChange(null, null);
403
        }
388
        }
404
389
405
        /** This action is created only when project has broken references.
390
        public @Override void actionPerformed(ActionEvent e) {
406
         * Once these are resolved the action is disabled.
391
            assert false;
407
         */
392
        }
408
        private class BrokenLinksAction extends AbstractAction implements PropertyChangeListener, ChangeListener, Runnable {
393
409
            
394
        public @Override Action createContextAwareInstance(Lookup actionContext) {
410
            private RequestProcessor.Task task = null;
395
            Collection<? extends Project> p = actionContext.lookupAll(Project.class);
411
            
396
            if (p.size() != 1) {
412
            private PropertyChangeListener weakPCL;
397
                return this;
413
            
414
            public BrokenLinksAction() {
415
                putValue(Action.NAME, NbBundle.getMessage(J2SELogicalViewProvider.class, "LBL_Fix_Broken_Links_Action"));
416
                setEnabled(broken);
417
                evaluator.addPropertyChangeListener(this);
418
                // When evaluator fires changes that platform properties were
419
                // removed the platform still exists in JavaPlatformManager.
420
                // That's why I have to listen here also on JPM:
421
                weakPCL = WeakListeners.propertyChange(this, JavaPlatformManager.getDefault());
422
                JavaPlatformManager.getDefault().addPropertyChangeListener(weakPCL);
423
                J2SELogicalViewProvider.this.addChangeListener(WeakListeners.change(this, J2SELogicalViewProvider.this));
424
            }
398
            }
425
            
399
            J2SELogicalViewProvider lvp = p.iterator().next().getLookup().lookup(J2SELogicalViewProvider.class);
426
            public void actionPerformed(ActionEvent e) {
400
            if (lvp == null) {
427
                try {
401
                return this;
428
                    helper.requestUpdate();
429
                    BrokenReferencesSupport.showCustomizer(helper.getAntProjectHelper(), resolver, getBreakableProperties(), new String[] {J2SEProjectProperties.JAVA_PLATFORM});
430
                    run();
431
                } catch (IOException ioe) {
432
                    ErrorManager.getDefault().notify(ioe);
433
                }
434
            }
402
            }
435
            
403
            return lvp.new BrokenLinksAction();
436
            public void propertyChange(PropertyChangeEvent evt) {
404
        }
437
                refsMayChanged();
405
406
    }
407
408
    /** This action is created only when project has broken references.
409
     * Once these are resolved the action is disabled.
410
     */
411
    private class BrokenLinksAction extends AbstractAction {
412
413
        public BrokenLinksAction() {
414
            putValue(Action.NAME, NbBundle.getMessage(J2SELogicalViewProvider.class, "LBL_Fix_Broken_Links_Action"));
415
            setEnabled(broken);
416
            putValue(DynamicMenuContent.HIDE_WHEN_DISABLED, true);
417
        }
418
419
        public void actionPerformed(ActionEvent e) {
420
            try {
421
                helper.requestUpdate();
422
                BrokenReferencesSupport.showCustomizer(helper.getAntProjectHelper(), resolver, getBreakableProperties(), new String[] {J2SEProjectProperties.JAVA_PLATFORM});
423
                testBroken();
424
            } catch (IOException ioe) {
425
                ErrorManager.getDefault().notify(ioe);
438
            }
426
            }
439
            
440
            
441
            public void stateChanged(ChangeEvent evt) {
442
                refsMayChanged();
443
            }
444
            
445
            public synchronized void run() {
446
                boolean old = J2SELogicalViewRootNode.this.broken;
447
                boolean broken = hasBrokenLinks();
448
                if (old != broken) {
449
                    setBroken(broken);
450
                }
451
                
452
                old = J2SELogicalViewRootNode.this.illegalState;
453
                broken = hasInvalidJdkVersion ();
454
                if (old != broken) {
455
                    setIllegalState(broken);
456
                }
457
                old = J2SELogicalViewRootNode.this.compileOnSaveDisabled;
458
                boolean cosDisabled = isCompileOnSaveDisabled();
459
                if (old != cosDisabled) {
460
                    setCompileOnSaveDisabled(cosDisabled);
461
                }
462
            }
463
            
464
            private void refsMayChanged() {
465
                // check project state whenever there was a property change
466
                // or change in list of platforms.
467
                // Coalesce changes since they can come quickly:
468
                if (task == null) {
469
                    task = RP.create(this);
470
                }
471
                task.schedule(100);
472
            }
473
            
474
        }
427
        }
475
        
428
476
    }
429
    }
477
    
430
478
}
431
}
(-)a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/resources/layer.xml (-2 / +111 lines)
Lines 100-108 Link Here
100
                    <attr name="position" intvalue="200"/>
100
                    <attr name="position" intvalue="200"/>
101
                </file>
101
                </file>
102
            </folder>
102
            </folder>
103
            
104
            <folder name="Lookup"/>
103
            <folder name="Lookup"/>
105
            
104
            <folder name="Actions">
105
                <file name="org-netbeans-modules-project-ui-NewFile$WithSubMenu.shadow">
106
                    <attr name="originalFile" stringvalue="Actions/Project/org-netbeans-modules-project-ui-NewFile$WithSubMenu.instance"/>
107
                    <attr name="position" intvalue="100"/>
108
                </file>
109
                <file name="sep-1.instance">
110
                    <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
111
                    <attr name="position" intvalue="200"/>
112
                </file>
113
                <file name="org-netbeans-modules-project-ui-BuildProject.shadow">
114
                    <attr name="originalFile" stringvalue="Actions/Project/org-netbeans-modules-project-ui-BuildProject.instance"/>
115
                    <attr name="position" intvalue="300"/>
116
                </file>
117
                <file name="org-netbeans-modules-project-ui-RebuildProject.shadow">
118
                    <attr name="originalFile" stringvalue="Actions/Project/org-netbeans-modules-project-ui-RebuildProject.instance"/>
119
                    <attr name="position" intvalue="400"/>
120
                </file>
121
                <file name="org-netbeans-modules-project-ui-CleanProject.shadow">
122
                    <attr name="originalFile" stringvalue="Actions/Project/org-netbeans-modules-project-ui-CleanProject.instance"/>
123
                    <attr name="position" intvalue="500"/>
124
                </file>
125
                <file name="org-netbeans-modules-project-ui-JavadocProject.shadow">
126
                    <attr name="originalFile" stringvalue="Actions/Project/org-netbeans-modules-project-ui-JavadocProject.instance"/>
127
                    <attr name="position" intvalue="600"/>
128
                </file>
129
                <file name="sep-2.instance">
130
                    <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
131
                    <attr name="position" intvalue="700"/>
132
                </file>
133
                <file name="org-netbeans-modules-project-ui-RunProject.shadow">
134
                    <attr name="originalFile" stringvalue="Actions/Project/org-netbeans-modules-project-ui-RunProject.instance"/>
135
                    <attr name="position" intvalue="800"/>
136
                </file>
137
                <file name="org-netbeans-modules-debugger-ui-actions-DebugProjectAction.shadow">
138
                    <attr name="originalFile" stringvalue="Actions/Debug/org-netbeans-modules-debugger-ui-actions-DebugProjectAction.instance"/>
139
                    <attr name="position" intvalue="900"/>
140
                </file>
141
                <file name="org-netbeans-modules-profiler-actions-ProfileProjectActionPopup.shadow">
142
                    <attr name="originalFile" stringvalue="Actions/Profile/org-netbeans-modules-profiler-actions-ProfileProjectActionPopup.instance"/>
143
                    <attr name="position" intvalue="1000"/>
144
                </file>
145
                <file name="org-netbeans-modules-project-ui-TestProject.shadow">
146
                    <attr name="originalFile" stringvalue="Actions/Project/org-netbeans-modules-project-ui-TestProject.instance"/>
147
                    <attr name="position" intvalue="1100"/>
148
                </file>
149
                <file name="org-netbeans-modules-project-ui-actions-ActiveConfigAction.shadow">
150
                    <attr name="originalFile" stringvalue="Actions/Project/org-netbeans-modules-project-ui-actions-ActiveConfigAction.instance"/>
151
                    <attr name="position" intvalue="1200"/>
152
                </file>
153
                <file name="sep-3.instance">
154
                    <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
155
                    <attr name="position" intvalue="1300"/>
156
                </file>
157
                <file name="org-netbeans-modules-project-ui-SetMainProject.shadow">
158
                    <attr name="originalFile" stringvalue="Actions/Project/org-netbeans-modules-project-ui-SetMainProject.instance"/>
159
                    <attr name="position" intvalue="1400"/>
160
                </file>
161
                <file name="org-netbeans-modules-project-ui-actions-OpenSubprojects.shadow">
162
                    <attr name="originalFile" stringvalue="Actions/Project/org-netbeans-modules-project-ui-actions-OpenSubprojects.instance"/>
163
                    <attr name="position" intvalue="1500"/>
164
                </file>
165
                <file name="org-netbeans-modules-project-ui-CloseProject.shadow">
166
                    <attr name="originalFile" stringvalue="Actions/Project/org-netbeans-modules-project-ui-CloseProject.instance"/>
167
                    <attr name="position" intvalue="1600"/>
168
                </file>
169
                <file name="sep-4.instance">
170
                    <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
171
                    <attr name="position" intvalue="1700"/>
172
                </file>
173
                <file name="org-netbeans-modules-project-ui-RenameProject.shadow">
174
                    <attr name="originalFile" stringvalue="Actions/Project/org-netbeans-modules-project-ui-RenameProject.instance"/>
175
                    <attr name="position" intvalue="1800"/>
176
                </file>
177
                <file name="org-netbeans-modules-project-ui-MoveProject.shadow">
178
                    <attr name="originalFile" stringvalue="Actions/Project/org-netbeans-modules-project-ui-MoveProject.instance"/>
179
                    <attr name="position" intvalue="1900"/>
180
                </file>
181
                <file name="org-netbeans-modules-project-ui-CopyProject.shadow">
182
                    <attr name="originalFile" stringvalue="Actions/Project/org-netbeans-modules-project-ui-CopyProject.instance"/>
183
                    <attr name="position" intvalue="2000"/>
184
                </file>
185
                <file name="org-netbeans-modules-project-ui-DeleteProject.shadow">
186
                    <attr name="originalFile" stringvalue="Actions/Project/org-netbeans-modules-project-ui-DeleteProject.instance"/>
187
                    <attr name="position" intvalue="2100"/>
188
                </file>
189
                <file name="sep-5.instance">
190
                    <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
191
                    <attr name="position" intvalue="2200"/>
192
                </file>
193
                <file name="org-openide-actions-FindAction.shadow">
194
                    <attr name="originalFile" stringvalue="Actions/Edit/org-openide-actions-FindAction.instance"/>
195
                    <attr name="position" intvalue="2300"/>
196
                </file>
197
                <file name="general.shadow">
198
                    <attr name="originalFile" stringvalue="Projects/Actions"/>
199
                    <attr name="position" intvalue="2400"/>
200
                </file>
201
                <file name="sep-6.instance">
202
                    <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
203
                    <attr name="position" intvalue="2500"/>
204
                </file>
205
                <file name="BrokenLinksAction.instance">
206
                    <attr name="instanceClass" stringvalue="org.netbeans.modules.java.j2seproject.ui.J2SELogicalViewProvider$BrokenLinksActionFactory"/>
207
                    <attr name="misplaced.action.allowed" boolvalue="true"/>
208
                    <attr name="position" intvalue="2600"/>
209
                </file>
210
                <file name="org-netbeans-modules-project-ui-CustomizeProject.shadow">
211
                    <attr name="originalFile" stringvalue="Actions/Project/org-netbeans-modules-project-ui-CustomizeProject.instance"/>
212
                    <attr name="position" intvalue="2700"/>
213
                </file>
214
            </folder>
106
        </folder>
215
        </folder>
107
    </folder>
216
    </folder>
108
    <folder name="ProjectXMLCatalog">
217
    <folder name="ProjectXMLCatalog">
(-)a/o.n.core/test/qa-functional/src/org/netbeans/core/validation/ValidateLayerConsistencyTest.java (-1 / +1 lines)
Lines 435-441 Link Here
435
                    continue;
435
                    continue;
436
                }
436
                }
437
                if (fo.getPath().startsWith("NativeProjects/Actions/")) {
437
                if (fo.getPath().startsWith("NativeProjects/Actions/")) {
438
                    // I should probably report a bug for NativeProjects
438
                    // XXX should perhaps be replaced
439
                    continue;
439
                    continue;
440
                }
440
                }
441
                if (fo.getPath().startsWith("contextmenu/uml/")) {
441
                if (fo.getPath().startsWith("contextmenu/uml/")) {
(-)a/openide.awt/src/org/netbeans/modules/openide/awt/DefaultAWTBridge.java (-10 / +18 lines)
Lines 59-65 Link Here
59
import org.openide.util.lookup.ServiceProvider;
59
import org.openide.util.lookup.ServiceProvider;
60
import org.openide.util.actions.ActionPresenterProvider;
60
import org.openide.util.actions.ActionPresenterProvider;
61
61
62
/** Default implementaiton of presenters for various action types.
62
/** Default implementation of presenters for various action types.
63
 */
63
 */
64
@ServiceProvider(service=ActionPresenterProvider.class)
64
@ServiceProvider(service=ActionPresenterProvider.class)
65
public final class DefaultAWTBridge extends ActionPresenterProvider {
65
public final class DefaultAWTBridge extends ActionPresenterProvider {
Lines 76-92 Link Here
76
        return new Actions.MenuItem (action, true);
76
        return new Actions.MenuItem (action, true);
77
    }
77
    }
78
    
78
    
79
    public JMenuItem createPopupPresenter(Action action) {
79
    public @Override JMenuItem createPopupPresenter(Action action) {
80
        JMenuItem item;
80
        if (action instanceof BooleanStateAction) {
81
        if (action instanceof BooleanStateAction) {
81
            BooleanStateAction b = (BooleanStateAction)action;
82
            BooleanStateAction b = (BooleanStateAction)action;
82
            return new Actions.CheckboxMenuItem (b, false);
83
            item = new Actions.CheckboxMenuItem (b, false);
84
        } else if (action instanceof SystemAction) {
85
            SystemAction s = (SystemAction)action;
86
            item = new Actions.MenuItem (s, false);
87
        } else {
88
            item = new Actions.MenuItem (action, false);
83
        }
89
        }
84
        if (action instanceof SystemAction) {
90
        item.putClientProperty(DynamicMenuContent.HIDE_WHEN_DISABLED, action.getValue(DynamicMenuContent.HIDE_WHEN_DISABLED));
85
            SystemAction s = (SystemAction)action;
91
        return item;
86
            return new Actions.MenuItem (s, false);
87
        }
88
            
89
        return new Actions.MenuItem (action, false);
90
    }
92
    }
91
    
93
    
92
    public Component createToolbarPresenter(Action action) {
94
    public Component createToolbarPresenter(Action action) {
Lines 105-111 Link Here
105
        return new JPopupMenu();
107
        return new JPopupMenu();
106
    }  
108
    }  
107
    
109
    
108
    public Component[] convertComponents(Component comp) {
110
    public @Override Component[] convertComponents(Component comp) {
111
        if (comp instanceof JMenuItem) {
112
            JMenuItem item = (JMenuItem) comp;
113
            if (Boolean.TRUE.equals(item.getClientProperty(DynamicMenuContent.HIDE_WHEN_DISABLED)) && !item.isEnabled()) {
114
                return new Component[0];
115
            }
116
        }
109
         if (comp instanceof DynamicMenuContent) {
117
         if (comp instanceof DynamicMenuContent) {
110
            Component[] toRet = ((DynamicMenuContent)comp).getMenuPresenters();
118
            Component[] toRet = ((DynamicMenuContent)comp).getMenuPresenters();
111
            boolean atLeastOne = false;
119
            boolean atLeastOne = false;
(-)a/openide.awt/src/org/openide/awt/DynamicMenuContent.java (+14 lines)
Lines 42-47 Link Here
42
package org.openide.awt;
42
package org.openide.awt;
43
43
44
import javax.swing.JComponent;
44
import javax.swing.JComponent;
45
import org.openide.util.Utilities;
45
46
46
/**
47
/**
47
 * Dynamic result of a {@link org.openide.util.actions.Presenter.Menu} or {@link org.openide.util.actions.Presenter.Popup}. If the presenters return
48
 * Dynamic result of a {@link org.openide.util.actions.Presenter.Menu} or {@link org.openide.util.actions.Presenter.Popup}. If the presenters return
Lines 66-69 Link Here
66
     * @return a new set of items to show in menu. Can be either an updated old set of instances or a completely new one.
67
     * @return a new set of items to show in menu. Can be either an updated old set of instances or a completely new one.
67
     */
68
     */
68
    public JComponent[] synchMenuPresenters(JComponent[] items);
69
    public JComponent[] synchMenuPresenters(JComponent[] items);
70
71
    /**
72
     * Marker for actions which should be hidden rather than merely disabled.
73
     * {@link Utilities#actionsToPopup(Action[],Lookup)} will skip over any disabled
74
     * actions which have this property set to true, unless they implement
75
     * {@link org.openide.util.actions.Presenter.Popup}.
76
     * This is a convenient way to make context menu items disappear when disabled;
77
     * for more complex cases you still need to have a popup presenter with dynamic
78
     * menu content.
79
     * @since XXX
80
     */
81
    String HIDE_WHEN_DISABLED = "hideWhenDisabled"; // NOI18N
82
69
}
83
}
(-)a/openide.util.lookup/src/org/openide/util/lookup/Lookups.java (-1 / +1 lines)
Lines 214-220 Link Here
214
     * <p>
214
     * <p>
215
     * Read more about the <a href="@org-openide-util@/org/openide/util/doc-files/api.html#folderlookup">usage of this method</a>.
215
     * Read more about the <a href="@org-openide-util@/org/openide/util/doc-files/api.html#folderlookup">usage of this method</a>.
216
     * 
216
     * 
217
     * @param path the path identifying the lookup, e.g. <code>Projects/Actions</code>
217
     * @param path the path identifying the lookup, e.g. <code>Servers/J2EEWrapper</code>
218
     * @return lookup associated with this path
218
     * @return lookup associated with this path
219
     * @since 7.9
219
     * @since 7.9
220
     */
220
     */
(-)a/profiler/src/org/netbeans/modules/profiler/mf-layer.xml (-6 / +8 lines)
Lines 44-52 Link Here
44
<filesystem>
44
<filesystem>
45
    <folder name="Projects">
45
    <folder name="Projects">
46
        <folder name="Profiler_Actions_temporary">
46
        <folder name="Profiler_Actions_temporary">
47
            <file name="org-netbeans-modules-profiler-actions-ProfileProjectActionPopup.instance">
47
            <file name="org-netbeans-modules-profiler-actions-ProfileProjectActionPopup.shadow">
48
                <attr name="instanceCreate" methodvalue="org.netbeans.modules.profiler.actions.AntActions.profileProjectPopup"/>
48
                <attr name="originalFile" stringvalue="Actions/Profile/org-netbeans-modules-profiler-actions-ProfileProjectActionPopup.instance"/>
49
                <attr name="misplaced.action.allowed" boolvalue="true"/>
50
            </file>
49
            </file>
51
        </folder>
50
        </folder>
52
    </folder>
51
    </folder>
Lines 392-400 Link Here
392
            <file name="org-netbeans-modules-profiler-actions-ShowTelemetryViewAction.instance"/>
391
            <file name="org-netbeans-modules-profiler-actions-ShowTelemetryViewAction.instance"/>
393
            <file name="org-netbeans-modules-profiler-actions-ShowThreadsViewAction.instance"/>
392
            <file name="org-netbeans-modules-profiler-actions-ShowThreadsViewAction.instance"/>
394
393
395
            <file name="org-netbeans-modules-profiler-actions-ProfileMainProjectAction.instance">
396
                <attr name="instanceCreate" methodvalue="org.netbeans.modules.profiler.actions.AntActions.profileMainProject"/>
397
            </file>
398
            <file name="org-netbeans-modules-profiler-actions-RerunAction.instance"/>
394
            <file name="org-netbeans-modules-profiler-actions-RerunAction.instance"/>
399
            <file name="org-netbeans-modules-profiler-actions-StopAction.instance"/>
395
            <file name="org-netbeans-modules-profiler-actions-StopAction.instance"/>
400
            <file name="org-netbeans-modules-profiler-actions-RunGCAction.instance"/>
396
            <file name="org-netbeans-modules-profiler-actions-RunGCAction.instance"/>
Lines 426-431 Link Here
426
            <file name="org-netbeans-modules-profiler-actions-ProfileProjectAction.instance">
422
            <file name="org-netbeans-modules-profiler-actions-ProfileProjectAction.instance">
427
                <attr name="instanceCreate" methodvalue="org.netbeans.modules.profiler.actions.AntActions.profileProject"/>
423
                <attr name="instanceCreate" methodvalue="org.netbeans.modules.profiler.actions.AntActions.profileProject"/>
428
            </file>
424
            </file>
425
            <file name="org-netbeans-modules-profiler-actions-ProfileMainProjectAction.instance">
426
                <attr name="instanceCreate" methodvalue="org.netbeans.modules.profiler.actions.AntActions.profileMainProject"/>
427
            </file>
428
            <file name="org-netbeans-modules-profiler-actions-ProfileProjectActionPopup.instance">
429
                <attr name="instanceCreate" methodvalue="org.netbeans.modules.profiler.actions.AntActions.profileProjectPopup"/>
430
            </file>
429
            <file name="org-netbeans-modules-profiler-actions-InternalStatsAction.instance"/>
431
            <file name="org-netbeans-modules-profiler-actions-InternalStatsAction.instance"/>
430
            <file name="org-netbeans-modules-profiler-actions-RunCalibrationAction.instance"/>
432
            <file name="org-netbeans-modules-profiler-actions-RunCalibrationAction.instance"/>
431
            <file name="org-netbeans-modules-profiler-actions-GetCmdLineArgumentsAction.instance"/>
433
            <file name="org-netbeans-modules-profiler-actions-GetCmdLineArgumentsAction.instance"/>
(-)a/projectui/src/org/netbeans/modules/project/ui/actions/Actions.java (-14 / +25 lines)
Lines 67-73 Link Here
67
    
67
    
68
    private static Action SET_AS_MAIN_PROJECT;
68
    private static Action SET_AS_MAIN_PROJECT;
69
    private static Action CUSTOMIZE_PROJECT;
69
    private static Action CUSTOMIZE_PROJECT;
70
    private static Action OPEN_SUBPROJECTS;
71
    private static Action CLOSE_PROJECT;
70
    private static Action CLOSE_PROJECT;
72
    private static Action NEW_FILE;
71
    private static Action NEW_FILE;
73
    private static Action COPY_PROJECT;
72
    private static Action COPY_PROJECT;
Lines 89-98 Link Here
89
    }
88
    }
90
    
89
    
91
    public synchronized Action openSubprojectsAction() {
90
    public synchronized Action openSubprojectsAction() {
92
        if ( OPEN_SUBPROJECTS == null ) {
91
        return SystemAction.get(OpenSubprojects.class);
93
            OPEN_SUBPROJECTS = new OpenSubprojects();
94
        }
95
        return OPEN_SUBPROJECTS;
96
    }
92
    }
97
    
93
    
98
    public synchronized Action closeProjectAction() {
94
    public synchronized Action closeProjectAction() {
Lines 103-113 Link Here
103
    }
99
    }
104
    
100
    
105
    public synchronized Action newFileAction() {
101
    public synchronized Action newFileAction() {
102
        return newFile();
103
    }
104
105
    public static Action newFile() {
106
        if ( NEW_FILE == null ) {
106
        if ( NEW_FILE == null ) {
107
            NEW_FILE = new NewFile.WithSubMenu();
107
            NEW_FILE = new NewFile.WithSubMenu();
108
        }
108
        }
109
        return NEW_FILE;
109
        return NEW_FILE;
110
    }    
110
    }
111
    
111
    
112
    public Action deleteProjectAction() {
112
    public Action deleteProjectAction() {
113
        return deleteProject();
113
        return deleteProject();
Lines 154-169 Link Here
154
    
154
    
155
    public static Action javadocProject() {
155
    public static Action javadocProject() {
156
        return new ProjectAction (
156
        return new ProjectAction (
157
            "javadoc", // XXX Define standard
157
            "javadoc", // XXX move to java.project and use JavaProjectConstants.COMMAND_JAVADOC
158
            NbBundle.getMessage(Actions.class, "LBL_JavadocProjectAction_Name" ), // NOI18N
158
            NbBundle.getMessage(Actions.class, "LBL_JavadocProjectAction_Name"),
159
            NbBundle.getMessage(Actions.class, "LBL_JavadocProjectAction_Name_popup"),
159
            null, 
160
            null, 
160
            null ); 
161
            null ); 
161
    }
162
    }
162
    
163
    
163
    public static Action testProject() {        
164
    public static Action testProject() {        
164
        Action a = new ProjectAction (
165
        Action a = new ProjectAction (
165
            "test", // XXX Define standard
166
            ActionProvider.COMMAND_TEST,
166
            NbBundle.getMessage(Actions.class, "LBL_TestProjectAction_Name" ),ImageUtilities.loadImageIcon("org/netbeans/modules/project/ui/resources/testProject.png", false), //NOI18N
167
            NbBundle.getMessage(Actions.class, "LBL_TestProjectAction_Name"),
168
            NbBundle.getMessage(Actions.class, "LBL_TestProjectAction_Name_popup"),
169
            ImageUtilities.loadImageIcon("org/netbeans/modules/project/ui/resources/testProject.png", false),
167
            null ); 
170
            null ); 
168
        a.putValue("iconBase","org/netbeans/modules/project/ui/resources/testProject.png"); //NOI18N
171
        a.putValue("iconBase","org/netbeans/modules/project/ui/resources/testProject.png"); //NOI18N
169
        a.putValue("noIconInMenu", Boolean.TRUE); //NOI18N
172
        a.putValue("noIconInMenu", Boolean.TRUE); //NOI18N
Lines 174-180 Link Here
174
    public static Action buildProject() {
177
    public static Action buildProject() {
175
        Action a = new ProjectAction (
178
        Action a = new ProjectAction (
176
            ActionProvider.COMMAND_BUILD, 
179
            ActionProvider.COMMAND_BUILD, 
177
            NbBundle.getMessage(Actions.class, "LBL_BuildProjectAction_Name" ),ImageUtilities.loadImageIcon("org/netbeans/modules/project/ui/resources/buildCurrentProject.gif", false), //NOI18N
180
            NbBundle.getMessage(Actions.class, "LBL_BuildProjectAction_Name"),
181
            NbBundle.getMessage(Actions.class, "LBL_BuildProjectAction_Name_popup"),
182
            ImageUtilities.loadImageIcon("org/netbeans/modules/project/ui/resources/buildCurrentProject.gif", false),
178
            null );  
183
            null );  
179
        a.putValue("iconBase","org/netbeans/modules/project/ui/resources/buildCurrentProject.gif"); //NOI18N
184
        a.putValue("iconBase","org/netbeans/modules/project/ui/resources/buildCurrentProject.gif"); //NOI18N
180
        return a;
185
        return a;
Lines 183-189 Link Here
183
    public static Action cleanProject() {
188
    public static Action cleanProject() {
184
        Action a = new ProjectAction(
189
        Action a = new ProjectAction(
185
                ActionProvider.COMMAND_CLEAN,
190
                ActionProvider.COMMAND_CLEAN,
186
                NbBundle.getMessage(Actions.class, "LBL_CleanProjectAction_Name" ),ImageUtilities.loadImageIcon("org/netbeans/modules/project/ui/resources/cleanCurrentProject.gif", false), //NOI18N
191
                NbBundle.getMessage(Actions.class, "LBL_CleanProjectAction_Name"),
192
                NbBundle.getMessage(Actions.class, "LBL_CleanProjectAction_Name_popup"),
193
                ImageUtilities.loadImageIcon("org/netbeans/modules/project/ui/resources/cleanCurrentProject.gif", false),
187
                null );
194
                null );
188
        a.putValue("iconBase","org/netbeans/modules/project/ui/resources/cleanCurrentProject.gif"); //NOI18N
195
        a.putValue("iconBase","org/netbeans/modules/project/ui/resources/cleanCurrentProject.gif"); //NOI18N
189
        return a;
196
        return a;
Lines 192-198 Link Here
192
    public static Action rebuildProject() {
199
    public static Action rebuildProject() {
193
        Action a = new ProjectAction(
200
        Action a = new ProjectAction(
194
            ActionProvider.COMMAND_REBUILD,
201
            ActionProvider.COMMAND_REBUILD,
195
            NbBundle.getMessage(Actions.class, "LBL_RebuildProjectAction_Name"),ImageUtilities.loadImageIcon("org/netbeans/modules/project/ui/resources/rebuildCurrentProject.gif", false), //NOI18N
202
            NbBundle.getMessage(Actions.class, "LBL_RebuildProjectAction_Name"),
203
            NbBundle.getMessage(Actions.class, "LBL_RebuildProjectAction_Name_popup"),
204
            ImageUtilities.loadImageIcon("org/netbeans/modules/project/ui/resources/rebuildCurrentProject.gif", false),
196
            null ); 
205
            null ); 
197
        a.putValue("iconBase","org/netbeans/modules/project/ui/resources/rebuildCurrentProject.gif"); //NOI18N
206
        a.putValue("iconBase","org/netbeans/modules/project/ui/resources/rebuildCurrentProject.gif"); //NOI18N
198
        return a;
207
        return a;
Lines 201-207 Link Here
201
    public static Action runProject() {
210
    public static Action runProject() {
202
        Action a = new ProjectAction(
211
        Action a = new ProjectAction(
203
            ActionProvider.COMMAND_RUN, 
212
            ActionProvider.COMMAND_RUN, 
204
            NbBundle.getMessage(Actions.class, "LBL_RunProjectAction_Name"),ImageUtilities.loadImageIcon("org/netbeans/modules/project/ui/resources/runCurrentProject.gif", false), //NOI18N
213
            NbBundle.getMessage(Actions.class, "LBL_RunProjectAction_Name"),
214
            NbBundle.getMessage(Actions.class, "LBL_RunProjectAction_Name_popup"),
215
            ImageUtilities.loadImageIcon("org/netbeans/modules/project/ui/resources/runCurrentProject.gif", false),
205
            null ); 
216
            null ); 
206
        a.putValue("iconBase","org/netbeans/modules/project/ui/resources/runCurrentProject.gif"); //NOI18N
217
        a.putValue("iconBase","org/netbeans/modules/project/ui/resources/runCurrentProject.gif"); //NOI18N
207
        return a;
218
        return a;
(-)a/projectui/src/org/netbeans/modules/project/ui/actions/Bundle.properties (-3 / +7 lines)
Lines 69-78 Link Here
69
# {0} number of project
69
# {0} number of project
70
# {1} the first project name
70
# {1} the first project name
71
LBL_BuildProjectAction_Name=Build {0,choice,0#Project|1#Project ({1})|1<{0} Projects}
71
LBL_BuildProjectAction_Name=Build {0,choice,0#Project|1#Project ({1})|1<{0} Projects}
72
LBL_BuildProjectAction_Name_popup=Build
72
LBL_CleanProjectAction_Name=Clean {0,choice,0#Project|1#Project ({1})|1<{0} Projects}
73
LBL_CleanProjectAction_Name=Clean {0,choice,0#Project|1#Project ({1})|1<{0} Projects}
74
LBL_CleanProjectAction_Name_popup=Clean
73
LBL_RebuildProjectAction_Name=Clean and Build {0,choice,0#Project|1#Project ({1})|1<{0} Projects}
75
LBL_RebuildProjectAction_Name=Clean and Build {0,choice,0#Project|1#Project ({1})|1<{0} Projects}
76
LBL_RebuildProjectAction_Name_popup=Clean and Build
74
LBL_JavadocProjectAction_Name=&Generate Javadoc{0,choice,0#|1# ({1})|1< {0} Projects}
77
LBL_JavadocProjectAction_Name=&Generate Javadoc{0,choice,0#|1# ({1})|1< {0} Projects}
78
LBL_JavadocProjectAction_Name_popup=Generate Javadoc
79
LBL_RunProjectAction_Name=Run {0,choice,0#Project|1#"{1}" Project|1<{0} Projects}
80
LBL_RunProjectAction_Name_popup=Run
75
LBL_TestProjectAction_Name=&Test {0,choice,0#Project|1#Project ({1})|1<{0} Projects}
81
LBL_TestProjectAction_Name=&Test {0,choice,0#Project|1#Project ({1})|1<{0} Projects}
82
LBL_TestProjectAction_Name_popup=Test
76
LBL_CompileSingleAction_Name=Compi&le {0,choice,0#File|1#File|1<Files}
83
LBL_CompileSingleAction_Name=Compi&le {0,choice,0#File|1#File|1<Files}
77
LBL_StopBuildingAction_Name=&Stop Building
84
LBL_StopBuildingAction_Name=&Stop Building
78
LBL_DeleteProjectAction_Name=Delete
85
LBL_DeleteProjectAction_Name=Delete
Lines 80-87 Link Here
80
LBL_MoveProjectAction_Name=Move...
87
LBL_MoveProjectAction_Name=Move...
81
LBL_RenameProjectAction_Name=Rename...
88
LBL_RenameProjectAction_Name=Rename...
82
89
83
LBL_RunProjectAction_Name=Run {0,choice,0#Project|1#"{1}" Project|1<{0} Projects}
84
85
# Names of main project actions
90
# Names of main project actions
86
# {0} - # of selected projects (0 if disabled), or -1 if main project
91
# {0} - # of selected projects (0 if disabled), or -1 if main project
87
# {1} - project name, if exactly one project
92
# {1} - project name, if exactly one project
Lines 154-157 Link Here
154
LBL_SBA_select=&Select the processes to stop:
159
LBL_SBA_select=&Select the processes to stop:
155
TITLE_SBA=Stop Build/Run
160
TITLE_SBA=Stop Build/Run
156
LBL_SBA_stop=Stop
161
LBL_SBA_stop=Stop
157
(-)a/projectui/src/org/netbeans/modules/project/ui/resources/layer.xml (-3 / +18 lines)
Lines 57-62 Link Here
57
            <file name="org-netbeans-modules-project-ui-NewFile.instance">
57
            <file name="org-netbeans-modules-project-ui-NewFile.instance">
58
                <attr name="instanceClass" stringvalue="org.netbeans.modules.project.ui.actions.NewFile"/>
58
                <attr name="instanceClass" stringvalue="org.netbeans.modules.project.ui.actions.NewFile"/>
59
            </file>
59
            </file>
60
            <file name="org-netbeans-modules-project-ui-NewFile$WithSubMenu.instance">
61
                <attr name="instanceCreate" methodvalue="org.netbeans.modules.project.ui.actions.Actions.newFile"/>
62
            </file>
60
            
63
            
61
            <file name="org-netbeans-modules-project-ui-OpenProject.instance">
64
            <file name="org-netbeans-modules-project-ui-OpenProject.instance">
62
                <attr name="instanceClass" stringvalue="org.netbeans.modules.project.ui.actions.OpenProject"/>
65
                <attr name="instanceClass" stringvalue="org.netbeans.modules.project.ui.actions.OpenProject"/>
Lines 65-71 Link Here
65
            <file name="org-netbeans-modules-project-ui-CloseProject.instance">
68
            <file name="org-netbeans-modules-project-ui-CloseProject.instance">
66
                <attr name="instanceClass" stringvalue="org.netbeans.modules.project.ui.actions.CloseProject"/>
69
                <attr name="instanceClass" stringvalue="org.netbeans.modules.project.ui.actions.CloseProject"/>
67
            </file>
70
            </file>
68
            
71
72
            <file name="org-netbeans-modules-project-ui-actions-OpenSubprojects.instance"/>
73
69
            <file name="org-netbeans-modules-project-ui-CustomizeProject.instance">
74
            <file name="org-netbeans-modules-project-ui-CustomizeProject.instance">
70
                <attr name="instanceClass" stringvalue="org.netbeans.modules.project.ui.actions.CustomizeProject"/>
75
                <attr name="instanceClass" stringvalue="org.netbeans.modules.project.ui.actions.CustomizeProject"/>
71
            </file>
76
            </file>
Lines 138-145 Link Here
138
                <attr name="instanceCreate" methodvalue="org.netbeans.modules.project.ui.actions.Actions.rebuildProjectAction"/>
143
                <attr name="instanceCreate" methodvalue="org.netbeans.modules.project.ui.actions.Actions.rebuildProjectAction"/>
139
            </file>
144
            </file>
140
            <file name="org-netbeans-modules-project-ui-actions-StopBuildingAction.instance"/>
145
            <file name="org-netbeans-modules-project-ui-actions-StopBuildingAction.instance"/>
141
            <file name="org-netbeans-modules-project-ui-SetMainProjectPopupWithoutContext.instance">
146
142
                <attr name="instanceClass" stringvalue="org.netbeans.modules.project.ui.actions.SetMainProject$PopupWithoutContext"/>
147
            <file name="org-netbeans-modules-project-ui-RenameProject.instance">
148
                <attr name="instanceCreate" methodvalue="org.netbeans.modules.project.ui.actions.Actions.renameProject"/>
149
            </file>
150
            <file name="org-netbeans-modules-project-ui-MoveProject.instance">
151
                <attr name="instanceCreate" methodvalue="org.netbeans.modules.project.ui.actions.Actions.moveProject"/>
152
            </file>
153
            <file name="org-netbeans-modules-project-ui-CopyProject.instance">
154
                <attr name="instanceCreate" methodvalue="org.netbeans.modules.project.ui.actions.Actions.copyProject"/>
155
            </file>
156
            <file name="org-netbeans-modules-project-ui-DeleteProject.instance">
157
                <attr name="instanceCreate" methodvalue="org.netbeans.modules.project.ui.actions.Actions.deleteProject"/>
143
            </file>
158
            </file>
144
159
145
            <!-- Project tabs opening -->
160
            <!-- Project tabs opening -->
(-)a/projectuiapi/src/org/netbeans/spi/project/ui/LogicalViewProvider.java (+2 lines)
Lines 41-46 Link Here
41
41
42
package org.netbeans.spi.project.ui;
42
package org.netbeans.spi.project.ui;
43
43
44
import org.netbeans.spi.project.ui.support.CommonProjectActions;
44
import org.openide.nodes.Node;
45
import org.openide.nodes.Node;
45
46
46
/**
47
/**
Lines 64-69 Link Here
64
     * <em>As of <code>org.netbeans.modules.projectuiapi/1 1.31</code></em>
65
     * <em>As of <code>org.netbeans.modules.projectuiapi/1 1.31</code></em>
65
     * </p>
66
     * </p>
66
     * @return a node displaying the contents of the project in an intuitive way
67
     * @return a node displaying the contents of the project in an intuitive way
68
     * @see CommonProjectActions#forType
67
     */
69
     */
68
    Node createLogicalView();
70
    Node createLogicalView();
69
    
71
    
(-)a/projectuiapi/src/org/netbeans/spi/project/ui/support/CommonProjectActions.java (+17 lines)
Lines 41-48 Link Here
41
41
42
package org.netbeans.spi.project.ui.support;
42
package org.netbeans.spi.project.ui.support;
43
43
44
import java.util.List;
44
import javax.swing.Action;
45
import javax.swing.Action;
45
import org.netbeans.modules.project.uiapi.Utilities;
46
import org.netbeans.modules.project.uiapi.Utilities;
47
import org.netbeans.spi.project.ui.LogicalViewProvider;
46
48
47
/**
49
/**
48
 * Factory for commonly needed generic project actions.
50
 * Factory for commonly needed generic project actions.
Lines 216-219 Link Here
216
        return Utilities.getActionsFactory().setProjectConfigurationAction();
218
        return Utilities.getActionsFactory().setProjectConfigurationAction();
217
    }
219
    }
218
220
221
    /**
222
     * Loads actions to be displayed in the context menu of {@link LogicalViewProvider#createLogicalView}.
223
     * The current implementation simply loads actions from {@code Projects/<projectType>/Actions}
224
     * but in the future it may merge in actions from another location as well.
225
     * <p>The folder is recommended to contain a link to {@code Projects/Actions} at some position
226
     * in order to pick up miscellaneous actions applicable to all project types.
227
     * @param projectType a type token, such as {@code org-netbeans-modules-java-j2seproject}
228
     * @return a list of actions
229
     * @since org.netbeans.modules.projectuiapi/1 XXX
230
     */
231
    public static Action[] forType(String projectType) {
232
        List<? extends Action> actions = org.openide.util.Utilities.actionsForPath("Projects/" + projectType + "/Actions");
233
        return actions.toArray(new Action[actions.size()]);
234
    }
235
219
}
236
}

Return to bug 182488