List of usage examples for org.eclipse.jface.viewers IDecoration addSuffix
void addSuffix(String suffix);
From source file:org.cs3.pdt.navigator.internal.decorators.PDTConsultDecoratorContributor.java
License:Open Source License
@Override public void decorate(Object element, IDecoration decoration) { if (!(element instanceof IFile) && !(element instanceof IFolder)) { return;/* w w w . j ava 2 s . c o m*/ } try { // get active pif from console PrologInterface currentPif = PDTCommonUtil.getActivePrologInterface(); if (currentPif == null) { if (element instanceof IFile) { decoration.addOverlay( ImageRepository.getImageDescriptor(ImageRepository.PROLOG_FILE_UNCONSULTED), IDecoration.UNDERLAY); } return; } if (element instanceof IFile) { IFile file = (IFile) element; // final DecorationContext decorationContext = (DecorationContext) decoration.getDecorationContext(); // decorationContext.putProperty(IDecoration.ENABLE_REPLACE, Boolean.TRUE); // check if file is in consulted files list (important for qlf files) String prologFileName = getPrologFileName(file); // XXX: don't mark qlf file if only the pl file is consulted if (prologFileName.endsWith(".qlf")) { prologFileName = prologFileName.substring(0, prologFileName.length() - 3) + "pl"; } // check if file is source_file if (isCurrent(prologFileName)) { decoration.addSuffix(" [consulted]"); if (file.getFileExtension().equalsIgnoreCase("QLF")) { decoration.addOverlay( ImageRepository.getImageDescriptor(ImageRepository.QLF_FILE_CONSULTED), IDecoration.BOTTOM_LEFT); } else { decoration.addOverlay( ImageRepository.getImageDescriptor(ImageRepository.PROLOG_FILE_CONSULTED), IDecoration.UNDERLAY); } } else if (isOld(prologFileName)) { decoration.addSuffix(" [consulted]"); if (file.getFileExtension().equalsIgnoreCase("QLF")) { decoration.addOverlay( ImageRepository.getImageDescriptor(ImageRepository.QLF_FILE_CONSULTED_OLD), IDecoration.BOTTOM_LEFT); } else { decoration.addOverlay( ImageRepository.getImageDescriptor(ImageRepository.PROLOG_FILE_CONSULTED_OLD), IDecoration.UNDERLAY); } } else { decoration.addOverlay( ImageRepository.getImageDescriptor(ImageRepository.PROLOG_FILE_UNCONSULTED), IDecoration.UNDERLAY); } } else { IFolder folder = (IFolder) element; String dirName = Util.prologFileName(folder.getRawLocation().toFile()); if (isContainingFolder(dirName)) { decoration.addOverlay( ImageRepository.getImageDescriptor(ImageRepository.PROLOG_FOLDER_CONSULTED), IDecoration.TOP_LEFT); } } } catch (Exception e) { Debug.error("Error during decoration of " + (element == null ? null : element.toString())); Debug.report(e); } }
From source file:org.deved.antlride.internal.ui.decorators.AntlrLabelDecorator.java
License:Open Source License
public void decorate(Object element, IDecoration decoration) { StringBuilder builder = new StringBuilder(" ["); AntlrGeneratedResource resource = (AntlrGeneratedResource) element; builder.append(resource.getGrammarName()); builder.append("]"); decoration.addSuffix(builder.toString()); }
From source file:org.eclipse.cft.server.ui.internal.CloudFoundryDecorator.java
License:Open Source License
public void decorate(Object element, final IDecoration decoration) { if (element instanceof ModuleServer) { ModuleServer moduleServer = (ModuleServer) element; IServer s = moduleServer.getServer(); if (s != null && CloudServerUtil.isCloudFoundryServer(s)) { IModule[] modules = moduleServer.getModule(); if (modules != null && modules.length == 1) { CloudFoundryServer server = getCloudFoundryServer(moduleServer.getServer()); if (server == null || !server.isConnected()) { return; }/* ww w .ja v a 2s . c o m*/ CloudFoundryApplicationModule module = server.getExistingCloudModule(modules[0]); // module may no longer exist if (module == null) { return; } if (module.getLocalModule() != null) { // show local information? } CloudApplication application = module.getApplication(); if (application != null) { String deployedAppName = application.getName(); IModule localModule = module.getLocalModule(); // Only show "Deployed as" when the local module name does not match the deployed app name. if (localModule != null && !localModule.getName().equals(deployedAppName)) { decoration.addSuffix( NLS.bind(Messages.CloudFoundryDecorator_SUFFIX_DEPLOYED_AS, deployedAppName)); } else { decoration.addSuffix(Messages.CloudFoundryDecorator_SUFFIX_DEPLOYED); } } else { decoration.addSuffix(Messages.CloudFoundryDecorator_SUFFIX_NOT_DEPLOYED); } if (module.getStatus() != null && !module.getStatus().isOK()) { if (module.getStatus().getSeverity() == IStatus.ERROR) { decoration.addOverlay(CloudFoundryImages.OVERLAY_ERROR, IDecoration.BOTTOM_LEFT); } else if (module.getStatus().getSeverity() == IStatus.WARNING) { decoration.addOverlay(CloudFoundryImages.OVERLAY_WARNING, IDecoration.BOTTOM_LEFT); } } } } } else if (element instanceof Server) { Server server = (Server) element; if (CloudServerUtil.isCloudFoundryServer(server)) { final CloudFoundryServer cfServer = getCloudFoundryServer(server); if (cfServer != null && cfServer.getUsername() != null) { // This now runs on a non UI thread, so we need to join this // update to a UI thread. Display.getDefault().syncExec(new Runnable() { @Override public void run() { // decoration.addSuffix(NLS.bind(" [{0}, {1}]", // cfServer.getUsername(), cfServer.getUrl())); if (cfServer.hasCloudSpace()) { CloudFoundrySpace clSpace = cfServer.getCloudFoundrySpace(); if (clSpace != null) { decoration.addSuffix( NLS.bind(" - {0} - {1}", clSpace.getOrgName(), clSpace.getSpaceName())); //$NON-NLS-1$ } } try { List<AbstractCloudFoundryUrl> cloudUrls = CloudServerUIUtil.getAllUrls( cfServer.getBehaviour().getServer().getServerType().getId(), null); String url = cfServer.getUrl(); // decoration.addSuffix(NLS.bind(" {0}", // cfServer.getUsername())); for (AbstractCloudFoundryUrl cloudUrl : cloudUrls) { if (cloudUrl.getUrl().equals(url)) { decoration.addSuffix(NLS.bind(" - {0}", cloudUrl.getUrl())); //$NON-NLS-1$ break; } } } catch (CoreException e) { CloudFoundryServerUiPlugin.logError(e); } } }); } } } }
From source file:org.eclipse.datatools.connectivity.sqm.core.internal.ui.explorer.providers.decorators.impl.ColumnDecorationService.java
License:Open Source License
private void decorate(Column column, IDecoration decoration) { boolean pk = column.isPartOfPrimaryKey(); boolean fk = column.isPartOfForeignKey(); boolean nullable = column.isNullable(); String dataType = IDataToolsUIServiceManager.INSTANCE.getColumnHelperService().getDataType(column); if (fk && pk) { decoration.addSuffix(ColumnDecoratorUtil.getPKFKColumnDecoration(dataType)); decoration.addOverlay(ImageDescription.getPKFKDecorationDescriptor()); } else if (fk && nullable) { decoration.addSuffix(ColumnDecoratorUtil.getFKNullableColumnDecoration(dataType)); decoration.addOverlay(ImageDescription.getFKDecorationDescriptor()); } else if (fk) { decoration.addSuffix(ColumnDecoratorUtil.getFKColumnDecoration(dataType)); decoration.addOverlay(ImageDescription.getFKDecorationDescriptor()); } else if (pk) { decoration.addSuffix(ColumnDecoratorUtil.getPKColumnDecoration(dataType)); decoration.addOverlay(ImageDescription.getPKDecorationDescriptor()); } else if (nullable) { decoration.addSuffix(ColumnDecoratorUtil.getNullableColumnDecoration(dataType)); } else {// ww w. ja va 2 s .c o m decoration.addSuffix(ColumnDecoratorUtil.getColumnDecoration(dataType)); } }
From source file:org.eclipse.datatools.connectivity.sqm.core.internal.ui.explorer.providers.decorators.impl.DependencyDecorationService.java
License:Open Source License
private void decorate(Dependency dependency, IDecoration decoration) { EObject eObject = dependency.getTargetEnd(); if (eObject instanceof ENamedElement) { decoration.addSuffix( MessageFormat.format(TARGET_NAME, new String[] { ((ENamedElement) eObject).getName() })); }// ww w .ja v a 2 s . c o m }
From source file:org.eclipse.datatools.connectivity.sqm.core.internal.ui.explorer.providers.decorators.impl.FilterNodeDecorationService.java
License:Open Source License
/** * @see org.eclipse.jface.viewers.ILightweightLabelDecorator#decorate(java.lang.Object, org.eclipse.jface.viewers.IDecoration) */// w w w. j a va 2 s . c o m public void decorate(Object element, IDecoration decoration) { IFilterNode filterNode = (IFilterNode) element; if (hasFiltering(filterNode)) { decoration.addOverlay(ImageDescription.getFilterDecorationDescriptor(), IDecoration.BOTTOM_RIGHT); decoration.addSuffix(FILTERED); } }
From source file:org.eclipse.datatools.connectivity.sqm.core.internal.ui.explorer.providers.decorators.impl.ForeignKeyDecorationService.java
License:Open Source License
/** * @see org.eclipse.jface.viewers.ILightweightLabelDecorator#decorate(java.lang.Object, org.eclipse.jface.viewers.IDecoration) *///w w w . ja va 2 s . c o m public void decorate(Object element, IDecoration decoration) { if (element instanceof ForeignKey) { decoration.addSuffix(getForeignKeyDecoration((ForeignKey) element)); } }
From source file:org.eclipse.datatools.connectivity.sqm.core.internal.ui.explorer.providers.decorators.impl.IndexTriggerDecorationService.java
License:Open Source License
public void decorate(Object element, IDecoration decoration) { decoration.addSuffix(getDecoration(element)); }
From source file:org.eclipse.datatools.enablement.asa.internal.ui.decorator.ProxyTableDecorationService.java
License:Open Source License
public void decorate(Object element, IDecoration decoration) { if (element instanceof SybaseASABaseProxyTable) { SybaseASABaseProxyTable table = (SybaseASABaseProxyTable) element; decoration.addSuffix(" [" + table.getRemoteObjectLocation() + "]"); }//from w w w . j av a2s. co m }
From source file:org.eclipse.datatools.enablement.ingres.internal.ui.providers.decorators.SynonymDecorationService.java
License:Open Source License
public void decorate(IngresSynonym synonym, IDecoration decoration) { decoration .addSuffix(MessageFormat.format(SYNONYM_NAME_DECORATION, new String[] { synonym.getTableName() })); }