Search in sources :

Example 26 with IPropertyChangeListener

use of org.eclipse.jface.util.IPropertyChangeListener in project titan.EclipsePlug-ins by eclipse.

the class ErrorsWarningsPreferencePage method createPotentialProgrammingProblemsSection.

/**
 * Creates the section of potential issues related to potential
 * programming problems. All of these should be considered as normal
 * errors, but on our current level we might not be able to detect them
 * in all cases correctly.
 *
 * @param parent
 *                the parent composite to put the section under.
 */
private void createPotentialProgrammingProblemsSection(final Composite parent) {
    ExpandableComposite expandable = createExtendableComposite(parent, "Potential programming problems");
    Composite comp = new Composite(expandable, SWT.NONE);
    comp.setLayout(new GridLayout(2, false));
    comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    expandable.setClient(comp);
    expandable.setExpanded(false);
    ComboFieldEditor comboedit = new ComboFieldEditor(PreferenceConstants.REPORTMISSINGIMPORTEDMODULE, REPORTMISSINGIMPORTATION, IGNORE_WARNING_ERROR, comp);
    Label text = comboedit.getLabelControl(comp);
    text.setToolTipText(REPORTMISSINGIMPORTATION_TOOLTIP);
    comboedit.setPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            changed = true;
        }
    });
    addField(comboedit);
    comboedit = new ComboFieldEditor(PreferenceConstants.REPORTMISSINGFRIENDMODULE, REPORTMISSINGFRIEND, IGNORE_WARNING_ERROR, comp);
    text = comboedit.getLabelControl(comp);
    text.setToolTipText(REPORTMISSINGFRIEND_TOOLTIP);
    comboedit.setPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            changed = true;
        }
    });
    addField(comboedit);
    comboedit = new ComboFieldEditor(PreferenceConstants.REPORTUNUSEDFUNCTIONRETURNVALUES, REPORTUNUSEDFUNTIONRETURNVALUES, IGNORE_WARNING_ERROR, comp);
    text = comboedit.getLabelControl(comp);
    text.setToolTipText(REPORTUNUSEDFUNCTIONRETURNVALUESTOOLTIP);
    comboedit.setPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            changed = true;
        }
    });
    addField(comboedit);
    comboedit = new ComboFieldEditor(PreferenceConstants.REPORTINFINITELOOPS, REPORT_INFINITE_LOOP, IGNORE_WARNING_ERROR, comp);
    text = comboedit.getLabelControl(comp);
    text.setToolTipText(REPORT_INFINITE_LOOP_TOOLTIP);
    comboedit.setPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            changed = true;
        }
    });
    addField(comboedit);
    comboedit = new ComboFieldEditor(PreferenceConstants.REPORTREADONLY, REPORT_READONLY, IGNORE_WARNING_ERROR, comp);
    text = comboedit.getLabelControl(comp);
    text.setToolTipText(REPORT_READONLY_TOOLTIP);
    comboedit.setPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            changed = true;
        }
    });
    addField(comboedit);
    comboedit = new ComboFieldEditor(PreferenceConstants.REPORT_NONPRIVATE_PRIVATE, REPORT_NONPRIVATE_PRIVATE, IGNORE_WARNING_ERROR, comp);
    text = comboedit.getLabelControl(comp);
    text.setToolTipText(REPORT_NONPRIVATE_PRIVATE_TOOLTIP);
    comboedit.setPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            changed = true;
        }
    });
    addField(comboedit);
    comboedit = new ComboFieldEditor(PreferenceConstants.REPORT_TOOMANY_PARAMETERS, REPORT_TOOMANY_PARAMETERS, IGNORE_WARNING_ERROR, comp);
    text = comboedit.getLabelControl(comp);
    text.setToolTipText(REPORT_TOOMANY_PARAMETERS_TOOLTIP);
    comboedit.setPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            changed = true;
        }
    });
    addField(comboedit);
    IntegerFieldEditor integeredit = new IntegerFieldEditor(PreferenceConstants.REPORT_TOOMANY_PARAMETERS_SIZE, REPORT_TOOMANY_PARAMETERS_SIZE, comp);
    text = integeredit.getLabelControl(comp);
    text.setToolTipText(REPORT_TOOMANY_PARAMETERS_TOOLTIP);
    integeredit.setPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            changed = true;
        }
    });
    addField(integeredit);
    comboedit = new ComboFieldEditor(PreferenceConstants.REPORT_EMPTY_STATEMENT_BLOCK, REPORT_EMPTY_STATEMENT_BLOCK, IGNORE_WARNING_ERROR, comp);
    text = comboedit.getLabelControl(comp);
    text.setToolTipText(REPORT_EMPTY_STATEMENT_BLOCK_TOOLTIP);
    comboedit.setPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            changed = true;
        }
    });
    addField(comboedit);
    comboedit = new ComboFieldEditor(PreferenceConstants.REPORT_TOOMANY_STATEMENTS, REPORT_TOOMANY_STATEMENTS, IGNORE_WARNING_ERROR, comp);
    text = comboedit.getLabelControl(comp);
    text.setToolTipText(REPORT_TOOMANY_STATEMENTS_TOOLTIP);
    comboedit.setPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            changed = true;
        }
    });
    addField(comboedit);
    integeredit = new IntegerFieldEditor(PreferenceConstants.REPORT_TOOMANY_STATEMENTS_SIZE, REPORT_TOOMANY_STATEMENTS_SIZE, comp);
    text = integeredit.getLabelControl(comp);
    text.setToolTipText(REPORT_TOOMANY_STATEMENTS_TOOLTIP);
    integeredit.setPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            changed = true;
        }
    });
    addField(integeredit);
    comboedit = new ComboFieldEditor(PreferenceConstants.REPORTINCORRECTSHIFTROTATESIZE, REPORTINCORRECTSHIFTROTATESIZE, IGNORE_WARNING_ERROR, comp);
    text = comboedit.getLabelControl(comp);
    text.setToolTipText(REPORTINCORRECTSHIFTROTATESIZE_TOOLTIP);
    comboedit.setPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            changed = true;
        }
    });
    addField(comboedit);
    comboedit = new ComboFieldEditor(PreferenceConstants.REPORT_IF_WITHOUT_ELSE, REPORT_IF_WITHOUT_ELSE, IGNORE_WARNING_ERROR, comp);
    text = comboedit.getLabelControl(comp);
    text.setToolTipText(REPORT_IF_WITHOUT_ELSE_TOOLTIP);
    comboedit.setPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            changed = true;
        }
    });
    addField(comboedit);
    comboedit = new ComboFieldEditor(PreferenceConstants.REPORT_SETVERDICT_WITHOUT_REASON, REPORT_SETVERDICT_WITHOUT_REASON, IGNORE_WARNING_ERROR, comp);
    text = comboedit.getLabelControl(comp);
    text.setToolTipText(REPORT_SETVERDICT_WITHOUT_REASON_TOOLTIP);
    comboedit.setPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            changed = true;
        }
    });
    addField(comboedit);
    comboedit = new ComboFieldEditor(PreferenceConstants.REPORTERRORSINEXTENSIONSYNTAX, REPORTERRORSINEXTENSIONSYNTAX, IGNORE_WARNING_ERROR, comp);
    text = comboedit.getLabelControl(comp);
    text.setToolTipText(REPORTERRORSINEXTENSIONSYNTAX_TOOLTIP);
    comboedit.setPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            changed = true;
        }
    });
    addField(comboedit);
}
Also used : IPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) GridLayout(org.eclipse.swt.layout.GridLayout) PropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) IntegerFieldEditor(org.eclipse.jface.preference.IntegerFieldEditor) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite)

Example 27 with IPropertyChangeListener

use of org.eclipse.jface.util.IPropertyChangeListener in project titan.EclipsePlug-ins by eclipse.

the class BaseNamingConventionPropertyPage method createFieldEditor.

/**
 * Creates a field editor with the provided preference and name.
 *
 * @param parent
 *                the composite to add the field editor to.
 * @param preference
 *                the preference the field editor should handle.
 * @param namepart
 *                the name of the field editor to be displayed.
 *
 * @return the new field editor.
 */
private RegexpFieldEditor createFieldEditor(final Composite parent, final String preference, final String namepart) {
    RegexpFieldEditor stringEditor = new RegexpFieldEditor(preference, "Format of " + namepart + " names", parent, namepart);
    stringEditor.setPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            changed = true;
            setErrorMessage(null);
            String newValue = ((StringFieldEditor) event.getSource()).getStringValue();
            try {
                Pattern.compile(newValue);
            } catch (PatternSyntaxException e) {
                setErrorMessage("The format of " + namepart + " name regexp is wrong");
            }
        }
    });
    return stringEditor;
}
Also used : IPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) PropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent) PatternSyntaxException(java.util.regex.PatternSyntaxException)

Example 28 with IPropertyChangeListener

use of org.eclipse.jface.util.IPropertyChangeListener in project titan.EclipsePlug-ins by eclipse.

the class NamingConventionPreferencePage method createOthersSection.

/**
 * Creates the section of naming conventions governing definitions
 *
 * @param parent
 *                the parent composite to put the section under.
 */
private void createOthersSection(final Composite parent) {
    ExpandableComposite expandable = createExtendableComposite(parent, "other naming rules");
    Composite comp = new Composite(expandable, SWT.NONE);
    comp.setLayout(new GridLayout(2, false));
    comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    expandable.setClient(comp);
    expandable.setExpanded(false);
    ComboFieldEditor comboedit = new ComboFieldEditor(PreferenceConstants.REPORT_MODULENAME_IN_DEFINITION, REPORT_MODULENAME_IN_DEFINITION, IGNORE_WARNING_ERROR, comp);
    Label text = comboedit.getLabelControl(comp);
    text.setToolTipText(REPORT_MODULENAME_IN_DEFINITION_TOOLTIP);
    comboedit.setPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            changed = true;
        }
    });
    addField(comboedit);
    comboedit = new ComboFieldEditor(PreferenceConstants.REPORT_VISIBILITY_IN_DEFINITION, REPORT_VISIBILITY_IN_DEFINITION, IGNORE_WARNING_ERROR, comp);
    text = comboedit.getLabelControl(comp);
    text.setToolTipText(REPORT_VISIBILITY_IN_DEFINITION_TOOLTIP);
    comboedit.setPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            changed = true;
        }
    });
    addField(comboedit);
}
Also used : IPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) GridLayout(org.eclipse.swt.layout.GridLayout) PropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite)

Example 29 with IPropertyChangeListener

use of org.eclipse.jface.util.IPropertyChangeListener in project titan.EclipsePlug-ins by eclipse.

the class NamingConventionPreferencePage method createFieldEditor.

/**
 * Creates a field editor with the provided preference and name.
 *
 * @param parent
 *                the composite to add the field editor to.
 * @param preference
 *                the preference the field editor should handle.
 * @param namepart
 *                the name of the field editor to be displayed.
 *
 * @return the new field editor.
 */
private StringFieldEditor createFieldEditor(final Composite parent, final String preference, final String namepart) {
    final RegexpFieldEditor stringEditor = new RegexpFieldEditor(preference, "Format of " + namepart + " names", parent, namepart);
    stringEditor.setPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            changed = true;
        }
    });
    return stringEditor;
}
Also used : IPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) PropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent)

Example 30 with IPropertyChangeListener

use of org.eclipse.jface.util.IPropertyChangeListener in project titan.EclipsePlug-ins by eclipse.

the class NamingConventionPreferencePage method createFieldEditors.

@Override
protected void createFieldEditors() {
    final Composite tempParent = getFieldEditorParent();
    ComboFieldEditor comboedit = new ComboFieldEditor(PreferenceConstants.REPORTNAMINGCONVENTIONPROBLEMS, REPORTNAMINGCONVENTIONPROBLEMS, IGNORE_WARNING_ERROR, tempParent);
    Label text = comboedit.getLabelControl(tempParent);
    text.setToolTipText(REPORTNAMINGCONVENTIONPROBLEMS_TOOLTIP);
    comboedit.setPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            changed = true;
        }
    });
    addField(comboedit);
    createModuleSection(tempParent);
    createTTCN3GlobalSection(tempParent);
    createTTCN3LocalSection(tempParent);
    createTTCN3ComponentSection(tempParent);
    createOthersSection(tempParent);
}
Also used : IPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) PropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) Label(org.eclipse.swt.widgets.Label)

Aggregations

IPropertyChangeListener (org.eclipse.jface.util.IPropertyChangeListener)126 PropertyChangeEvent (org.eclipse.jface.util.PropertyChangeEvent)120 Composite (org.eclipse.swt.widgets.Composite)55 GridData (org.eclipse.swt.layout.GridData)44 Label (org.eclipse.swt.widgets.Label)39 GridLayout (org.eclipse.swt.layout.GridLayout)37 SelectionEvent (org.eclipse.swt.events.SelectionEvent)31 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)25 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)22 Button (org.eclipse.swt.widgets.Button)22 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)21 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)20 ColorSelector (org.eclipse.jface.preference.ColorSelector)14 ComboViewer (org.eclipse.jface.viewers.ComboViewer)12 Text (org.eclipse.swt.widgets.Text)11 Iterator (java.util.Iterator)10 ISelection (org.eclipse.jface.viewers.ISelection)10 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)10 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)9 SashForm (org.eclipse.swt.custom.SashForm)9