/** * 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); }
/** * Fires {@link LabelProviderChangedEvent} for the given {@link DSLBreakpoint}. * * @param breakpoint * the {@link DSLBreakpoint} */ protected void fireLabelProviderChanged(IBreakpoint breakpoint) { if (resourceSet != null) { final Object instruction = getElement(resourceSet, (DSLBreakpoint)breakpoint); if (instruction != null) { final LabelProviderChangedEvent event = new LabelProviderChangedEvent(this, instruction); Display.getDefault().asyncExec(new Runnable() { /** * {@inheritDoc} * * @see java.lang.Runnable#run() */ public void run() { fireLabelProviderChanged(event); } }); } } }
public static void refreshAllProjectDecorations() { getSafeDisplay().asyncExec(new Runnable() { @Override public void run() { IWorkbench workbench = PlatformUI.getWorkbench(); if (workbench == null) { return; } IDecoratorManager manager = workbench.getDecoratorManager(); IProject[] projects = getAllProjects(); EGradleProjectDecorator decorator = (EGradleProjectDecorator) manager .getBaseLabelProvider("de.jcup.egradle.eclipse.ide.decorators.EGradleProjectDecorator"); /* decorate */ if (decorator != null) { // decorator is enabled LabelProviderChangedEvent event = new LabelProviderChangedEvent(decorator, projects); decorator.fireLabelProviderChanged(event); } } }); }
public SynchronizeLabelDecorator(final Subscriber subscriber) { this.subscriber = subscriber; preferenceStore = new ScopedPreferenceStore(new InstanceScope(), TEAM_UI_PLUGIN_ID); decorate = Boolean.TRUE.equals(preferenceStore.getBoolean(DECORATION_PREFERENCE_CONSTANT)); preferenceStore.addPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(final PropertyChangeEvent event) { if (event.getProperty().equals(DECORATION_PREFERENCE_CONSTANT)) { /* * Note that we compare against the string value of the * preference here. Preferences are not strongly typed * (they're strings under the hood), so in the property * change event, we're given the string value. */ decorate = "true".equals(event.getNewValue()); //$NON-NLS-1$ ((ILabelProviderListener) listeners.getListener()).labelProviderChanged( new LabelProviderChangedEvent(SynchronizeLabelDecorator.this)); } } }); }
public CoverageDecorator() { super(); coverageListener = new IJavaCoverageListener() { public void coverageChanged() { final Display display = EclEmmaUIPlugin.getInstance().getWorkbench() .getDisplay(); display.asyncExec(new Runnable() { public void run() { fireLabelProviderChanged(new LabelProviderChangedEvent( CoverageDecorator.this)); } }); } }; CoverageTools.addJavaCoverageListener(coverageListener); }
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)); } }
/** * 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; }
@Override public void handleMapChange ( final MapChangeEvent event ) { final Set<?> affectedElements = event.diff.getChangedKeys (); final LabelProviderChangedEvent newEvent = new LabelProviderChangedEvent ( ObservableMapStyledCellLabelProvider.this, affectedElements.toArray () ); fireLabelProviderChanged ( newEvent ); }
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 ) ); } } } } ); } }
@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 ); } }
@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 ); } }
@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 ); } }
private void startUpdateDecor(IProject proj) { final LabelProviderChangedEvent evnt = new LabelProviderChangedEvent(this, proj); Display.getDefault().asyncExec(new Runnable() { public void run() { fireLabelProviderChanged(evnt); } }); }
/** * Refresh on the UI thread. * * @param event * The event to fire on the UI thread */ private void refresh(final LabelProviderChangedEvent event) { UIHelpers.runOnUIThread(true, new Runnable() { @Override public void run() { fireLabelProviderChanged(event); } }); }
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()); } }
/** * 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); } }); }
/** * Sets the preserve case attribute * * @param preserveCase * the preserve case attribute */ public void setPreserveCase(boolean preserveCase) { this.preserveCase = preserveCase; // Since this attribute affects how the labels are computed, // notify all the listeners of the change. LabelProviderChangedEvent event = new LabelProviderChangedEvent(this); for (int i = 0, n = listeners.size(); i < n; i++) { ILabelProviderListener ilpl = (ILabelProviderListener) listeners .get(i); ilpl.labelProviderChanged(event); } }
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); } } }
public CloudFoundryDecorator() { this.listener = new CloudServerListener() { public void serverChanged(final CloudServerEvent event) { Display.getDefault().asyncExec(new Runnable() { public void run() { LabelProviderChangedEvent labelEvent = new LabelProviderChangedEvent(CloudFoundryDecorator.this); fireLabelProviderChanged(labelEvent); } }); } }; ServerEventHandler.getDefault().addServerListener(listener); }
@Override public void handleMapChange(MapChangeEvent event) { Set<?> affectedElements = event.diff.getChangedKeys(); if (!affectedElements.isEmpty()) { LabelProviderChangedEvent newEvent = new LabelProviderChangedEvent( BTSConfigurationTreeLabelProvider.this, affectedElements.toArray()); fireLabelProviderChanged(newEvent); } }
/** * * @param wrappedLabelProvider * @param decorator */ DelegatingLabelProviderWithTooltip(ILabelProvider wrappedLabelProvider, ILabelDecorator decorator) { this.wrappedLabelProvider = wrappedLabelProvider; this.decorator = decorator; wrappedLabelProvider.addListener(new ILabelProviderListener() { @Override public void labelProviderChanged(LabelProviderChangedEvent event) { fireLabelProviderChanged(event); } }); }
public DockerFoundryDecorator() { this.listener = new CloudServerListener() { public void serverChanged(final CloudServerEvent event) { Display.getDefault().asyncExec(new Runnable() { public void run() { LabelProviderChangedEvent labelEvent = new LabelProviderChangedEvent(DockerFoundryDecorator.this); fireLabelProviderChanged(labelEvent); } }); } }; ServerEventHandler.getDefault().addServerListener(listener); }
/** * Notifies listerners that the given resource'l decoration need to be updated * * @param resource a resource to refresh */ private void fireProviderChangedEvent(Object resource) { Iterator<ILabelProviderListener> i = listeners.iterator(); LabelProviderChangedEvent event = new LabelProviderChangedEvent(this, resource); while (i.hasNext()) { ILabelProviderListener listener = (ILabelProviderListener) i.next(); listener.labelProviderChanged(event); } }
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); } } }
@Override public void labelProviderChanged(LabelProviderChangedEvent event) { WidgetUtils.runInDisplayThread(infobar, new Runnable() { @Override public void run() { displayContents(data.getNodes(), data.getLeftNode(), data.getLeftTimepoint(), data.getRightNode(), data.getRightTimepoint(), data.getSelectionStartTime()); } }); }
@Override public void labelProviderChanged(LabelProviderChangedEvent event) { if (event.getElement() == getModel()) { GEFUtils.runInDisplayThread(TreeTimelineHeaderRowEditPart.this, new Runnable() { @Override public void run() { updateTitleVisual(); } }); } }
@Override public void labelProviderChanged(LabelProviderChangedEvent event) { WidgetUtils.runInDisplayThread(titleComposite, new Runnable() { @Override public void run() { refresh(); } }); }
private ILabelProvider getLabelProvider(final Object input) { if (labelProvider == null) { labelProvider = CommonUtils.getAdapter(input, ILabelProvider.class); if (labelProvider == null) { AdapterFactory adapterFactory = EMFUtils.getAdapterFactory(input); if (adapterFactory != null) { AdapterFactoryLabelProvider adlp = new AdapterFactoryLabelProvider(adapterFactory); adlp.setFireLabelUpdateNotifications(true); // why do we need to do this? labelProvider = adlp; } } if (labelProvider != null) { this.labelProviderListener = new ILabelProviderListener() { @Override public void labelProviderChanged(LabelProviderChangedEvent event) { WidgetUtils.runInDisplayThread(getComposite(), new Runnable() { @Override public void run() { updateTitle(); } }); } }; this.labelProvider.addListener(labelProviderListener); } } return labelProvider; }
@Override public void labelProviderChanged(LabelProviderChangedEvent event) { Object[] elements = event.getElements(); if ((elements == null) || (Arrays.asList(elements).contains(planElement))) { TransactionUtils.runInDisplayThread(imageLabel, planElement, new Runnable() { @Override public void run() { textLabel.setText(labelize(PlanPrinter.getPrintName(planElement))); imageLabel.setImage(PlanUtils.getIcon(planElement)); layout(); } }); } }
/** * 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 = this.listeners.getListeners(); for (int i = 0; i < listeners.length; ++i) { final ILabelProviderListener l = (ILabelProviderListener) listeners[i]; SafeRunnable.run(new SafeRunnable() { @Override public void run() { l.labelProviderChanged(event); } }); } }
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)); }
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); } } }
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); } } }
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); } }
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); }