More correct use of ExplorerUtils.
1.1 --- a/modulemanager/src/org/netbeans/modules/modulemanager/ModuleSelectionPanel.form Tue Oct 11 10:45:01 2011 -0400
1.2 +++ b/modulemanager/src/org/netbeans/modules/modulemanager/ModuleSelectionPanel.form Tue Oct 11 11:03:32 2011 -0400
1.3 @@ -1,13 +1,17 @@
1.4 <?xml version="1.0" encoding="UTF-8" ?>
1.5
1.6 -<Form version="1.0" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
1.7 +<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
1.8 <Properties>
1.9 <Property name="name" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
1.10 <ResourceString bundle="org/netbeans/modules/modulemanager/Bundle.properties" key="LBL_ModuleSelectionPanel_Name" replaceFormat="NbBundle.getMessage(ModuleSelectionPanel.class, "{key}")"/>
1.11 </Property>
1.12 </Properties>
1.13 <AuxValues>
1.14 + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
1.15 + <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
1.16 + <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
1.17 <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
1.18 + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
1.19 <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
1.20 <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
1.21 <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
2.1 --- a/modulemanager/src/org/netbeans/modules/modulemanager/ModuleSelectionPanel.java Tue Oct 11 10:45:01 2011 -0400
2.2 +++ b/modulemanager/src/org/netbeans/modules/modulemanager/ModuleSelectionPanel.java Tue Oct 11 11:03:32 2011 -0400
2.3 @@ -41,7 +41,6 @@
2.4
2.5 package org.netbeans.modules.modulemanager;
2.6
2.7 -import java.awt.BorderLayout;
2.8 import java.awt.Cursor;
2.9 import java.awt.Dialog;
2.10 import java.awt.Dimension;
2.11 @@ -54,7 +53,10 @@
2.12 import java.util.logging.Level;
2.13 import java.util.logging.Logger;
2.14 import javax.swing.ActionMap;
2.15 +import javax.swing.InputMap;
2.16 +import javax.swing.JComponent;
2.17 import javax.swing.JScrollPane;
2.18 +import javax.swing.KeyStroke;
2.19 import javax.swing.SwingUtilities;
2.20 import javax.swing.UIManager;
2.21 import javax.swing.border.Border;
2.22 @@ -73,9 +75,9 @@
2.23 import org.openide.nodes.Node;
2.24 import org.openide.nodes.PropertySupport;
2.25 import org.openide.util.AsyncGUIJob;
2.26 +import org.openide.util.Lookup;
2.27 import org.openide.util.NbBundle;
2.28 import org.openide.util.Utilities;
2.29 -import org.openide.windows.TopComponent;
2.30 import org.openide.xml.XMLUtil;
2.31
2.32 /** Module selection panel allows user to enable/disable modules in Module Catalog
2.33 @@ -83,7 +85,7 @@
2.34 * @author cledantec, jrojcek, Jesse Glick, Jirka Rechtacek (jrechtacek@netbeans.org)
2.35 */
2.36 public class ModuleSelectionPanel extends javax.swing.JPanel
2.37 - implements PropertyChangeListener {
2.38 + implements PropertyChangeListener, ExplorerManager.Provider, Lookup.Provider {
2.39
2.40 private TreeTableView treeTableView;
2.41 private static final Logger err = Logger.getLogger(ModuleSelectionPanel.class.getName ());
2.42 @@ -93,9 +95,9 @@
2.43 private static final int DEF_0_COL_WIDTH = 60;
2.44 private static final int DEF_1_COL_WIDTH = 150;
2.45 private static final int DEF_HEIGHT = 350;
2.46 -
2.47 - private static ModuleDeleter deleter;
2.48 -
2.49 +
2.50 + private final ExplorerManager manager;
2.51 + private final Lookup lookup;
2.52 private Cursor cursor = null;
2.53 static private ModuleSelectionPanel panel = null;
2.54
2.55 @@ -108,18 +110,20 @@
2.56 }
2.57
2.58 private ModuleSelectionPanel () {
2.59 + manager = new ExplorerManager();
2.60 + ActionMap map = getActionMap();
2.61 + map.put("delete", ExplorerUtils.actionDelete(manager, false));
2.62 + InputMap keys = getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
2.63 + keys.put(KeyStroke.getKeyStroke("DELETE"), "delete");
2.64 + lookup = ExplorerUtils.createLookup(manager, map);
2.65 initComponents();
2.66 treeTableView = new TreeTableView ();
2.67 treeTableView.setRootVisible(false);
2.68 - ExplorerPanel explorerPanel = new ExplorerPanel ();
2.69 - explorerPanel.getAccessibleContext ().setAccessibleName (
2.70 + getAccessibleContext().setAccessibleName(
2.71 NbBundle.getBundle (ModuleSelectionPanel.class).getString ("ACN_ModuleSelectionPanel_ExplorerPanel")); // NOI18N
2.72 - explorerPanel.getAccessibleContext ().setAccessibleDescription (
2.73 + getAccessibleContext().setAccessibleDescription(
2.74 NbBundle.getBundle (ModuleSelectionPanel.class).getString ("ACD_ModuleSelectionPanel_ExplorerPanel")); // NOI18N
2.75 - explorerPanel.setLayout (new BorderLayout ());
2.76 - explorerPanel.add (treeTableView, BorderLayout.CENTER);
2.77 - modulesPane.add (explorerPanel, BorderLayout.CENTER);
2.78 - manager = explorerPanel.getExplorerManager();
2.79 + modulesPane.add(treeTableView);
2.80
2.81 //Fix for NPE on WinXP L&F - either may be null - Tim
2.82 Font f = UIManager.getFont("controlFont"); // NOI18N
2.83 @@ -432,32 +436,23 @@
2.84 private javax.swing.JButton uninstallButton;
2.85 // End of variables declaration//GEN-END:variables
2.86
2.87 - private ExplorerManager manager;
2.88 -
2.89 - private static class ExplorerPanel extends TopComponent implements ExplorerManager.Provider {
2.90 - private ExplorerManager mgr;
2.91 - public ExplorerPanel () {
2.92 - this.mgr = new ExplorerManager ();
2.93 - ActionMap map = this.getActionMap ();
2.94 - map.put ("delete", ExplorerUtils.actionDelete(mgr, false));
2.95 - associateLookup (ExplorerUtils.createLookup (mgr, map));
2.96 - }
2.97 -
2.98 - public ExplorerManager getExplorerManager () {
2.99 - return mgr;
2.100 - }
2.101 -
2.102 - @Override
2.103 - protected void componentActivated() {
2.104 - ExplorerUtils.activateActions (mgr, true);
2.105 - }
2.106 -
2.107 - @Override
2.108 - protected void componentDeactivated() {
2.109 - ExplorerUtils.activateActions (mgr, false);
2.110 - }
2.111 + @Override public void addNotify() {
2.112 + super.addNotify();
2.113 + ExplorerUtils.activateActions(manager, true);
2.114 }
2.115 -
2.116 +
2.117 + @Override public void removeNotify() {
2.118 + super.removeNotify();
2.119 + ExplorerUtils.activateActions(manager, false);
2.120 + }
2.121 +
2.122 + @Override public ExplorerManager getExplorerManager() {
2.123 + return manager;
2.124 + }
2.125 + @Override public Lookup getLookup() {
2.126 + return lookup;
2.127 + }
2.128 +
2.129 /** Handling of property changes in node structure
2.130 */
2.131 public void propertyChange(PropertyChangeEvent evt) {