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

(-)DialogVisualizerWrapper.java (-6 / +66 lines)
Lines 13-19 Link Here
13
13
14
package org.netbeans.modules.vcscore.commands;
14
package org.netbeans.modules.vcscore.commands;
15
15
16
import java.awt.AWTEvent;
17
import java.awt.EventQueue;
18
import java.awt.Toolkit;
16
import java.awt.event.ActionListener;
19
import java.awt.event.ActionListener;
20
import java.awt.event.InvocationEvent;
21
import java.util.Iterator;
17
22
18
import org.netbeans.api.vcs.commands.CommandTask;
23
import org.netbeans.api.vcs.commands.CommandTask;
19
24
Lines 246-257 Link Here
246
        return null;
251
        return null;
247
    }
252
    }
248
    
253
    
249
    /**
254
    private WrapperQueue wrapperQueue;
250
     * @param args the command line arguments
255
    
251
     *
256
    public void show() {
252
    public static void main(String args[]) {
257
        controlThePump();
253
        new DialogVisualizerWrapper(new javax.swing.JFrame(), true).show();
258
        super.show();
259
    }
260
    
261
    public void dispose() {
262
        wrapperQueue.release();
263
    }
264
    
265
    private void controlThePump() {
266
        EventQueue queue = Toolkit.getDefaultToolkit().getSystemEventQueue();
267
        //System.out.println("controlThePump(): queue = "+queue);
268
        this.wrapperQueue = new WrapperQueue();
269
        queue.push(wrapperQueue);
270
    }
271
    
272
    private class WrapperQueue extends EventQueue implements Runnable {
273
        
274
        private java.util.List ignoredEvents = new java.util.ArrayList();
275
        
276
        protected void dispatchEvent(AWTEvent theEvent) {
277
            if (ignore(theEvent)) {
278
                synchronized (ignoredEvents) {
279
                    ignoredEvents.add(theEvent);
280
                }
281
            } else {
282
                super.dispatchEvent(theEvent);
283
            }
284
        }
285
        
286
        public void release() {
287
            pop();
288
            javax.swing.SwingUtilities.invokeLater(this);
289
        }
290
        
291
        public void run() {
292
            EventQueue queue = Toolkit.getDefaultToolkit().getSystemEventQueue();
293
            for (Iterator it = ignoredEvents.iterator(); it.hasNext(); ) {
294
                AWTEvent event = (AWTEvent) it.next();
295
                queue.postEvent(event);
296
                //System.out.println("POST Event: "+event);
297
            }
298
        }
299
        
300
        private boolean ignore(AWTEvent event) {
301
            //System.out.println("HAVE Event: "+event);
302
            if (event instanceof InvocationEvent) {
303
                InvocationEvent ie = (InvocationEvent) event;
304
                String ids = ie.paramString();
305
                if (ids.indexOf("javax.swing") >= 0 || ids.indexOf("java.awt") >= 0 ||
306
                        ids.indexOf("DialogVisualizerWrapper") >= 0) {
307
                    return false;
308
                } else {
309
                    //System.out.println("IGNORED Event: "+event);
310
                    return true;
311
                }
312
            }
313
            return false;
314
        }
254
    }
315
    }
255
     */
256
    
316
    
257
}
317
}

Return to bug 57855