Beispiel #1
0
 public boolean getEngineEnabled(EngineDescriptor desc) {
   IPreferenceStore store = getPreferenceStore();
   String key = getMasterKey(desc.getId());
   if (store.contains(key)) return store.getBoolean(key);
   store.setValue(key, desc.isEnabled());
   return desc.isEnabled();
 }
  /**
   * Create a new instance of the receiver.
   *
   * @param title The displayable name of the action.
   * @param preferenceStore The preference store to propogate changes to
   * @param property The property that is being updated
   * @throws IllegalArgumentException Thrown if preferenceStore or property are <code>null</code>.
   */
  public BooleanPropertyAction(String title, IPreferenceStore preferenceStore, String property)
      throws IllegalArgumentException {
    super(title, AS_CHECK_BOX);

    if (preferenceStore == null || property == null) {
      throw new IllegalArgumentException();
    }

    this.preferenceStore = preferenceStore;
    this.property = property;
    final String finalProprety = property;

    preferenceStore.addPropertyChangeListener(
        new IPropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent event) {
            if (finalProprety.equals(event.getProperty())) {
              setChecked(Boolean.TRUE.equals(event.getNewValue()));
            }
          }
        });

    setChecked(preferenceStore.getBoolean(property));
  }
 protected void initializeValues() {
   IPreferenceStore store = getPreferenceStore();
   mSaveBeforeLoad = store.getBoolean(SAVE_BEFORE_LOAD);
   mSurroundWithBegin = store.getBoolean(SURROUND_WITH_BEGIN);
 }