From bb08f3364dc355090a008364e99b8df0514d4c14 Mon Sep 17 00:00:00 2001 From: mak28ma <thanos@informatik.uni-wuerzburg.de> Date: Wed, 24 May 2017 12:59:37 +0200 Subject: [PATCH] update of the showcase --- .../textwidget/widget/ATHENEditorWidget.java | 74 ++++++++++--------- .../AEditorSubordinateViewPart.java | 1 - .../html/CorefViewParameterlessFunction.java | 1 - 3 files changed, 38 insertions(+), 38 deletions(-) diff --git a/de.uniwue.mk.athen/bundles/de.uniwue.mk.athen.textwidget/src/de/uniwue/mk/athen/textwidget/widget/ATHENEditorWidget.java b/de.uniwue.mk.athen/bundles/de.uniwue.mk.athen.textwidget/src/de/uniwue/mk/athen/textwidget/widget/ATHENEditorWidget.java index 8c7bf49f..750350f3 100644 --- a/de.uniwue.mk.athen/bundles/de.uniwue.mk.athen.textwidget/src/de/uniwue/mk/athen/textwidget/widget/ATHENEditorWidget.java +++ b/de.uniwue.mk.athen/bundles/de.uniwue.mk.athen.textwidget/src/de/uniwue/mk/athen/textwidget/widget/ATHENEditorWidget.java @@ -614,9 +614,10 @@ public class ATHENEditorWidget extends Canvas { vBar.setSelection(0); topLineOffset = 0; } - } - else if(height<getBounds().height){ - vBar.setVisible(false); + } else if (height < getBounds().height) { + if (vBar != null) { + vBar.setVisible(false); + } } // update the horizontal scrollbar @@ -657,17 +658,18 @@ public class ATHENEditorWidget extends Canvas { // offscreen rendering Image imOff = null; - if(useWrap){ - //if we use wrap, the image needs to be of the size as the clientarea + if (useWrap) { + // if we use wrap, the image needs to be of the size as the + // clientarea imOff = new Image(Display.getCurrent(), getClientArea()); + } else { + // if we do not use wrap, we render the whole width!! + imOff = new Image(Display.getCurrent(), + new Rectangle(getBounds().x, getBounds().y, + (hBar == null) ? getClientArea().width : hBar.getMaximum() + getClientArea().width, + getClientArea().height)); } - else{ - //if we do not use wrap, we render the whole width!! - imOff = new Image(Display.getCurrent(), new Rectangle(getBounds().x, getBounds().y, - (hBar == null) ? getClientArea().width : hBar.getMaximum() + getClientArea().width, - getClientArea().height)); - } - + GC gcOff = new GC(imOff); gcOff.setFont(getFont()); @@ -687,7 +689,7 @@ public class ATHENEditorWidget extends Canvas { // create a snippet from the image - this can easily be sped up by // saving the last image and only recreating it if something was // clicked - //TODO please verify if this stretches the image at some point + // TODO please verify if this stretches the image at some point gc.drawImage(imOff, Math.min(leftMostPosition, imOff.getBounds().width - getClientArea().width), 0, getClientArea().width, imOff.getBounds().height, 0, 0, getClientArea().width, getClientArea().height); @@ -1068,30 +1070,30 @@ public class ATHENEditorWidget extends Canvas { } - //sometimes, when the line is extremely long the result of the gc is not correct! - //see Bug 517015 - //https://bugs.eclipse.org/bugs/show_bug.cgi?id=517015 + // sometimes, when the line is extremely long the result of the gc is not + // correct! + // see Bug 517015 + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=517015 private Point measureLineWidthInPixel(GC gc, String prelimLine) { - - //if the line is too long, this seems to fail - if(prelimLine.length()<10000){ + + // if the line is too long, this seems to fail + if (prelimLine.length() < 10000) { return gc.textExtent(prelimLine); } - - //if it is longer we need to measure it in steps + + // if it is longer we need to measure it in steps Point maxBounds = new Point(0, 0); - for(int i=0;i<prelimLine.length();i+=10000){ + for (int i = 0; i < prelimLine.length(); i += 10000) { String snippet = prelimLine.substring(i, Math.min(prelimLine.length(), i + 10000)); - - //measure the snippet + + // measure the snippet Point textExtent = gc.textExtent(snippet); - - //update the bouds - maxBounds.y=Math.max(textExtent.y, maxBounds.y); - maxBounds.x+=textExtent.x; + + // update the bouds + maxBounds.y = Math.max(textExtent.y, maxBounds.y); + maxBounds.x += textExtent.x; } - - + return maxBounds; } @@ -1149,7 +1151,7 @@ public class ATHENEditorWidget extends Canvas { setSelection(new Point(from, from + length)); } - //TODO this should be private + // TODO this should be private public void setSelection(Point point) { this.selection = point; @@ -1424,16 +1426,16 @@ public class ATHENEditorWidget extends Canvas { public List<EditorLine> getEditorLines() { return editorLines; } - + @Override - public void layout () { + public void layout() { super.layout(); - + drawWidget(); } - + @Override - public void update(){ + public void update() { super.update(); drawWidget(); } diff --git a/de.uniwue.mk.athen/bundles/de.uniwue.mk.kall.athen.part.editor/src/de/uniwue/mk/kall/athen/part/editor/subordinate/AEditorSubordinateViewPart.java b/de.uniwue.mk.athen/bundles/de.uniwue.mk.kall.athen.part.editor/src/de/uniwue/mk/kall/athen/part/editor/subordinate/AEditorSubordinateViewPart.java index 59513ee6..f112d904 100644 --- a/de.uniwue.mk.athen/bundles/de.uniwue.mk.kall.athen.part.editor/src/de/uniwue/mk/kall/athen/part/editor/subordinate/AEditorSubordinateViewPart.java +++ b/de.uniwue.mk.athen/bundles/de.uniwue.mk.kall.athen.part.editor/src/de/uniwue/mk/kall/athen/part/editor/subordinate/AEditorSubordinateViewPart.java @@ -414,7 +414,6 @@ public abstract class AEditorSubordinateViewPart implements IPerspectiveDecouple } public void onEditorStyleChanged(Event arg0) { - // TODO Auto-generated method stub } diff --git a/de.uniwue.mk.athen/bundles/de.uniwue.mk.kall.coreferenceview/src/de/uniwue/mk/kall/coreferenceview/ui/html/CorefViewParameterlessFunction.java b/de.uniwue.mk.athen/bundles/de.uniwue.mk.kall.coreferenceview/src/de/uniwue/mk/kall/coreferenceview/ui/html/CorefViewParameterlessFunction.java index 26fb6d46..a1e2724f 100644 --- a/de.uniwue.mk.athen/bundles/de.uniwue.mk.kall.coreferenceview/src/de/uniwue/mk/kall/coreferenceview/ui/html/CorefViewParameterlessFunction.java +++ b/de.uniwue.mk.athen/bundles/de.uniwue.mk.kall.coreferenceview/src/de/uniwue/mk/kall/coreferenceview/ui/html/CorefViewParameterlessFunction.java @@ -14,7 +14,6 @@ public class CorefViewParameterlessFunction extends BrowserFunction { super(browser, name); this.runnable = r; this.functionName = name; - System.out.println(name); } public Object function(Object[] args) { -- GitLab