Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
View | Details | Raw Unified | Return to bug 180979 | Differences between
and this patch

Collapse All | Expand All

(-)core.startup/src/org/netbeans/core/startup/ManifestSection.java (+1 lines)
 Lines 268-273    Link Here 
268
            // no section tag
268
            // no section tag
269
            return null;
269
            return null;
270
        } else if (sectionName.equalsIgnoreCase("Action")) { // NOI18N
270
        } else if (sectionName.equalsIgnoreCase("Action")) { // NOI18N
271
            warnObsolete(sectionName, module);
271
            return new ActionSection(name, module);
272
            return new ActionSection(name, module);
272
        } else if (sectionName.equalsIgnoreCase("Option")) { // NOI18N
273
        } else if (sectionName.equalsIgnoreCase("Option")) { // NOI18N
273
            warnObsolete(sectionName, module);
274
            warnObsolete(sectionName, module);
(-)diff/manifest.mf (-7 lines)
 Lines 4-13    Link Here 
4
OpenIDE-Module-Implementation-Version: 42
4
OpenIDE-Module-Implementation-Version: 42
5
OpenIDE-Module-Layer: org/netbeans/modules/diff/mf-layer.xml
5
OpenIDE-Module-Layer: org/netbeans/modules/diff/mf-layer.xml
6
AutoUpdate-Show-In-Client: false
6
AutoUpdate-Show-In-Client: false
7
8
Name: org/netbeans/modules/diff/DiffAction.class
9
OpenIDE-Module-Class: Action
10
11
Name: org/netbeans/modules/diff/PatchAction.class
12
OpenIDE-Module-Class: Action
13
(-)diff/nbproject/project.xml (-1 / +1 lines)
 Lines 173-179    Link Here 
173
                    <build-prerequisite/>
173
                    <build-prerequisite/>
174
                    <compile-dependency/>
174
                    <compile-dependency/>
175
                    <run-dependency>
175
                    <run-dependency>
176
                        <specification-version>6.2</specification-version>
176
                        <specification-version>6.15</specification-version>
177
                    </run-dependency>
177
                    </run-dependency>
178
                </dependency>
178
                </dependency>
179
                <dependency>
179
                <dependency>
(-)diff/src/org/netbeans/modules/diff/mf-layer.xml (+14 lines)
 Lines 49-54    Link Here 
49
          <file name="org-netbeans-modules-diff-PatchAction.instance"/>
49
          <file name="org-netbeans-modules-diff-PatchAction.instance"/>
50
      </folder>
50
      </folder>
51
  </folder>
51
  </folder>
52
  <folder name="UI">
53
      <folder name="ToolsActions">
54
          <folder name="Files">
55
              <file name="org-netbeans-modules-diff-PatchAction.shadow">
56
                  <attr name="position" intvalue="100"/>
57
                  <attr name="originalFile" stringvalue="Actions/Tools/org-netbeans-modules-diff-PatchAction.instance"/>
58
              </file>
59
              <file name="org-netbeans-modules-diff-DiffAction.shadow">
60
                  <attr name="position" intvalue="200"/>
61
                  <attr name="originalFile" stringvalue="Actions/Tools/org-netbeans-modules-diff-DiffAction.instance"/>
62
              </file>
63
          </folder>
64
      </folder>
65
  </folder>
52
    
66
    
53
    <folder name="Services">
67
    <folder name="Services">
54
        <folder name="DiffProviders">
68
        <folder name="DiffProviders">
(-)favorites/manifest.mf (-4 lines)
 Lines 5-11    Link Here 
5
OpenIDE-Module-Layer: org/netbeans/modules/favorites/resources/layer.xml
5
OpenIDE-Module-Layer: org/netbeans/modules/favorites/resources/layer.xml
6
AutoUpdate-Show-In-Client: false
6
AutoUpdate-Show-In-Client: false
7
AutoUpdate-Essential-Module: true
7
AutoUpdate-Essential-Module: true
8
9
Name: org/netbeans/modules/favorites/Actions$Add.class
10
OpenIDE-Module-Class: Action
11
(-)favorites/nbproject/project.xml (-1 / +1 lines)
 Lines 60-66    Link Here 
60
                    <build-prerequisite/>
60
                    <build-prerequisite/>
61
                    <compile-dependency/>
61
                    <compile-dependency/>
62
                    <run-dependency>
62
                    <run-dependency>
63
                        <specification-version>6.2</specification-version>
63
                        <specification-version>6.15</specification-version>
64
                    </run-dependency>
64
                    </run-dependency>
65
                </dependency>
65
                </dependency>
66
                <dependency>
66
                <dependency>
(-)favorites/src/org/netbeans/modules/favorites/resources/layer.xml (+11 lines)
 Lines 92-97    Link Here 
92
            </file>
92
            </file>
93
            </folder>
93
            </folder>
94
    </folder>
94
    </folder>
95
96
  <folder name="UI">
97
      <folder name="ToolsActions">
98
          <folder name="Files">
99
              <file name="org-netbeans-modules-favorites-Add.shadow">
100
                  <attr name="position" intvalue="300"/>
101
                  <attr name="originalFile" stringvalue="Actions/Window/org-netbeans-modules-favorites-Add.instance"/>
102
              </file>
103
          </folder>
104
      </folder>
105
  </folder>
95
    
106
    
96
    <!-- default workspaces, frames and their layout defined by core-->
107
    <!-- default workspaces, frames and their layout defined by core-->
97
    <folder name="Windows2">
108
    <folder name="Windows2">
(-)form/manifest.mf (-3 lines)
 Lines 10-15    Link Here 
10
  org.openide.modules.InstalledFileLocator
10
  org.openide.modules.InstalledFileLocator
11
OpenIDE-Module-Layer: org/netbeans/modules/form/resources/layer.xml
11
OpenIDE-Module-Layer: org/netbeans/modules/form/resources/layer.xml
12
AutoUpdate-Show-In-Client: false
12
AutoUpdate-Show-In-Client: false
13
14
Name: org/netbeans/modules/form/actions/InstallToPaletteAction.class
15
OpenIDE-Module-Class: Action
(-)form/nbproject/project.xml (-1 / +1 lines)
 Lines 247-253    Link Here 
247
                    <build-prerequisite/>
247
                    <build-prerequisite/>
248
                    <compile-dependency/>
248
                    <compile-dependency/>
249
                    <run-dependency>
249
                    <run-dependency>
250
                        <specification-version>6.2</specification-version>
250
                        <specification-version>6.15</specification-version>
251
                    </run-dependency>
251
                    </run-dependency>
252
                </dependency>
252
                </dependency>
253
                <dependency>
253
                <dependency>
(-)form/src/org/netbeans/modules/form/resources/layer.xml (+10 lines)
 Lines 117-122    Link Here 
117
        </folder>
117
        </folder>
118
    </folder>
118
    </folder>
119
119
120
    <folder name="UI">
121
        <folder name="ToolsActions">
122
            <folder name="Java">
123
                <file name="org-netbeans-modules-form-actions-InstallToPaletteAction.shadow">
124
                    <attr name="originalFile" stringvalue="Actions/Form/org-netbeans-modules-form-actions-InstallToPaletteAction.instance"/>
125
                </file>
126
            </folder>
127
        </folder>
128
    </folder>
129
120
    <folder name="Menu">
130
    <folder name="Menu">
121
        <folder name="Window">
131
        <folder name="Window">
122
            <folder name="Navigator">
132
            <folder name="Navigator">
(-)j2ee.sun.appsrv81/nbproject/project.xml (-1 / +1 lines)
 Lines 264-270    Link Here 
264
                    <build-prerequisite/>
264
                    <build-prerequisite/>
265
                    <compile-dependency/>
265
                    <compile-dependency/>
266
                    <run-dependency>
266
                    <run-dependency>
267
                        <specification-version>6.2</specification-version>
267
                        <specification-version>6.15</specification-version>
268
                    </run-dependency>
268
                    </run-dependency>
269
                </dependency>
269
                </dependency>
270
                <dependency>
270
                <dependency>
(-)j2ee.sun.appsrv81/src/org/netbeans/modules/j2ee/sun/ide/j2ee/layer.xml (+10 lines)
 Lines 309-314    Link Here 
309
                <attr name="serverNodeHidden" boolvalue="true"/>
309
                <attr name="serverNodeHidden" boolvalue="true"/>
310
                <attr name="wizardMessage" bundlevalue="org.netbeans.modules.j2ee.sun.ide.Bundle#CTL_InfoWizard"/>
310
                <attr name="wizardMessage" bundlevalue="org.netbeans.modules.j2ee.sun.ide.Bundle#CTL_InfoWizard"/>
311
            </file>
311
            </file>
312
            <file name="org-netbeans-modules-j2ee-sun-ide-j2ee-runtime-actions.instance"/>
312
        </folder>        
313
        </folder>        
313
    </folder>
314
    </folder>
314
    <folder name="Servers">
315
    <folder name="Servers">
 Lines 323-328    Link Here 
323
        </folder>
324
        </folder>
324
    </folder>
325
    </folder>
325
326
327
    <folder name="UI">
328
        <folder name="ToolsActions">
329
            <folder name="Java">
330
                <file name="org-netbeans-modules-j2ee-sun-ide-j2ee-runtime-actions.shadow">
331
                    <attr name="originalFile" stringvalue="Actions/Help/org-netbeans-modules-j2ee-sun-ide-j2ee-runtime-actions.instance"/>
332
                </file>
333
            </folder>
334
        </folder>
335
    </folder>
326
336
327
  <!--folder name="Menu">
337
  <!--folder name="Menu">
328
        <folder name="Tools">
338
        <folder name="Tools">
(-)j2ee.sun.appsrv81/src/org/netbeans/modules/j2ee/sun/ide/j2ee/runtime/actions/RunASVerifierAction.java (-2 lines)
 Lines 42-49    Link Here 
42
package org.netbeans.modules.j2ee.sun.ide.j2ee.runtime.actions;
42
package org.netbeans.modules.j2ee.sun.ide.j2ee.runtime.actions;
43
43
44
import java.io.File;
44
import java.io.File;
45
import java.util.logging.Logger;
46
import org.netbeans.modules.j2ee.sun.ide.j2ee.PluginProperties;
47
import org.openide.nodes.Node;
45
import org.openide.nodes.Node;
48
import org.openide.util.HelpCtx;
46
import org.openide.util.HelpCtx;
49
import org.openide.filesystems.FileObject;
47
import org.openide.filesystems.FileObject;
(-)java.hints/manifest.mf (-3 lines)
 Lines 4-9    Link Here 
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/java/hints/resources/Bundle.properties
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/java/hints/resources/Bundle.properties
5
OpenIDE-Module-Layer: org/netbeans/modules/java/hints/resources/layer.xml
5
OpenIDE-Module-Layer: org/netbeans/modules/java/hints/resources/layer.xml
6
AutoUpdate-Show-In-Client: false
6
AutoUpdate-Show-In-Client: false
7
8
Name: org/netbeans/modules/java/hints/analyzer/AnalyzeFolder$ToolsAction.class
9
OpenIDE-Module-Class: Action
(-)java.hints/nbproject/project.xml (-1 / +1 lines)
 Lines 313-319    Link Here 
313
                    <build-prerequisite/>
313
                    <build-prerequisite/>
314
                    <compile-dependency/>
314
                    <compile-dependency/>
315
                    <run-dependency>
315
                    <run-dependency>
316
                        <specification-version>6.12</specification-version>
316
                        <specification-version>6.15</specification-version>
317
                    </run-dependency>
317
                    </run-dependency>
318
                </dependency>
318
                </dependency>
319
                <dependency>
319
                <dependency>
(-)java.hints/src/org/netbeans/modules/java/hints/resources/layer.xml (+9 lines)
 Lines 86-91    Link Here 
86
            </folder>
86
            </folder>
87
        </folder>
87
        </folder>
88
    </folder>
88
    </folder>
89
    <folder name="UI">
90
        <folder name="ToolsActions">
91
            <folder name="Java">
92
                <file name="org-netbeans-modules-java-hints-analyzer-AnalyzeFolder.shadow">
93
                    <attr name="originalFile" stringvalue="Actions/Source/org-netbeans-modules-java-hints-analyzer-AnalyzeFolder.instance"/>
94
                </file>
95
            </folder>
96
        </folder>
97
    </folder>
89
    <folder name="Editors">
98
    <folder name="Editors">
90
        <folder name="text">
99
        <folder name="text">
91
            <folder name="x-java">
100
            <folder name="x-java">
(-)junit/manifest.mf (-4 lines)
 Lines 5-11    Link Here 
5
OpenIDE-Module-Specification-Version: 2.35
5
OpenIDE-Module-Specification-Version: 2.35
6
OpenIDE-Module-Needs: javax.script.ScriptEngine.freemarker
6
OpenIDE-Module-Needs: javax.script.ScriptEngine.freemarker
7
AutoUpdate-Show-In-Client: false
7
AutoUpdate-Show-In-Client: false
8
9
Name: org/netbeans/modules/junit/CreateTestAction.class
10
OpenIDE-Module-Class: Action
11
(-)junit/nbproject/project.xml (+6 lines)
 Lines 198-203    Link Here 
198
                    </run-dependency>
198
                    </run-dependency>
199
                </dependency>
199
                </dependency>
200
                <dependency>
200
                <dependency>
201
                    <code-name-base>org.openide.actions</code-name-base>
202
                    <run-dependency>
203
                        <specification-version>6.15</specification-version>
204
                    </run-dependency>
205
                </dependency>
206
                <dependency>
201
                    <code-name-base>org.openide.awt</code-name-base>
207
                    <code-name-base>org.openide.awt</code-name-base>
202
                    <build-prerequisite/>
208
                    <build-prerequisite/>
203
                    <compile-dependency/>
209
                    <compile-dependency/>
(-)junit/src/org/netbeans/modules/junit/resources/layer.xml (+9 lines)
 Lines 171-176    Link Here 
171
            <file name="org-netbeans-modules-junit-CreateTestAction.instance"/>
171
            <file name="org-netbeans-modules-junit-CreateTestAction.instance"/>
172
        </folder>
172
        </folder>
173
    </folder>
173
    </folder>
174
    <folder name="UI">
175
        <folder name="ToolsActions">
176
            <folder name="Java">
177
                <file name="org-netbeans-modules-junit-CreateTestAction.shadow">
178
                    <attr name="originalFile" stringvalue="Actions/JUnitTests/org-netbeans-modules-junit-CreateTestAction.instance"/>
179
                </file>
180
            </folder>
181
        </folder>
182
    </folder>
174
    
183
    
175
    <!-- shortcuts -->
184
    <!-- shortcuts -->
176
    <folder name="Shortcuts">
185
    <folder name="Shortcuts">
(-)o.n.core/nbproject/project.xml (-1 / +1 lines)
 Lines 83-89    Link Here 
83
                    <build-prerequisite/>
83
                    <build-prerequisite/>
84
                    <compile-dependency/>
84
                    <compile-dependency/>
85
                    <run-dependency>
85
                    <run-dependency>
86
                        <specification-version>6.2</specification-version>
86
                        <specification-version>6.15</specification-version>
87
                    </run-dependency>
87
                    </run-dependency>
88
                </dependency>
88
                </dependency>
89
                <dependency>
89
                <dependency>
(-)o.n.core/src/org/netbeans/core/ModuleActions.java (-25 / +51 lines)
 Lines 49-58    Link Here 
49
import javax.swing.Action;
49
import javax.swing.Action;
50
50
51
import org.openide.actions.ActionManager;
51
import org.openide.actions.ActionManager;
52
import org.openide.util.actions.SystemAction;
53
import org.openide.util.Lookup;
52
import org.openide.util.Lookup;
54
53
55
import org.netbeans.core.startup.ManifestSection;
54
import org.netbeans.core.startup.ManifestSection;
55
import org.openide.util.LookupEvent;
56
import org.openide.util.LookupListener;
57
import org.openide.util.lookup.Lookups;
56
58
57
59
58
/**
60
/**
 Lines 60-76    Link Here 
60
 * @author Jaroslav Tulach, Jesse Glick
62
 * @author Jaroslav Tulach, Jesse Glick
61
 */
63
 */
62
@org.openide.util.lookup.ServiceProvider(service=org.openide.actions.ActionManager.class)
64
@org.openide.util.lookup.ServiceProvider(service=org.openide.actions.ActionManager.class)
63
public class ModuleActions extends ActionManager
65
public class ModuleActions extends ActionManager implements LookupListener {
64
/*implements PropertyChangeListener*/ {
65
66
    /** array of all actions added by modules */
66
    /** array of all actions added by modules */
67
    private static SystemAction[] array;
67
    private List<Action> array;
68
    /** of (ModuleItem, List (ManifestSection.ActionSection)) */
68
    /** of (ModuleItem, List (ManifestSection.ActionSection)) */
69
    private static Map<Object,List<ManifestSection.ActionSection>> map = new HashMap<Object,List<ManifestSection.ActionSection>> (8);
69
    private static Map<Object,List<ManifestSection.ActionSection>> map = new HashMap<Object,List<ManifestSection.ActionSection>> (8);
70
    /** current module */
70
    /** current module */
71
    private static Object module = null;
71
    private static Object module = null;
72
    /** Map of currently running actions */
72
    /** Map of currently running actions */
73
    private Map<ActionEvent,Action> runningActions = new HashMap<ActionEvent,Action>();
73
    private final Map<ActionEvent,Action> runningActions = new HashMap<ActionEvent,Action>();
74
    /** result of changes */
75
    private final Lookup.Result<Action> result;
76
77
    @SuppressWarnings("LeakingThisInConstructor")
78
    public ModuleActions() {
79
        result = Lookups.forPath("UI/ToolsActions").lookupResult(Action.class);
80
        result.addLookupListener(this);
81
    }
74
82
75
    public static ModuleActions getDefaultInstance() {
83
    public static ModuleActions getDefaultInstance() {
76
        ActionManager mgr = ActionManager.getDefault();
84
        ActionManager mgr = ActionManager.getDefault();
 Lines 81-92    Link Here 
81
    /** Array with all activated actions.
89
    /** Array with all activated actions.
82
    * Can contain null that will be replaced by separators.
90
    * Can contain null that will be replaced by separators.
83
    */
91
    */
84
    public SystemAction[] getContextActions () {
92
    @Override
85
        SystemAction[] a = array;
93
    protected List<Action> getToolsActions() {
94
        List<Action> a = array;
86
        if (a != null) {
95
        if (a != null) {
87
            return a;
96
            return a;
88
        }
97
        }
89
        array = a = createActions ();
98
        array = a = Collections.unmodifiableList(createActions());
90
        return a;
99
        return a;
91
    }
100
    }
92
    
101
    
 Lines 94-102    Link Here 
94
     * actions.
103
     * actions.
95
     */
104
     */
96
    @SuppressWarnings("deprecation")
105
    @SuppressWarnings("deprecation")
106
    @Override
97
    public void invokeAction(final Action a, final ActionEvent e) {
107
    public void invokeAction(final Action a, final ActionEvent e) {
98
        try {
108
        try {
99
            org.openide.util.Mutex.EVENT.readAccess (new Runnable() {
109
            org.openide.util.Mutex.EVENT.readAccess (new Runnable() {
110
                @Override
100
                public void run() {
111
                public void run() {
101
                    showWaitCursor(e);
112
                    showWaitCursor(e);
102
                }
113
                }
 Lines 107-112    Link Here 
107
        } finally {
118
        } finally {
108
            removeRunningAction(e);
119
            removeRunningAction(e);
109
            org.openide.util.Mutex.EVENT.readAccess (new Runnable() {
120
            org.openide.util.Mutex.EVENT.readAccess (new Runnable() {
121
                @Override
110
                public void run() {
122
                public void run() {
111
                    hideWaitCursor(e);
123
                    hideWaitCursor(e);
112
                }
124
                }
 Lines 176-182    Link Here 
176
        list.add (a);
188
        list.add (a);
177
        //a.addPropertyChangeListener (INSTANCE);
189
        //a.addPropertyChangeListener (INSTANCE);
178
190
179
        array = null;
191
        getDefaultInstance().array = null;
180
        getDefaultInstance().fireChange (); // PENDING this is too often
192
        getDefaultInstance().fireChange (); // PENDING this is too often
181
    }
193
    }
182
194
 Lines 194-209    Link Here 
194
            map.remove (module);
206
            map.remove (module);
195
        }
207
        }
196
208
197
        array = null;
209
        getDefaultInstance().array = null;
198
        getDefaultInstance().fireChange (); // PENDING this is too often
210
        getDefaultInstance().fireChange (); // PENDING this is too often
199
    }
211
    }
200
212
201
    /** Creates the actions.
213
    /** Creates the actions.
202
    */
214
    */
203
    private synchronized static SystemAction[] createActions () {
215
    private synchronized List<Action> createActions () {
204
        Iterator<List<ManifestSection.ActionSection>> it = map.values ().iterator ();
216
        Iterator<List<ManifestSection.ActionSection>> it = map.values ().iterator ();
205
217
206
        ArrayList<Object> arr = new ArrayList<Object> (map.size () * 5);
218
        ArrayList<Action> arr = new ArrayList<Action> (map.size () * 5);
207
219
208
        while (it.hasNext ()) {
220
        while (it.hasNext ()) {
209
            List<ManifestSection.ActionSection> l = it.next ();
221
            List<ManifestSection.ActionSection> l = it.next ();
 Lines 213-233    Link Here 
213
                ManifestSection.ActionSection s = actions.next();
225
                ManifestSection.ActionSection s = actions.next();
214
                
226
                
215
                try {
227
                try {
216
                    arr.add (s.getInstance ());
228
                    arr.add ((Action)s.getInstance ());
217
                } catch (Exception ex) {
229
                } catch (Exception ex) {
218
                    Logger.getLogger(ModuleActions.class.getName()).log(Level.WARNING, null, ex);
230
                    Logger.getLogger(ModuleActions.class.getName()).log(Level.WARNING, null, ex);
219
                }
231
                }
220
            }
232
            }
221
            
222
            
223
            if (it.hasNext ()) {
233
            if (it.hasNext ()) {
224
                // add separator between modules
234
                // add separator between modules
225
                arr.add (null);
235
                arr.add (null);
226
            }
236
            }
227
228
        }
237
        }
229
238
230
        return (SystemAction[])arr.toArray (new SystemAction[arr.size ()]);
239
        String pref = arr.isEmpty() ? null : "";
240
        for (Lookup.Item<Action> item : result.allItems()) {
241
            final Action action = item.getInstance();
242
            if (action == null) {
243
                continue;
244
            }
245
            String where = item.getId().replaceFirst("[^/]*$", "");
246
            if (pref != null && !pref.equals(where)) {
247
                arr.add(null);
248
            }
249
            pref = where;
250
            arr.add(action);
251
        }
252
253
        return arr;
231
    }
254
    }
232
255
233
    
256
    
 Lines 263-275    Link Here 
263
        assert !glassPaneUses.containsKey(key);
286
        assert !glassPaneUses.containsKey(key);
264
        java.awt.Component c = activeGlassPane();
287
        java.awt.Component c = activeGlassPane();
265
        if (c == null) {
288
        if (c == null) {
266
            err.warning("showWaitCursor could not find a suitable glass pane; key=" + key);
289
            err.log(Level.WARNING, "showWaitCursor could not find a suitable glass pane; key={0}", key);
267
            return;
290
            return;
268
        }
291
        }
269
        if (glassPaneUses.values().contains(c)) {
292
        if (glassPaneUses.values().contains(c)) {
270
            err.fine("wait cursor already displayed on " + c);
293
            err.log(Level.FINE, "wait cursor already displayed on {0}", c);
271
        } else {
294
        } else {
272
            err.fine("wait cursor will be displayed on " + c);
295
            err.log(Level.FINE, "wait cursor will be displayed on {0}", c);
273
            c.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
296
            c.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
274
            c.setVisible(true);
297
            c.setVisible(true);
275
        }
298
        }
 Lines 288-301    Link Here 
288
        }
311
        }
289
        glassPaneUses.remove(key);
312
        glassPaneUses.remove(key);
290
        if (glassPaneUses.values().contains(c)) {
313
        if (glassPaneUses.values().contains(c)) {
291
            err.fine("wait cursor still displayed on " + c);
314
            err.log(Level.FINE, "wait cursor still displayed on {0}", c);
292
        } else {
315
        } else {
293
            err.fine("wait cursor will be hidden on " + c);
316
            err.log(Level.FINE, "wait cursor will be hidden on {0}", c);
294
            c.setVisible(false);
317
            c.setVisible(false);
295
            c.setCursor(null);
318
            c.setCursor(null);
296
        }
319
        }
297
    }
320
    }
298
    
321
299
    
322
    @Override
323
    public void resultChanged(LookupEvent ev) {
324
        array = null;
325
    }
300
}
326
}
301
327
(-)o.n.core/src/org/netbeans/core/resources/mf-layer.xml (+5 lines)
 Lines 98-101    Link Here 
98
        </folder>
98
        </folder>
99
    </folder>
99
    </folder>
100
100
101
    <folder name="UI">
102
        <folder name="ToolsActions">
103
        </folder>
104
    </folder>  <!-- UI -->
105
101
</filesystem>
106
</filesystem>
(-)o.n.core/test/unit/src/org/netbeans/core/ModuleActionsTest.java (-5 / +33 lines)
 Lines 41-48    Link Here 
41
41
42
package org.netbeans.core;
42
package org.netbeans.core;
43
43
44
import java.util.List;
45
import javax.swing.Action;
44
import org.netbeans.junit.*;
46
import org.netbeans.junit.*;
45
import junit.textui.TestRunner;
47
import org.openide.actions.CopyAction;
48
import org.openide.actions.CutAction;
49
import org.openide.actions.PasteAction;
50
import org.openide.filesystems.FileObject;
51
import org.openide.filesystems.FileUtil;
46
52
47
/** Tests behaviour of asynchronous actions and exit dialog.
53
/** Tests behaviour of asynchronous actions and exit dialog.
48
 */
54
 */
 Lines 52-61    Link Here 
52
        super(name);
58
        super(name);
53
    }
59
    }
54
60
55
    public static void main(String[] args) {
61
    @Override
56
        TestRunner.run(new NbTestSuite(ModuleActionsTest.class));
57
    }
58
59
    protected boolean runInEQ () {
62
    protected boolean runInEQ () {
60
        return true;
63
        return true;
61
    }
64
    }
 Lines 79-94    Link Here 
79
        fail ("Act should be running: " + col);
82
        fail ("Act should be running: " + col);
80
    }
83
    }
81
84
85
    public void testActionReadFromLayer () throws Exception {
86
        CopyAction copy = CopyAction.get(CopyAction.class);
87
        CutAction cut = CutAction.get(CutAction.class);
88
        PasteAction paste = PasteAction.get(PasteAction.class);
89
90
        FileObject fo = FileUtil.getConfigFile("UI/ToolsActions");
91
        assertNotNull("ToolsActions folder found", fo);
92
93
        fo.createFolder("Cat1").createData("org-openide-actions-CutAction.instance").setAttribute("position", 100);
94
        fo.getFileObject("Cat1").createData("org-openide-actions-PasteAction.instance").setAttribute("position", 200);
95
        fo.createFolder("Cat2").createData("org-openide-actions-CopyAction.instance");
96
97
        List<Action> toolsActions = ModuleActions.getDefaultInstance().getToolsActions();
98
        assertEquals("Four actions: " + toolsActions, 4, toolsActions.size());
99
        assertEquals("Cut first", cut, toolsActions.get(0));
100
        assertEquals("Paste snd", paste, toolsActions.get(1));
101
        assertEquals("Separator in middle", null, toolsActions.get(2));
102
        assertEquals("Copy last", copy, toolsActions.get(3));
103
104
    }
105
82
    public static class Act extends org.openide.util.actions.CallableSystemAction {
106
    public static class Act extends org.openide.util.actions.CallableSystemAction {
83
        
107
        
108
        @Override
84
        public org.openide.util.HelpCtx getHelpCtx () {
109
        public org.openide.util.HelpCtx getHelpCtx () {
85
            return org.openide.util.HelpCtx.DEFAULT_HELP;
110
            return org.openide.util.HelpCtx.DEFAULT_HELP;
86
        }
111
        }
87
        
112
        
113
        @Override
88
        public String getName () {
114
        public String getName () {
89
            return getClass().getName ();
115
            return getClass().getName ();
90
        }
116
        }
91
        
117
        
118
        @Override
92
        public synchronized void performAction () {
119
        public synchronized void performAction () {
93
            notifyAll ();
120
            notifyAll ();
94
            try {
121
            try {
 Lines 98-103    Link Here 
98
            }
125
            }
99
        }
126
        }
100
        
127
        
128
        @Override
101
        protected boolean asynchronous () {
129
        protected boolean asynchronous () {
102
            return true;
130
            return true;
103
        }
131
        }
(-)openide.actions/apichanges.xml (+14 lines)
 Lines 49-54    Link Here 
49
<changes>
49
<changes>
50
<change>
50
<change>
51
      <api name="actions"/>
51
      <api name="actions"/>
52
      <summary><code>ActionManager.getToolsActions</code></summary>
53
      <version major="6" minor="15"/>
54
      <date day="26" month="2" year="2010"/>
55
      <author login="jtulach"/>
56
      <compatibility addition="yes" binary="compatible" source="compatible" semantic="compatible" deprecation="no" deletion="no" modification="no"/>
57
      <description>
58
          New method <code>ActionManager.getToolsActions</code> allows
59
          plain swing <code>Action</code>s to appear inside of <b>tools action</b>.
60
      </description>
61
      <class package="org.openide.actions" name="ActionManager"/>
62
      <issue number="180979 "/>
63
</change>
64
<change>
65
      <api name="actions"/>
52
      <summary><code>HeapView</code> preserves its settings between sessions</summary>
66
      <summary><code>HeapView</code> preserves its settings between sessions</summary>
53
      <version major="6" minor="5"/>
67
      <version major="6" minor="5"/>
54
      <date day="24" month="6" year="2008"/>
68
      <date day="24" month="6" year="2008"/>
(-)openide.actions/manifest.mf (-1 / +1 lines)
 Lines 2-6    Link Here 
2
OpenIDE-Module: org.openide.actions
2
OpenIDE-Module: org.openide.actions
3
OpenIDE-Module-Localizing-Bundle: org/openide/actions/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/openide/actions/Bundle.properties
4
AutoUpdate-Essential-Module: true
4
AutoUpdate-Essential-Module: true
5
OpenIDE-Module-Specification-Version: 6.14
5
OpenIDE-Module-Specification-Version: 6.15
6
6
(-)openide.actions/src/org/openide/actions/ActionManager.java (-12 / +19 lines)
 Lines 46-51    Link Here 
46
import java.awt.event.ActionEvent;
46
import java.awt.event.ActionEvent;
47
47
48
import java.beans.*;
48
import java.beans.*;
49
import java.util.Arrays;
50
import java.util.List;
49
51
50
import javax.swing.Action;
52
import javax.swing.Action;
51
53
 Lines 73-79    Link Here 
73
        ActionManager am = Lookup.getDefault().lookup(ActionManager.class);
75
        ActionManager am = Lookup.getDefault().lookup(ActionManager.class);
74
76
75
        if (am == null) {
77
        if (am == null) {
76
            am = new Trivial();
78
            am = new ActionManager(){};
77
        }
79
        }
78
80
79
        return am;
81
        return am;
 Lines 84-91    Link Here 
84
    * Can contain <code>null</code>s that will be replaced by separators.
86
    * Can contain <code>null</code>s that will be replaced by separators.
85
    *
87
    *
86
    * @return array of actions
88
    * @return array of actions
89
     * @deprecated override {@link #getToolsActions()}
87
    */
90
    */
88
    public abstract SystemAction[] getContextActions();
91
    @Deprecated
92
    public SystemAction[] getContextActions() {
93
        return new SystemAction[0];
94
    }
95
96
    /** Get all registered actions that should be displayed
97
     * by the tools action.
98
     * Can contain <code>null</code>s that will be replaced by separators.
99
     *
100
     * @return an immutable list of actions
101
     * @since 6.15
102
     */
103
    protected List<Action> getToolsActions() {
104
        return Arrays.<Action>asList(getContextActions());
105
    }
89
106
90
    /** Invokes action in a RequestPrecessor dedicated to performing
107
    /** Invokes action in a RequestPrecessor dedicated to performing
91
     * actions.
108
     * actions.
 Lines 127-140    Link Here 
127
            supp.firePropertyChange(name, o, n);
144
            supp.firePropertyChange(name, o, n);
128
        }
145
        }
129
    }
146
    }
130
131
    /**
132
     * Trivial impl.
133
     * @see "#32092"
134
     */
135
    private static final class Trivial extends ActionManager {
136
        public SystemAction[] getContextActions() {
137
            return new SystemAction[0];
138
        }
139
    }
140
}
147
}
(-)openide.actions/src/org/openide/actions/ToolsAction.java (-9 / +35 lines)
 Lines 90-123    Link Here 
90
90
91
    /* @return name
91
    /* @return name
92
    */
92
    */
93
    @Override
93
    public String getName() {
94
    public String getName() {
94
        return getActionName();
95
        return getActionName();
95
    }
96
    }
96
97
97
    /* @return help for this action
98
    /* @return help for this action
98
    */
99
    */
100
    @Override
99
    public HelpCtx getHelpCtx() {
101
    public HelpCtx getHelpCtx() {
100
        return new HelpCtx(ToolsAction.class);
102
        return new HelpCtx(ToolsAction.class);
101
    }
103
    }
102
104
103
    /* @return menu presenter for the action
105
    /* @return menu presenter for the action
104
    */
106
    */
107
    @Override
105
    public JMenuItem getMenuPresenter() {
108
    public JMenuItem getMenuPresenter() {
106
        return new Inline(this);
109
        return new Inline(this);
107
    }
110
    }
108
111
109
    /* @return menu presenter for the action
112
    /* @return menu presenter for the action
110
    */
113
    */
114
    @Override
111
    public JMenuItem getPopupPresenter() {
115
    public JMenuItem getPopupPresenter() {
112
        return new Popup(this);
116
        return new Popup(this);
113
    }
117
    }
114
118
115
    /* Does nothing.
119
    /* Does nothing.
116
    */
120
    */
121
    @Override
117
    public void actionPerformed(java.awt.event.ActionEvent ev) {
122
    public void actionPerformed(java.awt.event.ActionEvent ev) {
118
        assert false;
123
        assert false;
119
    }
124
    }
120
125
126
    @Override
121
    public Action createContextAwareInstance(Lookup actionContext) {
127
    public Action createContextAwareInstance(Lookup actionContext) {
122
        return new DelegateAction(this, actionContext);
128
        return new DelegateAction(this, actionContext);
123
    }
129
    }
 Lines 136-143    Link Here 
136
    */
142
    */
137
    private static List<JMenuItem> generate(Action toolsAction, boolean forMenu) {
143
    private static List<JMenuItem> generate(Action toolsAction, boolean forMenu) {
138
        ActionManager am = ActionManager.getDefault();
144
        ActionManager am = ActionManager.getDefault();
139
        SystemAction[] actions = am.getContextActions();
145
        List<Action> actions = am.getToolsActions();
140
        List<JMenuItem> list = new ArrayList<JMenuItem>(actions.length);
146
        List<JMenuItem> list = new ArrayList<JMenuItem>(actions.size());
141
147
142
        boolean separator = false;
148
        boolean separator = false;
143
        boolean firstItemAdded = false; // flag to prevent adding separator before actual menu items
149
        boolean firstItemAdded = false; // flag to prevent adding separator before actual menu items
 Lines 211-217    Link Here 
211
    /** @deprecated Useless, see {@link ActionManager}. */
217
    /** @deprecated Useless, see {@link ActionManager}. */
212
    @Deprecated
218
    @Deprecated
213
    public static interface Model {
219
    public static interface Model {
214
        public SystemAction[] getActions();
220
        public Action[] getActions();
215
221
216
        public void addChangeListener(javax.swing.event.ChangeListener l);
222
        public void addChangeListener(javax.swing.event.ChangeListener l);
217
223
 Lines 235-240    Link Here 
235
241
236
242
237
        
243
        
244
        @Override
238
        public JComponent[] synchMenuPresenters(JComponent[] items) {
245
        public JComponent[] synchMenuPresenters(JComponent[] items) {
239
            if (timestamp == gl().getTimestamp()) {
246
            if (timestamp == gl().getTimestamp()) {
240
                return items;
247
                return items;
 Lines 246-251    Link Here 
246
        }
253
        }
247
        
254
        
248
        
255
        
256
        @Override
249
        public JComponent[] getMenuPresenters() {
257
        public JComponent[] getMenuPresenters() {
250
            return synchMenuPresenters(new JComponent[0]);
258
            return synchMenuPresenters(new JComponent[0]);
251
        }        
259
        }        
 Lines 271-281    Link Here 
271
        }
279
        }
272
280
273
        
281
        
282
        @Override
274
        public JComponent[] synchMenuPresenters(JComponent[] items) {
283
        public JComponent[] synchMenuPresenters(JComponent[] items) {
275
            return gl().isPopupEnabled(toolsAction) ? new JMenuItem[] { menu } : new JMenuItem[0];
284
            return gl().isPopupEnabled(toolsAction) ? new JMenuItem[] { menu } : new JMenuItem[0];
276
        }
285
        }
277
        
286
        
278
        
287
        
288
        @Override
279
        public JComponent[] getMenuPresenters() {
289
        public JComponent[] getMenuPresenters() {
280
            return synchMenuPresenters(new JComponent[0]);
290
            return synchMenuPresenters(new JComponent[0]);
281
        }                
291
        }                
 Lines 291-296    Link Here 
291
                super(getActionName());
301
                super(getActionName());
292
            }
302
            }
293
303
304
            @Override
294
            public JPopupMenu getPopupMenu() {
305
            public JPopupMenu getPopupMenu() {
295
                JPopupMenu popup = super.getPopupMenu();
306
                JPopupMenu popup = super.getPopupMenu();
296
                fillSubmenu(popup);
307
                fillSubmenu(popup);
 Lines 326-337    Link Here 
326
                }
337
                }
327
            }
338
            }
328
339
340
            @Override
329
            public void popupMenuCanceled(PopupMenuEvent e) {
341
            public void popupMenuCanceled(PopupMenuEvent e) {
330
            }
342
            }
331
343
344
            @Override
332
            public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
345
            public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
333
            }
346
            }
334
347
348
            @Override
335
            public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
349
            public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
336
                lastPopup.removePopupMenuListener(this);
350
                lastPopup.removePopupMenuListener(this);
337
                lastPopup = null; // clear the status and stop listening
351
                lastPopup = null; // clear the status and stop listening
 Lines 344-350    Link Here 
344
    private static class G implements PropertyChangeListener {
358
    private static class G implements PropertyChangeListener {
345
        public static final String PROP_STATE = "actionsState"; // NOI18N
359
        public static final String PROP_STATE = "actionsState"; // NOI18N
346
        private int timestamp = 1;
360
        private int timestamp = 1;
347
        private SystemAction[] actions = null;
361
        private Action[] actions = null;
348
        private PropertyChangeSupport supp = new PropertyChangeSupport(this);
362
        private PropertyChangeSupport supp = new PropertyChangeSupport(this);
349
363
350
        public G() {
364
        public G() {
 Lines 369-379    Link Here 
369
            timestamp++;
383
            timestamp++;
370
384
371
            // deregister all actions listeners
385
            // deregister all actions listeners
372
            SystemAction[] copy = actions;
386
            Action[] copy = actions;
373
387
374
            if (copy != null) {
388
            if (copy != null) {
375
                for (int i = 0; i < copy.length; i++) {
389
                for (int i = 0; i < copy.length; i++) {
376
                    SystemAction act = copy[i];
390
                    Action act = copy[i];
377
391
378
                    if (act != null) {
392
                    if (act != null) {
379
                        act.removePropertyChangeListener(this);
393
                        act.removePropertyChangeListener(this);
 Lines 385-391    Link Here 
385
            copy = am.getContextActions();
399
            copy = am.getContextActions();
386
400
387
            for (int i = 0; i < copy.length; i++) {
401
            for (int i = 0; i < copy.length; i++) {
388
                SystemAction act = copy[i];
402
                Action act = copy[i];
389
403
390
                if (act != null) {
404
                if (act != null) {
391
                    act.addPropertyChangeListener(this);
405
                    act.addPropertyChangeListener(this);
 Lines 402-413    Link Here 
402
            firePropertyChange(PROP_STATE, null, null); // tell the world
416
            firePropertyChange(PROP_STATE, null, null); // tell the world
403
        }
417
        }
404
418
419
        @Override
405
        public void propertyChange(PropertyChangeEvent ev) {
420
        public void propertyChange(PropertyChangeEvent ev) {
406
            String prop = ev.getPropertyName();
421
            String prop = ev.getPropertyName();
407
422
408
            if ((prop == null) || prop.equals(ActionManager.PROP_CONTEXT_ACTIONS)) {
423
            if ((prop == null) || prop.equals(ActionManager.PROP_CONTEXT_ACTIONS)) {
409
                actionsListChanged();
424
                actionsListChanged();
410
            } else if (prop.equals(SystemAction.PROP_ENABLED)) {
425
            } else if (prop.equals("enabled")) {
411
                actionStateChanged();
426
                actionStateChanged();
412
            }
427
            }
413
        }
428
        }
 Lines 417-423    Link Here 
417
         */
432
         */
418
        private boolean isPopupEnabled(Action toolsAction) {
433
        private boolean isPopupEnabled(Action toolsAction) {
419
            boolean en = false;
434
            boolean en = false;
420
            SystemAction[] copy = actions;
435
            Action[] copy = actions;
421
436
422
            // Get action conext.
437
            // Get action conext.
423
            Lookup lookup;
438
            Lookup lookup;
 Lines 470-517    Link Here 
470
        }
485
        }
471
486
472
        /** Overrides superclass method, adds delegate description. */
487
        /** Overrides superclass method, adds delegate description. */
488
        @Override
473
        public String toString() {
489
        public String toString() {
474
            return super.toString() + "[delegate=" + delegate + "]"; // NOI18N
490
            return super.toString() + "[delegate=" + delegate + "]"; // NOI18N
475
        }
491
        }
476
492
477
        /** Implements <code>Lookup.Provider</code>. */
493
        /** Implements <code>Lookup.Provider</code>. */
494
        @Override
478
        public Lookup getLookup() {
495
        public Lookup getLookup() {
479
            return lookup;
496
            return lookup;
480
        }
497
        }
481
498
499
        @Override
482
        public void actionPerformed(java.awt.event.ActionEvent e) {
500
        public void actionPerformed(java.awt.event.ActionEvent e) {
483
        }
501
        }
484
502
503
        @Override
485
        public void putValue(String key, Object o) {
504
        public void putValue(String key, Object o) {
486
        }
505
        }
487
506
507
        @Override
488
        public Object getValue(String key) {
508
        public Object getValue(String key) {
489
            return delegate.getValue(key);
509
            return delegate.getValue(key);
490
        }
510
        }
491
511
512
        @Override
492
        public boolean isEnabled() {
513
        public boolean isEnabled() {
493
            // Irrelevant see G#isPopupEnabled(..).
514
            // Irrelevant see G#isPopupEnabled(..).
494
            return delegate.isEnabled();
515
            return delegate.isEnabled();
495
        }
516
        }
496
517
518
        @Override
497
        public void setEnabled(boolean b) {
519
        public void setEnabled(boolean b) {
498
            // Irrelevant see G#isPopupEnabled(..).
520
            // Irrelevant see G#isPopupEnabled(..).
499
        }
521
        }
500
522
523
        @Override
501
        public void addPropertyChangeListener(PropertyChangeListener listener) {
524
        public void addPropertyChangeListener(PropertyChangeListener listener) {
502
            support.addPropertyChangeListener(listener);
525
            support.addPropertyChangeListener(listener);
503
        }
526
        }
504
527
528
        @Override
505
        public void removePropertyChangeListener(PropertyChangeListener listener) {
529
        public void removePropertyChangeListener(PropertyChangeListener listener) {
506
            support.removePropertyChangeListener(listener);
530
            support.removePropertyChangeListener(listener);
507
        }
531
        }
508
532
509
        /** Implements <code>Presenter.Menu</code>. */
533
        /** Implements <code>Presenter.Menu</code>. */
534
        @Override
510
        public javax.swing.JMenuItem getMenuPresenter() {
535
        public javax.swing.JMenuItem getMenuPresenter() {
511
            return new Inline(this);
536
            return new Inline(this);
512
        }
537
        }
513
538
514
        /** Implements <code>Presenter.Popup</code>. */
539
        /** Implements <code>Presenter.Popup</code>. */
540
        @Override
515
        public javax.swing.JMenuItem getPopupPresenter() {
541
        public javax.swing.JMenuItem getPopupPresenter() {
516
            return new ToolsAction.Popup(this);
542
            return new ToolsAction.Popup(this);
517
        }
543
        }
(-)php.project/manifest.mf (-3 lines)
 Lines 4-9    Link Here 
4
OpenIDE-Module: org.netbeans.modules.php.project
4
OpenIDE-Module: org.netbeans.modules.php.project
5
OpenIDE-Module-Layer: org/netbeans/modules/php/project/resources/layer.xml
5
OpenIDE-Module-Layer: org/netbeans/modules/php/project/resources/layer.xml
6
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/php/project/resources/Bundle.properties
6
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/php/project/resources/Bundle.properties
7
8
Name: org/netbeans/modules/php/project/ui/actions/tests/CreateTestsAction.class
9
OpenIDE-Module-Class: Action
(-)php.project/nbproject/project.xml (-1 / +1 lines)
 Lines 243-249    Link Here 
243
                    <build-prerequisite/>
243
                    <build-prerequisite/>
244
                    <compile-dependency/>
244
                    <compile-dependency/>
245
                    <run-dependency>
245
                    <run-dependency>
246
                        <specification-version>6.6</specification-version>
246
                        <specification-version>6.15</specification-version>
247
                    </run-dependency>
247
                    </run-dependency>
248
                </dependency>
248
                </dependency>
249
                <dependency>
249
                <dependency>
(-)php.project/src/org/netbeans/modules/php/project/resources/layer.xml (+9 lines)
 Lines 55-60    Link Here 
55
            <file name="org-netbeans-modules-php-project-ui-actions-tests-CreateTestsAction.instance"/>
55
            <file name="org-netbeans-modules-php-project-ui-actions-tests-CreateTestsAction.instance"/>
56
        </folder>
56
        </folder>
57
    </folder>
57
    </folder>
58
    <folder name="UI">
59
        <folder name="ToolsActions">
60
            <folder name="PHP">
61
                <file name="org-netbeans-modules-php-project-ui-actions-tests-CreateTestsAction.shadow">
62
                    <attr name="originalFile" stringvalue="Actions/JUnitTests/org-netbeans-modules-php-project-ui-actions-tests-CreateTestsAction.instance"/>
63
                </file>
64
            </folder>
65
        </folder>
66
    </folder>
58
67
59
    <!-- uncomment/change default values for actions Download, Upload
68
    <!-- uncomment/change default values for actions Download, Upload
60
    <folder name="Shortcuts">
69
    <folder name="Shortcuts">

Return to bug 180979
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo