From de4bbe448ee6c4950e6062ae427f8724b0e4411f Mon Sep 17 00:00:00 2001 From: hneemann Date: Fri, 2 Jun 2017 13:32:52 +0200 Subject: [PATCH] fixed an missing shape issue Added some more error details in case of importing errors. --- distribution/ReleaseNotes.txt | 14 +++++++------- .../neemann/digital/draw/library/LibraryNode.java | 2 +- .../neemann/digital/draw/shapes/MissingShape.java | 13 +++++++++---- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/distribution/ReleaseNotes.txt b/distribution/ReleaseNotes.txt index 791870699..5bcae30e1 100644 --- a/distribution/ReleaseNotes.txt +++ b/distribution/ReleaseNotes.txt @@ -1,18 +1,18 @@ Release Notes Planned as v0.12 -- Added a locked mode, which avoids the unwanted modification of the circuit. -- Better support for high dpi screens. -- Added a pin number attribute to inputs and outputs. -- Added DIL packages to allow more "physical" circuits. See examples/74xx. - Up to now only a view 74xx circuits are available. -- Add some functions to make it easier to create 74xx circuits. - Added undo/redo functions. - New wire drawing mode: If a wire is added it is rectangular by default. In rectangular mode "F" flips the wire and pressing "D" switches to diagonal mode. - Added inverted inputs for basic gates and flip-flops. +- Added a locked mode, which avoids the unwanted modification of the circuit. +- Better support for high dpi screens. +- Added DIL packages to allow more "physical" circuits. See examples/74xx. + Up to now only a view 74xx circuits are available. +- Added a pin number attribute to inputs and outputs. +- Add some functions to make it easier to create 74xx circuits. - Lots of small usability improvements. -- Added a list of keyboard shortcuts to the documentation +- Added a list of keyboard shortcuts to the documentation. v0.11.1, released on 02. May 2017 - Added the possibility to open a circuit from the command line. diff --git a/src/main/java/de/neemann/digital/draw/library/LibraryNode.java b/src/main/java/de/neemann/digital/draw/library/LibraryNode.java index fe222ae7b..ced1e1751 100644 --- a/src/main/java/de/neemann/digital/draw/library/LibraryNode.java +++ b/src/main/java/de/neemann/digital/draw/library/LibraryNode.java @@ -150,7 +150,7 @@ public class LibraryNode implements Iterable { public ElementTypeDescription getDescription() throws IOException { if (description == null) { if (!unique) - throw new IOException(Lang.get("err_file_N0_ExistsTwiceBelow_N1", file, library.getRootFilePath())); + throw new IOException(Lang.get("err_file_N0_ExistsTwiceBelow_N1", file.getName(), library.getRootFilePath())); try { description = library.importElement(file); } catch (IOException e) { diff --git a/src/main/java/de/neemann/digital/draw/shapes/MissingShape.java b/src/main/java/de/neemann/digital/draw/shapes/MissingShape.java index 6825a45eb..f623fecc3 100644 --- a/src/main/java/de/neemann/digital/draw/shapes/MissingShape.java +++ b/src/main/java/de/neemann/digital/draw/shapes/MissingShape.java @@ -17,7 +17,7 @@ import de.neemann.digital.lang.Lang; public class MissingShape implements Shape { private final Pins pins = new Pins(); - private final String cause; + private final Exception cause; private final String message; /** @@ -28,7 +28,7 @@ public class MissingShape implements Shape { */ public MissingShape(String elementName, Exception cause) { this.message = Lang.get("msg_missingShape_N", elementName); - this.cause = cause.getMessage(); + this.cause = cause; } @Override @@ -45,7 +45,12 @@ public class MissingShape implements Shape { public void drawTo(Graphic graphic, Style highLight) { Style style = Style.NORMAL_TEXT; graphic.drawText(new Vector(4, 4), new Vector(5, 4), message, Orientation.LEFTTOP, style); - if (cause != null && cause.length() > 0) - graphic.drawText(new Vector(4, 4 + style.getFontSize()), new Vector(5, 4 + style.getFontSize()), cause, Orientation.LEFTTOP, style); + Throwable c = cause; + int y = 4; + while (c != null) { + y += style.getFontSize(); + graphic.drawText(new Vector(4, y), new Vector(5, y), c.getMessage(), Orientation.LEFTTOP, style); + c = c.getCause(); + } } }