List of usage examples for org.eclipse.jface.viewers IDecoration TOP_RIGHT
int TOP_RIGHT
To view the source code for org.eclipse.jface.viewers IDecoration TOP_RIGHT.
Click Source Link
From source file:com.aptana.editor.js.contentassist.JSModelFormatter.java
License:Open Source License
/** * getImage/*from w ww . j av a 2s . co m*/ * * @param property * @return */ public Image getImage(PropertyElement property) { String key = "property"; //$NON-NLS-1$ Image result = PROPERTY; if (property instanceof FunctionElement) { key = "function"; //$NON-NLS-1$ result = TYPE_IMAGE_MAP.get(JSTypeConstants.FUNCTION_TYPE); } if (property != null) { List<String> types = property.getTypeNames(); if (types != null && types.size() == 1) { String type = types.get(0); if (TYPE_IMAGE_MAP.containsKey(type)) { result = TYPE_IMAGE_MAP.get(type); key = type; } else if (type.startsWith(JSTypeConstants.DYNAMIC_CLASS_PREFIX)) { result = TYPE_IMAGE_MAP.get(JSTypeConstants.OBJECT_TYPE); key = "object"; //$NON-NLS-1$ } else if (type.startsWith(JSTypeConstants.FUNCTION_TYPE)) { result = TYPE_IMAGE_MAP.get(JSTypeConstants.FUNCTION_TYPE); key = "function"; //$NON-NLS-1$ } else if (type.endsWith(JSTypeConstants.ARRAY_LITERAL)) { result = TYPE_IMAGE_MAP.get(JSTypeConstants.ARRAY_TYPE); key = "array"; //$NON-NLS-1$ } } if (property.isClassProperty()) { key += ".static"; //$NON-NLS-1$ result = addOverlay(result, STATIC_OVERLAY, IDecoration.TOP_RIGHT, key); } if (property.isDeprecated()) { key += ".deprecated"; //$NON-NLS-1$ result = addOverlay(result, DEPRECATED_OVERLAY, IDecoration.TOP_LEFT, key); } } return result; }
From source file:com.aptana.editor.js.views.JSIndexViewLabelProvider.java
License:Open Source License
public Image decorateImage(Image image, Object element) { Image result = null;//from ww w. j ava 2 s .c om if (image != null && element instanceof PropertyElement) { PropertyElement property = (PropertyElement) element; if (property.isClassProperty()) { DecorationOverlayIcon decorator = new DecorationOverlayIcon(image, STATIC_OVERLAY, IDecoration.TOP_RIGHT); result = decorator.createImage(); } } return result; }
From source file:com.github.sdbg.debug.ui.internal.dialogs.CreateLaunchAction.java
License:Open Source License
/** * Create a new CreateLaunchAction.// ww w. j ava 2 s.c o m */ public CreateLaunchAction(ManageLaunchesDialog launchConfigurationDialog, ILaunchConfigurationType configType) { super("Create a new " + configType.getName()); this.launchConfigurationDialog = launchConfigurationDialog; this.configType = configType; setImageDescriptor(new DecorationOverlayIcon( SDBGDebugUIPlugin.getImage(DebugUITools.getDefaultImageDescriptor(configType)), SDBGDebugUIPlugin.getImageDescriptor("ovr16/new.png"), IDecoration.TOP_RIGHT)); }
From source file:com.liferay.ide.project.ui.LiferayPluginProjectDecorator.java
License:Open Source License
public void decorate(Object element, IDecoration decoration) { if (element instanceof IProject) { IProject project = (IProject) element; ImageDescriptor overlay = null;/*from www . ja v a2s . c om*/ if (hasFacet(project, PORTLET_FACET)) { overlay = getLiferay(); } else if (hasFacet(project, HOOK_FACET)) { overlay = getLiferay(); } else if (hasFacet(project, EXT_FACET)) { overlay = getLiferay(); } else if (hasFacet(project, LAYOUTTPL_FACET)) { overlay = getLiferay(); } else if (hasFacet(project, THEME_FACET)) { overlay = getLiferay(); } else if (hasFacet(project, WEB_FACET)) { overlay = getLiferay(); } else if (hasNature(project, LiferayNature.NATURE_ID)) { overlay = getLiferay(); } if (overlay != null) { // next two lines dangerous! // DecorationContext ctx = (DecorationContext) decoration.getDecorationContext(); // ctx.putProperty( IDecoration.ENABLE_REPLACE, true ); decoration.addOverlay(overlay, IDecoration.TOP_RIGHT); } } }
From source file:com.nextep.designer.synch.ui.decorators.DataSynchronizationDecorator.java
License:Open Source License
public void decorate(Object element, IDecoration decoration) { if (element instanceof IBasicTable) { if (descriptor == null) { descriptor = SynchUIPlugin.imageDescriptorFromPlugin(SynchUIPlugin.PLUGIN_ID, "/resource/datasync-deco.png"); //$NON-NLS-1$ }/*from w w w. j a v a 2 s .com*/ quadrant = IDecoration.TOP_RIGHT; Collection<IVersionable<?>> tables = SynchUIPlugin.getService(ISynchronizationUIService.class) .getDataSynchronizationTables(); if (tables.contains(element)) { decoration.addOverlay(descriptor, quadrant); } } }
From source file:com.nokia.tools.vct.confml.editor.view.viewers.ViewTreeViewerLabelDecorator.java
License:Open Source License
public void decorate(Object element, IDecoration decoration) { if (element instanceof ESetting) { if (((ESetting) element).isReadOnly()) { decoration.addOverlay(readOnlyDescriptor, IDecoration.TOP_RIGHT); }/*from w ww. j a v a2s .c o m*/ } else if (element instanceof ESettingEntryImpl) { if (((ESettingEntryImpl) element).getValue().isReadOnly()) { decoration.addOverlay(readOnlyDescriptor, IDecoration.TOP_RIGHT); decoration.addOverlay(warningDescriptor, IDecoration.BOTTOM_LEFT); } } else if (hasMarker(element, ERROR, null)) { decoration.addOverlay(errorDescriptor, IDecoration.BOTTOM_LEFT); } else if (hasMarker(element, WARNING, null)) { decoration.addOverlay(warningDescriptor, IDecoration.BOTTOM_LEFT); } if (element instanceof ESettingRef) { ESettingRef ref = (ESettingRef) element; if (ref.getTarget() instanceof ESetting) { if (((ESetting) ref.getTarget()).isReadOnly()) { decoration.addOverlay(readOnlyDescriptor, IDecoration.TOP_RIGHT); } } } if (element instanceof EAppFeature) { EAppFeature feature = (EAppFeature) element; if (isDefaultValue(feature)) { decoration.setFont(DEFAULT_FONT); } else { decoration.setFont(BOLD_FONT); } } }
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 {/* w w w . j a v a 2 s .co 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;//from w w w . j av a2 s . c o m /* * 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:com.sonatype.buildserver.api.HudsonImages.java
License:Open Source License
public static Image getOverlayImage(String base, String overlay, int quadrant) { assert quadrant == IDecoration.TOP_RIGHT || quadrant == IDecoration.BOTTOM_RIGHT : "only botton_right and top_right supported"; return com.sonatype.buildserver.eclipse.ui.HudsonImages.getOverlayImage(base, quadrant == IDecoration.TOP_RIGHT ? overlay : null, quadrant == IDecoration.BOTTOM_RIGHT ? overlay : null); }
From source file:com.vectrace.MercurialEclipse.synchronize.actions.CreateNewChangesetSynchronizeAction.java
License:Open Source License
public CreateNewChangesetSynchronizeAction(String text, ISynchronizePageConfiguration configuration, ISelectionProvider selectionProvider) { super(text, configuration, selectionProvider); setId(ID);/*ww w. j av a 2 s . co m*/ setImageDescriptor(MercurialEclipsePlugin.getImageDescriptor("elcl16/uncommitted_cs.gif", "ovr/add_ovr.gif", IDecoration.TOP_RIGHT)); }