diff --git a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/annotation/AnnotationViewPartBase.java b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/annotation/AnnotationViewPartBase.java index 8272324133a27117892f52a0584d888fa09280eb..3dd3f5cae74387e4c6bd744f946324545cd0eed6 100644 --- a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/annotation/AnnotationViewPartBase.java +++ b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/annotation/AnnotationViewPartBase.java @@ -17,11 +17,16 @@ $Id$ +--------------------------------------------------------------------------*/ package org.fortiss.tooling.base.ui.annotation; +import static org.eclipse.swt.SWT.COLOR_DARK_GRAY; + import java.util.List; import org.eclipse.emf.ecore.EObject; import org.eclipse.jface.viewers.ISelection; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; import org.eclipse.ui.ISelectionListener; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.part.ViewPart; @@ -41,6 +46,12 @@ import org.fortiss.tooling.kernel.ui.util.SelectionUtils; public abstract class AnnotationViewPartBase<T extends EObject, V extends IAnnotatedSpecification> extends ViewPart implements ISelectionListener { + /** Color of the selected component */ + protected Color currentlySelectedColor = Display.getCurrent().getSystemColor(SWT.COLOR_CYAN); + + /** Color of non editable components */ + protected Color notEditibleColor = Display.getCurrent().getSystemColor(COLOR_DARK_GRAY); + /** The currently selected Object */ private T currentlySelectedObject; @@ -67,7 +78,8 @@ public abstract class AnnotationViewPartBase<T extends EObject, V extends IAnnot currentlySelectedObject = (T)editPart.getModel(); } - if(currentlySelectedObject != null) { + if(currentlySelectedObject instanceof EObject && + isAcceptedSelection(currentlySelectedObject)) { addAll(); annotatedSpecification = extractAnnotatedSpecification(); onUpdateView(); @@ -104,6 +116,9 @@ public abstract class AnnotationViewPartBase<T extends EObject, V extends IAnnot /** Returns all annotated specs of Type V */ protected abstract List<V> getAllAnnotatedSpecs(); + /** called every time the view is updated */ protected abstract void onUpdateView(); + protected abstract boolean isAcceptedSelection(EObject object); + }