You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by se...@apache.org on 2013/07/12 03:25:27 UTC

svn commit: r1502406 - /jmeter/trunk/src/core/org/apache/jmeter/gui/action/TemplateCommand.java

Author: sebb
Date: Fri Jul 12 01:25:27 2013
New Revision: 1502406

URL: http://svn.apache.org/r1502406
Log:
Lazily load the dialog and TemplateManager using IODH idiom

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/gui/action/TemplateCommand.java

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/action/TemplateCommand.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/action/TemplateCommand.java?rev=1502406&r1=1502405&r2=1502406&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/action/TemplateCommand.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/action/TemplateCommand.java Fri Jul 12 01:25:27 2013
@@ -30,20 +30,24 @@ public class TemplateCommand extends Abs
 
     private static final Set<String> commands = new HashSet<String>();
 
+    // Ensure the dialog is only created when it is first needed
+    // In turn this avoids scanning the templates until first needed
+    static class IODH {
+        private static final SelectTemplateDialog dialog = new SelectTemplateDialog();        
+    }
+
     static {
         commands.add(ActionNames.CREATE_FROM_TEMPLATE);
     }
 
-    private final SelectTemplateDialog dialog = new SelectTemplateDialog();
     /**
      * @see Command#doAction(ActionEvent)
      */
     @Override
     public void doAction(ActionEvent e) {
-        dialog.setVisible(true);
+        IODH.dialog.setVisible(true);
     }
 
-
     /**
      * @see Command#getActionNames()
      */