diff --git a/AlgebraicDataflowArchitectureModel/src/application/editor/Editor.java b/AlgebraicDataflowArchitectureModel/src/application/editor/Editor.java index cb7692b..c81b30b 100644 --- a/AlgebraicDataflowArchitectureModel/src/application/editor/Editor.java +++ b/AlgebraicDataflowArchitectureModel/src/application/editor/Editor.java @@ -501,21 +501,26 @@ public ResourcePath addResourcePath(ResourcePath parentPath, String resName) { ResourcePath resourcePath = null; - if (resName.startsWith(Parser.LEFT_CURLY_BRACKET) && resName.endsWith(Parser.RIGHT_CURLY_BRACKET)) { - TokenStream stream = new Parser.TokenStream(); - Parser parser = new Parser(stream); - stream.addLine(resName.substring(1, resName.length() - 1)); - try { - Expression exp = parser.parseTerm(stream, getModel()); - resourcePath = new ResourcePath(parentPath, exp); - getModel().addResourcePath(resourcePath); - } catch (ExpectedRightBracket e) { - e.printStackTrace(); - return null; - } - } else { - resourcePath = new ResourcePath(parentPath, resName); + if (parentPath == null) { + resourcePath = new ResourcePath(resName); getModel().addResourcePath(resourcePath); + } else { + if (resName.startsWith(Parser.LEFT_CURLY_BRACKET) && resName.endsWith(Parser.RIGHT_CURLY_BRACKET)) { + TokenStream stream = new Parser.TokenStream(); + Parser parser = new Parser(stream); + stream.addLine(resName.substring(1, resName.length() - 1)); + try { + Expression exp = parser.parseTerm(stream, getModel()); + resourcePath = new ResourcePath(parentPath, exp); + getModel().addResourcePath(resourcePath); + } catch (ExpectedRightBracket e) { + e.printStackTrace(); + return null; + } + } else { + resourcePath = new ResourcePath(parentPath, resName); + getModel().addResourcePath(resourcePath); + } } resetDataFlowGraph(); graph.getModel().beginUpdate();