org.eclipse.jface.util.PropertyChangeEvent Java Examples

The following examples show how to use org.eclipse.jface.util.PropertyChangeEvent. 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: KbdMacroPreferencePage.java    From e4macs with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Listen for changes in the radio and directory dialogs
 * 
 * @see org.eclipse.jface.preference.FieldEditorPreferencePage#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
 */
public void propertyChange(PropertyChangeEvent event) {
	super.propertyChange(event);
	if (event.getSource().equals(radioEditor)) {
		// new value is different form old value when enabling new value
		if (!event.getNewValue().equals(event.getOldValue())){
			// validate the current active set, as the directory may have changed and
			// Eclipse doesn't force a change event on the directory editor when selection changes 
			someListEditor.validate();
			String newValue = (String)event.getNewValue();
			setSomeListEnabled(newValue);	
			setLoadButtonEnabled(newValue);	
		}
	} else if (event.getSource().equals(directoryEditor)) {
		// the interface thinks the directory has changed, so validate the current active set
		// if we're in the select some auto-load state
		if (someListEditor.isEnabled()) {
			someListEditor.validate();
		}
	}
}
 
Example #2
Source File: FieldEditorWrapper.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
@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 #3
Source File: Activator.java    From eclipse with Apache License 2.0 6 votes vote down vote up
@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: JenerateBasePreferencePage.java    From jenerate with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void propertyChange(PropertyChangeEvent event) {
    super.propertyChange(event);

    if (event.getProperty().equals(FieldEditor.VALUE)) {

        if (event.getSource() == getCacheHashCodeField()) {
            getHashCodeCachingField().setEnabled(getCacheHashCodeField().getBooleanValue(), getFieldEditorParent());

        } else if (event.getSource() == getCacheToStringField()) {
            getToStringCachingField().setEnabled(getCacheToStringField().getBooleanValue(), getFieldEditorParent());

        } else
            if (event.getSource() == getHashCodeCachingField() || event.getSource() == getToStringCachingField()) {
            checkState();
        }
    }
}
 
Example #5
Source File: CSSPreferencePage.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void propertyChange(PropertyChangeEvent event)
{
	if (event.getSource() == enableFolding)
	{
		Object newValue = event.getNewValue();
		if (Boolean.TRUE == newValue)
		{
			foldComments.setEnabled(true, foldingGroup);
			foldRules.setEnabled(true, foldingGroup);
		}
		else
		{
			foldComments.setEnabled(false, foldingGroup);
			foldRules.setEnabled(false, foldingGroup);
		}
	}
	super.propertyChange(event);
}
 
Example #6
Source File: FindingsSettings.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void propertyChange(PropertyChangeEvent event){
	super.propertyChange(event);
	if (event != null) {
		if (event.getSource() == diagStructFieldEditor) {
			diagPropertyChange(event);
		}
		else if (event.getSource() == persAnamneseStructFieldEditor) {
			persAnamnesePropertyChange(event);
		}
		else if (event.getSource() == riskFactorStructFieldEditor) {
			riskFactorPropertyChange(event);
		}
		else if (event.getSource() == famAnamneseStructFieldEditor) {
			famAnamnesePropertyChange(event);
		}
		else if (event.getSource() == allergyIntoleranceStructFieldEditor) {
			allergyIntolerancePropertyChange(event);
		}
	}
}
 
Example #7
Source File: JavaCodeScanner.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void adaptToPreferenceChange(PropertyChangeEvent event) {

	if (event.getProperty().equals(SOURCE_VERSION)) {
		Object value= event.getNewValue();

		if (value instanceof String) {
			String s= (String) value;

			for (Iterator<ISourceVersionDependent> it= fVersionDependentRules.iterator(); it.hasNext();) {
				ISourceVersionDependent dependent= it.next();
				dependent.setSourceVersion(s);
			}
		}

	} else if (super.affectsBehavior(event)) {
		super.adaptToPreferenceChange(event);
	}
}
 
Example #8
Source File: JSPreferencePage.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void propertyChange(PropertyChangeEvent event)
{
	if (event.getSource() == enableFolding) // $codepro.audit.disable useEquals
	{
		Object newValue = event.getNewValue();
		if (Boolean.TRUE == newValue) // $codepro.audit.disable useEquals
		{
			foldComments.setEnabled(true, foldingGroup);
			foldFunctions.setEnabled(true, foldingGroup);
			foldObjects.setEnabled(true, foldingGroup);
			foldArrays.setEnabled(true, foldingGroup);
		}
		else
		{
			foldComments.setEnabled(false, foldingGroup);
			foldFunctions.setEnabled(false, foldingGroup);
			foldObjects.setEnabled(false, foldingGroup);
			foldArrays.setEnabled(false, foldingGroup);
		}
	}
	super.propertyChange(event);
}
 
Example #9
Source File: GenericFieldEditorPropertyPage.java    From tlaplus with MIT License 6 votes vote down vote up
/**
 * The field editor preference page implementation of this <code>IPreferencePage</code>
 * (and <code>IPropertyChangeListener</code>) method intercepts <code>IS_VALID</code> 
 * events but passes other events on to its superclass.
 */
public void propertyChange(PropertyChangeEvent event)
{

    if (event.getProperty().equals(FieldEditor.IS_VALID))
    {
        boolean newValue = ((Boolean) event.getNewValue()).booleanValue();
        // If the new value is true then we must check all field editors.
        // If it is false, then the page is invalid in any case.
        if (newValue)
        {
            checkState();
        } else
        {
            setInvalidFieldEditor((FieldEditor) event.getSource());
            setValid(newValue);
        }
    }
}
 
Example #10
Source File: AbstractJavaScanner.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void adaptToStyleChange(Token token, PropertyChangeEvent event, int styleAttribute) {
	boolean eventValue= false;
	Object value= event.getNewValue();
	if (value instanceof Boolean)
		eventValue= ((Boolean) value).booleanValue();
	else if (IPreferenceStore.TRUE.equals(value))
		eventValue= true;

	Object data= token.getData();
	if (data instanceof TextAttribute) {
		TextAttribute oldAttr= (TextAttribute) data;
		boolean activeValue= (oldAttr.getStyle() & styleAttribute) == styleAttribute;
		if (activeValue != eventValue)
			token.setData(new TextAttribute(oldAttr.getForeground(), oldAttr.getBackground(), eventValue ? oldAttr.getStyle() | styleAttribute : oldAttr.getStyle() & ~styleAttribute));
	}
}
 
Example #11
Source File: DesignerActionBarContributor.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public void propertyChange( PropertyChangeEvent event )
{
	RegisterAction[] actions = getInsertElementActions( );
	if ( actions != null )
	{
		for ( int i = 0; i < actions.length; i++ )
		{
			if ( event.getProperty( )
					.equals( SubActionBars.P_ACTION_HANDLERS ) )
			{
				if ( getAction( actions[i].id ) instanceof ReportRetargetAction )
				{
					( (ReportRetargetAction) getAction( actions[i].id ) ).propagateChange( event );
				}
			}
		}
	}
}
 
Example #12
Source File: ModelEditorPreferencePage.java    From tlaplus with MIT License 6 votes vote down vote up
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 #13
Source File: Preferences.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
/**
 * @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 #14
Source File: Beeper.java    From e4macs with Eclipse Public License 1.0 5 votes vote down vote up
public void propertyChange(PropertyChangeEvent event) {
	if (RING_BELL_FUNCTION.getPref().equals(event.getProperty())) {
		setRingBellOption((String)event.getNewValue());
	} else if (VISIBLE_BELL.getPref().equals(event.getProperty())) {
		visibleBell = (Boolean)event.getNewValue();
	}
}
 
Example #15
Source File: TLAPMExecutableLocator.java    From tlaplus with MIT License 5 votes vote down vote up
public void propertyChange(final PropertyChangeEvent event) {
	if (MainProverPreferencePage.EXECUTABLE_LOCATION_KEY.equals(event.getProperty())) {
		final String location = (String) event.getNewValue();

		// Validation occurred in the preference page, so if we are getting this notification, the path is ok
		tlapmPath = new Path(location);
	}
}
 
Example #16
Source File: ConflictModel2.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
public void init(BindingManager manager, BindingModel model) {
	bindingManager = manager;
	bindingModel = model;
	conflictsMap = new HashMap();
	Iterator i = bindingModel.getBindings().iterator();
	while (i.hasNext()) {
		BindingElement be = (BindingElement) i.next();
		if (be.getModelObject() instanceof Binding) {
			updateConflictsFor(be);
		}
	}
	controller.addPropertyChangeListener(new IPropertyChangeListener() {
		public void propertyChange(PropertyChangeEvent event) {
			if (event.getSource() == ConflictModel2.this
					&& CommonModel.PROP_SELECTED_ELEMENT.equals(event
							.getProperty())) {
				if (event.getNewValue() != null) {
					updateConflictsFor(
							(BindingElement) event.getOldValue(),
							(BindingElement) event.getNewValue());
					setConflicts((Collection) conflictsMap.get(event
							.getNewValue()));
				} else {
					setConflicts(null);
				}
			} else if (BindingModel.PROP_BINDING_REMOVE.equals(event
					.getProperty())) {
				updateConflictsFor((BindingElement) event.getOldValue(),
						(BindingElement) event.getNewValue(), true);
			}
		}
	});
}
 
Example #17
Source File: AnnotationStyleChangeListener.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
@Override
public void propertyChange(PropertyChangeEvent event) {
  if (event.getProperty().endsWith(".style")) {
    // extract type name ...
    String typeName = event.getProperty().substring(0, event.getProperty().lastIndexOf(".style"));
    AnnotationStyle style = AnnotationStyle.getAnnotationStyleFromStore(
            (IPreferenceStore) event.getSource(), typeName);
    annotationStylesChanged(Collections.singleton(style));
  }
}
 
Example #18
Source File: OthersWorkingSetUpdater.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public void propertyChange(PropertyChangeEvent event) {
	if (IWorkingSetManager.CHANGE_WORKING_SET_CONTENT_CHANGE.equals(event.getProperty())) {
		IWorkingSet changedWorkingSet= (IWorkingSet) event.getNewValue();
		if (changedWorkingSet != fWorkingSet && fWorkingSetModel.isActiveWorkingSet(changedWorkingSet)) {
			updateElements();
		}
	}
}
 
Example #19
Source File: ResponsiveXtextDocumentProvider.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Performs (schedule) a "fast-only" validation job on preference changes.
 *
 * @param event
 *          the event
 */
@Override
public void propertyChange(final PropertyChangeEvent event) {
  if (LOGGER.isDebugEnabled()) {
    LOGGER.debug(NLS.bind("Preference Change: {0} => {1} -> {2}", new Object[] {event.getProperty(), event.getOldValue(), event.getNewValue()})); //$NON-NLS-1$
  }

  for (Iterator<?> i = getConnectedElements(); i.hasNext();) {
    ((XtextDocument) getDocument(i.next())).checkAndUpdateAnnotations();
  }
}
 
Example #20
Source File: JavaEditor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Determines whether the preference change encoded by the given event
 * changes the override indication.
 *
 * @param event the event to be investigated
 * @return <code>true</code> if event causes a change
 * @since 3.0
 */
protected boolean affectsOverrideIndicatorAnnotations(PropertyChangeEvent event) {
	String key= event.getProperty();
	AnnotationPreference preference= getAnnotationPreferenceLookup().getAnnotationPreference(OverrideIndicatorManager.ANNOTATION_TYPE);
	if (key == null || preference == null)
		return false;

	return key.equals(preference.getHighlightPreferenceKey())
		|| key.equals(preference.getVerticalRulerPreferenceKey())
		|| key.equals(preference.getOverviewRulerPreferenceKey())
		|| key.equals(preference.getTextPreferenceKey());
}
 
Example #21
Source File: CommunicationPreferencePage.java    From saros with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void propertyChange(PropertyChangeEvent event) {

  if (event.getSource() instanceof FieldEditor) {
    FieldEditor field = (FieldEditor) event.getSource();

    if (field.getPreferenceName().equals(EclipsePreferenceConstants.CUSTOM_MUC_SERVICE)) {
      String serverName = event.getNewValue().toString();
      useCustomChatServer.setEnabled(!serverName.isEmpty(), getFieldEditorParent());
    }
  }
}
 
Example #22
Source File: SpellCheckEngine.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
public final void propertyChange(final PropertyChangeEvent event) {
    if (event.getProperty().equals(SpellingService.PREFERENCE_SPELLING_ENABLED) && !EditorsUI.getPreferenceStore().getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED)) {
        if (this == fgEngine)
            SpellCheckEngine.shutdownInstance();
        else
            shutdown();
    }
}
 
Example #23
Source File: PreferenceStoreIndentationInformation.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@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 #24
Source File: AbstractEditorConfigScanner.java    From editorconfig-eclipse with Apache License 2.0 5 votes vote down vote up
public void adaptToPreferenceChange(PropertyChangeEvent event) {
	String p = event.getProperty();
	int index = indexOf(p);
	Token token = getToken(fPropertyNamesColor[index]);
	if (fPropertyNamesColor[index].equals(p))
		adaptToColorChange(token, event);
	else if (fPropertyNamesBold[index].equals(p))
		adaptToStyleChange(token, event, SWT.BOLD);
	else if (fPropertyNamesItalic[index].equals(p))
		adaptToStyleChange(token, event, SWT.ITALIC);
	else if (fPropertyNamesStrikethrough[index].equals(p))
		adaptToStyleChange(token, event, TextAttribute.STRIKETHROUGH);
	else if (fPropertyNamesUnderline[index].equals(p))
		adaptToStyleChange(token, event, TextAttribute.UNDERLINE);
}
 
Example #25
Source File: CustomFilters.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void propertyChange(PropertyChangeEvent event) {
    CustomFilters customFilters = weakCustomFilter.get();
    if (customFilters == null) {
        IPreferenceStore prefs = PydevPlugin.getDefault().getPreferenceStore();
        prefs.removePropertyChangeListener(this);
    } else {
        String property = event.getProperty();
        if (property.equals(PySetupCustomFilters.CUSTOM_FILTERS_PREFERENCE_NAME)) {
            customFilters.update((String) event.getNewValue());
        }
    }
}
 
Example #26
Source File: IndentGuidesPainter.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
private void reReadStore(PropertyChangeEvent event) {
    String p = event!=null ? event.getProperty() : null;
    
    if (painter != null) {
    	painter.getPreferencies();
    }
    
    if (p == null || p.equals(IndentGuidePreferencePage.PreferenceConstants.ENABLED))  {
        if (store.getBoolean(IndentGuidePreferencePage.PreferenceConstants.ENABLED)) {
            showIndentGuides();
        } else {
            hideIndentGuides();
        }
    }
}
 
Example #27
Source File: WorkingSetModel.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private boolean isAffected(PropertyChangeEvent event) {
	if (fActiveWorkingSets == null)
		return false;
	Object oldValue= event.getOldValue();
	Object newValue= event.getNewValue();
	if ((oldValue != null && fActiveWorkingSets.contains(oldValue))
			|| (newValue != null && fActiveWorkingSets.contains(newValue))) {
		return true;
	}
	return false;
}
 
Example #28
Source File: WorkingSetAwareContentProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public WorkingSetAwareContentProvider(boolean provideMembers, WorkingSetModel model) {
	super(provideMembers);
	fWorkingSetModel= model;
	fListener= new IPropertyChangeListener() {
				public void propertyChange(PropertyChangeEvent event) {
					workingSetModelChanged(event);
				}
			};
	fWorkingSetModel.addPropertyChangeListener(fListener);
}
 
Example #29
Source File: SpinnerTime.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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: PackageExplorerActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void doWorkingSetChanged(PropertyChangeEvent event) {
	if (ViewActionGroup.MODE_CHANGED.equals(event.getProperty())) {
		fPart.rootModeChanged(((Integer)event.getNewValue()).intValue());
		Object oldInput= null;
		Object newInput= null;
		if (fPart.getRootMode() == PackageExplorerPart.PROJECTS_AS_ROOTS) {
			oldInput= fPart.getWorkingSetModel();
			newInput= JavaCore.create(ResourcesPlugin.getWorkspace().getRoot());
		} else {
			oldInput= JavaCore.create(ResourcesPlugin.getWorkspace().getRoot());
			newInput= fPart.getWorkingSetModel();
		}
		if (oldInput != null && newInput != null) {
			Frame frame;
			for (int i= 0; (frame= fFrameList.getFrame(i)) != null; i++) {
				if (frame instanceof TreeFrame) {
					TreeFrame treeFrame= (TreeFrame)frame;
					if (oldInput.equals(treeFrame.getInput()))
						treeFrame.setInput(newInput);
				}
			}
		}
	} else {
		IWorkingSet workingSet= (IWorkingSet) event.getNewValue();

		String workingSetLabel= null;
		if (workingSet != null)
			workingSetLabel= BasicElementLabels.getWorkingSetLabel(workingSet);
		fPart.setWorkingSetLabel(workingSetLabel);
		fPart.updateTitle();

		String property= event.getProperty();
		if (IWorkingSetManager.CHANGE_WORKING_SET_CONTENT_CHANGE.equals(property)) {
			TreeViewer viewer= fPart.getTreeViewer();
			viewer.getControl().setRedraw(false);
			viewer.refresh();
			viewer.getControl().setRedraw(true);
		}
	}
}