Example usage for org.eclipse.jface.viewers IDecoration ENABLE_REPLACE

List of usage examples for org.eclipse.jface.viewers IDecoration ENABLE_REPLACE

Introduction

In this page you can find the example usage for org.eclipse.jface.viewers IDecoration ENABLE_REPLACE.

Prototype

String ENABLE_REPLACE

To view the source code for org.eclipse.jface.viewers IDecoration ENABLE_REPLACE.

Click Source Link

Document

Constant that is used as the property key on an IDecorationContext .

Usage

From source file:com.centimia.orm.jaqu.plugin.decorator.ResourceDecorator.java

License:Open Source License

public void decorate(Object element, IDecoration decoration) {
    if (element instanceof IFile) {
        String isJaqu = Activator.getDefault().getPreferenceStore()
                .getString(((IFile) element).getProject().getName() + "_" + ((IFile) element).getName());
        if (!"".equals(isJaqu)) {
            ((DecorationContext) decoration.getDecorationContext()).putProperty(IDecoration.ENABLE_REPLACE,
                    Boolean.TRUE);
            decoration.addOverlay(getFileImageDescriptor(), IDecoration.TOP_LEFT);
        }//from  w  w w  .ja va  2  s .co  m
    }
}

From source file:com.google.gdt.eclipse.managedapis.ui.ManageApiInfoDecorator.java

License:Open Source License

public void decorate(Object element, IDecoration decoration) {
    // Enables use of REPLACE as a valid image decoration
    ((DecorationContext) decoration.getDecorationContext()).putProperty(IDecoration.ENABLE_REPLACE, true);

    try {//from www  .  j a va 2 s  .  c  om
        if (ManagedApiContainer.isManagedApiContainer(element)) {
            ClassPathContainer container = (ClassPathContainer) element;
            ManagedApiProject managedApiProject = ManagedApiContainer
                    .getManagedApiProjectForClassPathContainer(container);
            ManagedApi managedApi = ManagedApiContainer.getManagedApiForClassPathContainer(container);
            if (checkAndApplyErrorDecoration(decoration, managedApiProject, container.getClasspathEntry())) {
                return;
            }
            if (managedApi.isUpdateAvailable()) {
                applyUpdateAvailableDecoration(decoration);
            }
        }
    } catch (MalformedURLException e) {
        ManagedApiLogger.warn(e, "Unexpected MalformedURLException");
    }
}

From source file:com.google.gdt.eclipse.managedapis.ui.ManagedApiContainerDecorator.java

License:Open Source License

/**
 * Conditionally decorate the element by replacing the element's icon
 *//* ww  w  .j  a  v  a  2  s . com*/
public void decorate(Object element, IDecoration decoration) {
    // Enables use of REPLACE as a valid image decoration
    ((DecorationContext) decoration.getDecorationContext()).putProperty(IDecoration.ENABLE_REPLACE, true);

    try {
        if (ManagedApiContainer.isManagedApiContainer(element)) {
            applyApiSpecificContainerIcon(element, decoration);
        }
    } catch (MalformedURLException e) {
        ManagedApiLogger.warn(e, "Unexpected MalformedURLException");
    }
}

From source file:org.eclipse.jubula.client.ui.provider.labelprovider.decorators.ResultDecorator.java

License:Open Source License

/** {@inheritDoc} */
public void decorate(Object element, IDecoration decoration) {
    if (element instanceof TestResultNode) {
        TestResultNode resultNode = ((TestResultNode) element);
        if (resultNode.getNode() instanceof ICommentPO) {
            return;
        }//from  w w  w . jav  a2  s  .co m

        int status = resultNode.getStatus();
        ImageDescriptor image2use = null;
        IDecorationContext context = decoration.getDecorationContext();
        if (context instanceof DecorationContext) {
            ((DecorationContext) context).putProperty(IDecoration.ENABLE_REPLACE, Boolean.TRUE);
        }
        switch (status) {
        case TestResultNode.NOT_YET_TESTED:
            break;
        case TestResultNode.NO_VERIFY:
            image2use = IconConstants.STEP_OK_IMAGE_DESCRIPTOR;
            break;
        case TestResultNode.TESTING:
            image2use = IconConstants.STEP_TESTING_IMAGE_DESCRIPTOR;
            break;
        case TestResultNode.SUCCESS:
            image2use = IconConstants.STEP_OK_IMAGE_DESCRIPTOR;
            break;
        case TestResultNode.ERROR:
        case TestResultNode.CONDITION_FAILED:
        case TestResultNode.INFINITE_LOOP:
            image2use = IconConstants.STEP_NOT_OK_IMAGE_DESCRIPTOR;
            break;
        case TestResultNode.ERROR_IN_CHILD:
            image2use = IconConstants.STEP_NOT_OK_IMAGE_DESCRIPTOR;
            break;
        case TestResultNode.NOT_TESTED:
            image2use = IconConstants.STEP_FAILED_IMAGE_DESCRIPTOR;
            break;
        case TestResultNode.RETRYING:
            image2use = IconConstants.STEP_RETRY_IMAGE_DESCRIPTOR;
            break;
        case TestResultNode.SUCCESS_RETRY:
            image2use = IconConstants.STEP_RETRY_OK_IMAGE_DESCRIPTOR;
            break;
        case TestResultNode.ABORT:
            image2use = IconConstants.STEP_NOT_OK_IMAGE_DESCRIPTOR;
            break;
        case TestResultNode.SKIPPED:
            image2use = IconConstants.STEP_SKIPPED_IMAGE_DESCRIPTOR;
            break;
        case TestResultNode.SUCCESS_ONLY_SKIPPED:
            image2use = IconConstants.STEP_SUCCESS_SKIPPED_IMAGE_DESCRIPTOR;
            break;
        default:
            break;
        }
        decoration.addOverlay(image2use, IDecoration.REPLACE);
    }
}

From source file:org.eclipse.php.internal.ui.navigator.PHPNavigatorLabelDecorator.java

License:Open Source License

@Override
public void decorate(Object element, IDecoration decoration) {
    if (element instanceof IFolder) {
        IDecorationContext context = decoration.getDecorationContext();
        if (context instanceof DecorationContext) {
            ((DecorationContext) context).putProperty(IDecoration.ENABLE_REPLACE, Boolean.TRUE);
        }//from   w  w  w . j  a v a  2 s  .c om
        IFolder folder = (IFolder) element;
        IScriptProject project = DLTKCore.create(folder.getProject());
        try {
            if (PHPToolkitUtil.isPhpProject(folder.getProject()) && project.isOnBuildpath(folder)) {
                if (lfm.isInLibraryFolder(folder)) {
                    decoration.addOverlay(PHPPluginImages.DESC_OBJS_PHP_LIBFOLDER, IDecoration.REPLACE);
                } else {
                    decoration.addOverlay(DLTKPluginImages.DESC_OBJS_PACKFRAG_ROOT, IDecoration.REPLACE);
                }
            }
        } catch (CoreException e) {
            Logger.logException(e);
        }
    }
}

From source file:org.eclipse.ui.internal.decorators.DecorationBuilder.java

License:Open Source License

/**
 * Clear the current values and return a DecorationResult.
 * /*from   ww  w  . ja va  2s  .  c o m*/
 * @return DecorationResult
 */
DecorationResult createResult() {
    // check whether the context says that replacement should happen
    boolean clearReplacementImage = true;
    if (context != null) {
        Object propertyValue = context.getProperty(IDecoration.ENABLE_REPLACE);
        if (propertyValue instanceof Boolean) {
            if (((Boolean) propertyValue).booleanValue()) {
                clearReplacementImage = false;
            }
        }
    }
    if (clearReplacementImage) {
        descriptors[IDecoration.REPLACE] = null;
    }
    DecorationResult newResult = new DecorationResult(new ArrayList(prefixes), new ArrayList(suffixes),
            descriptors, foregroundColor, backgroundColor, font);

    return newResult;
}

From source file:org.kalypso.ui.editor.gmleditor.part.GMLLabelProvider.java

License:Open Source License

public GMLLabelProvider() {
    final IWorkbench workbench = PlatformUI.getWorkbench();

    m_decoratorManager = workbench.getDecoratorManager();

    synchronized (workbench) {
        if (m_resourceManager == null)
            m_resourceManager = new LocalResourceManager(JFaceResources.getResources(workbench.getDisplay()));
    }//from   w  w w .  j  av a 2 s.c  o  m

    // TODO: check if this is ok? We change the global decoration context here...
    ((DecorationContext) DecorationContext.DEFAULT_CONTEXT).putProperty(IDecoration.ENABLE_REPLACE,
            Boolean.TRUE);

    m_decoratorManager.addListener(m_decoratorListener);
}

From source file:org.marketcetera.photon.strategy.engine.ui.StrategyEngineStatusDecorator.java

private void replaceImage(final IDecoration decoration, ImageDescriptor imageDescriptor) {
    /*/*from ww  w  .  jav  a 2s  .c o m*/
     * 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);
}

From source file:org.marketcetera.photon.strategy.engine.ui.StrategyEngineStatusDecoratorTest.java

@Test
public void testDisconnectedEngine() {
    StrategyEngine engine = createEngine("");
    mFixture.decorate(engine, mMockDecoration);
    verify(mMockDecorationContext).putProperty(IDecoration.ENABLE_REPLACE, Boolean.TRUE);
    verify(mMockDecoration).addOverlay(StrategyEngineImage.ENGINE_DISCONNECTED_OBJ.getImageDescriptor(),
            IDecoration.REPLACE);//  w  w w  .  ja  va2  s .c o m
    verify(mMockDecoration).setForegroundColor(StrategyEngineColor.ENGINE_DISCONNECTED.getColor());
}

From source file:org.marketcetera.photon.strategy.engine.ui.StrategyEngineStatusDecoratorTest.java

@Test
public void testConnectedEngine() {
    StrategyEngine engine = createEngine("");
    engine.setConnectionState(ConnectionState.CONNECTED);
    mFixture.decorate(engine, mMockDecoration);
    verify(mMockDecorationContext).putProperty(IDecoration.ENABLE_REPLACE, Boolean.TRUE);
    verify(mMockDecoration).addOverlay(StrategyEngineImage.ENGINE_CONNECTED_OBJ.getImageDescriptor(),
            IDecoration.REPLACE);/*from  w w  w . j a va  2 s .  c o  m*/
    verify(mMockDecoration, never()).setForegroundColor((Color) anyObject());
}