From a4121e009bb89bc6815e91fc4094915d726449bd Mon Sep 17 00:00:00 2001
From: Johannes Eder <eder@fortiss.org>
Date: Mon, 24 Mar 2014 10:21:53 +0000
Subject: [PATCH] colouring of selected objects refs 1841

---
 .../ui/annotation/GenericAnnotationView.java  | 34 ++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)

diff --git a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/annotation/GenericAnnotationView.java b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/annotation/GenericAnnotationView.java
index 731deab85..506c55a27 100644
--- a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/annotation/GenericAnnotationView.java
+++ b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/annotation/GenericAnnotationView.java
@@ -34,11 +34,13 @@ import org.eclipse.jface.viewers.TableViewer;
 import org.eclipse.jface.viewers.TableViewerColumn;
 import org.eclipse.jface.viewers.TextCellEditor;
 import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.layout.FillLayout;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Table;
 import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.wb.swt.SWTResourceManager;
 import org.fortiss.tooling.base.model.element.IAnnotatedSpecification;
 import org.fortiss.tooling.kernel.extension.data.ITopLevelElement;
 import org.fortiss.tooling.kernel.model.INamedCommentedElement;
@@ -51,7 +53,7 @@ import org.fortiss.tooling.kernel.service.IPersistencyService;
  * @version $Rev$
  * @ConQAT.Rating RED Hash:
  */
-public class GenericAnnotationView extends AnnotationViewPartBase2 {
+public class GenericAnnotationView extends AnnotationViewPartBase {
 
 	/** mapping of {@link IAnnotatedSpecification} -> TableViewerColumn */
 	private HashMap<Class<? extends IAnnotatedSpecification>, TableViewerColumn> columns =
@@ -86,7 +88,18 @@ public class GenericAnnotationView extends AnnotationViewPartBase2 {
 				modelElementName = modelElementName.replace("Impl", "");
 				firstColumn.getColumn().setText(modelElementName);
 				return ((INamedCommentedElement)entry.getModelElement()).getName();// toString();
+			}
 
+			/** {@inheritDoc} */
+			@Override
+			public Color getBackground(Object element) {
+				if(element instanceof AnnotationEntry<?>) {
+					AnnotationEntry<?> data = (AnnotationEntry<?>)element;
+					if(data.getModelElement().equals(getCurrentlySelectedObject())) {
+						return SWTResourceManager.getColor(0, 255, 0);
+					}
+				}
+				return super.getBackground(element);
 			}
 		});
 
@@ -294,6 +307,18 @@ public class GenericAnnotationView extends AnnotationViewPartBase2 {
 			return "-";
 		}
 
+		/** {@inheritDoc} */
+		@Override
+		public Color getBackground(Object element) {
+			if(element instanceof AnnotationEntry<?>) {
+				AnnotationEntry<?> data = (AnnotationEntry<?>)element;
+				if(data.getModelElement().equals(getCurrentlySelectedObject())) {
+					return SWTResourceManager.getColor(0, 255, 0);
+				}
+			}
+			return super.getBackground(element);
+		}
+
 	}
 
 	/** {@inheritDoc} */
@@ -302,4 +327,11 @@ public class GenericAnnotationView extends AnnotationViewPartBase2 {
 		// nothing to do
 
 	}
+
+	/** {@inheritDoc} */
+	@Override
+	public void dispose() {
+		tableViewer.getTable().dispose();
+		super.dispose();
+	}
 }
-- 
GitLab