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 179289
Collapse All | Expand All

(-)a/api.progress/apichanges.xml (+16 lines)
Lines 105-110 Link Here
105
    <!-- ACTUAL CHANGES BEGIN HERE: -->
105
    <!-- ACTUAL CHANGES BEGIN HERE: -->
106
106
107
  <changes>
107
  <changes>
108
    <change id="spi">
109
        <api name="progress_api"/>
110
        <summary>SPI added</summary>
111
        <version major="1" minor="18"/>
112
        <date day="8" month="1" year="2010"/>
113
        <author login="jglick"/>
114
        <compatibility addition="yes"/>
115
        <description>
116
            <p>
117
                An internal SPI package was exposed. Normal modules should not
118
                need to access this package.
119
            </p>
120
        </description>
121
        <package name="org.netbeans.modules.progress.spi"/>
122
        <issue number="177945"/>
123
    </change>
108
    <change id="ProgressUtils">
124
    <change id="ProgressUtils">
109
        <api name="progress_api"/>
125
        <api name="progress_api"/>
110
        <summary><code>ProgressUtils</code> class with <code>runOffEventDispatchThread</code> methods was added.</summary>
126
        <summary><code>ProgressUtils</code> class with <code>runOffEventDispatchThread</code> methods was added.</summary>
(-)a/api.progress/manifest.mf (-3 / +2 lines)
Lines 1-8 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.netbeans.api.progress/1
2
OpenIDE-Module: org.netbeans.api.progress/1
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/progress/module/resources/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/progress/module/resources/Bundle.properties
4
OpenIDE-Module-Layer: org/netbeans/progress/module/resources/layer.xml
4
OpenIDE-Module-Recommends: org.netbeans.modules.progress.spi.ProgressUIWorkerProvider, org.netbeans.modules.progress.spi.RunOffEDTProvider
5
OpenIDE-Module-Implementation-Version: 1
6
OpenIDE-Module-Recommends: org.netbeans.progress.spi.ProgressUIWorkerProvider, org.netbeans.progress.spi.RunOffAWTProvider
7
AutoUpdate-Essential-Module: true
5
AutoUpdate-Essential-Module: true
6
OpenIDE-Module-Specification-Version: 1.18
8
7
(-)a/api.progress/nbproject/project.properties (-1 lines)
Lines 40-46 Link Here
40
is.autoload=true
40
is.autoload=true
41
javac.compilerargs=-Xlint:unchecked
41
javac.compilerargs=-Xlint:unchecked
42
javac.source=1.5
42
javac.source=1.5
43
spec.version.base=1.17.0
44
43
45
javadoc.arch=${basedir}/arch.xml
44
javadoc.arch=${basedir}/arch.xml
46
javadoc.apichanges=${basedir}/apichanges.xml
45
javadoc.apichanges=${basedir}/apichanges.xml
(-)a/api.progress/nbproject/project.xml (+1 lines)
Lines 93-98 Link Here
93
            <public-packages>
93
            <public-packages>
94
                <package>org.netbeans.api.progress</package>
94
                <package>org.netbeans.api.progress</package>
95
                <package>org.netbeans.api.progress.aggregate</package>
95
                <package>org.netbeans.api.progress.aggregate</package>
96
                <package>org.netbeans.modules.progress.spi</package>
96
            </public-packages>
97
            </public-packages>
97
        </data>
98
        </data>
98
    </configuration>
99
    </configuration>
(-)a/api.progress/src/org/netbeans/api/progress/ProgressHandle.java (-1 / +1 lines)
Lines 45-51 Link Here
45
import java.util.logging.Logger;
45
import java.util.logging.Logger;
46
import javax.swing.JComponent;
46
import javax.swing.JComponent;
47
import javax.swing.JLabel;
47
import javax.swing.JLabel;
48
import org.netbeans.progress.spi.InternalHandle;
48
import org.netbeans.modules.progress.spi.InternalHandle;
49
49
50
/**
50
/**
51
 * Instances provided by the ProgressHandleFactory allow the users of the API to
51
 * Instances provided by the ProgressHandleFactory allow the users of the API to
(-)a/api.progress/src/org/netbeans/api/progress/ProgressHandleFactory.java (-1 / +1 lines)
Lines 44-50 Link Here
44
import javax.swing.Action;
44
import javax.swing.Action;
45
import javax.swing.JComponent;
45
import javax.swing.JComponent;
46
import javax.swing.JLabel;
46
import javax.swing.JLabel;
47
import org.netbeans.progress.spi.InternalHandle;
47
import org.netbeans.modules.progress.spi.InternalHandle;
48
import org.openide.util.Cancellable;
48
import org.openide.util.Cancellable;
49
49
50
/**
50
/**
(-)a/api.progress/src/org/netbeans/api/progress/ProgressUtils.java (-1 / +1 lines)
Lines 41-47 Link Here
41
41
42
import java.util.concurrent.atomic.AtomicBoolean;
42
import java.util.concurrent.atomic.AtomicBoolean;
43
import javax.swing.SwingUtilities;
43
import javax.swing.SwingUtilities;
44
import org.netbeans.progress.spi.RunOffEDTProvider;
44
import org.netbeans.modules.progress.spi.RunOffEDTProvider;
45
import org.openide.util.Lookup;
45
import org.openide.util.Lookup;
46
import org.openide.util.RequestProcessor;
46
import org.openide.util.RequestProcessor;
47
import org.openide.util.RequestProcessor.Task;
47
import org.openide.util.RequestProcessor.Task;
(-)a/api.progress/src/org/netbeans/progress/module/Controller.java (-43 / +30 lines)
Lines 40-48 Link Here
40
 */
40
 */
41
41
42
42
43
package org.netbeans.progress.module;
43
package org.netbeans.modules.progress.spi;
44
44
45
import java.awt.Component;
45
import java.awt.Component;
46
import java.awt.event.ActionEvent;
46
import java.awt.event.ActionListener;
47
import java.awt.event.ActionListener;
47
import java.util.ArrayList;
48
import java.util.ArrayList;
48
import java.util.Collection;
49
import java.util.Collection;
Lines 54-72 Link Here
54
import java.util.logging.Logger;
55
import java.util.logging.Logger;
55
import javax.swing.SwingUtilities;
56
import javax.swing.SwingUtilities;
56
import javax.swing.Timer;
57
import javax.swing.Timer;
57
import org.netbeans.progress.spi.InternalHandle;
58
import org.netbeans.progress.module.TrivialProgressUIWorkerProvider;
58
import org.netbeans.progress.spi.ProgressEvent;
59
import org.netbeans.progress.spi.ProgressUIWorker;
60
import org.netbeans.progress.spi.ProgressUIWorkerProvider;
61
import org.netbeans.progress.spi.ProgressUIWorkerWithModel;
62
import org.netbeans.progress.spi.TaskModel;
63
import org.openide.util.Lookup;
59
import org.openide.util.Lookup;
64
60
65
/**
61
/**
66
 *
62
 *
67
 * @author Milos Kleint (mkleint@netbeans.org)
63
 * @author Milos Kleint (mkleint@netbeans.org)
68
 */
64
 */
69
public /* final - because of tests */ class Controller implements Runnable, ActionListener {
65
public /* final - because of tests */ class Controller {
70
    
66
    
71
    // non-private so that it can be accessed from the tests
67
    // non-private so that it can be accessed from the tests
72
    public static Controller defaultInstance;
68
    public static Controller defaultInstance;
Lines 87-112 Link Here
87
    
83
    
88
    /** Creates a new instance of Controller */
84
    /** Creates a new instance of Controller */
89
    public Controller(ProgressUIWorker comp) {
85
    public Controller(ProgressUIWorker comp) {
90
        this();
91
        component = comp;
86
        component = comp;
92
    }
93
    protected Controller() {
94
        model = new TaskModel();
87
        model = new TaskModel();
95
        eventQueue = new ArrayList<ProgressEvent>();
88
        eventQueue = new ArrayList<ProgressEvent>();
96
        dispatchRunning = false;
89
        dispatchRunning = false;
97
        timer = new Timer(TIMER_QUANTUM, this);
90
        timer = new Timer(TIMER_QUANTUM, new ActionListener() {
91
            public void actionPerformed(ActionEvent e) {
92
                runNow();
93
            }
94
        });
98
        timer.setRepeats(false);
95
        timer.setRepeats(false);
99
    }
96
    }
100
97
101
    public static synchronized Controller getDefault() {
98
    public static synchronized Controller getDefault() {
102
        if (defaultInstance == null) {
99
        if (defaultInstance == null) {
103
            defaultInstance = new Controller();
100
            defaultInstance = new Controller(null);
104
        }
101
        }
105
        return defaultInstance;
102
        return defaultInstance;
106
    }
103
    }
107
    
104
    
108
    // to be called on the default instance only..
105
    // to be called on the default instance only..
109
    Component getVisualComponent() {
106
    public Component getVisualComponent() {
110
        if (component == null) {
107
        if (component == null) {
111
            getProgressUIWorker();
108
            getProgressUIWorker();
112
        }
109
        }
Lines 136-142 Link Here
136
        return model;
133
        return model;
137
    }
134
    }
138
    
135
    
139
    public void start(InternalHandle handle) {
136
    void start(InternalHandle handle) {
140
        ProgressEvent event = new ProgressEvent(handle, ProgressEvent.TYPE_START, isWatched(handle));
137
        ProgressEvent event = new ProgressEvent(handle, ProgressEvent.TYPE_START, isWatched(handle));
141
        if (this == getDefault() && handle.getInitialDelay() > 100) {
138
        if (this == getDefault() && handle.getInitialDelay() > 100) {
142
            // default controller
139
            // default controller
Lines 146-179 Link Here
146
        }
143
        }
147
    }
144
    }
148
    
145
    
149
    public void finish(InternalHandle handle) {
146
    void finish(InternalHandle handle) {
150
        ProgressEvent event = new ProgressEvent(handle, ProgressEvent.TYPE_FINISH, isWatched(handle));
147
        ProgressEvent event = new ProgressEvent(handle, ProgressEvent.TYPE_FINISH, isWatched(handle));
151
        postEvent(event);
148
        postEvent(event);
152
    }
149
    }
153
    
150
    
154
    public void toIndeterminate(InternalHandle handle) {
151
    void toIndeterminate(InternalHandle handle) {
155
        ProgressEvent event = new ProgressEvent(handle, ProgressEvent.TYPE_SWITCH, isWatched(handle));
152
        ProgressEvent event = new ProgressEvent(handle, ProgressEvent.TYPE_SWITCH, isWatched(handle));
156
        postEvent(event);
153
        postEvent(event);
157
    }
154
    }
158
    
155
    
159
    public void toSilent(InternalHandle handle, String message) {
156
    void toSilent(InternalHandle handle, String message) {
160
        ProgressEvent event = new ProgressEvent(handle, ProgressEvent.TYPE_SILENT, isWatched(handle), message);
157
        ProgressEvent event = new ProgressEvent(handle, ProgressEvent.TYPE_SILENT, isWatched(handle), message);
161
        postEvent(event);
158
        postEvent(event);
162
    }
159
    }
163
    
160
    
164
    
161
    
165
    public void toDeterminate(InternalHandle handle) {
162
    void toDeterminate(InternalHandle handle) {
166
        ProgressEvent event = new ProgressEvent(handle, ProgressEvent.TYPE_SWITCH, isWatched(handle));
163
        ProgressEvent event = new ProgressEvent(handle, ProgressEvent.TYPE_SWITCH, isWatched(handle));
167
        postEvent(event);
164
        postEvent(event);
168
    }    
165
    }    
169
    
166
    
170
    public void progress(InternalHandle handle, String msg, 
167
    void progress(InternalHandle handle, String msg, 
171
                  int units, double percentage, long estimate) {
168
                  int units, double percentage, long estimate) {
172
        ProgressEvent event = new ProgressEvent(handle, msg, units, percentage, estimate, isWatched(handle));
169
        ProgressEvent event = new ProgressEvent(handle, msg, units, percentage, estimate, isWatched(handle));
173
        postEvent(event);
170
        postEvent(event);
174
    }
171
    }
175
    
172
    
176
    public ProgressEvent snapshot(InternalHandle handle, String msg, 
173
    ProgressEvent snapshot(InternalHandle handle, String msg, 
177
                  int units, double percentage, long estimate) {
174
                  int units, double percentage, long estimate) {
178
        if (handle.isInSleepMode()) {
175
        if (handle.isInSleepMode()) {
179
            return new ProgressEvent(handle, ProgressEvent.TYPE_SILENT, isWatched(handle), msg);
176
            return new ProgressEvent(handle, ProgressEvent.TYPE_SILENT, isWatched(handle), msg);
Lines 182-188 Link Here
182
    }
179
    }
183
    
180
    
184
    
181
    
185
    public void explicitSelection(InternalHandle handle) {
182
    void explicitSelection(InternalHandle handle) {
186
        InternalHandle old = model.getExplicitSelection();
183
        InternalHandle old = model.getExplicitSelection();
187
        model.explicitlySelect(handle);
184
        model.explicitlySelect(handle);
188
        Collection<ProgressEvent> evnts = new ArrayList<ProgressEvent>();
185
        Collection<ProgressEvent> evnts = new ArrayList<ProgressEvent>();
Lines 194-200 Link Here
194
        runImmediately(evnts);
191
        runImmediately(evnts);
195
    }
192
    }
196
    
193
    
197
    public void displayNameChange(InternalHandle handle, int units, double percentage, long estimate, String display) {
194
    void displayNameChange(InternalHandle handle, int units, double percentage, long estimate, String display) {
198
        Collection<ProgressEvent> evnts = new ArrayList<ProgressEvent>();
195
        Collection<ProgressEvent> evnts = new ArrayList<ProgressEvent>();
199
        evnts.add(new ProgressEvent(handle, null, units, percentage, estimate, isWatched(handle), display));
196
        evnts.add(new ProgressEvent(handle, null, units, percentage, estimate, isWatched(handle), display));
200
        runImmediately(evnts);
197
        runImmediately(evnts);
Lines 204-212 Link Here
204
        return model.getExplicitSelection() == hndl;
201
        return model.getExplicitSelection() == hndl;
205
    }
202
    }
206
    
203
    
207
    /**
208
     * 
209
     */ 
210
    void runImmediately(Collection<ProgressEvent> events) {
204
    void runImmediately(Collection<ProgressEvent> events) {
211
        synchronized (this) {
205
        synchronized (this) {
212
            // need to add to queue immediately in the current thread
206
            // need to add to queue immediately in the current thread
Lines 215-223 Link Here
215
        }
209
        }
216
        // trigger ui update as fast as possible.
210
        // trigger ui update as fast as possible.
217
        if (SwingUtilities.isEventDispatchThread()) {
211
        if (SwingUtilities.isEventDispatchThread()) {
218
           run();
212
           runNow();
219
        } else {
213
        } else {
220
           SwingUtilities.invokeLater(this);
214
           SwingUtilities.invokeLater(new Runnable() {
215
                public void run() {
216
                    runNow();
217
                }
218
            });
221
        }
219
        }
222
        
220
        
223
    }
221
    }
Lines 256-265 Link Here
256
    }
254
    }
257
     
255
     
258
    
256
    
259
    /**
257
    public void runNow() {
260
     * can be run from awt only.
258
        // not true in tests: assert EventQueue.isDispatchThread();
261
     */
262
    public void run() {
263
        HashMap<InternalHandle, ProgressEvent> map = new HashMap<InternalHandle, ProgressEvent>();
259
        HashMap<InternalHandle, ProgressEvent> map = new HashMap<InternalHandle, ProgressEvent>();
264
        boolean hasShortOne = false;
260
        boolean hasShortOne = false;
265
        long minDiff = TIMER_QUANTUM;
261
        long minDiff = TIMER_QUANTUM;
Lines 284-290 Link Here
284
                {
280
                {
285
                    model.removeHandle(event.getSource());
281
                    model.removeHandle(event.getSource());
286
                }
282
                }
287
                ProgressEvent lastEvent = (ProgressEvent)map.get(event.getSource());
283
                ProgressEvent lastEvent = map.get(event.getSource());
288
                if (lastEvent != null && event.getType() == ProgressEvent.TYPE_FINISH && 
284
                if (lastEvent != null && event.getType() == ProgressEvent.TYPE_FINISH && 
289
                        justStarted.contains(event.getSource()) && isShort)
285
                        justStarted.contains(event.getSource()) && isShort)
290
                {
286
                {
Lines 316-322 Link Here
316
                    model.addHandle(hndl);
312
                    model.addHandle(hndl);
317
                } else {
313
                } else {
318
                    eventQueue.add(new ProgressEvent(hndl, ProgressEvent.TYPE_START, isWatched(hndl)));
314
                    eventQueue.add(new ProgressEvent(hndl, ProgressEvent.TYPE_START, isWatched(hndl)));
319
                    ProgressEvent evnt = (ProgressEvent)map.remove(hndl);
315
                    ProgressEvent evnt = map.remove(hndl);
320
                    if (evnt.getType() != ProgressEvent.TYPE_START) {
316
                    if (evnt.getType() != ProgressEvent.TYPE_START) {
321
                        eventQueue.add(evnt);
317
                        eventQueue.add(evnt);
322
                    }
318
                    }
Lines 350-362 Link Here
350
        }
346
        }
351
    }
347
    }
352
348
353
    /**
354
     * used by Timer
355
     */
356
    public void actionPerformed(java.awt.event.ActionEvent actionEvent) {
357
        run();
358
    }
359
360
    
361
362
}
349
}
(-)a/api.progress/src/org/netbeans/progress/spi/ExtractedProgressUIWorker.java (-1 / +1 lines)
Lines 39-45 Link Here
39
 * made subject to such option by the copyright holder.
39
 * made subject to such option by the copyright holder.
40
 */
40
 */
41
41
42
package org.netbeans.progress.spi;
42
package org.netbeans.modules.progress.spi;
43
43
44
import javax.swing.JComponent;
44
import javax.swing.JComponent;
45
import javax.swing.JLabel;
45
import javax.swing.JLabel;
(-)a/api.progress/src/org/netbeans/progress/spi/InternalHandle.java (-1 / +1 lines)
Lines 40-46 Link Here
40
 */
40
 */
41
41
42
42
43
package org.netbeans.progress.spi;
43
package org.netbeans.modules.progress.spi;
44
44
45
import java.awt.event.ActionEvent;
45
import java.awt.event.ActionEvent;
46
import java.util.logging.Level;
46
import java.util.logging.Level;
(-)a/api.progress/src/org/netbeans/progress/spi/ProgressEvent.java (-1 / +1 lines)
Lines 40-46 Link Here
40
 */
40
 */
41
41
42
42
43
package org.netbeans.progress.spi;
43
package org.netbeans.modules.progress.spi;
44
44
45
/**
45
/**
46
 *
46
 *
(-)a/api.progress/src/org/netbeans/progress/spi/ProgressUIWorker.java (-1 / +1 lines)
Lines 39-45 Link Here
39
 * made subject to such option by the copyright holder.
39
 * made subject to such option by the copyright holder.
40
 */
40
 */
41
41
42
package org.netbeans.progress.spi;
42
package org.netbeans.modules.progress.spi;
43
43
44
import org.netbeans.progress.module.*;
44
import org.netbeans.progress.module.*;
45
45
(-)a/api.progress/src/org/netbeans/progress/spi/ProgressUIWorkerProvider.java (-1 / +1 lines)
Lines 39-45 Link Here
39
 * made subject to such option by the copyright holder.
39
 * made subject to such option by the copyright holder.
40
 */
40
 */
41
41
42
package org.netbeans.progress.spi;
42
package org.netbeans.modules.progress.spi;
43
43
44
/**
44
/**
45
 *
45
 *
(-)a/api.progress/src/org/netbeans/progress/spi/ProgressUIWorkerWithModel.java (-1 / +1 lines)
Lines 39-45 Link Here
39
 * made subject to such option by the copyright holder.
39
 * made subject to such option by the copyright holder.
40
 */
40
 */
41
41
42
package org.netbeans.progress.spi;
42
package org.netbeans.modules.progress.spi;
43
43
44
import org.netbeans.progress.module.*;
44
import org.netbeans.progress.module.*;
45
45
(-)a/api.progress/src/org/netbeans/progress/spi/RunOffEDTProvider.java (-1 / +1 lines)
Lines 37-43 Link Here
37
 * Portions Copyrighted 2009 Sun Microsystems, Inc.
37
 * Portions Copyrighted 2009 Sun Microsystems, Inc.
38
 */
38
 */
39
39
40
package org.netbeans.progress.spi;
40
package org.netbeans.modules.progress.spi;
41
41
42
import java.util.concurrent.atomic.AtomicBoolean;
42
import java.util.concurrent.atomic.AtomicBoolean;
43
43
(-)a/api.progress/src/org/netbeans/progress/spi/TaskModel.java (-1 / +1 lines)
Lines 40-46 Link Here
40
 */
40
 */
41
41
42
42
43
package org.netbeans.progress.spi;
43
package org.netbeans.modules.progress.spi;
44
44
45
import javax.swing.DefaultListModel;
45
import javax.swing.DefaultListModel;
46
import javax.swing.DefaultListSelectionModel;
46
import javax.swing.DefaultListSelectionModel;
(-)a/api.progress/src/org/netbeans/modules/progress/spi/package-info.java (+44 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
5
 *
6
 * The contents of this file are subject to the terms of either the GNU
7
 * General Public License Version 2 only ("GPL") or the Common
8
 * Development and Distribution License("CDDL") (collectively, the
9
 * "License"). You may not use this file except in compliance with the
10
 * License. You can obtain a copy of the License at
11
 * http://www.netbeans.org/cddl-gplv2.html
12
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13
 * specific language governing permissions and limitations under the
14
 * License.  When distributing the software, include this License Header
15
 * Notice in each file and include the License file at
16
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
17
 * particular file as subject to the "Classpath" exception as provided
18
 * by Sun in the GPL Version 2 section of the License file that
19
 * accompanied this code. If applicable, add the following below the
20
 * License Header, with the fields enclosed by brackets [] replaced by
21
 * your own identifying information:
22
 * "Portions Copyrighted [year] [name of copyright owner]"
23
 *
24
 * If you wish your version of this file to be governed by only the CDDL
25
 * or only the GPL Version 2, indicate your decision by adding
26
 * "[Contributor] elects to include this software in this distribution
27
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
28
 * single choice of license, a recipient has the option to distribute
29
 * your version of this file under either the CDDL, the GPL Version 2 or
30
 * to extend the choice of license to its licensees as provided above.
31
 * However, if you add GPL Version 2 code and therefore, elected the GPL
32
 * Version 2 license, then the option applies only if the new code is
33
 * made subject to such option by the copyright holder.
34
 *
35
 * Contributor(s):
36
 *
37
 * Portions Copyrighted 2010 Sun Microsystems, Inc.
38
 */
39
40
/**
41
 * Interfaces permitting a UI for the progress system to be supplied.
42
 * Not intended for use from modules outside the NetBeans Platform.
43
 */
44
package org.netbeans.modules.progress.spi;
(-)a/api.progress/src/org/netbeans/progress/module/Bundle.properties (-42 lines)
Lines 1-42 Link Here
1
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2
#
3
# Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
4
#
5
# The contents of this file are subject to the terms of either the GNU
6
# General Public License Version 2 only ("GPL") or the Common
7
# Development and Distribution License("CDDL") (collectively, the
8
# "License"). You may not use this file except in compliance with the
9
# License. You can obtain a copy of the License at
10
# http://www.netbeans.org/cddl-gplv2.html
11
# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
12
# specific language governing permissions and limitations under the
13
# License.  When distributing the software, include this License Header
14
# Notice in each file and include the License file at
15
# nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
16
# particular file as subject to the "Classpath" exception as provided
17
# by Sun in the GPL Version 2 section of the License file that
18
# accompanied this code. If applicable, add the following below the
19
# License Header, with the fields enclosed by brackets [] replaced by
20
# your own identifying information:
21
# "Portions Copyrighted [year] [name of copyright owner]"
22
#
23
# Contributor(s):
24
#
25
# The Original Software is NetBeans. The Initial Developer of the Original
26
# Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
27
# Microsystems, Inc. All Rights Reserved.
28
#
29
# If you wish your version of this file to be governed by only the CDDL
30
# or only the GPL Version 2, indicate your decision by adding
31
# "[Contributor] elects to include this software in this distribution
32
# under the [CDDL or GPL Version 2] license." If you do not indicate a
33
# single choice of license, a recipient has the option to distribute
34
# your version of this file under either the CDDL, the GPL Version 2 or
35
# to extend the choice of license to its licensees as provided above.
36
# However, if you add GPL Version 2 code and therefore, elected the GPL
37
# Version 2 license, then the option applies only if the new code is
38
# made subject to such option by the copyright holder.
39
40
CTL_CancelAction=Cancel Process
41
CTL_ProcessListAction=&Processes
42
ProcessListAction.mnemonic=P
(-)a/api.progress/src/org/netbeans/progress/module/ProgressVisualizerProvider.java (+1 lines)
Lines 41-46 Link Here
41
41
42
package org.netbeans.progress.module;
42
package org.netbeans.progress.module;
43
43
44
import org.netbeans.modules.progress.spi.Controller;
44
import java.awt.Component;
45
import java.awt.Component;
45
import org.openide.awt.StatusLineElementProvider;
46
import org.openide.awt.StatusLineElementProvider;
46
47
(-)a/api.progress/src/org/netbeans/progress/module/TrivialProgressUIWorkerProvider.java (-5 / +5 lines)
Lines 44-54 Link Here
44
import javax.swing.JComponent;
44
import javax.swing.JComponent;
45
import javax.swing.JLabel;
45
import javax.swing.JLabel;
46
import javax.swing.JPanel;
46
import javax.swing.JPanel;
47
import org.netbeans.progress.spi.ExtractedProgressUIWorker;
47
import org.netbeans.modules.progress.spi.ExtractedProgressUIWorker;
48
import org.netbeans.progress.spi.ProgressEvent;
48
import org.netbeans.modules.progress.spi.ProgressEvent;
49
import org.netbeans.progress.spi.ProgressUIWorkerProvider;
49
import org.netbeans.modules.progress.spi.ProgressUIWorkerProvider;
50
import org.netbeans.progress.spi.ProgressUIWorkerWithModel;
50
import org.netbeans.modules.progress.spi.ProgressUIWorkerWithModel;
51
import org.netbeans.progress.spi.TaskModel;
51
import org.netbeans.modules.progress.spi.TaskModel;
52
52
53
/**
53
/**
54
 * Fallback provider in case no GUI is registered.
54
 * Fallback provider in case no GUI is registered.
(-)a/api.progress/src/org/netbeans/progress/module/resources/layer.xml (-53 lines)
Lines 1-53 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!--
3
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4
5
Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
6
7
8
The contents of this file are subject to the terms of either the GNU
9
General Public License Version 2 only ("GPL") or the Common
10
Development and Distribution License("CDDL") (collectively, the
11
"License"). You may not use this file except in compliance with the
12
License. You can obtain a copy of the License at
13
http://www.netbeans.org/cddl-gplv2.html
14
or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
15
specific language governing permissions and limitations under the
16
License.  When distributing the software, include this License Header
17
Notice in each file and include the License file at
18
nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
19
particular file as subject to the "Classpath" exception as provided
20
by Sun in the GPL Version 2 section of the License file that
21
accompanied this code. If applicable, add the following below the
22
License Header, with the fields enclosed by brackets [] replaced by
23
your own identifying information:
24
"Portions Copyrighted [year] [name of copyright owner]"
25
26
Contributor(s):
27
28
The Original Software is NetBeans. The Initial Developer of the Original
29
Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
30
Microsystems, Inc. All Rights Reserved.
31
32
If you wish your version of this file to be governed by only the CDDL
33
or only the GPL Version 2, indicate your decision by adding
34
"[Contributor] elects to include this software in this distribution
35
under the [CDDL or GPL Version 2] license." If you do not indicate a
36
single choice of license, a recipient has the option to distribute
37
your version of this file under either the CDDL, the GPL Version 2 or
38
to extend the choice of license to its licensees as provided above.
39
However, if you add GPL Version 2 code and therefore, elected the GPL
40
Version 2 license, then the option applies only if the new code is
41
made subject to such option by the copyright holder.
42
-->
43
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
44
<filesystem>
45
    <folder name="Actions">
46
        <folder name="System">
47
            <file name="org-netbeans-progress-module-CancelAction.instance"/>
48
        </folder>
49
        <folder name="Window">
50
            <file name="org-netbeans-progress-module-ProgressListAction.instance"/>
51
        </folder>
52
    </folder>
53
</filesystem>
(-)a/api.progress/test/unit/src/org/netbeans/api/progress/ProgressHandleFactoryTest.java (-4 / +4 lines)
Lines 49-58 Link Here
49
import javax.swing.UIManager;
49
import javax.swing.UIManager;
50
import org.netbeans.junit.NbTestCase;
50
import org.netbeans.junit.NbTestCase;
51
import org.netbeans.junit.RandomlyFails;
51
import org.netbeans.junit.RandomlyFails;
52
import org.netbeans.progress.module.Controller;
52
import org.netbeans.modules.progress.spi.Controller;
53
import org.netbeans.progress.spi.InternalHandle;
53
import org.netbeans.modules.progress.spi.InternalHandle;
54
import org.netbeans.progress.spi.ProgressEvent;
54
import org.netbeans.modules.progress.spi.ProgressEvent;
55
import org.netbeans.progress.spi.ProgressUIWorker;
55
import org.netbeans.modules.progress.spi.ProgressUIWorker;
56
import org.openide.util.Cancellable;
56
import org.openide.util.Cancellable;
57
57
58
/**
58
/**
(-)a/api.progress/test/unit/src/org/netbeans/api/progress/ProgressHandleTest.java (-12 / +12 lines)
Lines 49-58 Link Here
49
import javax.swing.Timer;
49
import javax.swing.Timer;
50
import org.netbeans.junit.NbTestCase;
50
import org.netbeans.junit.NbTestCase;
51
import org.netbeans.junit.RandomlyFails;
51
import org.netbeans.junit.RandomlyFails;
52
import org.netbeans.progress.module.Controller;
52
import org.netbeans.modules.progress.spi.Controller;
53
import org.netbeans.progress.spi.InternalHandle;
53
import org.netbeans.modules.progress.spi.InternalHandle;
54
import org.netbeans.progress.spi.ProgressUIWorker;
54
import org.netbeans.modules.progress.spi.ProgressUIWorker;
55
import org.netbeans.progress.spi.ProgressEvent;
55
import org.netbeans.modules.progress.spi.ProgressEvent;
56
import org.openide.util.Cancellable;
56
import org.openide.util.Cancellable;
57
57
58
/**
58
/**
Lines 217-223 Link Here
217
        proghandle.finish();
217
        proghandle.finish();
218
        
218
        
219
        //simulate timer run
219
        //simulate timer run
220
        control.run();
220
        control.runNow();
221
        //after running the timer sould be stopped
221
        //after running the timer sould be stopped
222
        assertTrue(control.tobeRestartedDelay == -1);
222
        assertTrue(control.tobeRestartedDelay == -1);
223
223
Lines 233-239 Link Here
233
        }
233
        }
234
        
234
        
235
        //simulate timer run
235
        //simulate timer run
236
        control.run();
236
        control.runNow();
237
        // timer should continue
237
        // timer should continue
238
        assertFalse(control.tobeRestartedDelay == -1);
238
        assertFalse(control.tobeRestartedDelay == -1);
239
        
239
        
Lines 242-248 Link Here
242
        proghandle.finish();
242
        proghandle.finish();
243
        
243
        
244
        //simulate timer run
244
        //simulate timer run
245
        control.run();
245
        control.runNow();
246
        // timer should be continuing
246
        // timer should be continuing
247
        assertFalse(control.tobeRestartedDelay == -1);
247
        assertFalse(control.tobeRestartedDelay == -1);
248
        
248
        
Lines 253-259 Link Here
253
        }
253
        }
254
        h2.finish();
254
        h2.finish();
255
        //simulate timer run
255
        //simulate timer run
256
        control.run();
256
        control.runNow();
257
        // timer should be stopped
257
        // timer should be stopped
258
        assertTrue(control.tobeRestartedDelay == -1);
258
        assertTrue(control.tobeRestartedDelay == -1);
259
        
259
        
Lines 272-278 Link Here
272
        proghandle.finish();
272
        proghandle.finish();
273
        
273
        
274
        //simulate timer run
274
        //simulate timer run
275
        control.run();
275
        control.runNow();
276
        //after running the timer sould be stopped
276
        //after running the timer sould be stopped
277
        assertTrue(control.tobeRestartedDelay == -1);
277
        assertTrue(control.tobeRestartedDelay == -1);
278
        
278
        
Lines 287-293 Link Here
287
            System.out.println("interrupted");
287
            System.out.println("interrupted");
288
        }
288
        }
289
        //simulate timer run
289
        //simulate timer run
290
        control.run();
290
        control.runNow();
291
        // timer should continue
291
        // timer should continue
292
        assertFalse(control.tobeRestartedDelay == -1);
292
        assertFalse(control.tobeRestartedDelay == -1);
293
        
293
        
Lines 297-303 Link Here
297
        proghandle.finish();
297
        proghandle.finish();
298
        
298
        
299
        //simulate timer run
299
        //simulate timer run
300
        control.run();
300
        control.runNow();
301
        // timer should be continuing
301
        // timer should be continuing
302
        assertFalse(control.tobeRestartedDelay == -1);
302
        assertFalse(control.tobeRestartedDelay == -1);
303
        
303
        
Lines 307-313 Link Here
307
            System.out.println("interrupted");
307
            System.out.println("interrupted");
308
        }
308
        }
309
        h2.finish();
309
        h2.finish();
310
        control.run();
310
        control.runNow();
311
        // timer should NOT continue
311
        // timer should NOT continue
312
        assertTrue(control.tobeRestartedDelay == -1);
312
        assertTrue(control.tobeRestartedDelay == -1);
313
    }    
313
    }    
(-)a/api.progress/test/unit/src/org/netbeans/api/progress/aggregate/AggregateProgressHandleTest.java (-3 / +3 lines)
Lines 42-50 Link Here
42
package org.netbeans.api.progress.aggregate;
42
package org.netbeans.api.progress.aggregate;
43
43
44
import junit.framework.TestCase;
44
import junit.framework.TestCase;
45
import org.netbeans.progress.module.Controller;
45
import org.netbeans.modules.progress.spi.Controller;
46
import org.netbeans.progress.spi.ProgressUIWorker;
46
import org.netbeans.modules.progress.spi.ProgressUIWorker;
47
import org.netbeans.progress.spi.ProgressEvent;
47
import org.netbeans.modules.progress.spi.ProgressEvent;
48
48
49
/**
49
/**
50
 *
50
 *
(-)a/core.execution/manifest.mf (+1 lines)
Lines 4-6 Link Here
4
OpenIDE-Module-Install: org/netbeans/core/execution/Install.class
4
OpenIDE-Module-Install: org/netbeans/core/execution/Install.class
5
OpenIDE-Module-Provides: org.openide.execution.ExecutionEngine
5
OpenIDE-Module-Provides: org.openide.execution.ExecutionEngine
6
AutoUpdate-Essential-Module: true
6
AutoUpdate-Essential-Module: true
7
OpenIDE-Module-Specification-Version: 1.19
(-)a/core.execution/nbproject/project.properties (-1 lines)
Lines 40-44 Link Here
40
is.autoload=true
40
is.autoload=true
41
javac.compilerargs=-Xlint:unchecked
41
javac.compilerargs=-Xlint:unchecked
42
javac.source=1.5
42
javac.source=1.5
43
spec.version.base=1.18.0
44
43
(-)a/core.execution/nbproject/project.xml (-1 / +1 lines)
Lines 52-58 Link Here
52
                    <compile-dependency/>
52
                    <compile-dependency/>
53
                    <run-dependency>
53
                    <run-dependency>
54
                        <release-version>1</release-version>
54
                        <release-version>1</release-version>
55
                        <implementation-version/>
55
                        <specification-version>1.18</specification-version>
56
                    </run-dependency>
56
                    </run-dependency>
57
                </dependency>
57
                </dependency>
58
                <dependency>
58
                <dependency>
(-)a/core.execution/src/org/netbeans/core/execution/Install.java (-2 / +2 lines)
Lines 71-78 Link Here
71
import javax.swing.text.DefaultEditorKit;
71
import javax.swing.text.DefaultEditorKit;
72
import org.netbeans.TopSecurityManager;
72
import org.netbeans.TopSecurityManager;
73
import org.netbeans.core.ModuleActions;
73
import org.netbeans.core.ModuleActions;
74
import org.netbeans.progress.module.Controller;
74
import org.netbeans.modules.progress.spi.Controller;
75
import org.netbeans.progress.spi.InternalHandle;
75
import org.netbeans.modules.progress.spi.InternalHandle;
76
import org.openide.DialogDescriptor;
76
import org.openide.DialogDescriptor;
77
import org.openide.DialogDisplayer;
77
import org.openide.DialogDisplayer;
78
import org.openide.awt.Mnemonics;
78
import org.openide.awt.Mnemonics;
(-)a/core.execution/test/unit/src/org/netbeans/core/execution/PendingTaskTest.java (-3 / +3 lines)
Lines 47-55 Link Here
47
import org.netbeans.api.progress.ProgressHandle;
47
import org.netbeans.api.progress.ProgressHandle;
48
import org.netbeans.api.progress.ProgressHandleFactory;
48
import org.netbeans.api.progress.ProgressHandleFactory;
49
import org.netbeans.junit.NbTestCase;
49
import org.netbeans.junit.NbTestCase;
50
import org.netbeans.progress.module.Controller;
50
import org.netbeans.modules.progress.spi.Controller;
51
import org.netbeans.progress.spi.ProgressEvent;
51
import org.netbeans.modules.progress.spi.ProgressEvent;
52
import org.netbeans.progress.spi.ProgressUIWorker;
52
import org.netbeans.modules.progress.spi.ProgressUIWorker;
53
import org.openide.actions.ActionManager;
53
import org.openide.actions.ActionManager;
54
import org.openide.util.RequestProcessor;
54
import org.openide.util.RequestProcessor;
55
55
(-)a/core.output2/manifest.mf (-1 / +1 lines)
Lines 1-7 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.netbeans.core.output2/1
2
OpenIDE-Module: org.netbeans.core.output2/1
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/core/output2/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/core/output2/Bundle.properties
4
OpenIDE-Module-Implementation-Version: 1
5
OpenIDE-Module-Provides: org.openide.windows.IOProvider
4
OpenIDE-Module-Provides: org.openide.windows.IOProvider
6
AutoUpdate-Essential-Module: true
5
AutoUpdate-Essential-Module: true
6
OpenIDE-Module-Specification-Version: 1.16
7
7
(-)a/core.output2/nbproject/project.properties (-1 lines)
Lines 40-44 Link Here
40
is.autoload=true
40
is.autoload=true
41
javac.compilerargs=-Xlint -Xlint:-serial
41
javac.compilerargs=-Xlint -Xlint:-serial
42
javac.source=1.5
42
javac.source=1.5
43
spec.version.base=1.15.0
44
javadoc.arch=${basedir}/arch.xml
43
javadoc.arch=${basedir}/arch.xml
(-)a/core.output2/src/org/netbeans/core/output2/ui/AbstractOutputPane.java (+3 lines)
Lines 258-263 Link Here
258
        }
258
        }
259
    }
259
    }
260
260
261
    /**
262
     * Accessed reflectively from org.netbeans.jellytools.OutputTabOperator.
263
     */
261
    public final Document getDocument() {
264
    public final Document getDocument() {
262
        return textView.getDocument();
265
        return textView.getDocument();
263
    }
266
    }
(-)a/core.output2/src/org/netbeans/core/output2/ui/AbstractOutputTab.java (-1 / +4 lines)
Lines 145-151 Link Here
145
    protected abstract AbstractOutputPane createOutputPane();
145
    protected abstract AbstractOutputPane createOutputPane();
146
    
146
    
147
    protected abstract void inputSent (String txt);
147
    protected abstract void inputSent (String txt);
148
    
148
149
    /**
150
     * Accessed reflectively from org.netbeans.jellytools.OutputTabOperator.
151
     */
149
    public final AbstractOutputPane getOutputPane() {
152
    public final AbstractOutputPane getOutputPane() {
150
        return outputPane;
153
        return outputPane;
151
    }
154
    }
(-)a/core.startup/manifest.mf (+1 lines)
Lines 3-6 Link Here
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/core/startup/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/core/startup/Bundle.properties
4
OpenIDE-Module-Layer: org/netbeans/core/startup/layer.xml
4
OpenIDE-Module-Layer: org/netbeans/core/startup/layer.xml
5
OpenIDE-Module-Provides: org.openide.modules.InstalledFileLocator
5
OpenIDE-Module-Provides: org.openide.modules.InstalledFileLocator
6
OpenIDE-Module-Specification-Version: 1.23
6
7
(-)a/core.startup/nbproject/project.properties (-1 lines)
Lines 37-43 Link Here
37
# Version 2 license, then the option applies only if the new code is
37
# Version 2 license, then the option applies only if the new code is
38
# made subject to such option by the copyright holder.
38
# made subject to such option by the copyright holder.
39
39
40
spec.version.base=1.22.0
41
javadoc.arch=${basedir}/arch.xml
40
javadoc.arch=${basedir}/arch.xml
42
javac.compilerargs=-Xlint -Xlint:-serial
41
javac.compilerargs=-Xlint -Xlint:-serial
43
javac.source=1.5
42
javac.source=1.5
(-)a/core.startup/nbproject/project.xml (-2 / +2 lines)
Lines 76-82 Link Here
76
                    <build-prerequisite/>
76
                    <build-prerequisite/>
77
                    <compile-dependency/>
77
                    <compile-dependency/>
78
                    <run-dependency>
78
                    <run-dependency>
79
                        <implementation-version/>
79
                        <specification-version>8.1</specification-version>
80
                    </run-dependency>
80
                    </run-dependency>
81
                </dependency>
81
                </dependency>
82
                <dependency>
82
                <dependency>
Lines 84-90 Link Here
84
                    <build-prerequisite/>
84
                    <build-prerequisite/>
85
                    <compile-dependency/>
85
                    <compile-dependency/>
86
                    <run-dependency>
86
                    <run-dependency>
87
                        <implementation-version/>
87
                        <specification-version>8.2</specification-version>
88
                    </run-dependency>
88
                    </run-dependency>
89
                </dependency>
89
                </dependency>
90
            </module-dependencies>
90
            </module-dependencies>
(-)a/core.startup/src/org/netbeans/core/startup/preferences/PreferencesProviderImpl.java (-2 / +3 lines)
Lines 43-54 Link Here
43
43
44
import java.util.prefs.Preferences;
44
import java.util.prefs.Preferences;
45
import org.netbeans.Util;
45
import org.netbeans.Util;
46
import org.netbeans.modules.openide.util.PreferencesProvider;
46
import org.openide.util.lookup.ServiceProvider;
47
import org.openide.util.spi.PreferencesProvider;
47
48
48
/**
49
/**
49
 * @author Radek Matous
50
 * @author Radek Matous
50
 */
51
 */
51
@org.openide.util.lookup.ServiceProvider(service=org.netbeans.modules.openide.util.PreferencesProvider.class)
52
@ServiceProvider(service=PreferencesProvider.class)
52
public class PreferencesProviderImpl implements PreferencesProvider {
53
public class PreferencesProviderImpl implements PreferencesProvider {
53
    /** Creates a new instance of PreferencesProviderImpl */
54
    /** Creates a new instance of PreferencesProviderImpl */
54
    public PreferencesProviderImpl() {
55
    public PreferencesProviderImpl() {
(-)a/core.ui/manifest.mf (+1 lines)
Lines 4-7 Link Here
4
OpenIDE-Module-Layer: org/netbeans/core/ui/resources/layer.xml
4
OpenIDE-Module-Layer: org/netbeans/core/ui/resources/layer.xml
5
AutoUpdate-Show-In-Client: false
5
AutoUpdate-Show-In-Client: false
6
AutoUpdate-Essential-Module: true
6
AutoUpdate-Essential-Module: true
7
OpenIDE-Module-Specification-Version: 1.21
7
8
(-)a/core.ui/nbproject/project.properties (-1 lines)
Lines 40-43 Link Here
40
javac.compilerargs=-Xlint:unchecked
40
javac.compilerargs=-Xlint:unchecked
41
javac.source=1.5
41
javac.source=1.5
42
javadoc.arch=${basedir}/arch.xml
42
javadoc.arch=${basedir}/arch.xml
43
spec.version.base=1.20.0
(-)a/core.ui/nbproject/project.xml (-1 / +1 lines)
Lines 118-124 Link Here
118
                    <build-prerequisite/>
118
                    <build-prerequisite/>
119
                    <compile-dependency/>
119
                    <compile-dependency/>
120
                    <run-dependency>
120
                    <run-dependency>
121
                        <implementation-version/>
121
                        <specification-version>7.34</specification-version>
122
                    </run-dependency>
122
                    </run-dependency>
123
                </dependency>
123
                </dependency>
124
                <dependency>
124
                <dependency>
(-)a/core.ui/src/org/netbeans/core/ui/options/filetypes/FileAssociationsModel.java (-6 / +20 lines)
Lines 47-53 Link Here
47
import java.util.Set;
47
import java.util.Set;
48
import java.util.TreeSet;
48
import java.util.TreeSet;
49
import java.util.logging.Logger;
49
import java.util.logging.Logger;
50
import org.netbeans.modules.openide.filesystems.declmime.MIMEResolverImpl;
51
import org.openide.filesystems.FileChangeAdapter;
50
import org.openide.filesystems.FileChangeAdapter;
52
import org.openide.filesystems.FileChangeListener;
51
import org.openide.filesystems.FileChangeListener;
53
import org.openide.filesystems.FileEvent;
52
import org.openide.filesystems.FileEvent;
Lines 56-68 Link Here
56
import org.openide.filesystems.FileStateInvalidException;
55
import org.openide.filesystems.FileStateInvalidException;
57
import org.openide.filesystems.FileSystem;
56
import org.openide.filesystems.FileSystem;
58
import org.openide.filesystems.FileUtil;
57
import org.openide.filesystems.FileUtil;
58
import org.openide.filesystems.MIMEResolver;
59
import org.openide.util.Exceptions;
59
import org.openide.util.Exceptions;
60
60
61
/** Model holds mapping between extension and MIME type.
61
/** Model holds mapping between extension and MIME type.
62
 *
62
 *
63
 * @author Jiri Skrivanek
63
 * @author Jiri Skrivanek
64
 */
64
 */
65
final class FileAssociationsModel {
65
final class FileAssociationsModel extends MIMEResolver.UIHelpers {
66
66
67
    private static final String MIME_RESOLVERS_PATH = "Services/MIMEResolver";  //NOI18N
67
    private static final String MIME_RESOLVERS_PATH = "Services/MIMEResolver";  //NOI18N
68
    private static final Logger LOGGER = Logger.getLogger(FileAssociationsModel.class.getName());
68
    private static final Logger LOGGER = Logger.getLogger(FileAssociationsModel.class.getName());
Lines 94-99 Link Here
94
94
95
    /** Creates new model. */
95
    /** Creates new model. */
96
    FileAssociationsModel() {
96
    FileAssociationsModel() {
97
        // the following code is a dirty trick to allow the UIHelpers class
98
        // to be a nested class (and thus not be visible in the general javadoc)
99
        // in the openide.filesystems API
100
        // It does not matter that you suffer reading this code. The important
101
        // thing is that millions of users of openide.filesystems are not
102
        // disturbed by presence of UIHelpers class or its methods
103
        // in javadoc overview.
104
        new MIMEResolver() {
105
            @Override
106
            public String findMIMEType(FileObject fo) {
107
                return null;
108
            }
109
        }.super();
110
97
        FileObject resolvers = FileUtil.getConfigFile(MIME_RESOLVERS_PATH);
111
        FileObject resolvers = FileUtil.getConfigFile(MIME_RESOLVERS_PATH);
98
        if (resolvers != null) {
112
        if (resolvers != null) {
99
            resolvers.addFileChangeListener(FileUtil.weakFileChangeListener(mimeResolversListener, resolvers));
113
            resolvers.addFileChangeListener(FileUtil.weakFileChangeListener(mimeResolversListener, resolvers));
Lines 252-258 Link Here
252
            }
266
            }
253
            extensions.add(extension);
267
            extensions.add(extension);
254
        }
268
        }
255
        MIMEResolverImpl.storeUserDefinedResolver(mimeToExtensions);
269
        storeUserDefinedResolver(mimeToExtensions);
256
    }
270
    }
257
271
258
    private void init() {
272
    private void init() {
Lines 261-269 Link Here
261
        }
275
        }
262
        LOGGER.fine("FileAssociationsModel.init");  //NOI18N
276
        LOGGER.fine("FileAssociationsModel.init");  //NOI18N
263
        initialized = true;
277
        initialized = true;
264
        for (FileObject mimeResolverFO : MIMEResolverImpl.getOrderedResolvers().values()) {
278
        for (FileObject mimeResolverFO : getOrderedResolvers()) {
265
            boolean userDefined = MIMEResolverImpl.isUserDefined(mimeResolverFO);
279
            boolean userDefined = isUserDefined(mimeResolverFO);
266
            Map<String, Set<String>> mimeToExtensions = MIMEResolverImpl.getMIMEToExtensions(mimeResolverFO);
280
            Map<String, Set<String>> mimeToExtensions = getMIMEToExtensions(mimeResolverFO);
267
            for (Map.Entry<String, Set<String>> entry : mimeToExtensions.entrySet()) {
281
            for (Map.Entry<String, Set<String>> entry : mimeToExtensions.entrySet()) {
268
                String mimeType = entry.getKey();
282
                String mimeType = entry.getKey();
269
                Set<String> extensions = entry.getValue();
283
                Set<String> extensions = entry.getValue();
(-)a/core.windows/manifest.mf (+1 lines)
Lines 6-9 Link Here
6
OpenIDE-Module-Recommends: org.netbeans.core.windows.nativeaccess.NativeWindowSystem
6
OpenIDE-Module-Recommends: org.netbeans.core.windows.nativeaccess.NativeWindowSystem
7
AutoUpdate-Show-In-Client: false
7
AutoUpdate-Show-In-Client: false
8
AutoUpdate-Essential-Module: true
8
AutoUpdate-Essential-Module: true
9
OpenIDE-Module-Specification-Version: 2.20
9
10
(-)a/core.windows/nbproject/project.properties (-1 lines)
Lines 39-45 Link Here
39
39
40
javac.compilerargs=-Xlint:unchecked
40
javac.compilerargs=-Xlint:unchecked
41
javac.source=1.5
41
javac.source=1.5
42
spec.version.base=2.19.0
43
42
44
43
45
test.config.commit.includes=**/Validate*Test.class
44
test.config.commit.includes=**/Validate*Test.class
(-)a/core.windows/nbproject/project.xml (-1 / +1 lines)
Lines 123-129 Link Here
123
                    <build-prerequisite/>
123
                    <build-prerequisite/>
124
                    <compile-dependency/>
124
                    <compile-dependency/>
125
                    <run-dependency>
125
                    <run-dependency>
126
                        <implementation-version/>
126
                        <specification-version>6.25</specification-version>
127
                    </run-dependency>
127
                    </run-dependency>
128
                </dependency>
128
                </dependency>
129
                <dependency>
129
                <dependency>
(-)a/jellytools.platform/manifest.mf (+1 lines)
Lines 1-4 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.netbeans.modules.jellytools.platform/3
2
OpenIDE-Module: org.netbeans.modules.jellytools.platform/3
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/jellytools/platform/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/jellytools/platform/Bundle.properties
4
OpenIDE-Module-Specification-Version: 3.4
4
5
(-)a/jellytools.platform/nbproject/project.properties (-1 lines)
Lines 1-7 Link Here
1
is.autoload=true
1
is.autoload=true
2
javac.source=1.5
2
javac.source=1.5
3
javac.compilerargs=-Xlint -Xlint:-serial
3
javac.compilerargs=-Xlint -Xlint:-serial
4
spec.version.base=3.3.0
5
4
6
test.config.stable.includes=**/*Test.class
5
test.config.stable.includes=**/*Test.class
7
test.config.bundle.includes=**/PlatformBundleKeysTest.class
6
test.config.bundle.includes=**/PlatformBundleKeysTest.class
(-)a/jellytools.platform/nbproject/project.xml (-3 / +1 lines)
Lines 42-52 Link Here
42
                </dependency>
42
                </dependency>
43
                <dependency>
43
                <dependency>
44
                    <code-name-base>org.netbeans.core.output2</code-name-base>
44
                    <code-name-base>org.netbeans.core.output2</code-name-base>
45
                    <build-prerequisite/>
46
                    <compile-dependency/>
47
                    <run-dependency>
45
                    <run-dependency>
48
                        <release-version>1</release-version>
46
                        <release-version>1</release-version>
49
                        <implementation-version/>
47
                        <specification-version>1.16</specification-version>
50
                    </run-dependency>
48
                    </run-dependency>
51
                </dependency>
49
                </dependency>
52
                <dependency>
50
                <dependency>
(-)a/jellytools.platform/src/org/netbeans/jellytools/OutputTabOperator.java (-6 / +22 lines)
Lines 49-55 Link Here
49
import javax.swing.JTabbedPane;
49
import javax.swing.JTabbedPane;
50
import javax.swing.KeyStroke;
50
import javax.swing.KeyStroke;
51
import javax.swing.text.Document;
51
import javax.swing.text.Document;
52
import org.netbeans.core.output2.ui.AbstractOutputTab;
53
import org.netbeans.jellytools.actions.Action;
52
import org.netbeans.jellytools.actions.Action;
54
import org.netbeans.jellytools.actions.CopyAction;
53
import org.netbeans.jellytools.actions.CopyAction;
55
import org.netbeans.jellytools.actions.FindAction;
54
import org.netbeans.jellytools.actions.FindAction;
Lines 255-261 Link Here
255
        // ((OutputTab)getSource()).getDocument().getLength();
254
        // ((OutputTab)getSource()).getDocument().getLength();
256
        return runMapping(new MapIntegerAction("getLength") {
255
        return runMapping(new MapIntegerAction("getLength") {
257
            public int map() {
256
            public int map() {
258
                Document document = ((AbstractOutputTab)getSource()).getOutputPane().getDocument();
257
                Document document = documentForTab(getSource());
259
                try {
258
                try {
260
                    Class clazz = Class.forName("org.netbeans.core.output2.OutputDocument");
259
                    Class clazz = Class.forName("org.netbeans.core.output2.OutputDocument");
261
                    Method getLengthMethod = clazz.getDeclaredMethod("getLength", (Class[])null);
260
                    Method getLengthMethod = clazz.getDeclaredMethod("getLength", (Class[])null);
Lines 292-298 Link Here
292
        final int length = getLength();
291
        final int length = getLength();
293
        return (String)runMapping(new MapAction("getText") {
292
        return (String)runMapping(new MapAction("getText") {
294
            public Object map() {
293
            public Object map() {
295
                Document document = ((AbstractOutputTab)getSource()).getOutputPane().getDocument();
294
                Document document = documentForTab(getSource());
296
                try {
295
                try {
297
                    Class clazz = Class.forName("org.netbeans.core.output2.OutputDocument");
296
                    Class clazz = Class.forName("org.netbeans.core.output2.OutputDocument");
298
                    Method getTextMethod = clazz.getDeclaredMethod("getText", new Class[] {int.class, int.class});
297
                    Method getTextMethod = clazz.getDeclaredMethod("getText", new Class[] {int.class, int.class});
Lines 341-347 Link Here
341
    public int getLineCount() {
340
    public int getLineCount() {
342
        return ((Integer)runMapping(new MapAction("getLineCount") {
341
        return ((Integer)runMapping(new MapAction("getLineCount") {
343
            public Object map() {
342
            public Object map() {
344
                Document document = ((AbstractOutputTab)getSource()).getOutputPane().getDocument();
343
                Document document = documentForTab(getSource());
345
                try {
344
                try {
346
                    Class clazz = Class.forName("org.netbeans.core.output2.OutputDocument");
345
                    Class clazz = Class.forName("org.netbeans.core.output2.OutputDocument");
347
                    Method getElementCountMethod = clazz.getDeclaredMethod("getElementCount", (Class[])null);
346
                    Method getElementCountMethod = clazz.getDeclaredMethod("getElementCount", (Class[])null);
Lines 361-367 Link Here
361
        // first make component visible because tab must be visible to dispatch events
360
        // first make component visible because tab must be visible to dispatch events
362
        makeComponentVisible();
361
        makeComponentVisible();
363
        if(outputPaneOperator == null) {
362
        if(outputPaneOperator == null) {
364
            outputPaneOperator = ComponentOperator.createOperator(((AbstractOutputTab)getSource()).getOutputPane());
363
            outputPaneOperator = ComponentOperator.createOperator(outputPaneForTab(getSource()));
365
            outputPaneOperator.copyEnvironment(this);
364
            outputPaneOperator.copyEnvironment(this);
366
        }
365
        }
367
        return outputPaneOperator;
366
        return outputPaneOperator;
Lines 374-380 Link Here
374
    public String getLine(final int line) {
373
    public String getLine(final int line) {
375
        return (String)runMapping(new MapAction("getText") {
374
        return (String)runMapping(new MapAction("getText") {
376
            public Object map() {
375
            public Object map() {
377
                Document document = ((AbstractOutputTab)getSource()).getOutputPane().getDocument();
376
                Document document = documentForTab(getSource());
378
                try {
377
                try {
379
                    Class clazz = Class.forName("org.netbeans.core.output2.OutputDocument");
378
                    Class clazz = Class.forName("org.netbeans.core.output2.OutputDocument");
380
                    Method getLineStartMethod = clazz.getDeclaredMethod("getLineStart", new Class[] {int.class});
379
                    Method getLineStartMethod = clazz.getDeclaredMethod("getLineStart", new Class[] {int.class});
Lines 396-401 Link Here
396
            }});
395
            }});
397
    }
396
    }
398
    
397
    
398
    private static Component outputPaneForTab(Component tab) {
399
        try {
400
            return (Component) tab.getClass().getMethod("getOutputPane").invoke(tab);
401
        } catch (Exception x) {
402
            throw new JemmyException("Reflection failed: " + x, x);
403
        }
404
    }
405
406
    private static Document documentForTab(Component tab) {
407
        Component pane = outputPaneForTab(tab);
408
        try {
409
            return (Document) pane.getClass().getMethod("getDocument").invoke(pane);
410
        } catch (Exception x) {
411
            throw new JemmyException("Reflection failed: " + x, x);
412
        }
413
    }
414
    
399
    /** SubChooser to determine OutputTab component
415
    /** SubChooser to determine OutputTab component
400
     * Used in findTopComponent method.
416
     * Used in findTopComponent method.
401
     */
417
     */
(-)a/openide.actions/manifest.mf (+1 lines)
Lines 2-5 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
6
(-)a/openide.actions/nbproject/project.properties (-1 lines)
Lines 44-47 Link Here
44
javadoc.arch=${basedir}/arch.xml
44
javadoc.arch=${basedir}/arch.xml
45
javadoc.apichanges=${basedir}/apichanges.xml
45
javadoc.apichanges=${basedir}/apichanges.xml
46
46
47
spec.version.base=6.13.0
(-)a/openide.actions/nbproject/project.xml (-16 / +16 lines)
Lines 47-65 Link Here
47
            <code-name-base>org.openide.actions</code-name-base>
47
            <code-name-base>org.openide.actions</code-name-base>
48
            <module-dependencies>
48
            <module-dependencies>
49
                <dependency>
49
                <dependency>
50
                    <code-name-base>org.openide.util</code-name-base>
50
                    <code-name-base>org.openide.awt</code-name-base>
51
                    <build-prerequisite/>
51
                    <build-prerequisite/>
52
                    <compile-dependency/>
52
                    <compile-dependency/>
53
                    <run-dependency>
53
                    <run-dependency>
54
                        <implementation-version/>
54
                        <specification-version>6.5</specification-version>
55
                    </run-dependency>
55
                    </run-dependency>
56
                </dependency>
56
                </dependency>
57
                <dependency>
57
                <dependency>
58
                    <code-name-base>org.openide.util.lookup</code-name-base>
58
                    <code-name-base>org.openide.dialogs</code-name-base>
59
                    <build-prerequisite/>
59
                    <build-prerequisite/>
60
                    <compile-dependency/>
60
                    <compile-dependency/>
61
                    <run-dependency>
61
                    <run-dependency>
62
                        <implementation-version/>
62
                        <specification-version>6.2</specification-version>
63
                    </run-dependency>
64
                </dependency>
65
                <dependency>
66
                    <code-name-base>org.openide.explorer</code-name-base>
67
                    <build-prerequisite/>
68
                    <compile-dependency/>
69
                    <run-dependency>
70
                        <specification-version>6.8</specification-version>
63
                    </run-dependency>
71
                    </run-dependency>
64
                </dependency>
72
                </dependency>
65
                <dependency>
73
                <dependency>
Lines 71-84 Link Here
71
                    </run-dependency>
79
                    </run-dependency>
72
                </dependency>
80
                </dependency>
73
                <dependency>
81
                <dependency>
74
                    <code-name-base>org.openide.awt</code-name-base>
75
                    <build-prerequisite/>
76
                    <compile-dependency/>
77
                    <run-dependency>
78
                        <specification-version>6.5</specification-version>
79
                    </run-dependency>
80
                </dependency>
81
                <dependency>
82
                    <code-name-base>org.openide.text</code-name-base>
82
                    <code-name-base>org.openide.text</code-name-base>
83
                    <build-prerequisite/>
83
                    <build-prerequisite/>
84
                    <compile-dependency/>
84
                    <compile-dependency/>
Lines 87-105 Link Here
87
                    </run-dependency>
87
                    </run-dependency>
88
                </dependency>
88
                </dependency>
89
                <dependency>
89
                <dependency>
90
                    <code-name-base>org.openide.explorer</code-name-base>
90
                    <code-name-base>org.openide.util</code-name-base>
91
                    <build-prerequisite/>
91
                    <build-prerequisite/>
92
                    <compile-dependency/>
92
                    <compile-dependency/>
93
                    <run-dependency>
93
                    <run-dependency>
94
                        <specification-version>6.8</specification-version>
94
                        <specification-version>8.1</specification-version>
95
                    </run-dependency>
95
                    </run-dependency>
96
                </dependency>
96
                </dependency>
97
                <dependency>
97
                <dependency>
98
                    <code-name-base>org.openide.dialogs</code-name-base>
98
                    <code-name-base>org.openide.util.lookup</code-name-base>
99
                    <build-prerequisite/>
99
                    <build-prerequisite/>
100
                    <compile-dependency/>
100
                    <compile-dependency/>
101
                    <run-dependency>
101
                    <run-dependency>
102
                        <specification-version>6.2</specification-version>
102
                        <specification-version>8.2</specification-version>
103
                    </run-dependency>
103
                    </run-dependency>
104
                </dependency>
104
                </dependency>
105
                <dependency>
105
                <dependency>
(-)a/openide.actions/src/org/netbeans/modules/openide/actions/ActionsBridgeImpl.java (-2 / +6 lines)
Lines 41-54 Link Here
41
41
42
package org.netbeans.modules.openide.actions;
42
package org.netbeans.modules.openide.actions;
43
43
44
import org.openide.util.lookup.ServiceProvider;
45
import org.openide.util.spi.ActionsBridge;
46
44
47
45
/** Implements the delegation to ActionManager that is called from
48
/** Implements the delegation to ActionManager that is called from
46
 * openide/util.
49
 * openide/util.
47
 */
50
 */
48
@org.openide.util.lookup.ServiceProvider(service=org.netbeans.modules.openide.util.ActionsBridge.class)
51
@ServiceProvider(service=ActionsBridge.class)
49
public class ActionsBridgeImpl extends org.netbeans.modules.openide.util.ActionsBridge {
52
public class ActionsBridgeImpl extends ActionsBridge {
50
    /** Invokes an action.
53
    /** Invokes an action.
51
     */
54
     */
55
    @SuppressWarnings("deprecation")
52
    protected void invokeAction (javax.swing.Action action, java.awt.event.ActionEvent ev) {
56
    protected void invokeAction (javax.swing.Action action, java.awt.event.ActionEvent ev) {
53
        org.openide.actions.ActionManager.getDefault().invokeAction(action, ev);
57
        org.openide.actions.ActionManager.getDefault().invokeAction(action, ev);
54
    }
58
    }
(-)a/openide.awt/manifest.mf (+1 lines)
Lines 2-5 Link Here
2
OpenIDE-Module: org.openide.awt
2
OpenIDE-Module: org.openide.awt
3
OpenIDE-Module-Localizing-Bundle: org/openide/awt/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/openide/awt/Bundle.properties
4
AutoUpdate-Essential-Module: true
4
AutoUpdate-Essential-Module: true
5
OpenIDE-Module-Specification-Version: 7.21
5
6
(-)a/openide.awt/nbproject/project.properties (-1 lines)
Lines 43-46 Link Here
43
javadoc.arch=${basedir}/arch.xml
43
javadoc.arch=${basedir}/arch.xml
44
javadoc.apichanges=${basedir}/apichanges.xml
44
javadoc.apichanges=${basedir}/apichanges.xml
45
45
46
spec.version.base=7.20.0
(-)a/openide.awt/nbproject/project.xml (-1 / +1 lines)
Lines 51-57 Link Here
51
                    <build-prerequisite/>
51
                    <build-prerequisite/>
52
                    <compile-dependency/>
52
                    <compile-dependency/>
53
                    <run-dependency>
53
                    <run-dependency>
54
                        <implementation-version/>
54
                        <specification-version>8.1</specification-version>
55
                    </run-dependency>
55
                    </run-dependency>
56
                </dependency>
56
                </dependency>
57
                <dependency>
57
                <dependency>
(-)a/openide.awt/src/org/netbeans/modules/openide/awt/DefaultAWTBridge.java (-2 / +4 lines)
Lines 56-66 Link Here
56
import org.openide.awt.DynamicMenuContent;
56
import org.openide.awt.DynamicMenuContent;
57
import org.openide.util.actions.BooleanStateAction;
57
import org.openide.util.actions.BooleanStateAction;
58
import org.openide.util.actions.SystemAction;
58
import org.openide.util.actions.SystemAction;
59
import org.openide.util.lookup.ServiceProvider;
60
import org.openide.util.spi.ActionPresenterProvider;
59
61
60
/** Default implementaiton of presenters for various action types.
62
/** Default implementaiton of presenters for various action types.
61
 */
63
 */
62
@org.openide.util.lookup.ServiceProvider(service=org.netbeans.modules.openide.util.AWTBridge.class)
64
@ServiceProvider(service=ActionPresenterProvider.class)
63
public final class DefaultAWTBridge extends org.netbeans.modules.openide.util.AWTBridge {
65
public final class DefaultAWTBridge extends ActionPresenterProvider {
64
    public JMenuItem createMenuPresenter (Action action) {
66
    public JMenuItem createMenuPresenter (Action action) {
65
        if (action instanceof BooleanStateAction) {
67
        if (action instanceof BooleanStateAction) {
66
            BooleanStateAction b = (BooleanStateAction)action;
68
            BooleanStateAction b = (BooleanStateAction)action;
(-)a/openide.awt/src/org/openide/awt/AlwaysEnabledAction.java (-2 / +2 lines)
Lines 21-28 Link Here
21
import javax.swing.Icon;
21
import javax.swing.Icon;
22
import javax.swing.JCheckBoxMenuItem;
22
import javax.swing.JCheckBoxMenuItem;
23
import javax.swing.JMenuItem;
23
import javax.swing.JMenuItem;
24
import org.netbeans.modules.openide.util.ActionsBridge;
25
import org.netbeans.modules.openide.util.ActionsBridge.ActionRunnable;
26
import org.openide.util.ContextAwareAction;
24
import org.openide.util.ContextAwareAction;
27
import org.openide.util.ImageUtilities;
25
import org.openide.util.ImageUtilities;
28
import org.openide.util.Lookup;
26
import org.openide.util.Lookup;
Lines 30-35 Link Here
30
import org.openide.util.LookupListener;
28
import org.openide.util.LookupListener;
31
import org.openide.util.NbPreferences;
29
import org.openide.util.NbPreferences;
32
import org.openide.util.actions.Presenter;
30
import org.openide.util.actions.Presenter;
31
import org.openide.util.spi.ActionsBridge;
32
import org.openide.util.spi.ActionsBridge.ActionRunnable;
33
33
34
/** Lazily initialized always enabled action
34
/** Lazily initialized always enabled action
35
 *
35
 *
(-)a/openide.awt/src/org/openide/awt/GeneralAction.java (-2 / +2 lines)
Lines 50-63 Link Here
50
import java.util.logging.Logger;
50
import java.util.logging.Logger;
51
import javax.swing.Action;
51
import javax.swing.Action;
52
import javax.swing.ActionMap;
52
import javax.swing.ActionMap;
53
import org.netbeans.modules.openide.util.ActionsBridge;
54
import org.netbeans.modules.openide.util.ActionsBridge.ActionRunnable;
55
import org.openide.awt.ContextAction.Performer;
53
import org.openide.awt.ContextAction.Performer;
56
import org.openide.util.ContextAwareAction;
54
import org.openide.util.ContextAwareAction;
57
import org.openide.util.Lookup;
55
import org.openide.util.Lookup;
58
import org.openide.util.Parameters;
56
import org.openide.util.Parameters;
59
import org.openide.util.Utilities;
57
import org.openide.util.Utilities;
60
import org.openide.util.WeakListeners;
58
import org.openide.util.WeakListeners;
59
import org.openide.util.spi.ActionsBridge;
60
import org.openide.util.spi.ActionsBridge.ActionRunnable;
61
61
62
/**
62
/**
63
 *
63
 *
(-)a/openide.explorer/manifest.mf (-1 / +1 lines)
Lines 1-6 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.openide.explorer
2
OpenIDE-Module: org.openide.explorer
3
OpenIDE-Module-Implementation-Version: 1
4
OpenIDE-Module-Localizing-Bundle: org/openide/explorer/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/openide/explorer/Bundle.properties
5
AutoUpdate-Essential-Module: true
4
AutoUpdate-Essential-Module: true
5
OpenIDE-Module-Specification-Version: 6.25
6
6
(-)a/openide.explorer/nbproject/project.properties (-1 lines)
Lines 44-47 Link Here
44
javadoc.arch=${basedir}/arch.xml
44
javadoc.arch=${basedir}/arch.xml
45
javadoc.apichanges=${basedir}/apichanges.xml
45
javadoc.apichanges=${basedir}/apichanges.xml
46
46
47
spec.version.base=6.24.0
(-)a/openide.explorer/nbproject/project.xml (+8 lines)
Lines 55-60 Link Here
55
                    </run-dependency>
55
                    </run-dependency>
56
                </dependency>
56
                </dependency>
57
                <dependency>
57
                <dependency>
58
                    <code-name-base>org.netbeans.swing.tabcontrol</code-name-base>
59
                    <build-prerequisite/>
60
                    <compile-dependency/>
61
                    <run-dependency>
62
                        <specification-version>1.20</specification-version>
63
                    </run-dependency>
64
                </dependency>
65
                <dependency>
58
                    <code-name-base>org.openide.awt</code-name-base>
66
                    <code-name-base>org.openide.awt</code-name-base>
59
                    <build-prerequisite/>
67
                    <build-prerequisite/>
60
                    <compile-dependency/>
68
                    <compile-dependency/>
(-)a/openide.explorer/src/org/netbeans/modules/openide/explorer/TabbedContainerBridge.java (-16 / +2 lines)
Lines 43-72 Link Here
43
43
44
import javax.swing.JComponent;
44
import javax.swing.JComponent;
45
import javax.swing.event.ChangeListener;
45
import javax.swing.event.ChangeListener;
46
import org.openide.util.Lookup;
47
46
48
/**
47
/**
49
 * An architectural hack - until PropertySheet is separated and openide
48
 * A separate class only for historical reasons. Could be inlined into PSheet if desired.
50
 * split up, openide cannot depend on module code due to classloader
51
 * restrictions.  So we have an interface which will supply a bridge to
52
 * the tabcontrol code; an implementation of this interface is provided
53
 * over org.netbeans.swing.tabcontrol.TabbedContainer (in core/swing/tabcontrol)
54
 * by the window system which depends on it.
55
 *
56
 * @see org.netbeans.core.windows.view.ui.tabcontrol.TabbedContainerBridgeImpl
57
 * @author  Tim Boudreau
58
 */
49
 */
59
public abstract class TabbedContainerBridge {
50
public abstract class TabbedContainerBridge {
60
    
51
    
61
    protected TabbedContainerBridge(){};
52
    protected TabbedContainerBridge(){};
62
    
53
    
63
    public static TabbedContainerBridge getDefault() {
54
    public static TabbedContainerBridge getDefault() {
64
        TabbedContainerBridge result = Lookup.getDefault().lookup (TabbedContainerBridge.class);
55
        return new TabbedContainerBridgeImpl();
65
        if (result == null) {
66
            //unit test or standalone library operation
67
            return new TrivialTabbedContainerBridgeImpl();
68
        }
69
        return result;
70
    }
56
    }
71
57
72
    public abstract JComponent createTabbedContainer();
58
    public abstract JComponent createTabbedContainer();
(-)a/core.windows/src/org/netbeans/core/windows/view/ui/tabcontrol/TabbedContainerBridgeImpl.java (-18 / +2 lines)
Lines 38-71 Link Here
38
 * Version 2 license, then the option applies only if the new code is
38
 * Version 2 license, then the option applies only if the new code is
39
 * made subject to such option by the copyright holder.
39
 * made subject to such option by the copyright holder.
40
 */
40
 */
41
/*
42
 * TabbedContainerBridgeImpl.java
43
 *
44
 * Created on June 1, 2004, 6:42 PM
45
 */
46
41
47
package org.netbeans.core.windows.view.ui.tabcontrol;
42
package org.netbeans.modules.openide.explorer;
48
43
49
import java.util.List;
44
import java.util.List;
50
import java.util.Arrays;
51
import javax.swing.JComponent;
45
import javax.swing.JComponent;
52
import javax.swing.event.ChangeListener;
46
import javax.swing.event.ChangeListener;
53
import org.netbeans.swing.tabcontrol.ComponentConverter;
47
import org.netbeans.swing.tabcontrol.ComponentConverter;
54
import org.netbeans.swing.tabcontrol.TabData;
48
import org.netbeans.swing.tabcontrol.TabData;
55
import org.netbeans.swing.tabcontrol.TabbedContainer;
49
import org.netbeans.swing.tabcontrol.TabbedContainer;
56
import org.netbeans.swing.tabcontrol.TabDataModel;
50
import org.netbeans.swing.tabcontrol.TabDataModel;
57
import org.netbeans.modules.openide.explorer.TabbedContainerBridge;
58
51
59
/**
52
class TabbedContainerBridgeImpl extends TabbedContainerBridge {
60
 * Implementation of org.netbeans.modules.explorer.TabbedContainerBridge, as
61
 * used by the property sheet.  This class allows the property sheet to use
62
 * TabbedContainer without openide explicitly depending on the TabControl
63
 * library (currently impossible).
64
 *
65
 * @author  Tim Boudreau
66
 */
67
@org.openide.util.lookup.ServiceProvider(service=org.netbeans.modules.openide.explorer.TabbedContainerBridge.class)
68
public class TabbedContainerBridgeImpl extends TabbedContainerBridge {
69
    
53
    
70
    /** Creates a new instance of TabbedContainerBridgeImpl */
54
    /** Creates a new instance of TabbedContainerBridgeImpl */
71
    public TabbedContainerBridgeImpl() {
55
    public TabbedContainerBridgeImpl() {
(-)a/openide.explorer/src/org/netbeans/modules/openide/explorer/TrivialTabbedContainerBridgeImpl.java (-127 lines)
Lines 1-127 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
5
 *
6
 * The contents of this file are subject to the terms of either the GNU
7
 * General Public License Version 2 only ("GPL") or the Common
8
 * Development and Distribution License("CDDL") (collectively, the
9
 * "License"). You may not use this file except in compliance with the
10
 * License. You can obtain a copy of the License at
11
 * http://www.netbeans.org/cddl-gplv2.html
12
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13
 * specific language governing permissions and limitations under the
14
 * License.  When distributing the software, include this License Header
15
 * Notice in each file and include the License file at
16
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
17
 * particular file as subject to the "Classpath" exception as provided
18
 * by Sun in the GPL Version 2 section of the License file that
19
 * accompanied this code. If applicable, add the following below the
20
 * License Header, with the fields enclosed by brackets [] replaced by
21
 * your own identifying information:
22
 * "Portions Copyrighted [year] [name of copyright owner]"
23
 *
24
 * Contributor(s):
25
 *
26
 * The Original Software is NetBeans. The Initial Developer of the Original
27
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
28
 * Microsystems, Inc. All Rights Reserved.
29
 *
30
 * If you wish your version of this file to be governed by only the CDDL
31
 * or only the GPL Version 2, indicate your decision by adding
32
 * "[Contributor] elects to include this software in this distribution
33
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
34
 * single choice of license, a recipient has the option to distribute
35
 * your version of this file under either the CDDL, the GPL Version 2 or
36
 * to extend the choice of license to its licensees as provided above.
37
 * However, if you add GPL Version 2 code and therefore, elected the GPL
38
 * Version 2 license, then the option applies only if the new code is
39
 * made subject to such option by the copyright holder.
40
 */
41
package org.netbeans.modules.openide.explorer;
42
43
import javax.swing.*;
44
import javax.swing.event.ChangeListener;
45
46
import java.awt.*;
47
48
/**
49
 * Trivial implementation of TabbedContainerBridge for use with unit tests, etc.
50
 * Does not actually support changing tabs, this is just so things link and do not
51
 * throw NPEs.
52
 * <p>
53
 * Given sufficient interest, a JTabbedPane implementation could be provided,
54
 * though there are some non-trivial difficulties getting a JTabbedPane to show
55
 * the same component for all tabs, and the technique that worked on 1.4 does not
56
 * work on 1.5.
57
 *
58
 */
59
public class TrivialTabbedContainerBridgeImpl extends TabbedContainerBridge {
60
    public TrivialTabbedContainerBridgeImpl() {
61
62
    }
63
64
    public JComponent createTabbedContainer() {
65
        JPanel result = new JPanel();
66
        result.setLayout (new BorderLayout());
67
        result.putClientProperty ("titles", new String[0]);
68
        result.putClientProperty ("items", new Object[0]);
69
        return result;
70
    }
71
72
    public void setInnerComponent(JComponent container, JComponent inner) {
73
        if (container.getComponentCount() > 0) {
74
            container.removeAll();
75
        }
76
        container.add (inner, BorderLayout.CENTER);
77
    }
78
79
    public JComponent getInnerComponent(JComponent jc) {
80
        JComponent result = null;
81
        if (jc.getComponentCount() > 0 && jc.getComponent(0) instanceof JComponent) {
82
            result = (JComponent) jc.getComponent(0);
83
        }
84
        return result;
85
    }
86
87
    public Object[] getItems(JComponent jc) {
88
        return new Object[0];
89
    }
90
91
    public void setItems(JComponent jc, Object[] objects, String[] titles) {
92
        jc.putClientProperty ("items", objects);
93
        jc.putClientProperty ("titles", titles);
94
    }
95
96
    public void attachSelectionListener(JComponent jc, ChangeListener listener) {
97
        //do nothing
98
    }
99
100
    public void detachSelectionListener(JComponent jc, ChangeListener listener) {
101
        //do nothing
102
    }
103
104
    public Object getSelectedItem(JComponent jc) {
105
        Object[] items = (Object[]) jc.getClientProperty ("items");
106
        if (items != null && items.length > 0) {
107
            return items[0];
108
        }
109
        return null;
110
    }
111
112
    public void setSelectedItem(JComponent jc, Object selection) {
113
        //do nothing
114
    }
115
116
    public boolean setSelectionByName(JComponent jc, String tabname) {
117
        return false;
118
    }
119
120
    public String getCurrentSelectedTabName(JComponent jc) {
121
        String[] titles = (String[]) jc.getClientProperty("titles");
122
        if (titles != null && titles.length > 0) {
123
            return titles[0];
124
        }
125
        return ""; //NOI18N
126
    }
127
}
(-)a/openide.filesystems/apichanges.xml (+18 lines)
Lines 46-51 Link Here
46
        <apidef name="filesystems">Filesystems API</apidef>
46
        <apidef name="filesystems">Filesystems API</apidef>
47
    </apidefs>
47
    </apidefs>
48
    <changes>
48
    <changes>
49
        <change id="MIMEResolverImpl">
50
            <api name="filesystems"/>
51
            <summary>Access methods added to <code>MIMEResolver.UIHelpers</code></summary>
52
            <version major="7" minor="34"/>
53
            <date day="8" month="1" year="2010"/>
54
            <author login="jglick"/>
55
            <compatibility addition="yes"/>
56
            <description>
57
                <p>
58
                    Several internal methods were added to nested class
59
                    of <code>MIMEResolver</code> - <code>UIHelpers</code>
60
                    for use from other parts of the NetBeans Platform. Use from
61
                    other modules is not supported.
62
                </p>
63
            </description>
64
            <class package="org.openide.filesystems" name="MIMEResolver"/>
65
            <issue number="179289"/>
66
        </change>
49
          <change id="recursive-listener">
67
          <change id="recursive-listener">
50
             <api name="filesystems"/>
68
             <api name="filesystems"/>
51
             <summary>Support for recursive listeners</summary>
69
             <summary>Support for recursive listeners</summary>
(-)a/openide.filesystems/manifest.mf (-1 / +1 lines)
Lines 1-6 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.openide.filesystems
2
OpenIDE-Module: org.openide.filesystems
3
OpenIDE-Module-Implementation-Version: 1
4
OpenIDE-Module-Localizing-Bundle: org/openide/filesystems/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/openide/filesystems/Bundle.properties
5
OpenIDE-Module-Layer: org/openide/filesystems/resources/layer.xml
4
OpenIDE-Module-Layer: org/openide/filesystems/resources/layer.xml
5
OpenIDE-Module-Specification-Version: 7.34
6
6
(-)a/openide.filesystems/nbproject/project.properties (-1 lines)
Lines 44-47 Link Here
44
javadoc.main.page=org/openide/filesystems/doc-files/api.html
44
javadoc.main.page=org/openide/filesystems/doc-files/api.html
45
javadoc.arch=${basedir}/arch.xml
45
javadoc.arch=${basedir}/arch.xml
46
javadoc.apichanges=${basedir}/apichanges.xml
46
javadoc.apichanges=${basedir}/apichanges.xml
47
spec.version.base=7.33.0
(-)a/openide.filesystems/nbproject/project.xml (-2 / +2 lines)
Lines 51-57 Link Here
51
                    <build-prerequisite/>
51
                    <build-prerequisite/>
52
                    <compile-dependency/>
52
                    <compile-dependency/>
53
                    <run-dependency>
53
                    <run-dependency>
54
                        <implementation-version/>
54
                        <specification-version>8.0</specification-version>
55
                    </run-dependency>
55
                    </run-dependency>
56
                </dependency>
56
                </dependency>
57
                <dependency>
57
                <dependency>
Lines 59-65 Link Here
59
                    <build-prerequisite/>
59
                    <build-prerequisite/>
60
                    <compile-dependency/>
60
                    <compile-dependency/>
61
                    <run-dependency>
61
                    <run-dependency>
62
                        <implementation-version/>
62
                        <specification-version>8.1</specification-version>
63
                    </run-dependency>
63
                    </run-dependency>
64
                </dependency>
64
                </dependency>
65
            </module-dependencies>
65
            </module-dependencies>
(-)a/openide.filesystems/src/org/netbeans/modules/openide/filesystems/RecognizeInstanceFiles.java (-2 / +2 lines)
Lines 41-47 Link Here
41
import java.util.Map;
41
import java.util.Map;
42
import java.util.logging.Level;
42
import java.util.logging.Level;
43
import java.util.logging.Logger;
43
import java.util.logging.Logger;
44
import org.netbeans.modules.openide.util.NamedServicesProvider;
45
import org.openide.filesystems.FileAttributeEvent;
44
import org.openide.filesystems.FileAttributeEvent;
46
import org.openide.filesystems.FileChangeListener;
45
import org.openide.filesystems.FileChangeListener;
47
import org.openide.filesystems.FileEvent;
46
import org.openide.filesystems.FileEvent;
Lines 58-65 Link Here
58
import org.openide.util.lookup.Lookups;
57
import org.openide.util.lookup.Lookups;
59
import org.openide.util.lookup.ProxyLookup;
58
import org.openide.util.lookup.ProxyLookup;
60
import org.openide.util.lookup.ServiceProvider;
59
import org.openide.util.lookup.ServiceProvider;
60
import org.openide.util.lookup.implspi.NamedServicesProvider;
61
61
62
/** Interface for core/startup to provide lookup overt system filesystem.
62
/** Interface for core/startup to provide lookup over system filesystem.
63
 *
63
 *
64
 * @author Jaroslav Tulach
64
 * @author Jaroslav Tulach
65
 */
65
 */
(-)a/openide.filesystems/src/org/netbeans/modules/openide/filesystems/declmime/MIMEResolverImpl.java (-5 / +5 lines)
Lines 46-51 Link Here
46
import java.io.InputStream;
46
import java.io.InputStream;
47
import java.io.OutputStream;
47
import java.io.OutputStream;
48
import java.util.ArrayList;
48
import java.util.ArrayList;
49
import java.util.Collection;
49
import java.util.Collections;
50
import java.util.Collections;
50
import java.util.HashMap;
51
import java.util.HashMap;
51
import java.util.HashSet;
52
import java.util.HashSet;
Lines 244-256 Link Here
244
        });
245
        });
245
    }
246
    }
246
247
247
    /** Returns map of all registered MIMEResolver instances in revers order,
248
    /** Lists registered MIMEResolver instances in reverse order,
248
     * i.e. first are ones with lower priority (position attribute higher)
249
     * i.e. first are ones with lower priority (position attribute higher)
249
     * and last are ones with highest prority (position attribute lower).
250
     * and last are ones with highest prority (position attribute lower).
250
     * @return map of all registered MIMEResolver instances in revers order
251
     * @return list of all registered MIMEResolver instances in reverse order
251
     * (highest priority last)
252
     */
252
     */
253
    public static Map<Integer, FileObject> getOrderedResolvers() {
253
    public static Collection<? extends FileObject> getOrderedResolvers() {
254
        // scan resolvers and order them to be able to assign extension to mime type from resolver with the lowest position
254
        // scan resolvers and order them to be able to assign extension to mime type from resolver with the lowest position
255
        FileObject[] resolvers = FileUtil.getConfigFile(MIME_RESOLVERS_PATH).getChildren();
255
        FileObject[] resolvers = FileUtil.getConfigFile(MIME_RESOLVERS_PATH).getChildren();
256
        TreeMap<Integer, FileObject> orderedResolvers = new TreeMap<Integer, FileObject>(Collections.reverseOrder());
256
        TreeMap<Integer, FileObject> orderedResolvers = new TreeMap<Integer, FileObject>(Collections.reverseOrder());
Lines 264-270 Link Here
264
            }
264
            }
265
            orderedResolvers.put(position, mimeResolverFO);
265
            orderedResolvers.put(position, mimeResolverFO);
266
        }
266
        }
267
        return orderedResolvers;
267
        return orderedResolvers.values();
268
    }
268
    }
269
269
270
    // MIMEResolver ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
270
    // MIMEResolver ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(-)a/openide.filesystems/src/org/openide/filesystems/FileUtil.java (-1 / +1 lines)
Lines 1470-1476 Link Here
1470
    public static List<String> getMIMETypeExtensions(String mimeType) {
1470
    public static List<String> getMIMETypeExtensions(String mimeType) {
1471
        Parameters.notEmpty("mimeType", mimeType);  //NOI18N
1471
        Parameters.notEmpty("mimeType", mimeType);  //NOI18N
1472
        HashMap<String, String> extensionToMime = new HashMap<String, String>();
1472
        HashMap<String, String> extensionToMime = new HashMap<String, String>();
1473
        for (FileObject mimeResolverFO : MIMEResolverImpl.getOrderedResolvers().values()) {
1473
        for (FileObject mimeResolverFO : MIMEResolverImpl.getOrderedResolvers()) {
1474
            Map<String, Set<String>> mimeToExtensions = MIMEResolverImpl.getMIMEToExtensions(mimeResolverFO);
1474
            Map<String, Set<String>> mimeToExtensions = MIMEResolverImpl.getMIMEToExtensions(mimeResolverFO);
1475
            for (Map.Entry<String, Set<String>> entry : mimeToExtensions.entrySet()) {
1475
            for (Map.Entry<String, Set<String>> entry : mimeToExtensions.entrySet()) {
1476
                String mimeKey = entry.getKey();
1476
                String mimeKey = entry.getKey();
(-)a/openide.filesystems/src/org/openide/filesystems/MIMEResolver.java (+71 lines)
Lines 40-45 Link Here
40
 */
40
 */
41
package org.openide.filesystems;
41
package org.openide.filesystems;
42
42
43
import java.util.Collection;
44
import java.util.Map;
45
import java.util.Set;
46
import org.netbeans.modules.openide.filesystems.declmime.MIMEResolverImpl;
43
import org.openide.util.Parameters;
47
import org.openide.util.Parameters;
44
48
45
/**
49
/**
Lines 104-107 Link Here
104
    String[] getMIMETypes() {
108
    String[] getMIMETypes() {
105
        return resolvableMIMETypes;
109
        return resolvableMIMETypes;
106
    }
110
    }
111
112
    /** Internal support for implementors of MIME resolver UIs. 
113
     * 
114
     * @since 7.34
115
     */
116
    public abstract class UIHelpers {
117
118
        /** Throws an exception. Allows instantiation only by known subclasses.
119
         * @throws IllegalStateException
120
         */
121
        protected UIHelpers() {
122
            if (getClass().getName().equals("org.netbeans.core.ui.options.filetypes.FileAssociationsModel")) { // NOI18N
123
                // only core.ui is allowed to use methods of this class.
124
                return;
125
            }
126
            throw new IllegalStateException();
127
        }
128
129
        /**
130
         * Stores declarative resolver corresponding to specified mapping of MIME type
131
         * and set of extensions. This resolver has the highest priority. Usually
132
         * it resides in userdir/config/Servicer/MIMEResolver.
133
         * <p><strong>Not intended for use by modules outside the NetBeans Platform.</strong>
134
         * @param mimeToExtensions mapping of MIME type to set of extensions like
135
         * {@code {image/jpeg=[jpg, jpeg], image/gif=[]}}
136
         * @since org.openide.filesystems 7.34
137
         */
138
        protected final void storeUserDefinedResolver(final Map<String, Set<String>> mimeToExtensions) {
139
            MIMEResolverImpl.storeUserDefinedResolver(mimeToExtensions);
140
        }
141
142
        /**
143
         * Lists registered MIMEResolver instances in reverse order,
144
         * i.e. first are ones with lower priority (position attribute higher)
145
         * and last are ones with highest prority (position attribute lower).
146
         * <p><strong>Not intended for use by modules outside the NetBeans Platform.</strong>
147
         * @return list of all registered MIME resolver definitions in reverse order
148
         * @since org.openide.filesystems 7.34
149
         */
150
        protected final Collection<? extends FileObject> getOrderedResolvers() {
151
            return MIMEResolverImpl.getOrderedResolvers();
152
        }
153
154
        /**
155
         * Checks whether a given resolver is user-defined.
156
         * <p><strong>Not intended for use by modules outside the NetBeans Platform.</strong>
157
         * @param mimeResolverFO resolver definition
158
         * @return true if the specified file is a user-defined MIME resolver, false otherwise
159
         * @since org.openide.filesystems 7.34
160
         */
161
        protected final boolean isUserDefined(FileObject mimeResolverFO) {
162
            return MIMEResolverImpl.isUserDefined(mimeResolverFO);
163
        }
164
165
        /**
166
         * Returns mapping of MIME type to set of extensions.
167
         * <p><strong>Not intended for use by modules outside the NetBeans Platform.</strong>
168
         * @param fo MIMEResolver definition
169
         * @return mapping of MIME type to set of extensions like
170
         * {@code {image/jpeg=[jpg, jpeg], image/gif=[]}} (never null but may be empty)
171
         * @since org.openide.filesystems 7.34
172
         */
173
        protected final Map<String, Set<String>> getMIMEToExtensions(FileObject fo) {
174
            return MIMEResolverImpl.getMIMEToExtensions(fo);
175
        }
176
    }
177
107
}
178
}
(-)a/openide.nodes/manifest.mf (+1 lines)
Lines 2-5 Link Here
2
OpenIDE-Module: org.openide.nodes
2
OpenIDE-Module: org.openide.nodes
3
OpenIDE-Module-Localizing-Bundle: org/openide/nodes/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/openide/nodes/Bundle.properties
4
AutoUpdate-Essential-Module: true
4
AutoUpdate-Essential-Module: true
5
OpenIDE-Module-Specification-Version: 7.14
5
6
(-)a/openide.nodes/nbproject/project.properties (-1 lines)
Lines 44-47 Link Here
44
javadoc.arch=${basedir}/arch.xml
44
javadoc.arch=${basedir}/arch.xml
45
javadoc.apichanges=${basedir}/apichanges.xml
45
javadoc.apichanges=${basedir}/apichanges.xml
46
46
47
spec.version.base=7.13.0
(-)a/openide.nodes/nbproject/project.xml (-1 / +1 lines)
Lines 67-73 Link Here
67
                    <build-prerequisite/>
67
                    <build-prerequisite/>
68
                    <compile-dependency/>
68
                    <compile-dependency/>
69
                    <run-dependency>
69
                    <run-dependency>
70
                        <implementation-version/>
70
                        <specification-version>8.0</specification-version>
71
                    </run-dependency>
71
                    </run-dependency>
72
                </dependency>
72
                </dependency>
73
                <dependency>
73
                <dependency>
(-)a/openide.nodes/src/org/openide/util/actions/NodeAction.java (-36 / +31 lines)
Lines 168-173 Link Here
168
    */
168
    */
169
    @Override
169
    @Override
170
    public boolean isEnabled() {
170
    public boolean isEnabled() {
171
        if (
172
            (SOURCE.get() instanceof Node) || (SOURCE.get() instanceof Node[])
173
        ) {
174
            return true;
175
        }
171
        Node[] ns = null;
176
        Node[] ns = null;
172
        Boolean b = null;
177
        Boolean b = null;
173
178
Lines 242-247 Link Here
242
        }
247
        }
243
    }
248
    }
244
249
250
    private final ThreadLocal<Object> SOURCE = new ThreadLocal<Object>();
245
    /** Perform the action with a specific action event.
251
    /** Perform the action with a specific action event.
246
     * Normally this simply calls {@link #performAction()}, that is using
252
     * Normally this simply calls {@link #performAction()}, that is using
247
     * the global node selection.
253
     * the global node selection.
Lines 261-288 Link Here
261
    @Override
267
    @Override
262
    public void actionPerformed(final ActionEvent ev) {
268
    public void actionPerformed(final ActionEvent ev) {
263
        final Object s = (ev == null) ? null : ev.getSource();
269
        final Object s = (ev == null) ? null : ev.getSource();
270
        Object prev = SOURCE.get();
271
        try {
272
            SOURCE.set(s);
273
            superActionPerformed(ev);
274
        } finally {
275
            SOURCE.set(prev);
276
        }
277
    }
264
278
265
        if (s instanceof Node) {
279
    final void superActionPerformed(ActionEvent ev) {
266
            org.netbeans.modules.openide.util.ActionsBridge.doPerformAction(
280
        super.actionPerformed(ev);
267
                this,
268
                new org.netbeans.modules.openide.util.ActionsBridge.ActionRunnable(ev, this, amIasynchronous()) {
269
                    public void run() {
270
                        performAction(new Node[] { (Node) s });
271
                    }
272
                }
273
            );
274
        } else if (s instanceof Node[]) {
275
            org.netbeans.modules.openide.util.ActionsBridge.doPerformAction(
276
                this,
277
                new org.netbeans.modules.openide.util.ActionsBridge.ActionRunnable(ev, this, amIasynchronous()) {
278
                    public void run() {
279
                        performAction((Node[]) s);
280
                    }
281
                }
282
            );
283
        } else {
284
            super.actionPerformed(ev);
285
        }
286
    }
281
    }
287
282
288
    /** Performs the action.
283
    /** Performs the action.
Lines 293-299 Link Here
293
     */
288
     */
294
    @Deprecated
289
    @Deprecated
295
    public void performAction() {
290
    public void performAction() {
296
        performAction(getActivatedNodes());
291
        Object s = SOURCE.get();
292
        if (s instanceof Node) {
293
            performAction(new Node[]{(Node) s});
294
        } else if (s instanceof Node[]) {
295
            performAction((Node[]) s);
296
        } else {
297
            performAction(getActivatedNodes());
298
        }
297
    }
299
    }
298
300
299
    /** Get the currently activated nodes.
301
    /** Get the currently activated nodes.
Lines 384-395 Link Here
384
        }
386
        }
385
    }
387
    }
386
    
388
    
387
    /** Package private accessor.
388
     */
389
    final boolean amIasynchronous() {
390
        return asynchronous();
391
    }
392
    
393
    /** Node listener to check whether the action is enabled or not
389
    /** Node listener to check whether the action is enabled or not
394
    */
390
    */
395
    private static final class NodesL implements LookupListener {
391
    private static final class NodesL implements LookupListener {
Lines 582-595 Link Here
582
        /** Invoked when an action occurs.
578
        /** Invoked when an action occurs.
583
         */
579
         */
584
        public void actionPerformed(ActionEvent e) {
580
        public void actionPerformed(ActionEvent e) {
585
            org.netbeans.modules.openide.util.ActionsBridge.doPerformAction (
581
            Object prev = delegate.SOURCE.get();
586
                delegate,
582
            try {
587
                new org.netbeans.modules.openide.util.ActionsBridge.ActionRunnable(e, delegate, delegate.amIasynchronous()) {
583
                delegate.SOURCE.set(nodes());
588
                    public void run() {
584
                delegate.superActionPerformed(e);
589
                        delegate.performAction(nodes());
585
            } finally {
590
                    }
586
                delegate.SOURCE.set(prev);
591
                }
587
            }
592
            );
593
        }
588
        }
594
589
595
        public void addPropertyChangeListener(PropertyChangeListener listener) {
590
        public void addPropertyChangeListener(PropertyChangeListener listener) {
(-)a/openide.util.lookup/apichanges.xml (+20 lines)
Lines 46-51 Link Here
46
    <apidef name="lookup">Lookup API</apidef>
46
    <apidef name="lookup">Lookup API</apidef>
47
</apidefs>
47
</apidefs>
48
<changes>
48
<changes>
49
    <change id="named.services.provider">
50
        <api name="lookup"/>
51
        <summary>Introducing semihidden SPI</summary>
52
        <version major="8" minor="1"/>
53
        <date day="15" month="1" year="2010"/>
54
        <author login="jtulach"/>
55
        <compatibility
56
            addition="yes"
57
            binary="compatible" deletion="no" deprecation="no"
58
            modification="no" semantic="compatible" source="compatible"
59
        />
60
        <description>
61
            <p>
62
                Adding SPI interface package for those who implement
63
                the NetBeans platform. This packages is not shown in javadoc
64
                as it does not form generally available public API.
65
            </p>
66
        </description>
67
        <issue number="179289"/>
68
    </change>
49
    <change id="lookup.is.free">
69
    <change id="lookup.is.free">
50
        <api name="lookup"/>
70
        <api name="lookup"/>
51
        <summary>Separate module for Lookup API</summary>
71
        <summary>Separate module for Lookup API</summary>
(-)a/openide.util.lookup/manifest.mf (-1 / +1 lines)
Lines 1-5 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.openide.util.lookup
2
OpenIDE-Module: org.openide.util.lookup
3
OpenIDE-Module-Implementation-Version: 1
4
OpenIDE-Module-Localizing-Bundle: org/openide/util/lookup/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/openide/util/lookup/Bundle.properties
4
OpenIDE-Module-Specification-Version: 8.2
5
5
(-)a/openide.util.lookup/nbproject/project.properties (-1 / +1 lines)
Lines 40-48 Link Here
40
module.jar.dir=lib
40
module.jar.dir=lib
41
javac.source=1.5
41
javac.source=1.5
42
javac.compilerargs=-Xlint -Xlint:-serial
42
javac.compilerargs=-Xlint -Xlint:-serial
43
spec.version.base=8.0.0
44
cp.extra=${nb_all}/apisupport.harness/external/openjdk-javac-6-b12.jar
43
cp.extra=${nb_all}/apisupport.harness/external/openjdk-javac-6-b12.jar
45
44
46
45
47
javadoc.arch=${basedir}/arch.xml
46
javadoc.arch=${basedir}/arch.xml
48
javadoc.apichanges=${basedir}/apichanges.xml
47
javadoc.apichanges=${basedir}/apichanges.xml
48
module.javadoc.packages=org.openide.util,org.openide.util.lookup
(-)a/openide.util.lookup/nbproject/project.xml (+1 lines)
Lines 22-27 Link Here
22
            <public-packages>
22
            <public-packages>
23
                <package>org.openide.util</package>
23
                <package>org.openide.util</package>
24
                <package>org.openide.util.lookup</package>
24
                <package>org.openide.util.lookup</package>
25
                <package>org.openide.util.lookup.implspi</package>
25
            </public-packages>
26
            </public-packages>
26
        </data>
27
        </data>
27
    </configuration>
28
    </configuration>
(-)a/openide.util.lookup/src/org/netbeans/modules/openide/util/ServiceProviderProcessor.java (+1 lines)
Lines 60-65 Link Here
60
import javax.lang.model.type.TypeMirror;
60
import javax.lang.model.type.TypeMirror;
61
import org.openide.util.lookup.ServiceProvider;
61
import org.openide.util.lookup.ServiceProvider;
62
import org.openide.util.lookup.ServiceProviders;
62
import org.openide.util.lookup.ServiceProviders;
63
import org.openide.util.lookup.implspi.AbstractServiceProviderProcessor;
63
64
64
@SupportedSourceVersion(SourceVersion.RELEASE_6)
65
@SupportedSourceVersion(SourceVersion.RELEASE_6)
65
public class ServiceProviderProcessor extends AbstractServiceProviderProcessor {
66
public class ServiceProviderProcessor extends AbstractServiceProviderProcessor {
(-)a/openide.util.lookup/src/org/openide/util/lookup/AbstractLookup.java (-8 / +4 lines)
Lines 40-54 Link Here
40
 */
40
 */
41
package org.openide.util.lookup;
41
package org.openide.util.lookup;
42
42
43
import java.io.PrintStream;
44
import org.openide.util.Lookup;
45
import org.openide.util.LookupEvent;
46
import org.openide.util.LookupListener;
47
48
import java.io.IOException;
43
import java.io.IOException;
49
import java.io.ObjectOutputStream;
44
import java.io.ObjectOutputStream;
50
import java.io.Serializable;
45
import java.io.Serializable;
51
52
import java.lang.ref.ReferenceQueue;
46
import java.lang.ref.ReferenceQueue;
53
import java.lang.ref.WeakReference;
47
import java.lang.ref.WeakReference;
54
import java.util.ArrayList;
48
import java.util.ArrayList;
Lines 63-71 Link Here
63
import java.util.Map;
57
import java.util.Map;
64
import java.util.Set;
58
import java.util.Set;
65
import java.util.TreeSet;
59
import java.util.TreeSet;
66
67
import java.util.concurrent.Executor;
60
import java.util.concurrent.Executor;
68
import org.netbeans.modules.openide.util.ActiveQueue;
61
import org.openide.util.Lookup;
62
import org.openide.util.LookupEvent;
63
import org.openide.util.LookupListener;
64
import org.openide.util.lookup.implspi.ActiveQueue;
69
65
70
66
71
/** Implementation of the lookup from OpenAPIs that is based on the
67
/** Implementation of the lookup from OpenAPIs that is based on the
(-)a/openide.util.lookup/src/org/openide/util/lookup/Lookups.java (-2 / +10 lines)
Lines 41-49 Link Here
41
41
42
package org.openide.util.lookup;
42
package org.openide.util.lookup;
43
43
44
import java.lang.ref.Reference;
45
import java.lang.ref.WeakReference;
44
import java.util.Arrays;
46
import java.util.Arrays;
45
import org.netbeans.modules.openide.util.NamedServicesProvider;
47
import java.util.Collections;
48
import java.util.HashMap;
49
import java.util.Map;
46
import org.openide.util.Lookup;
50
import org.openide.util.Lookup;
51
import org.openide.util.lookup.implspi.NamedServicesProvider;
47
52
48
/**
53
/**
49
 * Static factory methods for creating common lookup implementations.
54
 * Static factory methods for creating common lookup implementations.
Lines 214-220 Link Here
214
     * @since 7.9
219
     * @since 7.9
215
     */
220
     */
216
    public static Lookup forPath(String path) {
221
    public static Lookup forPath(String path) {
217
        return NamedServicesProvider.find(path);
222
        if (!path.endsWith("/")) {
223
            path = path + "/";
224
        }
225
        return NamedServicesProvider.forPath(path);
218
    }
226
    }
219
    
227
    
220
    /** Creates a lookup that wraps another one and filters out instances
228
    /** Creates a lookup that wraps another one and filters out instances
(-)a/openide.util.lookup/src/org/netbeans/modules/openide/util/AbstractServiceProviderProcessor.java (-3 / +13 lines)
Lines 37-43 Link Here
37
 * Portions Copyrighted 2009 Sun Microsystems, Inc.
37
 * Portions Copyrighted 2009 Sun Microsystems, Inc.
38
 */
38
 */
39
39
40
package org.netbeans.modules.openide.util;
40
package org.openide.util.lookup.implspi;
41
41
42
import java.io.BufferedReader;
42
import java.io.BufferedReader;
43
import java.io.FileNotFoundException;
43
import java.io.FileNotFoundException;
Lines 79-86 Link Here
79
    private final Map<ProcessingEnvironment,Map<String,List<Element>>> originatingElementsByProcessor = new WeakHashMap<ProcessingEnvironment,Map<String,List<Element>>>();
79
    private final Map<ProcessingEnvironment,Map<String,List<Element>>> originatingElementsByProcessor = new WeakHashMap<ProcessingEnvironment,Map<String,List<Element>>>();
80
    private final Map<TypeElement,Boolean> verifiedClasses = new WeakHashMap<TypeElement,Boolean>();
80
    private final Map<TypeElement,Boolean> verifiedClasses = new WeakHashMap<TypeElement,Boolean>();
81
81
82
    /** For access by subclasses. */
82
    /** Throws IllegalStateException. For access by selected subclasses. */
83
    protected AbstractServiceProviderProcessor() {}
83
    protected AbstractServiceProviderProcessor() {
84
        if (getClass().getName().equals("org.netbeans.modules.openide.util.ServiceProviderProcessor")) { // NOI18N
85
            // OK subclass
86
            return;
87
        }
88
        if (getClass().getName().equals("org.netbeans.modules.openide.util.URLStreamHandlerRegistrationProcessor")) { // NOI18N
89
            // OK subclass
90
            return;
91
        }
92
        throw new IllegalStateException();
93
    }
84
94
85
    public @Override final boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
95
    public @Override final boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
86
        if (roundEnv.errorRaised()) {
96
        if (roundEnv.errorRaised()) {
(-)a/openide.util.lookup/src/org/netbeans/modules/openide/util/ActiveQueue.java (-13 / +25 lines)
Lines 1-4 Link Here
1
package org.netbeans.modules.openide.util;
1
package org.openide.util.lookup.implspi;
2
2
3
import java.lang.ref.Reference;
3
import java.lang.ref.Reference;
4
import java.lang.ref.ReferenceQueue;
4
import java.lang.ref.ReferenceQueue;
Lines 7-30 Link Here
7
7
8
/**
8
/**
9
 * Implementation of the active reference queue.
9
 * Implementation of the active reference queue.
10
 * @since 8.1
10
 */
11
 */
11
public final class ActiveQueue extends ReferenceQueue<Object> implements Runnable {
12
public final class ActiveQueue {
13
14
    private ActiveQueue() {}
12
15
13
    private static final Logger LOGGER = Logger.getLogger(ActiveQueue.class.getName().replace('$', '.'));
16
    private static final Logger LOGGER = Logger.getLogger(ActiveQueue.class.getName().replace('$', '.'));
14
    private static ActiveQueue activeReferenceQueue;
17
    private static Impl activeReferenceQueue;
15
    
16
    /** number of known outstanding references */
17
    private int count;
18
    private boolean deprecated;
19
18
20
    ActiveQueue(boolean deprecated) {
19
    /**
21
        super();
20
     * Gets the active reference queue.
22
        this.deprecated = deprecated;
21
     * @return the singleton queue
23
    }
22
     */
24
25
    public static synchronized ReferenceQueue<Object> queue() {
23
    public static synchronized ReferenceQueue<Object> queue() {
26
        if (activeReferenceQueue == null) {
24
        if (activeReferenceQueue == null) {
27
            activeReferenceQueue = new ActiveQueue(false);
25
            activeReferenceQueue = new Impl(false);
28
        }
26
        }
29
27
30
        activeReferenceQueue.ping();
28
        activeReferenceQueue.ping();
Lines 32-37 Link Here
32
        return activeReferenceQueue;
30
        return activeReferenceQueue;
33
    }
31
    }
34
32
33
    private static final class Impl extends ReferenceQueue<Object> implements Runnable {
34
35
    /** number of known outstanding references */
36
    private int count;
37
    private boolean deprecated;
38
39
    Impl(boolean deprecated) {
40
        super();
41
        this.deprecated = deprecated;
42
    }
43
35
    @Override
44
    @Override
36
    public Reference<Object> poll() {
45
    public Reference<Object> poll() {
37
        throw new UnsupportedOperationException();
46
        throw new UnsupportedOperationException();
Lines 105-108 Link Here
105
        }
114
        }
106
        count++;
115
        count++;
107
    }
116
    }
117
118
    }
119
108
}
120
}
(-)a/openide.util.lookup/src/org/netbeans/modules/openide/util/NamedServicesProvider.java (-16 / +66 lines)
Lines 29-35 Link Here
29
 * Portions Copyrighted 2006 Sun Microsystems, Inc.
29
 * Portions Copyrighted 2006 Sun Microsystems, Inc.
30
 */
30
 */
31
31
32
package org.netbeans.modules.openide.util;
32
package org.openide.util.lookup.implspi;
33
33
34
import java.lang.ref.Reference;
34
import java.lang.ref.Reference;
35
import java.lang.ref.WeakReference;
35
import java.lang.ref.WeakReference;
Lines 39-67 Link Here
39
import org.openide.util.Lookup;
39
import org.openide.util.Lookup;
40
import org.openide.util.lookup.Lookups;
40
import org.openide.util.lookup.Lookups;
41
41
42
/** Interface for core/startup and core/settings
42
/** Infrastructure provider interface for those who control the overall
43
 * to provide lookup over system filesystem.
43
 * registration of services in the system. The first instance of this interface
44
 * found in {@link Lookup#getDefault()} is consulted when providing answers
45
 * to {@link Lookups#forPath(java.lang.String)} queries. Current implementation
46
 * is not ready for multiple instances of this interface (the first one wins)
47
 * and also changing the instances during runtime.
48
 *
49
 * <div class="nonnormative">
50
 * The basic implementation of this interface is provided in
51
 * <a href="@org-openide-filesystems@/overview-summary.html">Filesystem API</a>
52
 * and recognizes the 
53
 * <a href="@org-openide-util@/org/openide/util/doc-files/api.html#instance-folders">.instance files</a>
54
 * registered in XML layers. As such one can rely on
55
 * <a href="@org-openide-util@/org/openide/util/doc-files/api.html#instance-folders">.instance files</a>
56
 * being recognized in unit tests, if the
57
 * <a href="@org-openide-filesystems@/overview-summary.html">Filesystem API</a>
58
 * is included.
59
 * The implementation
60
 * is then refined in
61
 * <a href="@org-netbeans-modules-settings@/overview-summary.html">Settings API</a>
62
 * to handle also <a href="@org-openide-util@/org/openide/util/doc-files/api.html#settings">.settings files</a>.
63
 * Again, including this module in unit tests
64
 * ensures 
65
 * <a href="@org-openide-util@/org/openide/util/doc-files/api.html#settings">.settings files</a>
66
 * files are recognized.
67
 * </div>
44
 *
68
 *
45
 * @author Jaroslav Tulach
69
 * @author Jaroslav Tulach
70
 * @since 8.1
46
 */
71
 */
47
public abstract class NamedServicesProvider {
72
public abstract class NamedServicesProvider {
73
    private static final Map<String,Reference<Lookup>> namedServicesProviders = Collections.synchronizedMap(new HashMap<String,Reference<Lookup>>());
48
74
49
    private static final Map<String,Reference<Lookup>> map = Collections.synchronizedMap(new HashMap<String,Reference<Lookup>>());
75
    public static Lookup forPath(String path) {
50
    
76
51
    public abstract Lookup create(String path);
77
        Reference<Lookup> ref = namedServicesProviders.get(path);
52
    
53
    public static Lookup find(String path) {
54
        if (!path.endsWith("/")) {
55
            path = path + "/";
56
        }
57
        
58
        Reference<Lookup> ref = map.get(path);
59
        Lookup lkp = ref == null ? null : ref.get();
78
        Lookup lkp = ref == null ? null : ref.get();
60
        if (lkp != null) {
79
        if (lkp != null) {
61
            return lkp;
80
            return lkp;
62
        }
81
        }
63
        NamedServicesProvider prov = Lookup.getDefault().lookup(NamedServicesProvider.class);
82
        NamedServicesProvider prov = Lookup.getDefault().lookup(NamedServicesProvider.class);
64
        if (prov != null && 
83
        if (prov != null &&
65
            /* avoid stack overflow during initialization */
84
            /* avoid stack overflow during initialization */
66
            !path.startsWith(
85
            !path.startsWith(
67
                "URLStreamHandler/"
86
                "URLStreamHandler/"
Lines 79-87 Link Here
79
            }
98
            }
80
            lkp = Lookups.metaInfServices(l, "META-INF/namedservices/" + path);
99
            lkp = Lookups.metaInfServices(l, "META-INF/namedservices/" + path);
81
        }
100
        }
82
        
101
83
        map.put(path, new WeakReference<Lookup>(lkp));
102
        namedServicesProviders.put(path, new WeakReference<Lookup>(lkp));
84
        return lkp;
103
        return lkp;
85
    }
104
    }
105
106
    /** Throws an exception. Prevents unwanted instantiation of this class
107
     * by unknown subclasses.
108
     */
109
    protected NamedServicesProvider() {
110
        if (getClass().getName().equals("org.openide.util.lookup.PathInLookupTest$P")) { // NOI18N
111
            // OK for tests
112
            return;
113
        }
114
        if (getClass().getName().equals("org.openide.util.UtilitiesTest$NamedServicesProviderImpl")) { // NOI18N
115
            // OK for tests
116
            return;
117
        }
118
        if (getClass().getName().equals("org.netbeans.modules.openide.filesystems.RecognizeInstanceFiles")) { // NOI18N
119
            // OK for openide.filesystems
120
            return;
121
        }
122
        if (getClass().getName().equals("org.netbeans.modules.settings.RecognizeInstanceObjects")) { // NOI18N
123
            // OK for settings
124
            return;
125
        }
126
        throw new IllegalStateException();
127
    }
128
129
    /** Create the lookup for given path. Called as a result of query to
130
     * {@link Lookups#forPath(java.lang.String)}.
131
     *
132
     * @param path the identification of the path
133
     * @return the lookup representing objects in this path.
134
     */
135
    protected abstract Lookup create(String path);
86
    
136
    
87
}
137
}
(-)a/openide.util.lookup/src/org/openide/util/lookup/implspi/package-info.java (+43 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
5
 *
6
 * The contents of this file are subject to the terms of either the GNU
7
 * General Public License Version 2 only ("GPL") or the Common
8
 * Development and Distribution License("CDDL") (collectively, the
9
 * "License"). You may not use this file except in compliance with the
10
 * License. You can obtain a copy of the License at
11
 * http://www.netbeans.org/cddl-gplv2.html
12
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13
 * specific language governing permissions and limitations under the
14
 * License.  When distributing the software, include this License Header
15
 * Notice in each file and include the License file at
16
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
17
 * particular file as subject to the "Classpath" exception as provided
18
 * by Sun in the GPL Version 2 section of the License file that
19
 * accompanied this code. If applicable, add the following below the
20
 * License Header, with the fields enclosed by brackets [] replaced by
21
 * your own identifying information:
22
 * "Portions Copyrighted [year] [name of copyright owner]"
23
 *
24
 * If you wish your version of this file to be governed by only the CDDL
25
 * or only the GPL Version 2, indicate your decision by adding
26
 * "[Contributor] elects to include this software in this distribution
27
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
28
 * single choice of license, a recipient has the option to distribute
29
 * your version of this file under either the CDDL, the GPL Version 2 or
30
 * to extend the choice of license to its licensees as provided above.
31
 * However, if you add GPL Version 2 code and therefore, elected the GPL
32
 * Version 2 license, then the option applies only if the new code is
33
 * made subject to such option by the copyright holder.
34
 *
35
 * Contributor(s):
36
 *
37
 * Portions Copyrighted 2010 Sun Microsystems, Inc.
38
 */
39
40
/**
41
 * Interfaces intended to be used within the NetBeans Platform.
42
 */
43
package org.openide.util.lookup.implspi;
(-)a/openide.util.lookup/test/unit/src/org/netbeans/modules/openide/util/ActiveQueueTest.java (+1 lines)
Lines 45-50 Link Here
45
import java.net.URL;
45
import java.net.URL;
46
import java.net.URLClassLoader;
46
import java.net.URLClassLoader;
47
import org.netbeans.junit.NbTestCase;
47
import org.netbeans.junit.NbTestCase;
48
import org.openide.util.lookup.implspi.ActiveQueue;
48
49
49
/**
50
/**
50
 *
51
 *
(-)a/openide.util.lookup/test/unit/src/org/openide/util/lookup/AbstractLookupMemoryTest.java (-3 / +5 lines)
Lines 41-50 Link Here
41
41
42
package org.openide.util.lookup;
42
package org.openide.util.lookup;
43
43
44
import java.util.*;
44
import java.util.Arrays;
45
import org.netbeans.junit.*;
45
import java.util.Collections;
46
import org.netbeans.modules.openide.util.ActiveQueue;
46
import org.netbeans.junit.NbTestCase;
47
import org.netbeans.junit.NbTestSuite;
47
import org.openide.util.Lookup;
48
import org.openide.util.Lookup;
49
import org.openide.util.lookup.implspi.ActiveQueue;
48
50
49
/** Testing memory consumption of various AbstractLookup aspects.
51
/** Testing memory consumption of various AbstractLookup aspects.
50
 */
52
 */
(-)a/openide.util.lookup/test/unit/src/org/openide/util/lookup/PathInLookupTest.java (-3 / +1 lines)
Lines 45-52 Link Here
45
import java.util.logging.Level;
45
import java.util.logging.Level;
46
import org.netbeans.junit.MockServices;
46
import org.netbeans.junit.MockServices;
47
import org.netbeans.junit.NbTestCase;
47
import org.netbeans.junit.NbTestCase;
48
import org.netbeans.modules.openide.util.NamedServicesProvider;
49
import org.openide.util.Lookup;
48
import org.openide.util.Lookup;
49
import org.openide.util.lookup.implspi.NamedServicesProvider;
50
50
51
/** 
51
/** 
52
 * @author Jaroslav Tulach
52
 * @author Jaroslav Tulach
Lines 98-105 Link Here
98
            new AbstractLookup(ic1), new AbstractLookup(ic2)
98
            new AbstractLookup(ic1), new AbstractLookup(ic2)
99
        };
99
        };
100
100
101
102
        @Override
103
        public Lookup create(String path) {
101
        public Lookup create(String path) {
104
            int indx = -1;
102
            int indx = -1;
105
            if (path.equals("MyServices/")) {
103
            if (path.equals("MyServices/")) {
(-)a/openide.util.lookup/test/unit/src/org/openide/util/lookup/ProxyLookupTest.java (-4 / +6 lines)
Lines 45-59 Link Here
45
45
46
import java.lang.ref.Reference;
46
import java.lang.ref.Reference;
47
import java.lang.ref.WeakReference;
47
import java.lang.ref.WeakReference;
48
import java.util.*;
48
import java.util.ArrayList;
49
import java.util.Collection;
50
import java.util.Collections;
49
import java.util.concurrent.Executor;
51
import java.util.concurrent.Executor;
50
import junit.framework.*;
52
import junit.framework.Test;
51
import org.netbeans.junit.*;
53
import org.netbeans.junit.NbTestSuite;
52
import org.netbeans.modules.openide.util.ActiveQueue;
53
import org.openide.util.Lookup;
54
import org.openide.util.Lookup;
54
import org.openide.util.Lookup.Result;
55
import org.openide.util.Lookup.Result;
55
import org.openide.util.LookupEvent;
56
import org.openide.util.LookupEvent;
56
import org.openide.util.LookupListener;
57
import org.openide.util.LookupListener;
58
import org.openide.util.lookup.implspi.ActiveQueue;
57
59
58
/** Runs all NbLookupTest tests on ProxyLookup and adds few additional.
60
/** Runs all NbLookupTest tests on ProxyLookup and adds few additional.
59
 */
61
 */
(-)a/openide.util/manifest.mf (-1 / +1 lines)
Lines 1-5 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.openide.util
2
OpenIDE-Module: org.openide.util
3
OpenIDE-Module-Implementation-Version: 1
4
OpenIDE-Module-Localizing-Bundle: org/openide/util/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/openide/util/Bundle.properties
4
OpenIDE-Module-Specification-Version: 8.1
5
5
(-)a/openide.util/nbproject/project.properties (-1 lines)
Lines 42-48 Link Here
42
module.jar.dir=lib
42
module.jar.dir=lib
43
cp.extra=${nb_all}/apisupport.harness/external/openjdk-javac-6-b12.jar
43
cp.extra=${nb_all}/apisupport.harness/external/openjdk-javac-6-b12.jar
44
44
45
spec.version.base=8.0.0
46
45
47
# For XMLSerializer, needed for XMLUtil.write to work w/ namespaces under JDK 1.4:
46
# For XMLSerializer, needed for XMLUtil.write to work w/ namespaces under JDK 1.4:
48
47
(-)a/openide.util/nbproject/project.xml (-3 / +3 lines)
Lines 51-57 Link Here
51
                    <build-prerequisite/>
51
                    <build-prerequisite/>
52
                    <compile-dependency/>
52
                    <compile-dependency/>
53
                    <run-dependency>
53
                    <run-dependency>
54
                        <implementation-version/>
54
                        <specification-version>8.2</specification-version>
55
                    </run-dependency>
55
                    </run-dependency>
56
                </dependency>
56
                </dependency>
57
            </module-dependencies>
57
            </module-dependencies>
Lines 77-86 Link Here
77
            <public-packages>
77
            <public-packages>
78
                <package>org.openide</package>
78
                <package>org.openide</package>
79
                <package>org.openide.util</package>
79
                <package>org.openide.util</package>
80
                <package>org.openide.util.actions</package>
80
                <package>org.openide.util.datatransfer</package>
81
                <package>org.openide.util.datatransfer</package>
81
                <package>org.openide.util.actions</package>
82
                <package>org.openide.util.lookup</package>
83
                <package>org.openide.util.io</package>
82
                <package>org.openide.util.io</package>
83
                <package>org.openide.util.spi</package>
84
                <package>org.openide.xml</package>
84
                <package>org.openide.xml</package>
85
            </public-packages>
85
            </public-packages>
86
        </data>
86
        </data>
(-)a/openide.util/src/org/netbeans/modules/openide/util/URLStreamHandlerRegistrationProcessor.java (+1 lines)
Lines 49-54 Link Here
49
import javax.lang.model.element.TypeElement;
49
import javax.lang.model.element.TypeElement;
50
import javax.lang.model.type.TypeMirror;
50
import javax.lang.model.type.TypeMirror;
51
import org.openide.util.URLStreamHandlerRegistration;
51
import org.openide.util.URLStreamHandlerRegistration;
52
import org.openide.util.lookup.implspi.AbstractServiceProviderProcessor;
52
53
53
@SupportedSourceVersion(SourceVersion.RELEASE_6)
54
@SupportedSourceVersion(SourceVersion.RELEASE_6)
54
public class URLStreamHandlerRegistrationProcessor extends AbstractServiceProviderProcessor {
55
public class URLStreamHandlerRegistrationProcessor extends AbstractServiceProviderProcessor {
(-)a/openide.util/src/org/openide/util/NbPreferences.java (-1 / +1 lines)
Lines 47-53 Link Here
47
import java.util.logging.Level;
47
import java.util.logging.Level;
48
import java.util.logging.Logger;
48
import java.util.logging.Logger;
49
import java.util.prefs.Preferences;
49
import java.util.prefs.Preferences;
50
import org.netbeans.modules.openide.util.PreferencesProvider;
50
import org.openide.util.spi.PreferencesProvider;
51
51
52
/**
52
/**
53
 * Provides an implementation of the Preferences API which may be backed by
53
 * Provides an implementation of the Preferences API which may be backed by
(-)a/openide.util/src/org/openide/util/Utilities.java (-5 / +5 lines)
Lines 41-47 Link Here
41
41
42
package org.openide.util;
42
package org.openide.util;
43
43
44
import org.netbeans.modules.openide.util.ActiveQueue;
45
import java.awt.BorderLayout;
44
import java.awt.BorderLayout;
46
import java.awt.Component;
45
import java.awt.Component;
47
import java.awt.Container;
46
import java.awt.Container;
Lines 105-113 Link Here
105
import javax.swing.KeyStroke;
104
import javax.swing.KeyStroke;
106
import javax.swing.SwingUtilities;
105
import javax.swing.SwingUtilities;
107
import javax.swing.Timer;
106
import javax.swing.Timer;
108
import org.netbeans.modules.openide.util.AWTBridge;
109
import org.openide.util.actions.Presenter;
107
import org.openide.util.actions.Presenter;
110
import org.openide.util.lookup.Lookups;
108
import org.openide.util.lookup.Lookups;
109
import org.openide.util.lookup.implspi.ActiveQueue;
110
import org.openide.util.spi.ActionPresenterProvider;
111
111
112
/** Otherwise uncategorized useful static methods.
112
/** Otherwise uncategorized useful static methods.
113
*
113
*
Lines 2737-2746 Link Here
2737
                    }
2737
                    }
2738
                } else {
2738
                } else {
2739
                    // We need to correctly handle mnemonics with '&' etc.
2739
                    // We need to correctly handle mnemonics with '&' etc.
2740
                     item = AWTBridge.getDefault().createPopupPresenter(action);
2740
                     item = ActionPresenterProvider.getDefault().createPopupPresenter(action);
2741
                }
2741
                }
2742
2742
2743
                for (Component c : AWTBridge.getDefault().convertComponents(item)) {
2743
                for (Component c : ActionPresenterProvider.getDefault().convertComponents(item)) {
2744
                    if (c instanceof JSeparator) {
2744
                    if (c instanceof JSeparator) {
2745
                        components.add(null);
2745
                        components.add(null);
2746
                    } else {
2746
                    } else {
Lines 2753-2759 Link Here
2753
        }
2753
        }
2754
2754
2755
        // Now create actual menu. Strip adjacent, leading, and trailing separators.
2755
        // Now create actual menu. Strip adjacent, leading, and trailing separators.
2756
        JPopupMenu menu = AWTBridge.getDefault().createEmptyPopup();
2756
        JPopupMenu menu = ActionPresenterProvider.getDefault().createEmptyPopup();
2757
        boolean nonempty = false; // has anything been added yet?
2757
        boolean nonempty = false; // has anything been added yet?
2758
        boolean pendingSep = false; // should there be a separator before any following item?
2758
        boolean pendingSep = false; // should there be a separator before any following item?
2759
        for (Component c : components) {
2759
        for (Component c : components) {
(-)a/openide.util/src/org/openide/util/actions/BooleanStateAction.java (-3 / +3 lines)
Lines 62-68 Link Here
62
    * @return the JMenuItem representation for the Action
62
    * @return the JMenuItem representation for the Action
63
    */
63
    */
64
    public javax.swing.JMenuItem getMenuPresenter() {
64
    public javax.swing.JMenuItem getMenuPresenter() {
65
        return org.netbeans.modules.openide.util.AWTBridge.getDefault().createMenuPresenter(this);
65
        return org.openide.util.spi.ActionPresenterProvider.getDefault().createMenuPresenter(this);
66
    }
66
    }
67
67
68
    /* Returns a JMenuItem that presents the Action, that implements this
68
    /* Returns a JMenuItem that presents the Action, that implements this
Lines 71-77 Link Here
71
    * @return the JMenuItem representation for the Action
71
    * @return the JMenuItem representation for the Action
72
    */
72
    */
73
    public javax.swing.JMenuItem getPopupPresenter() {
73
    public javax.swing.JMenuItem getPopupPresenter() {
74
        return org.netbeans.modules.openide.util.AWTBridge.getDefault().createPopupPresenter(this);
74
        return org.openide.util.spi.ActionPresenterProvider.getDefault().createPopupPresenter(this);
75
    }
75
    }
76
76
77
    /* Returns a Component that presents the Action, that implements this
77
    /* Returns a Component that presents the Action, that implements this
Lines 79-85 Link Here
79
    * @return the Component representation for the Action
79
    * @return the Component representation for the Action
80
    */
80
    */
81
    public java.awt.Component getToolbarPresenter() {
81
    public java.awt.Component getToolbarPresenter() {
82
        return org.netbeans.modules.openide.util.AWTBridge.getDefault().createToolbarPresenter(this);
82
        return org.openide.util.spi.ActionPresenterProvider.getDefault().createToolbarPresenter(this);
83
    }
83
    }
84
84
85
    /** Get the current state.
85
    /** Get the current state.
(-)a/openide.util/src/org/openide/util/actions/CallableSystemAction.java (-5 / +5 lines)
Lines 85-91 Link Here
85
    * @return the JMenuItem representation for the Action
85
    * @return the JMenuItem representation for the Action
86
    */
86
    */
87
    public javax.swing.JMenuItem getMenuPresenter() {
87
    public javax.swing.JMenuItem getMenuPresenter() {
88
        return org.netbeans.modules.openide.util.AWTBridge.getDefault().createMenuPresenter(this);
88
        return org.openide.util.spi.ActionPresenterProvider.getDefault().createMenuPresenter(this);
89
    }
89
    }
90
90
91
    /* Returns a JMenuItem that presents the Action, that implements this
91
    /* Returns a JMenuItem that presents the Action, that implements this
Lines 93-99 Link Here
93
    * @return the JMenuItem representation for the Action
93
    * @return the JMenuItem representation for the Action
94
    */
94
    */
95
    public javax.swing.JMenuItem getPopupPresenter() {
95
    public javax.swing.JMenuItem getPopupPresenter() {
96
        return org.netbeans.modules.openide.util.AWTBridge.getDefault().createPopupPresenter(this);
96
        return org.openide.util.spi.ActionPresenterProvider.getDefault().createPopupPresenter(this);
97
    }
97
    }
98
98
99
    /* Returns a Component that presents the Action, that implements this
99
    /* Returns a Component that presents the Action, that implements this
Lines 101-107 Link Here
101
    * @return the Component representation for the Action
101
    * @return the Component representation for the Action
102
    */
102
    */
103
    public java.awt.Component getToolbarPresenter() {
103
    public java.awt.Component getToolbarPresenter() {
104
        return org.netbeans.modules.openide.util.AWTBridge.getDefault().createToolbarPresenter(this);
104
        return org.openide.util.spi.ActionPresenterProvider.getDefault().createToolbarPresenter(this);
105
    }
105
    }
106
106
107
    /** Actually perform the action.
107
    /** Actually perform the action.
Lines 120-128 Link Here
120
    */
120
    */
121
    public void actionPerformed(ActionEvent ev) {
121
    public void actionPerformed(ActionEvent ev) {
122
        if (isEnabled()) {
122
        if (isEnabled()) {
123
            org.netbeans.modules.openide.util.ActionsBridge.doPerformAction(
123
            org.openide.util.spi.ActionsBridge.doPerformAction(
124
                this,
124
                this,
125
                new org.netbeans.modules.openide.util.ActionsBridge.ActionRunnable(ev, this, asynchronous()) {
125
                new org.openide.util.spi.ActionsBridge.ActionRunnable(ev, this, asynchronous()) {
126
                    public void run() {
126
                    public void run() {
127
                        performAction();
127
                        performAction();
128
                    }
128
                    }
(-)a/openide.util/src/org/openide/util/actions/CallbackSystemAction.java (-8 / +8 lines)
Lines 225-233 Link Here
225
        final Object ap = getActionPerformer();
225
        final Object ap = getActionPerformer();
226
226
227
        if (ap != null) {
227
        if (ap != null) {
228
            org.netbeans.modules.openide.util.ActionsBridge.doPerformAction(
228
            org.openide.util.spi.ActionsBridge.doPerformAction(
229
                this,
229
                this,
230
                new org.netbeans.modules.openide.util.ActionsBridge.ActionRunnable(ev, this, asynchronous ()) {
230
                new org.openide.util.spi.ActionsBridge.ActionRunnable(ev, this, asynchronous ()) {
231
                    public void run() {
231
                    public void run() {
232
                        if (ap == getActionPerformer()) {
232
                        if (ap == getActionPerformer()) {
233
                            getActionPerformer().performAction(CallbackSystemAction.this);
233
                            getActionPerformer().performAction(CallbackSystemAction.this);
Lines 600-613 Link Here
600
            final Action a = findAction();
600
            final Action a = findAction();
601
601
602
            if (a != null) {
602
            if (a != null) {
603
                org.netbeans.modules.openide.util.ActionsBridge.ActionRunnable run;
603
                org.openide.util.spi.ActionsBridge.ActionRunnable run;
604
                run = new org.netbeans.modules.openide.util.ActionsBridge.ActionRunnable(e, delegate, delegate.asynchronous()) {
604
                run = new org.openide.util.spi.ActionsBridge.ActionRunnable(e, delegate, delegate.asynchronous()) {
605
                            public void run() {
605
                            public void run() {
606
                                a.actionPerformed(e);
606
                                a.actionPerformed(e);
607
                            }
607
                            }
608
                        };
608
                        };
609
609
610
                org.netbeans.modules.openide.util.ActionsBridge.doPerformAction(delegate, run);
610
                org.openide.util.spi.ActionsBridge.doPerformAction(delegate, run);
611
            } else {
611
            } else {
612
                // XXX #30303 if the action falls back to the old behaviour
612
                // XXX #30303 if the action falls back to the old behaviour
613
                // it may not be performed in case it is in dialog and
613
                // it may not be performed in case it is in dialog and
Lines 707-713 Link Here
707
707
708
                return delegate.getMenuPresenter();
708
                return delegate.getMenuPresenter();
709
            } else {
709
            } else {
710
                return org.netbeans.modules.openide.util.AWTBridge.getDefault().createMenuPresenter(this);
710
                return org.openide.util.spi.ActionPresenterProvider.getDefault().createMenuPresenter(this);
711
            }
711
            }
712
        }
712
        }
713
713
Lines 716-722 Link Here
716
716
717
                return delegate.getPopupPresenter();
717
                return delegate.getPopupPresenter();
718
            } else {
718
            } else {
719
                return org.netbeans.modules.openide.util.AWTBridge.getDefault().createPopupPresenter(this);
719
                return org.openide.util.spi.ActionPresenterProvider.getDefault().createPopupPresenter(this);
720
            }
720
            }
721
        }
721
        }
722
722
Lines 725-731 Link Here
725
725
726
                return delegate.getToolbarPresenter();
726
                return delegate.getToolbarPresenter();
727
            } else {
727
            } else {
728
                return org.netbeans.modules.openide.util.AWTBridge.getDefault().createToolbarPresenter(this);
728
                return org.openide.util.spi.ActionPresenterProvider.getDefault().createToolbarPresenter(this);
729
            }
729
            }
730
        }
730
        }
731
731
(-)a/openide.util/src/org/netbeans/modules/openide/util/AWTBridge.java (-5 / +5 lines)
Lines 39-45 Link Here
39
 * made subject to such option by the copyright holder.
39
 * made subject to such option by the copyright holder.
40
 */
40
 */
41
41
42
package org.netbeans.modules.openide.util;
42
package org.openide.util.spi;
43
43
44
import java.awt.Component;
44
import java.awt.Component;
45
import javax.swing.Action;
45
import javax.swing.Action;
Lines 56-67 Link Here
56
 * to allow more enhanced parts of the system to provide more enhanced
56
 * to allow more enhanced parts of the system to provide more enhanced
57
 * visualitions.
57
 * visualitions.
58
 */
58
 */
59
public abstract class AWTBridge extends Object {
59
public abstract class ActionPresenterProvider extends Object {
60
    /** Finds out the global implementtion of the object
60
    /** Finds out the global implementtion of the object
61
     * @return the presenter
61
     * @return the presenter
62
     */
62
     */
63
    public static AWTBridge getDefault () {
63
    public static ActionPresenterProvider getDefault () {
64
        AWTBridge ap = Lookup.getDefault().lookup(AWTBridge.class);
64
        ActionPresenterProvider ap = Lookup.getDefault().lookup(ActionPresenterProvider.class);
65
        return ap == null ? new Default () : ap;
65
        return ap == null ? new Default () : ap;
66
    }
66
    }
67
    
67
    
Lines 95-101 Link Here
95
    // Default implementation of the the presenter
95
    // Default implementation of the the presenter
96
    // 
96
    // 
97
    
97
    
98
    private static final class Default extends AWTBridge {
98
    private static final class Default extends ActionPresenterProvider {
99
        
99
        
100
        public JMenuItem createMenuPresenter(Action action) {
100
        public JMenuItem createMenuPresenter(Action action) {
101
            return new JMenuItem(action);
101
            return new JMenuItem(action);
(-)a/openide.util/src/org/netbeans/modules/openide/util/ActionsBridge.java (-10 / +1 lines)
Lines 39-56 Link Here
39
 * made subject to such option by the copyright holder.
39
 * made subject to such option by the copyright holder.
40
 */
40
 */
41
41
42
package org.netbeans.modules.openide.util;
42
package org.openide.util.spi;
43
43
44
import java.awt.event.ActionEvent;
44
import java.awt.event.ActionEvent;
45
import java.beans.PropertyChangeListener;
45
import java.beans.PropertyChangeListener;
46
import javax.swing.Action;
46
import javax.swing.Action;
47
import org.openide.util.Lookup;
47
import org.openide.util.Lookup;
48
import org.openide.util.RequestProcessor;
48
import org.openide.util.RequestProcessor;
49
import org.openide.util.actions.CallableSystemAction;
50
import org.openide.util.actions.SystemAction;
49
import org.openide.util.actions.SystemAction;
51
50
52
/** Allows Node action to get access to special tricks in CallableSystemAction.
53
 */
54
public abstract class ActionsBridge extends Object {
51
public abstract class ActionsBridge extends Object {
55
    /** thread to run actions in */
52
    /** thread to run actions in */
56
    private static RequestProcessor RP = new RequestProcessor("Module-Actions", Integer.MAX_VALUE); // NOI18N
53
    private static RequestProcessor RP = new RequestProcessor("Module-Actions", Integer.MAX_VALUE); // NOI18N
Lines 60-72 Link Here
60
     */
57
     */
61
    protected abstract void invokeAction(Action action, ActionEvent ev);
58
    protected abstract void invokeAction(Action action, ActionEvent ev);
62
59
63
    public static void doPerformAction(CallableSystemAction action, final ActionsBridge.ActionRunnable r) {
64
        implPerformAction(action, r);
65
    }
66
    public static void doPerformAction(Action action, final ActionsBridge.ActionRunnable r) {
60
    public static void doPerformAction(Action action, final ActionsBridge.ActionRunnable r) {
67
        implPerformAction(action, r);
68
    }
69
    private static void implPerformAction(Action action, final ActionsBridge.ActionRunnable r) {
70
        assert java.awt.EventQueue.isDispatchThread() : "Action " + action.getClass().getName() +
61
        assert java.awt.EventQueue.isDispatchThread() : "Action " + action.getClass().getName() +
71
        " may not be invoked from the thread " + Thread.currentThread().getName() +
62
        " may not be invoked from the thread " + Thread.currentThread().getName() +
72
        ", only the event queue: http://www.netbeans.org/download/4_1/javadoc/OpenAPIs/apichanges.html#actions-event-thread";
63
        ", only the event queue: http://www.netbeans.org/download/4_1/javadoc/OpenAPIs/apichanges.html#actions-event-thread";
(-)a/openide.util/src/org/netbeans/modules/openide/util/PreferencesProvider.java (-1 / +1 lines)
Lines 39-45 Link Here
39
 * made subject to such option by the copyright holder.
39
 * made subject to such option by the copyright holder.
40
 */
40
 */
41
41
42
package org.netbeans.modules.openide.util;
42
package org.openide.util.spi;
43
43
44
import java.util.prefs.Preferences;
44
import java.util.prefs.Preferences;
45
45
(-)a/openide.util/src/org/openide/util/spi/package-info.java (+43 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
5
 *
6
 * The contents of this file are subject to the terms of either the GNU
7
 * General Public License Version 2 only ("GPL") or the Common
8
 * Development and Distribution License("CDDL") (collectively, the
9
 * "License"). You may not use this file except in compliance with the
10
 * License. You can obtain a copy of the License at
11
 * http://www.netbeans.org/cddl-gplv2.html
12
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13
 * specific language governing permissions and limitations under the
14
 * License.  When distributing the software, include this License Header
15
 * Notice in each file and include the License file at
16
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
17
 * particular file as subject to the "Classpath" exception as provided
18
 * by Sun in the GPL Version 2 section of the License file that
19
 * accompanied this code. If applicable, add the following below the
20
 * License Header, with the fields enclosed by brackets [] replaced by
21
 * your own identifying information:
22
 * "Portions Copyrighted [year] [name of copyright owner]"
23
 *
24
 * If you wish your version of this file to be governed by only the CDDL
25
 * or only the GPL Version 2, indicate your decision by adding
26
 * "[Contributor] elects to include this software in this distribution
27
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
28
 * single choice of license, a recipient has the option to distribute
29
 * your version of this file under either the CDDL, the GPL Version 2 or
30
 * to extend the choice of license to its licensees as provided above.
31
 * However, if you add GPL Version 2 code and therefore, elected the GPL
32
 * Version 2 license, then the option applies only if the new code is
33
 * made subject to such option by the copyright holder.
34
 *
35
 * Contributor(s):
36
 *
37
 * Portions Copyrighted 2010 Sun Microsystems, Inc.
38
 */
39
40
/**
41
 * Interfaces intended to be used within the NetBeans Platform.
42
 */
43
package org.openide.util.spi;
(-)a/openide.util/test/unit/src/org/openide/util/UtilitiesTest.java (-50 / +67 lines)
Lines 63-74 Link Here
63
import junit.framework.Assert;
63
import junit.framework.Assert;
64
import org.netbeans.junit.MockServices;
64
import org.netbeans.junit.MockServices;
65
import org.netbeans.junit.NbTestCase;
65
import org.netbeans.junit.NbTestCase;
66
import org.netbeans.modules.openide.util.AWTBridge;
67
import org.netbeans.modules.openide.util.NamedServicesProvider;
68
import org.openide.util.actions.Presenter;
66
import org.openide.util.actions.Presenter;
69
import org.openide.util.lookup.AbstractLookup;
67
import org.openide.util.lookup.AbstractLookup;
70
import org.openide.util.lookup.InstanceContent;
68
import org.openide.util.lookup.InstanceContent;
71
import org.openide.util.lookup.Lookups;
69
import org.openide.util.lookup.Lookups;
70
import org.openide.util.lookup.implspi.NamedServicesProvider;
71
import org.openide.util.spi.ActionPresenterProvider;
72
import org.openide.util.test.MockLookup;
72
import org.openide.util.test.MockLookup;
73
73
74
/**
74
/**
Lines 283-335 Link Here
283
    }
283
    }
284
284
285
    public void testActionsForPath() throws Exception {
285
    public void testActionsForPath() throws Exception {
286
        MockLookup.setInstances(new NamedServicesProvider() {
286
        MockLookup.setInstances(new NamedServicesProviderImpl());
287
            public Lookup create(String path) {
288
                if (!path.equals("stuff/")) {
289
                    return Lookup.EMPTY;
290
                }
291
                InstanceContent content = new InstanceContent();
292
                InstanceContent.Convertor<String,Action> actionConvertor = new InstanceContent.Convertor<String,Action>() {
293
                    public Action convert(final String obj) {
294
                        return new AbstractAction() {
295
                            public void actionPerformed(ActionEvent e) {}
296
                            public @Override String toString() {
297
                                return obj;
298
                            }
299
300
                        };
301
                    }
302
                    public Class<? extends Action> type(String obj) {
303
                        return AbstractAction.class;
304
                    }
305
                    public String id(String obj) {
306
                        return obj;
307
                    }
308
                    public String displayName(String obj) {
309
                        return id(obj);
310
                    }
311
                };
312
                InstanceContent.Convertor<Boolean,JSeparator> separatorConvertor = new InstanceContent.Convertor<Boolean,JSeparator>() {
313
                    public JSeparator convert(Boolean obj) {
314
                        Assert.fail("should not be creating the JSeparator yet");
315
                        return new JSeparator();
316
                    }
317
                    public Class<? extends JSeparator> type(Boolean obj) {
318
                        return JSeparator.class;
319
                    }
320
                    public String id(Boolean obj) {
321
                        return "sep";
322
                    }
323
                    public String displayName(Boolean obj) {
324
                        return id(obj);
325
                    }
326
                };
327
                content.add("hello", actionConvertor);
328
                content.add(true, separatorConvertor);
329
                content.add("there", actionConvertor);
330
                return new AbstractLookup(content);
331
            }
332
        });
333
        // #156829: ensure that no tree lock is acquired.
287
        // #156829: ensure that no tree lock is acquired.
334
        final Semaphore ready = new Semaphore(0);
288
        final Semaphore ready = new Semaphore(0);
335
        final Semaphore done = new Semaphore(0);
289
        final Semaphore done = new Semaphore(0);
Lines 546-552 Link Here
546
    }
500
    }
547
     */
501
     */
548
502
549
    public static final class AwtBridgeImpl extends AWTBridge {
503
    public static final class AwtBridgeImpl extends ActionPresenterProvider {
550
        public JPopupMenu createEmptyPopup() {
504
        public JPopupMenu createEmptyPopup() {
551
            return new JPopupMenu();
505
            return new JPopupMenu();
552
        }
506
        }
Lines 567-571 Link Here
567
            }
521
            }
568
        }
522
        }
569
    }
523
    }
524
525
    private class NamedServicesProviderImpl extends NamedServicesProvider {
526
527
        public NamedServicesProviderImpl() {
528
        }
529
530
        public Lookup create(String path) {
531
            if (!path.equals("stuff/")) {
532
                return Lookup.EMPTY;
533
            }
534
            InstanceContent content = new InstanceContent();
535
            InstanceContent.Convertor<String, Action> actionConvertor = new InstanceContent.Convertor<String, Action>() {
536
537
                public Action convert(final String obj) {
538
                    return new AbstractAction() {
539
540
                        public void actionPerformed(ActionEvent e) {
541
                        }
542
543
                        @Override
544
                        public String toString() {
545
                            return obj;
546
                        }
547
                    };
548
                }
549
550
                public Class<? extends Action> type(String obj) {
551
                    return AbstractAction.class;
552
                }
553
554
                public String id(String obj) {
555
                    return obj;
556
                }
557
558
                public String displayName(String obj) {
559
                    return id(obj);
560
                }
561
            };
562
            InstanceContent.Convertor<Boolean, JSeparator> separatorConvertor = new InstanceContent.Convertor<Boolean, JSeparator>() {
563
564
                public JSeparator convert(Boolean obj) {
565
                    Assert.fail("should not be creating the JSeparator yet");
566
                    return new JSeparator();
567
                }
568
569
                public Class<? extends JSeparator> type(Boolean obj) {
570
                    return JSeparator.class;
571
                }
572
573
                public String id(Boolean obj) {
574
                    return "sep";
575
                }
576
577
                public String displayName(Boolean obj) {
578
                    return id(obj);
579
                }
580
            };
581
            content.add("hello", actionConvertor);
582
            content.add(true, separatorConvertor);
583
            content.add("there", actionConvertor);
584
            return new AbstractLookup(content);
585
        }
586
    }
570
    
587
    
571
}
588
}
(-)a/progress.ui/manifest.mf (-1 / +2 lines)
Lines 2-7 Link Here
2
OpenIDE-Module: org.netbeans.modules.progress.ui
2
OpenIDE-Module: org.netbeans.modules.progress.ui
3
OpenIDE-Module-Layer: org/netbeans/modules/progress/ui/layer.xml
3
OpenIDE-Module-Layer: org/netbeans/modules/progress/ui/layer.xml
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/progress/ui/Bundle.properties
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/progress/ui/Bundle.properties
5
OpenIDE-Module-Provides: org.netbeans.progress.spi.ProgressUIWorkerProvider, org.netbeans.progress.spi.RunOffAWTProvider
5
OpenIDE-Module-Provides: org.netbeans.modules.progress.spi.ProgressUIWorkerProvider, org.netbeans.modules.progress.spi.RunOffEDTProvider
6
AutoUpdate-Essential-Module: true
6
AutoUpdate-Essential-Module: true
7
OpenIDE-Module-Specification-Version: 1.8
7
8
(-)a/progress.ui/nbproject/project.properties (-1 lines)
Lines 2-5 Link Here
2
is.autoload=true
2
is.autoload=true
3
javac.compilerargs=-Xlint:unchecked
3
javac.compilerargs=-Xlint:unchecked
4
javac.source=1.5
4
javac.source=1.5
5
spec.version.base=1.7.0
(-)a/progress.ui/nbproject/project.xml (-1 / +1 lines)
Lines 11-17 Link Here
11
                    <compile-dependency/>
11
                    <compile-dependency/>
12
                    <run-dependency>
12
                    <run-dependency>
13
                        <release-version>1</release-version>
13
                        <release-version>1</release-version>
14
                        <implementation-version/>
14
                        <specification-version>1.18</specification-version>
15
                    </run-dependency>
15
                    </run-dependency>
16
                </dependency>
16
                </dependency>
17
                <dependency>
17
                <dependency>
(-)a/progress.ui/src/org/netbeans/modules/progress/ui/Bundle.properties (+5 lines)
Lines 57-59 Link Here
57
RunOffAWT.TITLE_Operation=Lengthy operation in progress
57
RunOffAWT.TITLE_Operation=Lengthy operation in progress
58
RunOffAWT.BTN_Cancel=Cancel
58
RunOffAWT.BTN_Cancel=Cancel
59
59
60
# ProgressListAction
61
CTL_ProcessListAction=&Processes
62
63
# CancelAction
64
CTL_CancelAction=Cancel Process
(-)a/api.progress/src/org/netbeans/progress/module/CancelAction.java (-2 / +3 lines)
Lines 38-46 Link Here
38
 * Version 2 license, then the option applies only if the new code is
38
 * Version 2 license, then the option applies only if the new code is
39
 * made subject to such option by the copyright holder.
39
 * made subject to such option by the copyright holder.
40
 */
40
 */
41
package org.netbeans.progress.module;
41
package org.netbeans.modules.progress.ui;
42
42
43
import org.netbeans.progress.spi.InternalHandle;
43
import org.netbeans.modules.progress.spi.Controller;
44
import org.netbeans.modules.progress.spi.InternalHandle;
44
import org.openide.util.HelpCtx;
45
import org.openide.util.HelpCtx;
45
import org.openide.util.NbBundle;
46
import org.openide.util.NbBundle;
46
import org.openide.util.actions.CallableSystemAction;
47
import org.openide.util.actions.CallableSystemAction;
(-)a/progress.ui/src/org/netbeans/modules/progress/ui/ListComponent.java (-2 / +2 lines)
Lines 63-70 Link Here
63
import javax.swing.JPopupMenu;
63
import javax.swing.JPopupMenu;
64
import javax.swing.KeyStroke;
64
import javax.swing.KeyStroke;
65
import javax.swing.UIManager;
65
import javax.swing.UIManager;
66
import org.netbeans.progress.spi.InternalHandle;
66
import org.netbeans.modules.progress.spi.InternalHandle;
67
import org.netbeans.progress.spi.ProgressEvent;
67
import org.netbeans.modules.progress.spi.ProgressEvent;
68
import org.openide.DialogDisplayer;
68
import org.openide.DialogDisplayer;
69
import org.openide.NotifyDescriptor;
69
import org.openide.NotifyDescriptor;
70
import org.openide.util.ImageUtilities;
70
import org.openide.util.ImageUtilities;
(-)a/progress.ui/src/org/netbeans/modules/progress/ui/NbProgressBar.java (-3 / +3 lines)
Lines 47-55 Link Here
47
import javax.swing.JLabel;
47
import javax.swing.JLabel;
48
import javax.swing.JProgressBar;
48
import javax.swing.JProgressBar;
49
import javax.swing.UIManager;
49
import javax.swing.UIManager;
50
import org.netbeans.progress.spi.ExtractedProgressUIWorker;
50
import org.netbeans.modules.progress.spi.ExtractedProgressUIWorker;
51
import org.netbeans.progress.spi.InternalHandle;
51
import org.netbeans.modules.progress.spi.InternalHandle;
52
import org.netbeans.progress.spi.ProgressEvent;
52
import org.netbeans.modules.progress.spi.ProgressEvent;
53
53
54
54
55
/**
55
/**
(-)a/progress.ui/src/org/netbeans/modules/progress/ui/PopupPane.java (-1 / +1 lines)
Lines 61-67 Link Here
61
import javax.swing.JScrollPane;
61
import javax.swing.JScrollPane;
62
import javax.swing.KeyStroke;
62
import javax.swing.KeyStroke;
63
import javax.swing.border.Border;
63
import javax.swing.border.Border;
64
import org.netbeans.progress.spi.InternalHandle;
64
import org.netbeans.modules.progress.spi.InternalHandle;
65
65
66
/**
66
/**
67
 *
67
 *
(-)a/api.progress/src/org/netbeans/progress/module/ProgressListAction.java (-2 / +3 lines)
Lines 39-50 Link Here
39
 * made subject to such option by the copyright holder.
39
 * made subject to such option by the copyright holder.
40
 */
40
 */
41
41
42
package org.netbeans.progress.module;
42
package org.netbeans.modules.progress.ui;
43
43
44
import org.netbeans.modules.progress.spi.Controller;
44
import javax.swing.AbstractAction;
45
import javax.swing.AbstractAction;
45
import javax.swing.SwingUtilities;
46
import javax.swing.SwingUtilities;
46
import javax.swing.event.ListDataListener;
47
import javax.swing.event.ListDataListener;
47
import org.netbeans.progress.spi.ProgressUIWorkerWithModel;
48
import org.netbeans.modules.progress.spi.ProgressUIWorkerWithModel;
48
import org.openide.util.NbBundle;
49
import org.openide.util.NbBundle;
49
50
50
/**
51
/**
(-)a/progress.ui/src/org/netbeans/modules/progress/ui/ProviderImpl.java (-4 / +4 lines)
Lines 41-55 Link Here
41
41
42
package org.netbeans.modules.progress.ui;
42
package org.netbeans.modules.progress.ui;
43
43
44
import org.netbeans.progress.spi.ExtractedProgressUIWorker;
44
import org.netbeans.modules.progress.spi.ExtractedProgressUIWorker;
45
import org.netbeans.progress.spi.ProgressUIWorkerProvider;
45
import org.netbeans.modules.progress.spi.ProgressUIWorkerProvider;
46
import org.netbeans.progress.spi.ProgressUIWorkerWithModel;
46
import org.netbeans.modules.progress.spi.ProgressUIWorkerWithModel;
47
47
48
/**
48
/**
49
 *
49
 *
50
 * @author mkleint
50
 * @author mkleint
51
 */
51
 */
52
@org.openide.util.lookup.ServiceProvider(service=org.netbeans.progress.spi.ProgressUIWorkerProvider.class)
52
@org.openide.util.lookup.ServiceProvider(service=org.netbeans.modules.progress.spi.ProgressUIWorkerProvider.class)
53
public class ProviderImpl implements ProgressUIWorkerProvider {
53
public class ProviderImpl implements ProgressUIWorkerProvider {
54
    
54
    
55
    /** Creates a new instance of ProviderImpl */
55
    /** Creates a new instance of ProviderImpl */
(-)a/progress.ui/src/org/netbeans/modules/progress/ui/RunOffEDTImpl.java (-2 / +2 lines)
Lines 54-60 Link Here
54
import javax.swing.JFrame;
54
import javax.swing.JFrame;
55
import javax.swing.SwingUtilities;
55
import javax.swing.SwingUtilities;
56
import org.netbeans.api.progress.ProgressUtils;
56
import org.netbeans.api.progress.ProgressUtils;
57
import org.netbeans.progress.spi.RunOffEDTProvider;
57
import org.netbeans.modules.progress.spi.RunOffEDTProvider;
58
import org.openide.DialogDescriptor;
58
import org.openide.DialogDescriptor;
59
import org.openide.DialogDisplayer;
59
import org.openide.DialogDisplayer;
60
import org.openide.NotifyDescriptor;
60
import org.openide.NotifyDescriptor;
Lines 67-73 Link Here
67
 * Default RunOffEDTProvider implementation for ProgressUtils.runOffEventDispatchThread() methods
67
 * Default RunOffEDTProvider implementation for ProgressUtils.runOffEventDispatchThread() methods
68
 * @author Jan Lahoda, Tomas Holy
68
 * @author Jan Lahoda, Tomas Holy
69
 */
69
 */
70
@org.openide.util.lookup.ServiceProvider(service = org.netbeans.progress.spi.RunOffEDTProvider.class, position = 100)
70
@org.openide.util.lookup.ServiceProvider(service = org.netbeans.modules.progress.spi.RunOffEDTProvider.class, position = 100)
71
public class RunOffEDTImpl implements RunOffEDTProvider {
71
public class RunOffEDTImpl implements RunOffEDTProvider {
72
72
73
    private static final RequestProcessor WORKER = new RequestProcessor(ProgressUtils.class.getName());
73
    private static final RequestProcessor WORKER = new RequestProcessor(ProgressUtils.class.getName());
(-)a/progress.ui/src/org/netbeans/modules/progress/ui/StatusLineComponent.java (-5 / +4 lines)
Lines 85-95 Link Here
85
import javax.swing.event.ListDataListener;
85
import javax.swing.event.ListDataListener;
86
import javax.swing.event.ListSelectionEvent;
86
import javax.swing.event.ListSelectionEvent;
87
import javax.swing.event.ListSelectionListener;
87
import javax.swing.event.ListSelectionListener;
88
import org.netbeans.progress.spi.InternalHandle;
88
import org.netbeans.modules.progress.spi.InternalHandle;
89
import org.netbeans.progress.spi.ProgressEvent;
89
import org.netbeans.modules.progress.spi.ProgressEvent;
90
import org.netbeans.progress.module.ProgressListAction;
90
import org.netbeans.modules.progress.spi.ProgressUIWorkerWithModel;
91
import org.netbeans.progress.spi.ProgressUIWorkerWithModel;
91
import org.netbeans.modules.progress.spi.TaskModel;
92
import org.netbeans.progress.spi.TaskModel;
93
import org.openide.DialogDisplayer;
92
import org.openide.DialogDisplayer;
94
import org.openide.NotifyDescriptor;
93
import org.openide.NotifyDescriptor;
95
import org.openide.util.ImageUtilities;
94
import org.openide.util.ImageUtilities;
(-)a/progress.ui/src/org/netbeans/modules/progress/ui/layer.xml (-2 / +10 lines)
Lines 42-58 Link Here
42
-->
42
-->
43
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
43
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
44
<filesystem>
44
<filesystem>
45
    <folder name="Actions">
46
        <folder name="System">
47
            <file name="org-netbeans-progress-module-ui-CancelAction.instance"/>
48
        </folder>
49
        <folder name="Window">
50
            <file name="org-netbeans-progress-module-ui-ProgressListAction.instance"/>
51
        </folder>
52
    </folder>
45
    <folder name="Menu">
53
    <folder name="Menu">
46
        <folder name="Window">
54
        <folder name="Window">
47
            <file name="ProgressListAction.shadow">
55
            <file name="ProgressListAction.shadow">
48
                <attr name="originalFile" stringvalue="Actions/Window/org-netbeans-progress-module-ProgressListAction.instance"/>
56
                <attr name="originalFile" stringvalue="Actions/Window/org-netbeans-progress-module-ui-ProgressListAction.instance"/>
49
                <attr name="position" intvalue="1900"/>
57
                <attr name="position" intvalue="1900"/>
50
            </file>
58
            </file>
51
        </folder>
59
        </folder>
52
    </folder>
60
    </folder>
53
    <folder name="Shortcuts">
61
    <folder name="Shortcuts">
54
        <file name="DS-DELETE.shadow">
62
        <file name="DS-DELETE.shadow">
55
            <attr name="originalFile" stringvalue="Actions/System/org-netbeans-progress-module-CancelAction.instance"/>
63
            <attr name="originalFile" stringvalue="Actions/System/org-netbeans-progress-module-ui-CancelAction.instance"/>
56
        </file>
64
        </file>
57
    </folder>
65
    </folder>
58
</filesystem>
66
</filesystem>
(-)a/settings/manifest.mf (+1 lines)
Lines 3-6 Link Here
3
OpenIDE-Module-Layer: org/netbeans/modules/settings/resources/mf-layer.xml
3
OpenIDE-Module-Layer: org/netbeans/modules/settings/resources/mf-layer.xml
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/settings/resources/Bundle.properties
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/settings/resources/Bundle.properties
5
AutoUpdate-Essential-Module: true
5
AutoUpdate-Essential-Module: true
6
OpenIDE-Module-Specification-Version: 1.25
6
7
(-)a/settings/nbproject/project.properties (-1 lines)
Lines 44-47 Link Here
44
javadoc.apichanges=${basedir}/apichanges.xml
44
javadoc.apichanges=${basedir}/apichanges.xml
45
javadoc.arch=${basedir}/arch.xml
45
javadoc.arch=${basedir}/arch.xml
46
javadoc.main.page=org/netbeans/spi/settings/doc-files/api.html
46
javadoc.main.page=org/netbeans/spi/settings/doc-files/api.html
47
spec.version.base=1.24.0
(-)a/settings/nbproject/project.xml (-1 / +1 lines)
Lines 115-121 Link Here
115
                    <build-prerequisite/>
115
                    <build-prerequisite/>
116
                    <compile-dependency/>
116
                    <compile-dependency/>
117
                    <run-dependency>
117
                    <run-dependency>
118
                        <implementation-version/>
118
                        <specification-version>8.1</specification-version>
119
                    </run-dependency>
119
                    </run-dependency>
120
                </dependency>
120
                </dependency>
121
                <dependency>
121
                <dependency>
(-)a/settings/src/org/netbeans/modules/settings/RecognizeInstanceObjects.java (-2 / +7 lines)
Lines 34-40 Link Here
34
import java.util.Collection;
34
import java.util.Collection;
35
import java.util.Collections;
35
import java.util.Collections;
36
import java.util.logging.Logger;
36
import java.util.logging.Logger;
37
import org.netbeans.modules.openide.util.NamedServicesProvider;
38
import org.openide.filesystems.FileAttributeEvent;
37
import org.openide.filesystems.FileAttributeEvent;
39
import org.openide.filesystems.FileChangeListener;
38
import org.openide.filesystems.FileChangeListener;
40
import org.openide.filesystems.FileEvent;
39
import org.openide.filesystems.FileEvent;
Lines 50-61 Link Here
50
import org.openide.util.WeakListeners;
49
import org.openide.util.WeakListeners;
51
import org.openide.util.lookup.Lookups;
50
import org.openide.util.lookup.Lookups;
52
import org.openide.util.lookup.ProxyLookup;
51
import org.openide.util.lookup.ProxyLookup;
52
import org.openide.util.lookup.ServiceProvider;
53
import org.openide.util.lookup.implspi.NamedServicesProvider;
53
54
54
/** Use FolderLookup to find out intances of named services.
55
/** Use FolderLookup to find out intances of named services.
55
 *
56
 *
56
 * @author Jaroslav Tulach
57
 * @author Jaroslav Tulach
57
 */
58
 */
58
@org.openide.util.lookup.ServiceProvider(service=org.netbeans.modules.openide.util.NamedServicesProvider.class, position=200, supersedes="org.netbeans.modules.openide.filesystems.RecognizeInstanceFiles")
59
@ServiceProvider(
60
    service=NamedServicesProvider.class,
61
    position=200,
62
    supersedes="org.netbeans.modules.openide.filesystems.RecognizeInstanceFiles"
63
)
59
public final class RecognizeInstanceObjects extends NamedServicesProvider {
64
public final class RecognizeInstanceObjects extends NamedServicesProvider {
60
    private static final Logger LOG = Logger.getLogger(RecognizeInstanceObjects.class.getName());
65
    private static final Logger LOG = Logger.getLogger(RecognizeInstanceObjects.class.getName());
61
    
66
    

Return to bug 179289