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

Collapse All | Expand All

(-)a/spi.debugger.ui/manifest.mf (-1 lines)
 Lines 2-7    Link Here 
2
OpenIDE-Module: org.netbeans.spi.debugger.ui/1
2
OpenIDE-Module: org.netbeans.spi.debugger.ui/1
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/debugger/ui/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/debugger/ui/Bundle.properties
4
OpenIDE-Module-Layer: org/netbeans/modules/debugger/resources/mf-layer.xml
4
OpenIDE-Module-Layer: org/netbeans/modules/debugger/resources/mf-layer.xml
5
OpenIDE-Module-Specification-Version: 2.44
6
OpenIDE-Module-Provides: org.netbeans.spi.debugger.ui
5
OpenIDE-Module-Provides: org.netbeans.spi.debugger.ui
7
OpenIDE-Module-Install: org/netbeans/modules/debugger/ui/DebuggerModule.class
6
OpenIDE-Module-Install: org/netbeans/modules/debugger/ui/DebuggerModule.class
(-)a/spi.debugger.ui/nbproject/project.properties (+1 lines)
 Lines 44-49    Link Here 
44
javac.compilerargs=-Xlint -Xlint:-serial
44
javac.compilerargs=-Xlint -Xlint:-serial
45
javac.source=1.6
45
javac.source=1.6
46
javadoc.arch=${basedir}/arch.xml
46
javadoc.arch=${basedir}/arch.xml
47
spec.version.base=2.44.0
47
48
48
test.config.stableBTD.includes=**/*Test.class
49
test.config.stableBTD.includes=**/*Test.class
49
test.config.stableBTD.excludes=\
50
test.config.stableBTD.excludes=\
(-)a/spi.debugger.ui/nbproject/project.xml (-1 / +2 lines)
 Lines 109-115    Link Here 
109
                    <compile-dependency/>
109
                    <compile-dependency/>
110
                    <run-dependency>
110
                    <run-dependency>
111
                        <release-version>1</release-version>
111
                        <release-version>1</release-version>
112
                        <specification-version>1.24</specification-version>
112
                        <!-- <specification-version>1.24</specification-version> -->
113
                        <implementation-version></implementation-version>
113
                    </run-dependency>
114
                    </run-dependency>
114
                </dependency>
115
                </dependency>
115
                <dependency>
116
                <dependency>
(-)a/spi.debugger.ui/src/org/netbeans/modules/debugger/ui/actions/DebugMainProjectAction.java (-2 / +110 lines)
 Lines 52-57    Link Here 
52
import java.beans.PropertyChangeListener;
52
import java.beans.PropertyChangeListener;
53
import java.lang.reflect.InvocationTargetException;
53
import java.lang.reflect.InvocationTargetException;
54
import java.lang.reflect.Method;
54
import java.lang.reflect.Method;
55
import java.util.LinkedList;
55
import java.util.List;
56
import java.util.List;
56
import javax.swing.Action;
57
import javax.swing.Action;
57
import javax.swing.ImageIcon;
58
import javax.swing.ImageIcon;
 Lines 61-75    Link Here 
61
import javax.swing.JPopupMenu;
62
import javax.swing.JPopupMenu;
62
import javax.swing.JSeparator;
63
import javax.swing.JSeparator;
63
import javax.swing.SwingUtilities;
64
import javax.swing.SwingUtilities;
65
import javax.swing.event.ChangeEvent;
66
import javax.swing.event.ChangeListener;
64
import javax.swing.event.PopupMenuEvent;
67
import javax.swing.event.PopupMenuEvent;
65
import javax.swing.event.PopupMenuListener;
68
import javax.swing.event.PopupMenuListener;
66
import org.netbeans.api.debugger.DebuggerManager;
69
import org.netbeans.api.debugger.DebuggerManager;
67
import org.netbeans.api.debugger.Properties;
70
import org.netbeans.api.debugger.Properties;
68
import org.netbeans.api.project.Project;
71
import org.netbeans.api.project.Project;
69
import org.netbeans.api.project.ui.OpenProjects;
72
import org.netbeans.api.project.ui.OpenProjects;
73
import org.netbeans.modules.project.uiapi.BuildExecutionSupportImplementation;
74
import org.netbeans.modules.project.uiapi.Utilities;
70
import org.netbeans.spi.debugger.ui.AttachType;
75
import org.netbeans.spi.debugger.ui.AttachType;
71
import org.netbeans.spi.debugger.ui.Controller;
76
import org.netbeans.spi.debugger.ui.Controller;
72
import org.netbeans.spi.project.ActionProvider;
77
import org.netbeans.spi.project.ActionProvider;
78
import org.netbeans.spi.project.ui.support.BuildExecutionSupport;
73
import org.netbeans.spi.project.ui.support.MainProjectSensitiveActions;
79
import org.netbeans.spi.project.ui.support.MainProjectSensitiveActions;
74
import org.openide.awt.Actions;
80
import org.openide.awt.Actions;
75
import org.openide.awt.DropDownButtonFactory;
81
import org.openide.awt.DropDownButtonFactory;
 Lines 78-83    Link Here 
78
import org.openide.util.ImageUtilities;
84
import org.openide.util.ImageUtilities;
79
import org.openide.util.NbBundle;
85
import org.openide.util.NbBundle;
80
import org.openide.util.RequestProcessor;
86
import org.openide.util.RequestProcessor;
87
import org.openide.util.WeakListeners;
81
import org.openide.util.WeakSet;
88
import org.openide.util.WeakSet;
82
import org.openide.util.actions.Presenter;
89
import org.openide.util.actions.Presenter;
83
90
 Lines 89-96    Link Here 
89
96
90
    private static WeakSet<AttachHistorySupport> ahs = null;
97
    private static WeakSet<AttachHistorySupport> ahs = null;
91
    
98
    
92
    private Action delegate;
99
    private final Action delegate;
93
    private AttachHistorySupport attachHistorySupport;
100
    private final DebugHistorySupport debugHistorySupport;
101
    private final AttachHistorySupport attachHistorySupport;
94
    
102
    
95
    /** Creates a new instance of DebugMainProjectAction */
103
    /** Creates a new instance of DebugMainProjectAction */
96
    public DebugMainProjectAction() {
104
    public DebugMainProjectAction() {
 Lines 98-103    Link Here 
98
                ActionProvider.COMMAND_DEBUG,
106
                ActionProvider.COMMAND_DEBUG,
99
                NbBundle.getMessage(DebugMainProjectAction.class, "LBL_DebugMainProjectAction_Name" ),ImageUtilities.loadImageIcon("org/netbeans/modules/debugger/resources/debugProject.png", false)); // NOI18N
107
                NbBundle.getMessage(DebugMainProjectAction.class, "LBL_DebugMainProjectAction_Name" ),ImageUtilities.loadImageIcon("org/netbeans/modules/debugger/resources/debugProject.png", false)); // NOI18N
100
        delegate.putValue("iconBase","org/netbeans/modules/debugger/resources/debugProject.png"); //NOI18N
108
        delegate.putValue("iconBase","org/netbeans/modules/debugger/resources/debugProject.png"); //NOI18N
109
        //BuildExecutionSupport.registerFinishedItem(null);
110
        //Utilities.getBuildExecutionSupportImplementation().getRunningItems();
111
        debugHistorySupport = new DebugHistorySupport();
101
        attachHistorySupport = new AttachHistorySupport();
112
        attachHistorySupport = new AttachHistorySupport();
102
    }
113
    }
103
    
114
    
 Lines 188-193    Link Here 
188
199
189
    @Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
200
    @Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
190
        JPopupMenu menu = (JPopupMenu)e.getSource();
201
        JPopupMenu menu = (JPopupMenu)e.getSource();
202
        debugHistorySupport.init(menu);
191
        attachHistorySupport.init(menu);
203
        attachHistorySupport.init(menu);
192
        menu.removePopupMenuListener(this);
204
        menu.removePopupMenuListener(this);
193
    }
205
    }
 Lines 199-204    Link Here 
199
    }
211
    }
200
212
201
    // AttachHistorySupport .....................................................
213
    // AttachHistorySupport .....................................................
214
    
215
    private static class DebugHistorySupport implements ActionListener, ChangeListener {
216
        
217
        private JPopupMenu menu;
218
        private JMenuItem[] items = new JMenuItem[0];
219
        private final JSeparator separator1 = new JPopupMenu.Separator();
220
        private final JSeparator separator2 = new JPopupMenu.Separator();
221
        private final BuildExecutionSupportImplementation besi;
222
        private final LinkedList<BuildExecutionSupport.ActionItem> debugItems = new LinkedList<BuildExecutionSupport.ActionItem>();
223
        
224
        private static final String DEBUG_ACTION_ITEM_PROP_NAME = "debug action item";
225
        private static final RequestProcessor RP = new RequestProcessor(DebugHistorySupport.class.getName());
226
        
227
        public DebugHistorySupport() {
228
            besi = Utilities.getBuildExecutionSupportImplementation();
229
            besi.addChangeListener(WeakListeners.change(this, besi));
230
        }
231
        
232
        void init(JPopupMenu menu) {
233
            this.menu = menu;
234
            computeItems();
235
        }
236
        
237
        private void computeItems() {
238
            boolean wasSeparator = items.length > 0;
239
            for (int i = 0; i < items.length; i++) {
240
                menu.remove(items[i]);
241
            }
242
            synchronized (debugItems) {
243
                if (debugItems.isEmpty()) {
244
                    items = new JMenuItem[0];
245
                } else {
246
                    int n = debugItems.size();
247
                    items = new JMenuItem[n];
248
                    int i = 0;
249
                    for (BuildExecutionSupport.ActionItem ai : debugItems) {
250
                        String dispName = ai.getDisplayName();
251
                        items[i] = new JMenuItem(dispName);
252
                        items[i].putClientProperty(DEBUG_ACTION_ITEM_PROP_NAME, ai);
253
                        items[i].addActionListener(this);
254
                        i++;
255
                    }
256
                }
257
            }
258
            if (items.length == 0) {
259
                if (wasSeparator) {
260
                    menu.remove(separator1);
261
                    menu.remove(separator2);
262
                }
263
            } else {
264
                if (!wasSeparator) {
265
                    menu.insert(separator1, 1);
266
                }
267
                int i;
268
                for (i = 0; i < items.length; i++) {
269
                    menu.insert(items[i], i + 2);
270
                }
271
                menu.insert(separator2, i + 2);
272
            }
273
        }
274
275
        @Override
276
        public void actionPerformed(ActionEvent e) {
277
            JMenuItem item = (JMenuItem)e.getSource();
278
            final BuildExecutionSupport.ActionItem ai =
279
                    (BuildExecutionSupport.ActionItem) item.getClientProperty(DEBUG_ACTION_ITEM_PROP_NAME);
280
            RP.post(new Runnable() {
281
                @Override
282
                public void run() {
283
                    ai.repeatExecution();
284
                }
285
            });
286
        }
287
288
        @Override
289
        public void stateChanged(ChangeEvent e) {
290
            BuildExecutionSupport.Item lastItem = besi.getLastItem();
291
            if (lastItem instanceof BuildExecutionSupport.ActionItem) {
292
                BuildExecutionSupport.ActionItem ai = (BuildExecutionSupport.ActionItem) lastItem;
293
                String action = ai.getAction();
294
                if (ActionProvider.COMMAND_DEBUG.equals(action)) { // Track debug items only
295
                    boolean changed = false;
296
                    synchronized (debugItems) {
297
                        if (debugItems.isEmpty() || ai != debugItems.getFirst()) {
298
                            debugItems.remove(ai); // Remove it if it's there
299
                            debugItems.addFirst(ai);
300
                            changed = true;
301
                        }
302
                    }
303
                    if (changed) {
304
                        computeItems();
305
                    }
306
                }
307
            }
308
        }
309
    }
202
310
203
    static class AttachHistorySupport implements ActionListener {
311
    static class AttachHistorySupport implements ActionListener {
204
312

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