From 46e24c2b8f59ecd5b7bf9ceaf05f61e1672751fe Mon Sep 17 00:00:00 2001
From: Ludovic Apvrille <ludovic.apvrille@telecom-paristech.fr>
Date: Thu, 11 Jun 2020 17:30:03 +0200
Subject: [PATCH] Pushing new Makefile for dev infra

---
 doc/dev_infrastructure/Makefile               |  87 +----------
 .../ttool_development_infrastructure.tex      |  24 ++-
 modeling/DIPLODOCUS/SmartCardProtocol.xml     |   2 +-
 plugins/howto                                 |   6 +-
 .../CustomizerGraphicalComponent.java         |   6 +-
 src/main/java/myutil/Plugin.java              |  20 ++-
 src/main/java/myutil/PluginManager.java       | 143 +++++++++--------
 src/main/java/ui/TToolBar.java                |  79 ++++++----
 .../java/ui/tmldd/TMLArchiDiagramToolBar.java | 145 +++++++++---------
 9 files changed, 238 insertions(+), 274 deletions(-)

diff --git a/doc/dev_infrastructure/Makefile b/doc/dev_infrastructure/Makefile
index 8c42622e1a..7476670c9e 100644
--- a/doc/dev_infrastructure/Makefile
+++ b/doc/dev_infrastructure/Makefile
@@ -1,86 +1,7 @@
-# Tools
-LATEXFLAGS	?= -interaction=nonstopmode -file-line-error
-PDFLATEX	= pdflatex $(LATEXFLAGS)
-BIBTEX		= 
-FIG2DEV		= fig2dev
-RUBBER		?= $(shell which rubber 2> /dev/null)
-RUBBERFLAGS	= --pdf --short --warn refs --warn misc
 
-# Files and directories
-FIGDIR		= figures
-FIGS		= $(wildcard $(FIGDIR)/*.fig)
-FIGPDFS		= $(patsubst $(FIGDIR)/%.fig,$(FIGDIR)/%.pdf,$(FIGURES))
-FIGPDFTS	= $(patsubst $(FIGDIR)/%.fig,$(FIGDIR)/%.pdf_t,$(FIGURES))
-FIGURES		= $(filter-out $(FIGS) $(FIGPDFS) $(FIGPDFTS), $(wildcard $(FIGDIR)/*))
+FIGDIR		:= images
+BUILDDIR	:= build
 
-JOB	= ttool_development_infrastructure
-TEXS	= $(wildcard *.tex) $(wildcard *.sty) $(wildcard *.cls)
-PICS	= $(wildcard *.png) $(filter-out $(JOB).pdf,$(wildcard *.pdf))
-BIBS	= $(wildcard *.bib) $(wildcard *.bst)
+include ../mli.mk
 
-TOPS		= $(shell grep -l '[^%]*\\begin{document}' *.tex)
-PDFTARGETS	= $(patsubst %.tex,%.pdf,$(TOPS))
-TARGETS		= $(patsubst %.tex,%,$(TOPS))
-
-.DEFAULT: help
-.PHONY: all help clean ultraclean
-
-help:
-	@echo '----------------------------------------------------------------'; \
-	echo 'available targets:'; \
-	echo '  "make" or "make help":        print this help'; \
-	echo '  "make foo" or "make foo.pdf": build the foo.pdf document'; \
-	echo '  "make all":                   build all documents'; \
-	echo '  "make clean":                 delete non-essential generated files'; \
-	echo '  "make ultraclean":            delete all generated files'; \
-	echo '----------------------------------------------------------------'; \
-	echo 'Buildable documents:'; \
-	echo -n $(sort $(TARGETS)) | sed -e 's/\([^ ]\+\) */  \1\n/g'; \
-	echo '----------------------------------------------------------------'; \
-	echo 'if you encounter problems please contact:'; \
-	echo '  Renaud Pacalet <renaud.pacalet@telecom-paristech.fr>'; \
-	echo '----------------------------------------------------------------'
-
-all: $(PDFTARGETS)
-$(TARGETS): % : %.pdf
-
-ifeq ($(RUBBER),)
-
-# Bootstrap aux file, then keep running pdflatex until it reaches a fixpoint
-
-$(JOB).aux: | $(TEXS) $(PICS)
-	$(PDFLATEX) $(JOB)
-
-$(JOB).bbl: $(JOB).aux $(BIBS)
-	$(BIBTEX) $(JOB)
-
-$(JOB).pdf: $(TEXS) $(PICS) $(JOB).aux $(JOB).bbl
-	@cp -p $(JOB).aux $(JOB).aux.bak
-	$(PDFLATEX) $(JOB)
-	@if cmp -s $(JOB).aux $(JOB).aux.bak; \
-	then touch -r $(JOB).aux.bak $(JOB).aux; \
-	else NEWS="$$NEWS -W $(JOB).aux"; fi; rm $(JOB).aux.bak; \
-	if [ -n "$$NEWS" ]; then $(MAKE) $$NEWS $@; fi
-
-$(FIGDIR)/%.pdf: $(FIGDIR)/%.fig
-	$(FIG2DEV) -L pdftex $< $@
-
-$(FIGDIR)/%.pdf_t: $(FIGDIR)/%.fig $(FIGDIR)/%.pdf
-	$(FIG2DEV) -L pdftex_t -p $(patsubst %.pdf_t,%.pdf,$@) $< $@
-
-clean:
-	rm -f $(JOB).aux $(JOB).log $(JOB).blg $(JOB).bbl $(JOB).out $(JOB).pdf
-
-else
-
-.NOTPARALLEL:
-
-.PHONY: $(PDFTARGETS)
-
-$(PDFTARGETS): %.pdf: %.tex
-	@$(RUBBER) $(RUBBERFLAGS) $<
-
-clean:
-	@$(RUBBER) $(RUBBERFLAGS) --clean $(TOPS)
-
-endif
+$(BUILDDIR)/ttool_development_infrastructure.pdf: $(FIGDIR)
diff --git a/doc/dev_infrastructure/ttool_development_infrastructure.tex b/doc/dev_infrastructure/ttool_development_infrastructure.tex
index f7f795a5de..eeb466fc49 100644
--- a/doc/dev_infrastructure/ttool_development_infrastructure.tex
+++ b/doc/dev_infrastructure/ttool_development_infrastructure.tex
@@ -93,6 +93,7 @@ Modifications} & \textbf{Sections Modified} \\
 1.2 & 11/02/2017 & Added more info on tests & Tests \\ 
 1.3 & 02/10/2018 & Update and added GUI development & All\\
 1.4 & 22/11/2018 & Added more info on automated tests and on the installer & Automated tests / Installer \\
+1.4 & 11/06/2020 & Plugin: configuration, programming & Plugin \\
 \hline
 \end{tabular}
 \end{adjustbox}
@@ -1442,7 +1443,28 @@ if (_split[1].equals("CPU")) {
 \end{lstlisting}
 and do the same for the FPGA component.
 
-\item Finally, in the same method, have a look to the case \texttt{if (node instanceof HwCPU)} and do the same for FPGA. To make the comparison easier, capitalize the name of the FPGA's parameters. 
+\item Finally, in the same method, have a look to the case \texttt{if (node instanceof HwCPU)} and do the same for FPGA. To make the comparison easier, capitalize the name of the FPGA parameters. 
 \end{itemize}   
 
+\newpage
+\section{Plugin}
+
+A plugin makes it possible to add external features to TTool. 
+
+\subsection{Installing a plugin}
+A plugin is provided as a \textit{jar} file, for instance \textit{MyLovelyPlugin.jar}. For TTool to find and use this plugin, a configuration line must be added to the configuration file of TTool (e.g. \textit{config.xml}). For instance:
+
+\begin{lstlisting}
+<PLUGIN file="MyLovelyPlugin.jar" package = "mainstream"/>
+\end{lstlisting}
+means that the main class of the plugin, called "MyLovelyPlugin" shall be searched for in the "mainstream" package of the jar file. If the main class of the plugin is not in a package, then package must be left empty  \texttt{package=""}.
+
+
+TTool searches for plugin in its default bin directory, or, if configured, in the \texttt{PLUGIN\_PATH}. Thus, the configuration file (e.g. \textit{config.xml}) can declare:
+\begin{lstlisting}
+<PLUGIN_PATH data="../plugins" />
+\end{lstlisting}
+
+\subsection{Programming a new plugin}
+
 \end{document}
diff --git a/modeling/DIPLODOCUS/SmartCardProtocol.xml b/modeling/DIPLODOCUS/SmartCardProtocol.xml
index a9bb6a099a..0d8a3e2677 100755
--- a/modeling/DIPLODOCUS/SmartCardProtocol.xml
+++ b/modeling/DIPLODOCUS/SmartCardProtocol.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
-<TURTLEGMODELING version="1.0beta" ANIMATE_INTERACTIVE_SIMULATION="true" ACTIVATE_PENALTIES="false" UPDATE_INFORMATION_DIPLO_SIM="false" ANIMATE_WITH_INFO_DIPLO_SIM="true" OPEN_DIAG_DIPLO_SIM="false" LAST_SELECTED_MAIN_TAB="1" LAST_SELECTED_SUB_TAB="0">
+<TURTLEGMODELING version="1.0beta" ANIMATE_INTERACTIVE_SIMULATION="true" ACTIVATE_PENALTIES="false" UPDATE_INFORMATION_DIPLO_SIM="false" ANIMATE_WITH_INFO_DIPLO_SIM="true" OPEN_DIAG_DIPLO_SIM="false" LAST_SELECTED_MAIN_TAB="3" LAST_SELECTED_SUB_TAB="0">
 
 <Modeling type="TML Component Design" nameTab="AppC" tabs="TML Component Task Diagram$Application$TCPIP$Timer$InterfaceDevice$SmartCard" >
 <TMLComponentTaskDiagramPanel name="TML Component Task Diagram" minX="0" maxX="2724" minY="0" maxY="916" channels="true" events="true" requests="true" zoom="1.0000000000000018" >
diff --git a/plugins/howto b/plugins/howto
index 014bf968ed..9e803b766e 100644
--- a/plugins/howto
+++ b/plugins/howto
@@ -5,8 +5,8 @@ $make
 
 Then, edit the configuration file of TTool (default: TTool/bin/config.xml) and add:
 <PLUGIN_PATH data="../plugins" />
-<PLUGIN file="CustomizerAvatarJavaCodeGeneration.jar" package = "."/>
-<PLUGIN file="CustomizerGraphicalComponent.jar" package="."/>
+<PLUGIN file="CustomizerAvatarJavaCodeGeneration.jar" package = ""/>
+<PLUGIN file="CustomizerGraphicalComponent.jar" package=""/>
 
 Then, start TTool, and generate Java code from an avatar design model.
 
@@ -16,7 +16,7 @@ Then, start TTool, and generate Java code from an avatar design model.
 
 2) Add the plugin reference in config.xml
 For example:
-<PLUGIN file="../plugins/CustomizerAvatarCodeGeneration.jar" package="."/>
+<PLUGIN file="../plugins/CustomizerAvatarCodeGeneration.jar" package=""/>
 
 3) Load the configuration information in ConfigurationTTool.java
 
diff --git a/plugins/testPluginGraphicalComponent/CustomizerGraphicalComponent.java b/plugins/testPluginGraphicalComponent/CustomizerGraphicalComponent.java
index 6479ec9a6f..dbec671d78 100644
--- a/plugins/testPluginGraphicalComponent/CustomizerGraphicalComponent.java
+++ b/plugins/testPluginGraphicalComponent/CustomizerGraphicalComponent.java
@@ -63,10 +63,12 @@ public class CustomizerGraphicalComponent {
     }
 
     public static ImageIcon getImageIcon() {
-	URL url = CustomizerGraphicalComponent.class.getResource("myicon.gif");
+	    URL url = CustomizerGraphicalComponent.class.getResource("myicon.gif");
+
+	    System.out.println("URL=" + url);
 
         if (url != null)  {
-	    myIcon = new ImageIcon(url);
+	        myIcon = new ImageIcon(url);
             return myIcon;
         } 
 	
diff --git a/src/main/java/myutil/Plugin.java b/src/main/java/myutil/Plugin.java
index f555944626..b4af971882 100644
--- a/src/main/java/myutil/Plugin.java
+++ b/src/main/java/myutil/Plugin.java
@@ -40,7 +40,6 @@
 package myutil;
 
 import javax.swing.*;
-import java.awt.*;
 import java.io.File;
 import java.lang.reflect.Method;
 import java.net.URL;
@@ -107,7 +106,7 @@ public class Plugin {
 
     public ImageIcon getDiplodocusCodeGeneratorLogo() {
         String mName = "getLogoImage";
-        TraceManager.addDev("Getting image with method=" + mName);
+        //TraceManager.addDev("Getting image with method=" + mName);
         ImageIcon img = executeRetImageIconMethod(classDiplodocusCodeGenerator, mName);
         return img;
     }
@@ -128,10 +127,15 @@ public class Plugin {
 
     public boolean hasGraphicalComponent(String _diagID) {
         //TraceManager.addDev("Test GC with diag=" + _diagID);
+        //TraceManager.addDev("Executing hasGraphicalComponent in plugin "  + getName());
         String ret = executeRetStringMethod(removeJar(name), "hasGraphicalComponent");
+        //TraceManager.addDev("Executed hasGraphicalComponent in plugin "  + getName() + " ret=" +ret);
+
         if (ret != null) {
             classGraphicalComponent = getClass(ret);
+            //TraceManager.addDev("Executing getPanelClassName in plugin "  + getName());
             String diagOk = executeRetStringMethod(classGraphicalComponent, "getPanelClassName");
+            //TraceManager.addDev("Executed getPanelClassName in plugin "  + getName());
             if (diagOk != null) {
                 if (diagOk.compareTo(_diagID) == 0) {
                     //TraceManager.addDev("Found graphical component in plugin:" + name);
@@ -184,9 +188,9 @@ public class Plugin {
             }
 
         } catch (Exception e) {
-            TraceManager.addDev("getClass()\n");
-            e.printStackTrace(System.out);
-            //TraceManager.addDev("Exception when using plugin " + name + " with className=" + _className);
+            //TraceManager.addDev("getClass()\n");
+            //e.printStackTrace(System.out);
+            TraceManager.addDev("Exception when using plugin " + name + " with className=" + _className);
             return null;
         }
 
@@ -218,7 +222,7 @@ public class Plugin {
 
             return c.getMethod(_methodName);
         } catch (Exception e) {
-            //e.printStackTrace( System.out );
+            e.printStackTrace( System.out );
             TraceManager.addDev("Exception when using plugin " + name + " with className=" + _className + " and method " + _methodName);
             return null;
         }
@@ -227,7 +231,9 @@ public class Plugin {
 
     public String executeRetStringMethod(String _className, String _methodName) {
         // We have a valid plugin. We now need to get the Method
+        //TraceManager.addDev("-------- Getting " + _methodName + " of class " + _className);
         Method m = getMethod(_className, _methodName);
+        //TraceManager.addDev("-------- Got " + _methodName + " of class " + _className);
         if (m == null) {
             //TraceManager.addDev("Null method with class as a string class=" + _className + " _method=" + _methodName);
             return null;
@@ -301,7 +307,7 @@ public class Plugin {
 
             return (ImageIcon) (m.invoke(null));
         } catch (Exception e) {
-            TraceManager.addDev("Exception occured when executing method " + _methodName);
+            TraceManager.addDev("Exception occurred when executing method " + _methodName + " in plugin " + this.getName());
             return null;
         }
     }
diff --git a/src/main/java/myutil/PluginManager.java b/src/main/java/myutil/PluginManager.java
index 791a1fb521..2a6b4e5cd3 100644
--- a/src/main/java/myutil/PluginManager.java
+++ b/src/main/java/myutil/PluginManager.java
@@ -1,26 +1,26 @@
 /* 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,
@@ -31,84 +31,82 @@
  * 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.
  */
 
 
-
-
 package myutil;
 
+import java.awt.*;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.LinkedList;
 
-import java.awt.*;
-
 /**
-   * Class PluginManager
-   * Creation: 24/05/2017
-   * Version 1.0 24/05/2017
-   * @author Ludovic APVRILLE
+ * Class PluginManager
+ * Creation: 24/05/2017
+ * Version 1.0 24/05/2017
+ *
+ * @author Ludovic APVRILLE
  */
-public class PluginManager  {
+public class PluginManager {
     public static PluginManager pluginManager;
     public static String PLUGIN_PATH = "";
-    
+
     public ArrayList<Plugin> plugins;
     public ArrayList<Plugin> pluginPackages;
 
     public PluginManager() {
-	plugins = new ArrayList<Plugin>();
-	pluginPackages = new ArrayList<Plugin>();
+        plugins = new ArrayList<Plugin>();
+        pluginPackages = new ArrayList<Plugin>();
     }
 
     public void preparePlugins(String path, String[] plugins, String[] packages) {
-	PLUGIN_PATH = path;
-	int cpt = 0;
-	for(String s: plugins) {
-	    createPlugin(s, packages[cpt]);
-	    cpt ++;
-	}
+        PLUGIN_PATH = path;
+        int cpt = 0;
+        for (String s : plugins) {
+            createPlugin(s, packages[cpt]);
+            cpt++;
+        }
     }
 
     public Plugin getPluginAvatarCodeGenerator() {
-	for(Plugin plugin: plugins) {
-	    if (plugin.hasAvatarCodeGenerator()) {
-		//TraceManager.addDev("     Found avatar code generation plugin");
-		return plugin;
-	    }
-	}
-	//TraceManager.addDev("     NOT Found avatar code generation plugin");
-	return null;
+        for (Plugin plugin : plugins) {
+            if (plugin.hasAvatarCodeGenerator()) {
+                //TraceManager.addDev("     Found avatar code generation plugin");
+                return plugin;
+            }
+        }
+        //TraceManager.addDev("     NOT Found avatar code generation plugin");
+        return null;
     }
 
     public LinkedList<Plugin> getPluginDiplodocusCodeGenerator() {
-	LinkedList<Plugin> lplugins = new LinkedList<Plugin>();
-	for(Plugin plugin: plugins) {
-	    if (plugin.hasDiplodocusCodeGenerator()) {
-		lplugins.add(plugin);
-		//TraceManager.addDev("     Found diplodocus code generator plugin");
-	    }
-	}
-	return lplugins;
+        LinkedList<Plugin> lplugins = new LinkedList<Plugin>();
+        for (Plugin plugin : plugins) {
+            if (plugin.hasDiplodocusCodeGenerator()) {
+                lplugins.add(plugin);
+                //TraceManager.addDev("     Found diplodocus code generator plugin");
+            }
+        }
+        return lplugins;
     }
 
     public LinkedList<Plugin> getPluginGraphicalComponent(String diag) {
-	LinkedList<Plugin> lplugins = new LinkedList<Plugin>();
-	for(Plugin plugin: plugins) {
-	    if (plugin.hasGraphicalComponent(diag)) {
-		lplugins.add(plugin);
-		//TraceManager.addDev("     Found graphical plugin");
-	    }
-	}
-	return lplugins;
+        LinkedList<Plugin> lplugins = new LinkedList<Plugin>();
+        for (Plugin plugin: plugins) {
+            if (plugin.hasGraphicalComponent(diag)) {
+                lplugins.add(plugin);
+                TraceManager.addDev("     Found graphical plugin: " + plugin.getName());
+            }
+        }
+        return lplugins;
     }
 
     public void addPlugin(Plugin _plugin) {
-	plugins.add(_plugin);
+        plugins.add(_plugin);
     }
 
     /*public Plugin getPluginOrCreate(String _name) {
@@ -121,35 +119,35 @@ public class PluginManager  {
 	}*/
 
     public Plugin getPlugin(String _name) {
-	for(Plugin plugin: plugins) {
-	    if (plugin.getName().compareTo(_name) == 0) {
-		return plugin;
-	    }
-	}
-	return null;
+        for (Plugin plugin : plugins) {
+            if (plugin.getName().compareTo(_name) == 0) {
+                return plugin;
+            }
+        }
+        return null;
     }
 
     public Plugin createPlugin(String _name, String packageName) {
-	Plugin plugin = new Plugin(PLUGIN_PATH, _name, packageName);
-	addPlugin(plugin);
-	return plugin;
+        Plugin plugin = new Plugin(PLUGIN_PATH, _name, packageName);
+        addPlugin(plugin);
+        return plugin;
     }
 
     public void executeGraphics(Plugin _plugin, String _className, String _methodName, Graphics g) {
-	if (_plugin == null) {
-	    return;
-	}
-
-	Method m = _plugin.getMethod(_className, _methodName);
-	if (m == null) {
-	    return;
-	}
-
-	try {
-	    m.invoke(g);
-	} catch (Exception e) {
-	    TraceManager.addDev("Exception occured when executing method " + _methodName);
-	}
+        if (_plugin == null) {
+            return;
+        }
+
+        Method m = _plugin.getMethod(_className, _methodName);
+        if (m == null) {
+            return;
+        }
+
+        try {
+            m.invoke(g);
+        } catch (Exception e) {
+            TraceManager.addDev("Exception occured when executing method " + _methodName);
+        }
     }
     
     /*public String executeString(String _pluginName, String _className, String _methodName) {
@@ -168,5 +166,4 @@ public class PluginManager  {
 	}*/
 
 
-
 }
diff --git a/src/main/java/ui/TToolBar.java b/src/main/java/ui/TToolBar.java
index 6ded5e3eca..cfd68195d6 100644
--- a/src/main/java/ui/TToolBar.java
+++ b/src/main/java/ui/TToolBar.java
@@ -37,24 +37,26 @@
  */
 
 
-
-
 package ui;
 
-import javax.swing.*;
-import java.util.*;
-import java.awt.event.*;
+import myutil.Plugin;
+import myutil.PluginManager;
+import myutil.TraceManager;
 
-import myutil.*;
-import common.*;
+import javax.swing.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.ArrayList;
+import java.util.LinkedList;
 
 
 /**
  * Class TToolBar
  * Abstract toolbar to be used by TURTLE diagrams
  * Creation: 21/12/2003
- * @version 1.0 21/12/2003
+ *
  * @author Ludovic APVRILLE
+ * @version 1.0 21/12/2003
  * @see TGComponent
  */
 public abstract class TToolBar extends JToolBar implements ActionListener {
@@ -71,7 +73,7 @@ public abstract class TToolBar extends JToolBar implements ActionListener {
         super();
         mgui = _mgui;
         setOrientation(SwingConstants.HORIZONTAL);
-        setFloatable(true) ;
+        setFloatable(true);
         setButtons();
     }
 
@@ -84,30 +86,45 @@ public abstract class TToolBar extends JToolBar implements ActionListener {
         pluginActions = new ArrayList<TGUIAction>();
         plugins = new ArrayList<Plugin>();
         this.addSeparator();
-	LinkedList<Plugin> list = PluginManager.pluginManager.getPluginGraphicalComponent(diag);
-	TraceManager.addDev("List of " + list.size() + " graphical components");
-	for(Plugin p: list) {
-	    //Plugin p = PluginManager.pluginManager.getPluginOrCreate(ConfigurationTTool.PLUGIN_GRAPHICAL_COMPONENT[i]);
-	    String shortText = p.executeRetStringMethod(p.getClassGraphicalComponent(), "getShortText");
-	    String longText = p.executeRetStringMethod(p.getClassGraphicalComponent(), "getLongText");
-	    String veryShortText = p.executeRetStringMethod(p.getClassGraphicalComponent(), "getVeryShortText");
-	    ImageIcon img = p.executeRetImageIconMethod(p.getClassGraphicalComponent(), "getImageIcon");
-	    if ((img != null)  && (shortText != null)) {
-		TraceManager.addDev("Plugin: " + p.getName() + " short name:" + shortText);
-		TAction t = new TAction("command-" + p.getName(), shortText, img, img, veryShortText, longText, 0);
-		TGUIAction tguia = new TGUIAction(t);
-		pluginActions.add(tguia);
-		plugins.add(p);
-		JButton button = add(tguia);
-		button.addMouseListener(mgui.mouseHandler);
-		tguia.addActionListener(this);
-		//button.addActionListener(this);
+        LinkedList<Plugin> list = PluginManager.pluginManager.getPluginGraphicalComponent(diag);
+        //TraceManager.addDev("List of " + list.size() + " graphical components");
+        for (Plugin p : list) {
+            //Plugin p = PluginManager.pluginManager.getPluginOrCreate(ConfigurationTTool.PLUGIN_GRAPHICAL_COMPONENT[i]);
+            //TraceManager.addDev("Testing plugin p=" + p.getName());
+            String shortText = p.executeRetStringMethod(p.getClassGraphicalComponent(), "getShortText");
+            String longText = p.executeRetStringMethod(p.getClassGraphicalComponent(), "getLongText");
+            String veryShortText = p.executeRetStringMethod(p.getClassGraphicalComponent(), "getVeryShortText");
+            //TraceManager.addDev("Got info on text. Will try icon");
+            ImageIcon img = p.executeRetImageIconMethod(p.getClassGraphicalComponent(), "getImageIcon");
+            //TraceManager.addDev("Icon got");
+            if (img == null) {
+                TraceManager.addDev("null icon");
+            } else {
+                TraceManager.addDev("Ok icon");
+            }
+
+            if (shortText == null) {
+                TraceManager.addDev("null short text");
+            } else {
+                TraceManager.addDev("Ok short text");
+            }
+
+            if ((img != null) && (shortText != null)) {
+                TraceManager.addDev("Plugin: " + p.getName() + " short name:" + shortText);
+                TAction t = new TAction("command-" + p.getName(), shortText, img, img, veryShortText, longText, 0);
+                TGUIAction tguia = new TGUIAction(t);
+                pluginActions.add(tguia);
+                plugins.add(p);
+                JButton button = add(tguia);
+                button.addMouseListener(mgui.mouseHandler);
+                tguia.addActionListener(this);
+                //button.addActionListener(this);
 		
 		/*JButton toto = new JButton("Test");
 		  toto.addActionListener(this);
 		  add(toto);*/
-		//TraceManager.addDev("Action listener...");
-	    }
+                //TraceManager.addDev("Action listener...");
+            }
         }
     }
 
@@ -120,14 +137,14 @@ public abstract class TToolBar extends JToolBar implements ActionListener {
         TGUIAction act = null;
         String command = evt.getActionCommand();
         //TraceManager.addDev("command=" + command);
-        for(TGUIAction t: pluginActions) {
+        for (TGUIAction t : pluginActions) {
             //TraceManager.addDev(" command of action:" + t.getActionCommand());
             if (t.getActionCommand().compareTo(command) == 0) {
                 p = plugins.get(index);
                 act = t;
                 break;
             }
-            index ++;
+            index++;
         }
 
         if ((act != null) && (p != null)) {
diff --git a/src/main/java/ui/tmldd/TMLArchiDiagramToolBar.java b/src/main/java/ui/tmldd/TMLArchiDiagramToolBar.java
index baeb2e2f67..7d5b4c60b6 100755
--- a/src/main/java/ui/tmldd/TMLArchiDiagramToolBar.java
+++ b/src/main/java/ui/tmldd/TMLArchiDiagramToolBar.java
@@ -1,27 +1,27 @@
 /* Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille, Andrea Enrici
- * 
+ *
  * ludovic.apvrille AT telecom-paristech.fr
  * andrea.enrici AT telecom-paristech.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,
@@ -32,7 +32,7 @@
  * 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.
  */
@@ -45,19 +45,19 @@ import ui.TGUIAction;
 import ui.TToolBar;
 
 import javax.swing.*;
-
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 
 /**
-   * Class TMLArchiDiagramToolBar
-   * Implements the toolbar to be used in conjunction with the panel of a TML Architecture diagram
-   * Creation: 18/09/2007
-   * @version 1.1 18/09/2017
-   * @author Ludovic APVRILLE
-   * @see ui.cd.TClassDiagramPanel
+ * Class TMLArchiDiagramToolBar
+ * Implements the toolbar to be used in conjunction with the panel of a TML Architecture diagram
+ * Creation: 18/09/2007
+ *
+ * @author Ludovic APVRILLE
+ * @version 1.1 18/09/2017
+ * @see ui.cd.TClassDiagramPanel
  */
-public class TMLArchiDiagramToolBar extends TToolBar  implements ActionListener {
+public class TMLArchiDiagramToolBar extends TToolBar implements ActionListener {
 
     protected JMenuBar box;
     protected JMenu menu;
@@ -94,10 +94,10 @@ public class TMLArchiDiagramToolBar extends TToolBar  implements ActionListener
         mgui.actions[TGUIAction.ACT_TOGGLE_ATTR].setEnabled(b);
         mgui.actions[TGUIAction.ACT_TOGGLE_DIPLO_ID].setEnabled(b);
 
-		// Issue #31
-		mgui.actions[ TGUIAction.ACT_ZOOM_MORE ].setEnabled( b );
-		mgui.actions[ TGUIAction.ACT_ZOOM_LESS ].setEnabled( b );
-		mgui.actions[ TGUIAction.ACT_SHOW_ZOOM ].setEnabled( b );
+        // Issue #31
+        mgui.actions[TGUIAction.ACT_ZOOM_MORE].setEnabled(b);
+        mgui.actions[TGUIAction.ACT_ZOOM_LESS].setEnabled(b);
+        mgui.actions[TGUIAction.ACT_SHOW_ZOOM].setEnabled(b);
 //        mgui.actions[TGUIAction.ACT_SHOW_ZOOM].setEnabled(false);
 
         mgui.actions[TGUIAction.ACT_MODEL_CHECKING].setEnabled(b);
@@ -134,11 +134,11 @@ public class TMLArchiDiagramToolBar extends TToolBar  implements ActionListener
         button = this.add(mgui.actions[TGUIAction.TMLARCHI_HWANODE]);
         button.addMouseListener(mgui.mouseHandler);
 
-	 if (mgui.isExperimentalOn()) {
-	     button = this.add(mgui.actions[TGUIAction.TMLARCHI_CAMSNODE]);
-	     button.addMouseListener(mgui.mouseHandler);
-	 }
-	 
+        if (mgui.isExperimentalOn()) {
+            button = this.add(mgui.actions[TGUIAction.TMLARCHI_CAMSNODE]);
+            button.addMouseListener(mgui.mouseHandler);
+        }
+
         if (mgui.isExperimentalOn()) {
             button = this.add(mgui.actions[TGUIAction.TMLARCHI_FPGANODE]);
             button.addMouseListener(mgui.mouseHandler);
@@ -167,29 +167,28 @@ public class TMLArchiDiagramToolBar extends TToolBar  implements ActionListener
         button.addMouseListener(mgui.mouseHandler);
         this.addSeparator();
 
-		button = this.add(mgui.actions[TGUIAction.TMLARCHI_COMMUNICATION_ARTIFACT]);
+        button = this.add(mgui.actions[TGUIAction.TMLARCHI_COMMUNICATION_ARTIFACT]);
         button.addMouseListener(mgui.mouseHandler);
 	
 	/*button = this.add(mgui.actions[TGUIAction.TMLARCHI_EVENT_ARTIFACT]);
 	  button.addMouseListener(mgui.mouseHandler);*/
-	    
+
         if (MainGUI.experimentalOn) {
-        	this.addSeparator();
+            this.addSeparator();
             button = this.add(mgui.actions[TGUIAction.TMLARCHI_CPNODE]);
             button.addMouseListener(mgui.mouseHandler);
             button = this.add(mgui.actions[TGUIAction.TMLARCHI_PORT_ARTIFACT]);
-            button.addMouseListener(mgui.mouseHandler);                    
-	        button = this.add(mgui.actions[TGUIAction.TMLARCHI_FIREWALL]);
-	        button.addMouseListener(mgui.mouseHandler);
+            button.addMouseListener(mgui.mouseHandler);
+            button = this.add(mgui.actions[TGUIAction.TMLARCHI_FIREWALL]);
+            button.addMouseListener(mgui.mouseHandler);
         }
 
         this.addSeparator();
-	
+
         button = this.add(mgui.actions[TGUIAction.TMLARCHI_KEY]);
         button.addMouseListener(mgui.mouseHandler);
 
 
-	
         this.addSeparator();
         button = this.add(mgui.actions[TGUIAction.ACT_TOGGLE_ATTR]);
         button.addMouseListener(mgui.mouseHandler);
@@ -200,36 +199,36 @@ public class TMLArchiDiagramToolBar extends TToolBar  implements ActionListener
         button.addMouseListener(mgui.mouseHandler);
 
         setPluginButtons("TMLArchiDiagramPanel");
-	
+
         this.addSeparator();
         if (viewInfos == null) {
             TraceManager.addDev("null viewInfos");
         }
-        
+
         //Issue #68: Review Filters of Diagram Elements
         box = new JMenuBar();
         menu = new JMenu("View (options)");
-        
-       	m1 = new JCheckBoxMenuItem(viewInfos[0], true);
-       	m1.addActionListener(this);
-       	m2 = new JCheckBoxMenuItem(viewInfos[1], true);
-       	m2.addActionListener(this);
-       	m3 = new JCheckBoxMenuItem(viewInfos[2], true);
-       	m3.addActionListener(this);
-       	m4 = new JCheckBoxMenuItem(viewInfos[3], true);
-       	m4.addActionListener(this);
-       	m5 = new JCheckBoxMenuItem(viewInfos[4], true);
-       	m5.addActionListener(this);
-       	
-       	
+
+        m1 = new JCheckBoxMenuItem(viewInfos[0], true);
+        m1.addActionListener(this);
+        m2 = new JCheckBoxMenuItem(viewInfos[1], true);
+        m2.addActionListener(this);
+        m3 = new JCheckBoxMenuItem(viewInfos[2], true);
+        m3.addActionListener(this);
+        m4 = new JCheckBoxMenuItem(viewInfos[3], true);
+        m4.addActionListener(this);
+        m5 = new JCheckBoxMenuItem(viewInfos[4], true);
+        m5.addActionListener(this);
+
+
         menu.add(m1);
-        menu.add(m2); 
-        menu.add(m3); 
-        menu.add(m4); 
+        menu.add(m2);
+        menu.add(m3);
+        menu.add(m4);
         menu.add(m5);
 
-        box.add(menu);    
-        
+        box.add(menu);
+
         this.add(box);
     }
 
@@ -239,29 +238,29 @@ public class TMLArchiDiagramToolBar extends TToolBar  implements ActionListener
 
     @Override
     public void actionPerformed(ActionEvent e) {
-    	super.actionPerformed(e);
-        
-    	//if (e.getSource() == box) {
-            if (panel != null) {
-            	int res = 0;
-            	
-            	//Check if "View Comm. Pattern mapping" is check to enable "Port Interface" option
-            	if (!((JCheckBoxMenuItem) box.getMenu(0).getItem(2)).getState())
-            		((JCheckBoxMenuItem)box.getMenu(0).getItem(3)).setEnabled(false);
-            	else
-            		((JCheckBoxMenuItem)box.getMenu(0).getItem(3)).setEnabled(true);
-            	
-            	//Verify checked options
-            	for (int i = 0; i < box.getMenu(0).getItemCount(); i++) {
-            		JMenuItem j = box.getMenu(0).getItem(i);
-            		JCheckBoxMenuItem ci = (JCheckBoxMenuItem) j;
-            		res *= 2;
-            		if (ci.isEnabled() && ci.getState())
-            			res++;
-            	}
-            	
-            	panel.setCurrentView(res);
+        super.actionPerformed(e);
+
+        //if (e.getSource() == box) {
+        if (panel != null) {
+            int res = 0;
+
+            //Check if "View Comm. Pattern mapping" is check to enable "Port Interface" option
+            if (!((JCheckBoxMenuItem) box.getMenu(0).getItem(2)).getState())
+                ((JCheckBoxMenuItem) box.getMenu(0).getItem(3)).setEnabled(false);
+            else
+                ((JCheckBoxMenuItem) box.getMenu(0).getItem(3)).setEnabled(true);
+
+            //Verify checked options
+            for (int i = 0; i < box.getMenu(0).getItemCount(); i++) {
+                JMenuItem j = box.getMenu(0).getItem(i);
+                JCheckBoxMenuItem ci = (JCheckBoxMenuItem) j;
+                res *= 2;
+                if (ci.isEnabled() && ci.getState())
+                    res++;
             }
+
+            panel.setCurrentView(res);
+        }
         //}
     }
 } // Class
-- 
GitLab