List of usage examples for org.eclipse.jface.viewers IDecoration addOverlay
void addOverlay(ImageDescriptor overlay, int quadrant);
From source file:gov.redhawk.ide.sdr.internal.ui.IdlLibraryDecorator.java
License:Open Source License
/** * {@inheritDoc}//from ww w. j av a 2s . c om */ @Override public void decorate(final Object element, final IDecoration decoration) { if (element instanceof IdlLibrary) { final IdlLibrary library = (IdlLibrary) element; ScaModelCommand.execute(library, new ScaModelCommand() { @Override public void execute() { if (!library.eAdapters().contains(libraryListener)) { library.eAdapters().add(libraryListener); } } }); if (library.getLoadStatus() != null) { final ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages(); final IStatus status = library.getLoadStatus(); switch (status.getSeverity()) { case IStatus.WARNING: decoration.addOverlay(sharedImages.getImageDescriptor(ISharedImages.IMG_DEC_FIELD_WARNING), IDecoration.BOTTOM_RIGHT); break; case IStatus.ERROR: decoration.addOverlay(sharedImages.getImageDescriptor(ISharedImages.IMG_DEC_FIELD_ERROR), IDecoration.BOTTOM_RIGHT); break; default: break; } } } }
From source file:gov.redhawk.ide.sdr.internal.ui.SdrRootDecorator.java
License:Open Source License
/** * {@inheritDoc}/*from w w w.j a v a 2 s. c o m*/ */ @Override public void decorate(final Object element, final IDecoration decoration) { if (element instanceof SdrRoot) { final SdrRoot sdrRoot = (SdrRoot) element; ScaModelCommand.execute(sdrRoot, new ScaModelCommand() { @Override public void execute() { if (!sdrRoot.eAdapters().contains(sdrRootListener)) { sdrRoot.eAdapters().add(sdrRootListener); } } }); if (sdrRoot.getLoadStatus() != null) { final ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages(); final IStatus status = sdrRoot.getLoadStatus(); if (status == null) { return; } switch (status.getSeverity()) { case IStatus.WARNING: decoration.addOverlay(sharedImages.getImageDescriptor(ISharedImages.IMG_DEC_FIELD_WARNING), IDecoration.BOTTOM_RIGHT); break; case IStatus.ERROR: decoration.addOverlay(sharedImages.getImageDescriptor(ISharedImages.IMG_DEC_FIELD_ERROR), IDecoration.BOTTOM_RIGHT); break; default: break; } } } }
From source file:gov.redhawk.sca.internal.ui.StatusDataProviderDecorator.java
License:Open Source License
@Override public void decorate(final Object element, final IDecoration decoration) { if (element instanceof IStatusProvider) { final IStatusProvider statusProvider = (IStatusProvider) element; ScaModelCommand.execute(statusProvider, new ScaModelCommand() { @Override//w ww. j a v a2 s . c o m public void execute() { if (!statusProvider.eAdapters().contains(StatusDataProviderDecorator.this.adaperListener)) { statusProvider.eAdapters().add(StatusDataProviderDecorator.this.adaperListener); } } }); final ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages(); IStatus status = statusProvider.getStatus(); if (status == null) { status = Status.OK_STATUS; } switch (status.getSeverity()) { case IStatus.WARNING: decoration.addOverlay(sharedImages.getImageDescriptor(ISharedImages.IMG_DEC_FIELD_WARNING), IDecoration.BOTTOM_LEFT); break; case IStatus.ERROR: decoration.addOverlay(sharedImages.getImageDescriptor(ISharedImages.IMG_DEC_FIELD_ERROR), IDecoration.BOTTOM_LEFT); break; default: break; } } }
From source file:gov.redhawk.sca.model.provider.refresh.internal.ui.RefreshDataProviderDecorator.java
License:Open Source License
/** * {@inheritDoc}/* w w w . j av a2s. c o m*/ */ @Override public void decorate(final Object element, final IDecoration decoration) { if (element instanceof DataProviderObject) { final DataProviderObject dataProvider = (DataProviderObject) element; final RefreshTasker task = ScaModelCommandWithResult.execute(dataProvider, new ScaModelCommandWithResult<RefreshTasker>() { @Override public void execute() { for (final IScaDataProvider provider : dataProvider.getDataProviders()) { if (provider instanceof RefreshTasker) { final RefreshTasker job = (RefreshTasker) provider; setResult(job); return; } } } }); if (task != null) { if (!task.isActive()) { decoration.addOverlay(RefreshProviderUIActivator.getDefault() .getImageDescriptor("icons/stock-media-pause.png"), IDecoration.TOP_RIGHT); } // Don't add a second listener if we have already added one for (PropertyChangeListener l : task.getPropertyChangeListeners()) { if (l instanceof PropertyListener && ((PropertyListener) l).element == dataProvider) { return; } } task.addPropertyChangeListener(new PropertyListener(dataProvider)); } } }
From source file:info.limpet.ui.decorators.LimpetDecorator.java
License:Open Source License
protected void decorateWrapper(CommandWrapper element, IDecoration decoration) { final ICommand<?> coll = element.getCommand(); boolean in = coll.getInputs() != null && coll.getInputs().size() > 0; boolean out = coll.getOutputs() != null && coll.getOutputs().size() > 0; decorateInOut(decoration, in, out);/*www . j a v a 2 s. co m*/ // also apply a decoration to indicate that the symbol is dynamically updating if (coll.getDynamic()) { decoration.addOverlay(DYNAMIC, IDecoration.BOTTOM_RIGHT); } }
From source file:info.limpet.ui.decorators.LimpetDecorator.java
License:Open Source License
protected void decorateWrapper(CollectionWrapper element, IDecoration decoration) { final ICollection coll = element.getCollection(); boolean out = coll.getPrecedent() != null; boolean in = coll.getDependents() != null && coll.getDependents().size() > 0; decorateInOut(decoration, in, out);//from w w w .java 2s .c om if (coll.isTemporal()) { decoration.addOverlay(TIME, IDecoration.BOTTOM_RIGHT); } if (coll.getValuesCount() == 1) { decoration.addOverlay(SINGLE, IDecoration.BOTTOM_LEFT); } }
From source file:info.limpet.ui.decorators.LimpetDecorator.java
License:Open Source License
private void decorateInOut(IDecoration decoration, boolean in, boolean out) { if (in && out) { decoration.addOverlay(TWO_WAY_ARROW, IDecoration.TOP_RIGHT); } else if (out) { decoration.addOverlay(LEFT_ARROW, IDecoration.TOP_RIGHT); } else if (in) { decoration.addOverlay(RIGHT_ARROW, IDecoration.TOP_RIGHT); }/*from ww w .ja v a 2 s .c o m*/ }
From source file:it.intecs.pisa.develenv.ui.decorators.TOOLBOXProjectDecorator.java
License:Open Source License
public void decorate(Object element, IDecoration decoration) { /**// w ww .j a v a 2s .co m * Checks that the element is an IResource with the 'Read-only' attribute * and adds the decorator based on the specified image description and the * integer representation of the placement option. */ if (isTBXProject(element)) { iconPath = getIconByType(element); if (iconPath != null) { IResource resource = (IResource) element; ResourceAttributes attrs = resource.getResourceAttributes(); URL url = Platform.find(Platform.getBundle("com.intecs.ToolboxScript.ui"), new Path(iconPath)); //NON-NLS-1 if (url == null) return; descriptor = ImageDescriptor.createFromURL(url); quadrant = IDecoration.BOTTOM_RIGHT; decoration.addOverlay(descriptor, quadrant); } } }
From source file:libgdxplugin.decorators.ReadOnly.java
License:Open Source License
public void decorate(Object element, IDecoration decoration) { /**/*from ww w.j av a2 s .c o m*/ * Checks that the element is an IResource with the 'Read-only' attribute * and adds the decorator based on the specified image description and the * integer representation of the placement option. */ IResource resource = (IResource) element; ResourceAttributes attrs = resource.getResourceAttributes(); if (attrs.isReadOnly()) { URL url = FileLocator.find(Platform.getBundle("LibgdxPlugin"), new Path(iconPath), null); //NON-NLS-1 if (url == null) return; descriptor = ImageDescriptor.createFromURL(url); quadrant = IDecoration.BOTTOM_RIGHT; decoration.addOverlay(descriptor, quadrant); } }
From source file:metabest.ui.decorators.TestcaseFolderDecorator.java
License:Open Source License
public void decorate(Object element, IDecoration decoration) { /**// www . j a v a 2s . c o m * Checks that the element is an IResource with the 'Read-only' attribute * and adds the decorator based on the specified image description and the * integer representation of the placement option. */ IResource resource = (IResource) element; if (resource instanceof IFolder) { IFolder folder = (IFolder) resource; try { if (folder.getPersistentProperty(MetaBestPersistentProperties.FOLDER_KEY) != null && folder.getPersistentProperty(MetaBestPersistentProperties.FOLDER_KEY) .equals(MetaBestPersistentProperties.FOLDER_KEY_TESTCASE)) { URL url = FileLocator.find(Platform.getBundle("metabest"), new Path(iconPath), null); //NON-NLS-1 if (url == null) return; descriptor = ImageDescriptor.createFromURL(url); quadrant = IDecoration.TOP_RIGHT; decoration.addOverlay(descriptor, quadrant); } } catch (CoreException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }