diff --git a/src/sdtranslator/SDTranslator.java b/src/sdtranslator/SDTranslator.java index 4c43d3775473bdfe5dc743f10cceb8e8102971e0..638205d84bf4089b1ff7ecab1f8ae8e3b8faa219 100755 --- a/src/sdtranslator/SDTranslator.java +++ b/src/sdtranslator/SDTranslator.java @@ -842,8 +842,8 @@ public class SDTranslator { } } if (!expIsUsed) { - //bt.removeExp(); - throw new SDTranslationException("Error on timers (error #3)"); + // bt.removeExp(); + //throw new SDTranslationException("Error on timers: expiration is never used (error #3)"); } if (!resetIsUsed) { //System.out.println("\n\n\nReset is not used\n\n\n"); diff --git a/src/tmltranslator/TMLSyntaxChecking.java b/src/tmltranslator/TMLSyntaxChecking.java index 43efb11c647f1edecc5ba402c568aa23ac25d913..5909751d375c5741ce776e21fab0cc6a9d1ff888 100755 --- a/src/tmltranslator/TMLSyntaxChecking.java +++ b/src/tmltranslator/TMLSyntaxChecking.java @@ -140,8 +140,12 @@ public class TMLSyntaxChecking { if (elt instanceof TMLWriteChannel) { for(int j=0; j<((TMLWriteChannel)elt).getNbOfChannels(); j++) { ch = ((TMLWriteChannel)elt).getChannel(j); - //System.out.println("Write channel"); + //System.out.println("Write in channel" + ch.getName()); if (ch.getOriginTask() != t) { + //System.out.println("Origin task=" + ch.getOriginTask().getName() + " / task = " + t.getName() + "tch=" + ch.getOriginTask() + " t=" + t); + //System.out.println("tml:" + tmlm.toString()); + TMLTextSpecification tmlt = new TMLTextSpecification("toto"); + //System.out.println("tml:" + tmlt.toTextFormat(tmlm)); addError(t, elt, ch.getName() + ": " + WRONG_ORIGIN_CHANNEL, TMLError.ERROR_BEHAVIOR); } } diff --git a/src/translator/RTLOTOSKeyword.java b/src/translator/RTLOTOSKeyword.java index 00d9877cc976bdc442902527b05d46afaa534d09..b77f4af4a80cc6a445626a2394f2444b371b4257 100755 --- a/src/translator/RTLOTOSKeyword.java +++ b/src/translator/RTLOTOSKeyword.java @@ -46,7 +46,7 @@ knowledge of the CeCILL license and that you accept its terms. package translator; public class RTLOTOSKeyword { - private final static String [] words = {"specification", "endspec", "process", "endproc", "exit", "noexit", "behaviour", "where", "hide", "in", "stop", "delay", "latency", "type", "is", "endtype", "library", "endlib", "sorts", "opns", "eqns", "let", "i", "inf", "min", "max", "true", "false", "div", "mod", "divs", "nat", "natural", "boolean", "not", "and", "or", "Clock", "clock"}; + private final static String [] words = {"specification", "endspec", "process", "endproc", "exit", "noexit", "behaviour", "where", "hide", "in", "stop", "delay", "latency", "type", "is", "endtype", "library", "endlib", "sorts", "opns", "eqns", "let", "i", "inf", "min", "max", "true", "false", "div", "mod", "divs", "nat", "natural", "boolean", "not", "and", "or", "Clock", "clock", "time", "Time"}; public static boolean isAKeyword(String s) { for(int i=0; i<words.length; i++) { diff --git a/src/ui/AnalysisPanelTranslator.java b/src/ui/AnalysisPanelTranslator.java index 6a0fbb975ae98190eacfbb08e5c78f7e39662f83..0a05be717d29b824daa09fe4924e25c74e343ca0 100755 --- a/src/ui/AnalysisPanelTranslator.java +++ b/src/ui/AnalysisPanelTranslator.java @@ -488,7 +488,7 @@ public class AnalysisPanelTranslator { if (tgc instanceof TGConnectorMessageAsyncSD) { if (!((TGConnectorMessageAsyncSD)(tgc)).isMessageWellFormed()) { - throw new AnalysisSyntaxException("Badly formatted synchronous exchange:" + ((TGConnectorMessageSyncSD)(tgc)).getMessage() +" in instance "+ sdi1.getInstanceName() + " in sequence diagram " + sdp.getName()); + throw new AnalysisSyntaxException("Badly formatted asynchronous exchange:" + ((TGConnectorMessageAsyncSD)(tgc)).getMessage() +" in instance "+ sdi1.getInstanceName() + " in sequence diagram " + sdp.getName()); } evt1 = new Evt(Evt.SEND_MSG, ((TGConnectorMessageAsyncSD)(tgc)).getFirstPartMessage() + "__" + ins1.getName() + "_to_" + ins2.getName() + ((TGConnectorMessageAsyncSD)(tgc)).getSecondPartMessage(), ins1); diff --git a/src/ui/ColorManager.java b/src/ui/ColorManager.java index 31372ff230f559540d25e00bcfe369850bfa6ddb..0b71001fe73ebeb6925ce1d969da8deba04a68d3 100755 --- a/src/ui/ColorManager.java +++ b/src/ui/ColorManager.java @@ -123,6 +123,7 @@ public class ColorManager { public static final Color ATD_BLOCK = new Color(196, 232, 195); public static final Color ATD_ATTACK = new Color(214, 187, 158); + public static final Color ATD_ROOT_ATTACK = new Color(243, 131, 10); public static final Color ATD_CONSTRAINT = new Color(191, 153, 161); public static final Color DIAGRAM_BACKGROUND = Color.white; diff --git a/src/ui/GTMLModeling.java b/src/ui/GTMLModeling.java index 0b52252a7126b168d6ec7eb0a7de67b85de9b1c3..c2c9a80b2b08dcee4513cfccb32fa44b075c56a8 100755 --- a/src/ui/GTMLModeling.java +++ b/src/ui/GTMLModeling.java @@ -227,6 +227,16 @@ public class GTMLModeling { checkingErrors.add(ce); throw new MalformedTMLDesignException(tmlto.getValue() + " msg"); } + + if (tmlm.getTMLTaskByName(tmlto.getValue()) != null) { + String msg = "Two tasks have the same name: " + tmlto.getValue() + " (mapping problem?)"; + CheckingError ce = new CheckingError(CheckingError.STRUCTURE_ERROR, msg); + ce.setTDiagramPanel(tmldp.tmltdp); + ce.setTGComponent(tgc); + checkingErrors.add(ce); + throw new MalformedTMLDesignException(tmlto.getValue() + " msg"); + } + tmlt = new TMLTask(tmlto.getValue(), tmlto, tmladp); listE.addCor(tmlt, tgc); tmlm.addTask(tmlt); @@ -256,8 +266,16 @@ public class GTMLModeling { checkingErrors.add(ce); throw new MalformedTMLDesignException(tmlcpc.getValue() + " msg"); } + if (tmlm.getTMLTaskByName(tmlcpc.getValue()) != null) { + String msg = "Two components have the same name: " + tmlcpc.getValue() + " (mapping problem?)"; + CheckingError ce = new CheckingError(CheckingError.STRUCTURE_ERROR, msg); + ce.setTDiagramPanel(tmlcdp.tmlctdp); + ce.setTGComponent(tgc); + checkingErrors.add(ce); + throw new MalformedTMLDesignException(tmlcpc.getValue() + " msg"); + } tmlt = new TMLTask(tmlcpc.getValue(), tmlcpc, tmladp); - System.out.println("Task added:" + tmlcpc.getValue()); + //System.out.println("Task added:" + tmlcpc.getValue()); listE.addCor(tmlt, tgc); tmlm.addTask(tmlt); tmlt.setExit(false); diff --git a/src/ui/atd/ATDAttack.java b/src/ui/atd/ATDAttack.java index a62336c4dc7a57e55dc97838b24f57edb97588bd..5552cbe1da8dfb6f997b23c49d640788e4129704 100755 --- a/src/ui/atd/ATDAttack.java +++ b/src/ui/atd/ATDAttack.java @@ -64,6 +64,8 @@ public class ATDAttack extends TGCScalableWithInternalComponent implements Swall protected String oldValue = ""; protected String description = ""; private String stereotype = "attack"; + private String rootStereotype = "root attack"; + private boolean isRootAttack = false; private int maxFontSize = 12; private int minFontSize = 4; @@ -109,7 +111,12 @@ public class ATDAttack extends TGCScalableWithInternalComponent implements Swall } public void internalDrawing(Graphics g) { - String ster = "<<" + stereotype + ">>"; + String ster; + if (isRootAttack) { + ster = "<<" + rootStereotype + ">>"; + } else { + ster = "<<" + stereotype + ">>"; + } Font f = g.getFont(); Font fold = f; @@ -160,7 +167,11 @@ public class ATDAttack extends TGCScalableWithInternalComponent implements Swall Color c = g.getColor(); g.draw3DRect(x, y, width, height, true); - g.setColor(ColorManager.ATD_ATTACK); + if (isRootAttack) { + g.setColor(ColorManager.ATD_ROOT_ATTACK); + } else { + g.setColor(ColorManager.ATD_ATTACK); + } g.fill3DRect(x+1, y+1, width-1, height-1, true); g.setColor(c); @@ -265,6 +276,8 @@ public class ATDAttack extends TGCScalableWithInternalComponent implements Swall if (dialog.getDescription() != null) { description = dialog.getDescription(); } + + isRootAttack = dialog.isRootAttack(); if (error) { JOptionPane.showMessageDialog(frame, @@ -291,6 +304,7 @@ public class ATDAttack extends TGCScalableWithInternalComponent implements Swall protected String translateExtraParam() { StringBuffer sb = new StringBuffer("<extraparam>\n"); sb.append("<info description=\"" + description); + sb.append("\" root=\"" +isRootAttack); sb.append("\" />\n"); sb.append("</extraparam>\n"); return new String(sb); @@ -306,6 +320,7 @@ public class ATDAttack extends TGCScalableWithInternalComponent implements Swall int t1id; String sdescription = null; String prio; + String isRoot = null; for(int i=0; i<nl.getLength(); i++) { n1 = nl.item(i); @@ -319,9 +334,17 @@ public class ATDAttack extends TGCScalableWithInternalComponent implements Swall elt = (Element) n2; if (elt.getTagName().equals("info")) { sdescription = elt.getAttribute("description"); + isRoot = elt.getAttribute("root"); } if (sdescription != null) { description = sdescription; + } + if (isRoot != null) { + if (isRoot.toUpperCase().compareTo("TRUE") == 0) { + isRootAttack = true; + } else { + isRootAttack = false; + } } } } @@ -351,6 +374,10 @@ public class ATDAttack extends TGCScalableWithInternalComponent implements Swall s += "Id=" + getId(); return s; } + + public boolean isRootAttack() { + return isRootAttack; + } diff --git a/src/ui/atd/ATDAttackConnector.java b/src/ui/atd/ATDAttackConnector.java index a5fde0b6009b815da8146982a1e10d403b80c389..9f7289bc8fede0da795a4a8a2fc3b5cfdf2bb2cb 100755 --- a/src/ui/atd/ATDAttackConnector.java +++ b/src/ui/atd/ATDAttackConnector.java @@ -89,11 +89,19 @@ public class ATDAttackConnector extends TGConnector implements ScalableTGCompon g.fillRect(p1.getX()-(cz/2), p1.getY()-(cz/2), cz, cz); Point p = GraphicLib.intersectionRectangleSegment(x2-(cz/2), y2-(cz/2), cz, cz, x1, y1, x2, y2); + if (p == null) { + //System.out.println("null point"); + } else { if (Point2D.distance(x1, y1, p.x, p.y) < GraphicLib.longueur * 1.5) { - g.drawLine(x1, y1, p.x, p.y); + //System.out.println("p.x=" + p.x + " x1=" + x1 + "p.y=" + p.y + " y1=" + y1); + if ((p.x != x1) || (p.y != y1)) { + g.drawLine(x1, y1, p.x, p.y); + //System.out.println("drawn"); + } } else { GraphicLib.arrowWithLine(g, 1, 0, 10, x1, y1, p.x, p.y, true); } + } if (value.length() > 0) { Font f = g.getFont(); diff --git a/src/ui/window/JDialogAttack.java b/src/ui/window/JDialogAttack.java index 9b36c1b1182cd6762669ead993759888d2b11fae..536a613107d3366580d63bbfc92dc57d14dca8ed 100755 --- a/src/ui/window/JDialogAttack.java +++ b/src/ui/window/JDialogAttack.java @@ -66,6 +66,7 @@ public class JDialogAttack extends javax.swing.JDialog implements ActionListener //protected JTextField taskName; protected JTextField name, description; + protected JCheckBox isRootAttack; // Main Panel private JButton closeButton; @@ -111,6 +112,12 @@ public class JDialogAttack extends javax.swing.JDialog implements ActionListener c1.gridheight = 1; c1.weighty = 1.0; c1.weightx = 1.0; + c1.gridwidth = GridBagConstraints.REMAINDER; //end row + isRootAttack = new JCheckBox("root attack"); + isRootAttack.setSelected(attack.isRootAttack()); + panel2.add(isRootAttack, c1); + + c1.gridwidth = 1; c1.fill = GridBagConstraints.HORIZONTAL; panel2.add(new JLabel("Name:"), c2); c1.gridwidth = GridBagConstraints.REMAINDER; //end row @@ -176,6 +183,10 @@ public class JDialogAttack extends javax.swing.JDialog implements ActionListener return name.getText(); } + public boolean isRootAttack() { + return isRootAttack.isSelected(); + } + }