diff --git a/executablecode/Makefile.src b/executablecode/Makefile.src index 1a5aafcafa7abcf094ea1b3c9d8808777263ed3e..28b9acb23f0af46aef4caec4f72c265800a703d3 100755 --- a/executablecode/Makefile.src +++ b/executablecode/Makefile.src @@ -1 +1 @@ -SRCS = generated_src/main.c generated_src/ObserverProp1.c generated_src/RemotelyControlledMicrowave.c generated_src/MicroWaveOven.c generated_src/WirelessInterface.c generated_src/Door.c generated_src/Magnetron.c generated_src/Controller.c generated_src/ControlPanel.c generated_src/Bell.c generated_src/RemoteControl.c \ No newline at end of file +SRCS = generated_src/main.c generated_src/ObserverProp1.c generated_src/RemotelyControlledMicrowave.c generated_src/RemoteControl.c generated_src/MicroWaveOven.c generated_src/Bell.c generated_src/ControlPanel.c generated_src/Controller.c generated_src/Magnetron.c generated_src/Door.c generated_src/WirelessInterface.c \ No newline at end of file diff --git a/modeling/MicroWaveOven_SafetySecurity_testCodeGeneration.xml b/modeling/MicroWaveOven_SafetySecurity_testCodeGeneration.xml index accf7f2271c8a2ce4cd8cd3d139d57532bb91c9a..be26a03d64a2a00ace25b8ac6b87f8c33fcb8e64 100644 --- a/modeling/MicroWaveOven_SafetySecurity_testCodeGeneration.xml +++ b/modeling/MicroWaveOven_SafetySecurity_testCodeGeneration.xml @@ -6167,7 +6167,7 @@ or by a maintenance station <AutomaticDrawing data="true" /> </CONNECTOR><SUBCOMPONENT type="-1" id="2972" > <father id="2974" num="0" /> -<cdparam x="407" y="190" /> +<cdparam x="412" y="172" /> <sizeparam width="59" height="15" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <hidden value="false" /> <cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" /> @@ -8610,7 +8610,7 @@ or by a maintenance station <cdparam x="516" y="268" /> <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="1000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> <infoparam name="connector from List of all parameters of an Avatar SMD transition to UML Note" value="null" /> -<P1 x="531" y="264" id="4090" /> +<P1 x="531" y="250" id="4090" /> <P2 x="607" y="233" id="4098" /> <AutomaticDrawing data="false" /> </CONNECTOR> diff --git a/src/avatartranslator/directsimulation/AvatarSimulationTransaction.java b/src/avatartranslator/directsimulation/AvatarSimulationTransaction.java index dee6cdcc8aee671bcbd483f12032c77a144e1830..1168ee203340dfb4f2c648827fa29a3c1c62a67a 100644 --- a/src/avatartranslator/directsimulation/AvatarSimulationTransaction.java +++ b/src/avatartranslator/directsimulation/AvatarSimulationTransaction.java @@ -55,6 +55,7 @@ import myutil.*; public class AvatarSimulationTransaction { public static long ID; + public static Hashtable<AvatarStateMachineElement, Integer> hashOfAllElements; public static LinkedList<AvatarStateMachineElement> allExecutedElements; public AvatarBlock block; @@ -96,12 +97,21 @@ public class AvatarSimulationTransaction { public static void reinit() { ID = 0; allExecutedElements = new LinkedList<AvatarStateMachineElement>(); + hashOfAllElements = new Hashtable<AvatarStateMachineElement, Integer>(); } public static void addExecutedElement(AvatarStateMachineElement _asme) { if (!allExecutedElements.contains(_asme)) { allExecutedElements.add(_asme); } + + Integer val = hashOfAllElements.get(_asme); + if (val == null) { + hashOfAllElements.put(_asme, new Integer(1)); + } else { + hashOfAllElements.put(_asme, new Integer(1+val.intValue())); + } + } public static synchronized long setID() { diff --git a/src/ui/AvatarDesignPanel.java b/src/ui/AvatarDesignPanel.java index f98013e42760c3ac5215a4e917b9cc8cde9b5933..6f60f7e1d799ba0926db3ae107a8207e2905e5a5 100644 --- a/src/ui/AvatarDesignPanel.java +++ b/src/ui/AvatarDesignPanel.java @@ -104,7 +104,7 @@ public class AvatarDesignPanel extends TURTLEPanel { toolBarPanel.add(jsp, BorderLayout.CENTER); panels.add(asmdp); tabbedPane.addTab(s, IconManager.imgic63, toolBarPanel, "Opens the state machine of " + s); - + //tabbedPane.setMnemonicAt(tabbedPane.getTabCount()-1, '^'); return; } @@ -131,6 +131,7 @@ public class AvatarDesignPanel extends TURTLEPanel { toolBarPanel.add(jsp, BorderLayout.CENTER); tabbedPane.addTab("AVATAR Design", IconManager.imgic80, toolBarPanel, "Opens the AVATAR Design"); tabbedPane.setSelectedIndex(0); + //tabbedPane.setMnemonicAt(tabbedPane.getTabCount()-1, '^'); //jsp.setVisible(true); @@ -172,7 +173,7 @@ public class AvatarDesignPanel extends TURTLEPanel { ListIterator iterator = ((TDiagramPanel)(panels.get(i))).getComponentList().listIterator(); while(iterator.hasNext()) { tgc = (TGComponent)(iterator.next()); - tgc.setAVATARMet(false); + tgc.setAVATARMet(0); } } diff --git a/src/ui/CheckingError.java b/src/ui/CheckingError.java index 3cc003a6e5b2e8e6b3804b491e20deddf8d2f582..937a5c51324efb91b471d50a1dac3d2837d0a468 100755 --- a/src/ui/CheckingError.java +++ b/src/ui/CheckingError.java @@ -56,6 +56,7 @@ public class CheckingError { public final static int STRUCTURE_ERROR = 0; public final static int BEHAVIOR_ERROR = 1; + public final static int INFO = 2; private int type; private String message; diff --git a/src/ui/GTURTLEModeling.java b/src/ui/GTURTLEModeling.java index be1a13de1db5b02e85cfad8f4607a0167d01b5ff..a5be47f49ac6eb93c86c3d1a1351fc5ab036251a 100755 --- a/src/ui/GTURTLEModeling.java +++ b/src/ui/GTURTLEModeling.java @@ -174,6 +174,7 @@ public class GTURTLEModeling { private int nbTPN; private ValidationDataTree vdt; + private SearchTree st; private Vector checkingErrors; private Vector warnings; @@ -224,6 +225,7 @@ public class GTURTLEModeling { invariants = new LinkedList<Invariant>(); vdt = new ValidationDataTree(mgui); + st = new SearchTree(mgui); /*if (!Charset.isSupported("UTF-8")) { ErrorGUI.exit(ErrorGUI.ERROR_CHARSET); @@ -1139,10 +1141,12 @@ public class GTURTLEModeling { } public Object getChild(int index) { - if (index < panels.size()) { + if (index < panels.size()-1) { return panels.elementAt(index); - } else { + } else if (index == panels.size()-1) { return vdt; + } else { + return st; } } @@ -5895,5 +5899,9 @@ public class GTURTLEModeling { TraceManager.addDev("the EBRDD:\n" + ebrdd.toString()); return true; } + + public void setElementsOfSearchTree(Vector<Object> elements) { + st.setElements(elements); + } } diff --git a/src/ui/JMenuBarTurtle.java b/src/ui/JMenuBarTurtle.java index 6debabba2f09353c27d578a7be0b5e15612c7bc2..daf938d917edb18204a094f990b21384195877c0 100755 --- a/src/ui/JMenuBarTurtle.java +++ b/src/ui/JMenuBarTurtle.java @@ -494,6 +494,9 @@ public class JMenuBarTurtle extends JMenuBar { menuItem.addMouseListener(mgui.mouseHandler); } + menuItem = codeG.add(mgui.actions[TGUIAction.ACT_AVATAR_EXECUTABLE_GENERATION]); + menuItem.addMouseListener(mgui.mouseHandler); + // View menuItem = view.add(mgui.actions[TGUIAction.ACT_VIEW_BIRDEYES_EMB]); menuItem.addMouseListener(mgui.mouseHandler); diff --git a/src/ui/JToolBarMainTurtle.java b/src/ui/JToolBarMainTurtle.java index 24dd2051578cf964488517c65ecfcdd687a0c66d..1c5f4b456db5dee85b9594fe95075e8818dcfa12 100755 --- a/src/ui/JToolBarMainTurtle.java +++ b/src/ui/JToolBarMainTurtle.java @@ -46,9 +46,9 @@ knowledge of the CeCILL license and that you accept its terms. package ui; import javax.swing.*; -//import javax.swing.event.*; -//import java.awt.*; -//import java.awt.event.*; +import javax.swing.event.*; +import java.awt.*; +import java.awt.event.*; import myutil.*; @@ -57,7 +57,7 @@ import myutil.*; * @author Ludovic APVRILLE * @see */ -public class JToolBarMainTurtle extends JToolBar { +public class JToolBarMainTurtle extends JToolBar implements ActionListener { // Avatar JButton avatarSimu, avatarFVUPPAAL, avatarFVProVerif, avatarFVStaticAnalysis, avatarCodeGeneration; @@ -65,9 +65,14 @@ public class JToolBarMainTurtle extends JToolBar { JButton genrtlotos, genlotos, genuppaal, gendesign; JButton checkcode, simulation, validation; JButton oneClickrtlotos, onclicklotos, gensystemc, simusystemc, gentml, genjava, nc; + + JTextField search; + + MainGUI mgui; - public JToolBarMainTurtle(MainGUI mgui) { + public JToolBarMainTurtle(MainGUI _mgui) { super(); + mgui = _mgui; buildToolBar(mgui); } @@ -253,8 +258,14 @@ public class JToolBarMainTurtle extends JToolBar { addSeparator(); } - showAvatarActions(false); + addSeparator(); + showAvatarActions(false); + search = new JTextField("", 10); + search.setEnabled(false); + add(search); + search.addActionListener(this); + } @@ -397,4 +408,20 @@ public class JToolBarMainTurtle extends JToolBar { } } + + public void actionPerformed(ActionEvent e) { + if (e.getSource() == search) { + String text = search.getText(); + TraceManager.addDev("Searching elements with" + text); + if (text.length()>0) { + search.setEnabled(false); + mgui.search(text); + search.setEnabled(true); + } + } + } + + public void activateSearch(boolean enabled) { + search.setEnabled(enabled); + } } // Class diff --git a/src/ui/MainGUI.java b/src/ui/MainGUI.java index 9c817b9513ec4215b08544fb13f891d1a3b1d9ff..0b807e200a370360845b28d6b28ad592cfdeeaf7 100755 --- a/src/ui/MainGUI.java +++ b/src/ui/MainGUI.java @@ -557,6 +557,9 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener { actions[TGUIAction.ACT_SIMU_SYSTEMC].setEnabled(true); actions[TGUIAction.ACT_VIEW_RG_DIPLODOCUS].setEnabled(ConfigurationTTool.GGraphPath != null); actions[TGUIAction.ACT_VIEW_STAT_AUTDIPLODOCUS].setEnabled(ConfigurationTTool.GGraphPath != null); + if (mainBar != null) { + mainBar.activateSearch(false); + } break; case OPENED: actions[TGUIAction.ACT_MERGE].setEnabled(true); @@ -583,6 +586,10 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener { actions[TGUIAction.ACT_GENERATE_ONTOLOGIES_CURRENT_DIAGRAM].setEnabled(true); actions[TGUIAction.ACT_GENERATE_ONTOLOGIES_CURRENT_SET_OF_DIAGRAMS].setEnabled(true); actions[TGUIAction.ACT_GENERATE_ONTOLOGIES_ALL_DIAGRAMS].setEnabled(true); + actions[TGUIAction.ACT_DELETE].setEnabled(true); + if (mainBar != null) { + mainBar.activateSearch(true); + } break; case MODEL_OK: @@ -752,13 +759,13 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener { case CUTCOPY_OK: actions[TGUIAction.ACT_CUT].setEnabled(true); actions[TGUIAction.ACT_COPY].setEnabled(true); - actions[TGUIAction.ACT_DELETE].setEnabled(true); + //actions[TGUIAction.ACT_DELETE].setEnabled(true); actions[TGUIAction.ACT_SELECTED_CAPTURE].setEnabled(true); break; case CUTCOPY_KO: actions[TGUIAction.ACT_CUT].setEnabled(false); actions[TGUIAction.ACT_COPY].setEnabled(false); - actions[TGUIAction.ACT_DELETE].setEnabled(false); + //actions[TGUIAction.ACT_DELETE].setEnabled(false); actions[TGUIAction.ACT_SELECTED_CAPTURE].setEnabled(false); break; case PASTE_OK: @@ -827,6 +834,21 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener { } } + public void search(String text) { + + Vector<Object> elements = new Vector<Object>(); + + TURTLEPanel panel; + for(int i=0; i<tabs.size(); i++) { + panel = (TURTLEPanel)(tabs.get(i)); + panel.searchForText(text.toLowerCase(), elements); + } + + gtm.setElementsOfSearchTree(elements); + //TraceManager.addDev("Found " + elements.size() + " elements"); + dtree.forceUpdate(); + } + public LinkedList<Invariant> getInvariants() { return gtm.getInvariants(); diff --git a/src/ui/TAction.java b/src/ui/TAction.java index 657336baaaf74e710aceed0c990f2f95d06c4388..256e0dbe234119923d80086f8e74ecd70902a830 100755 --- a/src/ui/TAction.java +++ b/src/ui/TAction.java @@ -68,6 +68,8 @@ public class TAction { public String SHORT_DESCRIPTION; public String LONG_DESCRIPTION; public int MNEMONIC_KEY; + public char KEY; + public boolean hasControl = false; /** * Creates a new TAction @@ -80,6 +82,20 @@ public class TAction { SHORT_DESCRIPTION = shortDescription; LONG_DESCRIPTION = longDescription; MNEMONIC_KEY = mneKey; + KEY = (char)mneKey; + hasControl = false; + } + + public TAction(String ActionCommand, String name, ImageIcon smallIcon, ImageIcon largeIcon, String shortDescription, String longDescription, int mneKey, boolean _hasControl) { + ACTION_COMMAND_KEY = ActionCommand; + NAME = name; + SMALL_ICON = smallIcon; + LARGE_ICON = largeIcon; + SHORT_DESCRIPTION = shortDescription; + LONG_DESCRIPTION = longDescription; + MNEMONIC_KEY = mneKey; + KEY = (char)mneKey; + hasControl = _hasControl; } public void setName(String name) { diff --git a/src/ui/TDiagramPanel.java b/src/ui/TDiagramPanel.java index 8577bf129c6aee7437cb2e11d13e093e4ea40684..18c0281aa8b4a9f50879fb5e4ca77b5a9d56000c 100755 --- a/src/ui/TDiagramPanel.java +++ b/src/ui/TDiagramPanel.java @@ -1918,7 +1918,14 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree { } public void makeDelete() { - removeAllSelectedComponents(); + //TraceManager.addDev("make delete"); + if (nextSelectedComponent() != null) { + removeAllSelectedComponents(); + } else if (componentPointed != null) { + removeComponent(componentPointed); + } else { + return; + } mode = NORMAL; mgui.setMode(MainGUI.CUTCOPY_KO); mgui.setMode(MainGUI.EXPORT_LIB_KO); @@ -3718,6 +3725,29 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree { tdmm.stopAddingConnector(); } } + + public void searchForText(String text, Vector<Object> elements) { + TraceManager.addDev("Searching for " + text + " in " + this); + + Iterator iterator = componentList.listIterator(); + TGComponent tgc; + String save; + + while(iterator.hasNext()) { + tgc = (TGComponent)(iterator.next()); + tgc.searchForText(text, elements); + /*save = tgc.saveInXML().toString().toLowerCase(); + if (save.indexOf(text) >= 0) { + TraceManager.addDev("Found " + tgc); + elements.add(tgc); + CheckingError ce = new CheckingError(CheckingError.INFO, tgc.toString()); + ce.setTDiagramPanel(this); + ce.setTGComponent(tgc); + elements.add(ce); + }*/ + } + + } } diff --git a/src/ui/TGComponent.java b/src/ui/TGComponent.java index ad1bbc58199fb404bc74652b853b290e1d1742c9..165d2c3d634cbe1d2711040b02235603e560ccaa 100755 --- a/src/ui/TGComponent.java +++ b/src/ui/TGComponent.java @@ -110,7 +110,7 @@ public abstract class TGComponent implements CDElement, GenericTree { // AVATAR ID private int AVATARID = -1; private boolean AVATAR_running = false; - private boolean AVATAR_met = false; + private int AVATAR_met = 0; // TEPE ID private int TEPEID = -1; @@ -636,8 +636,8 @@ public abstract class TGComponent implements CDElement, GenericTree { } - public void setAVATARMet(boolean _b) { - AVATAR_met = _b; + public void setAVATARMet(int _metNb) { + AVATAR_met = _metNb; } public void drawAVATARMet(Graphics g) { @@ -659,6 +659,8 @@ public abstract class TGComponent implements CDElement, GenericTree { g.drawLine(myx+mywidth, myy+1+dech/2, myx+mywidth + decw/3, myy+dech); g.drawLine(myx+mywidth + decw/3, myy+dech, myx+mywidth + decw, myy); + g.drawString(""+AVATAR_met, myx+mywidth + decw, myy); + } // _mode: 1 : running @@ -979,7 +981,7 @@ public abstract class TGComponent implements CDElement, GenericTree { if (tdp.AVATAR_ANIMATE_ON) { //TraceManager.addDev("Avatar animate?"); - if (AVATAR_met) { + if (AVATAR_met>0) { drawAVATARMet(g); } int ret = tdp.getMGUI().isRunningAvatarComponent(this); @@ -2656,8 +2658,11 @@ public abstract class TGComponent implements CDElement, GenericTree { // saving - public StringBuffer saveInXML() { + return saveInXML(true); + } + + public StringBuffer saveInXML(boolean saveSubComponents) { StringBuffer sb = null; boolean b = (father == null); if (b) { @@ -2690,7 +2695,10 @@ public abstract class TGComponent implements CDElement, GenericTree { } else { sb.append(XML_SUB_TAIL); } - sb.append(translateSubComponents()); + + if (saveSubComponents) { + sb.append(translateSubComponents()); + } return sb; } @@ -2907,5 +2915,17 @@ public abstract class TGComponent implements CDElement, GenericTree { return myImageIcon; } + public void searchForText(String text, Vector<Object> elements) { + String save = saveInXML(false).toString().toLowerCase(); + if (save.indexOf(text) >= 0) { + //TraceManager.addDev("Found " + this); + elements.add(this); + } + + for(int i=0; i<nbInternalTGComponent; i++) { + tgcomponent[i].searchForText(text, elements); + } + } + } diff --git a/src/ui/TGUIAction.java b/src/ui/TGUIAction.java index dcfc55fc382980448ae4b18289b498e1d0ebd10b..cae8151aef57c92300daa9bb595ca96a03611121 100755 --- a/src/ui/TGUIAction.java +++ b/src/ui/TGUIAction.java @@ -522,7 +522,11 @@ public class TGUIAction extends AbstractAction { putValue(Action.LONG_DESCRIPTION, actions[id].LONG_DESCRIPTION); //putValue(Action.MNEMONIC_KEY, new Integer(actions[id].MNEMONIC_KEY)); if (actions[id].MNEMONIC_KEY != 0) { - putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(actions[id].MNEMONIC_KEY, java.awt.event.InputEvent.CTRL_MASK)); + if (actions[id].hasControl) { + putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(actions[id].KEY, java.awt.event.InputEvent.CTRL_MASK)); + } else { + putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(actions[id].KEY)); + } } putValue(Action.ACTION_COMMAND_KEY, actions[id].ACTION_COMMAND_KEY); @@ -561,7 +565,7 @@ public class TGUIAction extends AbstractAction { actions[ACT_CUT] = new TAction("cut-command", "Cut",IconManager.imgic330, IconManager.imgic331, "Cut", "Cut selected components", 'X'); actions[ACT_COPY] = new TAction("copy-command", "Copy", IconManager.imgic332, IconManager.imgic333, "Copy", "Copy selected components", 'C'); actions[ACT_PASTE] = new TAction("paste-command", "Paste",IconManager.imgic334, IconManager.imgic335, "Paste", "Paste - if possible - previously cut / copied components at the minimal position of the currently opened diagram", 'V'); - actions[ACT_DELETE] = new TAction("delete-command", "Undo", IconManager.imgic336, IconManager.imgic337, "Delete", "Delete selected components", 'D'); + actions[ACT_DELETE] = new TAction("delete-command", "Undo", IconManager.imgic336, IconManager.imgic337, "Delete", "Delete selected components", KeyEvent.VK_BACK_SPACE); actions[ACT_ZOOM_MORE] = new TAction("zoommore-command", "Zoom +", IconManager.imgic316, IconManager.imgic317, "Zoom +", "Zoom +", '0'); actions[ACT_ZOOM_LESS] = new TAction("zoomless-command", "Zoom -", IconManager.imgic314, IconManager.imgic315, "Zoom -", "Zoom -", '0'); @@ -570,10 +574,10 @@ public class TGUIAction extends AbstractAction { actions[ACT_BACKWARD] = new TAction("backward-command", "Undo",IconManager.imgic40, IconManager.imgic41, "Undo", "One operation before", 'Z'); actions[ACT_FORWARD] = new TAction("forward-command", "Redo", IconManager.imgic42, IconManager.imgic43, "Redo", "One operation ahead", 'Y'); - actions[ACT_FIRST_DIAG] = new TAction("firstdiag-command", "First diagram",IconManager.imgic44, IconManager.imgic45, "First diagram", "Open the first diagram", '1'); - actions[ACT_BACK_DIAG] = new TAction("backdiag-command", "Previous diagram", IconManager.imgic46, IconManager.imgic47, "Previous diagram", "Open the previous diagram", '2'); - actions[ACT_NEXT_DIAG] = new TAction("nextdiag-command", "Next diagram",IconManager.imgic48, IconManager.imgic49, "Next diagram", "Open the next diagram", '3'); - actions[ACT_LAST_DIAG] = new TAction("lastdiag-command", "Last diagram", IconManager.imgic50, IconManager.imgic51, "Last diagram", "Open the last diagram", '4'); + actions[ACT_FIRST_DIAG] = new TAction("firstdiag-command", "First diagram",IconManager.imgic44, IconManager.imgic45, "First diagram", "Open the first diagram", 'A'); + actions[ACT_BACK_DIAG] = new TAction("backdiag-command", "Previous diagram", IconManager.imgic46, IconManager.imgic47, "Previous diagram", "Open the previous diagram", 'P', true); + actions[ACT_NEXT_DIAG] = new TAction("nextdiag-command", "Next diagram",IconManager.imgic48, IconManager.imgic49, "Next diagram", "Open the next diagram", 'F', true); + actions[ACT_LAST_DIAG] = new TAction("lastdiag-command", "Last diagram", IconManager.imgic50, IconManager.imgic51, "Last diagram", "Open the last diagram", 'E'); actions[ACT_TOGGLE_ATTRIBUTES] = new TAction("toggle-att-command", "Show / hide Attributes",IconManager.imgic132, IconManager.imgic132, "Show / hide Attributes", "Show / hide Attributes", '0'); actions[ACT_TOGGLE_GATES] = new TAction("toggle-gate-command", "Show / hide Gates",IconManager.imgic134, IconManager.imgic134, "Show / hide Gates", "Show / hide Gates", '0'); @@ -588,10 +592,11 @@ public class TGUIAction extends AbstractAction { actions[ACT_TOGGLE_INTERNAL_COMMENT] = new TAction("toggle-internal-comment-command", "Show / hide (OFF -> partial -> Full)", IconManager.imgic138, IconManager.imgic138, "Show / hide internal comments (OFF -> partial -> Full)", "Show / hide internal comments (OFF -> partial -> Full)", '0'); - actions[ACT_MODEL_CHECKING] = new TAction("checking-command", "Syntax analysis", IconManager.imgic36, IconManager.imgic37, "Syntax analysis", "Checks that all diagrams follows the TURTLE's syntax", KeyEvent.VK_F5); + actions[ACT_MODEL_CHECKING] = new TAction("checking-command", "Syntax analysis", IconManager.imgic36, IconManager.imgic37, "Syntax analysis", "Checks that all diagrams follows the TURTLE's syntax", '1'); actions[ACT_GEN_RTLOTOS] = new TAction("gen_rtlotos-command", "Generate RT-LOTOS", IconManager.imgic34, IconManager.imgic35, "Generate RT-LOTOS specification", "Generates a RT-LOTOS specification from TURTLE diagrams", KeyEvent.VK_F6); actions[ACT_GEN_LOTOS] = new TAction("gen_lotos-command", "Generate LOTOS", IconManager.imgic90, IconManager.imgic90, "Generate LOTOS specification", "Generates a LOTOS specification from TURTLE diagrams", '0'); - actions[ACT_ONECLICK_LOTOS_RG] = new TAction("gen_rglotos-command", "One-click LOTOS-based verification", IconManager.imgic342, IconManager.imgic342, "One-click LOTOS-based verification", "Generates a LOTOS-based RG from TURTLE diagrams", '0'); actions[ACT_ONECLICK_RTLOTOS_RG] = new TAction("gen_rgrtlotos-command", "Generate RT-LOTOS-based RG", IconManager.imgic342, IconManager.imgic342, "Generate RT-LOTOS-based RG ", "Generates an RT-LOTOS-based RG from TURTLE diagrams", '0'); + actions[ACT_ONECLICK_LOTOS_RG] = new TAction("gen_rglotos-command", "One-click LOTOS-based verification", IconManager.imgic342, IconManager.imgic342, "One-click LOTOS-based verification", "Generates a LOTOS-based RG from TURTLE diagrams", '0'); + actions[ACT_ONECLICK_RTLOTOS_RG] = new TAction("gen_rgrtlotos-command", "Generate RT-LOTOS-based RG", IconManager.imgic342, IconManager.imgic342, "Generate RT-LOTOS-based RG ", "Generates an RT-LOTOS-based RG from TURTLE diagrams", '0'); actions[ACT_GEN_UPPAAL] = new TAction("gen_uppaal-command", "Generate UPPAAL", IconManager.imgic92, IconManager.imgic92, "Generate UPPAAL specification", "Generates a UPPAAL specification from TTool diagrams", '0'); actions[ACT_GEN_PROVERIF] = new TAction("gen_proverif-command", "Generate ProVerif Code", IconManager.imgic34, IconManager.imgic35, "Generate ProVerif specification", "Generates a ProVerif specification from AVATAR diagrams", '0'); actions[ACT_GEN_JAVA] = new TAction("gen_java-command", "Generate JAVA", IconManager.imgic38, IconManager.imgic39, "Generate JAVA", "Generates Java code from TURTLE diagrams", 0); @@ -603,8 +608,8 @@ public class TGUIAction extends AbstractAction { actions[ACT_GEN_AUTS] = new TAction("gen_auts-command", "Generate automata via LOTOS", IconManager.imgic64, IconManager.imgic64, "Generate automata via LOTOS", "Generates automata from TML Design diagrams, using LOTOS", 0); actions[ACT_GEN_DESIGN] = new TAction("gen_design-command", "Generate Design", IconManager.imgic58, IconManager.imgic59, "Generate Design from analysis", "Generates a TURTLE design from a TURTLE analysis", 0); actions[ACT_CHECKCODE] = new TAction("gen_checkcode-command", "Check syntax of formal code", IconManager.imgic312, IconManager.imgic312, "Check syntax of formal code", "Gives as input to the corresponding tool the lastly generated formal specification", 0); - actions[ACT_SIMULATION] = new TAction("gen_sim-command", "Run intensive simulation", IconManager.imgic312, IconManager.imgic312, "Run simulation", "Generate a simulation trace for the lastly generated formal specification", KeyEvent.VK_F7); - actions[ACT_VALIDATION] = new TAction("gen_val-command", "Formal Verification", IconManager.imgic310, IconManager.imgic310, "Formal verification", "Generate an automata (DTA, RG) from the lastly generated formal specification", KeyEvent.VK_F8); + actions[ACT_SIMULATION] = new TAction("gen_sim-command", "Run intensive simulation", IconManager.imgic312, IconManager.imgic312, "Run simulation", "Generate a simulation trace for the lastly generated formal specification", '0'); + actions[ACT_VALIDATION] = new TAction("gen_val-command", "Formal Verification", IconManager.imgic310, IconManager.imgic310, "Formal verification", "Generate an automata (DTA, RG) from the lastly generated formal specification", '0'); actions[ACT_PROJECTION] = new TAction("proj_val-command", "Make minimization", IconManager.imgic310, IconManager.imgic310, "Make minimization", "Minimize a RG using Aldebaran", KeyEvent.VK_F9); actions[ACT_GRAPH_MODIFICATION] = new TAction("graph_modification-command", "Modify minimized graph", IconManager.imgic310, IconManager.imgic310, "Modify minimized graph", "Modify minimized graph according to a selected function", 0); actions[ACT_BISIMULATION] = new TAction("bisimulation-command", "Make bisimulation (Aldebaran)", IconManager.imgic310, IconManager.imgic310, "Make bisimulation (Aldebaran)", "Perform bisimulations using Aldebaran", KeyEvent.VK_F10); @@ -620,11 +625,11 @@ public class TGUIAction extends AbstractAction { actions[ACT_VIEW_PM_SAVED_AUT] = new TAction("viewpmsavedautproj-command", "Power Management Analysis (saved AUT graph)", IconManager.imgic28, IconManager.imgic29, "Power Management Analysis (saved AUT graph)", "Power Management Analysis on a graph saved in AUT (Aldebaran) format", 0); // AVATAR - actions[ACT_AVATAR_SIM] = new TAction("avatar-simu", "Interactive simulation", IconManager.imgic18, IconManager.imgic18, "Interactive simulation", "Interactive simulation of the AVATAR design under edition", '0'); - actions[ACT_AVATAR_FV_UPPAAL] = new TAction("avatar-formal-verification-uppaal", "Formal verification with UPPAAL (Safety)", IconManager.imgic86, IconManager.imgic86, "Formal verification with UPPAAL (Safety)", "Formal verification with UPPAAL (Safety) of the AVATAR design under edition", '0'); - actions[ACT_AVATAR_FV_PROVERIF] = new TAction("avatar-formal-verification-proverif", "Formal verification with ProVerif (Security)", IconManager.imgic88, IconManager.imgic88, "Formal verification with ProVerif (Security)", "Formal verification with ProVerif (Security) of the AVATAR design under edition", '0'); - actions[ACT_AVATAR_FV_STATICANALYSIS] = new TAction("avatar-formal-verification-staticanalysis", "Static analysis (invariants)", IconManager.imgic96, IconManager.imgic96, "Static analysis (Invariant)", "Static analysis (invariants) of the AVATAR design under edition", '0'); - actions[ACT_AVATAR_EXECUTABLE_GENERATION] = new TAction("avatar-executable-generation", "Generation of executable code", IconManager.imgic94, IconManager.imgic94, "Generation of executable code", "Generation of executable code from AVATAR design under edition", '0'); + actions[ACT_AVATAR_SIM] = new TAction("avatar-simu", "Interactive simulation", IconManager.imgic18, IconManager.imgic18, "Interactive simulation", "Interactive simulation of the AVATAR design under edition", '2'); + actions[ACT_AVATAR_FV_UPPAAL] = new TAction("avatar-formal-verification-uppaal", "Formal verification with UPPAAL (Safety)", IconManager.imgic86, IconManager.imgic86, "Formal verification with UPPAAL (Safety)", "Formal verification with UPPAAL (Safety) of the AVATAR design under edition", '3'); + actions[ACT_AVATAR_FV_PROVERIF] = new TAction("avatar-formal-verification-proverif", "Formal verification with ProVerif (Security)", IconManager.imgic88, IconManager.imgic88, "Formal verification with ProVerif (Security)", "Formal verification with ProVerif (Security) of the AVATAR design under edition", '4'); + actions[ACT_AVATAR_FV_STATICANALYSIS] = new TAction("avatar-formal-verification-staticanalysis", "Static analysis (invariants)", IconManager.imgic96, IconManager.imgic96, "Static analysis (Invariant)", "Static analysis (invariants) of the AVATAR design under edition", '5'); + actions[ACT_AVATAR_EXECUTABLE_GENERATION] = new TAction("avatar-executable-generation", "Generation of executable code", IconManager.imgic94, IconManager.imgic94, "Generation of executable code", "Generation of executable code from AVATAR design under edition", '6'); actions[ACT_VIEW_JAVA] = new TAction("view-java", "Display Java code", IconManager.imgic38, IconManager.imgic39, "Display Java code", "Display the java code of the pointed component", 0); diff --git a/src/ui/TURTLEPanel.java b/src/ui/TURTLEPanel.java index 3f9a132a572af1c519dde66e1ae22a4f302c3bf0..0150b670d13913cc18c09f02c50d0988ca0d733f 100755 --- a/src/ui/TURTLEPanel.java +++ b/src/ui/TURTLEPanel.java @@ -60,7 +60,7 @@ public abstract class TURTLEPanel implements GenericTree { protected MainGUI mgui; public Vector toolbars; public JPanel toolBarPanel; - public Vector panels; + public Vector<TDiagramPanel> panels; protected ChangeListener cl; protected TDiagramPanel tdp; @@ -241,7 +241,7 @@ public abstract class TURTLEPanel implements GenericTree { Object o = panels.elementAt(src); panels.removeElementAt(src); - panels.insertElementAt(o, dst); + panels.insertElementAt((TDiagramPanel)o, dst); tabbedPane.setSelectedIndex(dst); } @@ -312,6 +312,23 @@ public abstract class TURTLEPanel implements GenericTree { } } + public void searchForText(String text, Vector<Object> elements) { + if (panelAt(0) != null) { + String s = saveHeaderInXml().toLowerCase(); + if (s.indexOf(text) >= 0) { + elements.add(this); + /*CheckingError ce = new CheckingError(CheckingError.INFO, "Diagram"); + ce.setTDiagramPanel(this.panelAt(0)); + elements.add(ce);*/ + } + } + + + for(TDiagramPanel tdp: panels) { + tdp.searchForText(text, elements); + } + } + } diff --git a/src/ui/avatarinteractivesimulation/JFrameAvatarInteractiveSimulation.java b/src/ui/avatarinteractivesimulation/JFrameAvatarInteractiveSimulation.java index 3ebee326cedac3c83473a84018a842e9a60efeec..6c7a4201c125455588cef9108a77d0f8f8f5fb7f 100755 --- a/src/ui/avatarinteractivesimulation/JFrameAvatarInteractiveSimulation.java +++ b/src/ui/avatarinteractivesimulation/JFrameAvatarInteractiveSimulation.java @@ -1089,25 +1089,31 @@ public class JFrameAvatarInteractiveSimulation extends JFrame implements AvatarS } public void updateMetElements() { - LinkedList<AvatarStateMachineElement> allExecutedElements = AvatarSimulationTransaction.allExecutedElements; + Hashtable<AvatarStateMachineElement, Integer> hashOfAllElements = AvatarSimulationTransaction.hashOfAllElements; TGComponent tgc; Object o; - if (allExecutedElements == null) { + if (hashOfAllElements == null) { nbOfAllExecutedElements = 0; return; } - if (allExecutedElements.size() > nbOfAllExecutedElements) { - for(int i=nbOfAllExecutedElements; i<allExecutedElements.size(); i++) { - o = allExecutedElements.get(i).getReferenceObject(); - if (o instanceof TGComponent) { - tgc = (TGComponent)o; - tgc.setAVATARMet(true); + if (hashOfAllElements.hashCode() != nbOfAllExecutedElements) { + Object objs[] = hashOfAllElements.keySet().toArray(); + TraceManager.addDev("Parsing array of elements: " + objs.length); + for(int i=0; i<objs.length; i++) { + o = objs[i]; + TraceManager.addDev("objs: " + o); + Object oo = ((AvatarStateMachineElement)o).getReferenceObject(); + if (oo != null) { + tgc = (TGComponent)oo; + TraceManager.addDev("TGComponent: " + tgc); + tgc.setAVATARMet(hashOfAllElements.get(o).intValue()); } + } } - nbOfAllExecutedElements = allExecutedElements.size(); + nbOfAllExecutedElements = hashOfAllElements.hashCode(); } public void updateTransactionsTable() { diff --git a/src/ui/tree/DiagramTreeModel.java b/src/ui/tree/DiagramTreeModel.java index a3d6969779a110ddb5ee840f83332e46ec915a55..2c2e7e599171c1a3fbf1396faff8a96e9b6cf50c 100755 --- a/src/ui/tree/DiagramTreeModel.java +++ b/src/ui/tree/DiagramTreeModel.java @@ -140,6 +140,10 @@ public class DiagramTreeModel implements TreeModel { return false; } + if (node instanceof SearchTree) { + return false; + } + if (node instanceof SyntaxAnalysisErrorTree) { return false; } diff --git a/src/ui/tree/SearchTree.java b/src/ui/tree/SearchTree.java new file mode 100755 index 0000000000000000000000000000000000000000..45c6548ab0a7ad4293662306840c711694980055 --- /dev/null +++ b/src/ui/tree/SearchTree.java @@ -0,0 +1,100 @@ +/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille + +ludovic.apvrille AT enst.fr + +This software is a computer program whose purpose is to allow the +edition of TURTLE analysis, design and deployment diagrams, to +allow the generation of RT-LOTOS or Java code from this diagram, +and at last to allow the analysis of formal validation traces +obtained from external tools, e.g. RTL from LAAS-CNRS and CADP +from INRIA Rhone-Alpes. + +This software is governed by the CeCILL license under French law and +abiding by the rules of distribution of free software. You can use, +modify and/ or redistribute the software under the terms of the CeCILL +license as circulated by CEA, CNRS and INRIA at the following URL +"http://www.cecill.info". + +As a counterpart to the access to the source code and rights to copy, +modify and redistribute granted by the license, users are provided only +with a limited warranty and the software's author, the holder of the +economic rights, and the successive licensors have only limited +liability. + +In this respect, the user's attention is drawn to the risks associated +with loading, using, modifying and/or developing or reproducing the +software by the user in light of its specific status of free software, +that may mean that it is complicated to manipulate, and that also +therefore means that it is reserved for developers and experienced +professionals having in-depth computer knowledge. Users are therefore +encouraged to load and test the software's suitability as regards their +requirements in conditions enabling the security of their systems and/or +data to be ensured and, more generally, to use and operate it in the +same conditions as regards security. + +The fact that you are presently reading this means that you have had +knowledge of the CeCILL license and that you accept its terms. + +/** + * Class SearchTree + * Creation: 29/06/2013 + * Version 1.0 29/06/2013 + * @author Ludovic APVRILLE + * @see + */ + +package ui.tree; + +import java.util.*; + +import ui.*; +import myutil.*; + +public class SearchTree implements GenericTree { + + private MainGUI mgui; + private String name = "Search result"; + private Vector<Object> elements; + + public SearchTree(MainGUI _mgui) { + mgui = _mgui; + } + + public void setElements(Vector<Object> _elements) { + elements = _elements; + TraceManager.addDev("Found in search " + elements.size() + " elements"); + } + + // TREE MANAGEMENT + + public String toString() { + return name; + } + + public int getChildCount() { + //System.out.println("Get child count validation"); + if (elements == null) { + return 0; + } + return elements.size(); + } + + public Object getChild(int index) { + //System.out.println("Get child validation"); + if (elements != null) { + return elements.get(index); + } + return null; + } + + public int getIndexOfChild(Object child) { + //System.out.println("Get index of child validation"); + if (elements != null) { + return elements.indexOf(child); + } + + return -1; + + } + +}