mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-28 15:32:40 -04:00
more meaningful error messages
This commit is contained in:
parent
9b4a9eedef
commit
65f14ca0db
@ -263,7 +263,7 @@ public class ElementLibrary implements Iterable<ElementLibrary.ElementContainer>
|
||||
if (node != null)
|
||||
return node.getDescription();
|
||||
} catch (IOException e) {
|
||||
throw new ElementNotFoundException(Lang.get("msg_errorImportingModel"), e);
|
||||
throw new ElementNotFoundException(Lang.get("msg_errorImportingModel_N0", elementName), e);
|
||||
}
|
||||
|
||||
throw new ElementNotFoundException(Lang.get("err_element_N_notFound", elementName));
|
||||
@ -436,7 +436,7 @@ public class ElementLibrary implements Iterable<ElementLibrary.ElementContainer>
|
||||
}
|
||||
return description;
|
||||
} catch (PinException e) {
|
||||
throw new IOException(Lang.get("msg_errorImportingModel"), e);
|
||||
throw new IOException(Lang.get("msg_errorImportingModel_N0", file), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,7 @@ public class LibraryNode implements Iterable<LibraryNode> {
|
||||
private ElementLibrary library;
|
||||
private LibraryNode parent;
|
||||
private boolean unique;
|
||||
private boolean descriptionImportError = false;
|
||||
|
||||
/**
|
||||
* Creates a new node with the given name.
|
||||
@ -126,8 +127,12 @@ public class LibraryNode implements Iterable<LibraryNode> {
|
||||
if (description == null) {
|
||||
if (!unique)
|
||||
throw new IOException(Lang.get("err_file_N0_ExistsTwiceBelow_N1", file, library.getRootFilePath()));
|
||||
|
||||
description = library.importElement(file);
|
||||
try {
|
||||
description = library.importElement(file);
|
||||
} catch (IOException e) {
|
||||
descriptionImportError = true;
|
||||
throw e;
|
||||
}
|
||||
library.fireLibraryChanged(this);
|
||||
}
|
||||
return description;
|
||||
@ -217,6 +222,9 @@ public class LibraryNode implements Iterable<LibraryNode> {
|
||||
* @throws IOException IOException
|
||||
*/
|
||||
public Icon getIcon(ShapeFactory shapeFactory) throws IOException {
|
||||
if (descriptionImportError)
|
||||
return ICON_NOT_UNIQUE;
|
||||
|
||||
getDescription();
|
||||
return getIconOrNull(shapeFactory);
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ public final class InsertAction extends ToolTipAction {
|
||||
node.getDescription();
|
||||
setIcon(node.getIcon(shapeFactory));
|
||||
} catch (IOException ex) {
|
||||
SwingUtilities.invokeLater(new ErrorMessage(Lang.get("msg_errorImportingModel")).addCause(ex));
|
||||
SwingUtilities.invokeLater(new ErrorMessage(Lang.get("msg_errorImportingModel_N0", node.getName())).addCause(ex));
|
||||
}
|
||||
}
|
||||
insertHistory.add(this);
|
||||
@ -80,7 +80,7 @@ public final class InsertAction extends ToolTipAction {
|
||||
final Icon icon = node.getIcon(shapeFactory);
|
||||
setIcon(icon);
|
||||
} catch (IOException ex) {
|
||||
SwingUtilities.invokeLater(new ErrorMessage(Lang.get("msg_errorImportingModel")).addCause(ex));
|
||||
SwingUtilities.invokeLater(new ErrorMessage(Lang.get("msg_errorImportingModel_N0", node.getName())).addCause(ex));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ public class LibrarySelector implements LibraryListener {
|
||||
try {
|
||||
library.updateEntries();
|
||||
} catch (IOException ex) {
|
||||
SwingUtilities.invokeLater(new ErrorMessage(Lang.get("msg_errorImportingModel")).addCause(ex));
|
||||
SwingUtilities.invokeLater(new ErrorMessage(Lang.get("msg_errorUpdatingLibrary")).addCause(ex));
|
||||
}
|
||||
}
|
||||
}.setToolTip(Lang.get("menu_update_tt")).createJMenuItem());
|
||||
|
@ -50,7 +50,7 @@ public class SelectTree extends JTree {
|
||||
component.setPartToInsert(new VisualElement(d.getName()).setShapeFactory(shapeFactory));
|
||||
insertHistory.add(new InsertAction(node, insertHistory, component, shapeFactory));
|
||||
} catch (IOException e) {
|
||||
SwingUtilities.invokeLater(new ErrorMessage(Lang.get("msg_errorImportingModel")).addCause(e));
|
||||
SwingUtilities.invokeLater(new ErrorMessage(Lang.get("msg_errorImportingModel_N0", node.getName())).addCause(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -711,7 +711,8 @@ Die Icons stammen aus dem Tango Desktop Project.</string>
|
||||
<string name="msg_errorCreatingModel">Fehler beim Erzeugen der Schaltung</string>
|
||||
<string name="msg_errorDuringCalculation">Fehler während der Vereinfachung.</string>
|
||||
<string name="msg_errorEditingValue">Fehler bei der Eingabe eines Wertes</string>
|
||||
<string name="msg_errorImportingModel">Fehler beim Import einer Schaltung</string>
|
||||
<string name="msg_errorImportingModel_N0">Fehler beim Import der Schaltung {0}.</string>
|
||||
<string name="msg_errorUpdatingLibrary">Fehler beim Aktualisieren der Bauteile-Bibliothek!</string>
|
||||
<string name="msg_errorReadingFile">Fehler beim Lesen einer Datei</string>
|
||||
<string name="msg_remoteUnknownCommand">Das Kommando {0} ist unbekannt!</string>
|
||||
<string name="msg_errorWritingFile">Fehler beim Schreiben einer Datei</string>
|
||||
|
@ -698,7 +698,8 @@ The icons are taken from the Tango Desktop Project.</string>
|
||||
<string name="msg_errorCreatingModel">Error creating the circuit</string>
|
||||
<string name="msg_errorDuringCalculation">Error during simplification</string>
|
||||
<string name="msg_errorEditingValue">Error editing a atribute value</string>
|
||||
<string name="msg_errorImportingModel">Error importing a circuit</string>
|
||||
<string name="msg_errorImportingModel_N0">Error importing the circuit {0}!</string>
|
||||
<string name="msg_errorUpdatingLibrary">Error updating the component library!!</string>
|
||||
<string name="msg_errorReadingFile">Error reading a file</string>
|
||||
<string name="msg_errorWritingFile">Error writing a file</string>
|
||||
<string name="msg_fastRunError">Error at fast run</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user