Skip to content
Snippets Groups Projects
Commit fc74f670 authored by Johannes Eder's avatar Johannes Eder
Browse files

missing comments

refs 1841
parent d913bdf8
No related branches found
No related tags found
No related merge requests found
...@@ -30,6 +30,7 @@ import org.fortiss.tooling.base.model.element.IModelElement; ...@@ -30,6 +30,7 @@ import org.fortiss.tooling.base.model.element.IModelElement;
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating RED Hash: * @ConQAT.Rating RED Hash:
*/ */
@SuppressWarnings("unchecked")
public class AnnotationEntry<T extends IAnnotatedSpecification> { public class AnnotationEntry<T extends IAnnotatedSpecification> {
/** Model Element */ /** Model Element */
...@@ -54,10 +55,12 @@ public class AnnotationEntry<T extends IAnnotatedSpecification> { ...@@ -54,10 +55,12 @@ public class AnnotationEntry<T extends IAnnotatedSpecification> {
return valueProvider.getValue((T)specification); return valueProvider.getValue((T)specification);
} }
public List<String> getFixedSpecifiactionValues() { /** Returns the possible values of the {@link #specification} */
public List<String> getFixedSpecificationValues() {
return valueProvider.getFixedValues(); return valueProvider.getFixedValues();
} }
/** adds a new value to the {@link #specification} and overrides the old one */
public void setSpecificationValue(String value) { public void setSpecificationValue(String value) {
valueProvider.setValue(value, (T)specification); valueProvider.setValue(value, (T)specification);
} }
......
...@@ -87,8 +87,8 @@ public class AnnotationValueService extends ...@@ -87,8 +87,8 @@ public class AnnotationValueService extends
while(!(root instanceof IProjectRootElement)) { while(!(root instanceof IProjectRootElement)) {
root = root.eContainer(); root = root.eContainer();
} }
final List<? extends IModelElement> childrenWithType = // final List<? extends IModelElement> childrenWithType =
EcoreUtils.getChildrenWithType(root, element.getClass()); // EcoreUtils.getChildrenWithType(root, element.getClass());
for(IAnnotationValueProvider<IAnnotatedSpecification> annotationProvider : registeredHandlers) { for(IAnnotationValueProvider<IAnnotatedSpecification> annotationProvider : registeredHandlers) {
List<? extends IModelElement> allChildren = List<? extends IModelElement> allChildren =
...@@ -127,33 +127,30 @@ public class AnnotationValueService extends ...@@ -127,33 +127,30 @@ public class AnnotationValueService extends
return result; return result;
} }
private <S, T> List<T> getAllChildren(EObject element, Class<? extends IModelElement> class1, /**
* Returns all children from element of the given type and filters out children of the given
* filterOut list
*/
private <S, T> List<T> getAllChildren(EObject element, Class<? extends IModelElement> type,
List<Class<? extends EObject>> filterOut) { List<Class<? extends EObject>> filterOut) {
List<T> results = new ArrayList<T>(); List<T> results = new ArrayList<T>();
getAllChildren2(element, class1, filterOut, results); getAllChildren2(element, type, filterOut, results);
// EList<EObject> eContents = element.eContents();
// for(EObject o : eContents) {
// if(o.getClass().isInstance(clazz))
// getAllChildren((IModelElement)o, clazz, exceptions).add((T)o);
// else {
// if(o instanceof IModelElement)
// getAllChildren((IModelElement)o, clazz, exceptions);
// }
// }
return results; return results;
} }
private <T, S> void getAllChildren2(EObject element, Class<? extends IModelElement> class1, /** depth search for desired elements */
@SuppressWarnings("unchecked")
private <T, S> void getAllChildren2(EObject element, Class<? extends IModelElement> type,
List<Class<? extends EObject>> filterOut, final List<T> results) { List<Class<? extends EObject>> filterOut, final List<T> results) {
EList<EObject> eContents = element.eContents(); EList<EObject> eContents = element.eContents();
for(EObject o : eContents) { for(EObject o : eContents) {
if(class1.isInstance(o)) { if(type.isInstance(o)) {
results.add((T)o); results.add((T)o);
getAllChildren2(o, class1, filterOut, results); getAllChildren2(o, type, filterOut, results);
} else { } else {
boolean filter = false; boolean filter = false;
for(Class<?> c : filterOut) { for(Class<?> c : filterOut) {
...@@ -161,7 +158,7 @@ public class AnnotationValueService extends ...@@ -161,7 +158,7 @@ public class AnnotationValueService extends
filter = true; filter = true;
} }
if(!filter) if(!filter)
getAllChildren2(o, class1, filterOut, results); getAllChildren2(o, type, filterOut, results);
} }
} }
} }
......
...@@ -40,7 +40,10 @@ import org.fortiss.tooling.kernel.ui.util.SelectionUtils; ...@@ -40,7 +40,10 @@ import org.fortiss.tooling.kernel.ui.util.SelectionUtils;
*/ */
public abstract class AnnotationViewPartBase2 extends ViewPart implements ISelectionListener { public abstract class AnnotationViewPartBase2 extends ViewPart implements ISelectionListener {
/** the currently selected object */
private IModelElement currentlySelectedObject; private IModelElement currentlySelectedObject;
/** List of all Annotation entries of the {@link #currentlySelectedObject} */
protected List<AnnotationEntry<? extends IAnnotatedSpecification>> values = protected List<AnnotationEntry<? extends IAnnotatedSpecification>> values =
new ArrayList<AnnotationEntry<? extends IAnnotatedSpecification>>(); new ArrayList<AnnotationEntry<? extends IAnnotatedSpecification>>();
...@@ -72,10 +75,4 @@ public abstract class AnnotationViewPartBase2 extends ViewPart implements ISelec ...@@ -72,10 +75,4 @@ public abstract class AnnotationViewPartBase2 extends ViewPart implements ISelec
getSite().getWorkbenchWindow().getSelectionService().addSelectionListener(this); getSite().getWorkbenchWindow().getSelectionService().addSelectionListener(this);
} }
/** {@inheritDoc} */
@Override
public void setFocus() {
}
} }
...@@ -109,7 +109,7 @@ public class GenericAnnotationView extends AnnotationViewPartBase2 { ...@@ -109,7 +109,7 @@ public class GenericAnnotationView extends AnnotationViewPartBase2 {
column.getColumn().setText(entry.getAnnotationName()); column.getColumn().setText(entry.getAnnotationName());
column.getColumn().setWidth(100); column.getColumn().setWidth(100);
columns.put(entry.getSpecification().getClass(), column); columns.put(entry.getSpecification().getClass(), column);
if(entry.getFixedSpecifiactionValues() == null) { if(entry.getFixedSpecificationValues() == null) {
column.setLabelProvider(new AnnotationLabelProvider()); column.setLabelProvider(new AnnotationLabelProvider());
EditingSupport editingSupport = new StandardEditingSupport(column.getViewer()); EditingSupport editingSupport = new StandardEditingSupport(column.getViewer());
column.setEditingSupport(editingSupport); column.setEditingSupport(editingSupport);
...@@ -117,7 +117,7 @@ public class GenericAnnotationView extends AnnotationViewPartBase2 { ...@@ -117,7 +117,7 @@ public class GenericAnnotationView extends AnnotationViewPartBase2 {
column.setLabelProvider(new AnnotationLabelProvider()); column.setLabelProvider(new AnnotationLabelProvider());
EditingSupport editingSupport = EditingSupport editingSupport =
new ComboEditingSupport(column.getViewer(), new ComboEditingSupport(column.getViewer(),
entry.getFixedSpecifiactionValues()); entry.getFixedSpecificationValues());
column.setEditingSupport(editingSupport); column.setEditingSupport(editingSupport);
} }
} }
...@@ -136,13 +136,19 @@ public class GenericAnnotationView extends AnnotationViewPartBase2 { ...@@ -136,13 +136,19 @@ public class GenericAnnotationView extends AnnotationViewPartBase2 {
return false; return false;
} }
/** Editing support for combo table cells */
private final class ComboEditingSupport extends EditingSupport { private final class ComboEditingSupport extends EditingSupport {
/** Combo box cell editor */
private ComboBoxViewerCellEditor cellEditor = null; private ComboBoxViewerCellEditor cellEditor = null;
/** /**
* Constructor.
*
* @param viewer * @param viewer
* the column viewer
* @param values * @param values
* the values for the combo box
*/ */
private ComboEditingSupport(ColumnViewer viewer, List<String> values) { private ComboEditingSupport(ColumnViewer viewer, List<String> values) {
super(viewer); super(viewer);
...@@ -179,8 +185,6 @@ public class GenericAnnotationView extends AnnotationViewPartBase2 { ...@@ -179,8 +185,6 @@ public class GenericAnnotationView extends AnnotationViewPartBase2 {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
protected void setValue(Object element, final Object value) { protected void setValue(Object element, final Object value) {
boolean test = true;
if(element instanceof AnnotationEntry<?> && value instanceof String) { if(element instanceof AnnotationEntry<?> && value instanceof String) {
final AnnotationEntry<?> data = (AnnotationEntry<?>)element; final AnnotationEntry<?> data = (AnnotationEntry<?>)element;
...@@ -210,8 +214,10 @@ public class GenericAnnotationView extends AnnotationViewPartBase2 { ...@@ -210,8 +214,10 @@ public class GenericAnnotationView extends AnnotationViewPartBase2 {
} }
/** Editing Suppourt for standard table cells */
private final class StandardEditingSupport extends EditingSupport { private final class StandardEditingSupport extends EditingSupport {
/** Text cell editor */
private TextCellEditor cellEditor = null; private TextCellEditor cellEditor = null;
/** /**
...@@ -289,4 +295,11 @@ public class GenericAnnotationView extends AnnotationViewPartBase2 { ...@@ -289,4 +295,11 @@ public class GenericAnnotationView extends AnnotationViewPartBase2 {
} }
} }
/** {@inheritDoc} */
@Override
public void setFocus() {
// nothing to do
}
} }
...@@ -25,5 +25,5 @@ package org.fortiss.tooling.base.ui.annotation; ...@@ -25,5 +25,5 @@ package org.fortiss.tooling.base.ui.annotation;
* @ConQAT.Rating RED Hash: * @ConQAT.Rating RED Hash:
*/ */
public interface IAnnotationModelElementIterator { public interface IAnnotationModelElementIterator {
// TODO
} }
...@@ -43,14 +43,22 @@ public interface IAnnotationValueProvider<T extends IAnnotatedSpecification> ext ...@@ -43,14 +43,22 @@ public interface IAnnotationValueProvider<T extends IAnnotatedSpecification> ext
*/ */
public List<String> getFixedValues(); public List<String> getFixedValues();
/** sets a new value in the annotation and overrides the old one */
public void setValue(String value, T specification) throws IllegalArgumentException; public void setValue(String value, T specification) throws IllegalArgumentException;
/**
* adds a new {@link IAnnotatedSpecification} of type T to the given model element and returns
* it
*/
public T addNewSpecToModelElement(IModelElement element); public T addNewSpecToModelElement(IModelElement element);
/** Returns the class of T */
public Class<T> getClazz(); public Class<T> getClazz();
/** Returns the disered name of the Annotaion */
public String getAnnotationName(); public String getAnnotationName();
/** Returns a List of Objects which children will not have {@link IAnnotatedSpecification}s */
public List<Class<? extends EObject>> filterOut(); public List<Class<? extends EObject>> filterOut();
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment