Skip to content
Snippets Groups Projects
Commit b0710c2c authored by Markus Krug's avatar Markus Krug
Browse files

added 1 new feature: Annotations can now be created by double clicking

the type

and 1 bugfix- annobrowser labels were off by 1 iteration of the color
parent a77152e4
No related branches found
No related tags found
No related merge requests found
...@@ -388,6 +388,7 @@ public class AnnotationBrowserWidget extends Composite { ...@@ -388,6 +388,7 @@ public class AnnotationBrowserWidget extends Composite {
private void addTreeMouseListener() { private void addTreeMouseListener() {
viewer.getTree().addMouseListener(new MouseAdapter() { viewer.getTree().addMouseListener(new MouseAdapter() {
@Override @Override
public void mouseDoubleClick(MouseEvent e) { public void mouseDoubleClick(MouseEvent e) {
...@@ -395,6 +396,15 @@ public class AnnotationBrowserWidget extends Composite { ...@@ -395,6 +396,15 @@ public class AnnotationBrowserWidget extends Composite {
IStructuredSelection sel = (IStructuredSelection) viewer.getSelection(); IStructuredSelection sel = (IStructuredSelection) viewer.getSelection();
Object firstElement = sel.getFirstElement(); Object firstElement = sel.getFirstElement();
if(firstElement instanceof TypeStyleDataStructure){
TypeStyleDataStructure tsds = (TypeStyleDataStructure) firstElement;
if(editor.getActualSelectedText()!=null){
AnnotationFS fs = editor.getCas().createAnnotation(tsds.getAnnotationType(), editor.getActualSelectedText().x, editor.getActualSelectedText().y);
editor.addAnnotation(fs);
}
}
if (firstElement instanceof FeatureValueWrapper) { if (firstElement instanceof FeatureValueWrapper) {
......
...@@ -1137,8 +1137,11 @@ public class AnnotationEditorWidget extends Composite { ...@@ -1137,8 +1137,11 @@ public class AnnotationEditorWidget extends Composite {
// default is backgroundDrawingStrategy // default is backgroundDrawingStrategy
// TODO the anno browser labelprovider color seems off!! // TODO the anno browser labelprovider color seems off!!
StyleRange srAnnoType = new StyleRange();
srAnnoType.background=actual;
srAnnoType.foreground=actual;
AnnoStyle style = new AnnoStyle(DrawingTypeStrategyFactory.getNaiveSpanDrawingStrategy(next, AnnoStyle style = new AnnoStyle(DrawingTypeStrategyFactory.getNaiveSpanDrawingStrategy(next,
actual.getRGBA(), actual.getRGBA(), EDrawingType.RECTANGLE_FILLED), styleRange); actual.getRGBA(), actual.getRGBA(), EDrawingType.RECTANGLE_FILLED), srAnnoType);
// AnnoStyle style = new AnnoStyle(strat, styleRange); // AnnoStyle style = new AnnoStyle(strat, styleRange);
TypeStyleDataStructure asds = new TypeStyleDataStructure(next, style, 0); TypeStyleDataStructure asds = new TypeStyleDataStructure(next, style, 0);
...@@ -1283,6 +1286,8 @@ public class AnnotationEditorWidget extends Composite { ...@@ -1283,6 +1286,8 @@ public class AnnotationEditorWidget extends Composite {
String[] filterExt = { "*.xml", "*.*" }; String[] filterExt = { "*.xml", "*.*" };
fd.setFilterExtensions(filterExt); fd.setFilterExtensions(filterExt);
String selected = fd.open(); String selected = fd.open();
if (selected == null)
return;
AnnotationEditorWidget.this.currentNappiConfig = new File(selected); AnnotationEditorWidget.this.currentNappiConfig = new File(selected);
if (AnnotationEditorWidget.this.currentNappiConfig != null) { if (AnnotationEditorWidget.this.currentNappiConfig != null) {
......
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