Example usage for org.eclipse.jface.preference FieldEditor VALUE

List of usage examples for org.eclipse.jface.preference FieldEditor VALUE

Introduction

In this page you can find the example usage for org.eclipse.jface.preference FieldEditor VALUE.

Prototype

String VALUE

To view the source code for org.eclipse.jface.preference FieldEditor VALUE.

Click Source Link

Document

Property name constant (value "field_editor_value") to signal a change in the value of this field editor.

Usage

From source file:ch.qos.logback.beagle.preferences.BeaglePreferencesPage.java

License:Open Source License

public void propertyChange(PropertyChangeEvent event) {
    super.propertyChange(event);
    if (FieldEditor.VALUE.equals(event.getProperty())) {
        if (event.getSource() == bufferSizeEditor) {
            checkState();/*  ww w.  jav  a2 s .  c o m*/
        }
    }
}

From source file:com.ca.casd.lisa.plugins.odataassistant.preferences.OdataAssistantPreferencePage.java

License:Open Source License

public void propertyChange(PropertyChangeEvent event) {
    super.propertyChange(event);
    if (event.getProperty().equals(FieldEditor.VALUE)) {
        checkState();/*from w ww  .  j  ava  2 s .c o  m*/
    }

    if (event.getSource() instanceof BooleanFieldEditor) {
        BooleanFieldEditor booleanEditor = (BooleanFieldEditor) event.getSource();
        if (booleanEditor.getPreferenceName().equals(PreferenceConstants.P_ENABLE_POPULATE_TRANSACTIONS))
            fieldMaxNumberEditor.setEnabled(booleanEditor.getBooleanValue(), getFieldEditorParent());
    }

}

From source file:com.dnw.depmap.preferences.RootPreferenePage.java

License:Open Source License

/**
 * The field editor preference page implementation of this <code>IPreferencePage</code> (and
 * <code>IPropertyChangeListener</code>) method intercepts <code>IS_VALID</code> events but
 * passes other events on to its superclass.
 * //from   www.j a  v a  2s  .co  m
 * @author manbaum
 * @since Oct 23, 2014
 * @param event the property change event object describing which property changed and how.
 * @see org.eclipse.jface.preference.FieldEditorPreferencePage#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
 */
@Override
public void propertyChange(PropertyChangeEvent event) {
    super.propertyChange(event);
    FieldEditor f = (FieldEditor) event.getSource();
    Composite p = getFieldEditorParent();
    if (event.getProperty() == FieldEditor.VALUE) {
        if (f.getPreferenceName().equals(PrefKeys.P_USESTANDALONE)) {
            boolean value = (Boolean) event.getNewValue();
            dburl.setEnabled(value, gf1.getGroupControl(p));
        } else if (f.getPreferenceName().equals(PrefKeys.P_USEEMBEDDED)) {
            boolean value = (Boolean) event.getNewValue();
            dbdir.setEnabled(value, gf1.getGroupControl(p));
        } else if (f.getPreferenceName().equals(PrefKeys.P_USEPREEXEC)) {
            boolean value = (Boolean) event.getNewValue();
            statements.setEnabled(value, gf3.getGroupControl(p));
        }
    }
}

From source file:com.ebmwebsourcing.petals.services.preferences.MavenPreferencePage.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {

    Composite container = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    container.setLayout(layout);/* w  w  w  .  ja  v a  2 s .c o m*/
    container.setLayoutData(new GridData(GridData.FILL_BOTH));

    // Petals Maven plug-in
    Group group = new Group(container, SWT.NONE);
    group.setLayout(new GridLayout(3, false));
    GridData layoutData = new GridData(GridData.FILL_HORIZONTAL);
    layoutData.horizontalSpan = 3;
    layoutData.verticalIndent = 4;
    group.setLayoutData(layoutData);
    group.setText("Petals Maven plug-in");

    Composite subContainer = new Composite(group, SWT.NONE);
    subContainer.setLayout(new GridLayout());
    subContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    this.pluginVersionField = new StringFieldEditor(PreferencesManager.PREFS_MAVEN_PLUGIN_VERSION,
            "Plugin Version:", StringFieldEditor.UNLIMITED, subContainer);
    this.pluginVersionField.fillIntoGrid(subContainer, 3);
    this.pluginVersionField.setPage(this);
    this.pluginVersionField.setPreferenceStore(getPreferenceStore());
    this.pluginVersionField.load();

    this.groupIdField = new StringFieldEditor(PreferencesManager.PREFS_MAVEN_GROUP_ID, "Group ID:",
            StringFieldEditor.UNLIMITED, subContainer);
    this.groupIdField.fillIntoGrid(subContainer, 3);
    this.groupIdField.setPage(this);
    this.groupIdField.setPreferenceStore(getPreferenceStore());
    this.groupIdField.load();

    this.pomParentField = new FileUrlFieldEditor(PreferencesManager.PREFS_MAVEN_POM_PARENT, "POM Parent:", true,
            StringFieldEditor.VALIDATE_ON_KEY_STROKE, subContainer);
    this.pomParentField.setFileExtensions(new String[] { "*.xml" });
    this.pomParentField.setPage(this);
    this.pomParentField.setPreferenceStore(getPreferenceStore());
    this.pomParentField.load();

    // Work with customized POM
    group = new Group(container, SWT.NONE);
    group.setLayout(new GridLayout(4, false));
    layoutData = new GridData(GridData.FILL_HORIZONTAL);
    layoutData.horizontalSpan = 3;
    layoutData.verticalIndent = 10;
    group.setLayoutData(layoutData);
    group.setText("POM customization");

    subContainer = new Composite(group, SWT.NONE);
    subContainer.setLayout(new GridLayout());
    subContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    this.defaultButton = new Button(subContainer, SWT.RADIO);
    this.defaultButton.setText("Use default POM");
    layoutData = new GridData();
    layoutData.horizontalSpan = 3;
    this.defaultButton.setLayoutData(layoutData);

    this.customizedButton = new Button(subContainer, SWT.RADIO);
    this.customizedButton.setText("Use customized POM");
    layoutData = new GridData();
    layoutData.horizontalSpan = 3;
    this.customizedButton.setLayoutData(layoutData);

    // The next field must only validate the location if it is enabled
    this.customizedPomLocationField = new DirectoryFieldEditor(PreferencesManager.PREFS_CUSTOMIZED_POM_LOCATION,
            "POM templates:", subContainer) {

        @Override
        protected boolean checkState() {

            boolean result = true;
            if (MavenPreferencePage.this.useCustomizedPom)
                result = super.checkState();
            else
                clearErrorMessage();

            return result;
        }

        @Override
        public void setEnabled(boolean enabled, Composite parent) {
            super.setEnabled(enabled, parent);
            valueChanged();
        }
    };

    this.customizedPomLocationField.setErrorMessage("The POM templates location is not a valid directory.");
    this.customizedPomLocationField.setPage(this);
    this.customizedPomLocationField.setPreferenceStore(getPreferenceStore());
    this.customizedPomLocationField.load();

    // Add a hyper link to generate the default POM
    final Link hyperlink = new Link(subContainer, SWT.NONE);
    hyperlink.setText("<A>Generate the default POM templates</A>");
    layoutData = new GridData(SWT.TRAIL, SWT.DEFAULT, true, false);
    layoutData.horizontalSpan = 2;
    hyperlink.setLayoutData(layoutData);

    // Add the listeners
    this.customizedPomLocationField.setPropertyChangeListener(new IPropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent event) {
            if (FieldEditor.VALUE.equals(event.getProperty())) {

                boolean valid = MavenPreferencePage.this.customizedPomLocationField.isValid();
                hyperlink.setEnabled(valid);
                setValid(valid);
            }
        }
    });

    SelectionListener selectionListener = new SelectionListener() {
        public void widgetSelected(SelectionEvent e) {
            widgetDefaultSelected(e);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            MavenPreferencePage.this.useCustomizedPom = MavenPreferencePage.this.customizedButton
                    .getSelection();
            MavenPreferencePage.this.customizedPomLocationField.setEnabled(
                    MavenPreferencePage.this.useCustomizedPom,
                    MavenPreferencePage.this.customizedButton.getParent());

            if (MavenPreferencePage.this.useCustomizedPom)
                hyperlink.setEnabled(MavenPreferencePage.this.customizedPomLocationField.isValid());
            else
                hyperlink.setEnabled(false);
        }
    };

    this.defaultButton.addSelectionListener(selectionListener);
    this.customizedButton.addSelectionListener(selectionListener);
    this.defaultButton.setSelection(!this.useCustomizedPom);
    this.customizedButton.setSelection(this.useCustomizedPom);
    this.customizedButton.notifyListeners(SWT.Selection, new Event());

    hyperlink.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {

            // Get the situation
            File rootDirectory = new File(MavenPreferencePage.this.customizedPomLocationField.getStringValue());
            File suPom = new File(rootDirectory, PetalsServicePomManager.DEFAULT_SU_POM);
            File saPom = new File(rootDirectory, PetalsServicePomManager.DEFAULT_SA_POM);

            boolean overwrite = false;
            if (suPom.exists() || saPom.exists()) {
                String msg = "Some of the default POM templates already exist.\nDo you want to overwrite them?";
                overwrite = MessageDialog.openQuestion(hyperlink.getShell(), "Overwrite Templates", msg);
            }

            // Create the SU template
            boolean ok = true;
            if (!suPom.exists() || overwrite) {
                File tpl = getBundledTemplateFile(true);
                try {
                    IoUtils.copyStream(tpl, suPom);

                } catch (IOException e1) {
                    ok = false;
                    PetalsServicesPlugin.log(e1, IStatus.ERROR);
                }
            }

            // Create the SA template
            if (!saPom.exists() || overwrite) {
                File tpl = getBundledTemplateFile(false);
                try {
                    IoUtils.copyStream(tpl, saPom);

                } catch (IOException e1) {
                    ok = false;
                    PetalsServicesPlugin.log(e1, IStatus.ERROR);
                }
            }

            // Report the result
            if (ok) {
                MessageDialog.openInformation(hyperlink.getShell(), "Successful Creation",
                        "The default POM templates were successfully created.");
            } else {
                MessageDialog.openError(hyperlink.getShell(), "Error during the Creation",
                        "The default POM templates could not be created correctly.\nCheck the log for more details.");
            }
        }
    });

    // Update POM dependencies automatically
    group = new Group(container, SWT.NONE);
    group.setLayout(new GridLayout());
    layoutData = new GridData(GridData.FILL_HORIZONTAL);
    layoutData.horizontalSpan = 3;
    layoutData.verticalIndent = 10;
    group.setLayoutData(layoutData);
    group.setText("POM dependencies");

    subContainer = new Composite(group, SWT.NONE);
    subContainer.setLayout(new GridLayout());

    this.autoPomUpdateField = new BooleanFieldEditor(PreferencesManager.PREFS_UPDATE_MAVEN_POM,
            "Update POM dependencies automatically (SA projects)", subContainer);
    this.autoPomUpdateField.setPage(this);
    this.autoPomUpdateField.setPreferenceStore(getPreferenceStore());
    this.autoPomUpdateField.load();

    return container;
}

From source file:com.google.cloud.tools.eclipse.preferences.areas.FieldEditorWrapper.java

License:Apache License

@Override
public Control createContents(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    parent.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    fieldEditor = createFieldEditor(container);
    fieldEditor.setPage(messages);/*  ww  w.  j  a  v a 2  s . com*/
    fieldEditor.setPropertyChangeListener(new IPropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent event) {
            if (FieldEditor.IS_VALID.equals(event.getProperty())) {
                fireValueChanged(IS_VALID, event.getOldValue(), event.getNewValue());
            } else if (FieldEditor.VALUE.equals(event.getProperty())) {
                fireValueChanged(VALUE, event.getOldValue(), event.getNewValue());
            }
        }
    });
    fieldEditor.setPreferenceStore(getPreferenceStore());
    fieldEditor.load();
    fieldEditor.fillIntoGrid(container, fieldEditor.getNumberOfControls());
    return container;
}

From source file:com.gorillalogic.monkeyconsole.preferences.CloudMonkeyAppliancePreferencePage.java

License:Open Source License

@Override
public void propertyChange(PropertyChangeEvent event) {
    super.propertyChange(event);
    if (event.getProperty().equals(FieldEditor.VALUE)) {
        checkState();//w ww .  j a v a 2 s .  c o m
    }
}

From source file:com.gorillalogic.monkeyconsole.preferences.FonemonkeyPreferencePage.java

License:Open Source License

@Override
public void propertyChange(PropertyChangeEvent event) {
    super.propertyChange(event);

    if (event.getProperty().equals(FieldEditor.VALUE)) {
        checkState();//  w ww .  j  a v  a  2  s  .c o  m
    }
}

From source file:com.jstar.eclipse.preferences.JStarPreferencePage.java

License:BSD License

public void propertyChange(PropertyChangeEvent event) {
    super.propertyChange(event);
    if (event.getProperty().equals(FieldEditor.VALUE)) {
        Object source = event.getSource();
        if (source instanceof BooleanFieldEditor) {
            if (((BooleanFieldEditor) source).getPreferenceName()
                    .equals(PreferenceConstants.VERIFY_AFTER_SAVING)) {
                if (event.getNewValue().equals(Boolean.TRUE)) {
                    Activator.getDefault().addSaveListener();
                } else {
                    Activator.getDefault().removeSaveListener();
                }// w  ww . j  a  v  a2s.c  o m
            }
        }
        source.toString();
    }
}

From source file:com.palantir.typescript.CompilerPreferencePage.java

License:Apache License

@Override
public void propertyChange(PropertyChangeEvent event) {
    super.propertyChange(event);

    Object source = event.getSource();

    if (source.equals(this.compileOnSaveField) && event.getProperty().equals(FieldEditor.VALUE)) {
        this.synchronizeCompileOnSave();
    }//  w  w  w .  ja  va 2s .c o  m

    if (source.equals(this.compileOnSaveField) || source.equals(this.moduleGenTargetField)
            || source.equals(this.removeCommentsField) || source.equals(this.sourceMapField)) {
        this.compilerPreferencesModified = true;
    }
}

From source file:com.palantir.typescript.preferences.CompilerPreferencePage.java

License:Apache License

@Override
public void propertyChange(PropertyChangeEvent event) {
    super.propertyChange(event);

    Object source = event.getSource();

    if (event.getProperty().equals(FieldEditor.VALUE)) {
        if (source.equals(this.compileOnSaveField) || source.equals(this.inlineSourceMapField)
                || source.equals(this.noImplicitAnyField) || source.equals(this.sourceMapField)) {
            this.updateFieldEditors();
        }/*w w  w  .j a  va  2 s . c o m*/
    }

    if (source.equals(this.compileOnSaveField) || source.equals(this.declarationField)
            || source.equals(this.experimentalDecoratorsField) || source.equals(this.inlineSourceMapField)
            || source.equals(this.inlineSourcesField) || source.equals(this.jsxField)
            || source.equals(this.moduleField) || source.equals(this.moduleResolutionField)
            || source.equals(this.noEmitOnErrorField) || source.equals(this.noFallthroughCasesInSwitchField)
            || source.equals(this.noImplicitAnyField) || source.equals(this.noImplicitReturnsField)
            || source.equals(this.noLibField) || source.equals(this.removeCommentsField)
            || source.equals(this.sourceMapField) || source.equals(this.suppressExcessPropertyErrorsField)
            || source.equals(this.suppressImplicitAnyIndexErrorsField) || source.equals(this.targetField)) {
        this.compilerPreferencesModified = true;
    }
}