jdk/src/share/classes/sun/tools/jconsole/VMPanel.java
changeset 19432 ce3b6c1ab8a6
parent 18253 4323a5fe8bc4
child 19568 873477c7e278
equal deleted inserted replaced
19431:254c78d54bd9 19432:ce3b6c1ab8a6
     1 /*
     1 /*
     2  * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    69     //
    69     //
    70     private boolean initialUpdate = true;
    70     private boolean initialUpdate = true;
    71 
    71 
    72     // Each VMPanel has its own instance of the JConsolePlugin
    72     // Each VMPanel has its own instance of the JConsolePlugin
    73     // A map of JConsolePlugin to the previous SwingWorker
    73     // A map of JConsolePlugin to the previous SwingWorker
    74     private Map<JConsolePlugin, SwingWorker<?, ?>> plugins = null;
    74     private Map<ExceptionSafePlugin, SwingWorker<?, ?>> plugins = null;
    75     private boolean pluginTabsAdded = false;
    75     private boolean pluginTabsAdded = false;
    76 
    76 
    77     // Update these only on the EDT
    77     // Update these only on the EDT
    78     private JOptionPane optionPane;
    78     private JOptionPane optionPane;
    79     private JProgressBar progressBar;
    79     private JProgressBar progressBar;
   105             if (tabInfo.tabVisible) {
   105             if (tabInfo.tabVisible) {
   106                 addTab(tabInfo);
   106                 addTab(tabInfo);
   107             }
   107             }
   108         }
   108         }
   109 
   109 
   110         plugins = new LinkedHashMap<JConsolePlugin, SwingWorker<?, ?>>();
   110         plugins = new LinkedHashMap<ExceptionSafePlugin, SwingWorker<?, ?>>();
   111         for (JConsolePlugin p : JConsole.getPlugins()) {
   111         for (JConsolePlugin p : JConsole.getPlugins()) {
   112             p.setContext(proxyClient);
   112             p.setContext(proxyClient);
   113             plugins.put(p, null);
   113             plugins.put(new ExceptionSafePlugin(p), null);
   114         }
   114         }
   115 
   115 
   116         Utilities.updateTransparency(this);
   116         Utilities.updateTransparency(this);
   117 
   117 
   118         ToolTipManager.sharedInstance().registerComponent(this);
   118         ToolTipManager.sharedInstance().registerComponent(this);
   564                     }
   564                     }
   565                 }
   565                 }
   566             }
   566             }
   567 
   567 
   568             // plugin GUI update
   568             // plugin GUI update
   569             for (JConsolePlugin p : plugins.keySet()) {
   569             for (ExceptionSafePlugin p : plugins.keySet()) {
   570                 SwingWorker<?, ?> sw = p.newSwingWorker();
   570                 SwingWorker<?, ?> sw = p.newSwingWorker();
   571                 SwingWorker<?, ?> prevSW = plugins.get(p);
   571                 SwingWorker<?, ?> prevSW = plugins.get(p);
   572                 // schedule SwingWorker to run only if the previous
   572                 // schedule SwingWorker to run only if the previous
   573                 // SwingWorker has finished its task and it hasn't started.
   573                 // SwingWorker has finished its task and it hasn't started.
   574                 if (prevSW == null || prevSW.isDone()) {
   574                 if (prevSW == null || prevSW.isDone()) {
   575                     if (sw == null || sw.getState() == SwingWorker.StateValue.PENDING) {
   575                     if (sw == null || sw.getState() == SwingWorker.StateValue.PENDING) {
   576                         plugins.put(p, sw);
   576                         plugins.put(p, sw);
   577                         if (sw != null) {
   577                         if (sw != null) {
   578                             sw.execute();
   578                             p.executeSwingWorker(sw);
   579                         }
   579                         }
   580                     }
   580                     }
   581                 }
   581                 }
   582             }
   582             }
   583 
   583