Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraradermache2012-10-26 09:26:02 +0000
committeraradermache2012-10-26 09:26:02 +0000
commit2f39d483ba9849cbe5b622290df94a9af6361fd3 (patch)
treef964207b0c193d50def91d71ea899dd581096714
parentc558d503465e9140d2beeca55ed303baa030f6fc (diff)
downloadorg.eclipse.papyrus-2f39d483ba9849cbe5b622290df94a9af6361fd3.tar.gz
org.eclipse.papyrus-2f39d483ba9849cbe5b622290df94a9af6361fd3.tar.xz
org.eclipse.papyrus-2f39d483ba9849cbe5b622290df94a9af6361fd3.zip
Introduction of priority, fix for bug 392724
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/pagebookview/ModelExplorerDecorationAdapter.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/pagebookview/ModelExplorerDecorationAdapter.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/pagebookview/ModelExplorerDecorationAdapter.java
index 2bca32cc54c..a955d2b702e 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/pagebookview/ModelExplorerDecorationAdapter.java
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/pagebookview/ModelExplorerDecorationAdapter.java
@@ -118,8 +118,18 @@ public class ModelExplorerDecorationAdapter {
if(decoratedImage == null) {
// Otherwise create a new image and store it
ImageDescriptor[] decorationImages = new ImageDescriptor[5];
+ // Store the decoration by position
+ IPapyrusDecoration[] decorationByPosition = new IPapyrusDecoration[5];
+
for(IPapyrusDecoration decoration : decorations) {
- decorationImages[decoration.getPositionForJFace()] = decoration.getDecorationImageForME();
+ IPapyrusDecoration existingDecoration = decorationByPosition[decoration.getPositionForJFace()];
+ if (existingDecoration == null || existingDecoration.getPriority() < decoration.getPriority()) {
+ // if no decoration exists for the current position
+ // or if the existing decoration has a lower priority than the current
+ // replace the existing decoration with the current one
+ decorationImages[decoration.getPositionForJFace()] = decoration.getDecorationImageForME();
+ decorationByPosition[decoration.getPositionForJFace()] = decoration;
+ }
}
ImageDescriptor decoratedImageDesc = new DecorationOverlayIcon(decoratorTarget, decorationImages, size16);
Activator.getDefault().getImageRegistry().put(decoratedImageId, decoratedImageDesc);

Back to the top