org.eclipse.jface.util.IPropertyChangeListener Java Examples
The following examples show how to use
org.eclipse.jface.util.IPropertyChangeListener.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JavaOutlinePage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public JavaOutlinePage(String contextMenuID, JavaEditor editor) { super(); Assert.isNotNull(editor); fContextMenuID= contextMenuID; fEditor= editor; fTogglePresentation= new TogglePresentationAction(); fTogglePresentation.setEditor(editor); fPropertyChangeListener= new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { doPropertyChange(event); } }; JavaPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(fPropertyChangeListener); }
Example #2
Source File: PreferenceStoreAccessTest.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@Test public void testProjectScope() throws Exception { try { IProject project = IResourcesSetupUtil.createProject("test"); final List<String> keys = Lists.newArrayList(); preferenceStoreAccess.getContextPreferenceStore(project).addPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { keys.add(event.getProperty()); } }); getWritable().setValue("newValue", 1); assertEquals(0, keys.size()); preferenceStoreAccess.getWritablePreferenceStore(project).setValue("newValue", 2); assertEquals(1, keys.size()); assertEquals("newValue", keys.get(0)); assertEquals(1, getReadable().getInt("newValue")); assertEquals(2, preferenceStoreAccess.getContextPreferenceStore(project).getInt("newValue")); } finally { IResourcesSetupUtil.cleanWorkspace(); } }
Example #3
Source File: Activator.java From eclipse with Apache License 2.0 | 6 votes |
@Override public void start(BundleContext context) throws Exception { plugin = this; super.start(context); this.command = new BazelCommand(new BazelAspectLocationImpl(), new CommandConsoleFactoryImpl()); // Get the bazel path from the settings this.command.setBazelPath(getPreferenceStore().getString("BAZEL_PATH")); getPreferenceStore().addPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals("BAZEL_PATH")) { command.setBazelPath(event.getNewValue().toString()); } } }); }
Example #4
Source File: DeployConsolePageParticipant.java From google-cloud-eclipse with Apache License 2.0 | 6 votes |
@Override public void init(IPageBookViewPage page, IConsole console) { Preconditions.checkArgument(console instanceof DeployConsole, "console should be instance of %s", DeployConsole.class.getName()); this.console = (DeployConsole) console; console.addPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(DeployConsole.PROPERTY_JOB)) { // keep the order of adding a listener and then calling update() to ensure update // is called regardless of when the job finishes addJobChangeListener(); update(); } } }); IActionBars actionBars = page.getSite().getActionBars(); configureToolBar(actionBars.getToolBarManager()); // keep the order of adding a listener and then calling update() to ensure update // is called regardless of when the job finishes addJobChangeListener(); update(); }
Example #5
Source File: ProfileView.java From Pydev with Eclipse Public License 1.0 | 6 votes |
protected void addField(final FieldEditor editor, Composite parent, IPreferenceStore preferenceStore) { fields.add(editor); editor.setPreferenceStore(preferenceStore); editor.load(); editor.setPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { // Apply on any change! editor.store(); } }); if (editor instanceof BooleanFieldEditorCustom) { editor.fillIntoGrid(parent, 2); } else { editor.fillIntoGrid(parent, 1); } }
Example #6
Source File: FieldEditorWrapper.java From google-cloud-eclipse with Apache License 2.0 | 6 votes |
@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); 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; }
Example #7
Source File: AbstractViewInstance.java From neoscada with Eclipse Public License 1.0 | 6 votes |
private void attachVisibleExpression ( final ViewInstanceDescriptor descriptor, final IEvaluationService evaluationService ) { if ( descriptor.getVisibleExpression () != null ) { this.visibileRef = evaluationService.addEvaluationListener ( descriptor.getVisibleExpression (), new IPropertyChangeListener () { @Override public void propertyChange ( final PropertyChangeEvent event ) { if ( PROP_VISIBLE.equals ( event.getProperty () ) && event.getNewValue () instanceof Boolean ) { setVisibleState ( (Boolean)event.getNewValue () ); } } }, PROP_VISIBLE ); } else { setVisibleState ( true ); } }
Example #8
Source File: JavaNavigatorContentProvider.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public void init(ICommonContentExtensionSite commonContentExtensionSite) { IExtensionStateModel stateModel = commonContentExtensionSite .getExtensionStateModel(); IMemento memento = commonContentExtensionSite.getMemento(); fStateModel = stateModel; restoreState(memento); fLayoutPropertyListener = new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (Values.IS_LAYOUT_FLAT.equals(event.getProperty())) { if (event.getNewValue() != null) { boolean newValue = ((Boolean) event.getNewValue()) .booleanValue() ? true : false; setIsFlatLayout(newValue); } } } }; fStateModel.addPropertyChangeListener(fLayoutPropertyListener); IPreferenceStore store = PreferenceConstants.getPreferenceStore(); boolean showCUChildren = store .getBoolean(PreferenceConstants.SHOW_CU_CHILDREN); setProvideMembers(showCUChildren); }
Example #9
Source File: SyntaxColorerPreviewer.java From xds-ide with Eclipse Public License 1.0 | 6 votes |
public SyntaxColorerPreviewer(Composite parent, final IPreferenceStore preferenceStore) { super(parent, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY); this.preferenceStore = preferenceStore; this.setLayoutData(new GridData(GridData.FILL_BOTH)); Font font= JFaceResources.getTextFont(); this.setFont(font); defBackgroundColor = getEditorBackgroundColor(preferenceStore); this.setBackground(defBackgroundColor); prefListener = new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { try { // Widget may be disposed here defBackgroundColor = getEditorBackgroundColor(preferenceStore); setBackground(defBackgroundColor); updateColors(); } catch (Exception e) {} } }; preferenceStore.addPropertyChangeListener(prefListener); tokenManager = new TokenManager(); }
Example #10
Source File: ModulaReconciler.java From xds-ide with Eclipse Public License 1.0 | 6 votes |
/** * {@inheritDoc} */ @Override public void install(ITextViewer textViewer) { super.install(textViewer); propertyChangeListener = new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { boolean isEpeelingEnambed = SpellingService.PREFERENCE_SPELLING_ENABLED.equals(event.getProperty()) || SpellingService.PREFERENCE_SPELLING_ENGINE.equals(event.getProperty()); if (isEpeelingEnambed) { forceReconciling(); } } }; EditorsUI.getPreferenceStore().addPropertyChangeListener(propertyChangeListener); }
Example #11
Source File: MinimapOverviewRuler.java From Pydev with Eclipse Public License 1.0 | 6 votes |
private Color getSelectionColor() { if (selectionColor == null || selectionColor.isDisposed()) { preferenceStore = SharedUiPlugin.getDefault().getPreferenceStore(); fillSelectionColorField(); this.listener = new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (MinimapOverviewRulerPreferencesPage.MINIMAP_SELECTION_COLOR.equals(event.getProperty())) { selectionColor.dispose(); selectionColor = null; fillSelectionColorField(); } } }; preferenceStore.addPropertyChangeListener(listener); } return selectionColor; }
Example #12
Source File: PyMergeViewer.java From Pydev with Eclipse Public License 1.0 | 6 votes |
@Override protected void handleDispose(DisposeEvent event) { super.handleDispose(event); List<ColorAndStyleCache> colorCache = getColorCache(); for (ColorAndStyleCache c : colorCache) { c.dispose(); } colorCache.clear(); List<IPropertyChangeListener> prefChangeListeners = getPrefChangeListeners(); for (IPropertyChangeListener l : prefChangeListeners) { PyDevUiPrefs.getChainedPrefStore().removePropertyChangeListener(l); } prefChangeListeners.clear(); }
Example #13
Source File: ModelEditorPreferencePage.java From tlaplus with MIT License | 6 votes |
public ModelEditorPreferencePage() { super(GRID); // Copy preference value to non-ui plugin. TLCUIActivator.getDefault().getPreferenceStore().addPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { final IPreferenceStore store = TLCActivator.getDefault().getPreferenceStore(); if (TLCActivator.I_TLC_SNAPSHOT_KEEP_COUNT.equals(event.getProperty())) { store.setValue(TLCActivator.I_TLC_SNAPSHOT_KEEP_COUNT, (int)event.getNewValue()); } } }); setPreferenceStore(TLCUIActivator.getDefault().getPreferenceStore()); setDescription("Model Editor preferences"); }
Example #14
Source File: KeyController2.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
private void addSetBindingListener() { addPropertyChangeListener(new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (event.getSource() == bindingModel && CommonModel.PROP_SELECTED_ELEMENT.equals(event.getProperty())) { BindingElement binding = (BindingElement) event.getNewValue(); // Bug #2740 if (binding == null || binding.getTrigger() == null) { conflictModel.setSelectedElement(null); return; } conflictModel.setSelectedElement(binding); ContextElement context = binding.getContext(); if (context != null) { contextModel.setSelectedElement(context); } } } }); }
Example #15
Source File: KeyController2.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
private void addSetKeySequenceListener() { addPropertyChangeListener(new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (BindingElement.PROP_TRIGGER.equals(event.getProperty())) { // Bug #2740 if (((KeySequence) event.getNewValue()) != null) { if (((KeySequence) event.getNewValue()).toString().endsWith("+")) { return; } else { updateTrigger((BindingElement) event.getSource(), (KeySequence) event.getOldValue(), (KeySequence) event.getNewValue()); } } } } }); }
Example #16
Source File: PydevPlugin.java From Pydev with Eclipse Public License 1.0 | 6 votes |
/** * @return */ public static ColorCache getColorCache() { PydevPlugin plugin = getDefault(); if (plugin.colorCache == null) { final IPreferenceStore chainedPrefStore = PyDevUiPrefs.getChainedPrefStore(); plugin.colorCache = new ColorCache(chainedPrefStore) { { chainedPrefStore.addPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (fNamedColorTable.containsKey(event.getProperty())) { reloadProperty(event.getProperty()); } } }); } }; } return plugin.colorCache; }
Example #17
Source File: KeyController2.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
private void addSetBindingListener() { addPropertyChangeListener(new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (event.getSource() == bindingModel && CommonModel.PROP_SELECTED_ELEMENT.equals(event.getProperty())) { BindingElement binding = (BindingElement) event.getNewValue(); // Bug #2740 if (binding == null || binding.getTrigger() == null) { conflictModel.setSelectedElement(null); return; } conflictModel.setSelectedElement(binding); ContextElement context = binding.getContext(); if (context != null) { contextModel.setSelectedElement(context); } } } }); }
Example #18
Source File: ProfileManager.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
public void setSelected(IProject project, IProfile profile) { final IProfile newSelected = fProfiles.get(profile.getID()); IProfile prevSelected = getSelected(project); if (newSelected != null && !newSelected.equals(prevSelected)) { PropertyChangeEvent event = new PropertyChangeEvent(this, PROFILE_SELECTED, prevSelected, newSelected); fSelected.put(project, newSelected); Object[] allListeners = listeners.getListeners(); for (Object listener : allListeners) { ((IPropertyChangeListener) listener).propertyChange(event); } } }
Example #19
Source File: JavaPlugin.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public void start(BundleContext context) throws Exception { super.start(context); fBundleContext= context; WorkingCopyOwner.setPrimaryBufferProvider(new WorkingCopyOwner() { @Override public IBuffer createBuffer(ICompilationUnit workingCopy) { ICompilationUnit original= workingCopy.getPrimary(); IResource resource= original.getResource(); if (resource instanceof IFile) return new DocumentAdapter(workingCopy, (IFile) resource); return DocumentAdapter.NULL; } }); ensurePreferenceStoreBackwardsCompatibility(); // make sure org.eclipse.jdt.core.manipulation is loaded too // can be removed if JavaElementPropertyTester is moved down to jdt.core (bug 127085) JavaManipulation.class.toString(); if (PlatformUI.isWorkbenchRunning()) { // Initialize AST provider getASTProvider(); fThemeListener= new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (IThemeManager.CHANGE_CURRENT_THEME.equals(event.getProperty())) JavaUIPreferenceInitializer.setThemeBasedPreferences(PreferenceConstants.getPreferenceStore(), true); } }; PlatformUI.getWorkbench().getThemeManager().addPropertyChangeListener(fThemeListener); new InitializeAfterLoadJob().schedule(); // last call in start, see bug 191193 } }
Example #20
Source File: CppcheclipsePlugin.java From cppcheclipse with Apache License 2.0 | 5 votes |
public void propertyChange(PropertyChangeEvent event) { if (IPreferenceConstants.P_BINARY_PATH.equals(event .getProperty())) { for (IPropertyChangeListener binaryPathChangeListener : binaryPathChangeListeners) { binaryPathChangeListener.propertyChange(event); } } }
Example #21
Source File: ProjectionViewerExt.java From goclipse with Eclipse Public License 1.0 | 5 votes |
/** * Add given {@link IPropertyChangeListener} to given store. * The listener will be automatically removed if viewer is unconfigured or disposed. */ public void addConfigurationScoped_PrefStoreListener(IPreferenceStore prefStore, IPropertyChangeListener propertyChangeListener) { prefStore.addPropertyChangeListener(propertyChangeListener); addConfigurationOwned(new IDisposable() { @Override public void dispose() { prefStore.removePropertyChangeListener(propertyChangeListener); } }); }
Example #22
Source File: CommandDataStore.java From EasyShell with Eclipse Public License 2.0 | 5 votes |
public CommandDataStore(IPreferenceStore store) { super(store); store.addPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(Constants.PREF_COMMANDS_USER) || event.getProperty().equals(Constants.PREF_COMMANDS_PRESET) || event.getProperty().equals(Constants.PREF_COMMANDS_MODIFY) ) { load(); } } }); load(); }
Example #23
Source File: JavaEditor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * {@inheritDoc} */ public void firePropertyChangeEvent(String name, Object oldValue, Object newValue) { PropertyChangeEvent event= new PropertyChangeEvent(this, name, oldValue, newValue); Object[] listeners= fListeners.getListeners(); for (int i= 0; i < listeners.length; i++) ((IPropertyChangeListener) listeners[i]).propertyChange(event); }
Example #24
Source File: PyEdit.java From Pydev with Eclipse Public License 1.0 | 5 votes |
public static IPropertyChangeListener createPrefChangeListener( final IPySyntaxHighlightingAndCodeCompletionEditor editor) { return new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { try { String property = event.getProperty(); //tab width if (property.equals(PyDevCoreEditorPreferences.TAB_WIDTH)) { onTabSettingsChanged(editor); } else if (property.equals(PyDevCoreEditorPreferences.SUBSTITUTE_TABS)) { onTabSettingsChanged(editor); //auto adjust for file tabs } else if (property.equals(PyDevCoreEditorPreferences.GUESS_TAB_SUBSTITUTION)) { onTabSettingsChanged(editor); //colors and styles } else if (ColorAndStyleCache.isColorOrStyleProperty(property)) { editor.getColorCache().reloadProperty(property); //all reference this cache editor.getEditConfiguration().updateSyntaxColorAndStyle(); //the style needs no reloading ((ISourceViewer) editor.getEditorSourceViewer()).invalidateTextPresentation(); } } catch (Exception e) { Log.log(e); } } }; }
Example #25
Source File: PreferencesAdapter.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * {@inheritDoc} */ public void firePropertyChangeEvent(String name, Object oldValue, Object newValue) { if (!fSilent) { final PropertyChangeEvent event= new PropertyChangeEvent(this, name, oldValue, newValue); Object[] listeners= fListeners.getListeners(); for (int i= 0; i < listeners.length; i++) { final IPropertyChangeListener listener= (IPropertyChangeListener)listeners[i]; Runnable runnable= new Runnable() { public void run() { listener.propertyChange(event); } }; if (Display.getCurrent() != null) runnable.run(); else { // Post runnable into UI thread Shell shell= JavaPlugin.getActiveWorkbenchShell(); Display display; if (shell != null) display= shell.getDisplay(); else display= Display.getDefault(); display.asyncExec(runnable); } } } }
Example #26
Source File: KeyController2.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
private void addSetSchemeListener() { addPropertyChangeListener(new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (event.getSource() == fSchemeModel && CommonModel.PROP_SELECTED_ELEMENT.equals(event.getProperty())) { changeScheme((SchemeElement) event.getOldValue(), (SchemeElement) event.getNewValue()); } } }); }
Example #27
Source File: DialogArea.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
protected void firePropertyChangeChange(String property, Object oldValue, Object newValue) { PropertyChangeEvent event = new PropertyChangeEvent(this, property, oldValue, newValue); for (Iterator iter = listeners.iterator(); iter.hasNext();) { IPropertyChangeListener listener = (IPropertyChangeListener) iter.next(); listener.propertyChange(event); } }
Example #28
Source File: KeyController2.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
private void addSetModelObjectListener() { addPropertyChangeListener(new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (event.getSource() instanceof BindingElement && ModelElement.PROP_MODEL_OBJECT.equals(event.getProperty())) { if (event.getNewValue() != null) { BindingElement element = (BindingElement) event.getSource(); Object oldValue = event.getOldValue(); Object newValue = event.getNewValue(); // Bug #2740 快捷键--快捷键设置问题 if (oldValue instanceof Binding && newValue instanceof Binding) { conflictModel.updateConflictsFor(element, ((Binding) oldValue).getTriggerSequence(), ((Binding) newValue).getTriggerSequence(), false); } else if (oldValue instanceof Binding) { conflictModel.updateConflictsFor(element, ((Binding) oldValue).getTriggerSequence(), null, false); } else if (newValue instanceof Binding) { conflictModel.updateConflictsFor(element, null, ((Binding) newValue).getTriggerSequence(), false); } else { conflictModel.updateConflictsFor(element, false); } ContextElement context = element.getContext(); if (context != null) { contextModel.setSelectedElement(context); } } } } }); }
Example #29
Source File: SpinnerTable.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * Fire the event when the year value change * * @param e */ public void firePropertyListener( PropertyChangeEvent e ) { int size = listenerList.size( ); for ( int i = 0; i < size; i++ ) { IPropertyChangeListener listener = (IPropertyChangeListener) listenerList.get( i ); listener.propertyChange( e ); } }
Example #30
Source File: KeyController2.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
private void addSetSchemeListener() { addPropertyChangeListener(new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (event.getSource() == fSchemeModel && CommonModel.PROP_SELECTED_ELEMENT.equals(event.getProperty())) { changeScheme((SchemeElement) event.getOldValue(), (SchemeElement) event.getNewValue()); } } }); }