From 8fa8939fe1cfb52c4f55494a709e9d1e86dd8b8a Mon Sep 17 00:00:00 2001 From: tu <tu@PC-Tu.IDS.DOM> Date: Mon, 29 Oct 2018 11:19:39 +0100 Subject: [PATCH] automatically jump to next annotation after accepting/deleting one --- .../athen/rwview/part/RedeWiedergabeView.java | 38 ++++++++++++++++++- .../athen/rwview/ui/RwStwrTableComposite.java | 7 ++-- 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/de.uniwue.mk.athen/bundles/de.ids.tt.athen.rwview/src/de/ids/tt/athen/rwview/part/RedeWiedergabeView.java b/de.uniwue.mk.athen/bundles/de.ids.tt.athen.rwview/src/de/ids/tt/athen/rwview/part/RedeWiedergabeView.java index 78471b44..d59cfb32 100644 --- a/de.uniwue.mk.athen/bundles/de.ids.tt.athen.rwview/src/de/ids/tt/athen/rwview/part/RedeWiedergabeView.java +++ b/de.uniwue.mk.athen/bundles/de.ids.tt.athen.rwview/src/de/ids/tt/athen/rwview/part/RedeWiedergabeView.java @@ -46,8 +46,10 @@ import de.ids.tt.athen.rwview.ui.RwDrawingStrategy; import de.ids.tt.athen.rwview.ui.RwFrameDrawingStrategy; import de.ids.tt.athen.rwview.ui.RwMetadataDialog; import de.ids.tt.athen.rwview.ui.RwSpeakerDrawingStrategy; +import de.ids.tt.athen.rwview.ui.RwStwrTableComposite; import de.ids.tt.athen.rwview.ui.RwExpDrawingStrategy; import de.ids.tt.athen.rwview.ui.RwViewComposite; +import de.ids.tt.athen.rwview.ui.helper.StwrTableViewerDropListener; import de.uniwue.kalimachos.coref.paintingStrategies.BackgroundGCDrawingStrategy; import de.uniwue.mk.athen.textwidget.struct.AnnoStyle; import de.uniwue.mk.kall.athen.part.editor.annotations.ATHENEditorDrawingInfo; @@ -1725,6 +1727,19 @@ public class RedeWiedergabeView extends AEditorSubordinateViewPart { } public void deleteAnnotations(List<AnnotationFS> annos) { + AnnotationFS anno = annos.get(0); + + int i = 0; + for (AnnotationFS stwrAnno : stwrList){ + if (stwrAnno.equals(anno) && i+1 < stwrList.size()){ + editor.highlightRange(stwrList.get(i+1).getBegin(), stwrList.get(i+1).getEnd() - stwrList.get(i+1).getBegin(), true); + // highlight in table + IStructuredSelection sel = new StructuredSelection(stwrList.get(i+1)); + rwViewComposite.refreshSelection(sel); + } + i++; + } + deleteAnnotations(annos.toArray(new AnnotationFS[0])); } @@ -2094,6 +2109,7 @@ public class RedeWiedergabeView extends AEditorSubordinateViewPart { } } + public void changeToFreeIndirect(List<AnnotationFS> annos){ for (AnnotationFS anno : annos) { String rTypeValue = anno.getFeatureValueAsString(rTypeFeat); @@ -2103,10 +2119,30 @@ public class RedeWiedergabeView extends AEditorSubordinateViewPart { } rTypeValue = rTypeValue.equals("ruleFreeIndirect") ? "freeIndirect" : "ruleFreeIndirect"; updateAnnotation(anno, rTypeFeat, rTypeValue, true); + + int i = 0; + for (AnnotationFS stwrAnno : stwrList){ + if (stwrAnno.equals(anno) && i+1 < stwrList.size()){ + editor.highlightRange(stwrList.get(i+1).getBegin(), stwrList.get(i+1).getEnd() - stwrList.get(i+1).getBegin(), true); + // highlight in table + IStructuredSelection sel = new StructuredSelection(stwrList.get(i+1)); + rwViewComposite.refreshSelection(sel); + } + i++; + } } - renewPage(); + + /* + if (i+1 < annos.size()){ + System.out.println("test"); + editor.highlightRange(annos.get(i+1).getBegin(), annos.get(i+1).getEnd() - annos.get(i+1).getBegin(), true); + } + */ + renewPage(); } + + public void addStwrNote(List<AnnotationFS> annos) { for (AnnotationFS anno : annos) { diff --git a/de.uniwue.mk.athen/bundles/de.ids.tt.athen.rwview/src/de/ids/tt/athen/rwview/ui/RwStwrTableComposite.java b/de.uniwue.mk.athen/bundles/de.ids.tt.athen.rwview/src/de/ids/tt/athen/rwview/ui/RwStwrTableComposite.java index 44976071..9124e704 100644 --- a/de.uniwue.mk.athen/bundles/de.ids.tt.athen.rwview/src/de/ids/tt/athen/rwview/ui/RwStwrTableComposite.java +++ b/de.uniwue.mk.athen/bundles/de.ids.tt.athen.rwview/src/de/ids/tt/athen/rwview/ui/RwStwrTableComposite.java @@ -167,7 +167,7 @@ public class RwStwrTableComposite extends Composite{ goToStwr.setText("Go to selected Annotation"); delStwr = new MenuItem(stwrMenu, SWT.None); - delStwr.setText("Delete Selected Annotation"); + delStwr.setText("Delete Selected Annotation (Entf)"); mediumMenu = new MenuItem(stwrMenu, SWT.None); mediumMenu.setText("Change medium (a)"); @@ -211,7 +211,7 @@ public class RwStwrTableComposite extends Composite{ } private void handleTableKeyDown(Event e) { - // if nothing is selected the we cant do anything + // if nothing is selected then we cant do anything if (((IStructuredSelection) stwrViewer.getSelection()).getFirstElement() == null) { return; } @@ -219,7 +219,6 @@ public class RwStwrTableComposite extends Composite{ // access the selection and convert to annotations if possible List<AnnotationFS> selectedAnnos = getSelectedAnnotationsFromTable(); - // on enter we allow the user to change the name feature if (e.keyCode == SWT.CR) { //part.addStwrNote(selectedAnnos); part.goToAnnotation(getSelectedAnnotationsFromTable()); @@ -262,7 +261,7 @@ public class RwStwrTableComposite extends Composite{ part.toggleMetaph(selectedAnnos); } else if (e.keyCode == KeyEvent.VK_SPACE){ - part.changeToFreeIndirect(selectedAnnos); + part.changeToFreeIndirect(selectedAnnos); } else if (e.keyCode == KeyEvent.VK_DELETE){ part.deleteAnnotations(getSelectedAnnotationsFromTable()); -- GitLab