List of usage examples for org.eclipse.jface.viewers IDecoration addOverlay
void addOverlay(ImageDescriptor overlay, int quadrant);
From source file:org.eclipse.virgo.ide.runtime.internal.ui.providers.ServerTargetPlatformDecorator.java
License:Open Source License
/** * {@inheritDoc}/*from w ww . j a v a 2 s . c o m*/ */ public void decorate(Object element, IDecoration decoration) { if (element instanceof IServer) { IServer srv = (IServer) element; if (srv.getServerType().getId().equals(ServerCorePlugin.VIRGO_SERVER_ID)) { IRuntime runtime = srv.getRuntime(); String name = runtime.getName(); ITargetPlatformService service = PlatformUI.getWorkbench().getService(ITargetPlatformService.class); ITargetHandle handle = null; try { handle = service.getWorkspaceTargetHandle(); } catch (CoreException e) { } if (handle != null) { try { String name2 = handle.getTargetDefinition().getName(); if (name.equals(name2)) { decoration.addOverlay(ServerUiImages.DESC_OBJ_PDE_OVER, IDecoration.TOP_LEFT); } } catch (CoreException e) { } } } } }
From source file:org.eclipseguru.gwt.ui.decorators.GwtLabelDecorator.java
License:Open Source License
/** * Decorates a module descriptor.// w ww. j a va 2 s .c om * * @param resource * @param decoration */ private void decorateModuleDescriptor(final IResource resource, final IDecoration decoration) { decoration.addOverlay(GwtUiImages.DESC_OVERLAY_MODULE, IDecoration.TOP_RIGHT); }
From source file:org.guvnor.tools.GuvnorDecorator.java
License:Apache License
private void addGuvnorOverlay(IDecoration decoration) { int overlayLoc = GuvnorPreferencePage.getOverlayLocationPref(); if (overlayLoc != IGuvnorPreferenceConstants.NO_OVERLAY) { decoration.addOverlay(Activator.getImageDescriptor(Activator.IMG_GUVCONTROLLED), overlayLoc); }/*from www. j a va2s.com*/ }
From source file:org.jboss.ide.eclipse.as.ui.views.server.extensions.ModulePublishDecorator.java
License:Open Source License
public void decorate(Object element, IDecoration decoration) { IStatus ret = recentPublishStatus(element); if (ret != null) { int sev = ret.getSeverity(); if (sev == IStatus.ERROR) { ImageDescriptor id = JBossServerUISharedImages .getImageDescriptor(JBossServerUISharedImages.ERROR_MARKER); decoration.addOverlay(id, IDecoration.BOTTOM_LEFT); }//from w ww. j a v a 2 s . c om } }
From source file:org.jboss.tools.smooks.configuration.validate.ValidateResultLabelDecorator.java
License:Open Source License
public void decorate(Object element, IDecoration d) { try {/* w w w . j a va2s .c om*/ element = AdapterFactoryEditingDomain.unwrap(element); if (element instanceof AbstractAnyType) { final IResource resource = SmooksUIUtils.getResource((EObject) element); final IDecoration decoration = d; final Object fm = element; Display.getDefault().syncExec(new Runnable() { /* * (non-Javadoc) * * @see java.lang.Runnable#run() */ public void run() { IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window == null) { return; } SmooksMultiFormEditor editor = (SmooksMultiFormEditor) window.getActivePage() .findEditor(new FileEditorInput((IFile) resource)); if (editor == null) return; int type = -1; type = markErrorWarningPropertyUI(editor.getDiagnosticList(), fm); if (type == -1) return; decoration.addOverlay(null, IDecoration.BOTTOM_RIGHT); if (type == Diagnostic.ERROR) { decoration.addOverlay(SmooksConfigurationActivator.getDefault().getImageRegistry() .getDescriptor(GraphicsConstants.IMAGE_OVR_ERROR), IDecoration.BOTTOM_RIGHT); } if (type == Diagnostic.WARNING) { decoration.addOverlay(SmooksConfigurationActivator.getDefault().getImageRegistry() .getDescriptor(GraphicsConstants.IMAGE_OVR_WARING), IDecoration.BOTTOM_RIGHT); } } }); } } catch (Exception e) { e.printStackTrace(); } }
From source file:org.kalypso.model.wspm.tuhh.ui.internal.gml.WspmBuildingDecorator.java
License:Open Source License
private void decorateBuilding(final IProfileObject building, final IDecoration decoration) { final String typeLabel = building.getTypeLabel(); /* suffix */// w w w.j a va 2 s. co m if (building instanceof ICulvertBuilding) decoration.addSuffix(String.format(Messages.getString("WspmBuildingDecorator_0"), typeLabel)); //$NON-NLS-1$ else if (building instanceof GenericProfileHorizon) { // FIXME: remove this label // final String id = building.getType(); // decoration.addSuffix( String.format( " ('%s')", id ) ); } else decoration.addSuffix(String.format(" (%s)", typeLabel)); //$NON-NLS-1$ /* icon */ final ImageDescriptor buildingImage = getBuildingImage(building); if (buildingImage != null) decoration.addOverlay(buildingImage, IDecoration.REPLACE); }
From source file:org.kalypso.model.wspm.tuhh.ui.internal.gml.WspmMarkerDecorator.java
License:Open Source License
private void decorateProfile(final IProfileFeature profileFeature, final IDecoration decoration) { if (profileFeature == null) return;//from ww w .ja v a 2s . c om final IProfile profile = profileFeature.getProfile(); if (profile == null) return; /* find worst marker */ final MarkerIndex markerIndex = profile.getProblemMarker(); if (markerIndex == null) return; final IMarker[] markers = markerIndex.getMarkers(); final IMarker worst = MarkerUtils.worstOf(markers); if (worst == null) return; final int severity = MarkerUtils.getSeverity(worst); /* do not decorate info */ if (severity == IMarker.SEVERITY_INFO) return; /* do the decoration */ final ImageDescriptor imageDescriptor = getImage(severity); final String message = worst.getAttribute(IMarker.MESSAGE, null); final String kindText = getKindtext(severity); decoration.addSuffix(String.format(" (%s: %s)", kindText, message)); //$NON-NLS-1$ decoration.addOverlay(imageDescriptor, IDecoration.BOTTOM_RIGHT); }
From source file:org.key_project.key4eclipse.resources.decorator.ProofFileLightweightLabelDecorator.java
License:Open Source License
/** * {@inheritDoc}// w w w.j a v a 2 s . c o m */ @Override public void decorate(Object element, IDecoration decoration) { try { if (element instanceof IFile && KeYResourcesUtil.isProofFile((IFile) element)) { IFile file = (IFile) element; List<IFile> cycle = KeYResourcesUtil.getProofRecursionCycle(file); if (!CollectionUtil.isEmpty(cycle)) { decoration.addOverlay(PlatformUI.getWorkbench().getSharedImages() .getImageDescriptor(ISharedImages.IMG_DEC_FIELD_ERROR), IDecoration.TOP_RIGHT); } else { Boolean closed = KeYResourcesUtil.isProofClosed(file); if (closed != null && !closed.booleanValue()) { decoration.addOverlay(PlatformUI.getWorkbench().getSharedImages() .getImageDescriptor(ISharedImages.IMG_DEC_FIELD_WARNING), IDecoration.TOP_RIGHT); } } } } catch (CoreException e) { LogUtil.getLogger().logError(e); } }
From source file:org.locationtech.udig.project.ui.internal.LayerStatusDecorator.java
License:Open Source License
/** * @see org.eclipse.jface.viewers.ILightweightLabelDecorator#decorate(java.lang.Object, * org.eclipse.jface.viewers.IDecoration) *///from w ww . j a va2 s . co m @SuppressWarnings("unchecked") public synchronized void decorate(Object element, IDecoration decoration) { Layer layer = (Layer) element; // should be safe, extention point does the instanceof // check ImageDescriptor ovr = statusIcon(layer); if (ovr != null) decoration.addOverlay(ovr, IDecoration.BOTTOM_LEFT); // decoration.addOverlay( ProjectUIPlugin.getDefault().getImageDescriptor( ISharedImages.SELECT_UDR ), // IDecoration.UNDERLAY ); if (!layer.eAdapters().contains(adapterImpl)) layer.eAdapters().add(adapterImpl); }
From source file:org.marketcetera.photon.strategy.engine.ui.StrategyEngineStatusDecorator.java
private void replaceImage(final IDecoration decoration, ImageDescriptor imageDescriptor) { /*// ww w. j av a2 s.c om * Without setting IDecoration.ENABLE_REPLACE, IDecoration.REPLACE will * not be respected */ ((DecorationContext) decoration.getDecorationContext()).putProperty(IDecoration.ENABLE_REPLACE, Boolean.TRUE); decoration.addOverlay(imageDescriptor, IDecoration.REPLACE); }