Java Code Examples for org.eclipse.jface.util.PropertyChangeEvent#getProperty()
The following examples show how to use
org.eclipse.jface.util.PropertyChangeEvent#getProperty() .
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: CommonOutlinePage.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
public void propertyChange(PropertyChangeEvent event) { String property = event.getProperty(); if (property.equals(IPreferenceConstants.LINK_OUTLINE_WITH_EDITOR)) { boolean isLinked = Boolean.parseBoolean(StringUtil.getStringValue(event.getNewValue())); fToggleLinkingAction.setChecked(isLinked); TreeViewer viewer = getTreeViewer(); if (isLinked) { setEditorSelection((IStructuredSelection) viewer.getSelection(), false); } } else if (property.equals(IPreferenceConstants.SORT_OUTLINE_ALPHABETIC)) { boolean sort = Boolean.parseBoolean(StringUtil.getStringValue(event.getNewValue())); getTreeViewer().setComparator(sort ? new ViewerComparator() : null); } }
Example 2
Source File: SemanticHighlightings.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
/** * Tests whether <code>event</code> in <code>store</code> affects the * enablement of semantic highlighting. * * @param store the preference store where <code>event</code> was observed * @param event the property change under examination * @return <code>true</code> if <code>event</code> changed semantic * highlighting enablement, <code>false</code> if it did not * @since 3.1 */ public static boolean affectsEnablement(IPreferenceStore store, PropertyChangeEvent event) { String relevantKey= null; SemanticHighlighting[] highlightings= getSemanticHighlightings(); for (int i= 0; i < highlightings.length; i++) { if (event.getProperty().equals(getEnabledPreferenceKey(highlightings[i]))) { relevantKey= event.getProperty(); break; } } if (relevantKey == null) return false; for (int i= 0; i < highlightings.length; i++) { String key= getEnabledPreferenceKey(highlightings[i]); if (key.equals(relevantKey)) continue; if (store.getBoolean(key)) return false; // another is still enabled or was enabled before } // all others are disabled, so toggling relevantKey affects the enablement return true; }
Example 3
Source File: MatchViewPart.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
public void propertyChange(PropertyChangeEvent event) { if (gridTable == null || gridTable.isDisposed()) { return; } String property = event.getProperty(); if (net.heartsome.cat.ts.ui.Constants.MATCH_VIEWER_TEXT_FONT.equals(property)) { Font font = JFaceResources.getFont(net.heartsome.cat.ts.ui.Constants.MATCH_VIEWER_TEXT_FONT); sourceColunmCellRenderer.setFont(font); targetColumnCellRenderer.setFont(font); GridData sTextGd = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1); sourceText.getTextWidget().setFont(font); int lineH = sourceText.getTextWidget().getLineHeight() * 2; sTextGd.heightHint = lineH; sTextGd.minimumHeight = lineH; sourceText.getTextWidget().setLayoutData(sTextGd); gridTable.redraw(); sourceText.getTextWidget().getParent().layout(); } }
Example 4
Source File: XLIFFEditorImplWithNatTable.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
public void propertyChange(PropertyChangeEvent event) { if (table == null || table.isDisposed()) { return; } String property = event.getProperty(); if (net.heartsome.cat.ts.ui.Constants.XLIFF_EDITOR_TEXT_FONT.equals(property)) { Font font = JFaceResources.getFont(net.heartsome.cat.ts.ui.Constants.XLIFF_EDITOR_TEXT_FONT); ICellPainter cellPainter = table.getConfigRegistry().getConfigAttribute( CellConfigAttributes.CELL_PAINTER, DisplayMode.NORMAL, SOURCE_EDIT_CELL_LABEL); if (cellPainter instanceof TextPainterWithPadding) { TextPainterWithPadding textPainter = (TextPainterWithPadding) cellPainter; if (textPainter.getFont() == null || !textPainter.getFont().equals(font)) { HsMultiActiveCellEditor.commit(true); textPainter.setFont(font); autoResize(); // HsMultiCellEditorControl.activeSourceAndTargetCell(XLIFFEditorImplWithNatTable.this); } } } }
Example 5
Source File: XbaseEditor.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@Override protected void handlePreferenceStoreChanged(PropertyChangeEvent event) { super.handlePreferenceStoreChanged(event); String property = event.getProperty(); if (property.equals(org.eclipse.jdt.ui.PreferenceConstants.EDITOR_FOLDING_ENABLED)) { ProjectionViewer projectionViewer = (ProjectionViewer) getSourceViewer(); if (event.getNewValue() != null && Boolean.valueOf(event.getNewValue().toString())) { if (!projectionViewer.isProjectionMode()) { installFoldingSupport(projectionViewer); } } else { if (projectionViewer.isProjectionMode()) { uninstallFoldingSupport(); projectionViewer.disableProjection(); } } } }
Example 6
Source File: Preferences.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
/** * @see IPropertyChangeListener#propertyChange(PropertyChangeEvent) */ public void propertyChange(PropertyChangeEvent event) { String property = event.getProperty(); if (property == ISVNUIConstants.PREF_SVNINTERFACE) { String newValue = (String)event.getNewValue(); setSvnClientInterface(newValue); } if (property == ISVNUIConstants.PREF_SVNCONFIGDIR) { String configDir = (String)event.getNewValue(); setSvnClientConfigDir(configDir); } if (property == ISVNUIConstants.PREF_FETCH_CHANGE_PATH_ON_DEMAND) { boolean fetchChangePathOnDemand = ((Boolean) event.getNewValue()).booleanValue(); setSvnChangePathOnDemand(fetchChangePathOnDemand); } }
Example 7
Source File: PreferenceStoreIndentationInformation.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Override public synchronized void propertyChange(PropertyChangeEvent event) { String property = event.getProperty(); if (AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH.equals(property) || AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS.equals(property)) { indentString = null; } }
Example 8
Source File: WorkingSetActionProvider.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
public void propertyChange(PropertyChangeEvent event) { String property = event.getProperty(); Object newValue = event.getNewValue(); Object oldValue = event.getOldValue(); String newLabel = null; if (IWorkingSetManager.CHANGE_WORKING_SET_REMOVE.equals(property) && oldValue == workingSet) { newLabel = ""; //$NON-NLS-1$ setWorkingSet(null); } else if (IWorkingSetManager.CHANGE_WORKING_SET_NAME_CHANGE.equals(property) && newValue == workingSet) { newLabel = workingSet.getLabel(); } else if (IWorkingSetManager.CHANGE_WORKING_SET_CONTENT_CHANGE.equals(property) && newValue == workingSet) { if (workingSet.isAggregateWorkingSet() && workingSet.isEmpty()) { // act as if the working set has been made null if (!emptyWorkingSet) { emptyWorkingSet = true; setWorkingSetFilter(null); newLabel = null; } } else { // we've gone from empty to non-empty on our set. // Restore it. if (emptyWorkingSet) { emptyWorkingSet = false; setWorkingSetFilter(workingSet); newLabel = workingSet.getLabel(); } } } if (viewer != null) { if (newLabel != null) viewer.getCommonNavigator().setWorkingSetLabel(newLabel); viewer.getFrameList().reset(); viewer.refresh(); } }
Example 9
Source File: WorkingSetFilterActionGroup.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private void doPropertyChange(PropertyChangeEvent event) { String property= event.getProperty(); if (IWorkingSetManager.CHANGE_WORKING_SET_LABEL_CHANGE.equals(property)) { fChangeListener.propertyChange(event); } else if (IWorkingSetManager.CHANGE_WORKING_SET_CONTENT_CHANGE.equals(property)) { IWorkingSet newWorkingSet= (IWorkingSet) event.getNewValue(); if (newWorkingSet.equals(fWorkingSet)) { if (fWorkingSetFilter != null) { fWorkingSetFilter.notifyWorkingSetContentChange(); // first refresh the filter } fChangeListener.propertyChange(event); } } }
Example 10
Source File: CommonOccurrencesUpdater.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
public void propertyChange(PropertyChangeEvent event) { final String property = event.getProperty(); if (IPreferenceConstants.EDITOR_MARK_OCCURRENCES.equals(property)) { boolean newBooleanValue = false; Object newValue = event.getNewValue(); if (newValue != null) { newBooleanValue = Boolean.valueOf(newValue.toString()).booleanValue(); } if (newBooleanValue) { install(); } else { uninstall(); } // force update if (editor != null) { ISelectionProvider selectionProvider = editor.getSelectionProvider(); if (selectionProvider != null) { updateAnnotations(selectionProvider.getSelection()); } } } }
Example 11
Source File: Dashboard.java From MergeProcessor with Apache License 2.0 | 5 votes |
/** * Handles the given {@link PropertyChangeEvent}. * * @param event the event to handle */ private void handlePropertyChange(PropertyChangeEvent event) { switch (event.getProperty()) { case WorkbenchPreferencePage.WINDOW_SIZE: LogUtil.getLogger().fine("Setting new window size."); //$NON-NLS-1$ shell.setSize(Configuration.getWindowSize()); break; case WorkbenchPreferencePage.WINDOW_LOCATION: LogUtil.getLogger().fine("Setting new window location."); //$NON-NLS-1$ shell.setLocation(Configuration.getWindowLocation()); break; case WorkbenchPreferencePage.SORT_COLUMN: LogUtil.getLogger().fine("Setting new sort column."); //$NON-NLS-1$ final int columnIndex1 = Column.indexForValue(configuration.getSortColumn()); final Table table1 = view.getTableViewer().getTable(); comparator.setColumn(columnIndex1); table1.setSortColumn(table1.getColumn(columnIndex1)); view.getTableViewer().refresh(); break; case WorkbenchPreferencePage.SORT_DIRECTION: LogUtil.getLogger().fine("Setting new sort direction."); //$NON-NLS-1$ final int columnIndex = comparator.getColumn(); final Table table = view.getTableViewer().getTable(); comparator.setColumn(columnIndex); table.setSortColumn(table.getColumn(columnIndex)); table.setSortDirection(configuration.getSortDirection()); view.getTableViewer().refresh(); break; default: break; } }
Example 12
Source File: AbstractShowReferencesActionDelegate.java From Pydev with Eclipse Public License 1.0 | 5 votes |
@Override public void propertyChange(PropertyChangeEvent event) { String property = event.getProperty(); if (isShowReferenceProperty(property)) { if (fAction != null) { fAction.setChecked(isShowReference()); run(fAction); } } }
Example 13
Source File: SVNLightweightDecorator.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
private boolean isEventOfInterest(PropertyChangeEvent event) { String prop = event.getProperty(); return prop.equals(TeamUI.GLOBAL_IGNORES_CHANGED) || prop.equals(TeamUI.GLOBAL_FILE_TYPES_CHANGED) || prop.equals(SVNUIPlugin.P_DECORATORS_CHANGED) || prop.equals(SVNDecoratorConfiguration.OUTGOING_CHANGE_BACKGROUND_COLOR) || prop.equals(SVNDecoratorConfiguration.OUTGOING_CHANGE_FOREGROUND_COLOR) || prop.equals(SVNDecoratorConfiguration.OUTGOING_CHANGE_FONT) || prop.equals(SVNDecoratorConfiguration.IGNORED_FOREGROUND_COLOR) || prop.equals(SVNDecoratorConfiguration.IGNORED_BACKGROUND_COLOR) || prop.equals(SVNDecoratorConfiguration.IGNORED_FONT); }
Example 14
Source File: AbstractThemeableEditor.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
@Override protected void handlePreferenceStoreChanged(PropertyChangeEvent event) { super.handlePreferenceStoreChanged(event); if (this.fThemeableEditorColorsExtension == null) { return; } this.fThemeableEditorColorsExtension.handlePreferenceStoreChanged(event); // Add case when the global editor settings have changed String property = event.getProperty(); if (property.equals(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER)) { ((CommonLineNumberChangeRulerColumn) fLineNumberRulerColumn).showLineNumbers(isLineNumberVisible()); } else if (property.equals(IPreferenceConstants.EDITOR_PEER_CHARACTER_CLOSE)) { fPeerCharacterCloser.setAutoInsertEnabled(Boolean.parseBoolean(StringUtil.getStringValue(event .getNewValue()))); } else if (property.equals(IPreferenceConstants.EDITOR_WRAP_SELECTION)) { fPeerCharacterCloser .setAutoWrapEnabled(Boolean.parseBoolean(StringUtil.getStringValue(event.getNewValue()))); } else if (property.equals(IPreferenceConstants.EDITOR_ENABLE_FOLDING)) { SourceViewerConfiguration config = getSourceViewerConfiguration(); if (config instanceof CommonSourceViewerConfiguration) { ((CommonSourceViewerConfiguration) config).forceReconcile(); } } else if (IPreferenceConstants.USE_GLOBAL_DEFAULTS.equals(property)) { // Update the tab settings when we modify the use global defaults preference IPreferenceStore store = getPreferenceStore(); if (store != null) { getSourceViewer().getTextWidget().setTabs( store.getInt(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH)); } if (isTabsToSpacesConversionEnabled()) { installTabsToSpacesConverter(); } else { uninstallTabsToSpacesConverter(); } return; } }
Example 15
Source File: AbstractSyntaxColoringPage.java From birt with Eclipse Public License 1.0 | 4 votes |
public void propertyChange(PropertyChangeEvent event) { final String property = event.getProperty(); if (AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND.equals(property) || AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT.equals(property) || AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND.equals(property) || AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT.equals(property) || AbstractTextEditor.PREFERENCE_COLOR_SELECTION_FOREGROUND.equals(property) || AbstractTextEditor.PREFERENCE_COLOR_SELECTION_FOREGROUND_SYSTEM_DEFAULT.equals(property) || AbstractTextEditor.PREFERENCE_COLOR_SELECTION_BACKGROUND.equals(property) || AbstractTextEditor.PREFERENCE_COLOR_SELECTION_BACKGROUND_SYSTEM_DEFAULT.equals(property)) { initializeSourcePreviewColors(getSourcePreviewViewer()); } }
Example 16
Source File: GlobalsTwoPanelElementSelector2.java From Pydev with Eclipse Public License 1.0 | 4 votes |
/** * We need to add the action for the working set. */ @Override protected void fillViewMenu(IMenuManager menuManager) { super.fillViewMenu(menuManager); workingSetFilterActionGroup = new WorkingSetFilterActionGroup(getShell(), new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { String property = event.getProperty(); if (WorkingSetFilterActionGroup.CHANGE_WORKING_SET.equals(property)) { IWorkingSet workingSet = (IWorkingSet) event.getNewValue(); if (workingSet != null && !(workingSet.isAggregateWorkingSet() && workingSet.isEmpty())) { workingSetFilter.setWorkingSet(workingSet); setSubtitle(workingSet.getLabel()); } else { IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window != null) { IWorkbenchPage page = window.getActivePage(); workingSet = page.getAggregateWorkingSet(); if (workingSet.isAggregateWorkingSet() && workingSet.isEmpty()) { workingSet = null; } } workingSetFilter.setWorkingSet(workingSet); setSubtitle(null); } scheduleRefresh(); } } }); menuManager.add(new Separator()); workingSetFilterActionGroup.fillContextMenu(menuManager); }
Example 17
Source File: TLCChainedPreferenceStore.java From tlaplus with MIT License | 4 votes |
/** * Handle property change event from the child listener with the given child preference store. * * @param childPreferenceStore the child preference store * @param event the event */ private void handlePropertyChangeEvent(IPreferenceStore childPreferenceStore, PropertyChangeEvent event) { String property= event.getProperty(); Object oldValue= event.getOldValue(); Object newValue= event.getNewValue(); IPreferenceStore visibleStore= getVisibleStore(property); /* * Assume that the property is there but has no default value (its owner relies on the default-default value) * see https://bugs.eclipse.org/bugs/show_bug.cgi?id=52827 */ if (visibleStore == null && newValue != null) visibleStore= childPreferenceStore; if (visibleStore == null) { // no visible store if (oldValue != null) // removal in child, last in chain -> removal in this chained preference store firePropertyChangeEvent(event); } else if (visibleStore == childPreferenceStore) { // event from visible store if (oldValue != null) { // change in child, visible store -> change in this chained preference store firePropertyChangeEvent(event); } else { // insertion in child IPreferenceStore oldVisibleStore= null; int i= 0; int length= fPreferenceStores.length; while (i < length && fPreferenceStores[i++] != visibleStore) { // do nothing } while (oldVisibleStore == null && i < length) { if (fPreferenceStores[i].contains(property)) oldVisibleStore= fPreferenceStores[i]; i++; } if (oldVisibleStore == null) { // insertion in child, first in chain -> insertion in this chained preference store firePropertyChangeEvent(event); } else { // insertion in child, not first in chain oldValue= getOtherValue(property, oldVisibleStore, newValue); if (!oldValue.equals(newValue)) // insertion in child, different old value -> change in this chained preference store firePropertyChangeEvent(property, oldValue, newValue); // else: insertion in child, same old value -> no change in this chained preference store } } } else { // event from other than the visible store boolean eventBeforeVisibleStore= false; for (int i= 0, length= fPreferenceStores.length; i < length; i++) { IPreferenceStore store= fPreferenceStores[i]; if (store == visibleStore) break; if (store == childPreferenceStore) { eventBeforeVisibleStore= true; break; } } if (eventBeforeVisibleStore) { // removal in child, before visible store /* * The original event's new value can be non-null (removed assertion). * see https://bugs.eclipse.org/bugs/show_bug.cgi?id=69419 */ newValue= getOtherValue(property, visibleStore, oldValue); if (!newValue.equals(oldValue)) // removal in child, before visible store, different old value -> change in this chained preference store firePropertyChangeEvent(property, oldValue, newValue); // else: removal in child, before visible store, same old value -> no change in this chained preference store } // else: event behind visible store -> no change in this chained preference store } }
Example 18
Source File: TypeScriptEditor.java From typescript.java with MIT License | 4 votes |
protected void handlePreferenceStoreChanged(PropertyChangeEvent event) { String property = event.getProperty(); try { ISourceViewer sourceViewer = getSourceViewer(); if (sourceViewer == null) return; /* * if (AbstractDecoratedTextEditorPreferenceConstants. * EDITOR_SPACES_FOR_TABS.equals(property) || * TypeScriptCorePreferenceConstants.EDITOR_OPTIONS_INDENT_SIZE. * equals(property) || * AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH. * equals(property)) { */ if (TypeScriptCorePreferenceConstants.EDITOR_OPTIONS_CONVERT_TABS_TO_SPACES.equals(property)) { if (isTabsToSpacesConversionEnabled()) installTabsToSpacesConverter(); else uninstallTabsToSpacesConverter(); updateTabs(sourceViewer); return; } if (TypeScriptCorePreferenceConstants.EDITOR_OPTIONS_TAB_SIZE.equals(property) || TypeScriptCorePreferenceConstants.EDITOR_OPTIONS_INDENT_SIZE.equals(property)) { updateTabs(sourceViewer); return; } if (PreferenceConstants.EDITOR_SMART_TAB.equals(property)) { if (getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_SMART_TAB)) { setActionActivationCode("IndentOnTab", '\t', -1, SWT.NONE); //$NON-NLS-1$ } else { removeActionActivationCode("IndentOnTab"); //$NON-NLS-1$ } } boolean newBooleanValue = false; Object newValue = event.getNewValue(); if (newValue != null) newBooleanValue = Boolean.valueOf(newValue.toString()).booleanValue(); if (PreferenceConstants.EDITOR_MARK_OCCURRENCES.equals(property)) { if (newBooleanValue != fMarkOccurrenceAnnotations) { fMarkOccurrenceAnnotations = newBooleanValue; if (!fMarkOccurrenceAnnotations) uninstallOccurrencesFinder(); else installOccurrencesFinder(true); } return; } } finally { super.handlePreferenceStoreChanged(event); } }
Example 19
Source File: JavaScriptLightWeightEditor.java From typescript.java with MIT License | 4 votes |
@Override protected void handlePreferenceStoreChanged(PropertyChangeEvent event) { String property = event.getProperty(); if (AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH.equals(property)) { /* * Ignore tab setting since we rely on the formatter preferences. We * do this outside the try-finally block to avoid that * EDITOR_TAB_WIDTH is handled by the sub-class * (AbstractDecoratedTextEditor). */ return; } try { ISourceViewer sourceViewer = getSourceViewer(); if (sourceViewer == null) return; if (JavaScriptCore.COMPILER_SOURCE.equals(property)) { if (event.getNewValue() instanceof String) fBracketMatcher.setSourceVersion((String) event.getNewValue()); // fall through as others are interested in source change as // well. } ((JavaScriptSourceViewerConfiguration) getSourceViewerConfiguration()).handlePropertyChangeEvent(event); if (PreferenceConstants.EDITOR_FOLDING_PROVIDER.equals(property)) { if (sourceViewer instanceof ProjectionViewer) { ProjectionViewer pv = (ProjectionViewer) sourceViewer; // install projection support if it has not even been // installed yet if (isFoldingEnabled() && (fProjectionSupport == null)) { installProjectionSupport(); } if (pv.isProjectionMode() != isFoldingEnabled()) { if (pv.canDoOperation(ProjectionViewer.TOGGLE)) { pv.doOperation(ProjectionViewer.TOGGLE); } } } return; } } finally { super.handlePreferenceStoreChanged(event); } }
Example 20
Source File: AbstractLangBasicSourceViewerConfiguration.java From goclipse with Eclipse Public License 1.0 | 4 votes |
public void handlePropertyChange(PropertyChangeEvent event, IPreferenceStore prefStore, SourceViewer sourceViewer) { assertTrue(prefStore == getPreferenceStore()); String property = event.getProperty(); updateIndentationSettings(sourceViewer, property); }