From 97038fa8979729e9e994ac2d6347c10ce8e20b3d Mon Sep 17 00:00:00 2001 From: Lukas Ladenberger <lukas.ladenberger@googlemail.com> Date: Tue, 11 Dec 2012 14:39:47 +0100 Subject: [PATCH] applied find bugs --- .../gef/editor/figure/SignalFigure.java | 1 - .../gef/editor/model/Visualization.java | 4 +- .../gef/editor/observer/TableObserver.java | 53 +++++++++---------- 3 files changed, 28 insertions(+), 30 deletions(-) diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/figure/SignalFigure.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/figure/SignalFigure.java index 7e5752eb..052554a5 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/figure/SignalFigure.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/figure/SignalFigure.java @@ -84,7 +84,6 @@ public class SignalFigure extends AbstractBMotionFigure { p1.y = p1.y + 4; p2.y = p2.y + 8; - p3.y = p3.y; arrow.addPoint(p1); arrow.addPoint(p2); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/Visualization.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/Visualization.java index 11fa44fc..25c7b759 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/Visualization.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/Visualization.java @@ -172,11 +172,11 @@ public class Visualization extends BControl { return control; } for (BConnection c : control.getSourceConnections()) { - if (c.getIcon().equals(ID)) + if (c.getID().equals(ID)) return c; } for (BConnection c : control.getTargetConnections()) { - if (c.getIcon().equals(ID)) + if (c.getID().equals(ID)) return c; } if (control.getChildrenArray().size() > 0) { diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/TableObserver.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/TableObserver.java index 2e33d00a..889da54b 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/TableObserver.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/TableObserver.java @@ -101,34 +101,33 @@ public class TableObserver extends Observer { String content = rows.get(i - numberOfOldRows); - if (content != null && content.length() > 0) + if (content != null && content.length() > 0) { content = UnicodeTranslator.toAscii(content); - - content = content.replaceAll("^\\(", ""); - content = content.replaceAll("\\)$", ""); - - List<String> columns = split2(content, '#'); - int numberOfNewColumns = columns.size(); - - // Set only one time the number of columns! - if (!setColumns) { - int ncolumns = numberOfNewColumns; - if (numberOfOldColumns > numberOfNewColumns) - ncolumns = numberOfOldColumns; - control.setAttributeValue( - AttributeConstants.ATTRIBUTE_COLUMNS, ncolumns, - true, false); - setColumns = true; - } - - for (int z = 0; z < numberOfNewColumns; z++) { - String val = columns.get(z); - BControl column = control.getChildrenArray().get(z); - BControl cell = column.getChildrenArray().get(i); - if (val != null && val.length() > 0) - val = UnicodeTranslator.toUnicode(val); - cell.setAttributeValue(AttributeConstants.ATTRIBUTE_TEXT, - val); + content = content.replaceAll("^\\(", ""); + content = content.replaceAll("\\)$", ""); + List<String> columns = split2(content, '#'); + int numberOfNewColumns = columns.size(); + + // Set only one time the number of columns! + if (!setColumns) { + int ncolumns = numberOfNewColumns; + if (numberOfOldColumns > numberOfNewColumns) + ncolumns = numberOfOldColumns; + control.setAttributeValue( + AttributeConstants.ATTRIBUTE_COLUMNS, ncolumns, + true, false); + setColumns = true; + } + + for (int z = 0; z < numberOfNewColumns; z++) { + String val = columns.get(z); + BControl column = control.getChildrenArray().get(z); + BControl cell = column.getChildrenArray().get(i); + if (val != null && val.length() > 0) + val = UnicodeTranslator.toUnicode(val); + cell.setAttributeValue( + AttributeConstants.ATTRIBUTE_TEXT, val); + } } } -- GitLab