List of usage examples for org.eclipse.jface.util PropertyChangeEvent getOldValue
public Object getOldValue()
From source file:au.gov.ga.earthsci.common.ui.color.ColorMapEditor.java
License:Apache License
private void wireMapListeners() { map.addPropertyChangeListener(MutableColorMap.COLOR_MAP_ENTRY_CHANGE_EVENT, new PropertyChangeListener() { @Override/*from w w w.ja va 2 s.c o m*/ public void propertyChange(java.beans.PropertyChangeEvent evt) { Display.getCurrent().asyncExec(new Runnable() { @Override public void run() { entriesTable.refresh(); populateColors(); gradientCanvas.redraw(); } }); } }); map.addPropertyChangeListener(MutableColorMap.ENTRY_MOVED_EVENT, new PropertyChangeListener() { @SuppressWarnings("unchecked") @Override public void propertyChange(java.beans.PropertyChangeEvent evt) { Entry<Double, Color> oldEntry = (Entry<Double, Color>) evt.getOldValue(); Entry<Double, Color> newEntry = (Entry<Double, Color>) evt.getNewValue(); if (currentEntryValue == null || oldEntry.getKey().equals(currentEntryValue)) { currentEntryValue = newEntry.getKey(); entriesTable.refresh(); selectTableEntry(newEntry); } } }); map.addPropertyChangeListener(MutableColorMap.ENTRY_ADDED_EVENT, new PropertyChangeListener() { @Override public void propertyChange(java.beans.PropertyChangeEvent evt) { @SuppressWarnings("unchecked") Entry<Double, Color> newEntry = (Entry<Double, Color>) evt.getNewValue(); final Marker newMarker = addMarker(newEntry); Display.getCurrent().asyncExec(new Runnable() { @Override public void run() { markerCanvas.redraw(newMarker.bounds.x, newMarker.bounds.y, newMarker.bounds.width, newMarker.bounds.height, true); }; }); } }); map.addPropertyChangeListener(MutableColorMap.MODE_CHANGE_EVENT, new PropertyChangeListener() { @Override public void propertyChange(java.beans.PropertyChangeEvent evt) { Display.getCurrent().asyncExec(new Runnable() { @Override public void run() { populateColors(); gradientCanvas.redraw(); modeCombo.setSelection(new StructuredSelection(map.getMode())); }; }); } }); map.addPropertyChangeListener(MutableColorMap.NODATA_CHANGE_EVENT, new PropertyChangeListener() { @Override public void propertyChange(java.beans.PropertyChangeEvent evt) { updateNodataEditorFromMap(); if (map.getMode() == InterpolationMode.EXACT_MATCH) { Display.getCurrent().asyncExec(new Runnable() { @Override public void run() { populateColors(); gradientCanvas.redraw(); } }); } } }); }
From source file:carisma.ui.eclipse.preferences.pages.Carisma_index.java
License:Open Source License
/** * //from w w w . jav a 2 s . co m * @param composite the composite */ private void selectEditor(final Composite composite) { this.editors = new EditorRadioGroupFieldEditor(Constants.EDITOR_SELECTION_ART, "Open a Model with", 1, new String[][] { { "&Editor selection combo box", Constants.MANUALLY }, { "&Use editor priority list", Constants.AUTO }, }, composite, true, getPreferenceStore().getString(Constants.EDITOR_SELECTION_ART)); this.editors.setPage(this); this.editors.setPreferenceStore(getPreferenceStore()); this.editors.load(); this.edGroup = new Group(composite, SWT.NONE); this.list = new EditorPriorityList(Constants.EDITORS_LIST, "Editor priority list", this.edGroup); this.list.setPage(this); this.list.setPreferenceStore(getPreferenceStore()); this.list.load(); selectionArtChanged(getPreferenceStore().getString(Constants.EDITOR_SELECTION_ART)); this.editors.setPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(final PropertyChangeEvent event) { if (!event.getNewValue().toString().equals(event.getOldValue().toString())) { // updateApplyButton(); String newSelectionIdValue = event.getNewValue().toString(); Carisma_index.this.editors.setEditorSelectionId(newSelectionIdValue); selectionArtChanged(newSelectionIdValue); } } }); }
From source file:chuck.terran.admin.ui.jface.LineFieldEditor.java
License:Open Source License
/** * Returns the change button for this field editor. * * @param parent/*from w ww .jav a 2 s . co m*/ * The control to create the button in if required. * @return the change button */ protected Button getChangeControl(Composite parent) { if (lineSelector == null) { lineSelector = new LineSelector(parent); lineSelector.addListener(new IPropertyChangeListener() { // forward the property change of the color selector @Override public void propertyChange(PropertyChangeEvent event) { LineFieldEditor.this.fireValueChanged(event.getProperty(), event.getOldValue(), event.getNewValue()); setPresentsDefaultValue(false); } }); } else { checkParent(lineSelector.getButton(), parent); } return lineSelector.getButton(); }
From source file:com.agynamix.platform.frontend.preferences.PlatformFieldEditorPreferencePage.java
License:Open Source License
public void propertyChange(PropertyChangeEvent event) { super.propertyChange(event); if (!event.getNewValue().equals(event.getOldValue())) { FieldEditor fe = (FieldEditor) event.getSource(); List<IPropertyChangeListener> l = listeners.get(fe); if (l != null) { for (IPropertyChangeListener listener : l) { listener.propertyChange(event); }/*from w w w . j ava 2s . c om*/ } // call IPreferenceDialogListeners for (IPreferenceDialogListener listener : preferenceDialogListeners) { listener.propertyChange(event); } } }
From source file:com.aptana.ide.logging.preferences.LoggingPreferenceWidget.java
License:Open Source License
/** * Creates appearance settings.//from ww w .ja v a 2 s. c om * @param parent - parent. */ private void createAppearance(Composite parent) { final Group appearanceGroup = new Group(parent, SWT.NONE); appearanceGroup.setLayout(new GridLayout(3, false)); appearanceGroup.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false)); appearanceGroup.setText(Messages.LoggingPreferenceWidget_1); Label label = new Label(appearanceGroup, SWT.NONE); label.setText(Messages.LoggingPreferenceWidget_CursorLineColor_Label); cursorLineColorSelector = new ColorSelector(appearanceGroup); cursorLineColorSelector.getButton() .setLayoutData(new GridData(SWT.LEFT, GridData.CENTER, false, false, 2, 1)); cursorLineColorSelector.setEnabled(true); cursorLineColorSelector.addListener(new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { RGB newRGB = (RGB) event.getNewValue(); if (!newRGB.equals(event.getOldValue())) { provider.setCursorLineColor(newRGB); } cursorLineColorSelector.setColorValue(newRGB); } }); label = new Label(appearanceGroup, SWT.NONE); label.setText(Messages.LoggingPreferenceWidget_TextForegroundColor_Label); textForegroundColorSelector = new ColorSelector(appearanceGroup); textForegroundColorSelector.getButton() .setLayoutData(new GridData(SWT.LEFT, GridData.CENTER, false, false, 2, 1)); textForegroundColorSelector.setEnabled(true); textForegroundColorSelector.addListener(new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { RGB newRGB = (RGB) event.getNewValue(); if (!newRGB.equals(event.getOldValue())) { provider.setTextForegroundColor(newRGB); } textForegroundColorSelector.setColorValue(newRGB); } }); label = new Label(appearanceGroup, SWT.LEFT | SWT.CENTER); label.setText(Messages.LoggingPreferenceWidget_Font_Label); label.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); fontStyleLabel = new Label(appearanceGroup, SWT.LEFT | SWT.CENTER); fontStyleLabel.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); final Button fontButton = new Button(appearanceGroup, SWT.NONE); fontButton.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { } public void widgetSelected(SelectionEvent e) { if (provider != null) { FontDialog dialog = new FontDialog(fontButton.getShell()); dialog.setFontList(getPreferences().getFontData()); if (dialog.open() != null) { FontData[] font = dialog.getFontList(); provider.setFont(font); if (font != null && font.length > 0) { String fontStr = font[0].getName() + "-" + font[0].getHeight(); //$NON-NLS-1$ fontStyleLabel.setText(fontStr); appearanceGroup.layout(true, true); } } } } }); fontButton.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, false, false)); fontButton.setText(Messages.LoggingPreferenceWidget_4); final Label charsetLabel = new Label(appearanceGroup, SWT.LEFT | SWT.CENTER); charsetLabel.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); charsetLabel.setText(Messages.LoggingPreferenceWidget_5); charsetCombo = new Combo(appearanceGroup, SWT.LEFT | SWT.CENTER | SWT.READ_ONLY); charsetCombo.setLayoutData(new GridData(SWT.LEFT, GridData.CENTER, false, false, 2, 1)); Collection<String> charsets = Charset.availableCharsets().keySet(); String[] items = new String[charsets.size()]; charsets.toArray(items); charsetCombo.setItems(items); charsetCombo.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { } public void widgetSelected(SelectionEvent e) { if (provider != null) { String selected = charsetCombo.getItem(charsetCombo.getSelectionIndex()); provider.setDefaultEncoding(selected); } } }); }
From source file:com.bdaum.zoom.ui.internal.preferences.KeyPreferencePage.java
License:Open Source License
@SuppressWarnings("unused") private void createDefinitionArea(Composite parent) { final Composite composite = new Composite(parent, SWT.NONE); composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); composite.setLayout(new GridLayout(2, false)); new Label(composite, SWT.NONE).setText(Messages.getString("KeyPreferencePage.command2")); //$NON-NLS-1$ nameField = new Text(composite, SWT.SINGLE | SWT.LEAD | SWT.BORDER | SWT.READ_ONLY); nameField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); new Label(composite, SWT.NONE).setText(Messages.getString("KeyPreferencePage.description")); //$NON-NLS-1$ descriptionField = new Text(composite, SWT.MULTI | SWT.LEAD | SWT.BORDER | SWT.READ_ONLY | SWT.WRAP); GridData layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false); layoutData.heightHint = 50;// w w w . jav a 2 s .c o m descriptionField.setLayoutData(layoutData); new Label(composite, SWT.NONE).setText(Messages.getString("KeyPreferencePage.key_sequence")); //$NON-NLS-1$ Composite keyGroup = new Composite(composite, SWT.NONE); keyGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true)); GridLayout layout = new GridLayout(2, false); layout.marginHeight = 0; layout.marginWidth = 0; keyGroup.setLayout(layout); keyField = new Text(keyGroup, SWT.SINGLE | SWT.LEAD | SWT.BORDER); keyField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); keySequenceField = new KeySequenceText(keyField); keySequenceField.setKeyStrokeLimit(2); keySequenceField.addPropertyChangeListener(new IPropertyChangeListener() { public final void propertyChange(final PropertyChangeEvent event) { if (!event.getOldValue().equals(event.getNewValue())) { final KeySequence keySequence = keySequenceField.getKeySequence(); if (selectedCommand == null || !keySequence.isComplete()) return; boolean empty = keySequence.isEmpty(); Binding newBinding; Binding b = commandMap.get(selectedCommand.getId()); if (b != null) { if (!keySequence.equals(b.getTriggerSequence())) { newBinding = new KeyBinding(keySequence, empty ? null : b.getParameterizedCommand(), activeSchemeId, b.getContextId(), null, null, null, Binding.USER); userMap.remove(b.getTriggerSequence()); userMap.put(keySequence, newBinding); if (empty) commandMap.remove(selectedCommand.getId()); else commandMap.put(selectedCommand.getId(), newBinding); } } else if (!empty) { ParameterizedCommand pc = new ParameterizedCommand(selectedCommand, null); newBinding = new KeyBinding(keySequence, pc, activeSchemeId, "org.eclipse.ui.contexts.window", //$NON-NLS-1$ null, null, null, Binding.USER); userMap.put(keySequence, newBinding); commandMap.put(selectedCommand.getId(), newBinding); } refreshViewer(); doValidate(); keyField.setSelection(keyField.getTextLimit()); } } }); final Button helpButton = new Button(keyGroup, SWT.ARROW | SWT.LEFT); helpButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); helpButton.setToolTipText(Messages.getString("KeyPreferencePage.add_a_special_key")); //$NON-NLS-1$ // Arrow buttons aren't normally added to the tab list. Let's fix that. final Control[] tabStops = keyGroup.getTabList(); final ArrayList<Control> newTabStops = new ArrayList<Control>(); for (int i = 0; i < tabStops.length; i++) { Control tabStop = tabStops[i]; newTabStops.add(tabStop); if (keyField.equals(tabStop)) newTabStops.add(helpButton); } keyGroup.setTabList(newTabStops.toArray(new Control[newTabStops.size()])); // Construct the menu to attach to the above button. final Menu addKeyMenu = new Menu(helpButton); final Iterator<?> trappedKeyItr = KeySequenceText.TRAPPED_KEYS.iterator(); while (trappedKeyItr.hasNext()) { final KeyStroke trappedKey = (KeyStroke) trappedKeyItr.next(); final MenuItem menuItem = new MenuItem(addKeyMenu, SWT.PUSH); menuItem.setText(trappedKey.format()); menuItem.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { keySequenceField.insert(trappedKey); keyField.setFocus(); keyField.setSelection(keyField.getTextLimit()); } }); } helpButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent selectionEvent) { Point buttonLocation = helpButton.getLocation(); buttonLocation = composite.toDisplay(buttonLocation.x, buttonLocation.y); Point buttonSize = helpButton.getSize(); addKeyMenu.setLocation(buttonLocation.x, buttonLocation.y + buttonSize.y); addKeyMenu.setVisible(true); } }); new Label(composite, SWT.NONE); userLabel = new Label(composite, SWT.NONE); userLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); }
From source file:com.generalrobotix.ui.GrxPluginManager.java
License:Open Source License
@SuppressWarnings("unchecked") public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals("userItemChange")) { String newItemList = (String) event.getNewValue(); String[] newItems = newItemList.split(PreferenceConstants.SEPARATOR, -1); String oldItemList = (String) event.getOldValue(); String[] oldItems = oldItemList.split(PreferenceConstants.SEPARATOR, -1); IPreferenceStore store = Activator.getDefault().getPreferenceStore(); String userItemPathList = store .getString(PreferenceConstants.USERITEM + "." + PreferenceConstants.CLASSPATH); String[] userItemPath = userItemPathList.split(PreferenceConstants.SEPARATOR, -1); String userItemVisibleList = store .getString(PreferenceConstants.USERITEM + "." + PreferenceConstants.VISIBLE); String[] userItemVisible = userItemVisibleList.split(PreferenceConstants.SEPARATOR, -1); Vector<Integer> delList = new Vector<Integer>(); for (int i = 0; i < oldItems.length; i++) { boolean flg = false; for (String newItem : newItems) { if (newItem.equals(oldItems[i])) { flg = true;/*from w w w . j a v a 2 s .c o m*/ break; } } if (!flg && !oldItems[i].equals("")) delList.add(new Integer(i)); } OrderedHashMap modes = (OrderedHashMap) getItemMap(GrxModeInfoItem.class); for (Integer i : delList) { Class<? extends GrxBasePlugin> itemClass = null; try { itemClass = (Class<? extends GrxBasePlugin>) Class.forName(oldItems[i.intValue()], false, pluginLoader_); } catch (ClassNotFoundException e) { continue; } if (currentMode_.activeItemClassList_.contains(itemClass)) removeItems((Class<? extends GrxBaseItem>) itemClass); Iterator<GrxModeInfoItem> it = modes.values().iterator(); while (it.hasNext()) { GrxModeInfoItem mode = it.next(); if (mode.activeItemClassList_.contains(itemClass)) mode.activeItemClassList_.remove(itemClass); } } for (int i = 0; i < newItems.length; i++) { pluginLoader_.addURL(userItemPath[i]); Class<? extends GrxBasePlugin> itemClass = null; try { itemClass = (Class<? extends GrxBasePlugin>) Class.forName(newItems[i], false, pluginLoader_); } catch (ClassNotFoundException e) { continue; } Iterator<GrxModeInfoItem> it = modes.values().iterator(); while (it.hasNext()) { GrxModeInfoItem mode = it.next(); if (mode.activeItemClassList_.contains(itemClass)) { PluginInfo pi = pinfoMap_.get(itemClass); pi.visible = userItemVisible[i].equals("true") ? true : false; pinfoMap_.put(itemClass, pi); } else { if (pluginLoader_.existClass(newItems[i])) { Class<? extends GrxBasePlugin> plugin = registerPlugin(newItems[i]); if (plugin != null) { PluginInfo pi = pinfoMap_.get(plugin); pi.visible = userItemVisible[i].equals("true") ? true : false; pinfoMap_.put(plugin, pi); mode.addItemClassList(plugin); } } } } } } else if (event.getProperty().equals(PreferenceConstants.FONT_TABLE)) { Activator.getDefault().updateTableFont(); List<GrxBaseView> list = getViewList(); for (GrxBaseView v : list) { v.updateTableFont(); } } else if (event.getProperty().equals(PreferenceConstants.FONT_EDITER)) { Activator.getDefault().updateEditerFont(); List<GrxBaseView> list = getViewList(); for (GrxBaseView v : list) { v.updateEditerFont(); } } itemChange(currentMode_, CHANGE_MODE); }
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);//from w w w . ja v a 2 s. c o m 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.iw.plugins.spindle.core.TapestryCore.java
License:Mozilla Public License
public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(CACHE_GRAMMAR_PREFERENCE)) { boolean oldValue = ((Boolean) event.getOldValue()).booleanValue(); boolean newValue = ((Boolean) event.getNewValue()).booleanValue(); if (oldValue != newValue && !newValue) { // clear the cache if (!newValue) TapestryDOMParserConfiguration.clearCache(); // force full builds TapestryArtifactManager.getTapestryArtifactManager().invalidateBuildStates(); }//from w w w .j a v a2s.co m } }
From source file:com.iw.plugins.spindle.ui.util.PreferenceStoreWrapper.java
License:Mozilla Public License
public void propertyChange(PropertyChangeEvent event) { fPluginPreferences.firePropertyChangeEvent(event.getProperty(), event.getOldValue(), event.getNewValue()); }