Search in sources :

Example 66 with IPropertyChangeListener

use of org.eclipse.jface.util.IPropertyChangeListener in project knime-core by knime.

the class NodeOutputView method createPartControl.

/**
 * {@inheritDoc}
 */
@Override
public void createPartControl(final Composite parent) {
    // Toolbar
    IToolBarManager toolbarMGR = getViewSite().getActionBars().getToolBarManager();
    // create button for stick with branch.
    final RetargetAction lockAction = new RetargetAction("StayOnBranch", "Pin view to new node added to branch", IAction.AS_CHECK_BOX);
    lockAction.setImageDescriptor(ImageDescriptor.createFromFile(this.getClass(), "icons/lock.png"));
    lockAction.setChecked(m_branchLocked);
    lockAction.setEnabled(m_pinned);
    lockAction.addPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            if (lockAction.isChecked()) {
                m_branchLocked = true;
                m_selectionWhenLocked = m_lastSelection;
            } else {
                m_branchLocked = false;
                selectionChanged(null, m_lastSelectionWhilePinned);
            }
        }
    });
    toolbarMGR.add(lockAction);
    // create button which allows to "pin" selection:
    m_pinButton = new RetargetAction("PinView", "Pin view to selected node", IAction.AS_CHECK_BOX);
    m_pinButton.setImageDescriptor(ImageDescriptor.createFromFile(this.getClass(), "icons/pin.png"));
    m_pinButton.setChecked(m_pinned);
    m_pinButton.setEnabled(true);
    m_pinButton.addPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            if (m_pinButton.isChecked()) {
                m_pinned = true;
                m_lastSelectionWhilePinned = m_lastSelection;
                lockAction.setEnabled(true);
            } else {
                m_pinned = false;
                selectionChanged(null, m_lastSelectionWhilePinned);
                lockAction.setEnabled(false);
            }
        }
    });
    toolbarMGR.add(m_pinButton);
    toolbarMGR.add(new Separator());
    // configure drop down menu
    IMenuManager dropDownMenu = getViewSite().getActionBars().getMenuManager();
    // drop down menu entry for outport table:
    final RetargetAction menuentrytable = new RetargetAction("OutputTable", "Show Output Table", IAction.AS_RADIO_BUTTON);
    menuentrytable.setChecked(DISPLAYOPTIONS.TABLE.equals(m_choice));
    menuentrytable.setEnabled(true);
    menuentrytable.addPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            if (menuentrytable.isChecked()) {
                m_choice = DISPLAYOPTIONS.TABLE;
                updateNodeContainerInfo(m_lastNode);
            }
        }
    });
    dropDownMenu.add(menuentrytable);
    // drop down menu entry for node variables:
    final RetargetAction dropdownmenuvars = new RetargetAction("NodeVariables", "Show Variables", IAction.AS_RADIO_BUTTON);
    dropdownmenuvars.setChecked(DISPLAYOPTIONS.VARS.equals(m_choice));
    dropdownmenuvars.setEnabled(true);
    dropdownmenuvars.addPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            if (dropdownmenuvars.isChecked()) {
                m_choice = DISPLAYOPTIONS.VARS;
                updateNodeContainerInfo(m_lastNode);
            }
        }
    });
    dropDownMenu.add(dropdownmenuvars);
    // drop down menu entry for configuration/settings:
    final RetargetAction menuentrysettings = new RetargetAction("NodeConf", "Show Configuration", IAction.AS_RADIO_BUTTON);
    menuentrysettings.setChecked(DISPLAYOPTIONS.SETTINGS.equals(m_choice));
    menuentrysettings.setEnabled(true);
    menuentrysettings.addPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            if (menuentrysettings.isChecked()) {
                m_choice = DISPLAYOPTIONS.SETTINGS;
                updateNodeContainerInfo(m_lastNode);
            }
        }
    });
    dropDownMenu.add(menuentrysettings);
    // drop down menu entry for configuration/settings:
    final RetargetAction menuentryallsettings = new RetargetAction("NodeConfAll", "Show Entire Configuration", IAction.AS_RADIO_BUTTON);
    menuentryallsettings.setChecked(DISPLAYOPTIONS.ALLSETTINGS.equals(m_choice));
    menuentryallsettings.setEnabled(true);
    menuentryallsettings.addPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            if (menuentryallsettings.isChecked()) {
                m_choice = DISPLAYOPTIONS.ALLSETTINGS;
                updateNodeContainerInfo(m_lastNode);
            }
        }
    });
    dropDownMenu.add(menuentryallsettings);
    // drop down menu entry for node graph annotations
    final RetargetAction menuentrygraphannotations = new RetargetAction("NodeGraphAnno", "Show Graph Annotations", IAction.AS_RADIO_BUTTON);
    menuentrygraphannotations.setChecked(DISPLAYOPTIONS.GRAPHANNOTATIONS.equals(m_choice));
    menuentrygraphannotations.setEnabled(true);
    menuentrygraphannotations.addPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            if (menuentrygraphannotations.isChecked()) {
                m_choice = DISPLAYOPTIONS.GRAPHANNOTATIONS;
                updateNodeContainerInfo(m_lastNode);
            }
        }
    });
    dropDownMenu.add(menuentrygraphannotations);
    // Content
    GridLayoutFactory.swtDefaults().numColumns(2).applyTo(parent);
    // Node Title:
    Label titlelabel = new Label(parent, SWT.NONE);
    titlelabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
    titlelabel.setText("Node: ");
    m_title = new Text(parent, SWT.BORDER);
    m_title.setEditable(false);
    m_title.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
    m_title.setText("n/a.");
    // Panel for currently displayed information (some information
    // providers will add more elements to this):
    Composite infoPanel = new Composite(parent, SWT.NONE);
    GridData infoGrid = new GridData(SWT.FILL, SWT.TOP, true, false);
    infoGrid.horizontalSpan = 2;
    infoPanel.setLayoutData(infoGrid);
    GridLayoutFactory.swtDefaults().numColumns(3).applyTo(infoPanel);
    m_info = new Label(infoPanel, SWT.NONE);
    m_info.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
    m_info.setText("n/a.                        ");
    m_portIndex = new ComboViewer(infoPanel);
    m_portIndex.add(new String[] { "port 0", "port 1", "port 2" });
    m_portIndex.getCombo().setEnabled(false);
    m_portIndex.getCombo().setSelection(new Point(m_portIndexInit, m_portIndexInit));
    m_portIndex.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(final SelectionChangedEvent event) {
            ISelection sel = event.getSelection();
            try {
                int newIndex = Integer.parseInt(sel.toString().substring(5).replace(']', ' ').trim());
                NodeContainer node;
                if (m_workflow.containsNodeContainer(m_lastNode)) {
                    node = m_workflow.getNodeContainer(m_lastNode);
                    updateDataTable(node, newIndex);
                }
            } catch (NumberFormatException nfe) {
            // ignore.
            }
        }
    });
    // Table:
    // stack panel switches between KNIME data table view and SWT table for other info
    m_stackPanel = new Composite(parent, SWT.NONE);
    m_stackPanel.setLayout(new StackLayout());
    GridData tableGrid = new GridData(SWT.FILL, SWT.FILL, true, true);
    m_stackPanel.setLayoutData(tableGrid);
    // DataTable view wrapped in AWT-SWT bridge
    m_tableView = new TableView();
    m_tableViewPanel = new Panel2CompositeWrapper(m_stackPanel, m_tableView, SWT.NONE);
    m_errorLabel = new Label(m_stackPanel, SWT.NONE);
    // SWT Table for the other info
    m_table = new Table(m_stackPanel, SWT.MULTI | SWT.BORDER);
    m_table.setLinesVisible(true);
    m_table.setHeaderVisible(true);
    tableGrid.horizontalSpan = 2;
    m_table.setLayoutData(tableGrid);
    String[] titles = { "Name", "Value" };
    for (int i = 0; i < titles.length; i++) {
        TableColumn column = new TableColumn(m_table, SWT.NONE);
        column.setText(titles[i]);
    }
    for (int i = 0; i < titles.length; i++) {
        m_table.getColumn(i).pack();
    }
    m_lastNode = null;
    getViewSite().getPage().addSelectionListener(this);
    if (m_choice.equals(DISPLAYOPTIONS.TABLE)) {
        ((StackLayout) m_stackPanel.getLayout()).topControl = m_tableViewPanel;
        m_stackPanel.layout();
    } else {
        ((StackLayout) m_stackPanel.getLayout()).topControl = m_table;
        m_stackPanel.layout();
    }
    m_stackPanel.layout();
    selectionChanged(null, m_lastSelection);
}
Also used : Label(org.eclipse.swt.widgets.Label) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) NodeContainer(org.knime.core.node.workflow.NodeContainer) NativeNodeContainer(org.knime.core.node.workflow.NativeNodeContainer) SingleNodeContainer(org.knime.core.node.workflow.SingleNodeContainer) ISelection(org.eclipse.jface.viewers.ISelection) StackLayout(org.eclipse.swt.custom.StackLayout) TableView(org.knime.core.node.tableview.TableView) IPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) Panel2CompositeWrapper(org.knime.workbench.ui.wrapper.Panel2CompositeWrapper) PropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent) BufferedDataTable(org.knime.core.node.BufferedDataTable) Table(org.eclipse.swt.widgets.Table) DataTable(org.knime.core.data.DataTable) Composite(org.eclipse.swt.widgets.Composite) RetargetAction(org.eclipse.ui.actions.RetargetAction) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) Text(org.eclipse.swt.widgets.Text) Point(org.eclipse.swt.graphics.Point) TableColumn(org.eclipse.swt.widgets.TableColumn) Point(org.eclipse.swt.graphics.Point) IToolBarManager(org.eclipse.jface.action.IToolBarManager) ComboViewer(org.eclipse.jface.viewers.ComboViewer) GridData(org.eclipse.swt.layout.GridData) IMenuManager(org.eclipse.jface.action.IMenuManager) Separator(org.eclipse.jface.action.Separator)

Example 67 with IPropertyChangeListener

use of org.eclipse.jface.util.IPropertyChangeListener in project knime-core by knime.

the class FontStyleDialog method createColorSelector.

private void createColorSelector(final Composite parent) {
    Composite panel = new Composite(parent, SWT.FILL);
    GridData gData = new GridData(GridData.FILL_HORIZONTAL);
    panel.setLayoutData(gData);
    panel.setLayout(new GridLayout(2, false));
    Label msg = new Label(panel, SWT.LEFT);
    msg.setText("Font color (click to change):");
    msg.setLayoutData(gData);
    final ColorSelector sel = new ColorSelector(panel);
    sel.setColorValue(m_defColor.getRGB());
    sel.addListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            m_color = sel.getColorValue();
        }
    });
    m_color = null;
}
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) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) ColorSelector(org.eclipse.jface.preference.ColorSelector)

Example 68 with IPropertyChangeListener

use of org.eclipse.jface.util.IPropertyChangeListener in project knime-core by knime.

the class NodeMonitorView method createPartControl.

/**
 * {@inheritDoc}
 */
@Override
public void createPartControl(final Composite parent) {
    // Toolbar
    IToolBarManager toolbarMGR = getViewSite().getActionBars().getToolBarManager();
    // create button which allows to "pin" selection:
    final RetargetAction pinButton = new RetargetAction("PinView", "Pin view to selected node", IAction.AS_CHECK_BOX);
    pinButton.setImageDescriptor(ImageDescriptor.createFromFile(this.getClass(), "icons/pin.png"));
    pinButton.setChecked(m_pinned);
    pinButton.addPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            if (pinButton.isChecked()) {
                m_pinned = true;
                m_lastSelectionWhilePinned = m_lastSelection;
            } else {
                m_pinned = false;
                selectionChanged(null, m_lastSelectionWhilePinned);
            }
        }
    });
    pinButton.setEnabled(true);
    toolbarMGR.add(pinButton);
    toolbarMGR.add(new Separator());
    // configure drop down menu
    IMenuManager dropDownMenu = getViewSite().getActionBars().getMenuManager();
    // drop down menu entry for outport table:
    final RetargetAction menuentrytable = new RetargetAction("OutputTable", "Show Output Table", IAction.AS_RADIO_BUTTON);
    menuentrytable.setChecked(DISPLAYOPTIONS.TABLE.equals(m_choice));
    menuentrytable.addPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            if (menuentrytable.isChecked()) {
                m_choice = DISPLAYOPTIONS.TABLE;
                updateNodeContainerInfo(m_lastNode);
            }
        }
    });
    menuentrytable.setEnabled(true);
    dropDownMenu.add(menuentrytable);
    // drop down menu entry for node variables:
    final RetargetAction dropdownmenuvars = new RetargetAction("NodeVariables", "Show Variables", IAction.AS_RADIO_BUTTON);
    dropdownmenuvars.setChecked(DISPLAYOPTIONS.VARS.equals(m_choice));
    dropdownmenuvars.addPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            if (dropdownmenuvars.isChecked()) {
                m_choice = DISPLAYOPTIONS.VARS;
                updateNodeContainerInfo(m_lastNode);
            }
        }
    });
    dropdownmenuvars.setEnabled(true);
    dropDownMenu.add(dropdownmenuvars);
    // drop down menu entry for configuration/settings:
    final RetargetAction menuentrysettings = new RetargetAction("NodeConf", "Show Configuration", IAction.AS_RADIO_BUTTON);
    menuentrysettings.setChecked(DISPLAYOPTIONS.SETTINGS.equals(m_choice));
    menuentrysettings.addPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            if (menuentrysettings.isChecked()) {
                m_choice = DISPLAYOPTIONS.SETTINGS;
                updateNodeContainerInfo(m_lastNode);
            }
        }
    });
    menuentrysettings.setEnabled(true);
    dropDownMenu.add(menuentrysettings);
    // drop down menu entry for configuration/settings:
    final RetargetAction menuentryallsettings = new RetargetAction("NodeConfAll", "Show Entire Configuration", IAction.AS_RADIO_BUTTON);
    menuentryallsettings.setChecked(DISPLAYOPTIONS.ALLSETTINGS.equals(m_choice));
    menuentryallsettings.addPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            if (menuentryallsettings.isChecked()) {
                m_choice = DISPLAYOPTIONS.ALLSETTINGS;
                updateNodeContainerInfo(m_lastNode);
            }
        }
    });
    menuentryallsettings.setEnabled(true);
    dropDownMenu.add(menuentryallsettings);
    // drop down menu entry for node timer
    final RetargetAction menuentrynodetimer = new RetargetAction("NodeTimer", "Show Node Timing Information", IAction.AS_RADIO_BUTTON);
    menuentrynodetimer.setChecked(DISPLAYOPTIONS.TIMER.equals(m_choice));
    menuentrynodetimer.addPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            if (menuentrynodetimer.isChecked()) {
                m_choice = DISPLAYOPTIONS.TIMER;
                updateNodeContainerInfo(m_lastNode);
            }
        }
    });
    menuentrynodetimer.setEnabled(true);
    dropDownMenu.add(menuentrynodetimer);
    // drop down menu entry for node graph annotations
    final RetargetAction menuentrygraphannotations = new RetargetAction("NodeGraphAnno", "Show Graph Annotations", IAction.AS_RADIO_BUTTON);
    menuentrygraphannotations.setChecked(DISPLAYOPTIONS.GRAPHANNOTATIONS.equals(m_choice));
    menuentrygraphannotations.addPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            if (menuentrygraphannotations.isChecked()) {
                m_choice = DISPLAYOPTIONS.GRAPHANNOTATIONS;
                updateNodeContainerInfo(m_lastNode);
            }
        }
    });
    menuentrygraphannotations.setEnabled(true);
    dropDownMenu.add(menuentrygraphannotations);
    // Content
    GridLayoutFactory.swtDefaults().numColumns(2).applyTo(parent);
    // Node Title:
    Label titlelabel = new Label(parent, SWT.NONE);
    titlelabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
    titlelabel.setText("Node: ");
    m_title = new Text(parent, SWT.BORDER);
    m_title.setEditable(false);
    m_title.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
    m_title.setText("n/a.");
    // Node State:
    Label statelabel = new Label(parent, SWT.NONE);
    statelabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
    statelabel.setText("State: ");
    m_state = new Text(parent, SWT.BORDER);
    m_state.setEditable(false);
    m_state.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
    m_state.setText("n/a.");
    // Panel for currently displayed information (some information
    // providers will add more elements to this):
    Composite infoPanel = new Composite(parent, SWT.NONE);
    GridData infoGrid = new GridData(SWT.FILL, SWT.TOP, true, false);
    infoGrid.horizontalSpan = 2;
    infoPanel.setLayoutData(infoGrid);
    GridLayoutFactory.swtDefaults().numColumns(3).applyTo(infoPanel);
    m_info = new Label(infoPanel, SWT.NONE);
    m_info.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
    m_info.setText("n/a.                        ");
    m_portIndex = new ComboViewer(infoPanel);
    m_portIndex.add(new String[] { "port 0", "port 1", "port 2" });
    m_portIndex.getCombo().setEnabled(false);
    m_portIndex.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(final SelectionChangedEvent event) {
            ISelection sel = event.getSelection();
            try {
                int newIndex = Integer.parseInt(sel.toString().substring(5).replace(']', ' ').trim());
                updateDataTable(unwrapNC(m_lastNode), newIndex);
            } catch (NumberFormatException nfe) {
            // ignore.
            }
        }
    });
    // Table:
    m_table = new Table(parent, SWT.MULTI | SWT.BORDER);
    m_table.setLinesVisible(true);
    m_table.setHeaderVisible(true);
    GridData tableGrid = new GridData(SWT.FILL, SWT.FILL, true, true);
    tableGrid.horizontalSpan = 2;
    m_table.setLayoutData(tableGrid);
    String[] titles = { "Name", "Value" };
    for (int i = 0; i < titles.length; i++) {
        TableColumn column = new TableColumn(m_table, SWT.NONE);
        column.setText(titles[i]);
    }
    for (int i = 0; i < titles.length; i++) {
        m_table.getColumn(i).pack();
    }
    m_lastNode = null;
    getViewSite().getPage().addSelectionListener(this);
}
Also used : IPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) PropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent) BufferedDataTable(org.knime.core.node.BufferedDataTable) Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) RetargetAction(org.eclipse.ui.actions.RetargetAction) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) TableColumn(org.eclipse.swt.widgets.TableColumn) IToolBarManager(org.eclipse.jface.action.IToolBarManager) ComboViewer(org.eclipse.jface.viewers.ComboViewer) GridData(org.eclipse.swt.layout.GridData) ISelection(org.eclipse.jface.viewers.ISelection) IMenuManager(org.eclipse.jface.action.IMenuManager) Separator(org.eclipse.jface.action.Separator)

Example 69 with IPropertyChangeListener

use of org.eclipse.jface.util.IPropertyChangeListener in project erlide_eclipse by erlang.

the class OverlayPreferenceStore method start.

/**
 * Starts to listen for changes.
 */
public void start() {
    if (fPropertyListener == null) {
        fPropertyListener = new IPropertyChangeListener() {

            @Override
            public void propertyChange(final PropertyChangeEvent event) {
                final OverlayKey key = findOverlayKey(event.getProperty());
                if (key != null) {
                    propagateProperty(fParent, key, fStore);
                }
            }
        };
        fParent.addPropertyChangeListener(fPropertyListener);
    }
}
Also used : IPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) PropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent)

Example 70 with IPropertyChangeListener

use of org.eclipse.jface.util.IPropertyChangeListener in project abstools by abstools.

the class ABSPropertyPage method createContents.

@Override
protected Control createContents(Composite parent) {
    project = (IProject) getElement();
    GridLayout gridLayout = new GridLayout(1, false);
    parent.setLayout(gridLayout);
    // ArrayList<String[]> locations = new ArrayList<String[]>();
    // for(LocationType ltype : LocationType.ALLUSERTYPES){
    // locations.add(new String[]{ltype.toString(),ltype.toString()});
    // }
    prefstore = getAbsNature(project).getProjectPreferenceStore();
    locationTypecheckEditor = new BooleanFieldEditor(LOCATION_TYPECHECK, "Enable location type checking", createContainer(parent));
    locationTypecheckEditor.setPreferenceStore(prefstore);
    locationTypecheckEditor.load();
    typeCheckProductsEditor = new BooleanFieldEditor(PRODUCT_TYPECHECK, "Enable products type checking", createContainer(parent));
    typeCheckProductsEditor.setPreferenceStore(prefstore);
    typeCheckProductsEditor.load();
    final Composite locationTypeOverlayContainer = createContainer(parent);
    locationTypeOverlayEditor = new BooleanFieldEditor(LOCATION_TYPE_OVERLAY, "Show overlays", locationTypeOverlayContainer);
    locationTypeOverlayEditor.setPreferenceStore(prefstore);
    locationTypeOverlayEditor.load();
    final Composite defaultLocationContainer = createContainer(parent);
    defaultLocationTypeEditor = createComboFieldEditor(defaultLocationContainer, DEFAULT_LOCATION_TYPE, "Default location type", (Object[]) LocationType.ALLUSERTYPES);
    final Composite locationTypePrecisionContainer = createContainer(parent);
    locationTypePrecisionEditor = createComboFieldEditor(locationTypePrecisionContainer, LOCATION_TYPE_PRECISION, "Location type precision", (Object[]) LocationTypingPrecision.values());
    if (!locationTypecheckEditor.getBooleanValue()) {
        defaultLocationTypeEditor.setEnabled(false, defaultLocationContainer);
        locationTypePrecisionEditor.setEnabled(false, locationTypePrecisionContainer);
        locationTypeOverlayEditor.setEnabled(false, locationTypeOverlayContainer);
    }
    locationTypecheckEditor.setPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent event) {
            boolean b = (Boolean) event.getNewValue();
            defaultLocationTypeEditor.setEnabled(b, defaultLocationContainer);
            locationTypePrecisionEditor.setEnabled(b, locationTypePrecisionContainer);
            locationTypeOverlayEditor.setEnabled(b, locationTypeOverlayContainer);
        }
    });
    return parent;
}
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) BooleanFieldEditor(org.eclipse.jface.preference.BooleanFieldEditor)

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