Revision 440 org.gvsig.scripting/trunk/org.gvsig.scripting/org.gvsig.scripting.lib/org.gvsig.scripting.lib.impl/src/main/java/org/gvsig/scripting/impl/DefaultScriptingDialog.java

View differences:

DefaultScriptingDialog.java
4 4
import java.awt.event.ActionListener;
5 5
import java.io.File;
6 6

  
7
import org.gvsig.scripting.ExecuteErrorException;
7 8
import org.gvsig.scripting.ScriptingDialog;
8 9
import org.gvsig.scripting.ScriptingManager;
9 10
import org.gvsig.scripting.swing.api.JThinlet;
......
23 24
	
24 25
	public void runAsTask(Object[] args) {
25 26
		// Los dialogos no se ejecutan en otro hilo.
26
		super.run(args);
27
		this.run(args);
27 28
	}
28 29
	
29 30
	public Object run(Object args[]) {
......
36 37
		this.put("dialog", thinlet.getThinlet());
37 38
		
38 39
		this.compile();
39
		this.invokeFunction(this.getMainName(), args);		
40
		try {
41
			this.invokeFunction(this.getMainName(), args);
42
		} catch( ExecuteErrorException ex) {
43
			Throwable e = ex.getCause();
44
			if( !(e instanceof NoSuchMethodException) ) {
45
				throw ex;
46
			} else {
47
				// When running from the composer messages of stdout shows in the console tab.
48
				System.out.println("Code of dialog do not has function '"+ this.getMainName()+"'.");
49
			}
50
		}
40 51

  
41 52
		switch(this.getShowMode()){
42 53
		case MODE_WINDOW:
54
			// When running from the composer messages of stdout shows in the console tab.
55
			System.out.println("Showing dialog as window "+ this.getName()+".");
43 56
			uimanager.showWindow(thinlet, this.getName());
44 57
			break;
45 58
		case MODE_TOOL:
59
			// When running from the composer messages of stdout shows in the console tab.
60
			System.out.println("Showing dialog as tool "+ this.getName()+".");
46 61
			uimanager.showTool(thinlet, this.getName());
47 62
			break;
48 63
		default:
64
			// When running from the composer messages of stdout shows in the console tab.
65
			System.out.println("Showing dialog as dialog "+ this.getName()+".");
49 66
			uimanager.showDialog(thinlet, this.getName());
50 67
			break;
51 68
		}

Also available in: Unified diff