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:org.marketcetera.photon.strategy.engine.ui.StrategyEngineStatusDecoratorTest.java

@Test
public void testStoppedStrategy() {
    DeployedStrategy strategy = createDeployedStrategy("");
    mFixture.decorate(strategy, mMockDecoration);
    verify(mMockDecorationContext).putProperty(IDecoration.ENABLE_REPLACE, Boolean.TRUE);
    verify(mMockDecoration).addOverlay(StrategyEngineImage.STRATEGY_STOPPED_OBJ.getImageDescriptor(),
            IDecoration.REPLACE);/* w  w w. j  a  v  a2 s. co m*/
    verify(mMockDecoration).setForegroundColor(StrategyEngineColor.STRATEGY_STOPPED.getColor());
}

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

@Test
public void testRunningStrategy() {
    DeployedStrategy strategy = createDeployedStrategy("");
    strategy.setState(StrategyState.RUNNING);
    mFixture.decorate(strategy, mMockDecoration);
    verify(mMockDecorationContext).putProperty(IDecoration.ENABLE_REPLACE, Boolean.TRUE);
    verify(mMockDecoration).addOverlay(StrategyEngineImage.STRATEGY_RUNNING_OBJ.getImageDescriptor(),
            IDecoration.REPLACE);/*  w  w  w  . j a  va 2 s.co m*/
    verify(mMockDecoration, never()).setForegroundColor((Color) anyObject());
}

From source file:org.polymap.core.project.ui.layer.LayerStatusDecorator.java

License:Open Source License

public void decorate(Object elm, IDecoration decoration) {
    if (elm instanceof ILayer) {
        ILayer layer = (ILayer) elm;/*  w  w w .  j  a  v  a2 s  . c  om*/

        try {
            layer.id();
        } catch (NoSuchEntityException e) {
            // handled by EntityModificationDecorator
            return;
        }

        // visible
        if (layer.isVisible()) {
            ImageDescriptor image = ProjectPlugin.getDefault().imageDescriptor(visible);
            decoration.setFont(bold);

            DecorationContext context = (DecorationContext) decoration.getDecorationContext();
            context.putProperty(IDecoration.ENABLE_REPLACE, Boolean.TRUE);
            decoration.addOverlay(image, IDecoration.REPLACE);

            ImageDescriptor ovr = ProjectPlugin.getDefault().imageDescriptor(visible_ovr);
            decoration.addOverlay(ovr, TOP_LEFT);
        }

        // inactive == not visible
        if (!layer.isVisible()) {
            decoration.setForegroundColor(INACTIVE_COLOR);
        }

        LayerStatus layerStatus = layer.getLayerStatus();
        if (layerStatus.getCode() == LayerStatus.MISSING) {
            decoration.setForegroundColor(MISSING_COLOR);
            decoration.addSuffix(Messages.get("LayerStatusDecorator_missing"));
        } else if (layerStatus.getCode() == LayerStatus.WAITING) {
            ImageDescriptor ovr = ProjectPlugin.getDefault().imageDescriptor(waiting);
            decoration.setFont(italic);
            decoration.addOverlay(ovr, TOP_RIGHT);
            decoration.addSuffix(Messages.get("LayerStatusDecorator_checking"));
        } else if (layerStatus.getSeverity() == LayerStatus.OK) {
            //
        }

        // register listener
        decorated.put(layer.id(), layer);
    }
}

From source file:org.polymap.core.project.ui.project.MapStatusDecorator.java

License:Open Source License

public void decorate(Object elm, IDecoration decoration) {
    if (elm instanceof IMap) {
        IMap map = (IMap) elm;/*  w  ww  .j  a  v a 2  s  .co m*/
        // visible
        if (map.isVisible() /*activeMaps.containsKey( map.id() )*/) {
            DecorationContext context = (DecorationContext) decoration.getDecorationContext();
            context.putProperty(IDecoration.ENABLE_REPLACE, Boolean.TRUE);
            decoration.addOverlay(visible, IDecoration.REPLACE);
            decoration.addOverlay(visibleOvr, IDecoration.TOP_LEFT);
        }
        // empty
        if (map.getLayers().isEmpty()) {
            DecorationContext context = (DecorationContext) decoration.getDecorationContext();
            context.putProperty(IDecoration.ENABLE_REPLACE, Boolean.TRUE);
            decoration.addOverlay(empty, IDecoration.REPLACE);
        }
        decorated.put(map.id(), map);
    }
}