1 19 package org.netbeans.modules.ruby.rubyproject; 20 21 import java.beans.PropertyChangeListener ; 22 23 import javax.swing.JComponent ; 24 import org.netbeans.modules.ruby.rubyproject.api.RubyInstallation; 25 26 import org.netbeans.spi.options.AdvancedOption; 27 import org.netbeans.spi.options.OptionsPanelController; 28 import org.openide.util.HelpCtx; 29 import org.openide.util.Lookup; 30 import org.openide.util.Mutex; 31 import org.openide.util.NbBundle; 32 33 34 39 public class RubyOptionsAdvancedPanel extends AdvancedOption { 40 public String getTooltip() { 41 return getDisplayName(); 42 } 43 44 public String getDisplayName() { 45 return NbBundle.getMessage(RubyOptionsAdvancedPanel.class, "LBL_OptionsPanelName"); 46 } 47 48 public OptionsPanelController create() { 49 return new Controller(); 50 } 51 52 private static final class Controller extends OptionsPanelController { 53 private RubyHomeOptionsPanel component; 54 55 public JComponent getComponent(Lookup masterLookup) { 56 if (component == null) { 57 component = new RubyHomeOptionsPanel(); 58 } 59 60 return component; 61 } 62 63 public void removePropertyChangeListener(PropertyChangeListener l) { 64 } 65 66 public void addPropertyChangeListener(PropertyChangeListener l) { 67 } 68 69 public void update() { 70 Mutex.EVENT.readAccess(new Runnable () { 71 public void run() { 72 component.setRuby(RubyInstallation.getInstance().getRuby()); 73 component.setRake(RubyInstallation.getInstance().getRake()); 74 component.setRDoc(RubyInstallation.getInstance().getRDoc()); 75 component.setRails(RubyInstallation.getInstance().getRails()); 76 } 77 }); 78 } 79 80 public boolean isValid() { 81 return true; 82 } 83 84 public boolean isChanged() { 85 return false; 86 } 87 88 public HelpCtx getHelpCtx() { 89 return HelpCtx.DEFAULT_HELP; 90 } 91 92 public void cancel() { 93 } 94 95 public void applyChanges() { 96 Mutex.EVENT.readAccess(new Runnable () { 97 public void run() { 98 RubyInstallation config = RubyInstallation.getInstance(); 99 config.setRuby(component.getRuby()); 100 config.setRake(component.getRake()); 101 config.setRDoc(component.getRDoc()); 102 config.setRails(component.getRails()); 103 } 104 }); 105 } 106 } 107 } 108 | Popular Tags |