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;
* @version $Rev$
* @ConQAT.Rating RED Hash:
*/
@SuppressWarnings("unchecked")
public class AnnotationEntry<T extends IAnnotatedSpecification> {
/** Model Element */
......@@ -54,10 +55,12 @@ public class AnnotationEntry<T extends IAnnotatedSpecification> {
return valueProvider.getValue((T)specification);
}
public List<String> getFixedSpecifiactionValues() {
/** Returns the possible values of the {@link #specification} */
public List<String> getFixedSpecificationValues() {
return valueProvider.getFixedValues();
}
/** adds a new value to the {@link #specification} and overrides the old one */
public void setSpecificationValue(String value) {
valueProvider.setValue(value, (T)specification);
}
......
......@@ -87,8 +87,8 @@ public class AnnotationValueService extends
while(!(root instanceof IProjectRootElement)) {
root = root.eContainer();
}
final List<? extends IModelElement> childrenWithType =
EcoreUtils.getChildrenWithType(root, element.getClass());
// final List<? extends IModelElement> childrenWithType =
// EcoreUtils.getChildrenWithType(root, element.getClass());
for(IAnnotationValueProvider<IAnnotatedSpecification> annotationProvider : registeredHandlers) {
List<? extends IModelElement> allChildren =
......@@ -127,33 +127,30 @@ public class AnnotationValueService extends
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<T> results = new ArrayList<T>();
getAllChildren2(element, class1, 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);
// }
// }
getAllChildren2(element, type, filterOut, 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) {
EList<EObject> eContents = element.eContents();
for(EObject o : eContents) {
if(class1.isInstance(o)) {
if(type.isInstance(o)) {
results.add((T)o);
getAllChildren2(o, class1, filterOut, results);
getAllChildren2(o, type, filterOut, results);
} else {
boolean filter = false;
for(Class<?> c : filterOut) {
......@@ -161,7 +158,7 @@ public class AnnotationValueService extends
filter = true;
}
if(!filter)
getAllChildren2(o, class1, filterOut, results);
getAllChildren2(o, type, filterOut, results);
}
}
}
......
......@@ -40,7 +40,10 @@ import org.fortiss.tooling.kernel.ui.util.SelectionUtils;
*/
public abstract class AnnotationViewPartBase2 extends ViewPart implements ISelectionListener {
/** the currently selected object */
private IModelElement currentlySelectedObject;
/** List of all Annotation entries of the {@link #currentlySelectedObject} */
protected List<AnnotationEntry<? extends IAnnotatedSpecification>> values =
new ArrayList<AnnotationEntry<? extends IAnnotatedSpecification>>();
......@@ -72,10 +75,4 @@ public abstract class AnnotationViewPartBase2 extends ViewPart implements ISelec
getSite().getWorkbenchWindow().getSelectionService().addSelectionListener(this);
}
/** {@inheritDoc} */
@Override
public void setFocus() {
}
}
......@@ -109,7 +109,7 @@ public class GenericAnnotationView extends AnnotationViewPartBase2 {
column.getColumn().setText(entry.getAnnotationName());
column.getColumn().setWidth(100);
columns.put(entry.getSpecification().getClass(), column);
if(entry.getFixedSpecifiactionValues() == null) {
if(entry.getFixedSpecificationValues() == null) {
column.setLabelProvider(new AnnotationLabelProvider());
EditingSupport editingSupport = new StandardEditingSupport(column.getViewer());
column.setEditingSupport(editingSupport);
......@@ -117,7 +117,7 @@ public class GenericAnnotationView extends AnnotationViewPartBase2 {
column.setLabelProvider(new AnnotationLabelProvider());
EditingSupport editingSupport =
new ComboEditingSupport(column.getViewer(),
entry.getFixedSpecifiactionValues());
entry.getFixedSpecificationValues());
column.setEditingSupport(editingSupport);
}
}
......@@ -136,13 +136,19 @@ public class GenericAnnotationView extends AnnotationViewPartBase2 {
return false;
}
/** Editing support for combo table cells */
private final class ComboEditingSupport extends EditingSupport {
/** Combo box cell editor */
private ComboBoxViewerCellEditor cellEditor = null;
/**
* Constructor.
*
* @param viewer
* the column viewer
* @param values
* the values for the combo box
*/
private ComboEditingSupport(ColumnViewer viewer, List<String> values) {
super(viewer);
......@@ -179,8 +185,6 @@ public class GenericAnnotationView extends AnnotationViewPartBase2 {
/** {@inheritDoc} */
@Override
protected void setValue(Object element, final Object value) {
boolean test = true;
if(element instanceof AnnotationEntry<?> && value instanceof String) {
final AnnotationEntry<?> data = (AnnotationEntry<?>)element;
......@@ -210,8 +214,10 @@ public class GenericAnnotationView extends AnnotationViewPartBase2 {
}
/** Editing Suppourt for standard table cells */
private final class StandardEditingSupport extends EditingSupport {
/** Text cell editor */
private TextCellEditor cellEditor = null;
/**
......@@ -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;
* @ConQAT.Rating RED Hash:
*/
public interface IAnnotationModelElementIterator {
// TODO
}
......@@ -43,14 +43,22 @@ public interface IAnnotationValueProvider<T extends IAnnotatedSpecification> ext
*/
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;
/**
* adds a new {@link IAnnotatedSpecification} of type T to the given model element and returns
* it
*/
public T addNewSpecToModelElement(IModelElement element);
/** Returns the class of T */
public Class<T> getClazz();
/** Returns the disered name of the Annotaion */
public String getAnnotationName();
/** Returns a List of Objects which children will not have {@link IAnnotatedSpecification}s */
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