Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre-Charles David2017-06-22 12:47:25 +0000
committerPierre-Charles David2017-06-24 19:14:20 +0000
commitd1e44ecd3c1e273c5fe3c25c4c51fce8c989456e (patch)
tree932ae7f8a3981fae893e4ec561df76a8e8335826
parent9a91c999542583328356ab78fe11c9d615aed998 (diff)
downloadorg.eclipse.sirius-d1e44ecd3c1e273c5fe3c25c4c51fce8c989456e.tar.gz
org.eclipse.sirius-d1e44ecd3c1e273c5fe3c25c4c51fce8c989456e.tar.xz
org.eclipse.sirius-d1e44ecd3c1e273c5fe3c25c4c51fce8c989456e.zip
[517534] Decorate representation types to distinguish them from instancesv5.0.1rc1
Bug: 517534 Change-Id: I10d8b70008c64b1a70f005358b80049d97b7eedc Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.ui/icons/full/ovr16/description_decorator.pngbin0 -> 218 bytes
-rw-r--r--plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/navigator/SiriusCommonLabelProvider.java42
2 files changed, 26 insertions, 16 deletions
diff --git a/plugins/org.eclipse.sirius.ui/icons/full/ovr16/description_decorator.png b/plugins/org.eclipse.sirius.ui/icons/full/ovr16/description_decorator.png
new file mode 100644
index 0000000000..03d0191afd
--- /dev/null
+++ b/plugins/org.eclipse.sirius.ui/icons/full/ovr16/description_decorator.png
Binary files differ
diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/navigator/SiriusCommonLabelProvider.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/navigator/SiriusCommonLabelProvider.java
index 5743b3e661..f5604102d1 100644
--- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/navigator/SiriusCommonLabelProvider.java
+++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/navigator/SiriusCommonLabelProvider.java
@@ -40,6 +40,7 @@ import org.eclipse.sirius.ui.tools.api.views.ViewHelper;
import org.eclipse.sirius.ui.tools.api.views.common.item.AnalysisResourceItem;
import org.eclipse.sirius.ui.tools.api.views.common.item.CommonSessionItem;
import org.eclipse.sirius.ui.tools.api.views.common.item.ItemWrapper;
+import org.eclipse.sirius.ui.tools.api.views.common.item.RepresentationDescriptionItem;
import org.eclipse.sirius.ui.tools.internal.views.common.FileSessionFinder;
import org.eclipse.sirius.ui.tools.internal.views.common.SessionLabelProvider;
import org.eclipse.sirius.viewpoint.DRepresentation;
@@ -72,6 +73,12 @@ public class SiriusCommonLabelProvider extends ColumnLabelProvider implements IC
*/
public static final ImageDescriptor SIRIUS_MODELING_OVERLAY_DESC = AbstractUIPlugin.imageDescriptorFromPlugin(SiriusEditPlugin.ID, "/icons/full/ovr16/SessionDecorator.gif"); //$NON-NLS-1$ ;
+ /**
+ * The overlay decorator used to distinguish representation types/categories from actual representations
+ * (instances).
+ */
+ private static final ImageDescriptor REPRESENTATION_DESCRIPTION_OVERLAY_DESC = AbstractUIPlugin.imageDescriptorFromPlugin(SiriusEditPlugin.ID, "/icons/full/ovr16/description_decorator.png"); //$NON-NLS-1$ ;
+
private static final String DISABLED_REPRESENTATION_SUFFIX = "_disabled"; //$NON-NLS-1$
private static final String DIRTY = "*"; //$NON-NLS-1$
@@ -118,12 +125,23 @@ public class SiriusCommonLabelProvider extends ColumnLabelProvider implements IC
}
img = disabledImage;
}
- } catch (IllegalStateException e) {
- // This can happen when trying to get the label of a CDOObject
- // which
- // Transaction has just been closed
- // Nothing to do, null will returned
- } catch (NullPointerException e) {
+ if (element instanceof RepresentationDescriptionItem) {
+ Object wrapped = ((RepresentationDescriptionItem) element).getWrappedObject();
+ if (wrapped instanceof RepresentationDescription) {
+ // Decorate representation descriptions with a small overlay to distinguish them from the
+ // instances.
+ String key = ((RepresentationDescription) wrapped).eClass().getName() + "_decorated"; //$NON-NLS-1$
+ Image baseImg = img;
+ img = SiriusEditPlugin.getPlugin().getImageRegistry().get(key);
+ if (img == null) {
+ ImageDescriptor[] imageDescriptors = new ImageDescriptor[5];
+ imageDescriptors[IDecoration.BOTTOM_RIGHT] = SiriusCommonLabelProvider.REPRESENTATION_DESCRIPTION_OVERLAY_DESC;
+ img = new DecorationOverlayIcon(baseImg, imageDescriptors).createImage();
+ SiriusEditPlugin.getPlugin().getImageRegistry().put(key, img);
+ }
+ }
+ }
+ } catch (IllegalStateException | NullPointerException e) {
// This can happen when trying to get the label of a CDOObject
// which transaction has just been closed
// Nothing to do, null will returned
@@ -198,11 +216,7 @@ public class SiriusCommonLabelProvider extends ColumnLabelProvider implements IC
// Let eclipse look for file and project icons + nature
// decoration
text = sessionLabelProvider.getText(element);
- } catch (IllegalStateException e) {
- // This can happen when trying to get the label of a CDOObject
- // which transaction has just been closed
- // Nothing to do, null will returned
- } catch (NullPointerException e) {
+ } catch (IllegalStateException | NullPointerException e) {
// This can happen when trying to get the label of a CDOObject
// which transaction has just been closed
// Nothing to do, null will returned
@@ -317,11 +331,7 @@ public class SiriusCommonLabelProvider extends ColumnLabelProvider implements IC
if (isDanglingRepresentationDescriptor(element)) {
foreground = VisualBindingManager.getDefault().getColorFromName("light_gray"); //$NON-NLS-1$
}
- } catch (IllegalStateException e) {
- // This can happen when trying to get the label of a CDOObject which
- // Transaction has just been closed
- // Nothing to do, null will returned
- } catch (NullPointerException e) {
+ } catch (IllegalStateException | NullPointerException e) {
// This can happen when trying to get the label of a CDOObject
// which transaction has just been closed
// Nothing to do, null will returned

Back to the top