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

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

Introduction

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

Prototype

int REPLACE

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

Click Source Link

Document

Constant for replacing the original image.

Usage

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);
    verify(mMockDecoration, never()).setForegroundColor((Color) anyObject());
}

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);
    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);
    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;/*from   w w w  .j  a  va2  s.com*/

        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;//from www . jav a2s. c  om
        // 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);
    }
}