1 19 20 package org.netbeans.bluej.options; 21 22 import java.beans.PropertyChangeListener ; 23 import java.io.File ; 24 import java.util.ArrayList ; 25 import java.util.List ; 26 import javax.swing.Icon ; 27 import javax.swing.ImageIcon ; 28 import javax.swing.JComponent ; 29 import org.netbeans.spi.options.OptionsPanelController; 30 import org.openide.util.HelpCtx; 31 import org.openide.util.Lookup; 32 import org.openide.util.NbBundle; 33 import org.openide.util.Utilities; 34 35 39 public class BluejAdvancedOption extends org.netbeans.spi.options.OptionsCategory { 40 41 42 public BluejAdvancedOption() { 43 } 44 45 public OptionsPanelController create() { 46 return new Controller(); 47 } 48 49 public String getCategoryName() { 50 return NbBundle.getBundle(BluejAdvancedOption.class).getString("AdvanceOption_title"); } 52 53 public String getTitle() { 54 return NbBundle.getBundle(BluejAdvancedOption.class).getString("AdvancedOption_tooltip"); } 56 57 public Icon getIcon() { 58 return new ImageIcon (Utilities.loadImage("org/netbeans/bluej/options/Category.png")); } 60 61 62 static class Controller extends OptionsPanelController { 63 private List listeners = new ArrayList (); 64 private BlueJPanel panel; 65 66 public void update() { 67 File fil = BlueJSettings.getDefault().getHome(); 68 getPanel().setBlueJHome(fil != null ? fil.getAbsolutePath() : ""); } 70 71 public void applyChanges() { 72 String str = getPanel().getBlueJHome().trim(); 73 File fil = null; 74 if (str.length() > 0) { 75 fil = new File (str); 76 } 77 BlueJSettings.getDefault().setHome(fil); 78 } 79 80 public void cancel() { 81 } 82 83 public boolean isValid() { 84 return getPanel().isValidData(); 85 } 86 87 public boolean isChanged() { 88 return getPanel().isChangedData(); 89 } 90 91 public JComponent getComponent(Lookup masterLookup) { 92 return getPanel(); 93 } 94 95 public HelpCtx getHelpCtx() { 96 return HelpCtx.DEFAULT_HELP; 97 } 98 99 public void addPropertyChangeListener(PropertyChangeListener l) { 100 listeners.add(l); 101 } 102 103 public void removePropertyChangeListener(PropertyChangeListener l) { 104 listeners.remove(l); 105 } 106 107 private BlueJPanel getPanel() { 108 if(panel == null) { 109 panel = new BlueJPanel(); 110 } 111 return panel; 112 } 113 114 } 115 } 116 | Popular Tags |