List of usage examples for org.eclipse.jface.viewers IDecoration TOP_LEFT
int TOP_LEFT
To view the source code for org.eclipse.jface.viewers IDecoration TOP_LEFT.
Click Source Link
From source file:com.mountainminds.eclemma.internal.ui.decorators.CoverageDecorator.java
License:Open Source License
public void decorate(Object element, IDecoration decoration) { final ICoverageNode coverage = CoverageTools.getCoverageInfo(element); if (coverage == null) { // no coverage data return;/* w ww .ja v a 2s. c o m*/ } // TODO obtain counter from preferences ICounter counter = coverage.getInstructionCounter(); ImageDescriptor overlay = EclEmmaUIPlugin.getCoverageOverlay(counter.getCoveredRatio()); decoration.addOverlay(overlay, IDecoration.TOP_LEFT); decoration.addSuffix(SUFFIX_FORMAT.format(Double.valueOf(counter.getCoveredRatio()))); }
From source file:com.persistent.ui.decorator.LightWeightDecorator.java
License:Open Source License
@Override public void decorate(Object element, IDecoration decoration) { if (element instanceof IProject) { try {//from w ww . j a va2 s . c o m IProject project = (IProject) element; if (!project.isOpen() || !project.hasNature(WAProjectNature.NATURE_ID)) { return; } URL url = null; URL resolve = null; url = Activator.getDefault().getBundle().getEntry(Messages.projFolder); URL fileURL = FileLocator.toFileURL(url); resolve = FileLocator.resolve(fileURL); ImageDescriptor overlay = ImageDescriptor.createFromURL(resolve); decoration.addOverlay(overlay, IDecoration.TOP_LEFT); } catch (Exception e) { //This class sets the icons for folders, which is not an user //initiated process so only logging the exception. Activator.getDefault().log(Messages.errProjIcon, e); } } else if (element instanceof IFolder) { IFolder folder = (IFolder) element; IProject project = folder.getProject(); try { if (!project.isOpen() || !project.hasNature(WAProjectNature.NATURE_ID)) { return; } WindowsAzureProjectManager projMngr = WindowsAzureProjectManager .load(project.getLocation().toFile()); WindowsAzureRole role = projMngr.roleFromPath(folder.getLocation().toFile()); if (role == null) { return; } URL url = null; URL resolve = null; url = Activator.getDefault().getBundle().getEntry(Messages.roleFolder); URL fileURL = FileLocator.toFileURL(url); resolve = FileLocator.resolve(fileURL); ImageDescriptor overlay = ImageDescriptor.createFromURL(resolve); decoration.addOverlay(overlay, IDecoration.TOP_RIGHT); } catch (Exception e) { //This class sets the icons for folders, which is not an user //initiated process so only logging the exception. Activator.getDefault().log(Messages.errRoleIcon, e); } } }
From source file:com.rcpcompany.uibindings.internal.decorators.extenders.ViewerSpecificLabelDecoratorExtender.java
License:Open Source License
@Override public void extend(final IUIBindingDecoratorExtenderContext context) { final ValidationLabelDecorator labelDecorator = getLabelDecorator(context.getBinding()); if (labelDecorator == null) return;// w w w.ja v a 2 s . com /* * We want to be notified next time the decorator changes... * * Note that we expect the decorator to conform to the comment of #addListener(): "Adds a * listener to this label provider. Has no effect if an identical listener is already * registered.". * * This is done this way to avoid any references from the extender to the decorator, as * these can be problematic when garbage collecting... */ labelDecorator.addListener(this); final EObject element = context.getBinding().getModelObject(); final IDecoration decoration = new IDecoration() { @Override public void addPrefix(String prefix) { // TODO } @Override public void addSuffix(String suffix) { // TODO } @Override public void addOverlay(ImageDescriptor overlay) { final DecorationPosition pos = IManager.Factory.getManager().getMessageDecorationPosition(); switch (pos) { case TOP_LEFT: case CENTER_LEFT: addOverlay(overlay, IDecoration.TOP_LEFT); break; case BOTTOM_LEFT: addOverlay(overlay, IDecoration.BOTTOM_LEFT); break; case TOP_RIGHT: case CENTER_RIGHT: addOverlay(overlay, IDecoration.TOP_RIGHT); break; case BOTTOM_RIGHT: addOverlay(overlay, IDecoration.BOTTOM_RIGHT); break; default: LogUtils.error(this, "Unknown position: " + pos); addOverlay(overlay, IDecoration.TOP_LEFT); break; } } @Override public void addOverlay(ImageDescriptor overlay, int quadrant) { final Image image = getResourceManager().createImage(overlay); switch (quadrant) { case IDecoration.BOTTOM_LEFT: context.setDecoratingImage(DecorationPosition.BOTTOM_LEFT, false, image, null); break; case IDecoration.TOP_LEFT: context.setDecoratingImage(DecorationPosition.TOP_LEFT, false, image, null); break; case IDecoration.BOTTOM_RIGHT: context.setDecoratingImage(DecorationPosition.BOTTOM_RIGHT, false, image, null); break; case IDecoration.TOP_RIGHT: context.setDecoratingImage(DecorationPosition.TOP_RIGHT, false, image, null); break; case IDecoration.REPLACE: context.setImage(image); break; default: LogUtils.error(this, "Unknown quadrant: " + quadrant); break; } } @Override public void setForegroundColor(Color color) { context.setForegound(color); } @Override public void setBackgroundColor(Color color) { context.setBackgound(color); } @Override public void setFont(Font font) { context.setFont(font); } @Override public IDecorationContext getDecorationContext() { return DecorationContext.DEFAULT_CONTEXT; } }; labelDecorator.decorate(element, decoration); }
From source file:de.fu_berlin.inf.dpp.ui.decorators.SharedProjectDecorator.java
License:Open Source License
@Override public void decorate(Object element, IDecoration decoration) { // make a copy as this value might change while decorating ISarosSession currentSession = session; if (currentSession == null) return;// www . j ava2s . c o m IResource resource = (IResource) element; if (!currentSession.isShared(ResourceAdapterFactory.create(resource))) return; decoration.addOverlay(SharedProjectDecorator.PROJECT_DESCRIPTOR, IDecoration.TOP_LEFT); if (resource.getType() == IResource.PROJECT) { boolean isCompletelyShared = currentSession .isCompletelyShared(ResourceAdapterFactory.create(resource.getProject())); decoration.addSuffix(isCompletelyShared ? Messages.SharedProjectDecorator_shared : Messages.SharedProjectDecorator_shared_partial); } }
From source file:de.jcup.egradle.eclipse.decorators.EGradleProjectDecorator.java
License:Apache License
private void decorateImage(IDecoration decoration) { // TOP_LEFT decoration.addOverlay(egradleProjectDescriptor, IDecoration.TOP_LEFT); }
From source file:de.ovgu.featureide.ui.decorators.ActiveConfigurationDecorator.java
License:Open Source License
public void decorate(Object element, IDecoration decoration) { IFeatureProject pd = CorePlugin.getFeatureProject((IResource) element); if (pd != null && ((IResource) element).equals(pd.getCurrentConfiguration())) { decoration.addOverlay(icon, IDecoration.TOP_LEFT); }/*from ww w .j a va2 s.c o m*/ }
From source file:de.ovgu.featureide.ui.decorators.FeatureFolderDecorator.java
License:Open Source License
public void decorate(Object element, IDecoration decoration) { IFolder folder = (IFolder) element;/* w w w. j a v a 2s . co m*/ //decorate only files in our projects IFeatureProject featureProject = CorePlugin.getFeatureProject(folder); if (featureProject == null || featureProject.getSourceFolder() == null || !featureProject.getSourceFolder().equals(folder.getParent())) return; //handle only not-in-use folders if (featureProject.getFeatureModel().containsLayer(folder.getName())) return; //decorate non-empty not-in-use folders decoration.addOverlay(OVERLAY, IDecoration.TOP_LEFT); }
From source file:de.ovgu.featureide.ui.decorators.FeatureProjectDecorator.java
License:Open Source License
public void decorate(Object element, IDecoration decoration) { IProject project = (IProject) element; //decorate feature projects if (CorePlugin.hasProjectData(project)) { decoration.addOverlay(OVERLAY, IDecoration.TOP_LEFT); }/* www .ja v a 2 s .c o m*/ }
From source file:de.ovgu.featureide.ui.mpl.InterfaceProjectDecorator.java
License:Open Source License
@Override public void decorate(Object element, IDecoration decoration) { if (MPLPlugin.getDefault().isInterfaceProject((IProject) element)) { decoration.addOverlay(OVERLAY, IDecoration.TOP_LEFT); }/*from ww w. j a v a 2s .c om*/ }
From source file:de.walware.statet.r.internal.ui.nolazy.RResourceDecorator.java
License:Open Source License
@Override public void decorate(final Object element, final IDecoration decoration) { IProject project = null;//from ww w. ja va 2s .co m if (element instanceof IProject) { project = (IProject) element; } if (project != null) { try { if (project.hasNature(de.walware.statet.r.core.RProjects.R_PKG_NATURE_ID)) { decoration.addOverlay(getPackageProjectOverlay(), IDecoration.TOP_LEFT); } } catch (final CoreException e) { } } }