org.eclipse.jface.viewers.LabelProviderChangedEvent Java Examples

The following examples show how to use org.eclipse.jface.viewers.LabelProviderChangedEvent. 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: N4JSProjectExplorerLabelProvider.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Sole constructor.
 */
public N4JSProjectExplorerLabelProvider() {
	decorator = new N4JSProjectExplorerProblemsDecorator();
	workbenchLabelProvider = new WorkbenchLabelProvider();
	delegate = new DecoratingLabelProvider(workbenchLabelProvider, decorator);
	workingSetLabelProviderListener = new ILabelProviderListener() {

		@Override
		public void labelProviderChanged(final LabelProviderChangedEvent event) {
			final LabelProviderChangedEvent wrapperEvent = createWorkingSetWrapperEvent(event);
			if (null != wrapperEvent) {
				UIUtils.getDisplay().asyncExec(() -> fireLabelProviderChanged(wrapperEvent));
			}
		}

	};
	delegate.addListener(workingSetLabelProviderListener);
}
 
Example #2
Source File: SharedProjectFileDecorator.java    From saros with GNU General Public License v2.0 6 votes vote down vote up
private void updateDecoratorsAsync(final Object[] updateElements) {

    SWTUtils.runSafeSWTAsync(
        log,
        new Runnable() {
          @Override
          public void run() {
            LabelProviderChangedEvent event =
                new LabelProviderChangedEvent(SharedProjectFileDecorator.this, updateElements);

            for (ILabelProviderListener listener : listeners) {
              listener.labelProviderChanged(event);
            }
          }
        });
  }
 
Example #3
Source File: ColoringLabelProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public void update() {
	ColumnViewer viewer= getViewer();

	if (viewer == null) {
		return;
	}
	
	boolean needsUpdate= false;
	
	boolean showColoredLabels= ColoredViewersManager.showColoredLabels();
	if (showColoredLabels != isOwnerDrawEnabled()) {
		setOwnerDrawEnabled(showColoredLabels);
		needsUpdate= true;
	} else if (showColoredLabels) {
		needsUpdate= true;
	}
	if (needsUpdate) {
		fireLabelProviderChanged(new LabelProviderChangedEvent(this));
	}
}
 
Example #4
Source File: AppearanceAwareLabelProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public void propertyChange(PropertyChangeEvent event) {
	String property= event.getProperty();
	if (property.equals(PreferenceConstants.APPEARANCE_METHOD_RETURNTYPE)
			|| property.equals(PreferenceConstants.APPEARANCE_METHOD_TYPEPARAMETERS)
			|| property.equals(PreferenceConstants.APPEARANCE_CATEGORY)
			|| property.equals(PreferenceConstants.APPEARANCE_PKG_NAME_PATTERN_FOR_PKG_VIEW)
			|| property.equals(PreferenceConstants.APPEARANCE_COMPRESS_PACKAGE_NAMES)
			|| property.equals(PreferenceConstants.APPEARANCE_PKG_NAME_ABBREVIATION_PATTERN_FOR_PKG_VIEW)
			|| property.equals(PreferenceConstants.APPEARANCE_ABBREVIATE_PACKAGE_NAMES)) {
		initMasks();
		LabelProviderChangedEvent lpEvent= new LabelProviderChangedEvent(this, null); // refresh all
		fireLabelProviderChanged(lpEvent);
	}
}
 
Example #5
Source File: SVNLightweightDecorator.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public void refresh(IProject project) {
	final List resources = new ArrayList();
	try {
		project.accept(new IResourceVisitor() {
			public boolean visit(IResource resource) {
				resources.add(resource);
				return true;
			}
		});
		postLabelEvent(new LabelProviderChangedEvent(this, resources.toArray()));
	} catch (CoreException e) {
		SVNProviderPlugin.log(e.getStatus());
	}
}
 
Example #6
Source File: SVNLightweightDecorator.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Post the label event to the UI thread
 *
 * @param events  the events to post
 */
private void postLabelEvent(final LabelProviderChangedEvent event) {
	Display.getDefault().asyncExec(new Runnable() {
		public void run() {
			fireLabelProviderChanged(event);
		}
	});
}
 
Example #7
Source File: ProblemsLabelDecorator.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private void fireProblemsChanged(IResource[] changedResources, boolean isMarkerChange)
{
	if (fListeners != null && !fListeners.isEmpty())
	{
		LabelProviderChangedEvent event = new ProblemsLabelChangedEvent(this, changedResources, isMarkerChange);
		Object[] listeners = fListeners.getListeners();
		for (int i = 0; i < listeners.length; i++)
		{
			((ILabelProviderListener) listeners[i]).labelProviderChanged(event);
		}
	}
}
 
Example #8
Source File: ProblemsLabelDecorator.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void fireProblemsChanged(IResource[] changedResources, boolean isMarkerChange) {
	if (fListeners != null && !fListeners.isEmpty()) {
		LabelProviderChangedEvent event= new ProblemsLabelChangedEvent(this, changedResources, isMarkerChange);
		Object[] listeners= fListeners.getListeners();
		for (int i= 0; i < listeners.length; i++) {
			((ILabelProviderListener) listeners[i]).labelProviderChanged(event);
		}
	}
}
 
Example #9
Source File: AbstractJavaElementLabelDecorator.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void fireChange(IJavaElement[] elements) {
	if (fListeners != null && !fListeners.isEmpty()) {
		LabelProviderChangedEvent event= new LabelProviderChangedEvent(this, elements);
		Object[] listeners= fListeners.getListeners();
		for (int i= 0; i < listeners.length; i++) {
			((ILabelProviderListener) listeners[i]).labelProviderChanged(event);
		}
	}
}
 
Example #10
Source File: SearchLabelProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
final void doSearchPropertyChange(PropertyChangeEvent event) {
	if (fPotentialMatchFgColor == null)
		return;
	if (POTENTIAL_MATCH_FG_COLOR.equals(event.getProperty()) || EMPHASIZE_POTENTIAL_MATCHES.equals(event.getProperty())) {
		fPotentialMatchFgColor.dispose();
		fPotentialMatchFgColor= null;
		LabelProviderChangedEvent lpEvent= new LabelProviderChangedEvent(SearchLabelProvider.this, null); // refresh all
		fireLabelProviderChanged(lpEvent);
	}
}
 
Example #11
Source File: MethodsLabelProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public MethodsLabelProvider(TypeHierarchyLifeCycle lifeCycle, MethodsViewer methodsViewer) {
	super(DEFAULT_TEXTFLAGS | JavaElementLabels.P_COMPRESSED, DEFAULT_IMAGEFLAGS);
	fHierarchy= lifeCycle;
	fShowDefiningType= false;
	fMethodsViewer= methodsViewer;
	fColorRegistryListener= new IPropertyChangeListener() {
		public void propertyChange(PropertyChangeEvent event) {
			if (event.getProperty().equals(ColoredViewersManager.INHERITED_COLOR_NAME)) {
				fireLabelProviderChanged(new LabelProviderChangedEvent(MethodsLabelProvider.this, null));
			}
		}
	};
	JFaceResources.getColorRegistry().addListener(fColorRegistryListener);
}
 
Example #12
Source File: JavaUILabelProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Fires a label provider changed event to all registered listeners
 * Only listeners registered at the time this method is called are notified.
 *
 * @param event a label provider changed event
 *
 * @see ILabelProviderListener#labelProviderChanged
 */
protected void fireLabelProviderChanged(final LabelProviderChangedEvent event) {
    Object[] listeners = fListeners.getListeners();
    for (int i = 0; i < listeners.length; ++i) {
        final ILabelProviderListener l = (ILabelProviderListener) listeners[i];
        SafeRunner.run(new SafeRunnable() {
            public void run() {
                l.labelProviderChanged(event);
            }
        });
    }
}
 
Example #13
Source File: ChangeTypeWizard.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public void grayOut(Collection<ITypeBinding> invalidTypes){
	fInvalidTypes= invalidTypes;
	/*
	 * Invalidate all labels. Invalidating only invalid types doesn't
	 * work since there can be multiple nodes in the tree that
	 * correspond to the same invalid IType. The TreeViewer only updates
	 * the label of one of these ITypes and leaves the others in their
	 * old state.
	 */
	fireLabelProviderChanged(new LabelProviderChangedEvent(this));
}
 
Example #14
Source File: SharedProjectDecorator.java    From saros with GNU General Public License v2.0 5 votes vote down vote up
private void updateDecoratorsAsync(final IResource[] resources) {
  SWTUtils.runSafeSWTAsync(
      log,
      new Runnable() {
        @Override
        public void run() {
          LabelProviderChangedEvent event =
              new LabelProviderChangedEvent(SharedProjectDecorator.this, resources);

          for (ILabelProviderListener listener : listeners) {
            listener.labelProviderChanged(event);
          }
        }
      });
}
 
Example #15
Source File: ProblemsLabelDecorator.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
private void fireProblemsChanged(IResource[] changedResources, boolean isMarkerChange) {
	if (fListeners != null && !fListeners.isEmpty()) {
		LabelProviderChangedEvent event= new ProblemsLabelChangedEvent(this, changedResources, isMarkerChange);
		Object[] listeners= fListeners.getListeners();
		for (int i= 0; i < listeners.length; i++) {
			((ILabelProviderListener) listeners[i]).labelProviderChanged(event);
		}
	}
}
 
Example #16
Source File: LangNavigatorLabelProvider.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
public LangNavigatorLabelProvider() {
	super();
	this.registry = init_getImageRegistry();
	ProblemsLabelDecorator problemsLabelDecorator = new ProblemsLabelDecorator(registry);
	problemsLabelDecorator.addListener(new ILabelProviderListener() {
		@Override
		public void labelProviderChanged(LabelProviderChangedEvent event) {
			LangNavigatorLabelProvider.this.fireLabelProviderChanged(event);
		}
	});
	this.labelDecorators.add(problemsLabelDecorator);
}
 
Example #17
Source File: CustomPropertyColumnLabelProvider.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void handleMapChange(final MapChangeEvent event) {
    final Set<?> affectedElements = event.diff.getChangedKeys();
    if (!affectedElements.isEmpty()) {
        fireLabelProviderChanged(new LabelProviderChangedEvent(this, affectedElements.toArray()));
    }
}
 
Example #18
Source File: CustomCheckBoxColumnLabelProvider.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void handleMapChange(final MapChangeEvent event) {
    final Set<?> affectedElements = event.diff.getChangedKeys();
    if (!affectedElements.isEmpty()) {
        fireLabelProviderChanged(new LabelProviderChangedEvent(this, affectedElements.toArray()));
    }
}
 
Example #19
Source File: DataStyledTreeLabelProvider.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void handleMapChange(MapChangeEvent event) {
	Set<?> affectedElements = event.diff.getChangedKeys();
	if (!affectedElements.isEmpty()) {
		LabelProviderChangedEvent newEvent = new LabelProviderChangedEvent(DataStyledTreeLabelProvider.this, affectedElements.toArray());
		fireLabelProviderChanged(newEvent);
	}
}
 
Example #20
Source File: BuildpathIndicatorLabelDecorator.java    From typescript.java with MIT License 5 votes vote down vote up
private void fireChange(IResource[] elements) {
	if (fListeners != null && !fListeners.isEmpty()) {
		LabelProviderChangedEvent event = new LabelProviderChangedEvent(this, elements);
		Object[] listeners = fListeners.getListeners();
		for (int i = 0; i < listeners.length; i++) {
			((ILabelProviderListener) listeners[i]).labelProviderChanged(event);
		}
	}
}
 
Example #21
Source File: DerbyIsRunningDecorator.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
private void startUpdateDecor(IProject proj) {
  	final LabelProviderChangedEvent evnt = new LabelProviderChangedEvent(this, proj); 
Display.getDefault().asyncExec(new Runnable() {
	public void run() {
		fireLabelProviderChanged(evnt);
	}
});
  }
 
Example #22
Source File: N4JSProjectExplorerLabelProvider.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates a wrapper label provider change event with all visible {@link IWorkingSet working sets} if the working
 * set mode is enabled in the {@code Project Explorer}. Otherwise returns with {@code null}.
 *
 * @param event
 *            the original event.
 * @return a wrapper event with all visible working sets (if any) to trigger viewer refresh, or {@code null} if no
 *         viewer refresh is needed.
 */
private LabelProviderChangedEvent createWorkingSetWrapperEvent(final LabelProviderChangedEvent event) {
	if (event instanceof ProblemsLabelChangedEvent && workingSetManagerBroker.isWorkingSetTopLevel()) {
		final WorkingSetManager manager = workingSetManagerBroker.getActiveManager();
		if (null != manager) {
			final WorkingSet[] workingSets = manager.getWorkingSets();
			if (!Arrays2.isEmpty(workingSets)) {
				return new LabelProviderChangedEvent(delegate, workingSets);
			}
		}
	}
	return null;
}
 
Example #23
Source File: ObservableMapStyledCellLabelProvider.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void handleMapChange ( final MapChangeEvent event )
{
    final Set<?> affectedElements = event.diff.getChangedKeys ();
    final LabelProviderChangedEvent newEvent = new LabelProviderChangedEvent ( ObservableMapStyledCellLabelProvider.this, affectedElements.toArray () );
    fireLabelProviderChanged ( newEvent );
}
 
Example #24
Source File: InCompilationSetDecorator.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
private void fireLabelEvent(final LabelProviderChangedEvent event) {
    Display.getDefault().asyncExec(new Runnable() {
        public void run() {
            fireLabelProviderChanged(event);
        }
    });
}
 
Example #25
Source File: DerbyIsRunningDecorator.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
private void startUpdateDecor(IProject proj) {
  	final LabelProviderChangedEvent evnt = new LabelProviderChangedEvent(this, proj); 
Display.getDefault().asyncExec(new Runnable() {
	public void run() {
		fireLabelProviderChanged(evnt);
	}
});
  }
 
Example #26
Source File: ViewerLabelProvider.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
protected final void fireChangeEvent ( final Collection<?> changes )
{

    final LabelProviderChangedEvent event = new LabelProviderChangedEvent ( ViewerLabelProvider.this, changes.toArray () );
    final ILabelProviderListener[] listenerArray = ViewerLabelProvider.this.listeners.toArray ( new ILabelProviderListener[ViewerLabelProvider.this.listeners.size ()] );

    final Display display = getDisplay ();
    if ( !display.isDisposed () )
    {
        display.asyncExec ( new Runnable () {

            public void run ()
            {
                for ( final ILabelProviderListener listener : listenerArray )
                {
                    try
                    {
                        listener.labelProviderChanged ( event );
                    }
                    catch ( final Exception e )
                    {
                        Policy.getLog ().log ( new Status ( IStatus.ERROR, Policy.JFACE_DATABINDING, e.getLocalizedMessage (), e ) );
                    }
                }

            }
        } );

    }
}
 
Example #27
Source File: ConfigurationCellLabelProvider.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void handleMapChange ( final MapChangeEvent event )
{
    final Set<?> affectedElements = event.diff.getChangedKeys ();
    if ( !affectedElements.isEmpty () )
    {
        final LabelProviderChangedEvent newEvent = new LabelProviderChangedEvent ( ConfigurationCellLabelProvider.this, affectedElements.toArray () );
        fireLabelProviderChanged ( newEvent );
    }
}
 
Example #28
Source File: MonitorsLabelProvider.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void handleMapChange ( final MapChangeEvent event )
{
    final Set<?> affectedElements = event.diff.getChangedKeys ();
    if ( !affectedElements.isEmpty () )
    {
        final LabelProviderChangedEvent newEvent = new LabelProviderChangedEvent ( MonitorsLabelProvider.this, affectedElements.toArray () );
        fireLabelProviderChanged ( newEvent );
    }
}
 
Example #29
Source File: EventsLabelProvider.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void handleMapChange ( final MapChangeEvent event )
{
    final Set<?> affectedElements = event.diff.getChangedKeys ();
    if ( !affectedElements.isEmpty () )
    {
        final LabelProviderChangedEvent newEvent = new LabelProviderChangedEvent ( EventsLabelProvider.this, affectedElements.toArray () );
        fireLabelProviderChanged ( newEvent );
    }
}
 
Example #30
Source File: TableComboViewer.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
protected void handleLabelProviderChanged(LabelProviderChangedEvent event) {
	super.handleLabelProviderChanged(event);
	setSelection(getSelection());
}