List of usage examples for org.eclipse.jface.viewers IDecoration addSuffix
void addSuffix(String suffix);
From source file:rabbit.ui.internal.decorators.RabbitDecorator.java
License:Apache License
private void decorateWorkspace(WorkspaceStorage ws, IDecoration decoration) { IPath path = ws.getWorkspacePath();// ww w . ja v a2 s . c o m if (path != null) { decoration.addSuffix(" [" + path.toOSString() + "]"); } else { String guess = ws.getStoragePath().lastSegment().replace(".", SEPARATOR); decoration.addSuffix(" [may be " + guess + "?]"); } }
From source file:sernet.verinice.rcp.DBIDDecorator.java
License:Open Source License
@Override public void decorate(Object o, IDecoration decoration) { if (isElementToDecorate(o)) { CnATreeElement elmt = (CnATreeElement) o; if (Activator.getDefault().getPluginPreferences().getBoolean(PreferenceConstants.SHOW_DBID_DECORATOR)) { decoration.addSuffix( new StringBuilder().append(" <").append((elmt.getDbId())).append(">").toString()); }/*from w w w . jav a 2s . c om*/ } }
From source file:sernet.verinice.rcp.ImportDecorator.java
License:Open Source License
@Override public void decorate(Object o, IDecoration decoration) { if (o instanceof CnATreeElement) { CnATreeElement element = (CnATreeElement) o; if (element.getSourceId() != null && Activator.getDefault().getPluginPreferences() .getBoolean(PreferenceConstants.SHOW_ALIEN_DECORATOR)) { decoration.addOverlay(ImageCache.getInstance().getImageDescriptor(IMAGE_PATH)); decoration.addSuffix(new StringBuilder().append(" [").append(((CnATreeElement) o).getSourceId()) .append("]").toString()); }//from ww w . j a v a2s . com } }
From source file:uk.ac.diamond.sda.navigator.decorator.LightweightFileOwnerDecorator.java
License:Open Source License
@Override public void decorate(Object element, IDecoration decoration) { if (element instanceof IFile) { IFile ifile = (IFile) element;//ww w .j a v a 2s . c o m IPath path = ifile.getLocation(); File file = path.toFile(); decoration.addSuffix(" " + getFileOwner(file)); } }
From source file:uk.ac.diamond.sda.navigator.decorator.LightweightMetadataDecorator.java
License:Open Source License
@Override public void decorate(Object element, IDecoration decoration) { if (element instanceof IFile) { IFile ifile = (IFile) element;//from w ww . j a va 2s.c om IPath path = ifile.getLocation(); if (path != null) { File file = path.toFile(); String lastModified = new SimpleDateFormat("dd/MM/yy hh:mm aaa") .format(new Date(file.lastModified())); String filePermission = getFilePermission(file); // file size - date of last modification - file permissions decoration.addSuffix(" " + readableFileSize(file.length()) + " " + lastModified);// +" "+filePermission); // Image overlay decoration according to file permission: if (filePermission.equals("- - -")) { ImageDescriptor lockOverlay = ImageDescriptor.createFromFile(this.getClass(), "/icons/decorators/unconfigured_co.gif"); decoration.addOverlay(lockOverlay); } } } }
From source file:uk.ac.diamond.sda.navigator.decorator.LightweightNXSScanCmdDecorator.java
License:Open Source License
@Override public void decorate(Object element, IDecoration decoration) { decorator = ""; if (element instanceof IFile) { IFile modelFile = (IFile) element; IPath modelFilePath = modelFile.getLocation(); if (modelFilePath != null && modelFilePath.toFile().canRead() && NXS_EXT.equals(modelFile.getFileExtension())) { IFile ifile = (IFile) element; String[][] listTitlesAndScanCmd = NavigatorUtils .getHDF5TitlesAndScanCmds(ifile.getLocation().toString()); for (int i = 0; i < listTitlesAndScanCmd[0].length; i++) { decorator = listTitlesAndScanCmd[0][i] + listTitlesAndScanCmd[1][i]; decoration.addSuffix(decorator); }/*from w w w.j av a2 s . co m*/ } } }
From source file:uk.ac.diamond.sda.navigator.decorator.LightweightSRSScanCmdDecorator.java
License:Open Source License
@Override public void decorate(Object element, IDecoration decoration) { decorator = ""; if (element instanceof IFile) { IFile modelFile = (IFile) element; if (SRS_EXT.equals(modelFile.getFileExtension())) { IFile ifile = (IFile) element; if (!ifile.exists()) return; if (ifile.getLocation() == null) return; srsMetaDataLoader(ifile.getLocation().toString()); try { if (metaData != null) { decorator = metaData.getScanCommand(); if (decorator == null) { decorator = " * Scan Command: N/A"; decoration.addSuffix(decorator); } else { if (decorator.length() > 100) // restrict to 100 characters decorator = decorator.substring(0, 100) + "..."; decorator = " * " + decorator; decoration.addSuffix(decorator); }/*w ww .j av a 2 s. c o m*/ } else { decorator = " * Scan Command: N/A"; decoration.addSuffix(decorator); logger.warn("Could not read metadata from file {}", ifile.getFullPath()); } } catch (Exception e) { logger.error("Could not read metadata from {}: ", e); } } } }
From source file:ummisco.gama.ui.navigator.NavigatorBaseLighweightDecorator.java
@Override public void decorate(final Object element, final IDecoration decoration) { if (element instanceof VirtualContent) { ((VirtualContent<?>) element).getSuffix(sb); if (sb.length() > 0) { decoration.addSuffix(" ("); decoration.addSuffix(sb.toString()); decoration.addSuffix(")"); sb.setLength(0);//from w w w . j ava 2s . c o m } } }
From source file:ummisco.gama.ui.navigator.NavigatorDateLighweightDecorator.java
@Override public void decorate(final Object element, final IDecoration decoration) { final IResource r = ResourceManager.getResource(element); if (r != null) { final long date = r.getLocalTimeStamp(); final DateFormat df = DateFormat.getInstance(); final String dateStr = df.format(new Date(date)); decoration.addSuffix(" - " + dateStr); }/*from w w w.j a va2 s .c om*/ }
From source file:unc.lib.cdr.workbench.views.MdSecTypeDecorator.java
License:Apache License
@Override public void decorate(Object element, IDecoration decoration) { if (element instanceof MdSecType) { MdSecType md = (MdSecType) element; if (METSConstants.MD_STATUS_CROSSWALK_LINKED.equals(md.getSTATUS())) { decoration.addSuffix(" auto linked"); } else if (METSConstants.MD_STATUS_CROSSWALK_NOT_LINKED.equals(md.getSTATUS())) { //decoration.addSuffix(" auto-linked"); } else if (METSConstants.MD_STATUS_CROSSWALK_USER_LINKED.equals(md.getSTATUS())) { decoration.addSuffix(" user linked"); } else if (METSConstants.MD_STATUS_USER_EDITED.equals(md.getSTATUS())) { decoration.addSuffix(" user created"); }/* www. ja v a 2 s .c o m*/ } }