Java Code Examples for org.eclipse.jface.viewers.IDecoration#addSuffix()

The following examples show how to use org.eclipse.jface.viewers.IDecoration#addSuffix() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TimeRangeDecorator.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void decorate ( final Object element, final IDecoration decoration )
{
    try
    {
        final IFile resource = (IFile)element;
        final String timeframe = getTimeframe ( resource );
        if ( timeframe != null )
        {
            decoration.addSuffix ( " " + timeframe );
        }
    }
    catch ( final Exception e )
    {
    }

}
 
Example 2
Source File: SharedProjectDecorator.java    From saros with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void decorate(Object element, IDecoration decoration) {
  // make a copy as this value might change while decorating
  ISarosSession currentSession = session;

  if (currentSession == null) return;

  IResource resource = (IResource) element;

  if (!currentSession.isShared(ResourceAdapterFactory.create(resource))) return;

  decoration.addOverlay(SharedProjectDecorator.PROJECT_DESCRIPTOR, IDecoration.TOP_LEFT);

  if (resource.getType() == IResource.PROJECT) {
    decoration.addSuffix(Messages.SharedProjectDecorator_shared);
  }
}
 
Example 3
Source File: InCompilationSetDecorator.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
private void decorateWithSdkName(IProject project, IDecoration decoration) {
    if (project != null) {
        Sdk sdk = XdsProjectSettingsManager.getXdsProjectSettings(project).getProjectSdk();
        if ((sdk != null) && StringUtils.isNotEmpty(sdk.getName())) {
            decoration.addSuffix(String.format("  [%s]", sdk.getName())); //$NON-NLS-1$
        }
    }
}
 
Example 4
Source File: NavigatorBaseLighweightDecorator.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
@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);
		}
	}
}
 
Example 5
Source File: NavigatorDateLighweightDecorator.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
@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);
	}
}
 
Example 6
Source File: SVNDecoratorConfiguration.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
    * add a prefix and a suffix depending on format string and the bindings
    * @param decoration
    * @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]);
}
 
Example 7
Source File: CodeHighlightDecorator.java    From scava with Eclipse Public License 2.0 4 votes vote down vote up
private void applyDecorationOnParent(IDecoration decoration, int founds) {
	decoration.setForegroundColor(new Color(null, 230, 0, 230));
	decoration.setFont(new Font(null, new FontData("Arial", 9, SWT.NORMAL)));
	decoration.addSuffix(" [CROSSMINER: " + founds + " recommendations" + pluralSign(founds) + "]");
	setIcon(decoration);
}
 
Example 8
Source File: CodeHighlightDecorator.java    From scava with Eclipse Public License 2.0 4 votes vote down vote up
private void applyDecorationOnContainer(IDecoration decoration, int founds) {
	decoration.setForegroundColor(new Color(null, 255, 0, 255));
	decoration.setFont(new Font(null, new FontData("Arial", 9, SWT.BOLD)));
	decoration.addSuffix(" [CROSSMINER: " + founds + " recommendation" + pluralSign(founds) + "]");
	setIcon(decoration);
}