List of usage examples for org.eclipse.jface.viewers IDecoration addSuffix
void addSuffix(String suffix);
From source file:org.seasar.weblauncher.decorator.WebRunningDecorator.java
License:Apache License
public void decorate(Object element, IDecoration decoration) { try {/* w w w.jav a 2 s . c o m*/ if (element instanceof IAdaptable) { IAdaptable adaptable = (IAdaptable) element; IProject project = (IProject) adaptable.getAdapter(IProject.class); Object o = project.getSessionProperty(Constants.KEY_SERVER_STATE); WebPreferences pref = Activator.getPreferences(project); if (o instanceof ITerminate) { ITerminate t = (ITerminate) o; if (t.isTerminated()) { project.setSessionProperty(Constants.KEY_SERVER_STATE, null); } else { decoration.addSuffix(" [Web:" + pref.getWebPortNo() + "]"); decoration.addOverlay(Images.RUNNING, IDecoration.BOTTOM_RIGHT); } } } } catch (CoreException e) { } }
From source file:org.sonarlint.eclipse.ui.internal.server.ServerDecorator.java
License:Open Source License
private static void addSuffix(IDecoration decoration, String suffix) { decoration.addSuffix(" [" + suffix + "]"); }
From source file:org.spearce.egit.ui.internal.decorators.GitResourceDecorator.java
License:Open Source License
public void decorate(final Object element, final IDecoration decoration) { final IResource rsrc = toIResource(element); if (rsrc == null) return;// w w w. j a v a 2s. c o m // If the workspace has not been refreshed properly a resource might // not actually exist, so we ignore these and do not decorate them if (!rsrc.exists() && !rsrc.isPhantom()) { Activator.trace("Tried to decorate non-existent resource " + rsrc); return; } RepositoryMapping mapped = RepositoryMapping.getMapping(rsrc); // TODO: How do I see a renamed resource? // TODO: Even trickier: when a path change from being blob to tree? try { if (mapped != null) { Repository repository = mapped.getRepository(); GitIndex index = repository.getIndex(); String repoRelativePath = mapped.getRepoRelativePath(rsrc); Tree headTree = repository.mapTree("HEAD"); TreeEntry blob = headTree != null ? headTree.findBlobMember(repoRelativePath) : null; Entry entry = index.getEntry(repoRelativePath); if (entry == null) { if (blob == null) { if (rsrc instanceof IContainer) { Integer df = (Integer) rsrc.getSessionProperty(GITFOLDERDIRTYSTATEPROPERTY); Boolean f = df == null ? isDirty(rsrc) : Boolean.valueOf(df.intValue() == CHANGED); if (f != null) { if (f.booleanValue()) { decoration.addPrefix(">"); // Have not // seen orState(rsrc, CHANGED); } else { orState(rsrc, UNCHANGED); // decoration.addSuffix("=?"); } } else { decoration.addSuffix(" ?* "); } if (rsrc instanceof IProject) { Repository repo = mapped.getRepository(); try { String branch = repo.getBranch(); if (repo.isStGitMode()) { String patch = repo.getPatch(); decoration.addSuffix(" [StGit " + patch + "@" + branch + "]"); } else { RepositoryState repositoryState = repo.getRepositoryState(); String statename; if (repositoryState.equals(RepositoryState.SAFE)) statename = ""; else statename = repositoryState.getDescription() + " "; decoration.addSuffix(" [Git " + statename + "@ " + branch + "]"); } } catch (IOException e) { e.printStackTrace(); decoration.addSuffix(" [Git ?]"); } decoration.addOverlay(UIIcons.OVR_SHARED); } } else { if (Team.isIgnoredHint(rsrc)) { decoration.addSuffix("(ignored)"); } else { decoration.addPrefix(">"); decoration.addSuffix("(untracked)"); orState(rsrc.getParent(), CHANGED); } } } else { if (!(rsrc instanceof IContainer)) { decoration.addSuffix("(deprecated)"); // Will drop on // commit decoration.addOverlay(UIIcons.OVR_PENDING_REMOVE); orState(rsrc.getParent(), CHANGED); } } } else { if (entry.getStage() != GitIndex.STAGE_0) { decoration.addSuffix("(conflict)"); decoration.addOverlay(UIIcons.OVR_CONFLICT); orState(rsrc.getParent(), CHANGED); return; } if (blob == null) { decoration.addOverlay(UIIcons.OVR_PENDING_ADD); orState(rsrc.getParent(), CHANGED); } else { if (entry.isAssumedValid()) { decoration.addOverlay(UIIcons.OVR_ASSUMEVALID); return; } decoration.addOverlay(UIIcons.OVR_SHARED); if (entry.isModified(mapped.getWorkDir(), true)) { decoration.addPrefix(">"); decoration.addSuffix("(not updated)"); orState(rsrc.getParent(), CHANGED); } else { if (!entry.getObjectId().equals(blob.getId())) decoration.addPrefix(">"); else decoration.addPrefix(""); // set it to avoid further calls } } } } } catch (IOException e) { decoration.addSuffix("?"); // If we throw an exception Eclipse will log the error and // unregister us thereby preventing us from dragging down the // entire workbench because we are crashing. // throw new RuntimeException(UIText.Decorator_failedLazyLoading, e); } catch (CoreException e) { throw new RuntimeException(UIText.Decorator_failedLazyLoading, e); } }
From source file:org.springframework.ide.eclipse.boot.ui.BootProjectDecorator.java
License:Open Source License
@Override public void decorate(Object element, IDecoration decoration) { IProject project = getProject(element); if (project != null) { // workaround m2e initialization issue to avoid broken m2e if (BootPropertyTester.workaroundMavenBundleInitializationIssue(project)) { return; }//w w w. j av a 2 s . co m if (BootPropertyTester.isBootProject(project)) { decoration.addSuffix(" [boot]"); if (BootPropertyTester.hasDevtools(project)) { decoration.addSuffix(" [devtools]"); } } } }
From source file:org.springframework.ide.eclipse.roo.ui.internal.listener.RooProjectDecorator.java
License:Open Source License
@Override public void decorate(Object element, IDecoration decoration) { IProject project = getProject(element); if (project != null) { try {/*from w w w . j a v a2s. com*/ if (project.getNature(RooCoreActivator.NATURE_ID) != null) { decoration.addSuffix(" [roo] "); } } catch (CoreException e) { e.printStackTrace(); } } }
From source file:org.talend.mdm.repository.ui.navigator.MDMServerDecorator.java
License:Open Source License
private void decorateRepositoryObject(Item item, IDecoration decoration) { if (item != null) { String version = item.getProperty().getVersion(); if (item instanceof WSResourceItem) { // resource image show catalog WSResourceItem ritem = (WSResourceItem) item; String imageCatalog = ritem.getResource().getImageCatalog(); if (imageCatalog != null) { decoration.addSuffix(" " + imageCatalog); //$NON-NLS-1$ }/*from w w w . ja v a2 s . c om*/ } else if (version != null) { decoration.addSuffix(" " + version); //$NON-NLS-1$ } MDMServerDef serverDef = RepositoryResourceUtil.getLastServerDef(item); if (serverDef != null) { decoration.addOverlay(IMG_SERVER, IDecoration.TOP_RIGHT); decoration.addSuffix(" " + serverDef.getName()); //$NON-NLS-1$ } } }
From source file:org.talend.mdm.repository.ui.navigator.MDMServerDecorator.java
License:Open Source License
private void decorateRecycleBin(Item item, IDecoration decoration) { ItemState state = item.getState();//from w w w . j a v a 2 s.c om String path = state.getPath(); if (item instanceof ContainerItem) { int index = path.lastIndexOf(IPath.SEPARATOR); if (index > 0) { path = path.substring(0, index); } else if (index == 0) { path = ""; //$NON-NLS-1$ } } if (path.length() > 0) { decoration.addSuffix(" (" + path + ")"); //$NON-NLS-1$ //$NON-NLS-2$ } }
From source file:org.tigris.subversion.subclipse.ui.decorator.SVNDecoratorConfiguration.java
License:Open Source License
/** * add a prefix and a suffix depending on format string and the bindings * @param decoration/*from w w w . jav a2 s . c o m*/ * @param format * @param bindings */ public static void decorate(IDecoration decoration, IDecoratorComponent[][] format, Map bindings) { String[] prefixSuffix = decorate(format, bindings); decoration.addPrefix(prefixSuffix[0]); decoration.addSuffix(prefixSuffix[1]); }
From source file:org.wso2.developerstudio.eclipse.greg.manager.local.decorators.RegistryResourceDecorator.java
License:Open Source License
/** * decorate checked out files and folders with images according to the state * whether the file or folder is in-sync with remote registry etc *///from ww w . j av a 2s . c o m public void decorate(Object element, IDecoration decoration) { if (element instanceof IFolder || element instanceof IFile) { IResource resource = (IResource) element; if (distinctFiles.contains(resource.getName())) { if (resource.getParent() instanceof IProject) return; } ImageDescriptor imageDescriptor = getImageDescriptor(resource); if (imageDescriptor != null) { decoration.addOverlay(imageDescriptor); } if (resource.getLocation() != null) { if (RegistryCheckInClientUtils.isRegistryResource(resource.getLocation().toOSString())) { try { RemoteRegistryInfo r = RegistryCheckInClientUtils .getResourceRemoteRegistryUrlInfo(resource.getLocation().toOSString()); Date date = new Date(r.getResourceLastUpdateTime()); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("M/d/yyyy, h:mm a "); String suffix = " [" + simpleDateFormat.format(date) + " " + r.getResourceLastUpdateUser() + "] "; decoration.addSuffix(suffix); } catch (Exception e) { decoration.addSuffix(" Error"); } } } } }
From source file:rabbit.ui.internal.decorators.RabbitDecorator.java
License:Apache License
private void decorateDate(LocalDate date, IDecoration decoration) { checkDateFields();/*from w w w .j a v a 2 s. c o m*/ int yearDiff = today.getYear() - date.getYear(); int dayOfYearDiff = today.getDayOfYear() - date.getDayOfYear(); if (yearDiff == 0 & dayOfYearDiff == 0) { decoration.addSuffix(" [Today]"); } else if ((yearDiff == 0 & dayOfYearDiff == 1) | (yearDiff == 1 & isFirstDayOfYear(today) & isLastDayOfYear(date))) { decoration.addSuffix(" [Yesterday]"); } }