Index: org.gvsig.scripting/trunk/org.gvsig.scripting/pom.xml
===================================================================
--- org.gvsig.scripting/trunk/org.gvsig.scripting/pom.xml	(revision 951)
+++ org.gvsig.scripting/trunk/org.gvsig.scripting/pom.xml	(revision 952)
@@ -12,7 +12,7 @@
     <parent>
         <groupId>org.gvsig</groupId>
         <artifactId>org.gvsig.desktop</artifactId>
-        <version>2.0.206</version>
+        <version>2.0.207-SNAPSHOT</version>
     </parent>
 
     <scm>
Index: org.gvsig.scripting/trunk/org.gvsig.scripting/org.gvsig.scripting.lib/org.gvsig.scripting.lib.impl/src/main/java/org/gvsig/scripting/impl/DefaultScriptingManager.java
===================================================================
--- org.gvsig.scripting/trunk/org.gvsig.scripting/org.gvsig.scripting.lib/org.gvsig.scripting.lib.impl/src/main/java/org/gvsig/scripting/impl/DefaultScriptingManager.java	(revision 951)
+++ org.gvsig.scripting/trunk/org.gvsig.scripting/org.gvsig.scripting.lib/org.gvsig.scripting.lib.impl/src/main/java/org/gvsig/scripting/impl/DefaultScriptingManager.java	(revision 952)
@@ -340,6 +340,9 @@
 
     public ScriptingExternalFile createExternalFile(ScriptingFolder folder, String id) {
         DefaultScriptingExternalFile unit = new DefaultScriptingExternalFile(folder, this, id);
+        if( unit.getExternalFile()!=null && !unit.getExternalFile().exists() ) {
+            unit.create(folder, id);
+        }
         return unit;
     }
     
Index: org.gvsig.scripting/trunk/org.gvsig.scripting/org.gvsig.scripting.lib/org.gvsig.scripting.lib.impl/src/main/java/org/gvsig/scripting/impl/AbstractUnit.java
===================================================================
--- org.gvsig.scripting/trunk/org.gvsig.scripting/org.gvsig.scripting.lib/org.gvsig.scripting.lib.impl/src/main/java/org/gvsig/scripting/impl/AbstractUnit.java	(revision 951)
+++ org.gvsig.scripting/trunk/org.gvsig.scripting/org.gvsig.scripting.lib/org.gvsig.scripting.lib.impl/src/main/java/org/gvsig/scripting/impl/AbstractUnit.java	(revision 952)
@@ -21,7 +21,7 @@
 
 public abstract class AbstractUnit implements ScriptingUnit, Unit {
 
-    private static final Logger logger = LoggerFactory.getLogger(AbstractUnit.class);
+    protected static final Logger logger = LoggerFactory.getLogger(AbstractUnit.class);
 
     protected DefaultScriptingManager manager;
 
Index: org.gvsig.scripting/trunk/org.gvsig.scripting/org.gvsig.scripting.lib/org.gvsig.scripting.lib.impl/src/main/java/org/gvsig/scripting/impl/DefaultScriptingExternalFile.java
===================================================================
--- org.gvsig.scripting/trunk/org.gvsig.scripting/org.gvsig.scripting.lib/org.gvsig.scripting.lib.impl/src/main/java/org/gvsig/scripting/impl/DefaultScriptingExternalFile.java	(revision 951)
+++ org.gvsig.scripting/trunk/org.gvsig.scripting/org.gvsig.scripting.lib/org.gvsig.scripting.lib.impl/src/main/java/org/gvsig/scripting/impl/DefaultScriptingExternalFile.java	(revision 952)
@@ -33,8 +33,18 @@
     }
 
     @Override
+    public void create(ScriptingFolder folder, String id) {
+        File file = this.externFile;
+        try {
+            file.createNewFile();
+        } catch (IOException e) {
+            logger.warn("Can't create inf file in '" + file.getAbsolutePath() + "'.", e);
+        }        
+    }
+    
+    @Override
     public void create(ScriptingFolder folder, String id, String language) {
-        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+        this.create(folder, id);
     }
 
     @Override

Property changes on: org.gvsig.scripting/trunk/org.gvsig.scripting/org.gvsig.scripting.lib/org.gvsig.scripting.lib.impl
___________________________________________________________________
Modified: svn:ignore
   - .settings
target
.classpath
.project

   + .classpath
.project
.directory
.settings
target


Index: org.gvsig.scripting/trunk/org.gvsig.scripting/org.gvsig.scripting.swing/org.gvsig.scripting.swing.impl/src/main/java/org/gvsig/scripting/swing/impl/DefaultScriptingUIManager.java
===================================================================
--- org.gvsig.scripting/trunk/org.gvsig.scripting/org.gvsig.scripting.swing/org.gvsig.scripting.swing.impl/src/main/java/org/gvsig/scripting/swing/impl/DefaultScriptingUIManager.java	(revision 951)
+++ org.gvsig.scripting/trunk/org.gvsig.scripting/org.gvsig.scripting.swing/org.gvsig.scripting.swing.impl/src/main/java/org/gvsig/scripting/swing/impl/DefaultScriptingUIManager.java	(revision 952)
@@ -137,7 +137,12 @@
             try {
                 listener.componentCreated(component);
             } catch (Throwable th) {
-
+                String s = "unknow";
+                try {
+                    s = component.getClass().getName();
+                } catch(Throwable th1) {
+                }
+                logger.warn("Problems call listener",th);
             }
         }
     }
Index: org.gvsig.scripting/trunk/org.gvsig.scripting/org.gvsig.scripting.swing/org.gvsig.scripting.swing.impl/src/main/java/org/gvsig/scripting/swing/impl/DefaultJScriptingLauncher.java
===================================================================
--- org.gvsig.scripting/trunk/org.gvsig.scripting/org.gvsig.scripting.swing/org.gvsig.scripting.swing.impl/src/main/java/org/gvsig/scripting/swing/impl/DefaultJScriptingLauncher.java	(revision 951)
+++ org.gvsig.scripting/trunk/org.gvsig.scripting/org.gvsig.scripting.swing/org.gvsig.scripting.swing.impl/src/main/java/org/gvsig/scripting/swing/impl/DefaultJScriptingLauncher.java	(revision 952)
@@ -21,20 +21,20 @@
 import org.gvsig.scripting.swing.api.JScriptingLauncher;
 import org.gvsig.scripting.swing.api.ScriptingUIManager;
 import org.gvsig.scripting.swing.impl.DefaultJScriptingBrowser.DefaultBrowserActionEvent;
+import org.gvsig.tools.swing.api.ActionListenerSupport;
+import org.gvsig.tools.swing.api.ToolsSwingLocator;
+import org.gvsig.tools.util.CancelledException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class DefaultJScriptingLauncher extends JPanel implements JScriptingLauncher, ActionListener {
 
     private static final Logger LOG = LoggerFactory.getLogger(DefaultJScriptingLauncher.class);
-    /**
-     *
-     */
+
     private static final long serialVersionUID = -2612734398104678920L;
 
-    protected ActionListener defaultActionlistener = null;
-//    protected ActionListener selectionActionlistener = null;
-//    protected ActionListener dropDownActionlistener = null;
+    
+    protected ActionListenerSupport defaultActionlisteners = null;
     JTabbedPane pestana;
     ScriptingUIManager uimanager;
     ScriptingManager manager;
@@ -43,6 +43,7 @@
         this.uimanager = uimanager;
         this.manager = uimanager.getManager();
 
+        this.defaultActionlisteners = ToolsSwingLocator.getToolsSwingManager().createActionListenerSupport();
         List<ScriptingFolder> folders = new ArrayList<>();
         folders.add(manager.getUserFolder());
         folders.addAll(manager.getAlternativeUserFolders());
@@ -80,40 +81,43 @@
 
     @Override
     public void addDefaultActionListener(ActionListener actionlistener) {
-        this.defaultActionlistener = actionlistener;
+        this.defaultActionlisteners.addActionListener(actionlistener);
     }
 
     @Override
     public void actionPerformed(ActionEvent e) {
-        BrowserActionEvent e2 = (BrowserActionEvent) e;
-
-        switch (e.getID()) {
-            case DefaultJScriptingBrowser.DEFAULT_ACTION:
-                if (this.defaultActionlistener == null) {
-                    ScriptingUnit unit = e2.getUnit();
-                    if( unit instanceof ScriptingBaseScript ) {
-                        ScriptingBaseScript script = (ScriptingBaseScript) unit;
-                        try {
-                            script.compile();
-                            script.runAsTask(null);
-                        } catch (ScriptingRunningException ex) {
-                            LOG.warn("Problems launching script '" + script.getName() + "'", ex);
+        try {
+            BrowserActionEvent e2 = (BrowserActionEvent) e;
+            switch (e.getID()) {
+                case DefaultJScriptingBrowser.DEFAULT_ACTION:
+                    if( this.defaultActionlisteners.hasActionListeners() ) {
+                        this.defaultActionlisteners.fireActionEvent(
+                            new DefaultBrowserActionEvent(this, DEFAULT_ACTION, "default", e2.getUnit())
+                        );
+                    } else {
+                        ScriptingUnit unit = e2.getUnit();
+                        if( unit instanceof ScriptingBaseScript ) {
+                            ScriptingBaseScript script = (ScriptingBaseScript) unit;
+                            try {
+                                script.compile();
+                                script.runAsTask(null);
+                            } catch (ScriptingRunningException ex) {
+                                LOG.warn("Problems launching script '" + script.getName() + "'", ex);
+                            }
                         }
                     }
-                } else {
-                    this.defaultActionlistener.actionPerformed(
-                            new DefaultBrowserActionEvent(this, DEFAULT_ACTION, "default", e2.getUnit())
+                    break;
+                case DefaultJScriptingBrowser.DROPDOWN_ACTION:
+                case DefaultJScriptingBrowser.SELECTION_ACTION:
+                    this.defaultActionlisteners.fireActionEvent(
+                            new DefaultBrowserActionEvent(this, e.getID(), "default", e2.getUnit())
                     );
-                }
-                break;
-            case DefaultJScriptingBrowser.DROPDOWN_ACTION:
-            case DefaultJScriptingBrowser.SELECTION_ACTION:
-                if (this.defaultActionlistener != null) {
-                    this.defaultActionlistener.actionPerformed(
-                            new DefaultBrowserActionEvent(this, DEFAULT_ACTION, "default", e2.getUnit())
-                    );
-                }
-                break;
+                    break;
+            }
+        } catch( CancelledException ex) {
+            // Do norhing
+        } catch(Throwable th) {
+            LOG.warn("",th);
         }
     }
 }
Index: org.gvsig.scripting/trunk/org.gvsig.scripting/org.gvsig.scripting.swing/org.gvsig.scripting.swing.impl/src/main/java/org/gvsig/scripting/swing/impl/DefaultJScriptingBrowser.java
===================================================================
--- org.gvsig.scripting/trunk/org.gvsig.scripting/org.gvsig.scripting.swing/org.gvsig.scripting.swing.impl/src/main/java/org/gvsig/scripting/swing/impl/DefaultJScriptingBrowser.java	(revision 951)
+++ org.gvsig.scripting/trunk/org.gvsig.scripting/org.gvsig.scripting.swing/org.gvsig.scripting.swing.impl/src/main/java/org/gvsig/scripting/swing/impl/DefaultJScriptingBrowser.java	(revision 952)
@@ -10,6 +10,7 @@
 import java.awt.event.MouseEvent;
 import java.awt.event.MouseListener;
 import java.util.ArrayList;
+import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
@@ -210,9 +211,21 @@
     }
 
     public void refresh() {
+        Enumeration<TreePath> x = tree.getExpandedDescendants(new TreePath(treeModel.getRoot()));
         ((ScriptingFolderTreeModel) this.treeModel).reload();
+        if (x != null) {
+            while (x.hasMoreElements()) {
+                try {
+                    TreePath treePath = (TreePath) x.nextElement();
+                    tree.expandPath(treePath);
+                } catch(Throwable th) {
+                    
+                }
+            }
+        }        
     }
 
+    
     @Override
     public ScriptingManager getManager() {
         return this.manager;
