Search in sources :

Example 1 with IPropertyChangeListener

use of org.eclipse.jface.util.IPropertyChangeListener in project tdi-studio-se by Talend.

the class DragAndDrogDialog method createDialogArea.

/*
     * (non-Javadoc) Method declared on Dialog.
     */
protected Control createDialogArea(Composite parent) {
    // create composite
    Composite composite = (Composite) super.createDialogArea(parent);
    // composite.setLayout(new GridLayout());
    // String[][] namevalues = new String[][] { { "Create as sub-element of target node", CREATE_AS_SUBELEMENT },
    // { "Create as attribute of target node", CREATE_AS_ATTRIBUTE }, { "Add linker to target node", CREATE_AS_TEXT
    // } };
    String[][] namevalues = null;
    if (hasChildren) {
        namevalues = new String[][] { { "Create as sub-element of target node", CREATE_AS_SUBELEMENT }, { "Create as attribute of target node", CREATE_AS_ATTRIBUTE } };
    } else {
        namevalues = new String[][] { { "Create as sub-element of target node", CREATE_AS_SUBELEMENT }, { "Create as attribute of target node", CREATE_AS_ATTRIBUTE }, { "Add linker to target node", CREATE_AS_TEXT } };
    }
    RadioGroupFieldEditor rgfe = new RadioGroupFieldEditor("", "Select the operation:", 1, namevalues, composite, true);
    GridLayout layout = new GridLayout();
    layout.marginWidth = 12;
    composite.setLayout(layout);
    rgfe.setPropertyChangeListener(new IPropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent event) {
            value = event.getNewValue().toString();
        }
    });
    applyDialogFont(composite);
    return composite;
}
Also used : IPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) RadioGroupFieldEditor(org.eclipse.jface.preference.RadioGroupFieldEditor) GridLayout(org.eclipse.swt.layout.GridLayout) PropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent) Composite(org.eclipse.swt.widgets.Composite)

Example 2 with IPropertyChangeListener

use of org.eclipse.jface.util.IPropertyChangeListener in project translationstudio8 by heartsome.

the class PluginConfigManageDialog method createShortcutKeyGoup.

/**
	 * 创建快捷键面板
	 * @param tparent
	 *            ;
	 */
private void createShortcutKeyGoup(Composite tparent) {
    Group group = new Group(tparent, SWT.None);
    group.setText(Messages.getString("dialog.PluginConfigManageDialog.group"));
    GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(group);
    GridLayoutFactory.swtDefaults().numColumns(2).applyTo(group);
    Label keyLbl = new Label(group, SWT.NONE);
    keyLbl.setText(Messages.getString("dialog.PluginConfigManageDialog.keyLbl"));
    keyTxt = new Text(group, SWT.BORDER);
    GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(keyTxt);
    fKeySequenceText = new KeySequenceText(keyTxt);
    fKeySequenceText.setKeyStrokeLimit(4);
    fKeySequenceText.addPropertyChangeListener(new IPropertyChangeListener() {

        public final void propertyChange(final PropertyChangeEvent event) {
            if (!event.getOldValue().equals(event.getNewValue())) {
                final KeySequence keySequence = fKeySequenceText.getKeySequence();
                if (!keySequence.isComplete()) {
                    return;
                }
                keyTxt.setSelection(keyTxt.getTextLimit());
            }
        }
    });
}
Also used : IPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) Group(org.eclipse.swt.widgets.Group) PropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent) Label(org.eclipse.swt.widgets.Label) KeySequenceText(org.eclipse.jface.bindings.keys.KeySequenceText) Text(org.eclipse.swt.widgets.Text) KeySequenceText(org.eclipse.jface.bindings.keys.KeySequenceText) KeySequence(org.eclipse.jface.bindings.keys.KeySequence)

Example 3 with IPropertyChangeListener

use of org.eclipse.jface.util.IPropertyChangeListener in project cubrid-manager by CUBRID.

the class ChartCompositePart method createSeriesList.

/**
	 * Create the sub composite of Series selection combo and its related
	 * properties such as check and color
	 *
	 * @param composite the parent composite
	 */
private void createSeriesList(Composite composite) {
    Composite comp = new Composite(composite, SWT.NONE);
    GridLayout layout = new GridLayout(3, false);
    comp.setLayout(layout);
    comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    combo = new Combo(comp, SWT.DROP_DOWN);
    for (Map.Entry<String, String> entry : valueMap.entrySet()) {
        combo.add(entry.getKey());
    }
    combo.setLayout(new GridLayout());
    combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    combo.addSelectionListener(new SelectionAdapter() {

        /**
			 * Sent when selection occurs in the control.
			 *
			 * @param event an event containing information about the selection
			 */
        public void widgetSelected(SelectionEvent event) {
            widgetDefaultSelected(event);
        }

        /**
			 * Sent when default selection occurs in the control.
			 *
			 * @param event an event containing information about the default
			 *        selection
			 */
        public void widgetDefaultSelected(SelectionEvent event) {
            String selectedItem = combo.getItem(combo.getSelectionIndex());
            boolean checked = settingMap.get(selectedItem).isChecked();
            RGB rgb = settingMap.get(selectedItem).getSeriesRgb();
            checkBtn.setSelection(checked);
            colorField.getColorSelector().setColorValue(rgb);
        }
    });
    checkBtn = new Button(comp, SWT.CHECK);
    checkBtn.setText(Messages.seriesSelectCheckBtn);
    checkBtn.addSelectionListener(new SelectionAdapter() {

        /**
			 * Sent when selection occurs in the control.
			 *
			 * @param event an event containing information about the selection
			 */
        public void widgetSelected(SelectionEvent event) {
            widgetDefaultSelected(event);
        }

        /**
			 * Sent when default selection occurs in the control.
			 *
			 * @param event an event containing information about the default
			 *        selection
			 */
        public void widgetDefaultSelected(SelectionEvent event) {
            handleUpdateSettingChange();
        }
    });
    Composite selComp = new Composite(comp, SWT.NONE);
    colorField = new ColorFieldEditor(Messages.seriesSelectColorBtnName, Messages.seriesSelectColorBtnLbl, selComp);
    colorField.getColorSelector().addListener(new IPropertyChangeListener() {

        /**
			 * Notification that a property has changed.
			 *
			 * @param event the property change event object describing which
			 *        property changed and how
			 */
        public void propertyChange(PropertyChangeEvent event) {
            handleUpdateSettingChange();
        }
    });
}
Also used : IPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) PropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent) Composite(org.eclipse.swt.widgets.Composite) ChartComposite(org.jfree.experimental.chart.swt.ChartComposite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Combo(org.eclipse.swt.widgets.Combo) RGB(org.eclipse.swt.graphics.RGB) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) ColorFieldEditor(org.eclipse.jface.preference.ColorFieldEditor) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Map(java.util.Map) TreeMap(java.util.TreeMap)

Example 4 with IPropertyChangeListener

use of org.eclipse.jface.util.IPropertyChangeListener in project eclipse.platform.text by eclipse.

the class EditorsPlugin method start.

@Override
public void start(BundleContext context) throws Exception {
    super.start(context);
    if (PlatformUI.isWorkbenchRunning()) {
        fThemeListener = new IPropertyChangeListener() {

            @Override
            public void propertyChange(PropertyChangeEvent event) {
                if (IThemeManager.CHANGE_CURRENT_THEME.equals(event.getProperty()))
                    EditorsPluginPreferenceInitializer.setThemeBasedPreferences(getPreferenceStore(), true);
            }
        };
        PlatformUI.getWorkbench().getThemeManager().addPropertyChangeListener(fThemeListener);
    }
}
Also used : IPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) PropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent)

Example 5 with IPropertyChangeListener

use of org.eclipse.jface.util.IPropertyChangeListener in project eclipse.platform.text by eclipse.

the class TemplateStore method startListeningForPreferenceChanges.

/**
 * Starts listening for property changes on the preference store. If the configured preference
 * key changes, the template store is {@link #load() reloaded}. Call
 * {@link #stopListeningForPreferenceChanges()} to remove any listener and stop the
 * auto-updating behavior.
 *
 * @since 3.2
 */
public final void startListeningForPreferenceChanges() {
    if (fPropertyListener == null) {
        fPropertyListener = new IPropertyChangeListener() {

            @Override
            public void propertyChange(PropertyChangeEvent event) {
                /*
					 * Don't load if we are in the process of saving ourselves. We are in sync anyway after the
					 * save operation, and clients may trigger reloading by listening to preference store
					 * updates.
					 */
                if (!fIgnorePreferenceStoreChanges && fKey.equals(event.getProperty()))
                    try {
                        load();
                    } catch (IOException x) {
                        handleException(x);
                    }
            }
        };
        fPreferenceStore.addPropertyChangeListener(fPropertyListener);
    }
}
Also used : IPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) PropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent) IOException(java.io.IOException)

Aggregations

IPropertyChangeListener (org.eclipse.jface.util.IPropertyChangeListener)128 PropertyChangeEvent (org.eclipse.jface.util.PropertyChangeEvent)122 Composite (org.eclipse.swt.widgets.Composite)56 GridData (org.eclipse.swt.layout.GridData)45 Label (org.eclipse.swt.widgets.Label)40 GridLayout (org.eclipse.swt.layout.GridLayout)38 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 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)10 ISelection (org.eclipse.jface.viewers.ISelection)10 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)10 SashForm (org.eclipse.swt.custom.SashForm)10