Commit b351a20a authored by Simon Barner's avatar Simon Barner

- Move annotation value service, annotation value provider base classes and...

- Move annotation value service, annotation value provider base classes and annotation extension point to org.foritss.tooling.base
- Remove createEditingSupport() from IAnnotationValueProviderBase and move functionality to org.fortiss.tooling.base.ui.annotation.editingsupport.EditingSupportFactory instead
- Rename extension point to org.fortiss.tooling.base.annotation.

Example binding:

<extension point="org.fortiss.tooling.base.annotation">
  <annotation binding="org.fortiss.af3.timing.annotation.valueprovider.CIValueProvider">
     <modelElementClass modelElementClass="org.fortiss.af3.component.model.Component"/>
  </annotation>
</extension
- Adapt all known users of annotation framework to new structure
- The change is a preparation to fix #2208, i.e. to put the instantiation of a model element and its annotations into a single undo/redo command
refs 2208
parent 0d4ded58
......@@ -13,7 +13,6 @@ Export-Package: org.fortiss.tooling.base.ui,
org.fortiss.tooling.base.ui.annotation,
org.fortiss.tooling.base.ui.annotation.editingsupport,
org.fortiss.tooling.base.ui.annotation.labelprovider,
org.fortiss.tooling.base.ui.annotation.valueprovider,
org.fortiss.tooling.base.ui.annotation.view,
org.fortiss.tooling.base.ui.annotation.view.generic,
org.fortiss.tooling.base.ui.annotation.view.generic.filter,
......
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension-point id="annotationViewPart" name="Annotation View Part" schema="schema/annotationViewPart.exsd"/>
<extension
point="org.eclipse.ui.preferencePages">
<page
......
......@@ -22,8 +22,8 @@ import org.eclipse.jface.viewers.ColumnViewer;
import org.eclipse.jface.viewers.EditingSupport;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.widgets.Shell;
import org.fortiss.tooling.base.annotation.AnnotationEntry;
import org.fortiss.tooling.base.model.element.IAnnotatedSpecification;
import org.fortiss.tooling.base.ui.annotation.AnnotationEntry;
import org.fortiss.tooling.kernel.extension.data.ITopLevelElement;
import org.fortiss.tooling.kernel.service.IPersistencyService;
......
......@@ -20,8 +20,8 @@ package org.fortiss.tooling.base.ui.annotation.editingsupport;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ColumnViewer;
import org.eclipse.swt.widgets.Composite;
import org.fortiss.tooling.base.annotation.AnnotationEntry;
import org.fortiss.tooling.base.model.element.IAnnotatedSpecification;
import org.fortiss.tooling.base.ui.annotation.AnnotationEntry;
/**
*
......
......@@ -32,10 +32,10 @@ import org.eclipse.jface.viewers.ComboBoxViewerCellEditor;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.widgets.Composite;
import org.fortiss.tooling.base.annotation.AnnotationEntry;
import org.fortiss.tooling.base.annotation.valueprovider.EStructuralFeatureDescriptor;
import org.fortiss.tooling.base.model.element.IAnnotatedSpecification;
import org.fortiss.tooling.base.model.element.IDerivedAnnotation;
import org.fortiss.tooling.base.ui.annotation.AnnotationEntry;
import org.fortiss.tooling.base.ui.annotation.valueprovider.EStructuralFeatureDescriptor;
/**
* This class constructs and manages an editing element for the annotation view. It provides a combo
......
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2015 ForTISS GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.base.ui.annotation.editingsupport;
import java.util.Set;
import java.util.TreeSet;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.jface.viewers.ColumnViewer;
import org.eclipse.jface.viewers.EditingSupport;
import org.fortiss.tooling.base.annotation.AnnotationEntry;
import org.fortiss.tooling.base.annotation.valueprovider.DerivedAnnotationValueProviderBase;
import org.fortiss.tooling.base.annotation.valueprovider.DynamicInstanceAnnotationValueProviderBase;
import org.fortiss.tooling.base.annotation.valueprovider.EStructuralFeatureValueProviderBase;
import org.fortiss.tooling.base.annotation.valueprovider.IAnnotationValueProvider;
import org.fortiss.tooling.base.annotation.valueprovider.ValueProviderBase;
import org.fortiss.tooling.base.model.element.IAnnotatedSpecification;
import org.fortiss.tooling.base.model.element.IDerivedAnnotation;
import org.fortiss.tooling.base.ui.annotation.view.generic.GenericAnnotationView;
import org.fortiss.tooling.kernel.utils.EcoreUtils;
/**
* Factory to build {@link AnnotationEditingSupportBase}-based {@link EditingSupport} for the
* {@link GenericAnnotationView}.
*
* @author barner
* @author $Author$
* @version $Rev$
* @ConQAT.Rating RED Hash:
*/
public class EditingSupportFactory {
/**
* Creates the {@link EditingSupport} that is directly based on
* {@link DerivedAnnotationValueProviderBase}.
*/
private static
<T extends IDerivedAnnotation<?>, V extends DerivedAnnotationValueProviderBase<T>>
EditingSupport createEditingSupport4DerivedAnnotationValueProviderBase(V valueProvider,
ColumnViewer viewer, Class<? extends IAnnotatedSpecification> clazz,
T specification, String instanceKey) throws Exception {
if(valueProvider.isDerivedKey(instanceKey) && !valueProvider.isEditableByUser()) {
return null;
}
return createEditingSupport4EStructuralFeatureValueProviderBase(
(EStructuralFeatureValueProviderBase<T>)valueProvider, viewer, clazz,
specification, instanceKey);
}
/**
* Creates the {@link EditingSupport} that is directly based on
* {@link EStructuralFeatureValueProviderBase}.
*
* @param valueProvider
* @param specification
*/
private static
<T extends IAnnotatedSpecification, V extends DynamicInstanceAnnotationValueProviderBase<T>>
EditingSupport createEditingSupport4DynamicInstanceAnnotationValueProviderBase(
V valueProvider, ColumnViewer viewer,
Class<? extends IAnnotatedSpecification> clazz, T specification,
String instanceKey) throws Exception {
return new TextEditingSupport(viewer, clazz, instanceKey);
}
/**
* Creates the {@link EditingSupport} that is directly based on
* {@link EStructuralFeatureValueProviderBase}.
*/
private static
<T extends IAnnotatedSpecification, V extends EStructuralFeatureValueProviderBase<T>>
EditingSupport createEditingSupport4EStructuralFeatureValueProviderBase(
V valueProvider, ColumnViewer viewer,
Class<? extends IAnnotatedSpecification> clazz, T specification,
String instanceKey) throws Exception {
EStructuralFeature structuralFeature =
valueProvider.getEStructuralFeature(specification, instanceKey);
EClassifier eType = null;
try {
eType = structuralFeature.getEType();
} catch(Exception e) {
// Ignore
}
if(structuralFeature.getUpperBound() == 0) {
throw new Exception(
"EStructuralValueProvider: feature multiplicity == 0 is not supported.");
}
if(structuralFeature.getUpperBound() == 1) {
if(((!(eType instanceof EEnum)) && (!(eType instanceof EClass))) ||
((eType instanceof EClass) && (valueProvider.getEStructuralFeatureDescriptor(
instanceKey).getEReferenceScope() == null))) {
return createEditingSupport4ValueProviderBase((ValueProviderBase<T>)valueProvider,
viewer, clazz, specification, instanceKey);
}
return new ComboBoxEditingSupport(viewer, clazz, specification, instanceKey,
valueProvider.getEStructuralFeatureDescriptor(instanceKey));
}
if(eType instanceof EClass || eType instanceof EEnum) {
return new MultiSelectionEditingSupport(viewer, clazz, specification, instanceKey,
valueProvider.getEStructuralFeatureDescriptor(instanceKey));
}
throw new Exception(
"For feature multiplicity > 1, EStructuralValueProvider has been implemented for EReferences and EEnumns, only .");
}
/**
* Helper method for
* {@link #createEditingSupport4ValueProviderBase(ValueProviderBase, ColumnViewer, Class, IAnnotatedSpecification, String)}
* that initialized the current input map of the value provider.
*/
@SuppressWarnings("unchecked")
private static <T extends IAnnotatedSpecification, V extends ValueProviderBase<T>> void
initializeInputChoice(V valueProvider, ColumnViewer viewer,
Class<? extends IAnnotatedSpecification> clazz, String instanceKey)
throws Exception {
// Input choice is not set, or it is restricted to concrete set of values
// (use SingleEnumAttributeValueProviderBase for Enum types!)
if(valueProvider.getFixedInputChoiceMap().get(instanceKey) == null ||
!valueProvider.getFixedInputChoiceMap().get(instanceKey).isEmpty()) {
valueProvider.getCurrentInputChoiceMap().put(instanceKey,
valueProvider.getFixedInputChoiceMap().get(instanceKey));
} else if(!(viewer.getInput() instanceof Set<?>) || ((Set<?>)viewer.getInput()).isEmpty() ||
!(((Set<?>)viewer.getInput()).iterator().next() instanceof AnnotationEntry)) {
valueProvider.getCurrentInputChoiceMap().put(instanceKey, null);
} else {
AnnotationEntry annotationEntry =
((Set<AnnotationEntry>)viewer.getInput()).iterator().next();
EObject root = annotationEntry.getModelElement();
while(root.eContainer() != null) {
root = root.eContainer();
}
Set<String> choices = new TreeSet<String>();
for(T specification : (EList<T>)EcoreUtils.getChildrenWithType(root, clazz)) {
choices.add(valueProvider.getAnnotationValue(specification).toString());
}
valueProvider.getCurrentInputChoiceMap().put(instanceKey, choices);
}
}
/**
* Creates the {@link EditingSupport} for value providers that are directly based on
* {@link ValueProviderBase}.
*/
private static <T extends IAnnotatedSpecification, V extends ValueProviderBase<T>>
EditingSupport createEditingSupport4ValueProviderBase(V valueProvider,
ColumnViewer viewer, Class<? extends IAnnotatedSpecification> clazz,
T specification, String instanceKey) throws Exception {
try {
initializeInputChoice(valueProvider, viewer, clazz, instanceKey);
} catch(Exception e) {
// Use standard text editor as fallback
valueProvider.setCurrentInputChoiceMap(null);
}
// Input is not restricted -> free editing in text cell
if(valueProvider.getCurrentInputChoiceMap().get(instanceKey) == null) {
if(valueProvider.getAnnotationValue(specification, instanceKey) instanceof Boolean) {
return new CheckBoxEditingSupport(viewer, clazz, instanceKey);
}
return new TextEditingSupport(viewer, clazz, instanceKey);
}
// Multiple instances are not supported (yet) for input to be edited in Comboboxes
assert (instanceKey == null);
// Input is restricted to concrete set of values
// (use SingleEnumAttributeValueProviderBase for Enum types!)
return new ComboBoxEditingSupport(viewer, clazz, instanceKey, valueProvider
.getCurrentInputChoiceMap().get(instanceKey), valueProvider
.getFixedInputChoiceMap().get(instanceKey).isEmpty());
}
/**
* Creates the editing support.
*/
@SuppressWarnings({"rawtypes", "unchecked"})
public static <T extends IAnnotatedSpecification> EditingSupport createEditingSupport(
IAnnotationValueProvider<T> valueProvider, ColumnViewer viewer,
Class<? extends IAnnotatedSpecification> clazz, T specification, String instanceKey)
throws Exception {
if(valueProvider instanceof DerivedAnnotationValueProviderBase<?>) {
return createEditingSupport4DerivedAnnotationValueProviderBase(
(DerivedAnnotationValueProviderBase)valueProvider, viewer, clazz,
(IDerivedAnnotation)specification, instanceKey);
} else if(valueProvider instanceof DynamicInstanceAnnotationValueProviderBase<?>) {
return createEditingSupport4DynamicInstanceAnnotationValueProviderBase(
(DynamicInstanceAnnotationValueProviderBase)valueProvider, viewer, clazz,
specification, instanceKey);
} else if(valueProvider instanceof EStructuralFeatureValueProviderBase<?>) {
return createEditingSupport4EStructuralFeatureValueProviderBase(
(EStructuralFeatureValueProviderBase<T>)valueProvider, viewer, clazz,
specification, instanceKey);
}
if(valueProvider instanceof ValueProviderBase<?>) {
return createEditingSupport4ValueProviderBase((ValueProviderBase<T>)valueProvider,
viewer, clazz, specification, instanceKey);
}
return null;
}
/**
* Creates the editing support without referring to the optional {@code instanceKey} (see
* {@link #createEditingSupport(IAnnotationValueProvider, ColumnViewer, Class, IAnnotatedSpecification, String)}
* .
*/
public static <T extends IAnnotatedSpecification> EditingSupport createEditingSupport(
IAnnotationValueProvider<T> valueProvider, ColumnViewer viewer,
Class<? extends IAnnotatedSpecification> clazz) throws Exception {
return createEditingSupport(valueProvider, viewer, clazz, null, null);
}
}
......@@ -19,8 +19,8 @@ package org.fortiss.tooling.base.ui.annotation.editingsupport;
import org.eclipse.jface.viewers.ColumnViewer;
import org.eclipse.jface.viewers.EditingSupport;
import org.fortiss.tooling.base.annotation.AnnotationEntry;
import org.fortiss.tooling.base.model.element.IModelElement;
import org.fortiss.tooling.base.ui.annotation.AnnotationEntry;
import org.fortiss.tooling.kernel.model.INamedCommentedElement;
/**
......
......@@ -19,8 +19,8 @@ package org.fortiss.tooling.base.ui.annotation.editingsupport;
import org.eclipse.jface.viewers.ColumnViewer;
import org.eclipse.jface.viewers.EditingSupport;
import org.fortiss.tooling.base.annotation.AnnotationEntry;
import org.fortiss.tooling.base.model.element.IAnnotatedSpecification;
import org.fortiss.tooling.base.ui.annotation.AnnotationEntry;
/**
* Base class for {@link EditingSupport}s that directly access models element fields (and not the
......
......@@ -19,8 +19,8 @@ package org.fortiss.tooling.base.ui.annotation.editingsupport;
import org.eclipse.jface.viewers.ColumnViewer;
import org.eclipse.jface.viewers.EditingSupport;
import org.fortiss.tooling.base.annotation.AnnotationEntry;
import org.fortiss.tooling.base.model.element.IModelElement;
import org.fortiss.tooling.base.ui.annotation.AnnotationEntry;
import org.fortiss.tooling.kernel.model.INamedElement;
/**
......
......@@ -36,9 +36,9 @@ import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EEnumLiteral;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.fortiss.tooling.base.annotation.valueprovider.EStructuralFeatureDescriptor;
import org.fortiss.tooling.base.annotation.valueprovider.EStructuralFeatureDescriptor.EReferenceScope;
import org.fortiss.tooling.base.model.element.IAnnotatedSpecification;
import org.fortiss.tooling.base.ui.annotation.valueprovider.EStructuralFeatureDescriptor;
import org.fortiss.tooling.base.ui.annotation.valueprovider.EStructuralFeatureDescriptor.EReferenceScope;
import org.fortiss.tooling.kernel.model.IIdLabeled;
import org.fortiss.tooling.kernel.model.INamedElement;
import org.fortiss.tooling.kernel.model.IProjectRootElement;
......
......@@ -24,9 +24,9 @@ import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ColumnViewer;
import org.eclipse.jface.viewers.EditingSupport;
import org.eclipse.swt.widgets.Composite;
import org.fortiss.tooling.base.annotation.AnnotationEntry;
import org.fortiss.tooling.base.annotation.valueprovider.EStructuralFeatureDescriptor;
import org.fortiss.tooling.base.model.element.IAnnotatedSpecification;
import org.fortiss.tooling.base.ui.annotation.AnnotationEntry;
import org.fortiss.tooling.base.ui.annotation.valueprovider.EStructuralFeatureDescriptor;
import org.fortiss.tooling.kernel.extension.data.ITopLevelElement;
import org.fortiss.tooling.kernel.service.IPersistencyService;
......
......@@ -22,8 +22,8 @@ import org.eclipse.jface.viewers.ColumnViewer;
import org.eclipse.jface.viewers.TextCellEditor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.fortiss.tooling.base.annotation.AnnotationEntry;
import org.fortiss.tooling.base.model.element.IAnnotatedSpecification;
import org.fortiss.tooling.base.ui.annotation.AnnotationEntry;
/**
* This class constructs and manages an editing element for the annotation view. It provides a
......
......@@ -21,9 +21,9 @@ import org.eclipse.jface.viewers.EditingSupport;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.graphics.Color;
import org.eclipse.wb.swt.SWTResourceManager;
import org.fortiss.tooling.base.annotation.AnnotationEntry;
import org.fortiss.tooling.base.model.element.IAnnotatedSpecification;
import org.fortiss.tooling.base.model.element.IDerivedAnnotation;
import org.fortiss.tooling.base.ui.annotation.AnnotationEntry;
import org.fortiss.tooling.base.ui.annotation.editingsupport.ComboBoxEditingSupport;
import org.fortiss.tooling.base.ui.annotation.editingsupport.MultiSelectionEditingSupport;
import org.fortiss.tooling.base.ui.annotation.view.IAnnotationViewPart;
......
......@@ -17,8 +17,8 @@ $Id$
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.base.ui.annotation.labelprovider;
import org.fortiss.tooling.base.annotation.AnnotationEntry;
import org.fortiss.tooling.base.model.element.IModelElement;
import org.fortiss.tooling.base.ui.annotation.AnnotationEntry;
import org.fortiss.tooling.base.ui.annotation.view.IAnnotationViewPart;
import org.fortiss.tooling.kernel.model.INamedCommentedElement;
import org.fortiss.tooling.kernel.model.INamedElement;
......
......@@ -17,8 +17,8 @@ $Id$
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.base.ui.annotation.labelprovider;
import org.fortiss.tooling.base.annotation.AnnotationEntry;
import org.fortiss.tooling.base.model.element.IModelElement;
import org.fortiss.tooling.base.ui.annotation.AnnotationEntry;
import org.fortiss.tooling.base.ui.annotation.view.IAnnotationViewPart;
import org.fortiss.tooling.kernel.model.INamedElement;
......
......@@ -34,8 +34,8 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableItem;
import org.fortiss.tooling.base.annotation.AnnotationEntry;
import org.fortiss.tooling.base.model.element.IAnnotatedSpecification;
import org.fortiss.tooling.base.ui.annotation.AnnotationEntry;
import org.fortiss.tooling.base.ui.annotation.view.IAnnotationViewPart;
/**
......
......@@ -22,8 +22,8 @@ import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Point;
import org.eclipse.wb.swt.SWTResourceManager;
import org.fortiss.tooling.base.annotation.AnnotationEntry;
import org.fortiss.tooling.base.model.element.IModelElement;
import org.fortiss.tooling.base.ui.annotation.AnnotationEntry;
import org.fortiss.tooling.base.ui.annotation.view.IAnnotationViewPart;
import org.fortiss.tooling.kernel.model.IIdLabeled;
import org.fortiss.tooling.kernel.model.INamedElement;
......
......@@ -33,10 +33,10 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.part.ViewPart;
import org.fortiss.tooling.base.annotation.AnnotationEntry;
import org.fortiss.tooling.base.annotation.IAnnotationValueService;
import org.fortiss.tooling.base.model.element.IAnnotatedSpecification;
import org.fortiss.tooling.base.model.element.IModelElement;
import org.fortiss.tooling.base.ui.annotation.AnnotationEntry;
import org.fortiss.tooling.base.ui.annotation.IAnnotationValueService;
import org.fortiss.tooling.kernel.model.IProjectRootElement;
import org.fortiss.tooling.kernel.service.IPersistencyService;
import org.fortiss.tooling.kernel.ui.util.SelectionUtils;
......
......@@ -17,8 +17,8 @@ $Id$
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.base.ui.annotation.view.generic;
import org.fortiss.tooling.base.annotation.AnnotationEntry;
import org.fortiss.tooling.base.model.element.IAnnotatedSpecification;
import org.fortiss.tooling.base.ui.annotation.AnnotationEntry;
/**
* Data required to identify a column displaying a particular {@link IAnnotatedSpecification} in
......
......@@ -44,9 +44,9 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.fortiss.tooling.base.annotation.AnnotationEntry;
import org.fortiss.tooling.base.annotation.IAnnotationValueService;
import org.fortiss.tooling.base.model.element.IAnnotatedSpecification;
import org.fortiss.tooling.base.ui.annotation.AnnotationEntry;
import org.fortiss.tooling.base.ui.annotation.IAnnotationValueService;
import org.fortiss.tooling.kernel.extension.data.ITopLevelElement;
import org.fortiss.tooling.kernel.service.IPersistencyService;
......
......@@ -40,17 +40,18 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.fortiss.tooling.base.annotation.AnnotationEntry;
import org.fortiss.tooling.base.annotation.IAnnotationValueService;
import org.fortiss.tooling.base.annotation.valueprovider.IAnnotationValueProvider;
import org.fortiss.tooling.base.model.element.IAnnotatedSpecification;
import org.fortiss.tooling.base.model.element.IModelElement;
import org.fortiss.tooling.base.ui.annotation.AnnotationEntry;
import org.fortiss.tooling.base.ui.annotation.IAnnotationValueService;
import org.fortiss.tooling.base.ui.annotation.editingsupport.EditingSupportFactory;
import org.fortiss.tooling.base.ui.annotation.editingsupport.ElementCommentEditingSupport;
import org.fortiss.tooling.base.ui.annotation.editingsupport.ElementNameEditingSupport;
import org.fortiss.tooling.base.ui.annotation.labelprovider.AnnotationLabelProvider;
import org.fortiss.tooling.base.ui.annotation.labelprovider.ElementCommentLabelProvider;
import org.fortiss.tooling.base.ui.annotation.labelprovider.ElementNameLabelProvider;
import org.fortiss.tooling.base.ui.annotation.labelprovider.EmulatedNativeCheckBoxLabelProvider;
import org.fortiss.tooling.base.ui.annotation.valueprovider.IAnnotationValueProvider;
import org.fortiss.tooling.base.ui.annotation.view.AnnotationViewPartBase;
import org.fortiss.tooling.base.ui.annotation.view.generic.filter.AnnotationFilter;
import org.fortiss.tooling.base.ui.annotation.view.generic.filter.AnnotationFilterWidget;
......@@ -62,9 +63,9 @@ import org.fortiss.tooling.base.ui.annotation.view.generic.filter.AnnotationFilt
* first row, using this class.
* </p>
* <p>
* In order to support displaying and editing specific annotation types, the corresponding
* {@link IAnnotationValueProvider#createEditingSupport(org.eclipse.jface.viewers.ColumnViewer, Class, IAnnotatedSpecification, String)}
* factory method must return an appropriate {@link EditingSupport}.
* In order to support displaying and editing specific annotation types,
* {@link EditingSupportFactory} must create an appropriate {@link EditingSupport} for the
* corresponding {@link IAnnotationValueProvider} base classes.
* </p>
*
* @author eder, diewald, barner
......@@ -422,19 +423,22 @@ public class GenericAnnotationView extends AnnotationViewPartBase {
* If something else than pure text shall be displayed for the annotation, these extended
* {@link LabelProvider} shall be instantiated here.
*/
private TableViewerColumn createAnnotationTableViewerColumn(ColumnHandle columnHandle,
Class<? extends IAnnotatedSpecification> annotationClass) throws Exception {
private <T extends IAnnotatedSpecification> TableViewerColumn
createAnnotationTableViewerColumn(ColumnHandle columnHandle, Class<T> annotationClass)
throws Exception {
TableViewerColumn column = new TableViewerColumn(tableViewer, SWT.NONE);
// Have the matching EditingSupport created for the current annotated specification
// (work is delegated to respective IAnnotationValueProvider implementation)
EditingSupport editingSupport =
columnHandle.getEntry().createSpecificationEditElement(tableViewer,
annotationClass, columnHandle.getInstanceKey());
EditingSupportFactory.createEditingSupport(columnHandle.getEntry()
.getAnnotationValueProvider(annotationClass), tableViewer, annotationClass,
columnHandle.getEntry().getSpecification(annotationClass), columnHandle
.getInstanceKey());
ColumnLabelProvider columnLabelProvider = null;
// TODO: Avoid this case distinction here and delegate the construction of label providers
// to the value provider (see #2226).
// to a factory as well (see #2226).
if(columnHandle.getEntry().getSpecificationValue(annotationClass) instanceof Boolean) {
columnLabelProvider =
new EmulatedNativeCheckBoxLabelProvider(annotationClass, this,
......
......@@ -20,8 +20,8 @@ package org.fortiss.tooling.base.ui.annotation.view.generic;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerComparator;
import org.fortiss.tooling.base.annotation.AnnotationEntry;
import org.fortiss.tooling.base.model.element.IModelElement;
import org.fortiss.tooling.base.ui.annotation.AnnotationEntry;
import org.fortiss.tooling.kernel.model.IIdLabeled;
import org.fortiss.tooling.kernel.model.INamedElement;
......
......@@ -20,9 +20,9 @@ package org.fortiss.tooling.base.ui.annotation.view.generic.filter;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.fortiss.tooling.base.annotation.AnnotationEntry;
import org.fortiss.tooling.base.model.element.IAnnotatedSpecification;
import org.fortiss.tooling.base.model.element.IModelElement;
import org.fortiss.tooling.base.ui.annotation.AnnotationEntry;
import org.fortiss.tooling.base.ui.annotation.view.generic.ColumnHandle;
import org.fortiss.tooling.base.ui.annotation.view.generic.GenericAnnotationView;
import org.fortiss.tooling.kernel.model.INamedElement;
......
......@@ -38,8 +38,8 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.fortiss.tooling.base.annotation.AnnotationEntry;