1 19 20 package org.netbeans.modules.autoupdate.catalog; 21 22 import java.awt.BorderLayout ; 23 import java.awt.Component ; 24 import java.awt.Font ; 25 import java.util.HashSet ; 26 import java.util.Iterator ; 27 import java.util.List ; 28 import java.util.Set ; 29 import java.util.SortedSet ; 30 import java.util.TreeSet ; 31 import javax.swing.*; 32 33 import org.netbeans.Module; 34 import org.netbeans.ModuleManager; 35 import org.openide.util.NbBundle; 36 37 41 class ModuleEnableDisablePanel extends JPanel { 42 Set explicit; 43 Set modules; 44 private boolean toEnable; 45 46 public ModuleEnableDisablePanel (boolean enable, Set explicit, Set implied) { 47 this.explicit = explicit; 48 this.modules = implied; 49 this.toEnable = enable; 50 initComponents (); 51 postInitComponents (); 52 } 53 54 private void initComponents() { jPanel1 = new javax.swing.JPanel (); 56 enableDisableConfirmation = new javax.swing.JLabel (); 57 58 setLayout(new java.awt.BorderLayout (0, 2)); 59 60 add(jPanel1, java.awt.BorderLayout.CENTER); 61 62 enableDisableConfirmation.setText(org.openide.util.NbBundle.getMessage(ModuleEnableDisablePanel.class, "LBL_ModuleEnableDisablePanel_EnableConfirmation", new Object [] {})); 63 add(enableDisableConfirmation, java.awt.BorderLayout.SOUTH); 64 65 } 67 68 private javax.swing.JLabel enableDisableConfirmation; 70 private javax.swing.JPanel jPanel1; 71 73 private String getModuleNames () { 74 return explicit.size () == 1 ? ((Module) explicit.iterator ().next ()).getDisplayName () : 75 NbBundle.getMessage (ModuleUninstallPanel.class, "CTL_ModuleNodeActions_UninstallAction_many"); } 77 78 private void postInitComponents () { 79 80 String enableDisableText; 81 82 if (toEnable) { 83 enableDisableText = NbBundle.getMessage(ModuleEnableDisablePanel.class, "LBL_ModuleEnableDisablePanel_EnableLabel", new Object [] {getModuleNames ()}); 84 enableDisableConfirmation.setText(org.openide.util.NbBundle.getMessage(ModuleEnableDisablePanel.class, "LBL_ModuleEnableDisablePanel_EnableConfirmation", new Object [] {})); 85 } else { 86 enableDisableText = NbBundle.getMessage(ModuleEnableDisablePanel.class, "LBL_ModuleEnableDisablePanel_DisableLabel", new Object [] {getModuleNames ()}); 87 enableDisableConfirmation.setText(org.openide.util.NbBundle.getMessage(ModuleEnableDisablePanel.class, "LBL_ModuleEnableDisablePanel_DisableConfirmation", new Object [] {})); 88 } 89 90 Component c = new ModulesAndDescription ((Module []) modules.toArray (new Module [modules.size ()]), enableDisableText); 91 add (c, BorderLayout.CENTER); 92 } 93 94 } 95 | Popular Tags |