List of usage examples for org.eclipse.jface.viewers IDecoration getDecorationContext
IDecorationContext getDecorationContext();
From source file:org.marketcetera.photon.strategy.engine.ui.StrategyEngineStatusDecorator.java
private void replaceImage(final IDecoration decoration, ImageDescriptor imageDescriptor) { /*//from www .ja va 2 s. co 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.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 o m*/ 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 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); } }