import org.eclipse.swt.widgets.Table;\r
import org.eclipse.swt.widgets.Text;\r
\r
+import eu.etaxonomy.cdm.model.common.AnnotatableEntity;\r
import eu.etaxonomy.cdm.model.common.Annotation;\r
\r
public class AnnotationsDialog extends Dialog {\r
\r
private WritableList list = new WritableList();\r
private Annotation selectedAnnotation;\r
+ private AnnotatableEntity entity;\r
\r
/**\r
* Create the dialog\r
this(parent, SWT.NONE);\r
}\r
\r
- public AnnotationsDialog(Shell parent, Set<Annotation> annotations) {\r
+ public AnnotationsDialog(Shell parent, AnnotatableEntity entity) {\r
this(parent, SWT.NONE);\r
+ this.entity = entity;\r
+ Set<Annotation> annotations = entity.getAnnotations();\r
for (Annotation annotation : annotations) {\r
list.add(annotation);\r
}\r
addButton.addMouseListener(new MouseAdapter() {\r
@Override\r
public void mouseDown(MouseEvent e) {\r
+ if (text.getText().equals("")) {\r
+ return;\r
+ }\r
Annotation annotation = Annotation.NewInstance(text.getText(), null);\r
list.add(annotation);\r
+ entity.addAnnotation(annotation);\r
text.setText("");\r
}\r
});\r
table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1));\r
table.setLinesVisible(false);\r
table.setHeaderVisible(false);\r
-// table.s\r
new Label(composite, SWT.NONE);\r
\r
ObservableListContentProvider providerList = new ObservableListContentProvider();\r
\r
public void run() {\r
list.remove(annotation);\r
+ entity.removeAnnotation(annotation);\r
}\r
}\r
}
\ No newline at end of file