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

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

Introduction

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

Prototype

String IS_VALID

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

Click Source Link

Document

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

Usage

From source file:org.eclipse.ui.internal.ide.dialogs.ResourceInfoPage.java

License:Open Source License

protected Control createContents(Composite parent) {

    PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(),
            IIDEHelpContextIds.RESOURCE_INFO_PROPERTY_PAGE);

    // layout the page
    IResource resource = (IResource) getElement().getAdapter(IResource.class);

    if (resource == null) {
        Label label = new Label(parent, SWT.NONE);
        label.setText(IDEWorkbenchMessages.ResourceInfoPage_noResource);
        return label;
    }/*from ww w  .j ava 2  s  .  c  o m*/

    if (resource.getType() != IResource.PROJECT) {
        ResourceAttributes attrs = resource.getResourceAttributes();
        if (attrs != null) {
            previousReadOnlyValue = attrs.isReadOnly();
            previousExecutableValue = attrs.isExecutable();
            previousArchiveValue = attrs.isArchive();
        } else {
            previousReadOnlyValue = previousExecutableValue = previousArchiveValue = false;
        }
        previousDerivedValue = resource.isDerived();
    }

    // top level group
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    composite.setLayout(layout);
    GridData data = new GridData(GridData.FILL);
    data.grabExcessHorizontalSpace = true;
    composite.setLayoutData(data);

    createBasicInfoGroup(composite, resource);
    // Attributes are not relevant to projects
    if (resource.getType() != IResource.PROJECT) {
        createSeparator(composite);
        int fsAttributes = getFileSystemAttributes(resource);
        if (isPermissionsSupport(fsAttributes))
            previousPermissionsValue = fetchPermissions(resource);
        createStateGroup(composite, resource, fsAttributes);
        if (isPermissionsSupport(fsAttributes)) {
            createSeparator(composite);
            createPermissionsGroup(composite);
            setPermissionsSelection(previousPermissionsValue);
        }
    }
    //We can't save and load the preferences for closed project
    if (resource.getProject().isOpen()) {
        encodingEditor = new ResourceEncodingFieldEditor(getFieldEditorLabel(resource), composite, resource);
        encodingEditor.setPage(this);
        encodingEditor.load();

        encodingEditor.setPropertyChangeListener(new IPropertyChangeListener() {
            /*
             * (non-Javadoc)
             * 
             * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
             */
            public void propertyChange(PropertyChangeEvent event) {
                if (event.getProperty().equals(FieldEditor.IS_VALID)) {
                    setValid(encodingEditor.isValid());
                }
            }
        });

        if (resource.getType() == IResource.PROJECT) {
            lineDelimiterEditor = new LineDelimiterEditor(composite, resource.getProject());
            lineDelimiterEditor.doLoad();
        }
    }

    Dialog.applyDialogFont(composite);

    return composite;
}

From source file:org.eclipse.wb.core.controls.jface.preference.FieldLayoutPreferencePage.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  w w w .  j  a  va2s  . c  o  m
 */
public void propertyChange(PropertyChangeEvent event) {
    if (event.getProperty().equals(FieldEditor.IS_VALID)) {
        boolean newValue = ((Boolean) event.getNewValue()).booleanValue();
        // If the new value is true then we must check all field editors.
        // If it is false, then the page is invalid in any case.
        if (newValue) {
            checkState();
        } else {
            invalidFieldEditor = (FieldEditor) event.getSource();
        }
        setValid(newValue);
    }
}

From source file:org.eclipse.wb.swt.FieldLayoutPreferencePage.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 w  ww  .j av a 2 s  .c o m*/
public void propertyChange(PropertyChangeEvent event) {
    if (event.getProperty().equals(FieldEditor.IS_VALID)) {
        boolean newValue = ((Boolean) event.getNewValue()).booleanValue();
        // If the new value is true then we must check all field editors.
        // If it is false, then the page is invalid in any case.
        if (newValue) {
            checkState();
        } else {
            m_invalidFieldEditor = (FieldEditor) event.getSource();
            setValid(newValue);
        }
    }
}

From source file:org.soyatec.tooling.gef.properties.ViewPropertyTab.java

License:Open Source License

public void propertyChange(final PropertyChangeEvent event) {
    final String property = event.getProperty();
    if (FieldEditor.IS_VALID.equals(property)) {
        // valid/*from ww w . ja v a 2s  .c  om*/
    } else if (model != null) {
        final Object source = event.getSource();
        if (!(source instanceof FieldEditor)) {
            return;
        }
        final String name = ((FieldEditor) source).getPreferenceName();
        final EStructuralFeature feature = model.eClass().getEStructuralFeature(name);
        if (feature == null) {
            return;
        }
        Object newValue = event.getNewValue();
        if (ES_GRADIENT_VERTICAL == feature) {
            newValue = "true".equals(newValue); //$NON-NLS-1$
        }
        if (newValue instanceof RGB) {
            newValue = ResourcesFactory.RGBToInteger((RGB) newValue);
        }
        final EditingDomain domain = getEditingDomain();
        if (domain != null) {
            final Command command = SetCommand.create(domain, model, feature, newValue);
            executeCommand(command);
        }
    }
}

From source file:org.talend.designer.abstractmap.ui.prefs.MapPreferencePage.java

License:Open Source License

/**
 * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
 *///  w w  w.ja  va  2  s  . c o m
public void propertyChange(PropertyChangeEvent event) {

    if (event.getProperty().equals(FieldEditor.IS_VALID)) {
        boolean newValue = ((Boolean) event.getNewValue()).booleanValue();
        // If the new value is true then we must check all field editors.
        // If it is false, then the page is invalid in any case.
        if (newValue) {
            // if (fClientComPortEditor != null && event.getSource() != fClientComPortEditor) {
            // // fClientComPortEditor.refreshValidState();
            // }
            checkState();
        } else {
            super.propertyChange(event);
        }

    } else {
        super.propertyChange(event);
    }
}

From source file:org.talend.designer.codegen.components.ui.ComponentsPreferencePage.java

License:Open Source License

@Override
public void propertyChange(PropertyChangeEvent event) {

    if (event.getSource() == filePathTemp) {
        // propertyChangeForComponents(event);
    } else {//from  w w  w . ja  v  a  2  s.  c  o m
        Object nValue = event.getNewValue();
        if (event.getProperty().equals(FieldEditor.IS_VALID)) {
            boolean newValue = ((Boolean) nValue).booleanValue();
            if (newValue) {
                checkState();
            } else {
                super.propertyChange(event);
            }

        } else {
            super.propertyChange(event);
        }
    }
}

From source file:org.talend.designer.esb.runcontainer.preferences.FieldLayoutPreferencePage.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./* w  w w . j  a v  a  2  s  .  c o  m*/
 */
@Override
public void propertyChange(PropertyChangeEvent event) {
    if (event.getProperty().equals(FieldEditor.IS_VALID)) {
        boolean newValue = ((Boolean) event.getNewValue()).booleanValue();
        // If the new value is true then we must check all field editors.
        // If it is false, then the page is invalid in any case.
        if (newValue) {
            checkState();
        } else {
            m_invalidFieldEditor = (FieldEditor) event.getSource();
            setValid(newValue);
        }
    }
}

From source file:org.talend.designer.runprocess.prefs.RunProcessPreferencePage.java

License:Open Source License

/**
 * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
 *///from ww  w.j  av  a  2 s .co m
@Override
public void propertyChange(PropertyChangeEvent event) {

    if (event.getProperty().equals(FieldEditor.IS_VALID)) {
        boolean newValue = ((Boolean) event.getNewValue()).booleanValue();
        // If the new value is true then we must check all field editors.
        // If it is false, then the page is invalid in any case.
        if (newValue) {
            if (fClientComPortEditor != null && event.getSource() != fClientComPortEditor) {
                // fClientComPortEditor.refreshValidState();
            }
            checkState();
        } else {
            super.propertyChange(event);
        }

    } else {
        super.propertyChange(event);
    }
}