+ initial contribution of core, tcl, ruby source.
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/.classpath b/core/plugins/org.eclipse.dltk.debug.ui/.classpath
new file mode 100644
index 0000000..751c8f2
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/.cvsignore b/core/plugins/org.eclipse.dltk.debug.ui/.cvsignore
new file mode 100644
index 0000000..ba077a4
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/.cvsignore
@@ -0,0 +1 @@
+bin
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/.project b/core/plugins/org.eclipse.dltk.debug.ui/.project
new file mode 100644
index 0000000..b21431c
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.dltk.debug.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/META-INF/MANIFEST.MF b/core/plugins/org.eclipse.dltk.debug.ui/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..7585d16
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,32 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.dltk.debug.ui;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.dltk.debug.ui.DLTKDebugUIPlugin
+Bundle-Vendor: %pluginProvider
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.debug.ui,
+ org.eclipse.debug.core,
+ org.eclipse.core.resources,
+ org.eclipse.ui.ide,
+ org.eclipse.core.variables,
+ org.eclipse.dltk.core,
+ org.eclipse.dltk.ui,
+ org.eclipse.dltk.debug,
+ org.eclipse.dltk.launching,
+ com.ibm.icu,
+ org.eclipse.ui.workbench.texteditor,
+ org.eclipse.ui.editors,
+ org.eclipse.jface.text,
+ org.eclipse.ui.console
+Eclipse-LazyStart: true
+Export-Package: org.eclipse.dltk.debug.ui,
+ org.eclipse.dltk.debug.ui.actions,
+ org.eclipse.dltk.debug.ui.launchConfigurations,
+ org.eclipse.dltk.debug.ui.messages,
+ org.eclipse.dltk.internal.debug.ui,
+ org.eclipse.dltk.internal.debug.ui.interpreters,
+ org.eclipse.dltk.internal.debug.ui.launcher
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/build.properties b/core/plugins/org.eclipse.dltk.debug.ui/build.properties
new file mode 100644
index 0000000..b5f960f
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/build.properties
@@ -0,0 +1,8 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ icons/,\
+ plugin.properties,\
+ schema/
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dlcl16/Thumbs.db b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dlcl16/Thumbs.db
new file mode 100644
index 0000000..8584de4
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dlcl16/Thumbs.db
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dlcl16/constant_co.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dlcl16/constant_co.gif
new file mode 100644
index 0000000..5812de9
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dlcl16/constant_co.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dlcl16/deadlock_view.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dlcl16/deadlock_view.gif
new file mode 100644
index 0000000..3e992f0
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dlcl16/deadlock_view.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dlcl16/exc_catch.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dlcl16/exc_catch.gif
new file mode 100644
index 0000000..0944ffd
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dlcl16/exc_catch.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dlcl16/final_co.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dlcl16/final_co.gif
new file mode 100644
index 0000000..4a538a3
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dlcl16/final_co.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dlcl16/monitor_view.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dlcl16/monitor_view.gif
new file mode 100644
index 0000000..ba6a24b
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dlcl16/monitor_view.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dlcl16/resume_co.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dlcl16/resume_co.gif
new file mode 100644
index 0000000..8652797
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dlcl16/resume_co.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dlcl16/sethitcount_co.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dlcl16/sethitcount_co.gif
new file mode 100644
index 0000000..9b468bb
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dlcl16/sethitcount_co.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dlcl16/static_co.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dlcl16/static_co.gif
new file mode 100644
index 0000000..7660151
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dlcl16/static_co.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dlcl16/suspend_co.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dlcl16/suspend_co.gif
new file mode 100644
index 0000000..e47777b
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dlcl16/suspend_co.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dlcl16/thread_view.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dlcl16/thread_view.gif
new file mode 100644
index 0000000..03ad783
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dlcl16/thread_view.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dtool16/Thumbs.db b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dtool16/Thumbs.db
new file mode 100644
index 0000000..74c4460
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dtool16/Thumbs.db
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dtool16/debug_exc.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dtool16/debug_exc.gif
new file mode 100644
index 0000000..6434db2
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dtool16/debug_exc.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dtool16/disp_sbook.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dtool16/disp_sbook.gif
new file mode 100644
index 0000000..42005c9
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dtool16/disp_sbook.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dtool16/insp_sbook.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dtool16/insp_sbook.gif
new file mode 100644
index 0000000..d460ddd
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dtool16/insp_sbook.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dtool16/java_app.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dtool16/java_app.gif
new file mode 100644
index 0000000..cde1640
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dtool16/java_app.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dtool16/java_applet.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dtool16/java_applet.gif
new file mode 100644
index 0000000..1b4b282
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dtool16/java_applet.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dtool16/java_attach.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dtool16/java_attach.gif
new file mode 100644
index 0000000..45c7532
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dtool16/java_attach.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dtool16/run_exc.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dtool16/run_exc.gif
new file mode 100644
index 0000000..a252bf0
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dtool16/run_exc.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dtool16/run_sbook.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dtool16/run_sbook.gif
new file mode 100644
index 0000000..5c8aa53
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dtool16/run_sbook.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dtool16/term_sbook.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dtool16/term_sbook.gif
new file mode 100644
index 0000000..4f3dcba
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dtool16/term_sbook.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dtool16/watch_exp.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dtool16/watch_exp.gif
new file mode 100644
index 0000000..38f60cd
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/dtool16/watch_exp.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/elcl16/Thumbs.db b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/elcl16/Thumbs.db
new file mode 100644
index 0000000..9242f76
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/elcl16/Thumbs.db
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/elcl16/constant_co.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/elcl16/constant_co.gif
new file mode 100644
index 0000000..5397588
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/elcl16/constant_co.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/elcl16/deadlock_view.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/elcl16/deadlock_view.gif
new file mode 100644
index 0000000..8e3d48a
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/elcl16/deadlock_view.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/elcl16/exc_catch.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/elcl16/exc_catch.gif
new file mode 100644
index 0000000..96de5ff
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/elcl16/exc_catch.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/elcl16/final_co.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/elcl16/final_co.gif
new file mode 100644
index 0000000..7b406f3
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/elcl16/final_co.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/elcl16/monitor_view.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/elcl16/monitor_view.gif
new file mode 100644
index 0000000..e3ecc55
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/elcl16/monitor_view.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/elcl16/resume_co.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/elcl16/resume_co.gif
new file mode 100644
index 0000000..16f4e25
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/elcl16/resume_co.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/elcl16/sethitcount_co.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/elcl16/sethitcount_co.gif
new file mode 100644
index 0000000..1132786
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/elcl16/sethitcount_co.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/elcl16/static_co.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/elcl16/static_co.gif
new file mode 100644
index 0000000..8803755
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/elcl16/static_co.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/elcl16/suspend_co.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/elcl16/suspend_co.gif
new file mode 100644
index 0000000..161e3f5
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/elcl16/suspend_co.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/elcl16/thread_view.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/elcl16/thread_view.gif
new file mode 100644
index 0000000..9ac596d
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/elcl16/thread_view.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/etool16/Thumbs.db b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/etool16/Thumbs.db
new file mode 100644
index 0000000..8183de8
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/etool16/Thumbs.db
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/etool16/debug_exc.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/etool16/debug_exc.gif
new file mode 100644
index 0000000..afe775b
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/etool16/debug_exc.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/etool16/disp_sbook.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/etool16/disp_sbook.gif
new file mode 100644
index 0000000..5dbbebf
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/etool16/disp_sbook.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/etool16/insp_sbook.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/etool16/insp_sbook.gif
new file mode 100644
index 0000000..a4548c5
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/etool16/insp_sbook.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/etool16/java_app.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/etool16/java_app.gif
new file mode 100644
index 0000000..a42a7c8
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/etool16/java_app.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/etool16/java_applet.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/etool16/java_applet.gif
new file mode 100644
index 0000000..e235b45
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/etool16/java_applet.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/etool16/java_attach.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/etool16/java_attach.gif
new file mode 100644
index 0000000..3c42f63
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/etool16/java_attach.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/etool16/run_exc.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/etool16/run_exc.gif
new file mode 100644
index 0000000..57f4102
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/etool16/run_exc.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/etool16/run_sbook.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/etool16/run_sbook.gif
new file mode 100644
index 0000000..ffcef16
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/etool16/run_sbook.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/etool16/term_sbook.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/etool16/term_sbook.gif
new file mode 100644
index 0000000..69c31f4
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/etool16/term_sbook.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/etool16/watch_exp.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/etool16/watch_exp.gif
new file mode 100644
index 0000000..d37495a
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/etool16/watch_exp.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/eview16/Thumbs.db b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/eview16/Thumbs.db
new file mode 100644
index 0000000..868d942
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/eview16/Thumbs.db
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/eview16/thread_and_monitor_view.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/eview16/thread_and_monitor_view.gif
new file mode 100644
index 0000000..0a1fa96
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/eview16/thread_and_monitor_view.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/eview16/variable_tab.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/eview16/variable_tab.gif
new file mode 100644
index 0000000..e35f594
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/eview16/variable_tab.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/Thumbs.db b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/Thumbs.db
new file mode 100644
index 0000000..8868810
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/Thumbs.db
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/brkpi_obj.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/brkpi_obj.gif
new file mode 100644
index 0000000..21036fe
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/brkpi_obj.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/class_obj.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/class_obj.gif
new file mode 100644
index 0000000..e4c2a83
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/class_obj.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/classpath_obj.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/classpath_obj.gif
new file mode 100644
index 0000000..671f1b5
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/classpath_obj.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/contended_monitor_obj.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/contended_monitor_obj.gif
new file mode 100644
index 0000000..7758fc5
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/contended_monitor_obj.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/envvar_obj.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/envvar_obj.gif
new file mode 100644
index 0000000..bf043f9
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/envvar_obj.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/insp_sbook.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/insp_sbook.gif
new file mode 100644
index 0000000..d8d7fad
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/insp_sbook.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/jar_obj.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/jar_obj.gif
new file mode 100644
index 0000000..2fa1d77
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/jar_obj.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/jexcept_obj.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/jexcept_obj.gif
new file mode 100644
index 0000000..812a927
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/jexcept_obj.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/jexception_obj.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/jexception_obj.gif
new file mode 100644
index 0000000..f72a715
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/jexception_obj.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/jexceptiond_obj.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/jexceptiond_obj.gif
new file mode 100644
index 0000000..4c28e7c
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/jexceptiond_obj.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/jline_obj.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/jline_obj.gif
new file mode 100644
index 0000000..5456ce2
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/jline_obj.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/jload_obj.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/jload_obj.gif
new file mode 100644
index 0000000..8c64db6
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/jload_obj.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/jmeth_obj.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/jmeth_obj.gif
new file mode 100644
index 0000000..8d1142a
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/jmeth_obj.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/jrtexception_obj.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/jrtexception_obj.gif
new file mode 100644
index 0000000..3b3028e
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/jrtexception_obj.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/jsbook_obj.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/jsbook_obj.gif
new file mode 100644
index 0000000..772b363
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/jsbook_obj.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/jsbook_run_obj.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/jsbook_run_obj.gif
new file mode 100644
index 0000000..8f7d005
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/jsbook_run_obj.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/jspbrkpt_obj.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/jspbrkpt_obj.gif
new file mode 100644
index 0000000..1f4ec30
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/jspbrkpt_obj.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/jwatch_obj.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/jwatch_obj.gif
new file mode 100644
index 0000000..7d1ece1
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/jwatch_obj.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/library_obj.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/library_obj.gif
new file mode 100644
index 0000000..cb55e33
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/library_obj.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/localvariable_obj.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/localvariable_obj.gif
new file mode 100644
index 0000000..3244b26
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/localvariable_obj.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/monitor_obj.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/monitor_obj.gif
new file mode 100644
index 0000000..e3ecc55
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/monitor_obj.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/owned_monitor_obj.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/owned_monitor_obj.gif
new file mode 100644
index 0000000..57fb95e
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/owned_monitor_obj.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/package_obj.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/package_obj.gif
new file mode 100644
index 0000000..131c28d
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/package_obj.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/prj_obj.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/prj_obj.gif
new file mode 100644
index 0000000..a4ea580
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/prj_obj.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/thread_and_monitor_obj.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/thread_and_monitor_obj.gif
new file mode 100644
index 0000000..e7ec2a1
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/thread_and_monitor_obj.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/thread_obj.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/thread_obj.gif
new file mode 100644
index 0000000..b8ca14a
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/thread_obj.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/threadgroup_obj.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/threadgroup_obj.gif
new file mode 100644
index 0000000..18ffabe
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/obj16/threadgroup_obj.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/Thumbs.db b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/Thumbs.db
new file mode 100644
index 0000000..c05ac0e
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/Thumbs.db
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/caught_ovr.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/caught_ovr.gif
new file mode 100644
index 0000000..02de6e8
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/caught_ovr.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/caught_ovr_disabled.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/caught_ovr_disabled.gif
new file mode 100644
index 0000000..73d6454
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/caught_ovr_disabled.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/conditional_ovr.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/conditional_ovr.gif
new file mode 100644
index 0000000..de7a274
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/conditional_ovr.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/conditional_ovr_disabled.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/conditional_ovr_disabled.gif
new file mode 100644
index 0000000..81f44c8
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/conditional_ovr_disabled.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/contention_ovr.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/contention_ovr.gif
new file mode 100644
index 0000000..d83704b
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/contention_ovr.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/contentionformonitor_ovr.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/contentionformonitor_ovr.gif
new file mode 100644
index 0000000..c59c8f8
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/contentionformonitor_ovr.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/deadlock_ovr.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/deadlock_ovr.gif
new file mode 100644
index 0000000..4499ad0
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/deadlock_ovr.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/entry_ovr.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/entry_ovr.gif
new file mode 100644
index 0000000..f35215a
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/entry_ovr.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/entry_ovr_disabled.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/entry_ovr_disabled.gif
new file mode 100644
index 0000000..c3c0be9
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/entry_ovr_disabled.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/error_co.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/error_co.gif
new file mode 100644
index 0000000..119dccc
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/error_co.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/exit_ovr.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/exit_ovr.gif
new file mode 100644
index 0000000..a1f28ad
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/exit_ovr.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/exit_ovr_disabled.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/exit_ovr_disabled.gif
new file mode 100644
index 0000000..98fc222
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/exit_ovr_disabled.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/installed_ovr.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/installed_ovr.gif
new file mode 100644
index 0000000..0e6b414
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/installed_ovr.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/installed_ovr_disabled.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/installed_ovr_disabled.gif
new file mode 100644
index 0000000..c276ace
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/installed_ovr_disabled.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/owned_ovr.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/owned_ovr.gif
new file mode 100644
index 0000000..ef582a5
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/owned_ovr.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/ownsmonitor_ovr.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/ownsmonitor_ovr.gif
new file mode 100644
index 0000000..29dc4b2
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/ownsmonitor_ovr.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/scoped_ovr.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/scoped_ovr.gif
new file mode 100644
index 0000000..5b97523
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/scoped_ovr.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/scoped_ovr_disabled.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/scoped_ovr_disabled.gif
new file mode 100644
index 0000000..50d9082
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/scoped_ovr_disabled.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/sync_ovr.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/sync_ovr.gif
new file mode 100644
index 0000000..5893bda
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/sync_ovr.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/uncaught_ovr.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/uncaught_ovr.gif
new file mode 100644
index 0000000..6c06996
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/uncaught_ovr.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/uncaught_ovr_disabled.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/uncaught_ovr_disabled.gif
new file mode 100644
index 0000000..a631734
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/uncaught_ovr_disabled.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/warning_co.gif b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/warning_co.gif
new file mode 100644
index 0000000..ee2dac4
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/ovr16/warning_co.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/wizban/Thumbs.db b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/wizban/Thumbs.db
new file mode 100644
index 0000000..893632c
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/wizban/Thumbs.db
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/wizban/java_app_wiz.png b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/wizban/java_app_wiz.png
new file mode 100644
index 0000000..d2ebfe3
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/wizban/java_app_wiz.png
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/wizban/java_attach_wiz.png b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/wizban/java_attach_wiz.png
new file mode 100644
index 0000000..3ec71ff
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/wizban/java_attach_wiz.png
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/wizban/library_wiz.png b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/wizban/library_wiz.png
new file mode 100644
index 0000000..705dc30
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/wizban/library_wiz.png
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/icons/full/wizban/newsbook_wiz.png b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/wizban/newsbook_wiz.png
new file mode 100644
index 0000000..db5c70c
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/icons/full/wizban/newsbook_wiz.png
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/plugin.properties b/core/plugins/org.eclipse.dltk.debug.ui/plugin.properties
new file mode 100644
index 0000000..8ee108a
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/plugin.properties
@@ -0,0 +1,342 @@
+pluginProvider=Eclipse.org
+pluginName=Dynamic Languages Toolkit Debug UI
+
+accessAction.label=&Access
+BreakpointsView.name=Breakpoints
+ConsoleColorProvidersExtensionName= Console Color Providers
+ConsoleFont.description= The font used by the debug console.
+ConsoleFont.label= Console font
+ConsoleLineTrackersExtensionName= Console Line Trackers
+LaunchingPreferencePage.name=Launching
+ViewManagementPreferencePage.name=View Management
+ConsolePreferencePage.name=Console
+DebugModelContextBindingsName=Debug Model Context Bindings
+ContextViewBindingsName=Context View Bindings
+BreakpointOrganizersName=Breakpoint Organizers
+VariableValueEditorsName=Variable Value Editors
+
+BreakpointActionSet.label=Breakpoints
+CollapseAll.label=Collapse All
+CollapseAll.tooltip= Collapse All
+CopyToClipboardAction.label=&Copy Stack
+CopyVariablesToClipboardAction.label=Copy &Variables
+CopyExpressionsToClipboardAction.label=Copy &Expressions
+CopyRegistersToClipboardAction.label=Copy &Registers
+DebugActionSet.label=Debug
+debugCurrentInstructionPointer=Debug Current Instruction Pointer
+debugCallStack=Debug Call Stack
+DebugDropDownAction.label=Debug
+DebugHistoryMenuAction.label=Debug &History
+DebugLastAction.label=&Debug Last Launched
+DebugLaunchGroup.label=Debu&g
+DebugLaunchGroup.title=Select or configure an application to debug
+DebugModelPresentationExtensionName=Debug Model Presentation
+
+DebugPerspective.name=Debug
+DebugPerspective.description=This Debug perspective is designed to support application debugging. It incorporates views for displaying the debug stack, variables and breakpoint management.
+
+command.openDebugPerspective.description = Open the debug perspective
+DebugPreferencePage.name=Run/Debug
+DebugView.name=Debug
+DebugViewsCategory.name=Debug
+DebugWithConfigurationAction.label=Debu&g As
+DetailPaneFontDefinition.label=Detail pane text font
+DetailPaneFontDefinition.description=The detail pane text font is used in the detail panes of debug views.
+DisableBreakpointsAction.label=&Disable
+EnableBreakpointsAction.label=&Enable
+ExpandAll.label=Expand All
+ExpandAll.tooltip=Expand All
+ExpressionView.name=Expressions
+GroupBy.label=&Group By
+GroupBy.tooltip=Show
+LinkWithDebugView.label=Link with Debug View
+LinkWithDebugView.tooltip=Link with Debug View
+LaunchActionSet.label=Launch
+LaunchConfigurationTabGroupExtensionName=Launch Configuration Tab Group
+LaunchShortcutsName=Launch Shortcut
+LaunchConfigurationTypeImageExtensionName=Launch Configuration Type Image
+LaunchGroupsExtensionName=Launch Groups
+modificationAction.label=&Modification
+OpenDebugConfigurations.label=De&bug...
+OpenRunConfigurations.label=Ru&n...
+OpenProfileConfigurations.label=&Profile...
+processPropertyPageName=Process Information
+ProfileLaunchGroup.label=&Profile
+ProfileLaunchGroup.title=Select or configure an application to profile
+ProfileDropDownAction.label=Profile
+ProfileWithConfigurationAction.label=Pro&file As
+ProfileHistoryMenuAction.label=Profile Histor&y
+ProfileLastAction.label=Profi&le Last Launched
+ProfileActionSet.label=Profile
+RegistersView.name=Registers
+RelaunchAction.label=Re&launch
+RemoveAction.label=Rem&ove
+RemoveAllAction.label=Remove A&ll
+RemoveAllBreakpointsAction.label=Remo&ve All Breakpoints
+RemoveAllBreakpointsAction.tooltip=Remove All Breakpoints
+RemoveAllExpressionsAction.tooltip=Remove All Expressions
+RemoveAllTerminatedAction.label=Remove &All Terminated
+RemoveAllTerminatedAction.tooltip=Remove All Terminated Launches
+RemoveBreakpointAction.tooltip=Remove Selected Breakpoints
+RemoveExpressionAction.tooltip=Remove Selected Expressions
+ResumeAction.label=Resu&me
+RunDropDownAction.label=&Run
+RunMenu.label=&Run
+RunLastAction.label=&Run Last Launched
+RunLaunchGroup.label=Ru&n
+RunLaunchGroup.title=Select or configure an application to run
+RunHistoryMenuAction.label=Run His&tory
+RunWithConfigurationAction.label=Run A&s
+RunToLine.label=Run to &Line
+SelectAll.label=Select &All
+StepWithFiltersAction.label=Use Step &Filters
+StepWithFiltersAction.tooltip=Use Step Filters/Step Debug
+StepIntoAction.label=Step &Into
+StepOverAction.label=Step &Over
+StepReturnAction.label=Step Ret&urn
+StringVariablePresentationsName=String Variable Presentations
+SuspendAction.label=&Suspend
+TerminateAction.label=&Terminate
+ToggleBreakpointAction.label=Toggle Line Brea&kpoint
+ToggleMethodBreakpointAction.label=Toggle &Method Breakpoint
+ToggleWatchpointAction.label=Toggle &Watchpoint
+VariablesView.name=Variables
+StringVariablePreferencePage.name=String Substitution
+ToggleMemoryMonitorsPaneAction.name = Toggle Memory Monitors Pane
+ToggleSplitPaneAction.name = Toggle Split Pane
+LinkRenderingPanesAction.name = Link Memory Rendering Panes
+AddRemoveRenderingMenu.name = Add/Remove Rendering
+AddRenderingAction.name = Add Rendering
+RemoveRenderingAction.name = Remove Rendering
+PerspectivePreferencePage.name = Perspectives
+LaunchConfigurationsPage.name = Launch Configurations
+
+#string substitution variables
+string_prompt.description=Returns the text value entered into a prompt dialog. When one argument is provided, it is used as a prompt hint on the input dialog. When a second argument is provided, it is used as an initial value in the input dialog. The first and second arguments must be separated with a ':'.
+file_prompt.description=Returns the absolute file system path of a file chosen in a file selection dialog. When one argument is provided, it is used a prompt hint on the dialog title. When a second argument is provided, it is used as an initial value for the file selection dialog. The first and second arguments must be separated with a ':'.
+folder_prompt.description=Returns the absolute file system path of a directory chosen in a directory selection dialog. When one argument is provided, it is used a prompt hint on the dialog title. When a second argument is provided, it is used as an initial value for the directory selection dialog. The first and second arguments must be separated with a ':'.
+container_loc.description=Returns the absolute file system path of a resource's container. The target resource is the selected resource when no argument is specified, or the resource identified by a workspace relative path.
+container_path.description=Returns the workspace relative path of a resource's container. The target resource is the selected resource when no argument is specified, or the resource identified by a workspace relative path.
+container_name.description=Returns the name of a resource's container. The target resource is the selected resource when no argument is specified, or the resource identified by a workspace relative path.
+project_loc.description=Returns the absolute file system path of a resource's project. The target resource is the selected resource when no argument is specified, or the resource identified by a workspace relative path.
+project_path.description=Returns the workspace relative path of a resource's project. The target resource is the selected resource when no argument is specified, or the resource identified by a workspace relative path.
+project_name.description=Returns the name of a resource's project. The target resource is the selected resource when no argument is specified, or the resource identified by a workspace relative path.
+resource_loc.description=Returns the absolute file system path of a resource. The target resource is the selected resource when no argument is specified, or the resource identified by a workspace relative path.
+resource_path.description=Returns the workspace relative path of a resource. The target resource is the selected resource when no argument is specified, or the resource identified by a workspace relative path.
+resource_name.description=Returns the name of a resource. The target resource is the selected resource when no argument is specified, or the resource identified by a workspace relative path.
+workspace_loc.description=Returns the absolute file system path of the workspace root. When an argument is specified, the absolute file system path of the resource identified by a workspace relative path is returned.
+selected_text.description=Returns the text currently selected in the active editor.
+
+pluginProvider=Eclipse.org
+
+runCategory.name= Run/Debug
+runCategory.description= Run/Debug command category
+
+NoSourceFoundEditor.name= No Source Found
+
+DetailPaneWordWrapAction.label=&Wrap Text in Details Pane
+DetailPaneWordWrapAction.tooltip=Wrap text in the Details pane
+DetailPaneMaxLengthAction.label=&Detail Pane...
+DetailPaneMaxLengthAction.tooltip=Configure detail pane settings
+
+Context.debugging.description= Debugging Programs
+Context.debugging.name= Debugging
+
+Context.console.description= In Console
+Context.console.name= In Console
+
+Context.memoryview.description = In Memory View
+Context.memoryview.name = In Memory View
+
+ActionDefinition.eof.name= EOF
+ActionDefinition.eof.description= Send end of file
+
+ActionDefinition.addMemoryBlock.name= Add Memory Block
+ActionDefinition.addMemoryBlock.description=Add Memory block
+
+ActionDefinition.toggleStepFilters.name= Toggle Step Filters
+ActionDefinition.toggleStepFilters.description= Toggles enablement of debug step filters
+
+ActionDefinition.stepInto.name= Step Into
+ActionDefinition.stepInto.description= Step into
+
+ActionDefinition.stepOver.name= Step Over
+ActionDefinition.stepOver.description= Step over
+
+ActionDefinition.stepReturn.name= Step Return
+ActionDefinition.stepReturn.description= Step return
+
+ActionDefinition.resume.name=Resume
+ActionDefinition.resume.description=Resume
+
+
+ActionDefinition.runToLine.name=Run to Line
+ActionDefinition.runToLine.description=Resume and break when execution reaches the current line
+
+ActionDefinition.terminate.name=Terminate
+ActionDefinition.terminate.description=Terminate
+
+ActionDefinition.terminateAndRelaunch.name=Terminate and Relaunch
+ActionDefinition.terminateAndRelaunch.description=Terminate and Relaunch
+
+ActionDefinition.toggleBreakpoint.name=Toggle Line Breakpoint
+ActionDefinition.toggleBreakpoint.description=Creates or removes a line breakpoint
+
+ActionDefinition.suspend.name=Suspend
+ActionDefinition.suspend.description=Suspend
+
+ActionDefinition.openProfile.name=Profile...
+ActionDefinition.openProfile.description=Open profile launch configuration dialog
+
+ActionDefinition.profileLast.name=Profile Last Launched
+ActionDefinition.profileLast.description=Profile the last launch in profile mode
+
+ActionDefinition.openRun.name=Run...
+ActionDefinition.openRun.description=Open run launch configuration dialog
+
+ActionDefinition.debugLast.name=Debug Last Launched
+ActionDefinition.debugLast.description=Debug the last launch in debug mode
+
+ActionDefinition.runLast.name=Run Last Launched
+ActionDefinition.runLast.description=Relaunch the last launch in run mode
+
+ActionDefinition.openDebug.name=Debug...
+ActionDefinition.openDebug.description=Open debug launch configuration dialog
+
+
+ActionDefinition.toggleWatchpoint.name=Toggle Watchpoint
+ActionDefinition.toggleWatchpoint.description=Creates or removes a watchpoint
+
+ActionDefinition.toggleMethodBreakpoint.name=Toggle Method Breakpoint
+ActionDefinition.toggleMethodBreakpoint.description=Creates or removes a method breakpoint
+
+ActionDefinition.removeAllBreakpoints.name=Remove All Breakpoints
+ActionDefinition.removeAllBreakpoints.description=Removes all breakpoints
+
+ActionDefinition.skipAllBreakpoints.name=Skip All Breakpoints
+ActionDefinition.skipAllBreakpoints.description=Sets whether or not any breakpoint should suspend execution
+
+ViewCommand.debugView.name=Debug
+ViewCommand.debugView.description=Show the Debug view
+
+ViewCommand.breakpointView.name=Breakpoints
+ViewCommand.breakpointView.description=Show the Breakpoints view
+
+ViewCommand.variableView.name=Variables
+ViewCommand.variableView.description=Show the Variables view
+
+ViewCommand.expressionView.name=Expressions
+ViewCommand.expressionView.description=Show the Expressions view
+
+ViewCommand.registerView.name=Registers
+ViewCommand.registerView.description=Show the Registers view
+
+ViewCommand.memoryView.name=Memory
+ViewCommand.memoryView.description=Show the Memory view
+
+SkipAllBreakpointsAction.label=S&kip All Breakpoints
+editWatchExpressionAction.label=&Edit Watch Expression...
+editWatchExpressionAction.tooltip=Edit the selected watch expression
+reevaluateWatchExpressionAction.label=&Reevaluate Watch Expression
+reevaluateWatchExpressionAction.tooltip=Reevaluate the watch expression in the selected stack frame
+addWatchExpressionAction.label=&Add Watch Expression...
+addWatchExpressionAction.tooltip=Create a new watch expression
+convertToWatchExpressionAction.label=Convert to &Watch Expression
+convertToWatchExpressionAction.tooltip=Convert an inspect expression to a watch expression
+Watch.label=Create Wa&tch Expression
+
+enableWatchExpressionAction.label=Enable
+enableWatchExpressionAction.tooltip=Enable watch expression
+
+disableWatchExpressionAction.label=Disable
+disableWatchExpressionAction.tooltip=Disable watch expression
+
+BreakpointMarkerPreference.label= Breakpoints
+
+SourceContainerPresentationsName = Source Container Presentations
+
+DebugContextMenu.label=&Debug As
+RunContextMenu.label=&Run As
+ProfileContextMenu.label=&Profile As
+
+containerName.workingSet = Working set
+sourceNotFoundEditorName=Source Not Found Editor
+
+debugPresentation.label= Debug
+
+MemoryViewName = Memory
+
+MemoryViewTableFontDefinition.label=Memory view table font
+MemoryViewTableFontDefinition.description=The font used in the table of the memory view.
+
+RawHex = Hex
+ASCIIName = ASCII
+SignedIntegerName = Signed Integer
+UnsignedIntegerName = Unsigned Integer
+Endianess = Endianess
+BigEndianActionName = Big Endian
+LittleEndianActionName = Little Endian
+RestoreDefEndianessActionName = Restore Default
+
+ViewManagementAction.label=&View Management...
+
+setDefaultGroup.label=&Select Default Working Set...
+setDefaultGroup.tooltip=Select Default Working Set
+clearDefaultGroup.label=&Deselect Default Working Set
+clearDefaultGroup.tooltip=Deselect Default Working Set
+workingSets.label=&Working Sets...
+workingSets.tooltip=Manage Working Sets
+
+editGroup.label=&Edit Working Set...
+ToggleDefault.label=Defaul&t Working Set
+
+Project.label=Projects
+Project.others=Others (no project)
+File.label=Files
+File.others=Others (no file)
+BreakpointType.label=Breakpoint Types
+BreakpointType.others=Others (type unspecified)
+WorkingSet.label=Resource Working Sets
+WorkingSet.others=Others (no working set)
+BreakpointWorkingSet.label=Breakpoint Working Sets
+BreakpointWorkingSet.others=Others (no working set)
+BreakpointWorkingSet.name=Breakpoint
+
+memoryRenderingsExtensionPointName = Memory Renderings
+TableRenderingPrefActionName = &Table Renderings Preferences...
+
+
+NewMemoryViewAction.label=New Memory View
+PinMemoryBlockAction.label=Pin Memory Monitor
+TableRenderingInfo.label = Rendering Selection
+
+preferenceKeywords.general=run debug breakpoints variables color
+preferenceKeywords.console=console stdout stderr color
+preferenceKeywords.launching=launching build
+preferenceKeywords.stringSubstitution=variables
+preferenceKeywords.viewManagement=views
+preferenceKeywords.perspective=perspectives switching assign automatic run debug
+preferenceKeywords.launchConfigurations=filters launch migration configurations run debug
+
+
+exportBreakpoints.label=E&xport Breakpoints...
+importBreakpoints.label=I&mport Breakpoints...
+exportBreakpoints.name=Breakpoints
+importBreakpoints.description=Import breakpoints from the local file system.
+exportBreakpoints.description=Export breakpoints to the local file system.
+
+switchMemoryBlock.label = Switch &Memory Monitor
+toggleMemoryMonitorsPane.label = Toggle Memory Monitors Pane
+toggleMemoryMonitorsPane.description = Toggle visibility of the Memory Monitors Pane
+nextMemoryBlockCommand.label = Next Memory Monitor
+nextMemoryBlockCommand.description = Show renderings from next memory monitor.
+memoryViewPrefAction.label = &Preferences...
+resetMemoryMonitorAction.label = &Reset
+
+ConsolePreferencesAction.label = &Preferences...
+ConsolePreferencesAction.tooltip = Opens the console's Preferences Page
+
+command.description.0 = Go to Address
+command.name.0 = Go to Address
+context.description.0 = In Table Memory Rendering
+context.name.0 = In Table MemoryRendering
\ No newline at end of file
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/plugin.xml b/core/plugins/org.eclipse.dltk.debug.ui/plugin.xml
new file mode 100644
index 0000000..fadda6b
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/plugin.xml
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+
+<!-- Extensions Points -->
+ <extension-point id="interpreterInstallTypePage" name="%interpreterInstallTypePage" schema="schema/interpreterInstallTypePage.exsd"/>
+
+<!-- Extensions -->
+
+ <extension
+ point="org.eclipse.ui.actionSetPartAssociations">
+ <actionSetPartAssociation
+ targetID="org.eclipse.debug.ui.launchActionSet">
+ <part
+ id="org.eclipse.dltk.ui.ScriptExplorer">
+ </part>
+ </actionSetPartAssociation>
+ <actionSetPartAssociation
+ targetID="org.eclipse.dltk.debug.ui.DLTKDebugActionSet">
+ <part
+ id="org.eclipse.dltk.ui.ScriptExplorer">
+ </part>
+ </actionSetPartAssociation>
+ </extension>
+ <!-- Adapters for contextual launch -->
+ <extension point="org.eclipse.core.runtime.adapters">
+ <factory
+ class=""
+ adaptableType="org.eclipse.dltk.core.IModelElement">
+ <adapter type="org.eclipse.debug.ui.actions.ILaunchable"/>
+ </factory>
+ <factory
+ class=""
+ adaptableType="org.eclipse.core.resources.IResource">
+ <adapter type="org.eclipse.debug.ui.actions.ILaunchable"/>
+ </factory>
+ <factory
+ class=""
+ adaptableType="org.eclipse.dltk.internal.ui.editor.ExternalStorageEditorInput">
+ <adapter type="org.eclipse.debug.ui.actions.ILaunchable"/>
+ </factory>
+ <factory
+ adaptableType="org.eclipse.dltk.internal.ui.editor.DLTKEditor"
+ class="org.eclipse.dltk.internal.debug.ui.DltkRetargettableActionAdapterFactory">
+ <adapter type="org.eclipse.debug.ui.actions.IToggleBreakpointsTarget"/>
+ <adapter
+ type="org.eclipse.debug.ui.actions.IRunToLineTarget">
+ </adapter>
+ </factory>
+ </extension>
+ <extension
+ point="org.eclipse.ui.actionSets">
+ <actionSet
+ label="%DebugActionSet.label"
+ visible="false"
+ id="org.eclipse.dltk.debug.ui.DLTKDebugActionSet">
+ <menu
+ label="%RunMenu.label"
+ path="additions"
+ id="org.eclipse.ui.run">
+ <separator
+ name="dltkGroup">
+ </separator>
+ </menu>
+ </actionSet>
+ </extension>
+ <extension
+ point="org.eclipse.ui.propertyPages">
+ <page
+ class="org.eclipse.dltk.debug.ui.ScriptBreakpointPropertyPage"
+ id="org.eclipse.dltk.debug.ui.ScriptBreakpointPropertyPage"
+ name="Breakpoint properties"
+ objectClass="org.eclipse.dltk.debug.core.model.IScriptBreakpoint"/>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.contexts">
+ <context
+ name="DLTK Debugging"
+ description="DLTK Debugging description"
+ id="org.eclipse.dltk.debug.ui.debugging"
+ parentId="org.eclipse.debug.ui.debugging">
+ </context>
+ </extension>
+
+ <extension point="org.eclipse.debug.ui.debugModelContextBindings">
+ <modelContextBinding contextId="org.eclipse.dltk.debug.ui.debugging" debugModelId="org.eclipse.dltk.debug.core.model"></modelContextBinding>
+ </extension>
+
+ <extension
+ point="org.eclipse.debug.core.statusHandlers">
+ <statusHandler
+ class="org.eclipse.dltk.internal.debug.ui.DbgpServiceNotAvailableStatusHandler"
+ code="200"
+ id="org.eclipse.dltk.internal.debug.ui.DbgpServiceNotAvailableStatusHandler"
+ plugin="org.eclipse.dltk.launching">
+ </statusHandler>
+ <statusHandler
+ class="org.eclipse.dltk.internal.debug.ui.DebuggingEngineNotStartedStatusHandler"
+ code="201"
+ id="org.eclipse.dltk.internal.debug.ui.DebuggingEngineNotStartedStatusHandler"
+ plugin="org.eclipse.dltk.launching">
+ </statusHandler>
+ <statusHandler
+ class="org.eclipse.dltk.internal.debug.ui.DebuggingEngineNotConnectedStatusHandler"
+ code="202"
+ id="org.eclipse.dltk.internal.debug.ui.DebuggingEngineNotConnectedStatusHandler"
+ plugin="org.eclipse.dltk.launching">
+ </statusHandler>
+ </extension>
+ <extension
+ point="org.eclipse.ui.perspectiveExtensions">
+ <perspectiveExtension targetID="org.eclipse.debug.ui.DebugPerspective">
+ <view
+ relative="org.eclipse.debug.ui.DebugView"
+ visible="false"
+ relationship="stack"
+ id="org.eclipse.dltk.ui.ScriptExplorer">
+ </view>
+ </perspectiveExtension>
+ </extension>
+</plugin>
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/schema/interpreterInstallTypePage.exsd b/core/plugins/org.eclipse.dltk.debug.ui/schema/interpreterInstallTypePage.exsd
new file mode 100644
index 0000000..04b7baf
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/schema/interpreterInstallTypePage.exsd
@@ -0,0 +1,119 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.dltk.debug.ui">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.dltk.debug.ui" id="interpreterInstallTypePage" name="%interpreterInstallTypePage"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <choice>
+ <element ref="interpreterInstallTypePage" minOccurs="0" maxOccurs="unbounded"/>
+ </choice>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="interpreterInstallTypePage">
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="interpreterInstallTypeId" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.debug.ui.ILaunchConfigurationTab"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/BreakpointUtils.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/BreakpointUtils.java
new file mode 100644
index 0000000..b142ce7
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/BreakpointUtils.java
@@ -0,0 +1,34 @@
+package org.eclipse.dltk.debug.ui;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.model.ILineBreakpoint;
+import org.eclipse.dltk.debug.internal.core.model.ScriptDebugModel;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+public class BreakpointUtils {
+ public static void addLineBreakpoint(ITextEditor textEditor, int lineNumber)
+ throws CoreException {
+ IDocument document = textEditor.getDocumentProvider().getDocument(
+ textEditor.getEditorInput());
+
+ IResource resource = (IResource) textEditor.getEditorInput()
+ .getAdapter(IResource.class);
+ if (resource != null) {
+ try {
+ IRegion line = document.getLineInformation(lineNumber - 1);
+ int start = line.getOffset();
+ int end = start + line.getLength() - 1;
+
+ ILineBreakpoint b = ScriptDebugModel.createLineBreakpoint(
+ resource, lineNumber, start, end, 0, true, null);
+ } catch (BadLocationException e) {
+ // TODO: log exception
+ e.printStackTrace();
+ }
+ }
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/ConsoleScriptDebugTargetStreamManager.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/ConsoleScriptDebugTargetStreamManager.java
new file mode 100644
index 0000000..285d491
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/ConsoleScriptDebugTargetStreamManager.java
@@ -0,0 +1,38 @@
+package org.eclipse.dltk.debug.ui;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.eclipse.dltk.debug.internal.core.model.IScriptDebugTargetStreamManager;
+import org.eclipse.dltk.debug.internal.core.model.IScriptThreadStreamProxy;
+import org.eclipse.ui.console.IOConsole;
+
+
+public class ConsoleScriptDebugTargetStreamManager implements
+ IScriptDebugTargetStreamManager {
+ private IOConsole console;
+
+ public ConsoleScriptDebugTargetStreamManager(IOConsole console) {
+ this.console = console;
+ }
+
+ public IScriptThreadStreamProxy makeThreadStreamProxy() {
+ final InputStream input = console.getInputStream();
+ final OutputStream output = console.newOutputStream();
+
+ return new IScriptThreadStreamProxy() {
+
+ public OutputStream getStderr() {
+ return output;
+ }
+
+ public OutputStream getStdout() {
+ return output;
+ }
+
+ public InputStream getStdin() {
+ return input;
+ }
+ };
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/DLTKDebugUIPlugin.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/DLTKDebugUIPlugin.java
new file mode 100644
index 0000000..6cf6131
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/DLTKDebugUIPlugin.java
@@ -0,0 +1,297 @@
+package org.eclipse.dltk.debug.ui;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
+import org.eclipse.dltk.internal.debug.ui.ImageDescriptorRegistry;
+import org.eclipse.dltk.internal.debug.ui.ScriptDebugOptionsManager;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.preference.IPreferenceNode;
+import org.eclipse.jface.preference.IPreferencePage;
+import org.eclipse.jface.preference.PreferenceDialog;
+import org.eclipse.jface.preference.PreferenceManager;
+import org.eclipse.jface.preference.PreferenceNode;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class DLTKDebugUIPlugin extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.dltk.debug.ui";
+
+ private ImageDescriptorRegistry fImageDescriptorRegistry;
+
+ // The shared instance
+ private static DLTKDebugUIPlugin plugin;
+
+ // Map of InterpreterInstallTypeIDs to IConfigurationElements
+ protected Map fInterpreterInstallTypePageMap;
+
+ /**
+ * Whether this plugin is in the process of shutting
+ * down.
+ */
+ private boolean fShuttingDown= false;
+
+ // private Object fUtilPresentation;
+
+ /**
+ * Returns the image descriptor registry used for this plugin.
+ */
+ public static ImageDescriptorRegistry getImageDescriptorRegistry() {
+ if (getDefault().fImageDescriptorRegistry == null) {
+ getDefault().fImageDescriptorRegistry = new ImageDescriptorRegistry();
+ }
+ return getDefault().fImageDescriptorRegistry;
+ }
+
+ public DLTKDebugUIPlugin() {
+ plugin = this;
+ }
+
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+
+ ILaunchManager launchManager = DebugPlugin.getDefault()
+ .getLaunchManager();
+ launchManager.addLaunchListener(DebugConsoleManager.getInstance());
+
+ ScriptDebugOptionsManager.getDefault().startup();
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ try {
+ setShuttingDown(true);
+ ScriptDebugOptionsManager.getDefault().shutdown();
+ ILaunchManager launchManager = DebugPlugin.getDefault()
+ .getLaunchManager();
+ launchManager.removeLaunchListener(DebugConsoleManager
+ .getInstance());
+ } finally {
+ super.stop(context);
+ }
+ }
+ /**
+ * Returns whether this plug-in is in the process of
+ * being shutdown.
+ *
+ * @return whether this plug-in is in the process of
+ * being shutdown
+ */
+ public boolean isShuttingDown() {
+ return fShuttingDown;
+ }
+
+ private void setShuttingDown(boolean value) {
+ this.fShuttingDown = value;
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static DLTKDebugUIPlugin getDefault() {
+ return plugin;
+ }
+
+ // UI
+ /**
+ * Returns the active workbench window
+ *
+ * @return the active workbench window
+ */
+ public static IWorkbenchWindow getActiveWorkbenchWindow() {
+ return getDefault().getWorkbench().getActiveWorkbenchWindow();
+ }
+
+ /**
+ * Returns the active workbench shell or <code>null</code> if none
+ *
+ * @return the active workbench shell or <code>null</code> if none
+ */
+ public static Shell getActiveWorkbenchShell() {
+ IWorkbenchWindow window = getActiveWorkbenchWindow();
+ if (window != null) {
+ return window.getShell();
+ }
+ return null;
+ }
+
+ /**
+ * Returns the standard display to be used. The method first checks, if the
+ * thread calling this method has an associated display. If so, this display
+ * is returned. Otherwise the method returns the default display.
+ */
+ public static Display getStandardDisplay() {
+ Display display;
+ display = Display.getCurrent();
+ if (display == null)
+ display = Display.getDefault();
+ return display;
+ }
+
+ /**
+ * Convenience method which returns the unique identifier of this plugin.
+ */
+ public static String getUniqueIdentifier() {
+ return PLUGIN_ID;
+ }
+
+ /**
+ * Displays the given preference page.
+ *
+ * @param id
+ * pref page id
+ * @param page
+ * pref page
+ */
+ public static void showPreferencePage(String id, IPreferencePage page) {
+ final IPreferenceNode targetNode = new PreferenceNode(id, page);
+
+ PreferenceManager manager = new PreferenceManager();
+ manager.addToRoot(targetNode);
+ final PreferenceDialog dialog = new PreferenceDialog(DLTKDebugUIPlugin
+ .getActiveWorkbenchShell(), manager);
+ final boolean[] result = new boolean[] { false };
+ BusyIndicator.showWhile(DLTKDebugUIPlugin.getStandardDisplay(),
+ new Runnable() {
+ public void run() {
+ dialog.create();
+ dialog.setMessage(targetNode.getLabelText());
+ result[0] = (dialog.open() == Window.OK);
+ }
+ });
+ }
+
+ /**
+ * Logs the specified status with this plug-in's log.
+ *
+ * @param status
+ * status to log
+ */
+ public static void log(IStatus status) {
+ getDefault().getLog().log(status);
+ }
+
+ /**
+ * Logs an internal error with the specified message.
+ *
+ * @param message
+ * the error message to log
+ */
+ public static void logErrorMessage(String message) {
+ log(new Status(IStatus.ERROR, getUniqueIdentifier(),
+ IDLTKDebugUIConstants.INTERNAL_ERROR, message, null));
+ }
+
+ /**
+ * Logs an internal error with the specified throwable
+ *
+ * @param e
+ * the exception to be logged
+ */
+ public static void log(Throwable e) {
+ log(new Status(IStatus.ERROR, getUniqueIdentifier(),
+ IDLTKDebugUIConstants.INTERNAL_ERROR, "Internal error", e));
+ }
+
+ public static void errorDialog(String message, IStatus status) {
+ log(status);
+ Shell shell = getActiveWorkbenchShell();
+ if (shell != null) {
+ ErrorDialog
+ .openError(shell,
+ "DebugUIMessages.JDIDebugUIPlugin_Error_1",
+ message, status);
+ }
+ }
+
+ /**
+ * Utility method with conventions
+ */
+ public static void errorDialog(String message, Throwable t) {
+ log(t);
+ Shell shell = getActiveWorkbenchShell();
+ if (shell != null) {
+ IStatus status = new Status(IStatus.ERROR, getUniqueIdentifier(),
+ IDLTKDebugUIConstants.INTERNAL_ERROR,
+ "Error logged from DLTK Debug UI: ", t); //$NON-NLS-1$
+ ErrorDialog
+ .openError(shell,
+ "DebugUIMessages.JDIDebugUIPlugin_Error_1",
+ message, status);
+ }
+ }
+
+ /**
+ * Return an object that implements <code>ILaunchConfigurationTab</code>
+ * for the specified Interpreter install type ID.
+ */
+ public ILaunchConfigurationTab getInterpreterInstallTypePage(
+ String InterpreterInstallTypeID) {
+ if (fInterpreterInstallTypePageMap == null) {
+ initializeInterpreterInstallTypePageMap();
+ }
+ IConfigurationElement configElement = (IConfigurationElement) fInterpreterInstallTypePageMap
+ .get(InterpreterInstallTypeID);
+ ILaunchConfigurationTab tab = null;
+ if (configElement != null) {
+ try {
+ tab = (ILaunchConfigurationTab) configElement
+ .createExecutableExtension("class"); //$NON-NLS-1$
+ } catch (CoreException ce) {
+ log(new Status(
+ IStatus.ERROR,
+ getUniqueIdentifier(),
+ IDLTKDebugUIConstants.INTERNAL_ERROR,
+ "DebugUIMessages.JDIDebugUIPlugin_An_error_occurred_retrieving_a_InterpreterInstallType_page_1",
+ ce));
+ }
+ }
+ return tab;
+ }
+
+ protected void initializeInterpreterInstallTypePageMap() {
+ fInterpreterInstallTypePageMap = new HashMap(10);
+
+ IExtensionPoint extensionPoint = Platform
+ .getExtensionRegistry()
+ .getExtensionPoint(
+ getUniqueIdentifier(),
+ IDLTKDebugUIConstants.EXTENSION_POINT_INTERPRETER_INSTALL_TYPE_PAGE);
+ IConfigurationElement[] infos = extensionPoint
+ .getConfigurationElements();
+ for (int i = 0; i < infos.length; i++) {
+ String id = infos[i].getAttribute("interpreterInstallTypeID"); //$NON-NLS-1$
+ fInterpreterInstallTypePageMap.put(id, infos[i]);
+ }
+ }
+
+ public static IWorkbenchPage getActivePage() {
+ IWorkbenchWindow w = getActiveWorkbenchWindow();
+ if (w != null) {
+ return w.getActivePage();
+ }
+ return null;
+ }
+
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/DebugConsoleManager.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/DebugConsoleManager.java
new file mode 100644
index 0000000..9aaf0a5
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/DebugConsoleManager.java
@@ -0,0 +1,89 @@
+package org.eclipse.dltk.debug.ui;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchListener;
+import org.eclipse.dltk.debug.core.model.IScriptDebugTarget;
+import org.eclipse.ui.console.ConsolePlugin;
+import org.eclipse.ui.console.IConsole;
+import org.eclipse.ui.console.IConsoleManager;
+import org.eclipse.ui.console.IOConsole;
+
+public class DebugConsoleManager implements ILaunchListener {
+
+ private static DebugConsoleManager instance;
+
+ public static DebugConsoleManager getInstance() {
+ if (instance == null) {
+ instance = new DebugConsoleManager();
+ }
+
+ return instance;
+ }
+
+ private Map launchToConsoleMap;
+
+ protected boolean testLaunch(ILaunch launch) {
+ return launch != null;
+ }
+
+ protected IOConsole createConsole(String name) {
+ IOConsole console = new IOConsole(name, null);
+
+ IConsoleManager manager = ConsolePlugin.getDefault()
+ .getConsoleManager();
+ manager.addConsoles(new IConsole[] { console });
+ manager.showConsoleView(console);
+ return console;
+ }
+
+ protected void destroyConsole(IOConsole console) {
+ IConsoleManager manager = ConsolePlugin.getDefault()
+ .getConsoleManager();
+ manager.removeConsoles(new IConsole[] { console });
+ }
+
+ protected DebugConsoleManager() {
+ launchToConsoleMap = new HashMap();
+ }
+
+ public void launchAdded(ILaunch launch) {
+ if (!testLaunch(launch)) {
+ return;
+ }
+
+ launchToConsoleMap.put(launch, createConsole("Debug console"));
+ }
+
+ public void launchChanged(ILaunch launch) {
+ if (!testLaunch(launch)) {
+ return;
+ }
+
+ IScriptDebugTarget target = (IScriptDebugTarget) launch
+ .getDebugTarget();
+
+ if (target != null) {
+ IOConsole console = (IOConsole) launchToConsoleMap.get(launch);
+ if (console != null) {
+ if (target.getStreamManager() == null) {
+ ConsoleScriptDebugTargetStreamManager manager = new ConsoleScriptDebugTargetStreamManager(
+ console);
+ target.setStreamManager(manager);
+ }
+ }
+ }
+ }
+
+ public void launchRemoved(ILaunch launch) {
+ if (!testLaunch(launch)) {
+ return;
+ }
+
+ IOConsole console = (IOConsole) launchToConsoleMap.get(launch);
+ destroyConsole(console);
+ launchToConsoleMap.remove(launch);
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/IDLTKDebugUIConstants.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/IDLTKDebugUIConstants.java
new file mode 100644
index 0000000..bd5d9c7
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/IDLTKDebugUIConstants.java
@@ -0,0 +1,8 @@
+package org.eclipse.dltk.debug.ui;
+
+public interface IDLTKDebugUIConstants {
+
+ int INTERNAL_ERROR = 0;
+ String EXTENSION_POINT_INTERPRETER_INSTALL_TYPE_PAGE = "interpreterInstallTypePage";
+ //String PLUGIN_ID = "org.eclipse.dltk.debug.ui";
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/ScriptBreakpointPropertyPage.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/ScriptBreakpointPropertyPage.java
new file mode 100644
index 0000000..0724939
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/ScriptBreakpointPropertyPage.java
@@ -0,0 +1,218 @@
+package org.eclipse.dltk.debug.ui;
+
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.dltk.debug.core.model.IScriptBreakpoint;
+import org.eclipse.dltk.debug.core.model.IScriptLineBreakpoint;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.PropertyPage;
+
+public class ScriptBreakpointPropertyPage extends PropertyPage {
+
+ private Button enabledButton;
+
+ private Button hitCountButton;
+
+ private Text hitCountText;
+
+ private Combo hitConditionCombo;
+
+ protected Composite createComposite(Composite parent, int numColumns) {
+ Composite composit = new Composite(parent, SWT.NONE);
+ composit.setFont(parent.getFont());
+ GridLayout layout = new GridLayout();
+ layout.numColumns = numColumns;
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ composit.setLayout(layout);
+ composit.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ return composit;
+ }
+
+ protected Button createRadioButton(Composite parent, String text) {
+ Button button = new Button(parent, SWT.RADIO | SWT.LEFT);
+ button.setText(text);
+ button.setFont(parent.getFont());
+ button.setLayoutData(new GridData());
+ return button;
+ }
+
+ protected Button createCheckButton(Composite parent, String text) {
+ Button button = new Button(parent, SWT.CHECK | SWT.LEFT);
+ button.setText(text);
+ button.setFont(parent.getFont());
+ button.setLayoutData(new GridData());
+ return button;
+ }
+
+ protected Label createLabel(Composite parent, String text) {
+ Label label = new Label(parent, SWT.NONE);
+ label.setText(text);
+ label.setFont(parent.getFont());
+ label.setLayoutData(new GridData());
+ return label;
+ }
+
+ protected void createLabels(Composite parent) throws CoreException {
+ IScriptBreakpoint breakpoint = getBreakpoint();
+
+ Composite labelComposite = createComposite(parent, 2);
+
+ // Resource name
+ String resourceName = breakpoint.getResourceName();
+ if (resourceName != null) {
+ // File
+ createLabel(labelComposite, "File:");
+ createLabel(labelComposite, resourceName);
+
+ // Hit count
+ int hitCount = breakpoint.getHitCount();
+ createLabel(labelComposite, "Hit count:");
+ createLabel(labelComposite, hitCount == -1 ? "Not available"
+ : Integer.toString(hitCount));
+
+ }
+
+ createTypeSpecificLabels(labelComposite);
+ }
+
+ protected void createTypeSpecificLabels(Composite parent)
+ throws CoreException {
+ IScriptBreakpoint breakpoint = getBreakpoint();
+
+ // IScriptLineBreakpoint
+ if (breakpoint instanceof IScriptLineBreakpoint) {
+ IScriptLineBreakpoint b = (IScriptLineBreakpoint) breakpoint;
+
+ // Line number
+ int lineNumber = b.getLineNumber();
+ createLabel(parent, "Line Number: ");
+ createLabel(parent, Integer.toString(lineNumber));
+ }
+ }
+
+ protected void createEnabledButton(Composite parent) throws CoreException {
+ enabledButton = createCheckButton(parent, "&Enabled");
+ enabledButton.setSelection(getBreakpoint().isEnabled());
+ }
+
+ protected void createHitCountEditor(Composite parent) {
+ IScriptBreakpoint breakpoint = getBreakpoint();
+
+ // Hit composite
+ Composite hitComposite = createComposite(parent, 1);
+ hitCountButton = createCheckButton(hitComposite, "Enable hit checking");
+
+ // Hit count
+ Composite hitCountComposite = createComposite(hitComposite, 2);
+ createLabel(hitCountComposite, "Hit count:");
+ hitCountText = new Text(hitCountComposite, SWT.BORDER);
+ hitCountText.setLayoutData(new GridData());
+
+ int hitCount = breakpoint.getHitValue();
+
+ if (hitCount > 0) {
+ hitCountText.setText(Integer.toString(hitCount));
+ }
+
+ // Hit condition
+ Composite hitConditionComposite = createComposite(hitComposite, 2);
+
+ createLabel(hitConditionComposite, "Hit condition:");
+ hitConditionCombo = new Combo(hitConditionComposite, SWT.DROP_DOWN
+ | SWT.READ_ONLY);
+
+ hitConditionCombo.add("greater",
+ IScriptBreakpoint.HIT_CONDITION_GREATER);
+
+ hitConditionCombo.add("equal", IScriptBreakpoint.HIT_CONDITION_EQUAL);
+
+ hitConditionCombo.add("multiple",
+ IScriptBreakpoint.HIT_CONDITION_MULTIPLE);
+
+ int hitCondition = breakpoint.getHitCondition();
+
+ if (hitCondition > 0) {
+ hitConditionCombo.select(hitCondition);
+ } else {
+ hitConditionCombo.select(IScriptBreakpoint.HIT_CONDITION_GREATER);
+ }
+ }
+
+ protected Control createContents(Composite parent) {
+ noDefaultAndApplyButton();
+ Composite mainComposite = createComposite(parent, 1);
+
+ try {
+ createLabels(mainComposite);
+ createEnabledButton(mainComposite);
+ createHitCountEditor(mainComposite);
+ } catch (CoreException e) {
+
+ }
+
+ setValid(true);
+ return mainComposite;
+ }
+
+ protected IScriptBreakpoint getBreakpoint() {
+ return (IScriptBreakpoint) getElement();
+ }
+
+ private void storeEnabled(IScriptBreakpoint breakpoint)
+ throws CoreException {
+ boolean enabled = enabledButton.getSelection();
+ breakpoint.setEnabled(enabled);
+ }
+
+ private void storeHits(IScriptBreakpoint breakpoint)
+ throws CoreException {
+
+ if (false){
+ int hitCount = Integer.parseInt(hitCountText.getText());
+ breakpoint.setHitValue(hitCount);
+
+ int hitCondition = hitConditionCombo.getSelectionIndex();
+ breakpoint.setHitCondition(hitCondition);
+ } else {
+ breakpoint.setHitValue(-1);
+ breakpoint.setHitCondition(-1);
+ }
+ }
+
+ public boolean performOk() {
+ try {
+ ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
+ public void run(IProgressMonitor monitor) throws CoreException {
+ IScriptBreakpoint breakpoint = getBreakpoint();
+
+ storeEnabled(breakpoint);
+ storeHits(breakpoint);
+
+ DebugPlugin.getDefault().getBreakpointManager()
+ .fireBreakpointChanged(breakpoint);
+ }
+ }, null, 0, null);
+
+ } catch (CoreException e) {
+ //TODO: log exception
+ }
+
+ return super.performOk();
+ }
+
+ public boolean performCancel() {
+ return super.performCancel();
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/ScriptDebugModelPresentation.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/ScriptDebugModelPresentation.java
new file mode 100644
index 0000000..17c49a4
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/ScriptDebugModelPresentation.java
@@ -0,0 +1,178 @@
+package org.eclipse.dltk.debug.ui;
+
+import java.io.File;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.ILineBreakpoint;
+import org.eclipse.debug.core.model.IValue;
+import org.eclipse.debug.ui.IDebugModelPresentation;
+import org.eclipse.debug.ui.IValueDetailListener;
+import org.eclipse.dltk.debug.core.model.IScriptBreakpoint;
+import org.eclipse.dltk.debug.core.model.IScriptLineBreakpoint;
+import org.eclipse.dltk.debug.core.model.IScriptStackFrame;
+import org.eclipse.dltk.debug.core.model.IScriptThread;
+import org.eclipse.dltk.debug.core.model.IScriptValue;
+import org.eclipse.dltk.debug.core.model.IScriptVariable;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IPathEditorInput;
+import org.eclipse.ui.IPersistableElement;
+import org.eclipse.ui.editors.text.ILocationProvider;
+import org.eclipse.ui.part.FileEditorInput;
+
+public abstract class ScriptDebugModelPresentation extends LabelProvider
+ implements IDebugModelPresentation {
+ public static class ExternalFileEditorInput implements IPathEditorInput,
+ ILocationProvider {
+ private File file;
+
+ public ExternalFileEditorInput(File file) {
+ super();
+ this.file = file;
+ }
+
+ public boolean exists() {
+ return file.exists();
+ }
+
+ public ImageDescriptor getImageDescriptor() {
+ return null;
+ }
+
+ public String getName() {
+ return file.getName();
+ }
+
+ public IPersistableElement getPersistable() {
+ return null;
+ }
+
+ public String getToolTipText() {
+ return file.getAbsolutePath();
+ }
+
+ public Object getAdapter(Class adapter) {
+ if (ILocationProvider.class.equals(adapter))
+ return this;
+
+ return Platform.getAdapterManager().getAdapter(this, adapter);
+ }
+
+ public IPath getPath(Object element) {
+ if (element instanceof ExternalFileEditorInput) {
+ ExternalFileEditorInput input = (ExternalFileEditorInput) element;
+ return Path.fromOSString(input.file.getAbsolutePath());
+ }
+ return null;
+ }
+
+ public IPath getPath() {
+ return Path.fromOSString(file.getAbsolutePath());
+ }
+
+ public boolean equals(Object o) {
+ if (o == this)
+ return true;
+
+ if (o instanceof ExternalFileEditorInput) {
+ ExternalFileEditorInput input = (ExternalFileEditorInput) o;
+ return file.equals(input.file);
+ }
+
+ if (o instanceof IPathEditorInput) {
+ IPathEditorInput input = (IPathEditorInput) o;
+ return getPath().equals(input.getPath());
+ }
+
+ return false;
+ }
+
+ public int hashCode() {
+ return file.hashCode();
+ }
+ }
+
+ protected String getThreadText(IScriptThread thread) {
+ return thread.toString();
+ }
+
+ protected String getStackFrameText(IScriptStackFrame stackFrame) {
+ return stackFrame.toString();
+ }
+
+ protected String getVariableText(IScriptVariable variable) {
+ return variable.toString();
+ }
+
+ protected String getValueText(IScriptValue value) {
+ return value.toString();
+ }
+
+ protected String getBreakpointText(IScriptBreakpoint breakpoint) {
+ try {
+ if (breakpoint instanceof IScriptLineBreakpoint) {
+ IScriptLineBreakpoint b = (IScriptLineBreakpoint) breakpoint;
+ return b.getResourceName() + " [line: " + b.getLineNumber()
+ + "]";
+ }
+ } catch (CoreException e) {
+ // Nothing to do
+ }
+
+ return breakpoint.toString();
+ }
+
+ public String getText(Object element) {
+ if (element instanceof IScriptBreakpoint) {
+ return getBreakpointText((IScriptBreakpoint) element);
+ } else if (element instanceof IScriptThread) {
+ return getThreadText((IScriptThread) element);
+ } else if (element instanceof IScriptStackFrame) {
+ return getStackFrameText((IScriptStackFrame) element);
+ } else if (element instanceof IScriptVariable) {
+ return getVariableText((IScriptVariable) element);
+ } else if (element instanceof IScriptValue) {
+ return getValueText((IScriptValue) element);
+ }
+
+ return element.toString();
+ }
+
+ public void computeDetail(IValue value, IValueDetailListener listener) {
+ String detail = "";
+ try {
+ detail = value.getValueString();
+ } catch (DebugException e) {
+ // Nothing to do
+ }
+ listener.detailComputed(value, detail);
+ }
+
+ public void setAttribute(String attribute, Object value) {
+ }
+
+ public Image getImage(Object element) {
+ return null;
+ }
+
+ public IEditorInput getEditorInput(Object element) {
+ if (element instanceof File) {
+ return new ExternalFileEditorInput((File) element);
+ } else if (element instanceof IFile) {
+ return new FileEditorInput((IFile) element);
+ } else if (element instanceof ILineBreakpoint) {
+ return new FileEditorInput((IFile) ((ILineBreakpoint) element)
+ .getMarker().getResource());
+ }
+ return null;
+ }
+
+ public abstract String getEditorId(IEditorInput input, Object element);
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/actions/ActionMessages.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/actions/ActionMessages.java
new file mode 100644
index 0000000..74d22d6
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/actions/ActionMessages.java
@@ -0,0 +1,16 @@
+package org.eclipse.dltk.debug.ui.actions;
+
+import org.eclipse.osgi.util.NLS;
+
+public class ActionMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.dltk.debug.ui.actions.ActionMessages";//$NON-NLS-1$
+
+ // ScriptBreakpointPropertiesRulerAction
+ public static String ScriptBreakpointPropertiesRulerAction_BreakpointProperties;
+
+
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, ActionMessages.class);
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/actions/ActionMessages.properties b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/actions/ActionMessages.properties
new file mode 100644
index 0000000..0d7a882
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/actions/ActionMessages.properties
@@ -0,0 +1 @@
+ScriptBreakpointPropertiesRulerAction_BreakpointProperties=Breakpoint Properties...
\ No newline at end of file
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/actions/ControlAccessibleListener.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/actions/ControlAccessibleListener.java
new file mode 100644
index 0000000..f8fc02d
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/actions/ControlAccessibleListener.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.dltk.debug.ui.actions;
+
+import org.eclipse.swt.accessibility.AccessibleAdapter;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.widgets.Control;
+
+public class ControlAccessibleListener extends AccessibleAdapter {
+ private String controlName;
+
+ public ControlAccessibleListener(String name) {
+ controlName = name;
+ }
+
+ public void getName(AccessibleEvent e) {
+ e.result = controlName;
+ }
+
+ public static void addListener(Control comp, String name) {
+ //strip mnemonic
+ String[] strs = name.split("&"); //$NON-NLS-1$
+ StringBuffer stripped = new StringBuffer();
+ for (int i = 0; i < strs.length; i++) {
+ stripped.append(strs[i]);
+ }
+ comp.getAccessible().addAccessibleListener(new ControlAccessibleListener(stripped.toString()));
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/actions/ScriptBreakpointPropertiesRulerAction.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/actions/ScriptBreakpointPropertiesRulerAction.java
new file mode 100644
index 0000000..eda2612
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/actions/ScriptBreakpointPropertiesRulerAction.java
@@ -0,0 +1,57 @@
+package org.eclipse.dltk.debug.ui.actions;
+
+import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.debug.ui.actions.RulerBreakpointAction;
+import org.eclipse.dltk.debug.core.model.IScriptBreakpoint;
+import org.eclipse.jface.text.source.IVerticalRulerInfo;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.dialogs.PropertyDialogAction;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.ui.texteditor.IUpdate;
+
+public class ScriptBreakpointPropertiesRulerAction extends
+ RulerBreakpointAction implements IUpdate {
+
+ private IBreakpoint fBreakpoint;
+
+ public ScriptBreakpointPropertiesRulerAction(ITextEditor editor,
+ IVerticalRulerInfo info) {
+ super(editor, info);
+ setText(ActionMessages.ScriptBreakpointPropertiesRulerAction_BreakpointProperties);
+ }
+
+ public void run() {
+ if (getBreakpoint() != null) {
+ PropertyDialogAction action = new PropertyDialogAction(getEditor()
+ .getEditorSite(), new ISelectionProvider() {
+ public void addSelectionChangedListener(
+ ISelectionChangedListener listener) {
+ }
+
+ public ISelection getSelection() {
+ return new StructuredSelection(getBreakpoint());
+ }
+
+ public void removeSelectionChangedListener(
+ ISelectionChangedListener listener) {
+ }
+
+ public void setSelection(ISelection selection) {
+ }
+ });
+ action.run();
+ }
+ }
+
+ public void update() {
+ fBreakpoint = null;
+ IBreakpoint breakpoint = getBreakpoint();
+ if (breakpoint != null && (breakpoint instanceof IScriptBreakpoint)) {
+ fBreakpoint = breakpoint;
+ }
+ setEnabled(fBreakpoint != null);
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/actions/ScriptBreakpointPropertiesRulerActionDelegate.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/actions/ScriptBreakpointPropertiesRulerActionDelegate.java
new file mode 100644
index 0000000..dccc891
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/actions/ScriptBreakpointPropertiesRulerActionDelegate.java
@@ -0,0 +1,13 @@
+package org.eclipse.dltk.debug.ui.actions;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.text.source.IVerticalRulerInfo;
+import org.eclipse.ui.texteditor.AbstractRulerActionDelegate;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+public class ScriptBreakpointPropertiesRulerActionDelegate extends AbstractRulerActionDelegate {
+ protected IAction createAction(ITextEditor editor,
+ IVerticalRulerInfo rulerInfo) {
+ return new ScriptBreakpointPropertiesRulerAction(editor, rulerInfo);
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/actions/WatchExpressionAction.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/actions/WatchExpressionAction.java
new file mode 100644
index 0000000..087b949
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/actions/WatchExpressionAction.java
@@ -0,0 +1,72 @@
+package org.eclipse.dltk.debug.ui.actions;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.model.IDebugElement;
+import org.eclipse.debug.core.model.IWatchExpression;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IEditorActionDelegate;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+
+public class WatchExpressionAction implements IEditorActionDelegate {
+ private ITextSelection fSelection;
+
+ public void setActiveEditor(IAction action, IEditorPart targetEditor) {
+ }
+
+ public void run(IAction action) {
+ if (fSelection == null) {
+ return;
+ }
+ String text = fSelection.getText();
+ createExpression(text);
+ }
+
+ public void selectionChanged(IAction action, ISelection selection) {
+ fSelection = null;
+ if (selection instanceof ITextSelection) {
+ fSelection = (ITextSelection) selection;
+ }
+ }
+
+ private void showExpressionsView() {
+ IWorkbenchPage page = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage();
+ IViewPart part = page.findView(IDebugUIConstants.ID_EXPRESSION_VIEW);
+ if (part == null) {
+ try {
+ page.showView(IDebugUIConstants.ID_EXPRESSION_VIEW);
+ } catch (PartInitException e) {
+ }
+ } else {
+ page.bringToTop(part);
+ }
+
+ }
+
+ private void createExpression(String variable) {
+ IWatchExpression expression = DebugPlugin.getDefault()
+ .getExpressionManager().newWatchExpression(variable);
+
+ DebugPlugin.getDefault().getExpressionManager().addExpression(
+ expression);
+ IAdaptable object = DebugUITools.getDebugContext();
+ IDebugElement context = null;
+ if (object instanceof IDebugElement) {
+ context = (IDebugElement) object;
+ } else if (object instanceof ILaunch) {
+ context = ((ILaunch) object).getDebugTarget();
+ }
+ expression.setExpressionContext(context);
+ showExpressionsView();
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/launchConfigurations/CommonScriptLaunchTab.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/launchConfigurations/CommonScriptLaunchTab.java
new file mode 100644
index 0000000..409e02d
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/launchConfigurations/CommonScriptLaunchTab.java
@@ -0,0 +1,40 @@
+package org.eclipse.dltk.debug.ui.launchConfigurations;
+
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
+
+public abstract class CommonScriptLaunchTab extends AbstractLaunchConfigurationTab {
+
+ /**
+ * Config being modified
+ */
+ private ILaunchConfiguration fLaunchConfig;
+
+ /**
+ * Returns the launch configuration this tab was initialized from.
+ *
+ * @return launch configuration this tab was initialized from
+ */
+ protected ILaunchConfiguration getCurrentLaunchConfiguration() {
+ return fLaunchConfig;
+ }
+
+ /**
+ * Sets the launch configuration this tab was initialized from
+ *
+ * @param config launch configuration this tab was initialized from
+ */
+ private void setCurrentLaunchConfiguration(ILaunchConfiguration config) {
+ fLaunchConfig = config;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
+ *
+ * Subclasses may override this method and should call super.initializeFrom(...).
+ */
+ public void initializeFrom(ILaunchConfiguration config) {
+ setCurrentLaunchConfiguration(config);
+ }
+
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/launchConfigurations/DLTKCommonTab.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/launchConfigurations/DLTKCommonTab.java
new file mode 100644
index 0000000..7a3ad5a
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/launchConfigurations/DLTKCommonTab.java
@@ -0,0 +1,54 @@
+package org.eclipse.dltk.debug.ui.launchConfigurations;
+
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.ui.CommonTab;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+
+public class DLTKCommonTab extends CommonTab {
+
+ public void createControl(Composite parent) {
+ super.createControl(parent);
+
+ /*Composite comp = new Composite(parent, SWT.NONE);
+ setControl(comp);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IDebugHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_COMMON_TAB);
+ comp.setLayout(new GridLayout(2, true));
+ comp.setFont(parent.getFont());
+
+ createSharedConfigComponent(comp);
+ createFavoritesComponent(comp);
+ createEncodingComponent(comp);
+ createOutputCaptureComponent(comp);
+ createLaunchInBackgroundComponent(comp);*/
+ createUseScriptConsoleComponent((Composite)getControl());
+ }
+
+ private Button myButtom;
+
+ private void createUseScriptConsoleComponent(Composite parent){
+ myButtom = createCheckButton(parent, "Use specific DLTK Script console");
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ data.horizontalSpan = 2;
+ myButtom.setLayoutData(data);
+ myButtom.setFont(parent.getFont());
+ myButtom.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ updateLaunchConfigurationDialog();
+ }
+ });
+ }
+
+ public void performApply(ILaunchConfigurationWorkingCopy configuration) {
+ super.performApply(configuration);
+
+ if (myButtom.getSelection()){
+ configuration.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, false);
+ configuration.setAttribute("script_console_output", true);
+ }
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/launchConfigurations/InterpreterTab.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/launchConfigurations/InterpreterTab.java
new file mode 100644
index 0000000..b25004b
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/launchConfigurations/InterpreterTab.java
@@ -0,0 +1,459 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.dltk.debug.ui.launchConfigurations;
+
+
+import java.util.Map;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
+import org.eclipse.dltk.core.DLTKCore;
+import org.eclipse.dltk.core.IDLTKProject;
+import org.eclipse.dltk.debug.ui.DLTKDebugUIPlugin;
+import org.eclipse.dltk.debug.ui.messages.DLTKLaunchMessages;
+import org.eclipse.dltk.internal.debug.ui.interpreters.AbstractInterpreterComboBlock;
+import org.eclipse.dltk.internal.debug.ui.interpreters.InterpreterDescriptor;
+import org.eclipse.dltk.launching.IDLTKLaunchConfigurationConstants;
+import org.eclipse.dltk.launching.IInterpreterInstall;
+import org.eclipse.dltk.launching.ScriptRuntime;
+import org.eclipse.dltk.ui.DLTKPluginImages;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+import com.ibm.icu.text.MessageFormat;
+
+/**
+ * A launch configuration tab that displays and edits the Interpreter install
+ * launch configuration attributes.
+ * <p>
+ * This class may be instantiated. This class is not intended to be subclassed.
+ * </p>
+ *
+ */
+
+public abstract class InterpreterTab extends CommonScriptLaunchTab {
+
+ // Interpreter Block
+ protected AbstractInterpreterComboBlock fInterpreterBlock;
+
+ // Dynamic Interpreter UI widgets
+ protected ILaunchConfigurationTab fDynamicTab;
+ protected Composite fDynamicTabHolder;
+ protected boolean fUseDynamicArea = true;
+
+ protected ILaunchConfigurationWorkingCopy fWorkingCopy;
+ protected ILaunchConfiguration fLaunchConfiguration;
+
+ // State
+ protected boolean fIsInitializing = false;
+
+ // Selection changed listener (checked InterpreterEnvironment)
+ private IPropertyChangeListener fCheckListener = new IPropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent event) {
+ handleSelectedInterpreterChanged();
+ }
+ };
+
+ // Constants
+ protected static final String EMPTY_STRING = ""; //$NON-NLS-1$
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#dispose()
+ */
+ public void dispose() {
+ super.dispose();
+ if (fInterpreterBlock != null) {
+ fInterpreterBlock.removePropertyChangeListener(fCheckListener);
+ }
+ }
+
+ /**
+ * @see ILaunchConfigurationTab#createControl(Composite)
+ */
+ public void createControl(Composite parent) {
+ Font font = parent.getFont();
+
+ Composite topComp = new Composite(parent, SWT.NONE);
+ setControl(topComp);
+ //PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IScriptDebugHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_InterpreterEnvironment_TAB);
+ GridLayout topLayout = new GridLayout();
+ topLayout.numColumns = 1;
+ topLayout.marginHeight=0;
+ topLayout.marginWidth=0;
+ topComp.setLayout(topLayout);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ topComp.setLayoutData(gd);
+ topComp.setFont(font);
+
+ fInterpreterBlock = getInterpreterBlock();
+ fInterpreterBlock.setDefaultInterpreterDescriptor(getDefaultInterpreterDescriptor());
+ fInterpreterBlock.setSpecificInterpreterDescriptor(getSpecificInterpreterDescriptor());
+ fInterpreterBlock.createControl(topComp);
+ Control control = fInterpreterBlock.getControl();
+ fInterpreterBlock.addPropertyChangeListener(fCheckListener);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ control.setLayoutData(gd);
+
+ Composite dynTabComp = new Composite(topComp, SWT.NONE);
+ dynTabComp.setFont(font);
+
+ setDynamicTabHolder(dynTabComp);
+ GridLayout tabHolderLayout = new GridLayout();
+ tabHolderLayout.marginHeight= 0;
+ tabHolderLayout.marginWidth= 0;
+ tabHolderLayout.numColumns = 1;
+ getDynamicTabHolder().setLayout(tabHolderLayout);
+ gd = new GridData(GridData.FILL_BOTH);
+ getDynamicTabHolder().setLayoutData(gd);
+ }
+
+ protected abstract AbstractInterpreterComboBlock getInterpreterBlock ();
+
+ protected void setDynamicTabHolder(Composite tabHolder) {
+ this.fDynamicTabHolder = tabHolder;
+ }
+
+ protected Composite getDynamicTabHolder() {
+ return fDynamicTabHolder;
+ }
+
+ protected void setDynamicTab(ILaunchConfigurationTab tab) {
+ fDynamicTab = tab;
+ }
+
+ protected ILaunchConfigurationTab getDynamicTab() {
+ return fDynamicTab;
+ }
+
+ /**
+ * @see ILaunchConfigurationTab#setDefaults(ILaunchConfigurationWorkingCopy)
+ */
+ public void setDefaults(ILaunchConfigurationWorkingCopy config) {
+ setLaunchConfigurationWorkingCopy(config);
+ ILaunchConfigurationTab dynamicTab = getDynamicTab();
+ if (dynamicTab != null) {
+ dynamicTab.setDefaults(config);
+ }
+ }
+
+ /**
+ * @see ILaunchConfigurationTab#initializeFrom(ILaunchConfiguration)
+ */
+ public void initializeFrom(ILaunchConfiguration configuration) {
+ fIsInitializing = true;
+ getControl().setRedraw(false);
+ setLaunchConfiguration(configuration);
+ updateInterpreterFromConfig(configuration);
+ fInterpreterBlock.setDefaultInterpreterDescriptor(getDefaultInterpreterDescriptor());
+ ILaunchConfigurationTab dynamicTab = getDynamicTab();
+ if (dynamicTab != null) {
+ dynamicTab.initializeFrom(configuration);
+ }
+ getControl().setRedraw(true);
+ fIsInitializing = false;
+ }
+
+ protected abstract String getNature ();
+
+ /**
+ * @see ILaunchConfigurationTab#performApply(ILaunchConfigurationWorkingCopy)
+ */
+ public void performApply(ILaunchConfigurationWorkingCopy configuration) {
+ configuration.setAttribute(IDLTKLaunchConfigurationConstants.ATTR_NATURE, getNature());
+ if (fInterpreterBlock.isDefaultInterpreter()) {
+ configuration.setAttribute(IDLTKLaunchConfigurationConstants.ATTR_CONTAINER_PATH, (String)null);
+ } else {
+ IPath containerPath = fInterpreterBlock.getPath();
+ String portablePath = null;
+ if (containerPath != null) {
+ portablePath = containerPath.toPortableString();
+ }
+ configuration.setAttribute(IDLTKLaunchConfigurationConstants.ATTR_CONTAINER_PATH, portablePath);
+ }
+
+ // Handle any attributes in the Interpreter-specific area
+ ILaunchConfigurationTab dynamicTab = getDynamicTab();
+ if (dynamicTab == null) {
+ configuration.setAttribute(IDLTKLaunchConfigurationConstants.ATTR_INTERPRETER_INSTALL_TYPE_SPECIFIC_ATTRS_MAP, (Map)null);
+ } else {
+ dynamicTab.performApply(configuration);
+ }
+ }
+
+ /**
+ * @see ILaunchConfigurationTab#isValid(ILaunchConfiguration)
+ */
+ public boolean isValid(ILaunchConfiguration config) {
+
+ setErrorMessage(null);
+ setMessage(null);
+
+ IStatus status = fInterpreterBlock.getStatus();
+ if (!status.isOK()) {
+ setErrorMessage(status.getMessage());
+ return false;
+ }
+
+ ILaunchConfigurationTab dynamicTab = getDynamicTab();
+ if (dynamicTab != null) {
+ return dynamicTab.isValid(config);
+ }
+ return true;
+ }
+
+ /**
+ * @see ILaunchConfigurationTab#getName()
+ */
+ public String getName() {
+ return DLTKLaunchMessages.InterpreterTab__Interp_1;
+ }
+
+ /**
+ * @see ILaunchConfigurationTab#getImage()
+ */
+ public Image getImage() {
+ return DLTKPluginImages.DESC_OBJS_NATIVE_LIB_PATH_ATTRIB.createImage();
+ }
+
+ protected void updateInterpreterFromConfig(ILaunchConfiguration config) {
+ try {
+ String path = config.getAttribute(IDLTKLaunchConfigurationConstants.ATTR_CONTAINER_PATH, (String)null);
+ if (path != null) {
+ fInterpreterBlock.setPath(Path.fromPortableString(path));
+ return;
+ }
+ } catch (CoreException e) {
+ DLTKDebugUIPlugin.log(e);
+ }
+ fInterpreterBlock.setUseDefaultInterpreter();
+ }
+
+ /**
+ * Notification that the user changed the selection in the InterpreterEnvironment combination box.
+ */
+ protected void handleSelectedInterpreterChanged() {
+ loadDynamicInterpreterArea();
+
+ // always set the newly created area with defaults
+ ILaunchConfigurationWorkingCopy wc = getLaunchConfigurationWorkingCopy();
+ if (getDynamicTab() == null) {
+ // remove any Interpreter specific arguments from the config
+ if (wc == null) {
+ if (getLaunchConfiguration().isWorkingCopy()) {
+ wc = (ILaunchConfigurationWorkingCopy)getLaunchConfiguration();
+ }
+ }
+ if (!fIsInitializing) {
+ if (wc != null) {
+ wc.setAttribute(IDLTKLaunchConfigurationConstants.ATTR_INTERPRETER_INSTALL_TYPE_SPECIFIC_ATTRS_MAP, (Map)null);
+ }
+ }
+ } else {
+ if (wc == null) {
+ try {
+ if (getLaunchConfiguration().isWorkingCopy()) {
+ // get a fresh copy to work on
+ wc = ((ILaunchConfigurationWorkingCopy)getLaunchConfiguration()).getOriginal().getWorkingCopy();
+ } else {
+ wc = getLaunchConfiguration().getWorkingCopy();
+ }
+ } catch (CoreException e) {
+ DLTKDebugUIPlugin.errorDialog(DLTKLaunchMessages.InterpreterTab_Unable_to_initialize_defaults_for_selected_InterpreterEnvironment_1, e);
+ return;
+ }
+ }
+ if (!fIsInitializing) {
+ getDynamicTab().setDefaults(wc);
+ getDynamicTab().initializeFrom(wc);
+ }
+ }
+
+ updateLaunchConfigurationDialog();
+ }
+
+ protected void selectInterpreter(String typeID, String InterpreterName) {
+ if (typeID == null) {
+ fInterpreterBlock.setUseDefaultInterpreter();
+ } else {
+ fInterpreterBlock.setPath(ScriptRuntime.newInterpreterContainerPath(typeID, InterpreterName));
+ }
+ }
+
+ /**
+ * Return the class that implements <code>ILaunchConfigurationTab</code>
+ * that is registered against the install type of the currently selected Interpreter.
+ */
+ protected ILaunchConfigurationTab getTabForCurrentInterpreter() {
+ IPath path = fInterpreterBlock.getPath();
+ if (path != null) {
+ IInterpreterInstall Interpreter = fInterpreterBlock.getInterpreter();
+ if (Interpreter != null) {
+ String InterpreterInstallTypeID = Interpreter.getInterpreterInstallType().getId();
+ return DLTKDebugUIPlugin.getDefault().getInterpreterInstallTypePage(InterpreterInstallTypeID);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Show the contributed piece of UI that was registered for the install type
+ * of the currently selected Interpreter.
+ */
+ protected void loadDynamicInterpreterArea() {
+
+ // Dispose of any current child widgets in the tab holder area
+ Control[] children = getDynamicTabHolder().getChildren();
+ for (int i = 0; i < children.length; i++) {
+ children[i].dispose();
+ }
+
+ if (isUseDynamicInterpreterArea()) {
+ // Retrieve the dynamic UI for the current InterpreterEnvironment
+ setDynamicTab(getTabForCurrentInterpreter());
+ if (getDynamicTab() == null) {
+ return;
+ }
+
+ // Ask the dynamic UI to create its Control
+ getDynamicTab().setLaunchConfigurationDialog(getLaunchConfigurationDialog());
+ getDynamicTab().createControl(getDynamicTabHolder());
+ getDynamicTabHolder().layout();
+ }
+
+ }
+
+ protected ILaunchConfigurationWorkingCopy getLaunchConfigurationWorkingCopy() {
+ return fWorkingCopy;
+ }
+
+ /**
+ * Overridden here so that any error message in the dynamic UI gets returned.
+ *
+ * @see ILaunchConfigurationTab#getErrorMessage()
+ */
+ public String getErrorMessage() {
+ ILaunchConfigurationTab tab = getDynamicTab();
+ if ((super.getErrorMessage() != null) || (tab == null)) {
+ return super.getErrorMessage();
+ }
+ return tab.getErrorMessage();
+ }
+
+ protected void setLaunchConfigurationWorkingCopy(ILaunchConfigurationWorkingCopy workingCopy) {
+ fWorkingCopy = workingCopy;
+ }
+
+ protected ILaunchConfiguration getLaunchConfiguration() {
+ return fLaunchConfiguration;
+ }
+
+ protected void setLaunchConfiguration(ILaunchConfiguration launchConfiguration) {
+ fLaunchConfiguration = launchConfiguration;
+ }
+
+ /**
+ * Sets whether this tab will display the Interpreter specific arguments area
+ * if a InterpreterEnvironment supports Interpreter specific arguments.
+ *
+ * @param visible whether this tab will display the Interpreter specific arguments area
+ * if a InterpreterEnvironment supports Interpreter specific arguments
+ */
+ public void setInterpreterSpecificArgumentsVisible(boolean visible) {
+ fUseDynamicArea = visible;
+ }
+
+ protected boolean isUseDynamicInterpreterArea() {
+ return fUseDynamicArea;
+ }
+
+ protected InterpreterDescriptor getDefaultInterpreterDescriptor() {
+ return new InterpreterDescriptor() {
+
+ public String getDescription() {
+ IDLTKProject project = getDLTKProject();
+ String name = DLTKLaunchMessages.InterpreterTab_7;
+ if (project == null) {
+ IInterpreterInstall Interpreter = null;
+ Interpreter = ScriptRuntime.getDefaultInterpreterInstall(getNature());
+ if (Interpreter != null) {
+ name = Interpreter.getName();
+ }
+ return MessageFormat.format(DLTKLaunchMessages.InterpreterTab_8, new String[]{name});
+ }
+ try {
+ IInterpreterInstall Interpreter = ScriptRuntime.getInterpreterInstall(project);
+ if (Interpreter != null) {
+ name = Interpreter.getName();
+ }
+ } catch (CoreException e) {
+ }
+ return MessageFormat.format(DLTKLaunchMessages.InterpreterTab_9, new String[]{name});
+ }
+ };
+ }
+
+ protected InterpreterDescriptor getSpecificInterpreterDescriptor() {
+ return null;
+ }
+
+ /**
+ * Returns the Script project associated with the current config being edited,
+ * or <code>null</code> if none.
+ *
+ * @returnscriptproject or <code>null</code>
+ */
+ protected IDLTKProject getDLTKProject() {
+ if (getLaunchConfiguration() != null) {
+ try {
+ String name = getLaunchConfiguration().getAttribute(IDLTKLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String)null);
+ if (name != null && name.length() > 0) {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
+ if (project.exists()) {
+ return DLTKCore.create(project);
+ }
+ }
+ } catch (CoreException e) {
+ DLTKDebugUIPlugin.log(e);
+ }
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#activated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ public void activated(ILaunchConfigurationWorkingCopy workingCopy) {
+ // update the default InterpreterEnvironment description, in case it has changed
+ // based on the selected project
+ fInterpreterBlock.refresh();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#deactivated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ public void deactivated(ILaunchConfigurationWorkingCopy workingCopy) {
+ // do nothing when deactivated
+ }
+}
\ No newline at end of file
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/launchConfigurations/MainLaunchConfigurationTab.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/launchConfigurations/MainLaunchConfigurationTab.java
new file mode 100644
index 0000000..cc6cde9
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/launchConfigurations/MainLaunchConfigurationTab.java
@@ -0,0 +1,389 @@
+package org.eclipse.dltk.debug.ui.launchConfigurations;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
+import org.eclipse.dltk.core.DLTKCore;
+import org.eclipse.dltk.core.IDLTKProject;
+import org.eclipse.dltk.core.IModelElement;
+import org.eclipse.dltk.core.IScriptModel;
+import org.eclipse.dltk.core.ModelException;
+import org.eclipse.dltk.debug.ui.messages.DLTKLaunchConfigurationsMessages;
+import org.eclipse.dltk.internal.corext.util.Messages;
+import org.eclipse.dltk.internal.launching.DLTKLaunchingPlugin;
+import org.eclipse.dltk.internal.ui.DLTKUIStatus;
+import org.eclipse.dltk.launching.IDLTKLaunchConfigurationConstants;
+import org.eclipse.dltk.ui.DLTKUIPlugin;
+import org.eclipse.dltk.ui.viewsupport.ScriptUILabelProvider;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.dialogs.ElementListSelectionDialog;
+import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
+import org.eclipse.ui.model.WorkbenchContentProvider;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.eclipse.ui.views.navigator.ResourceSorter;
+
+
+public abstract class MainLaunchConfigurationTab extends AbstractLaunchConfigurationTab {
+ /**
+ * A listener which handles widget change events for the controls in this
+ * tab.
+ */
+ private class WidgetListener implements ModifyListener, SelectionListener {
+ public void modifyText(ModifyEvent e) {
+ setErrorMessage(null);
+ if (e.getSource() == fProjText) {
+ IDLTKProject proj = getProject();
+ if (proj != null) {
+ if (!validateProject(proj))
+ setErrorMessage(DLTKLaunchConfigurationsMessages.error_notAValidProject);
+ } else
+ setErrorMessage(DLTKLaunchConfigurationsMessages.error_selectProject);
+ }
+ updateLaunchConfigurationDialog();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {/* do nothing */
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ Object source = e.getSource();
+ if (source == fProjButton) {
+ handleProjectButtonSelected();
+ } else {
+ updateLaunchConfigurationDialog();
+ }
+ }
+ }
+ protected static final String EMPTY_STRING = ""; //$NON-NLS-1$
+ // Project UI widgets
+ protected Text fProjText;
+ private Button fProjButton;
+ private WidgetListener fListener = new WidgetListener();
+
+ /**
+ * chooses a project for the type of launch config that it is
+ *
+ * @return
+ */
+ private IDLTKProject chooseProject() {
+ ILabelProvider labelProvider = new ScriptUILabelProvider();
+ ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), labelProvider);
+ dialog.setTitle(DLTKLaunchConfigurationsMessages.mainTab_chooseProject_title);
+ dialog.setMessage(DLTKLaunchConfigurationsMessages.mainTab_chooseProject_message);
+ try {
+ dialog.setElements(DLTKCore.create(getWorkspaceRoot()).getScriptProjects());
+ }// end try
+ catch (ModelException jme) {
+ DLTKLaunchingPlugin.log(jme);
+ }
+ IDLTKProject project = getProject();
+ if (project != null) {
+ dialog.setInitialSelections(new Object[] {
+ project
+ });
+ }// end if
+ if (dialog.open() == Window.OK) {
+ return (IDLTKProject) dialog.getFirstResult();
+ }// end if
+ return null;
+ }
+
+ /**
+ * Creates the widgets for specifying a main type.
+ *
+ * @param parent
+ * the parent composite
+ */
+ protected void createProjectEditor(Composite parent) {
+ Font font = parent.getFont();
+ Group group = new Group(parent, SWT.NONE);
+ group.setText(DLTKLaunchConfigurationsMessages.mainTab_projectGroup);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ group.setLayoutData(gd);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ group.setLayout(layout);
+ group.setFont(font);
+ fProjText = new Text(group, SWT.SINGLE | SWT.BORDER);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ fProjText.setLayoutData(gd);
+ fProjText.setFont(font);
+ fProjText.addModifyListener(fListener);
+ fProjButton = createPushButton(group, DLTKLaunchConfigurationsMessages.mainTab_projectButton, null);
+ fProjButton.addSelectionListener(fListener);
+ }
+
+ /**
+ * Convenience method to get access to thescriptmodel.
+ */
+ private IScriptModel getScriptModel() {
+ return DLTKCore.create(getWorkspaceRoot());
+ }
+
+ /**
+ * Return the IDLTKProject corresponding to the project name in the project
+ * name text field, or null if the text does not match a project name.
+ */
+ protected IDLTKProject getProject() {
+ String projectName = fProjText.getText().trim();
+ if (projectName.length() < 1) {
+ return null;
+ }// end if
+ return getScriptModel().getScriptProject(projectName);
+ }
+
+ /**
+ * Convenience method to get the workspace root.
+ */
+ protected IWorkspaceRoot getWorkspaceRoot() {
+ return ResourcesPlugin.getWorkspace().getRoot();
+ }
+
+ protected abstract boolean validateProject(IDLTKProject project);
+
+ protected abstract String getLanguageName();
+
+ /**
+ * Show a dialog that lets the user select a project. This in turn provides
+ * context for the main type, allowing the user to key a main type name, or
+ * constraining the search for main types to the specified project.
+ */
+ protected void handleProjectButtonSelected() {
+ IDLTKProject project = chooseProject();
+ if (project == null)
+ return;
+ if (!validateProject(project)) {
+ String msg = Messages.format(DLTKLaunchConfigurationsMessages.mainTab_errorDlg_notALangProject, new String[] {
+ getLanguageName()
+ });
+ String reason = Messages.format(DLTKLaunchConfigurationsMessages.mainTab_errorDlg_reasonNotALangProject, new String[] {
+ getLanguageName()
+ });
+ ErrorDialog.openError(getShell(), DLTKLaunchConfigurationsMessages.mainTab_errorDlg_invalidProject, msg,
+ DLTKUIStatus.createError(IStatus.ERROR, reason, null));
+ return;
+ }
+ String projectName = project.getElementName();
+ fProjText.setText(projectName);
+ }// end handle selected
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ public void initializeFrom(ILaunchConfiguration config) {
+ updateProjectFromConfig(config);
+ updateMainModuleFromConfig(config);
+ if (fProjText.getText().trim().length() == 0 && fMainText.getText().trim().length() == 0) {
+ // try to fill-in
+ IWorkbenchPage page = DLTKUIPlugin.getActivePage();
+ if (page != null) {
+ IEditorPart editor = page.getActiveEditor();
+ if (editor != null) {
+ IEditorInput editorInput = editor.getEditorInput();
+ if (editorInput != null) {
+ IModelElement me = DLTKUIPlugin.getEditorInputModelElement(editorInput);
+ IDLTKProject project = me.getScriptProject();
+ if (project != null && validateProject(project)) {
+ String projectName = project.getProject().getName();
+ String scriptName = me.getResource().getProjectRelativePath().toPortableString();//me.getResource().getLocation().toPortableString(); /*me.getResource().getFullPath().toPortableString();*/
+ if (scriptName.trim().length() > 0) {
+ fProjText.setText(projectName);
+ fMainText.setText(scriptName);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * updates the project text field form the configuration
+ *
+ * @param config
+ * the configuration we are editing
+ */
+ private void updateProjectFromConfig(ILaunchConfiguration config) {
+ String projectName = EMPTY_STRING;
+ try {
+ projectName = config.getAttribute(IDLTKLaunchConfigurationConstants.ATTR_PROJECT_NAME, EMPTY_STRING);
+ }// end try
+ catch (CoreException ce) {
+ DLTKLaunchingPlugin.log(ce);
+ }
+ fProjText.setText(projectName);
+ }
+ protected Text fMainText;
+ private Button fSearchButton;
+
+ /**
+ * Creates the widgets for specifying a main type.
+ *
+ * @param parent
+ * the parent composite
+ */
+ protected void createMainModuleEditor(Composite parent, String text) {
+ Font font = parent.getFont();
+ Group mainGroup = new Group(parent, SWT.NONE);
+ mainGroup.setText(text);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ mainGroup.setLayoutData(gd);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ mainGroup.setLayout(layout);
+ mainGroup.setFont(font);
+ fMainText = new Text(mainGroup, SWT.SINGLE | SWT.BORDER);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ fMainText.setLayoutData(gd);
+ fMainText.setFont(font);
+ fMainText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ updateLaunchConfigurationDialog();
+ }
+ });
+ fSearchButton = createPushButton(mainGroup, DLTKLaunchConfigurationsMessages.mainTab_searchButton, null);
+ fSearchButton.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {}
+
+ public void widgetSelected(SelectionEvent e) {
+ handleSearchButtonSelected();
+ }
+ });
+ }
+
+ /**
+ * The select button pressed handler
+ */
+ protected void handleSearchButtonSelected() {
+ ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), new WorkbenchLabelProvider(),
+ new WorkbenchContentProvider());
+ dialog.setTitle(DLTKLaunchConfigurationsMessages.mainTab_searchButton_title);
+ dialog.setMessage(DLTKLaunchConfigurationsMessages.mainTab_searchButton_message);
+ IDLTKProject proj = getProject();
+ if (proj == null)
+ return;
+ dialog.setInput(proj.getProject());
+ dialog.setSorter(new ResourceSorter(ResourceSorter.NAME));
+ if (dialog.open() == IDialogConstants.OK_ID) {
+ IResource resource = (IResource) dialog.getFirstResult();
+ String arg = resource.getProjectRelativePath().toPortableString();
+ // check extension
+ fMainText.setText(arg);
+ }
+ }
+
+ /**
+ * Loads the main type from the launch configuration's preference store
+ *
+ * @param config
+ * the config to load the main type from
+ */
+ protected void updateMainModuleFromConfig(ILaunchConfiguration config) {
+ String mainModuleName = EMPTY_STRING;
+ try {
+ mainModuleName = config.getAttribute(IDLTKLaunchConfigurationConstants.ATTR_MAIN_SCRIPT_NAME, EMPTY_STRING);
+ }// end try
+ catch (CoreException ce) {
+ DLTKLaunchingPlugin.log(ce);
+ }
+ fMainText.setText(mainModuleName);
+ }
+
+ public void createControl(Composite parent) {
+ Font font = parent.getFont();
+ Composite comp = new Composite(parent, SWT.NONE);
+ setControl(comp);
+ // PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(),
+ // IScriptDebugHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_MAIN_TAB);
+ GridLayout topLayout = new GridLayout();
+ topLayout.verticalSpacing = 0;
+ comp.setLayout(topLayout);
+ comp.setFont(font);
+ createProjectEditor(comp);
+ createVerticalSpacer(comp, 1);
+ createMainModuleEditor(comp, DLTKLaunchConfigurationsMessages.mainTab_mainModule);
+ }
+
+ public String getName() {
+ return DLTKLaunchConfigurationsMessages.mainTab_title;
+ }
+
+ public void performApply(ILaunchConfigurationWorkingCopy configuration) {
+ String mainModule = fMainText.getText().trim();
+ String project = fProjText.getText().trim();
+ configuration.setAttribute(IDLTKLaunchConfigurationConstants.ATTR_MAIN_SCRIPT_NAME, mainModule);
+ configuration.setAttribute(IDLTKLaunchConfigurationConstants.ATTR_PROJECT_NAME, project);
+ }
+
+ protected boolean validateProject() {
+ String projectName = fProjText.getText().trim();
+ if (projectName.length() == 0) {
+ setErrorMessage(DLTKLaunchConfigurationsMessages.error_selectProject);
+ return false;
+ }
+ IDLTKProject proj = getScriptModel().getScriptProject(projectName);
+ if (proj == null || !validateProject(proj)) {
+ setErrorMessage(DLTKLaunchConfigurationsMessages.error_notAValidProject);
+ return false;
+ }
+ return true;
+ }
+
+ protected boolean validateModule() {
+ String mainModule = fMainText.getText().trim();
+ if (mainModule.length() == 0) {
+ setErrorMessage(DLTKLaunchConfigurationsMessages.error_selectScript);
+ return false;
+ }
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#canSave()
+ */
+ public boolean canSave() {
+ return validateProject() && validateModule();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#isValid(org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ public boolean isValid(ILaunchConfiguration launchConfig) {
+ setMessage(null);
+ setErrorMessage(null);
+ return validateProject() && validateModule();
+ }
+
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+ // TODO Auto-generated method stub
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/launchConfigurations/ScriptArgumentsTab.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/launchConfigurations/ScriptArgumentsTab.java
new file mode 100644
index 0000000..3cb7604
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/launchConfigurations/ScriptArgumentsTab.java
@@ -0,0 +1,268 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.dltk.debug.ui.launchConfigurations;
+
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.ui.ILaunchConfigurationDialog;
+import org.eclipse.debug.ui.StringVariableSelectionDialog;
+import org.eclipse.dltk.debug.ui.actions.ControlAccessibleListener;
+import org.eclipse.dltk.debug.ui.messages.DLTKLaunchMessages;
+import org.eclipse.dltk.internal.debug.ui.DLTKDebugImages;
+import org.eclipse.dltk.internal.debug.ui.launcher.InterpreterArgumentsBlock;
+import org.eclipse.dltk.internal.debug.ui.launcher.WorkingDirectoryBlock;
+import org.eclipse.dltk.internal.launching.DLTKLaunchingPlugin;
+import org.eclipse.dltk.launching.IDLTKLaunchConfigurationConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+
+/**
+ * A launch configuration tab that displays and edits program arguments,
+ * Interpreter arguments, and working directory launch configuration attributes.
+ * <p>
+ * This class may be instantiated. This class may be subclassed by overloading createInterpreterArgsBlock and createWorkingDirBlock.
+ * </p>
+ *
+ */
+public class ScriptArgumentsTab extends CommonScriptLaunchTab {
+
+ // Program arguments widgets
+ protected Label fPrgmArgumentsLabel;
+ protected Text fPrgmArgumentsText;
+
+ // Interpreter arguments widgets
+ protected InterpreterArgumentsBlock fInterpreterArgumentsBlock;
+
+ // Working directory
+ protected WorkingDirectoryBlock fWorkingDirectoryBlock;
+
+ protected static final String EMPTY_STRING = ""; //$NON-NLS-1$
+
+ public ScriptArgumentsTab() {
+ fInterpreterArgumentsBlock = createInterpreterArgsBlock();
+ fWorkingDirectoryBlock = createWorkingDirBlock();
+ }
+
+ protected InterpreterArgumentsBlock createInterpreterArgsBlock() {
+ return new InterpreterArgumentsBlock();
+ }
+
+ protected WorkingDirectoryBlock createWorkingDirBlock() {
+ return new WorkingDirectoryBlock();
+ }
+
+ /**
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(Composite)
+ */
+ public void createControl(Composite parent) {
+ Font font = parent.getFont();
+ Composite comp = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(1, true);
+ comp.setLayout(layout);
+ comp.setFont(font);
+
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ comp.setLayoutData(gd);
+ setControl(comp);
+ setHelpContextId();
+
+ Group group = new Group(comp, SWT.NONE);
+ group.setFont(font);
+ layout = new GridLayout();
+ group.setLayout(layout);
+ group.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ String controlName = (DLTKLaunchMessages.ArgumentsTab__Program_arguments__5);
+ group.setText(controlName);
+
+ fPrgmArgumentsText = new Text(group, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL);
+ gd = new GridData(GridData.FILL_BOTH);
+ gd.heightHint = 40;
+ gd.widthHint = 100;
+ fPrgmArgumentsText.setLayoutData(gd);
+ fPrgmArgumentsText.setFont(font);
+ fPrgmArgumentsText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent evt) {
+ updateLaunchConfigurationDialog();
+ }
+ });
+ ControlAccessibleListener.addListener(fPrgmArgumentsText, group.getText());
+
+ String buttonLabel = DLTKLaunchMessages.ArgumentsTab_5;
+ Button pgrmArgVariableButton = createPushButton(group, buttonLabel, null);
+ pgrmArgVariableButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
+ pgrmArgVariableButton.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell());
+ dialog.open();
+ String variable = dialog.getVariableExpression();
+ if (variable != null) {
+ fPrgmArgumentsText.insert(variable);
+ }
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ });
+
+ if (fInterpreterArgumentsBlock != null)
+ fInterpreterArgumentsBlock.createControl(comp);
+
+ fWorkingDirectoryBlock.createControl(comp);
+ }
+
+ /**
+ * Set the help context id for this launch config tab. Subclasses may
+ * override this method.
+ */
+ protected void setHelpContextId() {
+ //PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IScriptDebugHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_ARGUMENTS_TAB);
+ }
+
+ /**
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#dispose()
+ */
+ public void dispose() {
+ }
+
+ /**
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#isValid(ILaunchConfiguration)
+ */
+ public boolean isValid(ILaunchConfiguration config) {
+ return fWorkingDirectoryBlock.isValid(config);
+ }
+
+ /**
+ * Defaults are empty.
+ *
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(ILaunchConfigurationWorkingCopy)
+ */
+ public void setDefaults(ILaunchConfigurationWorkingCopy config) {
+ config.setAttribute(IDLTKLaunchConfigurationConstants.ATTR_SCRIPT_ARGUMENTS, (String)null);
+ if (fInterpreterArgumentsBlock != null)
+ fInterpreterArgumentsBlock.setDefaults(config);
+ fWorkingDirectoryBlock.setDefaults(config);
+ }
+
+ /**
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(ILaunchConfiguration)
+ */
+ public void initializeFrom(ILaunchConfiguration configuration) {
+ try {
+ fPrgmArgumentsText.setText(configuration.getAttribute(IDLTKLaunchConfigurationConstants.ATTR_SCRIPT_ARGUMENTS, "")); //$NON-NLS-1$
+ if (fInterpreterArgumentsBlock != null)
+ fInterpreterArgumentsBlock.initializeFrom(configuration);
+ fWorkingDirectoryBlock.initializeFrom(configuration);
+ } catch (CoreException e) {
+ setErrorMessage(DLTKLaunchMessages.ArgumentsTab_Exception_occurred_reading_configuration___15 + e.getStatus().getMessage());
+ DLTKLaunchingPlugin.log(e);
+ }
+ }
+
+ /**
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(ILaunchConfigurationWorkingCopy)
+ */
+ public void performApply(ILaunchConfigurationWorkingCopy configuration) {
+ configuration.setAttribute(IDLTKLaunchConfigurationConstants.ATTR_SCRIPT_ARGUMENTS,
+ getAttributeValueFrom(fPrgmArgumentsText));
+ if (fInterpreterArgumentsBlock != null)
+ fInterpreterArgumentsBlock.performApply(configuration);
+ fWorkingDirectoryBlock.performApply(configuration);
+ }
+
+ /**
+ * Returns the string in the text widget, or <code>null</code> if empty.
+ *
+ * @return text or <code>null</code>
+ */
+ protected String getAttributeValueFrom(Text text) {
+ String content = text.getText().trim();
+ if (content.length() > 0) {
+ return content;
+ }
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
+ */
+ public String getName() {
+ return DLTKLaunchMessages.ArgumentsTab__Arguments_16;
+ }
+
+ /**
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setLaunchConfigurationDialog(ILaunchConfigurationDialog)
+ */
+ public void setLaunchConfigurationDialog(ILaunchConfigurationDialog dialog) {
+ super.setLaunchConfigurationDialog(dialog);
+ fWorkingDirectoryBlock.setLaunchConfigurationDialog(dialog);
+ if (fInterpreterArgumentsBlock != null)
+ fInterpreterArgumentsBlock.setLaunchConfigurationDialog(dialog);
+ }
+ /**
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getErrorMessage()
+ */
+ public String getErrorMessage() {
+ String m = super.getErrorMessage();
+ if (m == null) {
+ return fWorkingDirectoryBlock.getErrorMessage();
+ }
+ return m;
+ }
+
+ /**
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getMessage()
+ */
+ public String getMessage() {
+ String m = super.getMessage();
+ if (m == null) {
+ return fWorkingDirectoryBlock.getMessage();
+ }
+ return m;
+ }
+
+ /**
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage()
+ */
+ public Image getImage() {
+ return DLTKDebugImages.get(DLTKDebugImages.IMG_VIEW_ARGUMENTS_TAB);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#activated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ public void activated(ILaunchConfigurationWorkingCopy workingCopy) {
+ fWorkingDirectoryBlock.initializeFrom(workingCopy);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#deactivated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ public void deactivated(ILaunchConfigurationWorkingCopy workingCopy) {
+ // do nothing when deactivated
+ }
+}
+
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/messages/DLTKLaunchConfigurationsMessages.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/messages/DLTKLaunchConfigurationsMessages.java
new file mode 100644
index 0000000..f9644ed
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/messages/DLTKLaunchConfigurationsMessages.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.dltk.debug.ui.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+public class DLTKLaunchConfigurationsMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.dltk.debug.ui.messages.DLTKLaunchConfigurationsMessages";//$NON-NLS-1$
+ public static String mainTab_title;
+ public static String mainTab_projectGroup;
+ public static String mainTab_projectButton;
+ public static String mainTab_chooseProject_title;
+ public static String mainTab_chooseProject_message;
+ public static String mainTab_searchButton;
+ public static String mainTab_mainModule;
+ public static String mainTab_searchButton_title;
+ public static String mainTab_searchButton_message;
+ public static String error_selectProject;
+ public static String error_notAValidProject;
+ public static String mainTab_errorDlg_invalidProject;
+ public static String mainTab_errorDlg_notALangProject;
+ public static String mainTab_errorDlg_reasonNotALangProject;
+ public static String error_selectScript;
+
+ private DLTKLaunchConfigurationsMessages() {
+ // dont instatiate
+ }
+ static {
+ // load message values from bundle file
+ NLS.initializeMessages(BUNDLE_NAME, DLTKLaunchConfigurationsMessages.class);
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/messages/DLTKLaunchConfigurationsMessages.properties b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/messages/DLTKLaunchConfigurationsMessages.properties
new file mode 100644
index 0000000..427d680
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/messages/DLTKLaunchConfigurationsMessages.properties
@@ -0,0 +1,15 @@
+mainTab_title=Main
+mainTab_projectGroup=Project:
+mainTab_projectButton=Browse...
+mainTab_chooseProject_title=Project selection
+mainTab_chooseProject_message=Select a project to launch
+mainTab_searchButton=Browse...
+mainTab_mainModule=Launch script:
+mainTab_searchButton_title=Script selection
+mainTab_searchButton_message=Select a script to launch
+error_selectProject=Select project
+error_notAValidProject=It is not a valid project name
+mainTab_errorDlg_invalidProject=Invalid project
+mainTab_errorDlg_notALangProject=It is not a {0} project
+mainTab_errorDlg_reasonNotALangProject=You have selected not a {0} project
+error_selectScript=Select a script to launch
\ No newline at end of file
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/messages/DLTKLaunchMessages.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/messages/DLTKLaunchMessages.java
new file mode 100644
index 0000000..dc97f42
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/messages/DLTKLaunchMessages.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.dltk.debug.ui.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+public class DLTKLaunchMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.dltk.debug.ui.messages.DLTKLaunchMessages";//$NON-NLS-1$
+ public static String scriptLaunchShortcut2_title;
+ public static String scriptLaunchShortcut2;
+ public static String WorkingDirectoryBlock_12;
+ public static String WorkingDirectoryBlock_18;
+ public static String WorkingDirectoryBlock_19;
+ public static String WorkingDirectoryBlock_0;
+ public static String WorkingDirectoryBlock_1;
+ public static String WorkingDirectoryBlock_17;
+ public static String WorkingDirectoryBlock_7;
+ public static String WorkingDirectoryBlock_4;
+ public static String WorkingDirectoryBlock_10;
+ public static String WorkingDirectoryBlock_20;
+ public static String ArgumentsTab_Exception_occurred_reading_configuration___15;
+ public static String WorkingDirectoryBlock_Working_Directory_8;
+ public static String ArgumentsTab__Program_arguments__5;
+ public static String ArgumentsTab_5;
+ public static String ArgumentsTab__Arguments_16;
+ public static String InterpreterTab__Interp_1;
+ public static String InterpreterTab_Unable_to_initialize_defaults_for_selected_InterpreterEnvironment_1;
+ public static String InterpreterTab_7;
+ public static String InterpreterTab_8;
+ public static String InterpreterTab_9;
+ public static String InterpreterArgumentsTab_Interpreter_ar_guments__6;
+ public static String InterpreterArgumentsBlock_4;
+ public static String InterpreterArgumentsTab_Exception_occurred_reading_configuration___15;
+ public static String InterpreterArgumentsBlock_Interpreter_Arguments;
+
+ private DLTKLaunchMessages() {
+ // dont instatiate
+ }
+ static {
+ // load message values from bundle file
+ NLS.initializeMessages(BUNDLE_NAME, DLTKLaunchMessages.class);
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/messages/DLTKLaunchMessages.properties b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/messages/DLTKLaunchMessages.properties
new file mode 100644
index 0000000..475c173
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/messages/DLTKLaunchMessages.properties
@@ -0,0 +1,26 @@
+scriptLaunchShortcut2_title=Launch configurations
+scriptLaunchShortcut2=&Select existing configuration:
+WorkingDirectoryBlock_4=Select a &workspace relative working directory:
+WorkingDirectoryBlock_7=Select a working directory for the launch configuration:
+WorkingDirectoryBlock_0=W&orkspace...
+WorkingDirectoryBlock_Working_Directory_8=Working Directory
+WorkingDirectoryBlock_10=Working directory does not exist
+WorkingDirectoryBlock_12=Working directory:
+WorkingDirectoryBlock_17=Variabl&es...
+WorkingDirectoryBlock_18=Defa&ult:
+WorkingDirectoryBlock_19=Ot&her:
+WorkingDirectoryBlock_20=Working directory not specified
+WorkingDirectoryBlock_1=File S&ystem...
+ArgumentsTab_Exception_occurred_reading_configuration___15=Exception occurred reading configuration:
+ArgumentsTab_5=Var&iables...
+ArgumentsTab__Arguments_16=Arguments
+ArgumentsTab__Program_arguments__5=Script &arguments:
+InterpreterTab__Interp_1=Interpreter
+InterpreterTab_Unable_to_initialize_defaults_for_selected_InterpreterEnvironment_1=Unable to initialize defaults for selected interpreter
+InterpreterTab_7=undefined
+InterpreterTab_8=Workspace &default interpreter ({0})
+InterpreterTab_9=&Project interpreter ({0})
+
+InterpreterArgumentsTab_Interpreter_ar_guments__6=Interpreter ar&guments:
+
+InterpreterArgumentsBlock_4=Variable&s...
\ No newline at end of file
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/DLTKDebugImages.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/DLTKDebugImages.java
new file mode 100644
index 0000000..dbddc7c
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/DLTKDebugImages.java
@@ -0,0 +1,230 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.dltk.internal.debug.ui;
+
+
+import java.net.URL;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.dltk.debug.ui.DLTKDebugUIPlugin;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.swt.graphics.Image;
+import org.osgi.framework.Bundle;
+
+
+/**
+ * Bundle of most images used by the debug plug-in.
+ * DLTK note: used icons are marked with a comment
+ * TODO: delete unused icons
+ */
+public class DLTKDebugImages {
+
+ private static String ICONS_PATH = "$nl$/icons/full/"; //$NON-NLS-1$
+
+ // The plugin registry
+ private static ImageRegistry fgImageRegistry = null;
+
+ /*
+ * Available cached Images in the Script debug plug-in image registry.
+ */
+ public static final String IMG_OBJS_EXCEPTION= "IMG_OBJS_EXCEPTION"; //$NON-NLS-1$
+ public static final String IMG_OBJS_EXCEPTION_DISABLED= "IMG_OBJS_EXCEPTION_DISABLED"; //$NON-NLS-1$
+ public static final String IMG_OBJS_ERROR= "IMG_OBJS_ERROR"; //$NON-NLS-1$
+
+ public static final String IMG_OVR_BREAKPOINT_INSTALLED= "IMG_OBJS_BREAKPOINT_INSTALLED"; //$NON-NLS-1$
+ public static final String IMG_OVR_BREAKPOINT_INSTALLED_DISABLED= "IMG_OBJS_BREAKPOINT_INSTALLED_DISABLED"; //$NON-NLS-1$
+
+ public static final String IMG_OBJS_LOCAL_VARIABLE = "IMG_OBJS_LOCAL_VARIABLE"; //$NON-NLS-1$
+
+ public static final String IMG_OVR_METHOD_BREAKPOINT_ENTRY= "IMG_OBJS_METHOD_BREAKPOINT_ENTRY"; //$NON-NLS-1$
+ public static final String IMG_OVR_METHOD_BREAKPOINT_ENTRY_DISABLED= "IMG_OBJS_METHOD_BREAKPOINT_ENTRY_DISABLED"; //$NON-NLS-1$
+ public static final String IMG_OVR_METHOD_BREAKPOINT_EXIT= "IMG_OBJS_METHOD_BREAKPOINT_EXIT"; //$NON-NLS-1$
+ public static final String IMG_OVR_METHOD_BREAKPOINT_EXIT_DISABLED= "IMG_OBJS_METHOD_BREAKPOINT_EXIT_DISABLED"; //$NON-NLS-1$
+
+ public static final String IMG_OVR_CONDITIONAL_BREAKPOINT= "IMG_OBJS_CONDITIONAL_BREAKPOINT"; //$NON-NLS-1$
+ public static final String IMG_OVR_CONDITIONAL_BREAKPOINT_DISABLED= "IMG_OBJS_CONDITIONAL_BREAKPOINT_DISABLED"; //$NON-NLS-1$
+
+ public static final String IMG_OVR_SCOPED_BREAKPOINT= "IMG_OBJS_SCOPED_BREAKPOINT"; //$NON-NLS-1$
+ public static final String IMG_OVR_SCOPED_BREAKPOINT_DISABLED= "IMG_OBJS_SCOPED_BREAKPOINT_DISABLED"; //$NON-NLS-1$
+
+ public static final String IMG_OVR_UNCAUGHT_BREAKPOINT= "IMG_OBJS_UNCAUGHT_BREAKPOINT"; //$NON-NLS-1$
+ public static final String IMG_OVR_UNCAUGHT_BREAKPOINT_DISABLED= "IMG_OBJS_UNCAUGHT_BREAKPOINT_DISABLED"; //$NON-NLS-1$
+
+ public static final String IMG_OVR_CAUGHT_BREAKPOINT= "IMG_OBJS_CAUGHT_BREAKPOINT"; //$NON-NLS-1$
+ public static final String IMG_OVR_CAUGHT_BREAKPOINT_DISABLED= "IMG_OBJS_CAUGHT_BREAKPOINT_DISABLED"; //$NON-NLS-1$
+
+ public static final String IMG_OBJS_SNIPPET_EVALUATING= "IMG_OBJS_SNIPPET_EVALUATING"; //$NON-NLS-1$
+
+ //used
+ public static final String IMG_VIEW_ARGUMENTS_TAB= "IMG_VIEW_ARGUMENTS_TAB"; //$NON-NLS-1$
+
+ public static final String IMG_OBJS_MONITOR = "IMG_OBJS_MONITOR"; //$NON-NLS-1$
+ public static final String IMG_OBJS_CONTENDED_MONITOR = "IMG_OBJS_CONTENDED_MONITOR"; //$NON-NLS-1$
+ public static final String IMG_OBJS_OWNED_MONITOR = "IMG_OBJS_OWNED_MONITOR"; //$NON-NLS-1$
+
+ public static final String IMG_OVR_OWNED = "IMG_OVR_OWNED"; //$NON-NLS-1$
+ public static final String IMG_OVR_OWNS_MONITOR = "IMG_OVR_OWNS_MONITOR"; //$NON-NLS-1$
+ public static final String IMG_OVR_IN_CONTENTION = "IMG_OVR_IN_CONTENTION"; //$NON-NLS-1$
+ public static final String IMG_OVR_IN_CONTENTION_FOR_MONITOR = "IMG_OVR_IN_CONTENTION_FOR_MONITOR"; //$NON-NLS-1$
+ public static final String IMG_OVR_IN_DEADLOCK = "IMG_OVR_IN_DEADLOCK"; //$NON-NLS-1$
+
+ public static final String IMG_OBJS_EXCEPTION_BRKPT_TYPE = "IMG_OBJS_EXCEPTION_BRKPT_TYPE"; //$NON-NLS-1$
+ public static final String IMG_OBJS_LINE_BRKPT_TYPE = "IMG_OBJS_LINE_BRKPT_TYPE"; //$NON-NLS-1$
+ public static final String IMG_OBJS_CLASSLOAD_BRKPT_TYPE = "IMG_OBJS_CLASSLOAD_BRKPT_TYPE"; //$NON-NLS-1$
+ public static final String IMG_OBJS_WATCHPOINT_TYPE = "IMG_OBJS_WATCHPOINT_TYPE"; //$NON-NLS-1$
+ public static final String IMG_OBJS_JSP_BRKPT_TYPE = "IMG_OBJS_JSP_BRKPT_TYPE"; //$NON-NLS-1$
+ public static final String IMG_OBJS_METHOD_BRKPT_TYPE = "IMG_OBJS_METHOD_BRKPT_TYPE"; //$NON-NLS-1$
+ public static final String IMG_OBJS_THREAD_GROUP = "IMG_OBJS_THREAD_GROUP"; //$NON-NLS-1$
+
+ public static final String IMG_OBJS_CLASSPATH = "IMG_OBJS_CLASSPATH"; //$NON-NLS-1$
+
+ public static final String IMG_OVR_OUT_OF_SYNCH = "IMG_OVR_OUT_OF_SYNCH"; //$NON-NLS-1$
+ public static final String IMG_OVR_MAY_BE_OUT_OF_SYNCH = "IMG_OVR_MAY_BE_OUT_OF_SYNCH"; //$NON-NLS-1$
+ public static final String IMG_OVR_SYNCHRONIZED = "IMG_OVR_SYNCHRONIZED"; //$NON-NLS-1$
+
+ public static final String IMG_WIZBAN_NEWSCRAPPAGE = "IMG_WIZBAN_NEWSCRAPPAGE"; //$NON-NLS-1$
+ public static final String IMG_WIZBAN_LIBRARY = "IMG_WIZBAN_LIBRARY"; //$NON-NLS-1$
+ public static final String IMG_TOOL_TERMSNIPPET = "IMG_TOOL_TERMSNIPPET"; //$NON-NLS-1$
+ public static final String IMG_TOOL_TERMSNIPPET_HOVER = "IMG_TOOL_TERMSNIPPET_HOVER"; //$NON-NLS-1$
+ public static final String IMG_TOOL_TERMSNIPPET_DISABLED = "IMG_TOOL_TERMSNIPPET_DISABLED"; //$NON-NLS-1$
+ public static final String IMG_OBJ_JAVA_INSPECT_EXPRESSION = "IMG_OBJ_JAVA_INSPECT_EXPRESSION"; //$NON-NLS-1$
+
+ /*
+ * Set of predefined Image Descriptors.
+ */
+ private static final String T_OBJ= ICONS_PATH + "obj16/"; //$NON-NLS-1$
+ private static final String T_OVR= ICONS_PATH + "ovr16/"; //$NON-NLS-1$
+ private static final String T_WIZBAN= ICONS_PATH + "wizban/"; //$NON-NLS-1$
+ private static final String T_EVIEW= ICONS_PATH + "eview16/"; //$NON-NLS-1$
+ private static final String T_DLCL= ICONS_PATH + "dtool16/"; //$NON-NLS-1$
+ private static final String T_ELCL= ICONS_PATH + "etool16/"; //$NON-NLS-1$
+
+
+
+ /**
+ * Returns the image managed under the given key in this registry.
+ *
+ * @param key the image's key
+ * @return the image managed under the given key
+ */
+ public static Image get(String key) {
+ return getImageRegistry().get(key);
+ }
+
+ /**
+ * Returns the <code>ImageDescriptor</code> identified by the given key,
+ * or <code>null</code> if it does not exist.
+ */
+ public static ImageDescriptor getImageDescriptor(String key) {
+ return getImageRegistry().getDescriptor(key);
+ }
+
+ /*
+ * Helper method to access the image registry from the JDIDebugUIPlugin class.
+ */
+ /* package */ static ImageRegistry getImageRegistry() {
+ if (fgImageRegistry == null) {
+ initializeImageRegistry();
+ }
+ return fgImageRegistry;
+ }
+
+ private static void initializeImageRegistry() {
+ fgImageRegistry= new ImageRegistry(DLTKDebugUIPlugin.getStandardDisplay());
+ declareImages();
+ }
+
+ private static void declareImages() {
+ declareRegistryImage(IMG_OBJS_EXCEPTION, T_OBJ + "jexception_obj.gif"); //$NON-NLS-1$
+ declareRegistryImage(IMG_OBJS_EXCEPTION_DISABLED, T_OBJ + "jexceptiond_obj.gif"); //$NON-NLS-1$
+ declareRegistryImage(IMG_OVR_BREAKPOINT_INSTALLED, T_OVR + "installed_ovr.gif"); //$NON-NLS-1$
+ declareRegistryImage(IMG_OVR_BREAKPOINT_INSTALLED_DISABLED, T_OVR + "installed_ovr_disabled.gif"); //$NON-NLS-1$
+
+ declareRegistryImage(IMG_OBJS_LOCAL_VARIABLE, T_OBJ + "localvariable_obj.gif"); //$NON-NLS-1$
+
+ declareRegistryImage(IMG_OVR_METHOD_BREAKPOINT_ENTRY, T_OVR + "entry_ovr.gif"); //$NON-NLS-1$
+ declareRegistryImage(IMG_OVR_METHOD_BREAKPOINT_ENTRY_DISABLED, T_OVR + "entry_ovr_disabled.gif"); //$NON-NLS-1$
+ declareRegistryImage(IMG_OVR_METHOD_BREAKPOINT_EXIT, T_OVR + "exit_ovr.gif"); //$NON-NLS-1$
+ declareRegistryImage(IMG_OVR_METHOD_BREAKPOINT_EXIT_DISABLED, T_OVR + "exit_ovr_disabled.gif"); //$NON-NLS-1$
+
+ declareRegistryImage(IMG_OVR_CONDITIONAL_BREAKPOINT, T_OVR + "conditional_ovr.gif"); //$NON-NLS-1$
+ declareRegistryImage(IMG_OVR_CONDITIONAL_BREAKPOINT_DISABLED, T_OVR + "conditional_ovr_disabled.gif"); //$NON-NLS-1$
+
+ declareRegistryImage(IMG_OVR_SCOPED_BREAKPOINT, T_OVR + "scoped_ovr.gif"); //$NON-NLS-1$
+ declareRegistryImage(IMG_OVR_SCOPED_BREAKPOINT_DISABLED, T_OVR + "scoped_ovr_disabled.gif"); //$NON-NLS-1$
+
+ declareRegistryImage(IMG_OVR_UNCAUGHT_BREAKPOINT, T_OVR + "uncaught_ovr.gif"); //$NON-NLS-1$
+ declareRegistryImage(IMG_OVR_UNCAUGHT_BREAKPOINT_DISABLED, T_OVR + "uncaught_ovr_disabled.gif"); //$NON-NLS-1$
+
+ declareRegistryImage(IMG_OVR_CAUGHT_BREAKPOINT, T_OVR + "caught_ovr.gif"); //$NON-NLS-1$
+ declareRegistryImage(IMG_OVR_CAUGHT_BREAKPOINT_DISABLED, T_OVR + "caught_ovr_disabled.gif"); //$NON-NLS-1$
+
+ declareRegistryImage(IMG_OBJS_ERROR, T_OBJ + "jrtexception_obj.gif"); //$NON-NLS-1$
+
+ declareRegistryImage(IMG_OBJS_SNIPPET_EVALUATING, T_OBJ + "jsbook_run_obj.gif"); //$NON-NLS-1$
+
+ declareRegistryImage(IMG_VIEW_ARGUMENTS_TAB, T_EVIEW + "variable_tab.gif"); //$NON-NLS-1$
+
+ declareRegistryImage(IMG_OVR_OUT_OF_SYNCH, T_OVR + "error_co.gif"); //$NON-NLS-1$
+ declareRegistryImage(IMG_OVR_MAY_BE_OUT_OF_SYNCH, T_OVR + "warning_co.gif"); //$NON-NLS-1$
+ declareRegistryImage(IMG_OVR_SYNCHRONIZED, T_OVR + "sync_ovr.gif"); //$NON-NLS-1$
+
+ declareRegistryImage(IMG_OBJS_MONITOR, T_OBJ + "monitor_obj.gif"); //$NON-NLS-1$
+ declareRegistryImage(IMG_OVR_OWNED, T_OVR + "owned_ovr.gif"); //$NON-NLS-1$
+ declareRegistryImage(IMG_OVR_OWNS_MONITOR, T_OVR + "ownsmonitor_ovr.gif"); //$NON-NLS-1$
+ declareRegistryImage(IMG_OVR_IN_CONTENTION, T_OVR + "contention_ovr.gif"); //$NON-NLS-1$
+ declareRegistryImage(IMG_OVR_IN_CONTENTION_FOR_MONITOR, T_OVR + "contentionformonitor_ovr.gif"); //$NON-NLS-1$
+ declareRegistryImage(IMG_OVR_IN_DEADLOCK, T_OVR + "deadlock_ovr.gif"); //$NON-NLS-1$
+ declareRegistryImage(IMG_OBJS_CONTENDED_MONITOR, T_OBJ + "contended_monitor_obj.gif"); //$NON-NLS-1$
+ declareRegistryImage(IMG_OBJS_OWNED_MONITOR, T_OBJ + "owned_monitor_obj.gif"); //$NON-NLS-1$
+ declareRegistryImage(IMG_OBJS_THREAD_GROUP, T_OBJ + "threadgroup_obj.gif"); //$NON-NLS-1$
+
+ declareRegistryImage(IMG_WIZBAN_NEWSCRAPPAGE, T_WIZBAN + "newsbook_wiz.png"); //$NON-NLS-1$
+ declareRegistryImage(IMG_WIZBAN_LIBRARY, T_WIZBAN + "library_wiz.png"); //$NON-NLS-1$
+
+ declareRegistryImage(IMG_TOOL_TERMSNIPPET, T_ELCL + "term_sbook.gif"); //$NON-NLS-1$
+ declareRegistryImage(IMG_TOOL_TERMSNIPPET_HOVER, T_ELCL + "term_sbook.gif"); //$NON-NLS-1$
+ declareRegistryImage(IMG_TOOL_TERMSNIPPET_DISABLED, T_DLCL + "term_sbook.gif"); //$NON-NLS-1$
+
+ declareRegistryImage(IMG_OBJ_JAVA_INSPECT_EXPRESSION, T_OBJ + "insp_sbook.gif"); //$NON-NLS-1$
+ declareRegistryImage(IMG_OBJS_CLASSPATH, T_OBJ + "classpath_obj.gif"); //$NON-NLS-1$
+
+ declareRegistryImage(IMG_OBJS_EXCEPTION_BRKPT_TYPE, T_OBJ + "jexcept_obj.gif"); //$NON-NLS-1$
+ declareRegistryImage(IMG_OBJS_LINE_BRKPT_TYPE, T_OBJ + "jline_obj.gif"); //$NON-NLS-1$
+ declareRegistryImage(IMG_OBJS_CLASSLOAD_BRKPT_TYPE, T_OBJ + "jload_obj.gif"); //$NON-NLS-1$
+ declareRegistryImage(IMG_OBJS_METHOD_BRKPT_TYPE, T_OBJ + "jmeth_obj.gif"); //$NON-NLS-1$
+ declareRegistryImage(IMG_OBJS_JSP_BRKPT_TYPE, T_OBJ + "jspbrkpt_obj.gif"); //$NON-NLS-1$
+ declareRegistryImage(IMG_OBJS_WATCHPOINT_TYPE, T_OBJ + "jwatch_obj.gif"); //$NON-NLS-1$
+
+ }
+
+
+
+ /**
+ * Declare an Image in the registry table.
+ * @param key The key to use when registering the image
+ * @param path The path where the image can be found. This path is relative to where
+ * this plugin class is found (i.e. typically the packages directory)
+ */
+ private final static void declareRegistryImage(String key, String path) {
+ ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor();
+ Bundle bundle = Platform.getBundle(DLTKDebugUIPlugin.getUniqueIdentifier());
+ URL url = null;
+ if (bundle != null){
+ url = FileLocator.find(bundle, new Path(path), null);
+ desc = ImageDescriptor.createFromURL(url);
+ }
+ fgImageRegistry.put(key, desc);
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/DbgpServiceNotAvailableStatusHandler.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/DbgpServiceNotAvailableStatusHandler.java
new file mode 100644
index 0000000..1ea4536
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/DbgpServiceNotAvailableStatusHandler.java
@@ -0,0 +1,25 @@
+package org.eclipse.dltk.internal.debug.ui;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.debug.core.IStatusHandler;
+import org.eclipse.dltk.debug.ui.DLTKDebugUIPlugin;
+import org.eclipse.jface.dialogs.MessageDialog;
+
+public class DbgpServiceNotAvailableStatusHandler implements IStatusHandler {
+ public Object handleStatus(IStatus status, Object source)
+ throws CoreException {
+
+ DLTKDebugUIPlugin.getStandardDisplay().syncExec(new Runnable() {
+ public void run() {
+ String title = "Dbgp service not avaialble";
+ String message = "Dbgp service not avaialble. Check port settings";
+
+ MessageDialog.openError(DLTKDebugUIPlugin
+ .getActiveWorkbenchShell(), title, message);
+ }
+ });
+
+ return null;
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/DebugImageDescriptor.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/DebugImageDescriptor.java
new file mode 100644
index 0000000..e9c5393
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/DebugImageDescriptor.java
@@ -0,0 +1,288 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.dltk.internal.debug.ui;
+
+import org.eclipse.jface.resource.CompositeImageDescriptor;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.Point;
+
+public class DebugImageDescriptor extends CompositeImageDescriptor {
+
+ /** Flag to render the is out of synch adornment */
+ public final static int IS_OUT_OF_SYNCH = 0x0001;
+ /** Flag to render the may be out of synch adornment */
+ public final static int MAY_BE_OUT_OF_SYNCH = 0x0002;
+ /** Flag to render the installed breakpoint adornment */
+ public final static int INSTALLED = 0x0004;
+ /** Flag to render the entry method breakpoint adornment */
+ public final static int ENTRY = 0x0008;
+ /** Flag to render the exit method breakpoint adornment */
+ public final static int EXIT = 0x0010;
+ /** Flag to render the enabled breakpoint adornment */
+ public final static int ENABLED = 0x0020;
+ /** Flag to render the conditional breakpoint adornment */
+ public final static int CONDITIONAL = 0x0040;
+ /** Flag to render the caught breakpoint adornment */
+ public final static int CAUGHT = 0x0080;
+ /** Flag to render the uncaught breakpoint adornment */
+ public final static int UNCAUGHT = 0x0100;
+ /** Flag to render the scoped breakpoint adornment */
+ public final static int SCOPED = 0x0200;
+
+ /** Flag to render the owning a monitor thread adornment */
+ public final static int OWNS_MONITOR = 0x0400;
+ /** Flag to render the owned monitor adornment */
+ public final static int OWNED_MONITOR = 0x0800;
+ /** Flag to render the in contention monitor adornment */
+ public final static int CONTENTED_MONITOR = 0x1000;
+ /** Flag to render the in contention for monitor thread adornment */
+ public final static int IN_CONTENTION_FOR_MONITOR = 0x2000;
+ /** Flag to render the in deadlock adornment */
+ public final static int IN_DEADLOCK = 0x8000;
+
+ /** Flag to render the synchronized stack frame adornment */
+ public final static int SYNCHRONIZED = 0x4000;
+
+ private ImageDescriptor fBaseImage;
+ private int fFlags;
+ private Point fSize;
+
+ /**
+ * Create a new JDIImageDescriptor.
+ *
+ * @param baseImage
+ * an image descriptor used as the base image
+ * @param flags
+ * flags indicating which adornments are to be rendered
+ *
+ */
+ public DebugImageDescriptor(ImageDescriptor baseImage, int flags) {
+ setBaseImage(baseImage);
+ setFlags(flags);
+ }
+
+ /**
+ * @see CompositeImageDescriptor#getSize()
+ */
+ protected Point getSize() {
+ if (fSize == null) {
+ ImageData data = getBaseImage().getImageData();
+ setSize(new Point(data.width, data.height));
+ }
+ return fSize;
+ }
+
+ /**
+ * @see Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object object) {
+ if (!(object instanceof DebugImageDescriptor)) {
+ return false;
+ }
+
+ DebugImageDescriptor other = (DebugImageDescriptor) object;
+ return (getBaseImage().equals(other.getBaseImage()) && getFlags() == other
+ .getFlags());
+ }
+
+ /**
+ * @see Object#hashCode()
+ */
+ public int hashCode() {
+ return getBaseImage().hashCode() | getFlags();
+ }
+
+ /**
+ * @see CompositeImageDescriptor#drawCompositeImage(int, int)
+ */
+ protected void drawCompositeImage(int width, int height) {
+ ImageData bg = getBaseImage().getImageData();
+ if (bg == null) {
+ bg = DEFAULT_IMAGE_DATA;
+ }
+ drawImage(bg, 0, 0);
+ drawOverlays();
+ }
+
+ private ImageData getImageData(String imageDescriptorKey) {
+ return DLTKDebugImages.getImageDescriptor(imageDescriptorKey)
+ .getImageData();
+ }
+
+ /**
+ * Add any overlays to the image as specified in the flags.
+ */
+ protected void drawOverlays() {
+ int flags = getFlags();
+ int x = 0;
+ int y = 0;
+ ImageData data = null;
+ if ((flags & IS_OUT_OF_SYNCH) != 0) {
+ x = getSize().x;
+ y = 0;
+ data = getImageData(DLTKDebugImages.IMG_OVR_OUT_OF_SYNCH);
+ x -= data.width;
+ drawImage(data, x, y);
+ } else if ((flags & MAY_BE_OUT_OF_SYNCH) != 0) {
+ x = getSize().x;
+ y = 0;
+ data = getImageData(DLTKDebugImages.IMG_OVR_MAY_BE_OUT_OF_SYNCH);
+ x -= data.width;
+ drawImage(data, x, y);
+ } else if ((flags & SYNCHRONIZED) != 0) {
+ x = getSize().x;
+ y = 0;
+ data = getImageData(DLTKDebugImages.IMG_OVR_SYNCHRONIZED);
+ x -= data.width;
+ drawImage(data, x, y);
+ } else {
+ if ((flags & IN_DEADLOCK) != 0) {
+ x = 0;
+ y = 0;
+ data = getImageData(DLTKDebugImages.IMG_OVR_IN_DEADLOCK);
+ drawImage(data, x, y);
+ }
+ if ((flags & OWNED_MONITOR) != 0) {
+ x = getSize().x;
+ y = getSize().y;
+ data = getImageData(DLTKDebugImages.IMG_OVR_OWNED);
+ x -= data.width;
+ y -= data.height;
+ drawImage(data, x, y);
+ } else if ((flags & CONTENTED_MONITOR) != 0) {
+ x = getSize().x;
+ y = getSize().y;
+ data = getImageData(DLTKDebugImages.IMG_OVR_IN_CONTENTION);
+ x -= data.width;
+ y -= data.height;
+ drawImage(data, x, y);
+ } else if ((flags & OWNS_MONITOR) != 0) {
+ x = getSize().x;
+ y = 0;
+ data = getImageData(DLTKDebugImages.IMG_OVR_OWNS_MONITOR);
+ x -= data.width;
+ drawImage(data, x, y);
+ } else if ((flags & IN_CONTENTION_FOR_MONITOR) != 0) {
+ x = getSize().x;
+ y = 0;
+ data = getImageData(DLTKDebugImages.IMG_OVR_IN_CONTENTION_FOR_MONITOR);
+ x -= data.width;
+ drawImage(data, x, y);
+ } else {
+ drawBreakpointOverlays();
+ }
+ }
+ }
+
+ protected void drawBreakpointOverlays() {
+ int flags = getFlags();
+ int x = 0;
+ int y = 0;
+ ImageData data = null;
+ if ((flags & INSTALLED) != 0) {
+ x = 0;
+ y = getSize().y;
+ if ((flags & ENABLED) != 0) {
+ data = getImageData(DLTKDebugImages.IMG_OVR_BREAKPOINT_INSTALLED);
+ } else {
+ data = getImageData(DLTKDebugImages.IMG_OVR_BREAKPOINT_INSTALLED_DISABLED);
+ }
+
+ y -= data.height;
+ drawImage(data, x, y);
+ }
+ if ((flags & CAUGHT) != 0) {
+ if ((flags & ENABLED) != 0) {
+ data = getImageData(DLTKDebugImages.IMG_OVR_CAUGHT_BREAKPOINT);
+ } else {
+ data = getImageData(DLTKDebugImages.IMG_OVR_CAUGHT_BREAKPOINT_DISABLED);
+ }
+ x = 0;
+ y = 0;
+ drawImage(data, x, y);
+ }
+ if ((flags & UNCAUGHT) != 0) {
+ if ((flags & ENABLED) != 0) {
+ data = getImageData(DLTKDebugImages.IMG_OVR_UNCAUGHT_BREAKPOINT);
+ } else {
+ data = getImageData(DLTKDebugImages.IMG_OVR_UNCAUGHT_BREAKPOINT_DISABLED);
+ }
+ x = data.width;
+ y = data.height;
+ drawImage(data, x, y);
+ }
+ if ((flags & SCOPED) != 0) {
+ if ((flags & ENABLED) != 0) {
+ data = getImageData(DLTKDebugImages.IMG_OVR_SCOPED_BREAKPOINT);
+ } else {
+ data = getImageData(DLTKDebugImages.IMG_OVR_SCOPED_BREAKPOINT_DISABLED);
+ }
+ x = 0;
+ y = getSize().y;
+ y -= data.height;
+ drawImage(data, x, y);
+ }
+ if ((flags & CONDITIONAL) != 0) {
+ if ((flags & ENABLED) != 0) {
+ data = getImageData(DLTKDebugImages.IMG_OVR_CONDITIONAL_BREAKPOINT);
+ } else {
+ data = getImageData(DLTKDebugImages.IMG_OVR_CONDITIONAL_BREAKPOINT_DISABLED);
+ }
+ x = 0;
+ y = 0;
+ drawImage(data, x, y);
+ }
+ if ((flags & ENTRY) != 0) {
+ x = getSize().x;
+ y = 0;
+ if ((flags & ENABLED) != 0) {
+ data = getImageData(DLTKDebugImages.IMG_OVR_METHOD_BREAKPOINT_ENTRY);
+ } else {
+ data = getImageData(DLTKDebugImages.IMG_OVR_METHOD_BREAKPOINT_ENTRY_DISABLED);
+ }
+ x -= data.width;
+ drawImage(data, x, y);
+ }
+ if ((flags & EXIT) != 0) {
+ x = getSize().x;
+ y = getSize().y;
+ if ((flags & ENABLED) != 0) {
+ data = getImageData(DLTKDebugImages.IMG_OVR_METHOD_BREAKPOINT_EXIT);
+ } else {
+ data = getImageData(DLTKDebugImages.IMG_OVR_METHOD_BREAKPOINT_EXIT_DISABLED);
+ }
+ x -= data.width;
+ y -= data.height;
+ drawImage(data, x, y);
+ }
+ }
+
+ protected ImageDescriptor getBaseImage() {
+ return fBaseImage;
+ }
+
+ protected void setBaseImage(ImageDescriptor baseImage) {
+ fBaseImage = baseImage;
+ }
+
+ protected int getFlags() {
+ return fFlags;
+ }
+
+ protected void setFlags(int flags) {
+ fFlags = flags;
+ }
+
+ protected void setSize(Point size) {
+ fSize = size;
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/DebuggingEngineNotConnectedStatusHandler.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/DebuggingEngineNotConnectedStatusHandler.java
new file mode 100644
index 0000000..8ca5543
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/DebuggingEngineNotConnectedStatusHandler.java
@@ -0,0 +1,25 @@
+package org.eclipse.dltk.internal.debug.ui;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.debug.core.IStatusHandler;
+import org.eclipse.dltk.debug.ui.DLTKDebugUIPlugin;
+import org.eclipse.jface.dialogs.MessageDialog;
+
+public class DebuggingEngineNotConnectedStatusHandler implements IStatusHandler {
+ public Object handleStatus(IStatus status, Object source)
+ throws CoreException {
+
+ DLTKDebugUIPlugin.getStandardDisplay().syncExec(new Runnable() {
+ public void run() {
+ String title = "Debugging engine not avaialble";
+ String message = "Debugging engine cannot connect to dbgp service during period of time";
+
+ MessageDialog.openError(DLTKDebugUIPlugin
+ .getActiveWorkbenchShell(), title, message);
+ }
+ });
+
+ return null;
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/DebuggingEngineNotStartedStatusHandler.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/DebuggingEngineNotStartedStatusHandler.java
new file mode 100644
index 0000000..0631aac
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/DebuggingEngineNotStartedStatusHandler.java
@@ -0,0 +1,25 @@
+package org.eclipse.dltk.internal.debug.ui;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.debug.core.IStatusHandler;
+import org.eclipse.dltk.debug.ui.DLTKDebugUIPlugin;
+import org.eclipse.jface.dialogs.MessageDialog;
+
+public class DebuggingEngineNotStartedStatusHandler implements IStatusHandler {
+ public Object handleStatus(IStatus status, Object source)
+ throws CoreException {
+
+ DLTKDebugUIPlugin.getStandardDisplay().syncExec(new Runnable() {
+ public void run() {
+ String title = "Debugging engine not started";
+ String message = "Debugging engine not started. Please check its settings.";
+
+ MessageDialog.openError(DLTKDebugUIPlugin
+ .getActiveWorkbenchShell(), title, message);
+ }
+ });
+
+ return null;
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/DltkRetargettableActionAdapterFactory.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/DltkRetargettableActionAdapterFactory.java
new file mode 100644
index 0000000..23e5ceb
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/DltkRetargettableActionAdapterFactory.java
@@ -0,0 +1,23 @@
+package org.eclipse.dltk.internal.debug.ui;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.debug.ui.actions.IRunToLineTarget;
+import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
+
+public class DltkRetargettableActionAdapterFactory implements IAdapterFactory {
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adapterType == IRunToLineTarget.class) {
+ return new DltkRunToLineAdapter();
+ }
+ else if (adapterType == IToggleBreakpointsTarget.class) {
+ return new DltkToggleBreakpointAdapter();
+ }
+
+ return null;
+ }
+
+ public Class[] getAdapterList() {
+ return new Class[] { IRunToLineTarget.class,
+ IToggleBreakpointsTarget.class };
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/DltkRunToLineAdapter.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/DltkRunToLineAdapter.java
new file mode 100644
index 0000000..92c3509
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/DltkRunToLineAdapter.java
@@ -0,0 +1,71 @@
+package org.eclipse.dltk.internal.debug.ui;
+
+import java.net.URI;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.model.IDebugElement;
+import org.eclipse.debug.core.model.IDebugTarget;
+import org.eclipse.debug.core.model.ISuspendResume;
+import org.eclipse.debug.ui.actions.IRunToLineTarget;
+import org.eclipse.dltk.debug.core.model.IScriptDebugTarget;
+import org.eclipse.dltk.debug.internal.core.model.ScriptLineBreakpoint;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+public class DltkRunToLineAdapter implements IRunToLineTarget {
+
+ protected ITextEditor getPartEditor(IWorkbenchPart part) {
+ if (part instanceof ITextEditor) {
+ return (ITextEditor) part;
+ }
+
+ return null;
+ }
+
+ protected IResource getPartResource(IWorkbenchPart part) {
+ ITextEditor textEditor = getPartEditor(part);
+ if (textEditor != null) {
+ IResource resource = (IResource) textEditor.getEditorInput()
+ .getAdapter(IResource.class);
+ return resource;
+ }
+
+ return null;
+ }
+
+ public DltkRunToLineAdapter() {
+
+ }
+
+ public boolean canRunToLine(IWorkbenchPart part, ISelection selection,
+ ISuspendResume target) {
+ return true;
+ }
+
+ public void runToLine(IWorkbenchPart part, ISelection selection,
+ ISuspendResume target) throws CoreException {
+
+ if (selection instanceof ITextSelection) {
+ ITextSelection textSelection = (ITextSelection) selection;
+
+ IResource resource = getPartResource(part);
+
+ URI uri = ScriptLineBreakpoint.makeUri(resource);
+
+ int lineNumber = textSelection.getStartLine() + 1; // one based
+
+ if (target instanceof IDebugElement) {
+ IDebugTarget debugTarget = ((IDebugElement) target)
+ .getDebugTarget();
+ if (debugTarget instanceof IScriptDebugTarget) {
+ ((IScriptDebugTarget) debugTarget).runToLine(uri,
+ lineNumber);
+ target.resume();
+ }
+ }
+ }
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/DltkToggleBreakpointAdapter.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/DltkToggleBreakpointAdapter.java
new file mode 100644
index 0000000..d240d16
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/DltkToggleBreakpointAdapter.java
@@ -0,0 +1,99 @@
+package org.eclipse.dltk.internal.debug.ui;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.debug.core.model.ILineBreakpoint;
+import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
+import org.eclipse.debug.ui.actions.IToggleBreakpointsTargetExtension;
+import org.eclipse.dltk.debug.internal.core.model.ScriptModelConstants;
+import org.eclipse.dltk.debug.ui.BreakpointUtils;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+public class DltkToggleBreakpointAdapter implements IToggleBreakpointsTarget {
+
+ protected ITextEditor getPartEditor(IWorkbenchPart part) {
+ if (part instanceof ITextEditor) {
+ return (ITextEditor) part;
+ }
+
+ return null;
+ }
+
+ protected IResource getPartResource(IWorkbenchPart part) {
+ ITextEditor textEditor = getPartEditor(part);
+ if (textEditor != null) {
+ IResource resource = (IResource) textEditor.getEditorInput()
+ .getAdapter(IResource.class);
+ return resource;
+ }
+
+ return null;
+ }
+
+ public DltkToggleBreakpointAdapter() {
+
+ }
+
+ public void toggleLineBreakpoints(IWorkbenchPart part, ISelection selection)
+ throws CoreException {
+ if (selection instanceof ITextSelection) {
+
+ ITextSelection textSelection = (ITextSelection) selection;
+ int lineNumber = textSelection.getStartLine() + 1; //one based
+
+ //System.out.println("Selection: " + textSelection);
+ //System.out.println("Line number: " + lineNumber);
+ //System.out.println("Offset: " + textSelection.getOffset());
+ //System.out.println("Length: " + textSelection.getLength());
+
+ IResource resource = getPartResource(part);
+
+ if (resource != null) {
+ IBreakpoint[] breakpoints = DebugPlugin.getDefault()
+ .getBreakpointManager().getBreakpoints(
+ ScriptModelConstants.MODEL_ID);
+
+ for (int i = 0; i < breakpoints.length; i++) {
+ IBreakpoint breakpoint = breakpoints[i];
+ if (resource.equals(breakpoint.getMarker().getResource())) {
+ if (((ILineBreakpoint) breakpoint).getLineNumber() == lineNumber) {
+ // delete existing breakpoint
+ breakpoint.delete();
+ return;
+ }
+ }
+ }
+
+ BreakpointUtils.addLineBreakpoint(getPartEditor(part), lineNumber);
+ }
+ }
+ }
+
+ public boolean canToggleLineBreakpoints(IWorkbenchPart part,
+ ISelection selection) {
+ return getPartResource(part) != null;
+ }
+
+ public void toggleMethodBreakpoints(IWorkbenchPart part,
+ ISelection selection) throws CoreException {
+ }
+
+ public boolean canToggleMethodBreakpoints(IWorkbenchPart part,
+ ISelection selection) {
+ return false;
+ }
+
+ public void toggleWatchpoints(IWorkbenchPart part, ISelection selection)
+ throws CoreException {
+ }
+
+ public boolean canToggleWatchpoints(IWorkbenchPart part,
+ ISelection selection) {
+ return false;
+ }
+}
\ No newline at end of file
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/IDLTKDebugHelpContextIds.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/IDLTKDebugHelpContextIds.java
new file mode 100644
index 0000000..d945643
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/IDLTKDebugHelpContextIds.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.dltk.internal.debug.ui;
+
+import org.eclipse.dltk.debug.ui.DLTKDebugUIPlugin;
+
+
+/**
+ * Help context ids for the Script Debug UI.
+ * <p>
+ * This interface contains constants only; it is not intended to be implemented
+ * or extended.
+ * </p>
+ *
+ */
+public interface IDLTKDebugHelpContextIds {
+
+ public static final String PREFIX= DLTKDebugUIPlugin.PLUGIN_ID + '.';
+
+ // view parts
+ public static final String DISPLAY_VIEW= PREFIX + "display_view_context"; //$NON-NLS-1$
+ public static final String STACK_TRACE_CONSOLE = PREFIX + "stack_trace_console_context"; //$NON-NLS-1$
+
+ //dialogs
+ public static final String EDIT_INTERPRETER_DIALOG= PREFIX + "edit_interpreter_dialog_context"; //$NON-NLS-1$
+ public static final String INTERPRETER_DETAILS_DIALOG= PREFIX + "interpreter_details_dialog_context"; //$NON-NLS-1$
+ public static final String MAIN_TYPE_SELECTION_DIALOG= PREFIX + "main_type_selection_dialog_context"; //$NON-NLS-1$
+ public static final String EDIT_DETAIL_FORMATTER_DIALOG= PREFIX + "edit_detail_formatter_dialog_context"; //$NON-NLS-1$
+ public static final String INSTANCE_BREAKPOINT_SELECTION_DIALOG= PREFIX + "instance_breakpoint_selection_dialog_context"; //$NON-NLS-1$
+ public static final String SNIPPET_IMPORTS_DIALOG= PREFIX + "snippet_imports_dialog_context"; //$NON-NLS-1$
+ public static final String ADD_EXCEPTION_DIALOG= PREFIX + "add_exception_dialog_context"; //$NON-NLS-1$
+ public static final String DETAIL_DISPLAY_OPTIONS_DIALOG= PREFIX + "detail_options_dialog_context"; //$NON-NLS-1$
+
+ // Preference/Property pages
+ public static final String INTERPRETER_PREFERENCE_PAGE= PREFIX + "interpreter_preference_page_context"; //$NON-NLS-1$
+ public static final String INTERPRETER_PROFILES_PAGE= PREFIX + "interpreter_profiles_page_context"; //$NON-NLS-1$
+ public static final String LAUNCH_INTERPRETER_PROPERTY_PAGE= PREFIX + "launch_interpreter_property_page_context"; //$NON-NLS-1$
+ public static final String SCRIPT_DEBUG_PREFERENCE_PAGE= PREFIX + "script_debug_preference_page_context"; //$NON-NLS-1$
+ public static final String SCRIPT_STEP_FILTER_PREFERENCE_PAGE= PREFIX + "script_step_filter_preference_page_context"; //$NON-NLS-1$
+ public static final String SCRIPT_BREAKPOINT_PREFERENCE_PAGE= PREFIX + "script_breakpoint_preference_page_context"; //$NON-NLS-1$
+ public static final String SCRIPT_DETAIL_FORMATTER_PREFERENCE_PAGE= PREFIX + "script_detail_formatter_preference_page_context"; //$NON-NLS-1$
+ public static final String SCRIPT_PRIMITIVES_PREFERENCE_PAGE= PREFIX + "script_primitives_preference_page_context"; //$NON-NLS-1$
+
+ // reused ui-blocks
+ public static final String SOURCE_ATTACHMENT_BLOCK= PREFIX + "source_attachment_context"; //$NON-NLS-1$
+ public static final String WORKING_DIRECTORY_BLOCK= PREFIX + "working_directory_context"; //$NON-NLS-1$
+
+ // application launch configuration dialog tabs
+ public static final String LAUNCH_CONFIGURATION_DIALOG_ARGUMENTS_TAB= PREFIX + "launch_configuration_dialog_arguments_tab"; //$NON-NLS-1$
+ public static final String LAUNCH_CONFIGURATION_DIALOG_CLASSPATH_TAB= PREFIX + "launch_configuration_dialog_classpath_tab"; //$NON-NLS-1$
+ public static final String LAUNCH_CONFIGURATION_DIALOG_CONNECT_TAB= PREFIX + "launch_configuration_dialog_connect_tab"; //$NON-NLS-1$
+ public static final String LAUNCH_CONFIGURATION_DIALOG_INTERPRETER_TAB= PREFIX + "launch_configuration_dialog_interpreter_tab"; //$NON-NLS-1$
+ public static final String LAUNCH_CONFIGURATION_DIALOG_MAIN_TAB= PREFIX + "launch_configuration_dialog_main_tab"; //$NON-NLS-1$
+ public static final String LAUNCH_CONFIGURATION_DIALOG_SOURCE_TAB= PREFIX + "launch_configuration_dialog_source_tab"; //$NON-NLS-1$
+
+ // applet launch configuration dialog tabs
+ public static final String LAUNCH_CONFIGURATION_DIALOG_APPLET_MAIN_TAB= PREFIX + "launch_configuration_dialog_applet_main_tab"; //$NON-NLS-1$
+ public static final String LAUNCH_CONFIGURATION_DIALOG_APPLET_ARGUMENTS_TAB= PREFIX + "launch_configuration_dialog_applet_arguments_tab"; //$NON-NLS-1$
+
+ //actions
+ public static final String STEP_INTO_SELECTION_ACTION = PREFIX + "step_into_selection_action"; //$NON-NLS-1$
+ public static final String SHOW_STATICS_ACTION = PREFIX + "show_static_action_context"; //$NON-NLS-1$
+ public static final String SHOW_CONSTANTS_ACTION = PREFIX + "show_constants_action_context"; //$NON-NLS-1$
+ public static final String CLEAR_DISPLAY_VIEW_ACTION = PREFIX + "clear_display_view_action_context"; //$NON-NLS-1$
+ public static final String TERMINATE_SCRAPBOOK_Interpreter_ACTION = PREFIX + "terminate_scrapbook_Interpreter_action_context"; //$NON-NLS-1$
+ public static final String SCRAPBOOK_IMPORTS_ACTION = PREFIX + "scrapbook_imports_action_context"; //$NON-NLS-1$
+
+ public static final String NEW_SNIPPET_WIZARD_PAGE= PREFIX + "new_snippet_wizard_page_context"; //$NON-NLS-1$
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/ImageDescriptorRegistry.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/ImageDescriptorRegistry.java
new file mode 100644
index 0000000..b9b5ce8
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/ImageDescriptorRegistry.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.dltk.internal.debug.ui;
+
+
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.dltk.debug.ui.DLTKDebugUIPlugin;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+
+
+/**
+ * A registry that maps <code>ImageDescriptors</code> to <code>Image</code>.
+ */
+public class ImageDescriptorRegistry {
+
+ private HashMap fRegistry= new HashMap(10);
+ private Display fDisplay;
+
+ /**
+ * Creates a new image descriptor registry for the current or default display,
+ * respectively.
+ */
+ public ImageDescriptorRegistry() {
+ this(DLTKDebugUIPlugin.getStandardDisplay());
+ }
+
+ /**
+ * Creates a new image descriptor registry for the given display. All images
+ * managed by this registry will be disposed when the display gets disposed.
+ *
+ * @param display the display the images managed by this registry are allocated for
+ */
+ public ImageDescriptorRegistry(Display display) {
+ fDisplay= display;
+ Assert.isNotNull(fDisplay);
+ hookDisplay();
+ }
+
+ /**
+ * Returns the image associated with the given image descriptor.
+ *
+ * @param descriptor the image descriptor for which the registry manages an image
+ * @return the image associated with the image descriptor or <code>null</code>
+ * if the image descriptor can't create the requested image.
+ */
+ public Image get(ImageDescriptor descriptor) {
+ if (descriptor == null)
+ descriptor= ImageDescriptor.getMissingImageDescriptor();
+
+ Image result= (Image)fRegistry.get(descriptor);
+ if (result != null)
+ return result;
+
+ Assert.isTrue(fDisplay == DLTKDebugUIPlugin.getStandardDisplay(), "DebugUIMessages.ImageDescriptorRegistry_Allocating_image_for_wrong_display_1");
+ result= descriptor.createImage();
+ if (result != null)
+ fRegistry.put(descriptor, result);
+ return result;
+ }
+
+ /**
+ * Disposes all images managed by this registry.
+ */
+ public void dispose() {
+ for (Iterator iter= fRegistry.values().iterator(); iter.hasNext(); ) {
+ Image image= (Image)iter.next();
+ image.dispose();
+ }
+ fRegistry.clear();
+ }
+
+ private void hookDisplay() {
+ fDisplay.asyncExec(new Runnable() {
+ public void run() {
+ fDisplay.disposeExec(new Runnable() {
+ public void run() {
+ dispose();
+ }
+ });
+ }
+ });
+
+ }
+}
+
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/ScriptDebugOptionsManager.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/ScriptDebugOptionsManager.java
new file mode 100644
index 0000000..29a96c4
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/ScriptDebugOptionsManager.java
@@ -0,0 +1,143 @@
+package org.eclipse.dltk.internal.debug.ui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IMarkerDelta;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.DebugEvent;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.IBreakpointsListener;
+import org.eclipse.debug.core.IDebugEventSetListener;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchListener;
+import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.dltk.core.DLTKCore;
+import org.eclipse.dltk.debug.core.model.IScriptBreakpoint;
+import org.eclipse.dltk.debug.core.model.IScriptBreakpointListener;
+import org.eclipse.dltk.debug.ui.DLTKDebugUIPlugin;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.viewers.ILabelProvider;
+
+public class ScriptDebugOptionsManager implements IDebugEventSetListener,
+ IPropertyChangeListener, IScriptBreakpointListener, ILaunchListener,
+ IBreakpointsListener {
+
+ private static ScriptDebugOptionsManager fgOptionsManager;
+
+ /**
+ * A label provider
+ */
+ private static ILabelProvider fLabelProvider = DebugUITools
+ .newDebugModelPresentation();
+
+ public void handleDebugEvents(DebugEvent[] events) {
+ }
+
+ public void launchAdded(ILaunch launch) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void launchChanged(ILaunch launch) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void launchRemoved(ILaunch launch) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void breakpointsAdded(IBreakpoint[] breakpoints) {
+ // if a breakpoint is added, but already has a message, do not update it
+ List update = new ArrayList();
+ for (int i = 0; i < breakpoints.length; i++) {
+ IBreakpoint breakpoint = breakpoints[i];
+ try {
+ if (breakpoint instanceof IScriptBreakpoint
+ && breakpoint.getMarker().getAttribute(IMarker.MESSAGE) == null) {
+ update.add(breakpoint);
+ }
+ } catch (CoreException e) {
+ DLTKDebugUIPlugin.log(e);
+ }
+ }
+ if (!update.isEmpty()) {
+ updateBreakpointMessages((IBreakpoint[]) update
+ .toArray(new IBreakpoint[update.size()]));
+ }
+ }
+
+ public void breakpointsChanged(IBreakpoint[] breakpoints,
+ IMarkerDelta[] deltas) {
+ updateBreakpointMessages(breakpoints);
+
+ }
+
+ private void updateBreakpointMessages(final IBreakpoint[] breakpoints) {
+ IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
+ public void run(IProgressMonitor monitor) throws CoreException {
+ for (int i = 0; i < breakpoints.length; i++) {
+ IBreakpoint breakpoint = breakpoints[i];
+ if (breakpoint instanceof IScriptBreakpoint) {
+ String info = fLabelProvider.getText(breakpoint);
+ breakpoint.getMarker().setAttribute(IMarker.MESSAGE,
+ info);
+ }
+ }
+ }
+ };
+ try {
+ ResourcesPlugin.getWorkspace().run(runnable, null, 0, null);
+ } catch (CoreException e) {
+ DLTKDebugUIPlugin.log(e);
+ }
+ }
+
+ public void breakpointsRemoved(IBreakpoint[] breakpoints,
+ IMarkerDelta[] deltas) {
+ if (DLTKCore.DEBUG) {
+ System.out.println("Removed breakpoints.");
+ }
+ }
+
+ public static ScriptDebugOptionsManager getDefault() {
+ if (fgOptionsManager == null) {
+ fgOptionsManager = new ScriptDebugOptionsManager();
+ }
+ return fgOptionsManager;
+ }
+
+ public void startup() {
+ // lazy initialization will occur on the first launch
+ DebugPlugin debugPlugin = DebugPlugin.getDefault();
+ debugPlugin.getLaunchManager().addLaunchListener(this);
+ debugPlugin.getBreakpointManager().addBreakpointListener(this);
+ }
+
+ public void shutdown() {
+ DebugPlugin debugPlugin = DebugPlugin.getDefault();
+ debugPlugin.removeDebugEventListener(this);
+ debugPlugin.getLaunchManager().removeLaunchListener(this);
+ debugPlugin.getBreakpointManager().removeBreakpointListener(this);
+ if (!DLTKDebugUIPlugin.getDefault().isShuttingDown()) {
+ // avert restoring the preference store at shutdown
+ DLTKDebugUIPlugin.getDefault().getPreferenceStore()
+ .removePropertyChangeListener(this);
+ }
+ // ScriptDebugModel.removeJavaBreakpointListener(this);
+ System.getProperties().remove(
+ DLTKDebugUIPlugin.getUniqueIdentifier() + ".debuggerActive"); //$NON-NLS-1$
+ }
+
+ public void propertyChange(org.eclipse.jface.util.PropertyChangeEvent event) {
+ // TODO Auto-generated method stub
+ System.out.println("Propety changed.");
+ }
+}
\ No newline at end of file
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/AbstractInterpreterComboBlock.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/AbstractInterpreterComboBlock.java
new file mode 100644
index 0000000..af0b99b
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/AbstractInterpreterComboBlock.java
@@ -0,0 +1,557 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.dltk.internal.debug.ui.interpreters;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.ListenerList;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.dltk.debug.ui.DLTKDebugUIPlugin;
+import org.eclipse.dltk.debug.ui.IDLTKDebugUIConstants;
+import org.eclipse.dltk.debug.ui.actions.ControlAccessibleListener;
+import org.eclipse.dltk.internal.launching.DLTKLaunchingPlugin;
+import org.eclipse.dltk.internal.ui.util.SWTUtil;
+import org.eclipse.dltk.launching.IDLTKLaunchConfigurationConstants;
+import org.eclipse.dltk.launching.IInterpreterInstall;
+import org.eclipse.dltk.launching.IInterpreterInstallType;
+import org.eclipse.dltk.launching.InterpreterStandin;
+import org.eclipse.dltk.launching.ScriptRuntime;
+import org.eclipse.jface.preference.IPreferencePage;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * A composite that displays installed InterpreterEnvironment's in a combo box, with a 'manage...'
+ * button to modify installed InterpreterEnvironments.
+ * <p>
+ * This block implements ISelectionProvider - it sends selection change events
+ * when the checked InterpreterEnvironment in the table changes, or when the "use default" button
+ * check state changes.
+ * </p>
+ */
+public abstract class AbstractInterpreterComboBlock {
+
+ public static final String PROPERTY_INTERPRETER = "PROPERTY_INTERPRETER"; //$NON-NLS-1$
+
+ /**
+ * This block's control
+ */
+ private Composite fControl;
+
+ /**
+ * Interpreters being displayed
+ */
+ private List fInterpreters = new ArrayList();
+
+ /**
+ * The main control
+ */
+ private Combo fCombo;
+
+ // Action buttons
+ private Button fManageButton;
+
+ /**
+ * InterpreterEnvironment change listeners
+ */
+ private ListenerList fListeners = new ListenerList();
+
+ /**
+ * Default InterpreterEnvironment descriptor or <code>null</code> if none.
+ */
+ private InterpreterDescriptor fDefaultDescriptor = null;
+
+ /**
+ * Specific InterpreterEnvironment descriptor or <code>null</code> if none.
+ */
+ private InterpreterDescriptor fSpecificDescriptor = null;
+
+ /**
+ * Default InterpreterEnvironment radio button or <code>null</code> if none
+ */
+ private Button fDefaultButton = null;
+
+ /**
+ * Selected InterpreterEnvironment radio button
+ */
+ private Button fSpecificButton = null;
+
+ /**
+ * The title used for the InterpreterEnvironment block
+ */
+ private String fTitle = null;
+
+ private IStatus fStatus = OK_STATUS;
+
+ private static IStatus OK_STATUS = new Status(IStatus.OK,
+ DLTKDebugUIPlugin.getUniqueIdentifier(), 0, "", null); //$NON-NLS-1$
+
+ public void addPropertyChangeListener(IPropertyChangeListener listener) {
+ fListeners.add(listener);
+ }
+
+ public void removePropertyChangeListener(IPropertyChangeListener listener) {
+ fListeners.remove(listener);
+ }
+
+ private void firePropertyChange() {
+ PropertyChangeEvent event = new PropertyChangeEvent(this, PROPERTY_INTERPRETER, null, getPath());
+ Object[] listeners = fListeners.getListeners();
+ for (int i = 0; i < listeners.length; i++) {
+ IPropertyChangeListener listener = (IPropertyChangeListener) listeners[i];
+ listener.propertyChange(event);
+ }
+ }
+
+ /**
+ * Creates this block's control in the given control.
+ *
+ * @param anscestor containing control
+ */
+ public void createControl(Composite ancestor) {
+ Font font = ancestor.getFont();
+ Composite comp = new Composite(ancestor, SWT.NONE);
+ GridLayout layout= new GridLayout();
+ comp.setLayout(new GridLayout());
+ comp.setLayoutData(new GridData(GridData.FILL_BOTH));
+ fControl = comp;
+ comp.setFont(font);
+
+ Group group= new Group(comp, SWT.NULL);
+ layout= new GridLayout();
+ layout.numColumns= 3;
+ group.setLayout(layout);
+ group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ group.setFont(font);
+
+ GridData data;
+
+ if (fTitle == null) {
+ fTitle = InterpretersMessages.InterpretersComboBlock_3;
+ }
+ group.setText(fTitle);
+
+ // display a 'use default InterpreterEnvironment' check box
+ if (fDefaultDescriptor != null) {
+ fDefaultButton = new Button(group, SWT.RADIO);
+ fDefaultButton.setText(fDefaultDescriptor.getDescription());
+ fDefaultButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ if (fDefaultButton.getSelection()) {
+ setUseDefaultInterpreter();
+ if (fInterpreters.isEmpty()) {
+ setStatus (new Status(IStatus.ERROR,
+ DLTKLaunchingPlugin.getUniqueIdentifier(),
+ IDLTKLaunchConfigurationConstants.ERR_NO_DEFAULT_INTERPRETER_INSTALL,
+ InterpretersMessages.InterpretersComboBlock_0,
+ null));
+ } else {
+ setStatus(OK_STATUS);
+ }
+ firePropertyChange();
+ }
+ }
+ });
+ data = new GridData();
+ data.horizontalSpan = 3;
+ fDefaultButton.setLayoutData(data);
+ fDefaultButton.setFont(font);
+ }
+
+ fSpecificButton = new Button(group, SWT.RADIO);
+ if (fSpecificDescriptor != null) {
+ fSpecificButton.setText(fSpecificDescriptor.getDescription());
+ } else {
+ fSpecificButton.setText(InterpretersMessages.InterpretersComboBlock_1);
+ }
+ fSpecificButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ if (fSpecificButton.getSelection()) {
+ fCombo.setEnabled(true);
+ if (fCombo.getText().length() == 0 && !fInterpreters.isEmpty()) {
+ fCombo.select(0);
+ }
+ if (fInterpreters.isEmpty()) {
+ setStatus (new Status(IStatus.ERROR,
+ DLTKLaunchingPlugin.getUniqueIdentifier(),
+ IDLTKLaunchConfigurationConstants.ERR_NO_DEFAULT_INTERPRETER_INSTALL,
+ InterpretersMessages.InterpretersComboBlock_0,
+ null));
+ } else {
+ setStatus(OK_STATUS);
+ }
+ firePropertyChange();
+ }
+ }
+ });
+ fSpecificButton.setFont(font);
+ data = new GridData(GridData.BEGINNING);
+ fSpecificButton.setLayoutData(data);
+
+ fCombo = new Combo(group, SWT.DROP_DOWN | SWT.READ_ONLY);
+ fCombo.setFont(font);
+ data= new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 1;
+ fCombo.setLayoutData(data);
+ ControlAccessibleListener.addListener(fCombo, fSpecificButton.getText());
+
+ fCombo.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ firePropertyChange();
+ }
+ });
+
+ fManageButton = createPushButton(group, InterpretersMessages.InterpretersComboBlock_2);
+ fManageButton.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event event) {
+ showInterpreterPreferencePage();
+ }
+ });
+
+ fillWithWorkspaceInterpreters();
+ if (fInterpreters.isEmpty()) {
+ setStatus (new Status(IStatus.ERROR,
+ DLTKLaunchingPlugin.getUniqueIdentifier(),
+ IDLTKLaunchConfigurationConstants.ERR_NO_DEFAULT_INTERPRETER_INSTALL,
+ InterpretersMessages.InterpretersComboBlock_0,
+ null));
+ } else {
+ setStatus(OK_STATUS);
+ }
+
+ }
+
+
+
+ /**
+ * Opens the given preference page, and updates when closed.
+ *
+ * @param id pref page id
+ * @param page pref page
+ */
+ protected void showPrefPage(String id, IPreferencePage page) {
+ DLTKDebugUIPlugin.showPreferencePage(id, page);
+ refreshInterpreters();
+ }
+
+ private void restoreCombo(List elements, Object element, Combo combo) {
+ int index = -1;
+ if (element != null) {
+ index = elements.indexOf(element);
+ }
+ if (index >= 0) {
+ combo.select(index);
+ } else {
+ combo.select(0);
+ }
+ }
+
+ protected Button createPushButton(Composite parent, String label) {
+ return SWTUtil.createPushButton(parent, label, null);
+ }
+
+ /**
+ * Returns this block's control
+ *
+ * @return control
+ */
+ public Control getControl() {
+ return fControl;
+ }
+
+ /**
+ * Sets the InterpreterEnvironments to be displayed in this block
+ *
+ * @param Interpreters InterpreterEnvironments to be displayed
+ */
+ protected void setInterpreters(List InterpreterEnvironments) {
+ fInterpreters.clear();
+ fInterpreters.addAll(InterpreterEnvironments);
+ // sort by name
+ Collections.sort(fInterpreters, new Comparator() {
+ public int compare(Object o1, Object o2) {
+ IInterpreterInstall left = (IInterpreterInstall)o1;
+ IInterpreterInstall right = (IInterpreterInstall)o2;
+ return left.getName().compareToIgnoreCase(right.getName());
+ }
+
+ public boolean equals(Object obj) {
+ return obj == this;
+ }
+ });
+ // now make an array of names
+ String[] names = new String[fInterpreters.size()];
+ Iterator iter = fInterpreters.iterator();
+ int i = 0;
+ while (iter.hasNext()) {
+ IInterpreterInstall Interpreter = (IInterpreterInstall)iter.next();
+ names[i] = Interpreter.getName();
+ i++;
+ }
+ fCombo.setItems(names);
+ fCombo.setVisibleItemCount(Math.min(names.length, 20));
+ }
+
+ protected Shell getShell() {
+ return getControl().getShell();
+ }
+
+ /**
+ * Selects a specific InterpreterEnvironment based on type/name.
+ *
+ * @param Interpreter InterpreterEnvironment
+ */
+ private void selectInterpreter(IInterpreterInstall Interpreter) {
+ fSpecificButton.setSelection(true);
+ fDefaultButton.setSelection(false);
+ fCombo.setEnabled(true);
+ int index = fInterpreters.indexOf(Interpreter);
+ if (index >= 0) {
+ fCombo.select(index);
+ }
+ firePropertyChange();
+ }
+
+
+ /**
+ * Returns the selected InterpreterEnvironment or <code>null</code> if none.
+ *
+ * @return the selected InterpreterEnvironment or <code>null</code> if none
+ */
+ public IInterpreterInstall getInterpreter() {
+ int index = fCombo.getSelectionIndex();
+ if (index >= 0) {
+ return (IInterpreterInstall)fInterpreters.get(index);
+ }
+ return null;
+ }
+
+
+
+
+ /**
+ * Sets the Default InterpreterEnvironment Descriptor for this block.
+ *
+ * @param descriptor default InterpreterEnvironment descriptor
+ */
+ public void setDefaultInterpreterDescriptor(InterpreterDescriptor descriptor) {
+ fDefaultDescriptor = descriptor;
+ setButtonTextFromDescriptor(fDefaultButton, descriptor);
+ }
+
+ private void setButtonTextFromDescriptor(Button button, InterpreterDescriptor descriptor) {
+ if (button != null) {
+ //update the description & InterpreterEnvironment in case it has changed
+ String currentText = button.getText();
+ String newText = descriptor.getDescription();
+ if (!newText.equals(currentText)) {
+ button.setText(newText);
+ fControl.layout();
+ }
+ }
+ }
+
+ /**
+ * Sets the specific InterpreterEnvironment Descriptor for this block.
+ *
+ * @param descriptor specific InterpreterEnvironment descriptor
+ */
+ public void setSpecificInterpreterDescriptor(InterpreterDescriptor descriptor) {
+ fSpecificDescriptor = descriptor;
+ setButtonTextFromDescriptor(fSpecificButton, descriptor);
+ }
+
+ /**
+ * Returns whether the 'use default InterpreterEnvironment' button is checked.
+ *
+ * @return whether the 'use default InterpreterEnvironment' button is checked
+ */
+ public boolean isDefaultInterpreter() {
+ if (fDefaultButton != null) {
+ return fDefaultButton.getSelection();
+ }
+ return false;
+ }
+
+ /**
+ * Sets this control to use the 'default' InterpreterEnvironment.
+ */
+ public void setUseDefaultInterpreter() {
+ if (fDefaultDescriptor != null) {
+ fDefaultButton.setSelection(true);
+ fSpecificButton.setSelection(false);
+ fCombo.setEnabled(false);
+ firePropertyChange();
+ }
+ }
+
+ /**
+ * Sets the title used for this InterpreterEnvironment block
+ *
+ * @param title title for this InterpreterEnvironment block
+ */
+ public void setTitle(String title) {
+ fTitle = title;
+ }
+
+ /**
+ * Refresh the default InterpreterEnvironment description.
+ */
+ public void refresh() {
+ setDefaultInterpreterDescriptor(fDefaultDescriptor);
+ }
+
+ public void refreshInterpreters () {
+ IInterpreterInstall prevInterpreterEnvironment = getInterpreter();
+ fillWithWorkspaceInterpreters();
+ if (fInterpreters.isEmpty()) {
+ setStatus (new Status(IStatus.ERROR,
+ DLTKLaunchingPlugin.getUniqueIdentifier(),
+ IDLTKLaunchConfigurationConstants.ERR_NO_DEFAULT_INTERPRETER_INSTALL,
+ InterpretersMessages.InterpretersComboBlock_0,
+ null));
+ } else {
+ setStatus(OK_STATUS);
+ }
+ restoreCombo(fInterpreters, prevInterpreterEnvironment, fCombo);
+
+ // update text
+ setDefaultInterpreterDescriptor(fDefaultDescriptor);
+ if (isDefaultInterpreter()) {
+ // reset in case default has changed
+ setUseDefaultInterpreter();
+ }
+ setPath(getPath());
+ firePropertyChange();
+ }
+
+ /**
+ * Returns a buildpath container path identifying the selected InterpreterEnvironment.
+ *
+ * @return buildpath container path or <code>null</code>
+
+ */
+ public IPath getPath() {
+ if (fSpecificButton.getSelection()) {
+ int index = fCombo.getSelectionIndex();
+ if (index >= 0) {
+ IInterpreterInstall Interpreter = (IInterpreterInstall) fInterpreters.get(index);
+ return ScriptRuntime.newInterpreterContainerPath(Interpreter);
+ }
+ return null;
+ }
+ return ScriptRuntime.newDefaultInterpreterContainerPath();
+ }
+
+ /**
+ * Sets the selection based on the given container path and returns
+ * a status indicating if the selection was successful.
+ *
+ * @param containerPath
+ * @return status
+ */
+ public void setPath(IPath containerPath) {
+ if (fInterpreters.isEmpty()) {
+ setStatus (new Status(IStatus.ERROR,
+ DLTKLaunchingPlugin.getUniqueIdentifier(),
+ IDLTKLaunchConfigurationConstants.ERR_NO_DEFAULT_INTERPRETER_INSTALL,
+ InterpretersMessages.InterpretersComboBlock_0,
+ null));
+ } else {
+ setStatus(OK_STATUS);
+ }
+ if (ScriptRuntime.newDefaultInterpreterContainerPath().equals(containerPath)) {
+ setUseDefaultInterpreter();
+ } else {
+ IInterpreterInstall install = ScriptRuntime.getInterpreterInstall(getCurrentLanguageNature(), containerPath);
+ if (install == null) {
+ setError(InterpretersMessages.InterpretersComboBlock_8);
+ } else {
+ selectInterpreter(install);
+ File location = install.getInstallLocation();
+ if (location == null) {
+ setError(InterpretersMessages.InterpretersComboBlock_12);
+ } else if (!location.exists()) {
+ setError(InterpretersMessages.InterpretersComboBlock_13);
+ }
+ }
+
+ }
+ }
+
+ private void setError(String message) {
+ setStatus(new Status(IStatus.ERROR, DLTKDebugUIPlugin.getUniqueIdentifier(),
+ IDLTKDebugUIConstants.INTERNAL_ERROR, message, null));
+ }
+
+ /**
+ * Returns the status of the interpreter selection.
+ *
+ * @return status
+ */
+ public IStatus getStatus() {
+ return fStatus;
+ }
+
+ private void setStatus(IStatus status) {
+ fStatus = status;
+ }
+
+ /**
+ * Shows window with appropriate language preference page.
+ *
+ */
+ protected abstract void showInterpreterPreferencePage ();
+
+ protected void fillWithWorkspaceInterpreters() {
+ // fill with interpreters
+ List standins = new ArrayList();
+ IInterpreterInstallType[] types = ScriptRuntime.getInterpreterInstallTypes();
+ for (int i = 0; i < types.length; i++) {
+ IInterpreterInstallType type = types[i];
+
+ //filter
+ if (type.getNatureId() != getCurrentLanguageNature ())
+ continue;
+
+ IInterpreterInstall[] installs = type.getInterpreterInstalls();
+ for (int j = 0; j < installs.length; j++) {
+ IInterpreterInstall install = installs[j];
+ standins.add(new InterpreterStandin(install));
+ }
+ }
+ setInterpreters(standins);
+ }
+
+ protected abstract String getCurrentLanguageNature ();
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/AbstractInterpreterContainerWizardPage.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/AbstractInterpreterContainerWizardPage.java
new file mode 100644
index 0000000..5b62090
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/AbstractInterpreterContainerWizardPage.java
@@ -0,0 +1,145 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.dltk.internal.debug.ui.interpreters;
+
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.IStatusHandler;
+import org.eclipse.dltk.core.DLTKCore;
+import org.eclipse.dltk.core.IBuildpathEntry;
+import org.eclipse.dltk.internal.debug.ui.DLTKDebugImages;
+import org.eclipse.dltk.internal.ui.wizards.IBuildpathContainerPage;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+
+
+/**
+ * Extension to allow a user to associate a InterpreterEnvironment with a Script project.
+ */
+public abstract class AbstractInterpreterContainerWizardPage extends WizardPage implements IBuildpathContainerPage {
+
+ /**
+ * The buildpath entry to be created.
+ */
+ private IBuildpathEntry fSelection;
+
+ /**
+ * InterpreterEnvironment control
+ */
+ private AbstractInterpreterComboBlock fInterpreterEnvironmentBlock;
+
+ /**
+ * Constructs a new page.
+ */
+ public AbstractInterpreterContainerWizardPage() {
+ super(InterpretersMessages.InterpreterContainerWizardPage_Interpreter_System_Library_1);
+ }
+
+ public boolean finish() {
+ IStatus status = fInterpreterEnvironmentBlock.getStatus();
+ if (!status.isOK()) {
+ return false;
+ }
+ IPath path = fInterpreterEnvironmentBlock.getPath();
+ fSelection = DLTKCore.newContainerEntry(path);
+ return true;
+ }
+
+ public IBuildpathEntry getSelection() {
+ return fSelection;
+ }
+
+ public void setSelection(IBuildpathEntry containerEntry) {
+ fSelection = containerEntry;
+ initializeFromSelection();
+ }
+
+ /**
+ * Initlaizes the InterpreterEnvironment selection
+ */
+ protected void initializeFromSelection() {
+ if (getControl() != null) {
+ if (fSelection == null) {
+ fInterpreterEnvironmentBlock.setUseDefaultInterpreter();
+ } else {
+ fInterpreterEnvironmentBlock.setPath(fSelection.getPath());
+ }
+ IStatus status = fInterpreterEnvironmentBlock.getStatus();
+ if (!status.isOK()) {
+ setErrorMessage(status.getMessage());
+ try {
+ IStatusHandler handler = DebugPlugin.getDefault().getStatusHandler(status);
+ if (handler != null) {
+ Boolean b = (Boolean)handler.handleStatus(status, this);
+ if (b.booleanValue()) {
+ fInterpreterEnvironmentBlock.refreshInterpreters();
+ }
+ }
+ } catch (CoreException e) {
+ }
+ }
+ }
+ }
+
+ protected abstract AbstractInterpreterComboBlock getInterpreterBlock ();
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ composite.setLayout(layout);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ composite.setLayoutData(gd);
+ composite.setFont(parent.getFont());
+ fInterpreterEnvironmentBlock = getInterpreterBlock();
+ fInterpreterEnvironmentBlock.setDefaultInterpreterDescriptor(new BuildInterpreterDescriptor(getInterpreterBlock ().getCurrentLanguageNature()));
+ fInterpreterEnvironmentBlock.setTitle(InterpretersMessages.InterpreterContainerWizardPage_3);
+ fInterpreterEnvironmentBlock.createControl(composite);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ fInterpreterEnvironmentBlock.getControl().setLayoutData(gd);
+ setControl(composite);
+ fInterpreterEnvironmentBlock.addPropertyChangeListener(new IPropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent event) {
+ IStatus status = fInterpreterEnvironmentBlock.getStatus();
+ if (status.isOK()) {
+ setErrorMessage(null);
+ } else {
+ setErrorMessage(status.getMessage());
+ }
+ }
+ });
+
+ setTitle(InterpretersMessages.InterpreterContainerWizardPage_Interpreter_System_Library_1);
+ setMessage(InterpretersMessages.InterpreterContainerWizardPage_Select_the_Interpreter_used_to_build_this_project__4);
+
+ initializeFromSelection();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#getImage()
+ */
+ public Image getImage() {
+ return DLTKDebugImages.get(DLTKDebugImages.IMG_WIZBAN_LIBRARY);
+ }
+
+
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/AbstractInterpreterLibraryBlock.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/AbstractInterpreterLibraryBlock.java
new file mode 100644
index 0000000..ea1fda9
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/AbstractInterpreterLibraryBlock.java
@@ -0,0 +1,393 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.dltk.internal.debug.ui.interpreters;
+
+
+import java.io.File;
+import java.util.Iterator;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.dltk.debug.ui.DLTKDebugUIPlugin;
+import org.eclipse.dltk.debug.ui.IDLTKDebugUIConstants;
+import org.eclipse.dltk.launching.IInterpreterInstall;
+import org.eclipse.dltk.launching.IInterpreterInstallType;
+import org.eclipse.dltk.launching.LibraryLocation;
+import org.eclipse.dltk.launching.ScriptRuntime;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.viewers.IBaseLabelProvider;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Label;
+
+
+/**
+ * Control used to edit the libraries associated with a Interpreter install
+ */
+public abstract class AbstractInterpreterLibraryBlock implements SelectionListener, ISelectionChangedListener {
+
+ /**
+ * Attribute name for the last path used to open a file/directory chooser
+ * dialog.
+ */
+ protected static final String LAST_PATH_SETTING = "LAST_PATH_SETTING"; //$NON-NLS-1$
+
+ /**
+ * the prefix for dialog setting pertaining to this block
+ */
+ protected static final String DIALOG_SETTINGS_PREFIX = "AbstractInterpreterLibraryBlock"; //$NON-NLS-1$
+
+ protected boolean fInCallback = false;
+ protected IInterpreterInstall fInterpreterInstall;
+ protected IInterpreterInstallType fInterpreterInstallType;
+ protected File fHome;
+
+ //widgets
+ protected LibraryContentProvider fLibraryContentProvider;
+ protected TreeViewer fLibraryViewer;
+ private Button fUpButton;
+ private Button fDownButton;
+ private Button fRemoveButton;
+ private Button fAddButton;
+ protected Button fDefaultButton;
+
+ protected AddDLTKInterpreterDialog fDialog;
+
+ protected AbstractInterpreterLibraryBlock(AddDLTKInterpreterDialog dialog)
+ {
+ this.fDialog = dialog;
+ }
+
+ /**
+ * Creates and returns the source lookup control.
+ *
+ * @param parent the parent widget of this control
+ */
+ public Control createControl(Composite parent) {
+ Font font = parent.getFont();
+
+ Composite comp = new Composite(parent, SWT.NONE);
+ GridLayout topLayout = new GridLayout();
+ topLayout.numColumns = 2;
+ topLayout.marginHeight = 0;
+ topLayout.marginWidth = 0;
+ comp.setLayout(topLayout);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ comp.setLayoutData(gd);
+
+ fLibraryViewer= new TreeViewer(comp);
+ gd = new GridData(GridData.FILL_BOTH);
+ gd.heightHint = 6;
+ fLibraryViewer.getControl().setLayoutData(gd);
+ fLibraryContentProvider= new LibraryContentProvider();
+ fLibraryViewer.setContentProvider(fLibraryContentProvider);
+ fLibraryViewer.setLabelProvider(getLabelProvider());
+ fLibraryViewer.setInput(this);
+ fLibraryViewer.addSelectionChangedListener(this);
+
+ Composite pathButtonComp = new Composite(comp, SWT.NONE);
+ GridLayout pathButtonLayout = new GridLayout();
+ pathButtonLayout.marginHeight = 0;
+ pathButtonLayout.marginWidth = 0;
+ pathButtonComp.setLayout(pathButtonLayout);
+ gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL);
+ pathButtonComp.setLayoutData(gd);
+ pathButtonComp.setFont(font);
+
+ fAddButton= createPushButton(pathButtonComp, InterpretersMessages.InterpreterLibraryBlock_7);
+ fAddButton.addSelectionListener(this);
+
+ fRemoveButton= createPushButton(pathButtonComp, InterpretersMessages.InterpreterLibraryBlock_6);
+ fRemoveButton.addSelectionListener(this);
+
+ fUpButton= createPushButton(pathButtonComp, InterpretersMessages.InterpreterLibraryBlock_4);
+ fUpButton.addSelectionListener(this);
+
+ fDownButton= createPushButton(pathButtonComp, InterpretersMessages.InterpreterLibraryBlock_5);
+ fDownButton.addSelectionListener(this);
+
+ fDefaultButton= createPushButton(pathButtonComp, InterpretersMessages.InterpreterLibraryBlock_9);
+ fDefaultButton.addSelectionListener(this);
+
+ return comp;
+ }
+
+ /**
+ * The "default" button has been toggled
+ */
+ public void restoreDefaultLibraries() {
+ LibraryLocation[] libs = null;
+ File installLocation = getHomeDirectory();
+ if (installLocation == null) {
+ libs = new LibraryLocation[0];
+ } else {
+ libs = getInterpreterInstallType().getDefaultLibraryLocations(installLocation);
+ }
+ if (libs != null)
+ fLibraryContentProvider.setLibraries(libs);
+ update();
+ }
+ /**
+ * Creates and returns a button
+ *
+ * @param parent parent widget
+ * @param label label
+ * @return Button
+ */
+ protected Button createPushButton(Composite parent, String label) {
+ Button button = new Button(parent, SWT.PUSH);
+ button.setFont(parent.getFont());
+ button.setText(label);
+ setButtonLayoutData(button);
+ return button;
+ }
+
+ /**
+ * Create some empty space
+ */
+ protected void createVerticalSpacer(Composite comp, int colSpan) {
+ Label label = new Label(comp, SWT.NONE);
+ GridData gd = new GridData();
+ gd.horizontalSpan = colSpan;
+ label.setLayoutData(gd);
+ }
+
+
+ /**
+ * Sets the home directory of the Interpreter Install the user has chosen
+ */
+ public void setHomeDirectory(File file) {
+ fHome = file;
+ }
+
+ /**
+ * Returns the home directory
+ */
+ protected File getHomeDirectory() {
+ return fHome;
+ }
+
+ /**
+ * Updates buttons and status based on current libraries
+ */
+ public void update() {
+ updateButtons();
+ IStatus status = Status.OK_STATUS;
+ if (fLibraryContentProvider.getLibraries().length == 0) { // && !isDefaultSystemLibrary()) {
+ status = new Status(IStatus.ERROR, DLTKDebugUIPlugin.getUniqueIdentifier(), IDLTKDebugUIConstants.INTERNAL_ERROR,
+ InterpretersMessages.InterpreterLibraryBlock_Libraries_cannot_be_empty__1, null);
+ }
+ LibraryStandin[] standins = fLibraryContentProvider.getStandins();
+ for (int i = 0; i < standins.length; i++) {
+ IStatus st = standins[i].validate();
+ if (!st.isOK()) {
+ status = st;
+ break;
+ }
+ }
+ updateDialogStatus (status);
+ }
+
+ /**
+ * Saves settings in the given working copy
+ */
+ public void performApply(IInterpreterInstall Interpreter) {
+ if (isDefaultLocations()) {
+ Interpreter.setLibraryLocations(null);
+ } else {
+ LibraryLocation[] libs = fLibraryContentProvider.getLibraries();
+ Interpreter.setLibraryLocations(libs);
+ }
+ }
+
+ /**
+ * Determines if the present setup is the default location s for this InterpreterEnvironment
+ * @return true if the current set of locations are the defaults, false otherwise
+ */
+ protected boolean isDefaultLocations() {
+ LibraryLocation[] libraryLocations = fLibraryContentProvider.getLibraries();
+ IInterpreterInstall install = getInterpreterInstall();
+
+ if (install == null || libraryLocations == null) {
+ return true;
+ }
+ File installLocation = install.getInstallLocation();
+ if (installLocation != null) {
+ LibraryLocation[] def = getInterpreterInstallType().getDefaultLibraryLocations(installLocation);
+ if (def.length == libraryLocations.length) {
+ for (int i = 0; i < def.length; i++) {
+ if (!def[i].equals(libraryLocations[i])) {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Returns the Interpreter install associated with this library block.
+ *
+ * @return Interpreter install
+ */
+ protected IInterpreterInstall getInterpreterInstall() {
+ return fInterpreterInstall;
+ }
+
+ /**
+ * Returns the Interpreter install type associated with this library block.
+ *
+ * @return Interpreter install
+ */
+ protected IInterpreterInstallType getInterpreterInstallType() {
+ return fInterpreterInstallType;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ public void widgetSelected(SelectionEvent e) {
+ Object source= e.getSource();
+ if (source == fUpButton) {
+ fLibraryContentProvider.up((IStructuredSelection) fLibraryViewer.getSelection());
+ } else if (source == fDownButton) {
+ fLibraryContentProvider.down((IStructuredSelection) fLibraryViewer.getSelection());
+ } else if (source == fRemoveButton) {
+ fLibraryContentProvider.remove((IStructuredSelection) fLibraryViewer.getSelection());
+ } else if (source == fAddButton) {
+ add((IStructuredSelection) fLibraryViewer.getSelection());
+ }
+ else if (source == fDefaultButton) {
+ restoreDefaultLibraries();
+ }
+ update();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ public void widgetDefaultSelected(SelectionEvent e) {}
+
+
+ private void add(IStructuredSelection selection) {
+ LibraryLocation libs = add();
+ if (libs == null)
+ return;
+ fLibraryContentProvider.add(new LibraryLocation[] {libs}, selection);
+ update ();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
+ */
+ public void selectionChanged(SelectionChangedEvent event) {
+ updateButtons();
+ }
+
+ /**
+ * Refresh the enable/disable state for the buttons.
+ */
+ private void updateButtons() {
+ IStructuredSelection selection = (IStructuredSelection) fLibraryViewer.getSelection();
+ fRemoveButton.setEnabled(!selection.isEmpty());
+ boolean enableUp = true,
+ enableDown = true;
+ Object[] libraries = fLibraryContentProvider.getElements(null);
+ if (selection.isEmpty() || libraries.length == 0) {
+ enableUp = false;
+ enableDown = false;
+ } else {
+ Object first = libraries[0];
+ Object last = libraries[libraries.length - 1];
+ for (Iterator iter= selection.iterator(); iter.hasNext();) {
+ Object element= iter.next();
+ Object lib;
+ lib = element;
+ if (lib == first) {
+ enableUp = false;
+ }
+ if (lib == last) {
+ enableDown = false;
+ }
+ }
+ }
+ fUpButton.setEnabled(enableUp);
+ fDownButton.setEnabled(enableDown);
+ }
+
+ /**
+ * Initializes this control based on the settings in the given
+ * Interpreter install and type.
+ *
+ * @param Interpreter Interpreter or <code>null</code> if none
+ * @param type type of Interpreter install
+ */
+
+ public void initializeFrom(IInterpreterInstall Interpreter, IInterpreterInstallType type) {
+ fInterpreterInstall = Interpreter;
+ fInterpreterInstallType = type;
+ if (Interpreter != null) {
+ setHomeDirectory(Interpreter.getInstallLocation());
+ fLibraryContentProvider.setLibraries(ScriptRuntime.getLibraryLocations(getInterpreterInstall()));
+ }
+ update();
+ }
+ protected abstract IBaseLabelProvider getLabelProvider();
+
+ protected void updateDialogStatus(IStatus status) {
+ fDialog.setSystemLibraryStatus(status);
+ fDialog.updateStatusLine();
+ }
+
+ protected void setButtonLayoutData(Button button) {
+ fDialog.setButtonLayoutData(button);
+ }
+
+ protected abstract IDialogSettings getDialogSettions();
+ protected LibraryLocation add() {
+ IDialogSettings dialogSettings= getDialogSettions();
+ String lastUsedPath= dialogSettings.get(LAST_PATH_SETTING);
+ if (lastUsedPath == null) {
+ lastUsedPath= ""; //$NON-NLS-1$
+ }
+ DirectoryDialog dialog= new DirectoryDialog(fLibraryViewer.getControl().getShell(), SWT.MULTI);
+ dialog.setMessage(InterpretersMessages.InterpreterLibraryBlock_10);
+ dialog.setFilterPath(lastUsedPath);
+ String res= dialog.open();
+ if (res == null) {
+ return null;
+ }
+
+ IPath path= new Path(res);
+ LibraryLocation lib= new LibraryLocation(path.makeAbsolute());
+ dialogSettings.put(LAST_PATH_SETTING, path.toOSString());
+ return lib;
+ }
+
+
+
+
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/AddDLTKInterpreterDialog.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/AddDLTKInterpreterDialog.java
new file mode 100644
index 0000000..4306457
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/AddDLTKInterpreterDialog.java
@@ -0,0 +1,457 @@
+package org.eclipse.dltk.internal.debug.ui.interpreters;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.dltk.debug.ui.DLTKDebugUIPlugin;
+import org.eclipse.dltk.internal.ui.dialogs.StatusInfo;
+import org.eclipse.dltk.internal.ui.wizards.dialogfields.ComboDialogField;
+import org.eclipse.dltk.internal.ui.wizards.dialogfields.DialogField;
+import org.eclipse.dltk.internal.ui.wizards.dialogfields.IDialogFieldListener;
+import org.eclipse.dltk.internal.ui.wizards.dialogfields.IStringButtonAdapter;
+import org.eclipse.dltk.internal.ui.wizards.dialogfields.StringButtonDialogField;
+import org.eclipse.dltk.internal.ui.wizards.dialogfields.StringDialogField;
+import org.eclipse.dltk.launching.IInterpreterInstall;
+import org.eclipse.dltk.launching.IInterpreterInstallType;
+import org.eclipse.dltk.launching.InterpreterStandin;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.dialogs.StatusDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+
+public abstract class AddDLTKInterpreterDialog extends StatusDialog {
+
+ private IAddInterpreterDialogRequestor fRequestor;
+
+ private IInterpreterInstallType[] fInterpreterTypes;
+
+ private IInterpreterInstallType fSelectedInterpreterType;
+
+ private ComboDialogField fInterpreterTypeCombo;
+
+ private IInterpreterInstall fEditedInterpreter;
+
+ private AbstractInterpreterLibraryBlock fLibraryBlock;
+
+ private StringButtonDialogField fInterpreterPath;
+
+ private StringDialogField fInterpreterName;
+
+ private StringDialogField fInterpreterArgs;
+
+ private IStatus[] fStati;
+ private int fPrevIndex = -1;
+
+ protected boolean useInterpreterArgs() {
+ return true;
+ }
+
+ public AddDLTKInterpreterDialog(IAddInterpreterDialogRequestor requestor, Shell shell,
+ IInterpreterInstallType[] interpreterInstallTypes, IInterpreterInstall editedInterpreter) {
+ super(shell);
+ setShellStyle(getShellStyle() | SWT.RESIZE);
+ fRequestor= requestor;
+ fStati= new IStatus[5];
+ for (int i= 0; i < fStati.length; i++) {
+ fStati[i]= new StatusInfo();
+ }
+
+ fInterpreterTypes= interpreterInstallTypes;
+ fSelectedInterpreterType= editedInterpreter != null ? editedInterpreter.getInterpreterInstallType() : interpreterInstallTypes[0];
+
+ fEditedInterpreter = editedInterpreter;
+ }
+
+ /**
+ * @see Windows#configureShell
+ */
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+ //PlatformUI.getWorkbench().getHelpSystem().setHelp(newShell, IScriptDebugHelpContextIds.EDIT_InterpreterEnvironment_DIALOG);
+ }
+
+ protected void createDialogFields() {
+ fInterpreterTypeCombo= new ComboDialogField(SWT.READ_ONLY);
+ fInterpreterTypeCombo.setLabelText(InterpretersMessages.addInterpreterDialog_InterpreterEnvironmentType);
+ fInterpreterTypeCombo.setItems(getInterpreterTypeNames());
+
+ fInterpreterName= new StringDialogField();
+ fInterpreterName.setLabelText(InterpretersMessages.addInterpreterDialog_InterpreterEnvironmentName);
+
+ fInterpreterPath= new StringButtonDialogField(new IStringButtonAdapter() {
+ public void changeControlPressed(DialogField field) {
+ browseForInstallation();
+ }
+ });
+ fInterpreterPath.setLabelText(InterpretersMessages.addInterpreterDialog_InterpreterExecutableName);
+ fInterpreterPath.setButtonLabel(InterpretersMessages.addInterpreterDialog_browse1);
+
+ if( this.useInterpreterArgs() ) {
+ fInterpreterArgs= new StringDialogField();
+ fInterpreterArgs.setLabelText(InterpretersMessages.AddInterpreterDialog_iArgs);
+ }
+ }
+
+ protected void createFieldListeners() {
+
+ fInterpreterTypeCombo.setDialogFieldListener(new IDialogFieldListener() {
+ public void dialogFieldChanged(DialogField field) {
+ updateInterpreterType();
+ }
+ });
+
+ fInterpreterName.setDialogFieldListener(new IDialogFieldListener() {
+ public void dialogFieldChanged(DialogField field) {
+ setInterpreterNameStatus(validateInterpreterName());
+ updateStatusLine();
+ }
+ });
+
+ fInterpreterPath.setDialogFieldListener(new IDialogFieldListener() {
+ public void dialogFieldChanged(DialogField field) {
+ setInterpreterLocationStatus(validateInterpreterLocation());
+ updateStatusLine();
+ }
+ });
+
+ }
+
+ protected String getInterpreterName() {
+ return fInterpreterName.getText();
+ }
+
+ protected File getInstallLocation() {
+ return new File(fInterpreterPath.getText());
+ }
+
+ protected abstract AbstractInterpreterLibraryBlock createLibraryBlock(AddDLTKInterpreterDialog dialog);
+ protected Control createDialogArea(Composite ancestor) {
+ createDialogFields();
+ Composite parent = (Composite)super.createDialogArea(ancestor);
+ ((GridLayout)parent.getLayout()).numColumns= 3;
+
+ fInterpreterTypeCombo.doFillIntoGrid(parent, 3);
+ ((GridData)fInterpreterTypeCombo.getComboControl(null).getLayoutData()).widthHint= convertWidthInCharsToPixels(50);
+
+ fInterpreterName.doFillIntoGrid(parent, 3);
+
+ fInterpreterPath.doFillIntoGrid(parent, 3);
+
+ if( this.useInterpreterArgs() ) {
+ fInterpreterArgs.doFillIntoGrid(parent, 3);
+ ((GridData)fInterpreterArgs.getTextControl(null).getLayoutData()).widthHint= convertWidthInCharsToPixels(50);
+ }
+
+
+ Label l = new Label(parent, SWT.NONE);
+ l.setText(InterpretersMessages.AddInterpreterDialog_Interpreter_system_libraries__1);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 3;
+ l.setLayoutData(gd);
+
+ fLibraryBlock = createLibraryBlock(this);
+ Control block = fLibraryBlock.createControl(parent);
+ gd = new GridData(GridData.FILL_BOTH);
+ gd.horizontalSpan = 3;
+ block.setLayoutData(gd);
+
+ Text t= fInterpreterPath.getTextControl(parent);
+ gd= (GridData)t.getLayoutData();
+ gd.grabExcessHorizontalSpace=true;
+ gd.widthHint= convertWidthInCharsToPixels(50);
+
+ initializeFields();
+ createFieldListeners();
+ applyDialogFont(parent);
+ return parent;
+ }
+
+ private void updateInterpreterType() {
+ int selIndex= fInterpreterTypeCombo.getSelectionIndex();
+ if (selIndex == fPrevIndex) {
+ return;
+ }
+ fPrevIndex = selIndex;
+ if (selIndex >= 0 && selIndex < fInterpreterTypes.length) {
+ fSelectedInterpreterType= fInterpreterTypes[selIndex];
+ }
+ setInterpreterLocationStatus(validateInterpreterLocation());
+ fLibraryBlock.initializeFrom(fEditedInterpreter, fSelectedInterpreterType);
+ updateStatusLine();
+ }
+
+ public void create() {
+ super.create();
+ fInterpreterName.setFocus();
+ selectInterpreterType();
+ }
+
+ private String[] getInterpreterTypeNames() {
+ String[] names= new String[fInterpreterTypes.length];
+ for (int i= 0; i < fInterpreterTypes.length; i++) {
+ names[i]= fInterpreterTypes[i].getName();
+ }
+ return names;
+ }
+
+ private void selectInterpreterType() {
+ for (int i= 0; i < fInterpreterTypes.length; i++) {
+ if (fSelectedInterpreterType == fInterpreterTypes[i]) {
+ fInterpreterTypeCombo.selectItem(i);
+ return;
+ }
+ }
+ }
+
+ private void initializeFields() {
+ fInterpreterTypeCombo.setItems(getInterpreterTypeNames());
+ if (fEditedInterpreter == null) {
+ fInterpreterName.setText(""); //$NON-NLS-1$
+ fInterpreterPath.setText(""); //$NON-NLS-1$
+ fLibraryBlock.initializeFrom(null, fSelectedInterpreterType);
+ if( this.useInterpreterArgs() ) {
+ fInterpreterArgs.setText(""); //$NON-NLS-1$
+ }
+ } else {
+ fInterpreterTypeCombo.setEnabled(false);
+ fInterpreterName.setText(fEditedInterpreter.getName());
+ fInterpreterPath.setText(fEditedInterpreter.getInstallLocation().getAbsolutePath());
+ fLibraryBlock.initializeFrom(fEditedInterpreter, fSelectedInterpreterType);
+ String InterpreterArgs = fEditedInterpreter.getInterpreterArgs();
+ if (InterpreterArgs != null) {
+ fInterpreterArgs.setText(InterpreterArgs);
+ }
+ }
+ setInterpreterNameStatus(validateInterpreterName());
+ updateStatusLine();
+ }
+
+
+ private IInterpreterInstallType getInterpreterType() {
+ return fSelectedInterpreterType;
+ }
+
+
+ private IStatus validateInterpreterLocation() {
+ String locationName= fInterpreterPath.getText();
+ IStatus s = null;
+ File file = null;
+ if (locationName.length() == 0) {
+ s = new StatusInfo(IStatus.INFO, InterpretersMessages.addInterpreterDialog_enterLocation);
+ } else {
+ file= new File(locationName);
+ if (!file.exists()) {
+ s = new StatusInfo(IStatus.ERROR, InterpretersMessages.addInterpreterDialog_locationNotExists);
+ } else {
+ final IStatus[] temp = new IStatus[1];
+ final File tempFile = file;
+ Runnable r = new Runnable() {
+ /**
+ * @see java.lang.Runnable#run()
+ */
+ public void run() {
+ temp[0] = getInterpreterType().validateInstallLocation(tempFile);
+ }
+ };
+ BusyIndicator.showWhile(getShell().getDisplay(), r);
+ s = temp[0];
+ }
+ }
+ if (s.isOK()) {
+ fLibraryBlock.setHomeDirectory(file);
+ String name = fInterpreterName.getText();
+ if (name == null || name.trim().length() == 0) {
+ // auto-generate interpreter name
+ try {
+ String genName = null;
+ IPath path = new Path(file.getCanonicalPath());
+ int segs = path.segmentCount();
+ if (segs == 1) {
+ genName = path.segment(0);
+ } else if (segs >= 2) {
+ String last = path.lastSegment();
+ genName = last;
+ }
+ if (genName != null) {
+ fInterpreterName.setText(genName);
+ }
+ } catch (IOException e) {}
+ }
+ } else {
+ fLibraryBlock.setHomeDirectory(null);
+ }
+ fLibraryBlock.restoreDefaultLibraries();
+ return s;
+ }
+
+
+ private IStatus validateInterpreterName() {
+ StatusInfo status= new StatusInfo();
+ String name= fInterpreterName.getText();
+ if (name == null || name.trim().length() == 0) {
+ status.setInfo(InterpretersMessages.addInterpreterDialog_enterName);
+ } else {
+ if (fRequestor.isDuplicateName(name) && (fEditedInterpreter == null || !name.equals(fEditedInterpreter.getName()))) {
+ status.setError(InterpretersMessages.addInterpreterDialog_duplicateName);
+ }
+ }
+ return status;
+ }
+
+ public void updateStatusLine() {
+ IStatus max= null;
+ for (int i= 0; i < fStati.length; i++) {
+ IStatus curr= fStati[i];
+ if (curr.matches(IStatus.ERROR)) {
+ updateStatus(curr);
+ return;
+ }
+ if (max == null || curr.getSeverity() > max.getSeverity()) {
+ max= curr;
+ }
+ }
+ updateStatus(max);
+ }
+
+ private void browseForInstallation() {
+
+ FileDialog dialog= new FileDialog(getShell());
+ dialog.setFilterPath(fInterpreterPath.getText());
+ if (Platform.getOS().equals(Platform.OS_WIN32))
+ dialog.setFilterExtensions(new String[] {"*.exe"});
+ else
+ dialog.setFilterExtensions(new String[] {"*"});
+ dialog.setFilterNames(new String[] {"Executables"});
+ String newPath= dialog.open();
+ if (newPath != null) {
+ fInterpreterPath.setText(newPath);
+ }
+ }
+
+
+ protected void okPressed() {
+ doOkPressed();
+ super.okPressed();
+ }
+
+ private void doOkPressed() {
+ if (fEditedInterpreter == null) {
+ IInterpreterInstall Interpreter= new InterpreterStandin(fSelectedInterpreterType, createUniqueId(fSelectedInterpreterType));
+ setFieldValuesToInterpreter(Interpreter);
+ fRequestor.interpreterAdded(Interpreter);
+ } else {
+ setFieldValuesToInterpreter(fEditedInterpreter);
+ }
+ }
+
+ private String createUniqueId(IInterpreterInstallType InterpreterType) {
+ String id= null;
+ do {
+ id= String.valueOf(System.currentTimeMillis());
+ } while (InterpreterType.findInterpreterInstall(id) != null);
+ return id;
+ }
+
+ protected void setFieldValuesToInterpreter(IInterpreterInstall Interpreter) {
+ File dir = new File(fInterpreterPath.getText());
+ try {
+ Interpreter.setInstallLocation(dir.getCanonicalFile());
+ } catch (IOException e) {
+ Interpreter.setInstallLocation(dir.getAbsoluteFile());
+ }
+ Interpreter.setName(fInterpreterName.getText());
+
+ if(this.useInterpreterArgs() ) {
+ String argString = fInterpreterArgs.getText().trim();
+
+ if (argString != null && argString.length() >0) {
+ Interpreter.setInterpreterArgs(argString);
+ } else {
+ Interpreter.setInterpreterArgs(null);
+ }
+ }
+ else {
+ Interpreter.setInterpreterArgs(null);
+ }
+
+ fLibraryBlock.performApply(Interpreter);
+ }
+
+ protected File getAbsoluteFileOrEmpty(String path) {
+ if (path == null || path.length() == 0) {
+ return new File(""); //$NON-NLS-1$
+ }
+ return new File(path).getAbsoluteFile();
+ }
+
+ private void setInterpreterNameStatus(IStatus status) {
+ fStati[0]= status;
+ }
+
+ private void setInterpreterLocationStatus(IStatus status) {
+ fStati[1]= status;
+ }
+
+ protected IStatus getSystemLibraryStatus() {
+ return fStati[3];
+ }
+
+ public void setSystemLibraryStatus(IStatus status) {
+ fStati[3]= status;
+ }
+
+ /**
+ * Updates the status of the ok button to reflect the given status.
+ * Subclasses may override this method to update additional buttons.
+ * @param status the status.
+ */
+ protected void updateButtonsEnableState(IStatus status) {
+ Button ok = getButton(IDialogConstants.OK_ID);
+ if (ok != null && !ok.isDisposed())
+ ok.setEnabled(status.getSeverity() == IStatus.OK);
+ }
+
+ /**
+ * @see org.eclipse.jface.dialogs.Dialog#setButtonLayoutData(org.eclipse.swt.widgets.Button)
+ */
+ public void setButtonLayoutData(Button button) {
+ super.setButtonLayoutData(button);
+ }
+
+ /**
+ * Returns the name of the section that this dialog stores its settings in
+ *
+ * @return String
+ */
+ protected String getDialogSettingsSectionName() {
+ return "ADD_INTERPRETER_DIALOG_SECTION"; //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#getDialogBoundsSettings()
+ */
+ protected IDialogSettings getDialogBoundsSettings() {
+ IDialogSettings settings = DLTKDebugUIPlugin.getDefault().getDialogSettings();
+ IDialogSettings section = settings.getSection(getDialogSettingsSectionName());
+ if (section == null) {
+ section = settings.addNewSection(getDialogSettingsSectionName());
+ }
+ return section;
+ }
+
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/BuildInterpreterDescriptor.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/BuildInterpreterDescriptor.java
new file mode 100644
index 0000000..0a574d9
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/BuildInterpreterDescriptor.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.dltk.internal.debug.ui.interpreters;
+
+import org.eclipse.dltk.debug.ui.messages.DLTKLaunchMessages;
+import org.eclipse.dltk.launching.IInterpreterInstall;
+import org.eclipse.dltk.launching.ScriptRuntime;
+
+import com.ibm.icu.text.MessageFormat;
+
+/**
+ * Interpreter Descriptor used for the Interpreter container wizard page.
+ */
+public class BuildInterpreterDescriptor extends InterpreterDescriptor {
+
+ private String fNature;
+
+ public BuildInterpreterDescriptor(String nature) {
+ fNature = nature;
+ }
+
+ public String getDescription() {
+ String name = DLTKLaunchMessages.InterpreterTab_7;
+ IInterpreterInstall Interpreter = ScriptRuntime.getDefaultInterpreterInstall(fNature);
+ if (Interpreter != null) {
+ name = Interpreter.getName();
+ }
+ return MessageFormat.format(DLTKLaunchMessages.InterpreterTab_8, new String[] {
+ name
+ });
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/IAddInterpreterDialogRequestor.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/IAddInterpreterDialogRequestor.java
new file mode 100644
index 0000000..18001b2
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/IAddInterpreterDialogRequestor.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.dltk.internal.debug.ui.interpreters;
+
+
+import org.eclipse.dltk.launching.IInterpreterInstall;
+
+/**
+ * This interface is implemented by clients of the <code>AddInterpreterDialog</code>.
+ */
+public interface IAddInterpreterDialogRequestor {
+
+ /**
+ * Reply whether or not a new Interpreter of the specified name would
+ * constitute a duplicate.
+ *
+ * @param name the name of a potential new Interpreter
+ * @return whether a new Interpreter with the specified name would be a duplicate Interpreter
+ */
+ public boolean isDuplicateName(String name);
+
+ /**
+ * Notification that a Interpreter has been added from the <code>AddInterpreterDialog</code>.
+ *
+ * @param Interpreter the added Interpreter
+ */
+ public void interpreterAdded(IInterpreterInstall Interpreter);
+
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/InterpreterDescriptor.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/InterpreterDescriptor.java
new file mode 100644
index 0000000..99e79b7
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/InterpreterDescriptor.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.dltk.internal.debug.ui.interpreters;
+
+
+/**
+ * Used to provide a description for interpreter selections in the
+ * installed interpreters block.
+ */
+public abstract class InterpreterDescriptor {
+
+ /**
+ * Returns a description of the interpreter setting.
+ *
+ * @return description of the interpeter setting
+ */
+ public abstract String getDescription();
+
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/InterpreterPreferencePage.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/InterpreterPreferencePage.java
new file mode 100644
index 0000000..1a7d6c3
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/InterpreterPreferencePage.java
@@ -0,0 +1,214 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.dltk.internal.debug.ui.interpreters;
+
+
+import java.io.File;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.dltk.core.DLTKCore;
+import org.eclipse.dltk.core.IScriptModel;
+import org.eclipse.dltk.debug.ui.DLTKDebugUIPlugin;
+import org.eclipse.dltk.debug.ui.IDLTKDebugUIConstants;
+import org.eclipse.dltk.internal.debug.ui.IDLTKDebugHelpContextIds;
+import org.eclipse.dltk.launching.IInterpreterInstall;
+import org.eclipse.dltk.launching.LibraryLocation;
+import org.eclipse.dltk.launching.ScriptRuntime;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.PlatformUI;
+
+
+/**
+ * The Installed InterpreterEnvironments preference page.
+ *
+ *
+ */
+public abstract class InterpreterPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
+
+ // InterpreterEnvironment Block
+ private InterpretersBlock fInterpretersBlock;
+
+ public InterpreterPreferencePage() {
+ super();
+
+ // only used when page is shown programatically
+ setTitle(InterpretersMessages.InterpretersPreferencePage_1);
+
+ setDescription(InterpretersMessages.InterpretersPreferencePage_2);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ public void init(IWorkbench workbench) {
+ }
+
+ public abstract InterpretersBlock createInterpretersBlock ();
+
+ /**
+ * Find & verify the default interpreter.
+ */
+ private void initDefaultInterpreter() {
+ IInterpreterInstall realDefault;
+ realDefault = ScriptRuntime.getDefaultInterpreterInstall(fInterpretersBlock.getCurrentNature());
+ boolean verified = false;
+ if (realDefault != null) {
+ IInterpreterInstall[] Interpreters= fInterpretersBlock.getInterpreters();
+ for (int i = 0; i < Interpreters.length; i++) {
+ IInterpreterInstall fakeInterpreter= Interpreters[i];
+ if (fakeInterpreter.equals(realDefault)) {
+ verified = true;
+ verifyDefaultInterpreter(fakeInterpreter);
+ break;
+ }
+ }
+ }
+
+ if (!verified) {
+ if (fInterpretersBlock.getInterpreters().length > 0)
+ setErrorMessage(InterpretersMessages.InterpreterPreferencePage_pleaseSetDefaultInterpreter);
+ else
+ setErrorMessage(InterpretersMessages.InterpreterPreferencePage_addInterpreter);
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createContents(Composite ancestor) {
+ initializeDialogUnits(ancestor);
+
+ noDefaultAndApplyButton();
+
+ GridLayout layout= new GridLayout();
+ layout.numColumns= 1;
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ ancestor.setLayout(layout);
+
+ fInterpretersBlock = createInterpretersBlock();
+ fInterpretersBlock.createControl(ancestor);
+ Control control = fInterpretersBlock.getControl();
+ GridData data = new GridData(GridData.FILL_BOTH);
+ data.horizontalSpan = 1;
+ control.setLayoutData(data);
+
+ fInterpretersBlock.restoreColumnSettings(DLTKDebugUIPlugin.getDefault().getDialogSettings(),
+ IDLTKDebugHelpContextIds.INTERPRETER_PREFERENCE_PAGE);
+
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(ancestor, IDLTKDebugHelpContextIds.INTERPRETER_PREFERENCE_PAGE);
+ initDefaultInterpreter();
+ fInterpretersBlock.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ IInterpreterInstall install = getCurrentDefaultInterpreter();
+ if (install == null) {
+ if (fInterpretersBlock.getInterpreters().length > 0)
+ setErrorMessage(InterpretersMessages.InterpreterPreferencePage_pleaseSetDefaultInterpreter);
+ else
+ setErrorMessage(InterpretersMessages.InterpreterPreferencePage_addInterpreter);
+ } else {
+ setErrorMessage(null);
+ }
+ }
+ });
+ applyDialogFont(ancestor);
+ return ancestor;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferencePage#performOk()
+ */
+ public boolean performOk() {
+ final boolean[] canceled = new boolean[] {false};
+ BusyIndicator.showWhile(null, new Runnable() {
+ public void run() {
+ IInterpreterInstall defaultInterpreter = getCurrentDefaultInterpreter();
+ IInterpreterInstall[] Interpreters = fInterpretersBlock.getInterpreters();
+ InterpretersUpdater updater = new InterpretersUpdater();
+ if (!updater.updateInterpreterSettings(fInterpretersBlock.getCurrentNature(), Interpreters, defaultInterpreter)) {
+ canceled[0] = true;
+ }
+ }
+ });
+
+ if(canceled[0]) {
+ return false;
+ }
+
+ // save column widths
+ IDialogSettings settings = DLTKDebugUIPlugin.getDefault().getDialogSettings();
+ fInterpretersBlock.saveColumnSettings(settings, IDLTKDebugHelpContextIds.INTERPRETER_PREFERENCE_PAGE);
+
+ return super.performOk();
+ }
+
+ protected IScriptModel getScriptModel() {
+ return DLTKCore.create(ResourcesPlugin.getWorkspace().getRoot());
+ }
+
+ /**
+ * Verify that the specified Interpreter can be a valid default Interpreter. This amounts to verifying
+ * that all of the Interpreter's library locations exist on the file system. If this fails,
+ * remove the Interpreter from the table and try to set another default.
+ */
+ private void verifyDefaultInterpreter(IInterpreterInstall Interpreter) {
+ if (Interpreter != null) {
+ // Verify that all of the specified Interpreter's library locations actually exist
+ LibraryLocation[] locations= ScriptRuntime.getLibraryLocations(Interpreter);
+ boolean exist = true;
+ for (int i = 0; i < locations.length; i++) {
+ exist = exist && new File(locations[i].getSystemLibraryPath().toOSString()).exists();
+ }
+
+ // If all library locations exist, check the corresponding entry in the list,
+ // otherwise remove the Interpreter
+ if (exist) {
+ fInterpretersBlock.setCheckedInterpreter(Interpreter);
+ } else {
+ fInterpretersBlock.removeInterpreters(new IInterpreterInstall[]{Interpreter});
+ IInterpreterInstall def = null;
+ def = ScriptRuntime.getDefaultInterpreterInstall(fInterpretersBlock.getCurrentNature());
+ if (def == null) {
+ fInterpretersBlock.setCheckedInterpreter(null);
+ } else {
+ fInterpretersBlock.setCheckedInterpreter(def);
+ }
+ ErrorDialog.openError(getControl().getShell(), InterpretersMessages.InterpretersPreferencePage_1,
+ InterpretersMessages.InterpretersPreferencePage_10, new Status(IStatus.ERROR,
+ DLTKDebugUIPlugin.PLUGIN_ID,
+ IDLTKDebugUIConstants.INTERNAL_ERROR,
+ InterpretersMessages.InterpretersPreferencePage_11, null)); //
+ return;
+ }
+ } else {
+ fInterpretersBlock.setCheckedInterpreter(null);
+ }
+ }
+
+ private IInterpreterInstall getCurrentDefaultInterpreter() {
+ return fInterpretersBlock.getCheckedInterpreter();
+ }
+
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/InterpretersBlock.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/InterpretersBlock.java
new file mode 100644
index 0000000..9a3af9f
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/InterpretersBlock.java
@@ -0,0 +1,988 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.dltk.internal.debug.ui.interpreters;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.ListenerList;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.dltk.debug.ui.DLTKDebugUIPlugin;
+import org.eclipse.dltk.internal.ui.util.SWTUtil;
+import org.eclipse.dltk.internal.ui.util.TableLayoutComposite;
+import org.eclipse.dltk.launching.IInterpreterInstall;
+import org.eclipse.dltk.launching.IInterpreterInstallType;
+import org.eclipse.dltk.launching.InterpreterStandin;
+import org.eclipse.dltk.launching.ScriptRuntime;
+import org.eclipse.dltk.ui.util.PixelConverter;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+
+import com.ibm.icu.text.MessageFormat;
+
+/**
+ * A composite that displays installed InterpreterEnvironment's in a table. InterpreterEnvironments can be
+ * added, removed, edited, and searched for.
+ * <p>
+ * This block implements ISelectionProvider - it sends selection change events
+ * when the checked InterpreterEnvironment in the table changes, or when the "use default" button
+ * check state changes.
+ * </p>
+ */
+public abstract class InterpretersBlock implements IAddInterpreterDialogRequestor, ISelectionProvider {
+
+ /**
+ * This block's control
+ */
+ private Composite fControl;
+
+ /**
+ * Interpreters being displayed
+ */
+ protected List fInterpreters = new ArrayList();
+
+ /**
+ * The main list control
+ */
+ protected CheckboxTableViewer fInterpreterList;
+
+ // Action buttons
+ private Button fAddButton;
+ private Button fRemoveButton;
+ private Button fEditButton;
+ private Button fCopyButton;
+ private Button fSearchButton;
+
+ // index of column used for sorting
+ private int fSortColumn = 0;
+
+ /**
+ * Selection listeners (checked InterpreterEnvironment changes)
+ */
+ private ListenerList fSelectionListeners = new ListenerList();
+
+ /**
+ * Previous selection
+ */
+ private ISelection fPrevSelection = new StructuredSelection();
+
+ private Table fTable;
+
+
+
+ /**
+ * Content provider to show a list of InterpreterEnvironments
+ */
+ class InterpretersContentProvider implements IStructuredContentProvider {
+ public Object[] getElements(Object input) {
+ return fInterpreters.toArray();
+ }
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+ public void dispose() {
+ }
+ }
+
+ /**
+ * Label provider for installed InterpreterEnvironments table.
+ */
+ class InterpreterLabelProvider extends LabelProvider implements ITableLabelProvider {
+
+ /**
+ * @see ITableLabelProvider#getColumnText(Object, int)
+ */
+ public String getColumnText(Object element, int columnIndex) {
+ if (element instanceof IInterpreterInstall) {
+ IInterpreterInstall interp = (IInterpreterInstall)element;
+ switch(columnIndex) {
+ case 0:
+ return interp.getName();
+ case 1:
+ return interp.getInterpreterInstallType().getName();
+ case 2:
+ return interp.getInstallLocation().getAbsolutePath();
+ }
+ }
+ return element.toString();
+ }
+
+ /**
+ * @see ITableLabelProvider#getColumnImage(Object, int)
+ */
+ public Image getColumnImage(Object element, int columnIndex) {
+ if (columnIndex == 0) {
+ //TODO: instert interpreter logo here
+ }
+ return null;
+ }
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ISelectionProvider#addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
+ */
+ public void addSelectionChangedListener(ISelectionChangedListener listener) {
+ fSelectionListeners.add(listener);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ISelectionProvider#getSelection()
+ */
+ public ISelection getSelection() {
+ return new StructuredSelection(fInterpreterList.getCheckedElements());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ISelectionProvider#removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
+ */
+ public void removeSelectionChangedListener(ISelectionChangedListener listener) {
+ fSelectionListeners.remove(listener);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ISelectionProvider#setSelection(org.eclipse.jface.viewers.ISelection)
+ */
+ public void setSelection(ISelection selection) {
+ if (selection instanceof IStructuredSelection) {
+ if (!selection.equals(fPrevSelection)) {
+ fPrevSelection = selection;
+ Object interp = ((IStructuredSelection)selection).getFirstElement();
+ if (interp == null) {
+ fInterpreterList.setCheckedElements(new Object[0]);
+ } else {
+ fInterpreterList.setCheckedElements(new Object[]{interp});
+ fInterpreterList.reveal(interp);
+ }
+ fireSelectionChanged();
+ }
+ }
+ }
+
+ /**
+ * Creates this block's control in the given control.
+ *
+ * @param ancestor containing control
+ * @param useManageButton whether to present a single 'manage...' button to
+ * the user that opens the installed InterpreterEnvironments pref page for InterpreterEnvironment management,
+ * or to provide 'add, remove, edit, and search' buttons.
+ */
+ public void createControl(Composite ancestor) {
+
+ Composite parent= new Composite(ancestor, SWT.NULL);
+ GridLayout layout= new GridLayout();
+ layout.numColumns= 2;
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+
+ Font font = ancestor.getFont();
+ parent.setFont(font);
+ parent.setLayout(layout);
+
+ fControl = parent;
+
+ GridData data;
+
+ Label tableLabel = new Label(parent, SWT.NONE);
+ tableLabel.setText(InterpretersMessages.InstalledInterpretersBlock_15);
+ data = new GridData();
+ data.horizontalSpan = 2;
+ tableLabel.setLayoutData(data);
+ tableLabel.setFont(font);
+
+
+ PixelConverter conv = new PixelConverter(parent);
+ data = new GridData(GridData.FILL_BOTH);
+ data.widthHint = conv.convertWidthInCharsToPixels(50);
+ TableLayoutComposite tblComposite = new TableLayoutComposite(parent, SWT.NONE);
+ tblComposite.setLayoutData(data);
+ fTable = new Table(tblComposite, SWT.CHECK | SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
+
+
+
+ data= new GridData(GridData.FILL_BOTH);
+ data.widthHint = 450;
+ fTable.setLayoutData(data);
+ fTable.setFont(font);
+
+ fTable.setHeaderVisible(true);
+ fTable.setLinesVisible(true);
+
+ TableColumn column1= new TableColumn(fTable, SWT.NULL);
+ column1.setText(InterpretersMessages.InstalledInterpretersBlock_0);
+ column1.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ sortByName();
+ }
+ });
+
+ TableColumn column2= new TableColumn(fTable, SWT.NULL);
+ column2.setText(InterpretersMessages.InstalledInterpretersBlock_2);
+ column2.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ sortByType();
+ }
+ });
+
+ TableColumn column3= new TableColumn(fTable, SWT.NULL);
+ column3.setText(InterpretersMessages.InstalledInterpretersBlock_1);
+ column3.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ sortByLocation();
+ }
+ });
+
+ fInterpreterList= new CheckboxTableViewer(fTable);
+ fInterpreterList.setLabelProvider(new InterpreterLabelProvider());
+ fInterpreterList.setContentProvider(new InterpretersContentProvider());
+ // by default, sort by name
+ sortByName();
+
+ fInterpreterList.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent evt) {
+ enableButtons();
+ }
+ });
+
+ fInterpreterList.addCheckStateListener(new ICheckStateListener() {
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ if (event.getChecked()) {
+ setCheckedInterpreter((IInterpreterInstall)event.getElement());
+ } else {
+ setCheckedInterpreter(null);
+ }
+ }
+ });
+
+ fInterpreterList.addDoubleClickListener(new IDoubleClickListener() {
+ public void doubleClick(DoubleClickEvent e) {
+ if (!fInterpreterList.getSelection().isEmpty()) {
+ editInterpreter();
+ }
+ }
+ });
+ fTable.addKeyListener(new KeyAdapter() {
+ public void keyPressed(KeyEvent event) {
+ if (event.character == SWT.DEL && event.stateMask == 0) {
+ if (fRemoveButton.getEnabled())
+ removeInterpreters();
+ }
+ }
+ });
+
+ Composite buttons= new Composite(parent, SWT.NULL);
+ buttons.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
+ layout= new GridLayout();
+ layout.marginHeight= 0;
+ layout.marginWidth= 0;
+ buttons.setLayout(layout);
+ buttons.setFont(font);
+
+ fAddButton = createPushButton(buttons, InterpretersMessages.InstalledInterpretersBlock_3);
+ fAddButton.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event evt) {
+ addInterpreter();
+ }
+ });
+
+ fEditButton= createPushButton(buttons, InterpretersMessages.InstalledInterpretersBlock_4);
+ fEditButton.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event evt) {
+ editInterpreter();
+ }
+ });
+
+ fCopyButton = createPushButton(buttons, InterpretersMessages.InstalledInterpretersBlock_16);
+ fCopyButton.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event evt) {
+ copyInterpreter();
+ }
+ });
+
+ fRemoveButton= createPushButton(buttons, InterpretersMessages.InstalledInterpretersBlock_5);
+ fRemoveButton.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event evt) {
+ removeInterpreters();
+ }
+ });
+
+ // copied from ListDialogField.CreateSeparator()
+ Label separator= new Label(buttons, SWT.NONE);
+ separator.setVisible(false);
+ GridData gd= new GridData();
+ gd.horizontalAlignment= GridData.FILL;
+ gd.verticalAlignment= GridData.BEGINNING;
+ gd.heightHint= 4;
+ separator.setLayoutData(gd);
+
+ fSearchButton = createPushButton(buttons, InterpretersMessages.InstalledInterpretersBlock_6);
+ fSearchButton.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event evt) {
+ search();
+ }
+ });
+
+ fillWithWorkspaceInterpreters();
+ enableButtons();
+ fAddButton.setEnabled(ScriptRuntime.getInterpreterInstallTypes(getCurrentNature()).length > 0);
+ }
+
+
+
+ /**
+ * Fire current selection
+ */
+ private void fireSelectionChanged() {
+ SelectionChangedEvent event = new SelectionChangedEvent(this, getSelection());
+ Object[] listeners = fSelectionListeners.getListeners();
+ for (int i = 0; i < listeners.length; i++) {
+ ISelectionChangedListener listener = (ISelectionChangedListener)listeners[i];
+ listener.selectionChanged(event);
+ }
+ }
+
+
+ /**
+ * Sorts by Interpreter type, and name within type.
+ */
+ private void sortByType() {
+ fInterpreterList.setSorter(new ViewerSorter() {
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ if ((e1 instanceof IInterpreterInstall) && (e2 instanceof IInterpreterInstall)) {
+ IInterpreterInstall left= (IInterpreterInstall)e1;
+ IInterpreterInstall right= (IInterpreterInstall)e2;
+ String leftType= left.getInterpreterInstallType().getName();
+ String rightType= right.getInterpreterInstallType().getName();
+ int res= leftType.compareToIgnoreCase(rightType);
+ if (res != 0) {
+ return res;
+ }
+ return left.getName().compareToIgnoreCase(right.getName());
+ }
+ return super.compare(viewer, e1, e2);
+ }
+
+ public boolean isSorterProperty(Object element, String property) {
+ return true;
+ }
+ });
+ fSortColumn = 3;
+ }
+
+ /**
+ * Sorts by Interpreter name.
+ */
+ private void sortByName() {
+ fInterpreterList.setSorter(new ViewerSorter() {
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ if ((e1 instanceof IInterpreterInstall) && (e2 instanceof IInterpreterInstall)) {
+ IInterpreterInstall left= (IInterpreterInstall)e1;
+ IInterpreterInstall right= (IInterpreterInstall)e2;
+ return left.getName().compareToIgnoreCase(right.getName());
+ }
+ return super.compare(viewer, e1, e2);
+ }
+
+ public boolean isSorterProperty(Object element, String property) {
+ return true;
+ }
+ });
+ fSortColumn = 1;
+ }
+
+ /**
+ * Sorts by Interpreter location.
+ */
+ private void sortByLocation() {
+ fInterpreterList.setSorter(new ViewerSorter() {
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ if ((e1 instanceof IInterpreterInstall) && (e2 instanceof IInterpreterInstall)) {
+ IInterpreterInstall left= (IInterpreterInstall)e1;
+ IInterpreterInstall right= (IInterpreterInstall)e2;
+ return left.getInstallLocation().getAbsolutePath().compareToIgnoreCase(right.getInstallLocation().getAbsolutePath());
+ }
+ return super.compare(viewer, e1, e2);
+ }
+
+ public boolean isSorterProperty(Object element, String property) {
+ return true;
+ }
+ });
+ fSortColumn = 2;
+ }
+
+ private void enableButtons() {
+ IStructuredSelection selection = (IStructuredSelection) fInterpreterList.getSelection();
+ int selectionCount= selection.size();
+ fEditButton.setEnabled(selectionCount == 1);
+ fCopyButton.setEnabled(selectionCount > 0);
+ if (selectionCount > 0) {
+ Iterator iterator = selection.iterator();
+ while (iterator.hasNext()) {
+ IInterpreterInstall install = (IInterpreterInstall)iterator.next();
+ if (isContributed(install)) {
+ fRemoveButton.setEnabled(false);
+ return;
+ }
+ }
+ fRemoveButton.setEnabled(true);
+ } else {
+ fRemoveButton.setEnabled(false);
+ }
+ }
+
+ protected Button createPushButton(Composite parent, String label) {
+ return SWTUtil.createPushButton(parent, label, null);
+ }
+
+ private boolean isContributed(IInterpreterInstall install) {
+ return ScriptRuntime.isContributedInterpreterInstall(install.getId());
+ }
+
+ /**
+ * Returns this block's control
+ *
+ * @return control
+ */
+ public Control getControl() {
+ return fControl;
+ }
+
+ /**
+ * Sets the InterpreterEnvironments to be displayed in this block
+ *
+ * @param Interpreters InterpreterEnvironments to be displayed
+ */
+ protected void setInterpreters(IInterpreterInstall[] Interpreters) {
+ fInterpreters.clear();
+ for (int i = 0; i < Interpreters.length; i++) {
+ fInterpreters.add(Interpreters[i]);
+ }
+ fInterpreterList.setInput(fInterpreters);
+ fInterpreterList.refresh();
+ }
+
+ /**
+ * Returns the InterpreterEnvironments currently being displayed in this block
+ *
+ * @return InterpreterEnvironments currently being displayed in this block
+ */
+ public IInterpreterInstall[] getInterpreters() {
+ return (IInterpreterInstall[])fInterpreters.toArray(new IInterpreterInstall[fInterpreters.size()]);
+ }
+
+
+
+ /**
+ * @see IAddInterpreterDialogRequestor#isDuplicateName(String)
+ */
+ public boolean isDuplicateName(String name) {
+ for (int i= 0; i < fInterpreters.size(); i++) {
+ IInterpreterInstall Interpreter = (IInterpreterInstall)fInterpreters.get(i);
+ if (Interpreter.getName().equals(name)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private void removeInterpreters() {
+ IStructuredSelection selection= (IStructuredSelection)fInterpreterList.getSelection();
+ IInterpreterInstall[] Interpreters = new IInterpreterInstall[selection.size()];
+ Iterator iter = selection.iterator();
+ int i = 0;
+ while (iter.hasNext()) {
+ Interpreters[i] = (IInterpreterInstall)iter.next();
+ i++;
+ }
+ removeInterpreters(Interpreters);
+ }
+
+ /**
+ * Removes the given Interpreters from the table.
+ *
+ * @param Interpreters
+ */
+ public void removeInterpreters(IInterpreterInstall[] Interpreters) {
+ IStructuredSelection prev = (IStructuredSelection) getSelection();
+ for (int i = 0; i < Interpreters.length; i++) {
+ fInterpreters.remove(Interpreters[i]);
+ }
+ fInterpreterList.refresh();
+ IStructuredSelection curr = (IStructuredSelection) getSelection();
+ if (!curr.equals(prev)) {
+ IInterpreterInstall[] installs = getInterpreters();
+ if (curr.size() == 0 && installs.length == 1) {
+ // pick a default Interpreter automatically
+ setSelection(new StructuredSelection(installs[0]));
+ } else {
+ fireSelectionChanged();
+ }
+ }
+ }
+
+ /**
+ * Search for installed interpreters in the file system
+ */
+ protected void search() {
+
+ // choose a root directory for the search
+ /*DirectoryDialog dialog = new DirectoryDialog(getShell());
+ dialog.setMessage(InterpretersMessages.InstalledInterpreterEnvironmentsBlock_9);
+ dialog.setText(InterpretersMessages.InstalledInterpreterEnvironmentsBlock_10);
+ String path = dialog.open();
+ if (path == null) {
+ return;
+ }*/
+
+ // ignore installed locations
+ final Set exstingLocations = new HashSet();
+ Iterator iter = fInterpreters.iterator();
+ while (iter.hasNext()) {
+ exstingLocations.add(((IInterpreterInstall)iter.next()).getInstallLocation());
+ }
+
+ // search
+ //final File rootDir = new File(path);
+ final List locations = new ArrayList();
+ final List types = new ArrayList();
+
+ IRunnableWithProgress r = new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) {
+ monitor.beginTask(InterpretersMessages.InstalledInterpretersBlock_11, IProgressMonitor.UNKNOWN);
+ //search(rootDir, locations, types, exstingLocations, monitor, -1);
+ searchFast(locations, types, exstingLocations, monitor);
+ monitor.done();
+ }
+ };
+
+ try {
+ ProgressMonitorDialog progress = new ProgressMonitorDialog(getShell());
+ progress.run(true, true, r);
+ } catch (InvocationTargetException e) {
+ DLTKDebugUIPlugin.log(e);
+ } catch (InterruptedException e) {
+ // cancelled
+ return;
+ }
+
+ if (locations.isEmpty()) {
+ //MessageDialog.openInformation(getShell(), InterpretersMessages.InstalledInterpreterEnvironmentsBlock_12, MessageFormat.format(InterpretersMessages.InstalledInterpreterEnvironmentsBlock_13, new String[]{path})); //
+ MessageDialog.openInformation(getShell(), InterpretersMessages.InstalledInterpretersBlock_12, InterpretersMessages.InstalledInterpretersBlock_113); //
+ } else {
+ iter = locations.iterator();
+ Iterator iter2 = types.iterator();
+ while (iter.hasNext()) {
+ File location = (File)iter.next();
+ IInterpreterInstallType type = (IInterpreterInstallType)iter2.next();
+ IInterpreterInstall Interpreter = new InterpreterStandin(type, createUniqueId(type));
+ String name = location.getName();
+ String nameCopy = new String(name);
+ int i = 1;
+ while (isDuplicateName(nameCopy)) {
+ nameCopy = name + '(' + i++ + ')';
+ }
+ Interpreter.setName(nameCopy);
+ Interpreter.setInstallLocation(location);
+ interpreterAdded(Interpreter);
+ }
+ }
+ }
+
+
+ protected Shell getShell() {
+ return getControl().getShell();
+ }
+
+ /**
+ * Searches in PATH
+ * @param found
+ * @param types
+ * @param ignore
+ * @param monitor
+ */
+ protected void searchFast (List found, List types, Set ignore, IProgressMonitor monitor) {
+ if (monitor.isCanceled()) {
+ return;
+ }
+ // get system environment
+ Map systemEnv = DebugPlugin.getDefault().getLaunchManager().getNativeEnvironmentCasePreserved();
+ String pName = null;
+ Set varNames = systemEnv.keySet();
+ for (Iterator iter = varNames.iterator(); iter.hasNext();) {
+ String var = (String) iter.next();
+ if (var.compareToIgnoreCase("path") == 0) {
+ pName = var;
+ break;
+ }
+ }
+ if (pName == null)
+ return;
+ String path = (String)systemEnv.get(pName);
+
+ ArrayList folders = new ArrayList ();
+
+ //split path
+ if (Platform.getOS().equals(Platform.OS_WIN32)) {
+ String[] res = path.split(";");
+ for (int i = 0; i < res.length; i++) {
+ folders.add(Path.fromOSString(res[i]));
+ }
+ } else {
+ String[] res = path.split(":");
+ for (int i = 0; i < res.length; i++) {
+ folders.add(Path.fromOSString(res[i]));
+ }
+ }
+
+ for (Iterator iter = folders.iterator(); iter.hasNext();) {
+ Path folder = (Path) iter.next();
+ if (folder != null) {
+ File f = folder.toFile();
+ if (f !=null && f.isDirectory())
+ search(f, found, types, ignore, monitor, 1);
+ }
+
+ }
+
+ }
+
+ /**
+ * Searches the specified directory recursively for installed Interpreters, adding each
+ * detected Interpreter to the <code>found</code> list. Any directories specified in
+ * the <code>ignore</code> are not traversed.
+ *
+ * @param directory
+ * @param found
+ * @param types
+ * @param ignore
+ * @param deep deepness of search. -1 if infinite.
+ */
+ protected void search(File directory, List found, List types, Set ignore, IProgressMonitor monitor, int deep) {
+ if (deep == 0)
+ return;
+ if (monitor.isCanceled()) {
+ return;
+ }
+
+ String[] names = directory.list();
+ if (names == null) {
+ return;
+ }
+ List subDirs = new ArrayList();
+ for (int i = 0; i < names.length; i++) {
+ if (monitor.isCanceled()) {
+ return;
+ }
+ File file = new File(directory, names[i]);
+
+ try {
+ monitor.subTask(MessageFormat.format(InterpretersMessages.InstalledInterpretersBlock_14, new String[]{Integer.toString(found.size()), file.getCanonicalPath()}));
+ // check if file is a symlink
+ if (file.isDirectory() && (!file.getCanonicalPath().equals(file.getAbsolutePath())))
+ continue;
+ } catch (IOException e) {
+ }
+ IInterpreterInstallType[] InterpreterTypes = ScriptRuntime.getInterpreterInstallTypes(getCurrentNature());
+
+ if (!ignore.contains(file)) {
+ boolean validLocation = false;
+ // Take the first Interpreter install type that claims the location as a
+ // valid Interpreter install. Interpreter install types should be smart enough to not
+ // claim another type's Interpreter, but just in case...
+ for (int j = 0; j < InterpreterTypes.length; j++) {
+ if (monitor.isCanceled()) {
+ return;
+ }
+ IInterpreterInstallType type = InterpreterTypes[j];
+ IStatus status = type.validateInstallLocation(file);
+ if (status.isOK()) {
+ found.add(file);
+ types.add(type);
+ validLocation = true;
+ break;
+ }
+ }
+ if (file.isDirectory() && !validLocation) {
+ subDirs.add(file);
+ }
+ }
+
+ }
+ while (!subDirs.isEmpty()) {
+ File subDir = (File)subDirs.remove(0);
+ search(subDir, found, types, ignore, monitor, deep - 1);
+ if (monitor.isCanceled()) {
+ return;
+ }
+ }
+
+ }
+
+ /**
+ * Sets the checked InterpreterEnvironment, possible <code>null</code>
+ *
+ * @param Interpreter InterpreterEnvironment or <code>null</code>
+ */
+ public void setCheckedInterpreter(IInterpreterInstall Interpreter) {
+ if (Interpreter == null) {
+ setSelection(new StructuredSelection());
+ } else {
+ setSelection(new StructuredSelection(Interpreter));
+ }
+ }
+
+ /**
+ * Returns the checked Interpreter or <code>null</code> if none.
+ *
+ * @return the checked Interpreter or <code>null</code> if none
+ */
+ public IInterpreterInstall getCheckedInterpreter() {
+ Object[] objects = fInterpreterList.getCheckedElements();
+ if (objects.length == 0) {
+ return null;
+ }
+ return (IInterpreterInstall)objects[0];
+ }
+
+ /**
+ * Persist table settings into the give dialog store, prefixed
+ * with the given key.
+ *
+ * @param settings dialog store
+ * @param qualifier key qualifier
+ */
+ public void saveColumnSettings(IDialogSettings settings, String qualifier) {
+ int columnCount = fTable.getColumnCount();
+ for (int i = 0; i < columnCount; i++) {
+ settings.put(qualifier + ".columnWidth" + i, fTable.getColumn(i).getWidth()); //$NON-NLS-1$
+ }
+ settings.put(qualifier + ".sortColumn", fSortColumn); //$NON-NLS-1$
+ }
+
+ /**
+ * Restore table settings from the given dialog store using the
+ * given key.
+ *
+ * @param settings dialog settings store
+ * @param qualifier key to restore settings from
+ */
+ public void restoreColumnSettings(IDialogSettings settings, String qualifier) {
+ fInterpreterList.getTable().layout(true);
+ restoreColumnWidths(settings, qualifier);
+ try {
+ fSortColumn = settings.getInt(qualifier + ".sortColumn"); //$NON-NLS-1$
+ } catch (NumberFormatException e) {
+ fSortColumn = 1;
+ }
+ switch (fSortColumn) {
+ case 1:
+ sortByName();
+ break;
+ case 2:
+ sortByLocation();
+ break;
+ case 3:
+ sortByType();
+ break;
+ }
+ }
+
+ private void restoreColumnWidths(IDialogSettings settings, String qualifier) {
+ int columnCount = fTable.getColumnCount();
+ for (int i = 0; i < columnCount; i++) {
+ int width = -1;
+
+ try {
+ width = settings.getInt(qualifier + ".columnWidth" + i); //$NON-NLS-1$
+ } catch (NumberFormatException e) {}
+
+ if (width <= 0) {
+ fTable.getColumn(i).pack();
+ } else {
+ fTable.getColumn(i).setWidth(width);
+ }
+ }
+ }
+
+ /**
+ * Populates the InterpreterEnvironment table with existing InterpreterEnvironments defined in the workspace.
+ */
+ protected void fillWithWorkspaceInterpreters() {
+ // fill with interpreters
+ List standins = new ArrayList();
+ IInterpreterInstallType[] types = ScriptRuntime.getInterpreterInstallTypes(getCurrentNature());
+ for (int i = 0; i < types.length; i++) {
+ IInterpreterInstallType type = types[i];
+ IInterpreterInstall[] installs = type.getInterpreterInstalls();
+ if (installs != null)
+ for (int j = 0; j < installs.length; j++) {
+ IInterpreterInstall install = installs[j];
+ standins.add(new InterpreterStandin(install));
+ }
+ }
+ setInterpreters((IInterpreterInstall[])standins.toArray(new IInterpreterInstall[standins.size()]));
+ }
+ public void interpreterAdded(IInterpreterInstall Interpreter) {
+ fInterpreters.add(Interpreter);
+ fInterpreterList.refresh();
+
+ IInterpreterInstall[] installs = getInterpreters();
+ if (installs.length == 1) {
+ // pick a default Interpreter automatically
+ setSelection(new StructuredSelection(installs[0]));
+ }
+ fireSelectionChanged();
+ }
+
+ // Make sure that InterpreterStandin ids are unique if multiple calls to System.currentTimeMillis()
+ // happen very quickly
+ private static String fgLastUsedID;
+
+ /**
+ * Find a unique Interpreter id. Check existing 'real' Interpreters, as well as the last id used for
+ * a InterpreterStandin.
+ */
+ protected String createUniqueId(IInterpreterInstallType InterpreterType) {
+ String id= null;
+ do {
+ id= String.valueOf(System.currentTimeMillis());
+ } while (InterpreterType.findInterpreterInstall(id) != null || id.equals(fgLastUsedID));
+ fgLastUsedID = id;
+ return id;
+ }
+
+ /**
+ * Compares the given name against current names and adds the appropriate numerical
+ * suffix to ensure that it is unique.
+ * @param name the name with which to ensure uniqueness
+ * @return the unique version of the given name
+ *
+ */
+ protected String generateName(String name){
+ if (!isDuplicateName(name)) {
+ return name;
+ }
+
+ if (name.matches(".*\\(\\d*\\)")) { //$NON-NLS-1$
+ int start = name.lastIndexOf('(');
+ int end = name.lastIndexOf(')');
+ String stringInt = name.substring(start+1, end);
+ int numericValue = Integer.parseInt(stringInt);
+ String newName = name.substring(0, start+1) + (numericValue+1) + ")"; //$NON-NLS-1$
+ return generateName(newName);
+ } else {
+ return generateName(name + " (1)"); //$NON-NLS-1$
+ }
+ }
+
+ abstract protected String getCurrentNature();
+
+ protected abstract AddDLTKInterpreterDialog createInterpreterDialog(IInterpreterInstall standin);
+
+ protected void copyInterpreter() {
+ IStructuredSelection selection = (IStructuredSelection) fInterpreterList.getSelection();
+ Iterator it = selection.iterator();
+
+ ArrayList newEntries = new ArrayList();
+ while (it.hasNext()) {
+ IInterpreterInstall selectedInterpreter = (IInterpreterInstall) it.next();
+
+ // duplicate & add Interpreter
+ InterpreterStandin standin = new InterpreterStandin(selectedInterpreter, createUniqueId(selectedInterpreter.getInterpreterInstallType()));
+ standin.setName(generateName(selectedInterpreter.getName()));
+ AddDLTKInterpreterDialog dialog = createInterpreterDialog(standin);
+ dialog.setTitle(InterpretersMessages.InstalledInterpretersBlock_18);
+ if (dialog.open() != Window.OK) {
+ return;
+ }
+ newEntries.add(standin);
+ fInterpreters.add(standin);
+ }
+ fInterpreterList.refresh();
+ fInterpreterList.setSelection(new StructuredSelection(newEntries.toArray()));
+ }
+
+ /**
+ * Bring up a dialog that lets the user create a new Interpreter definition.
+ */
+ protected void addInterpreter() {
+ AddDLTKInterpreterDialog dialog= createInterpreterDialog(null);
+ dialog.setTitle(InterpretersMessages.InstalledInterpretersBlock_7);
+ if (dialog.open() != Window.OK) {
+ return;
+ }
+ fInterpreterList.refresh();
+ }
+
+ protected void editInterpreter() {
+ IStructuredSelection selection= (IStructuredSelection)fInterpreterList.getSelection();
+ IInterpreterInstall Interpreter= (IInterpreterInstall)selection.getFirstElement();
+ if (Interpreter == null) {
+ return;
+ }
+
+ AddDLTKInterpreterDialog dialog= createInterpreterDialog(Interpreter);
+ dialog.setTitle(InterpretersMessages.InstalledInterpretersBlock_8);
+ if (dialog.open() != Window.OK) {
+ return;
+ }
+ fInterpreterList.refresh(Interpreter);
+
+ }
+}
\ No newline at end of file
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/InterpretersMessages.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/InterpretersMessages.java
new file mode 100644
index 0000000..7747def
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/InterpretersMessages.java
@@ -0,0 +1,80 @@
+package org.eclipse.dltk.internal.debug.ui.interpreters;
+
+import org.eclipse.osgi.util.NLS;
+
+public class InterpretersMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.dltk.internal.debug.ui.interpreters.InterpretersMessages";//$NON-NLS-1$
+ public static String addInterpreterDialog_InterpreterEnvironmentName;
+ public static String InterpretersPreferencePage_1;
+ public static String InterpretersPreferencePage_2;
+ public static String InstalledInterpretersBlock_15;
+ public static String InstalledInterpretersBlock_0;
+ public static String InstalledInterpretersBlock_1;
+ public static String InstalledInterpretersBlock_2;
+ public static String InstalledInterpretersBlock_3;
+ public static String InstalledInterpretersBlock_4;
+ public static String InstalledInterpretersBlock_16;
+ public static String InstalledInterpretersBlock_5;
+ public static String InstalledInterpretersBlock_6;
+ public static String InstalledInterpretersBlock_18;
+ public static String InstalledInterpretersBlock_8;
+ public static String InstalledInterpretersBlock_7;
+ public static String addInterpreterDialog_InterpreterExecutableName;
+ public static String addInterpreterDialog_browse1;
+ public static String AddInterpreterDialog_23;
+ public static String AddInterpreterDialog_Interpreter_system_libraries__1;
+ public static String addInterpreterDialog_enterLocation;
+ public static String addInterpreterDialog_locationNotExists;
+ public static String addInterpreterDialog_enterName;
+ public static String addInterpreterDialog_duplicateName;
+ public static String addInterpreterDialog_pickInterpreterRootDialog_message;
+ public static String InterpretersComboBlock_3;
+ public static String InterpretersComboBlock_1;
+ public static String InterpretersComboBlock_0;
+ public static String InterpretersComboBlock_2;
+ public static String InterpretersComboBlock_12;
+ public static String InterpretersComboBlock_13;
+ public static String InterpretersComboBlock_11;
+ public static String InterpretersComboBlock_10;
+ public static String InterpretersComboBlock_9;
+ public static String InterpretersComboBlock_8;
+ public static String addInterpreterDialog_InterpreterEnvironmentType;
+ public static String LibraryStandin_0;
+ public static String InterpreterLibraryBlock_0;
+ public static String InterpreterLibraryBlock_7;
+ public static String InterpreterLibraryBlock_6;
+ public static String InterpreterLibraryBlock_4;
+ public static String InterpreterLibraryBlock_5;
+ public static String InterpreterLibraryBlock_9;
+ public static String InterpreterLibraryBlock_Libraries_cannot_be_empty__1;
+ public static String InterpreterLibraryBlock_10;
+ public static String InterpretersPreferencePage_11;
+ public static String InterpretersPreferencePage_10;
+ public static String InterpretersUpdater_0;
+ public static String InstalledInterpretersBlock_11;
+ public static String InstalledInterpretersBlock_12;
+ public static String InstalledInterpretersBlock_13;
+ public static String InstalledInterpretersBlock_9;
+ public static String InstalledInterpretersBlock_10;
+ public static String InstalledInterpretersBlock_14;
+ public static String InterpreterPreferencePage_addInterpreter;
+ public static String InterpreterPreferencePage_pleaseSetDefaultInterpreter;
+ public static String InterpreterContainerWizardPage_3;
+ public static String InterpreterContainerWizardPage_Interpreter_System_Library_1;
+ public static String InterpreterContainerWizardPage_Select_the_Interpreter_used_to_build_this_project__4;
+ public static String BuildInterpreterDescriptor_0;
+ public static String InstalledInterpretersBlock_113;
+ public static String statusFetchingLibs;
+ public static String AddInterpreterDialog_iArgs;
+
+
+
+
+ private InterpretersMessages() {
+ // dont instatiate
+ }
+ static {
+ // load message values from bundle file
+ NLS.initializeMessages(BUNDLE_NAME, InterpretersMessages.class);
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/InterpretersMessages.properties b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/InterpretersMessages.properties
new file mode 100644
index 0000000..7786120
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/InterpretersMessages.properties
@@ -0,0 +1,110 @@
+###############################################################################
+# Copyright (c) 2000, 2006 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+
+#AbstractScriptCommandTab_1=Interpreter executable:
+#AbstractScriptCommandTab_2=D&efault ({0})
+#AbstractScriptCommandTab_3=Standard command
+#AbstractScriptCommandTab_4=&Alternate
+#AbstractScriptCommandTab_Script_executable_must_be_specified_5=Executable must be specified
+
+BuildInterpreterDescriptor_0=Workspace &default interpreter ({0})
+
+InstalledInterpretersBlock_0=Name
+InstalledInterpretersBlock_1=Location
+InstalledInterpretersBlock_2=Type
+InstalledInterpretersBlock_3=&Add...
+InstalledInterpretersBlock_4=&Edit...
+InstalledInterpretersBlock_5=&Remove
+InstalledInterpretersBlock_6=&Search...
+InstalledInterpretersBlock_7=Add interpreter
+InstalledInterpretersBlock_8=Edit interpreter
+InstalledInterpretersBlock_9=Select a directory to search in:
+InstalledInterpretersBlock_10=Directory Selection
+InstalledInterpretersBlock_11=Searching...
+InstalledInterpretersBlock_12=Information
+InstalledInterpretersBlock_13=No interpreters found in {0}
+InstalledInterpretersBlock_113=No interpreters found
+InstalledInterpretersBlock_14=Found {0} - Searching {1}
+InstalledInterpretersBlock_15=Installed &interpreters:
+InstalledInterpretersBlock_16=&Copy...
+InstalledInterpretersBlock_18=Copy interpreter
+#InstalledInterpretersBlock_19={0} (locked)
+
+InterpretersComboBlock_1=Alternate &interpreter:
+InterpretersComboBlock_10=Interpreter name not specified for interpreter type: {0}
+InterpretersComboBlock_11=Unable to resolve interpreter: {0} ({1})
+InterpretersComboBlock_12=Interpreter path not specified
+InterpretersComboBlock_13=Interpreter path does not exist
+#InterpretersComboBlock_14=Envir&onments...
+InterpretersComboBlock_2=&Installed interpreters...
+InterpretersComboBlock_3=Runtime interpreter:
+InterpretersComboBlock_0=No interpreters defined in workspace
+#InterpretersComboBlock_4=E&xecution Environment:
+#InterpretersComboBlock_5=No execution environments defined in workspace
+#InterpretersComboBlock_6=Unknown execution environment specified: {0}
+#InterpretersComboBlock_7=No interpreters in workspace compatible with specified execution environment: {0}
+InterpretersComboBlock_8=interpreter type not specified
+InterpretersComboBlock_9=Unknown interpreter type specified: {0}
+
+InterpreterContainerWizardPage_Interpreter_System_Library_1=System Library
+InterpreterContainerWizardPage_Select_the_Interpreter_used_to_build_this_project__4=Select a interpreter to add to the buildpath.
+InterpreterContainerWizardPage_3=System library
+
+InterpretersPreferencePage_1=Installed interpreters
+InterpretersPreferencePage_2=Add, remove or edit interpreter definitions.\nChecked interpreter is a default interpreter used for newly created projects.\nAlso you may specify interpreteter on project level using project options.
+InterpretersPreferencePage_10=Installed interpreter location no longer exists. Interpreter will be removed.
+InterpretersPreferencePage_11=Interpreter removed
+
+addInterpreterDialog_browse1=&Browse...
+addInterpreterDialog_duplicateName=The name is already used.
+addInterpreterDialog_enterLocation=Enter the location of the interpreter.
+addInterpreterDialog_enterName=Enter a name for the interpreter.
+addInterpreterDialog_InterpreterExecutableName=&Interpreter executable:
+addInterpreterDialog_InterpreterEnvironmentName=Interpreter &name:
+addInterpreterDialog_InterpreterEnvironmentType=Interpreter &type:
+addInterpreterDialog_locationNotExists=The location does not exist.
+AddInterpreterDialog_iArgs=Interpreter arguments:
+addInterpreterDialog_pickInterpreterRootDialog_message=Select the root directory of the interpreter installation:
+AddInterpreterDialog_Interpreter_system_libraries__1=Interpreter system libraries:
+#AddInterpreterDialog_Interpreter_name_must_be_a_valid_file_name___0__1=Interpreter name must be a valid file name: {0}
+AddInterpreterDialog_23=Default &interpreter Arguments:
+#AddInterpreterDialog_0=interpreter
+
+InterpreterLibraryBlock_Libraries_cannot_be_empty__1=Libraries cannot be empty.
+
+InterpretersUpdater_0=Save Interpreter Definitions
+InterpreterLibraryBlock_0=Source attachment:
+I#nterpreterLibraryBlock_1=(none)
+InterpreterLibraryBlock_10=Library Selection
+#InterpreterDetailsDialog_0=Interpreter Details
+InterpreterLibraryBlock_4=U&p
+InterpreterLibraryBlock_5=&Down
+InterpreterLibraryBlock_6=Re&move
+InterpreterLibraryBlock_7=Add E&xternal libraries...
+#InterpreterLibraryBlock_8=Ed&it...
+InterpreterLibraryBlock_9=&Restore Default
+LibraryStandin_0=System library does not exist: {0}
+LibraryStandin_1=Source attachment does not exist: {0}
+
+
+InterpreterPreferencePage_addInterpreter=Add interpreters, if you want to launch anything
+InterpreterPreferencePage_pleaseSetDefaultInterpreter=Select a default interpreter
+InterpreterContainerWizardPage_Interpreter_System_Library_1=Interpreter System Library
+InterpreterContainerWizardPage_3=System library
+InterpreterContainerWizardPage_Interpreter_System_Library_1=Interpreter system library
+InterpreterContainerWizardPage_Select_the_Interpreter_used_to_build_this_project__4=Select an interpreter
+BuildInterpreterDescriptor_0=Workspace &default interpreter ({0})
+
+statusFetchingLibs=Fetching default interpreter library locations...
+
+
+#GenericPythonArgumentsTab_1=Interpreters arguments:
+#GenericPythonArgumentsTab_2
\ No newline at end of file
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/InterpretersUpdater.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/InterpretersUpdater.java
new file mode 100644
index 0000000..9b193ed
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/InterpretersUpdater.java
@@ -0,0 +1,151 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.dltk.internal.debug.ui.interpreters;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.TransformerException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.dltk.debug.ui.DLTKDebugUIPlugin;
+import org.eclipse.dltk.internal.launching.InterpreterDefinitionsContainer;
+import org.eclipse.dltk.launching.IInterpreterInstall;
+import org.eclipse.dltk.launching.IInterpreterInstallType;
+import org.eclipse.dltk.launching.ScriptRuntime;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+
+
+/**
+ * Processes add/removed/changed Interpreters.
+ */
+public class InterpretersUpdater {
+
+ // the Interpreters defined when this updated is instantiated
+ private InterpreterDefinitionsContainer fOriginalInterpreters;
+
+ /**
+ * Contstructs a new Interpreter updater to update Interpreter install settings.
+ */
+ public InterpretersUpdater() {
+ saveCurrentAsOriginal ();
+ }
+
+ private void saveCurrentAsOriginal () {
+ fOriginalInterpreters = new InterpreterDefinitionsContainer();
+ IInterpreterInstall def = null;
+
+ String natures[] = ScriptRuntime.getInterpreterNatures();
+ for (int i = 0; i < natures.length; i++) {
+ def = ScriptRuntime.getDefaultInterpreterInstall(natures[i]);
+
+ if (def != null) {
+ fOriginalInterpreters.setDefaultInterpreterInstallCompositeID(natures[i], ScriptRuntime.getCompositeIdFromInterpreter(def));
+ }
+ }
+
+
+ IInterpreterInstallType[] types = ScriptRuntime.getInterpreterInstallTypes();
+ for (int i = 0; i < types.length; i++) {
+ IInterpreterInstall[] Interpreters = types[i].getInterpreterInstalls();
+ if (Interpreters != null)
+ for (int j = 0; j < Interpreters.length; j++) {
+ fOriginalInterpreters.addInterpreter(Interpreters[j]);
+ }
+ }
+ }
+
+ /**
+ * Updates Interpreter settings and returns whether the update was successful.
+ *
+ * @param InterpreterEnvironments new installed InterpreterEnvironments
+ * @param defaultInterp new default Interpreter
+ * @return whether the update was successful
+ */
+ public boolean updateInterpreterSettings(String nature, IInterpreterInstall[] InterpreterEnvironments, IInterpreterInstall defaultInterp) {
+
+ // Create a Interpreter definition container
+ InterpreterDefinitionsContainer InterpreterContainer = new InterpreterDefinitionsContainer();
+
+ // Set the default Interpreter Id on the container
+ if (defaultInterp != null) {
+ String defaultInterpId = ScriptRuntime.getCompositeIdFromInterpreter(defaultInterp);
+ InterpreterContainer.setDefaultInterpreterInstallCompositeID(nature, defaultInterpId);
+ } else {
+ InterpreterContainer.setDefaultInterpreterInstallCompositeID(nature, null);
+ }
+
+
+ // Set the Interpreters on the container
+ for (int i = 0; i < InterpreterEnvironments.length; i++) {
+ InterpreterContainer.addInterpreter(InterpreterEnvironments[i]);
+ }
+
+ //get old other lang interpreters
+ List oldList = fOriginalInterpreters.getInterpreterList();
+ String[] natures = fOriginalInterpreters.getInterpreterNatures();
+ for (Iterator iter = oldList.iterator(); iter.hasNext();) {
+ IInterpreterInstall ii = (IInterpreterInstall) iter.next();
+ if (!ii.getInterpreterInstallType().getNatureId().equals(nature)) {
+ InterpreterContainer.addInterpreter(ii);
+ }
+ }
+ for (int i = 0; i < natures.length; i++) {
+ if (!nature.equals(natures[i])) {
+ String sid = fOriginalInterpreters.getDefaultInterpreterInstallCompositeID(natures[i]);
+ InterpreterContainer.setDefaultInterpreterInstallCompositeID(natures[i], sid);
+ }
+ }
+
+
+ // Generate XML for the Interpreter defs and save it as the new value of the Interpreter preference
+ saveInterpreterDefinitions(InterpreterContainer);
+
+ saveCurrentAsOriginal ();
+
+ return true;
+ }
+
+ private void saveInterpreterDefinitions(final InterpreterDefinitionsContainer container) {
+ IRunnableWithProgress runnable = new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ try {
+ monitor.beginTask(InterpretersMessages.InterpretersUpdater_0, 100);
+ String InterpreterDefXML = container.getAsXML();
+ monitor.worked(40);
+ ScriptRuntime.getPreferences().setValue(ScriptRuntime.PREF_INTERPRETER_XML, InterpreterDefXML);
+ monitor.worked(30);
+ ScriptRuntime.savePreferences();
+ monitor.worked(30);
+ } catch (IOException ioe) {
+ DLTKDebugUIPlugin.log(ioe);
+ } catch (ParserConfigurationException e) {
+ DLTKDebugUIPlugin.log(e);
+ } catch (TransformerException e) {
+ DLTKDebugUIPlugin.log(e);
+ } finally {
+ monitor.done();
+ }
+
+ }
+ };
+ try {
+ DLTKDebugUIPlugin.getDefault().getWorkbench().getProgressService().busyCursorWhile(runnable);
+ } catch (InvocationTargetException e) {
+ DLTKDebugUIPlugin.log(e);
+ } catch (InterruptedException e) {
+ DLTKDebugUIPlugin.log(e);
+ }
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/LibraryContentProvider.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/LibraryContentProvider.java
new file mode 100644
index 0000000..4ae2ffb
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/LibraryContentProvider.java
@@ -0,0 +1,185 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.dltk.internal.debug.ui.interpreters;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.dltk.launching.LibraryLocation;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+
+
+public class LibraryContentProvider implements ITreeContentProvider {
+
+ private Viewer fViewer;
+
+ private LibraryStandin[] fLibraries= new LibraryStandin[0];
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+ */
+ public void dispose() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ */
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ fViewer = viewer;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+ */
+ public Object[] getElements(Object inputElement) {
+ return fLibraries;
+ }
+
+
+ public void setLibraries(LibraryLocation[] libs) {
+ fLibraries = new LibraryStandin[libs.length];
+ for (int i = 0; i < libs.length; i++) {
+ fLibraries[i] = new LibraryStandin(libs[i]);
+ }
+ fViewer.refresh();
+ }
+
+ public LibraryLocation[] getLibraries() {
+ LibraryLocation[] locations = new LibraryLocation[fLibraries.length];
+ for (int i = 0; i < locations.length; i++) {
+ locations[i] = fLibraries[i].toLibraryLocation();
+ }
+ return locations;
+ }
+
+ /**
+ * Returns the list of libraries in the given selection. SubElements
+ * are replaced by their parent libraries.
+ */
+ private Set getSelectedLibraries(IStructuredSelection selection) {
+ Set libraries= new HashSet();
+ for (Iterator iter= selection.iterator(); iter.hasNext();) {
+ Object element= iter.next();
+ if (element instanceof LibraryStandin) {
+ libraries.add(element);
+ }
+ }
+ return libraries;
+ }
+
+ /**
+ * Move the libraries of the given selection up.
+ */
+ public void up(IStructuredSelection selection) {
+ Set libraries= getSelectedLibraries(selection);
+ for (int i= 0; i < fLibraries.length - 1; i++) {
+ if (libraries.contains(fLibraries[i + 1])) {
+ LibraryStandin temp= fLibraries[i];
+ fLibraries[i]= fLibraries[i + 1];
+ fLibraries[i + 1]= temp;
+ }
+ }
+ fViewer.refresh();
+ fViewer.setSelection(selection);
+ }
+
+ /**
+ * Move the libraries of the given selection down.
+ */
+ public void down(IStructuredSelection selection) {
+ Set libraries= getSelectedLibraries(selection);
+ for (int i= fLibraries.length - 1; i > 0; i--) {
+ if (libraries.contains(fLibraries[i - 1])) {
+ LibraryStandin temp= fLibraries[i];
+ fLibraries[i]= fLibraries[i - 1];
+ fLibraries[i - 1]= temp;
+ }
+ }
+ fViewer.refresh();
+ fViewer.setSelection(selection);
+ }
+
+ /**
+ * Remove the libraries contained in the given selection.
+ */
+ public void remove(IStructuredSelection selection) {
+ List newLibraries = new ArrayList();
+ for (int i = 0; i < fLibraries.length; i++) {
+ newLibraries.add(fLibraries[i]);
+ }
+ Iterator iterator = selection.iterator();
+ while (iterator.hasNext()) {
+ Object element = iterator.next();
+ if (element instanceof LibraryStandin) {
+ newLibraries.remove(element);
+ }
+ }
+ fLibraries= (LibraryStandin[]) newLibraries.toArray(new LibraryStandin[newLibraries.size()]);
+ fViewer.refresh();
+ }
+
+ /**
+ * Add the given libraries before the selection, or after the existing libraries
+ * if the selection is empty.
+ */
+ public void add(LibraryLocation[] libs, IStructuredSelection selection) {
+ List newLibraries = new ArrayList(fLibraries.length + libs.length);
+ for (int i = 0; i < fLibraries.length; i++) {
+ newLibraries.add(fLibraries[i]);
+ }
+ List toAdd = new ArrayList(libs.length);
+ for (int i = 0; i < libs.length; i++) {
+ toAdd.add(new LibraryStandin(libs[i]));
+ }
+ if (selection.isEmpty()) {
+ newLibraries.addAll(toAdd);
+ } else {
+ Object element= selection.getFirstElement();
+ LibraryStandin firstLib = (LibraryStandin) element;
+ int index = newLibraries.indexOf(firstLib);
+ newLibraries.addAll(index, toAdd);
+ }
+ fLibraries= (LibraryStandin[]) newLibraries.toArray(new LibraryStandin[newLibraries.size()]);
+ fViewer.refresh();
+ fViewer.setSelection(new StructuredSelection(libs), true);
+ }
+
+ /**
+ * Returns the standin libraries being edited.
+ *
+ * @return standins
+ */
+ public LibraryStandin[] getStandins() {
+ return fLibraries;
+ }
+
+ public Object[] getChildren(Object parentElement) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Object getParent(Object element) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean hasChildren(Object element) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+}
\ No newline at end of file
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/LibraryLabelProvider.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/LibraryLabelProvider.java
new file mode 100644
index 0000000..f36e0c1
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/LibraryLabelProvider.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.dltk.internal.debug.ui.interpreters;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.dltk.debug.ui.DLTKDebugUIPlugin;
+import org.eclipse.dltk.internal.debug.ui.DebugImageDescriptor;
+import org.eclipse.dltk.ui.DLTKPluginImages;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+
+
+public class LibraryLabelProvider extends LabelProvider {
+
+ public Image getImage(Object element) {
+ if (element instanceof LibraryStandin) {
+ LibraryStandin library= (LibraryStandin) element;
+ String key = null;
+ key = DLTKPluginImages.IMG_OBJS_EXTJAR;
+ IStatus status = library.validate();
+ if (!status.isOK()) {
+ ImageDescriptor base = DLTKPluginImages.getDescriptor(key);
+ DebugImageDescriptor descriptor= new DebugImageDescriptor(base, DebugImageDescriptor.IS_OUT_OF_SYNCH);
+ return DLTKDebugUIPlugin.getImageDescriptorRegistry().get(descriptor);
+ }
+ return DLTKPluginImages.get(key);
+ }
+ return null;
+ }
+
+ public String getText(Object element) {
+ if (element instanceof LibraryStandin) {
+ return ((LibraryStandin)element).getSystemLibraryPath().toOSString();
+ }
+ return null;
+ }
+
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/LibraryStandin.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/LibraryStandin.java
new file mode 100644
index 0000000..f6073c3
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/interpreters/LibraryStandin.java
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.dltk.internal.debug.ui.interpreters;
+
+import java.io.File;
+import java.text.MessageFormat;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.dltk.debug.ui.DLTKDebugUIPlugin;
+import org.eclipse.dltk.debug.ui.IDLTKDebugUIConstants;
+import org.eclipse.dltk.launching.LibraryLocation;
+
+
+
+/**
+ * Wrapper for an original library location, to support editing.
+ *
+ */
+public final class LibraryStandin {
+ private IPath fSystemLibrary;
+
+ /**
+ * Creates a new library standin on the given library location.
+ */
+ public LibraryStandin(LibraryLocation libraryLocation) {
+ fSystemLibrary= libraryLocation.getSystemLibraryPath();
+ }
+
+ /**
+ * Returns the InterpreterEnvironment library archive location.
+ *
+ * @return The InterpreterEnvironment library archive location.
+ */
+ public IPath getSystemLibraryPath() {
+ return fSystemLibrary;
+ }
+
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object obj) {
+ if (obj instanceof LibraryStandin) {
+ LibraryStandin lib = (LibraryStandin)obj;
+ return getSystemLibraryPath().equals(lib.getSystemLibraryPath());
+ }
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode() {
+ return getSystemLibraryPath().hashCode();
+ }
+
+ /**
+ * Returns whether the given paths are equal - either may be <code>null</code>.
+ * @param path1 path to be compared
+ * @param path2 path to be compared
+ * @return whether the given paths are equal
+ */
+ protected boolean equals(IPath path1, IPath path2) {
+ return equalsOrNull(path1, path2);
+ }
+
+ /**
+ * Returns whether the given objects are equal - either may be <code>null</code>.
+ * @param o1 object to be compared
+ * @param o2 object to be compared
+ * @return whether the given objects are equal or both null
+ *
+ */
+ private boolean equalsOrNull(Object o1, Object o2) {
+ if (o1 == null) {
+ return o2 == null;
+ }
+ if (o2 == null) {
+ return false;
+ }
+ return o1.equals(o2);
+ }
+
+
+ /**
+ * Returns an equivalent library location.
+ *
+ * @return library location
+ */
+ public LibraryLocation toLibraryLocation() {
+ return new LibraryLocation(getSystemLibraryPath());
+ }
+
+ /**
+ * Returns a status for this library describing any error states
+ *
+ * @return
+ */
+ public IStatus validate() {
+ File f = getSystemLibraryPath().toFile();
+ if (!f.exists()) {
+ IPath path = getSystemLibraryPath();
+ String message = "Path is empty";
+ if( path != null ) {
+ message = path.toOSString();
+ }
+ return new Status(IStatus.ERROR, DLTKDebugUIPlugin.PLUGIN_ID, IDLTKDebugUIConstants.INTERNAL_ERROR,
+ MessageFormat.format(InterpretersMessages.LibraryStandin_0, new String[]{message}), null);
+ }
+ return Status.OK_STATUS;
+ }
+
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/launcher/AbstractNoInterpreterStatusHandler.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/launcher/AbstractNoInterpreterStatusHandler.java
new file mode 100644
index 0000000..5cd8261
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/launcher/AbstractNoInterpreterStatusHandler.java
@@ -0,0 +1,57 @@
+package org.eclipse.dltk.internal.debug.ui.launcher;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.debug.core.IStatusHandler;
+import org.eclipse.dltk.debug.ui.DLTKDebugUIPlugin;
+import org.eclipse.dltk.launching.LaunchingMessages;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.preference.IPreferencePage;
+
+
+public abstract class AbstractNoInterpreterStatusHandler implements IStatusHandler
+{
+ /*
+ * @see org.eclipse.debug.core.IStatusHandler#handleStatus(org.eclipse.core.runtime.IStatus, java.lang.Object)
+ */
+ public Object handleStatus(IStatus status, Object source)
+ {
+ final boolean[] result = new boolean[1];
+ DLTKDebugUIPlugin.getStandardDisplay().syncExec(new Runnable()
+ {
+ public void run()
+ {
+ String title = LaunchingMessages.NoDefaultInterpreterStatusHandler_title;
+ String message =
+ LaunchingMessages.NoDefaultInterpreterStatusHandler_message;
+ result[0] =
+ (MessageDialog.openQuestion(DLTKDebugUIPlugin.getActiveWorkbenchShell(),
+ title, message));
+ if (result[0])
+ {
+ // show preference page
+ showInterpreterPreferencePage();
+ }
+ }
+ });
+ return new Boolean(result[0]);
+ }
+
+ /**
+ * shows the interpreter preference page
+ *
+ * <p>sub-classes should create their intepreter specific preference page and then make
+ * a call to @link {@link #showPrefPage(String, IPreferencePage)} to render the page.</p>
+ */
+ protected abstract void showInterpreterPreferencePage();
+
+ /**
+ * cause the reference page to appear
+ *
+ * @param id preference page id
+ * @param page preference page
+ */
+ protected final void showPrefPage(String id, IPreferencePage page)
+ {
+ DLTKDebugUIPlugin.showPreferencePage(id, page);
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/launcher/InterpreterArgumentsBlock.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/launcher/InterpreterArgumentsBlock.java
new file mode 100644
index 0000000..37c16ff
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/launcher/InterpreterArgumentsBlock.java
@@ -0,0 +1,142 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.dltk.internal.debug.ui.launcher;
+
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.ui.StringVariableSelectionDialog;
+import org.eclipse.dltk.debug.ui.DLTKDebugUIPlugin;
+import org.eclipse.dltk.debug.ui.actions.ControlAccessibleListener;
+import org.eclipse.dltk.debug.ui.launchConfigurations.CommonScriptLaunchTab;
+import org.eclipse.dltk.debug.ui.messages.DLTKLaunchMessages;
+import org.eclipse.dltk.launching.IDLTKLaunchConfigurationConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Text;
+
+
+/**
+ * Editor for Interpreter arguments of a Script launch configuration.
+ */
+public class InterpreterArgumentsBlock extends CommonScriptLaunchTab {
+
+ // Interpreter arguments widgets
+ protected Text fInterpreterArgumentsText;
+ private Button fPgrmArgVariableButton;
+
+ /**
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(Composite)
+ */
+ public void createControl(Composite parent) {
+ Font font = parent.getFont();
+
+ Group group = new Group(parent, SWT.NONE);
+ setControl(group);
+ GridLayout topLayout = new GridLayout();
+ group.setLayout(topLayout);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ group.setLayoutData(gd);
+ group.setFont(font);
+ group.setText(DLTKLaunchMessages.InterpreterArgumentsTab_Interpreter_ar_guments__6);
+
+ fInterpreterArgumentsText = new Text(group, SWT.MULTI | SWT.WRAP| SWT.BORDER | SWT.V_SCROLL);
+ gd = new GridData(GridData.FILL_BOTH);
+ gd.heightHint = 40;
+ gd.widthHint = 100;
+ fInterpreterArgumentsText.setLayoutData(gd);
+ fInterpreterArgumentsText.setFont(font);
+ fInterpreterArgumentsText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent evt) {
+ updateLaunchConfigurationDialog();
+ }
+ });
+ ControlAccessibleListener.addListener(fInterpreterArgumentsText, group.getText());
+
+ fPgrmArgVariableButton = createPushButton(group, DLTKLaunchMessages.InterpreterArgumentsBlock_4, null);
+ fPgrmArgVariableButton.setFont(font);
+ fPgrmArgVariableButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
+ fPgrmArgVariableButton.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell());
+ dialog.open();
+ String variable = dialog.getVariableExpression();
+ if (variable != null) {
+ fInterpreterArgumentsText.insert(variable);
+ }
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ });
+ }
+
+ /**
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(ILaunchConfigurationWorkingCopy)
+ */
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+ configuration.setAttribute(IDLTKLaunchConfigurationConstants.ATTR_INTERPRETER_ARGUMENTS, (String)null);
+ }
+
+ /**
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(ILaunchConfiguration)
+ */
+ public void initializeFrom(ILaunchConfiguration configuration) {
+ try {
+ fInterpreterArgumentsText.setText(configuration.getAttribute(IDLTKLaunchConfigurationConstants.ATTR_INTERPRETER_ARGUMENTS, "")); //$NON-NLS-1$
+ } catch (CoreException e) {
+ setErrorMessage(DLTKLaunchMessages.InterpreterArgumentsTab_Exception_occurred_reading_configuration___15 + e.getStatus().getMessage());
+ DLTKDebugUIPlugin.log(e);
+ }
+ }
+
+ /**
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(ILaunchConfigurationWorkingCopy)
+ */
+ public void performApply(ILaunchConfigurationWorkingCopy configuration) {
+ configuration.setAttribute(IDLTKLaunchConfigurationConstants.ATTR_INTERPRETER_ARGUMENTS, getAttributeValueFrom(fInterpreterArgumentsText));
+ }
+
+ /**
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
+ */
+ public String getName() {
+ return DLTKLaunchMessages.InterpreterArgumentsBlock_Interpreter_Arguments;
+ }
+
+ /**
+ * Retuns the string in the text widget, or <code>null</code> if empty.
+ *
+ * @return text or <code>null</code>
+ */
+ protected String getAttributeValueFrom(Text text) {
+ String content = text.getText().trim();
+ if (content.length() > 0) {
+ return content;
+ }
+ return null;
+ }
+
+ public void setEnabled(boolean enabled) {
+ fInterpreterArgumentsText.setEnabled(enabled);
+ fPgrmArgVariableButton.setEnabled(enabled);
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/launcher/ScriptLaunchShortcut.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/launcher/ScriptLaunchShortcut.java
new file mode 100644
index 0000000..779501c
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/launcher/ScriptLaunchShortcut.java
@@ -0,0 +1,323 @@
+package org.eclipse.dltk.internal.debug.ui.launcher;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.IDebugModelPresentation;
+import org.eclipse.debug.ui.ILaunchShortcut;
+import org.eclipse.dltk.core.IModelElement;
+import org.eclipse.dltk.core.IParent;
+import org.eclipse.dltk.core.ISourceModule;
+import org.eclipse.dltk.core.ModelException;
+import org.eclipse.dltk.debug.ui.DLTKDebugUIPlugin;
+import org.eclipse.dltk.debug.ui.messages.DLTKLaunchMessages;
+import org.eclipse.dltk.internal.launching.DLTKLaunchingPlugin;
+import org.eclipse.dltk.launching.LaunchingMessages;
+import org.eclipse.dltk.launching.IDLTKLaunchConfigurationConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.ElementListSelectionDialog;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+
+
+
+public abstract class ScriptLaunchShortcut implements ILaunchShortcut {
+ public void launch(ISelection selection, String mode) {
+ if (selection instanceof IStructuredSelection) {
+ searchAndLaunch(((IStructuredSelection)selection).toArray(), mode, getScriptSelectionTitle(), getSelectionEmptyMessage());
+ }
+ }
+
+ /**
+ * @param search the elements to search for a main script
+ * @param mode the mode to launch in
+ */
+ public void searchAndLaunch(Object[] search, String mode, String selectMessage, String emptyMessage) {
+ IResource[] scripts = null;
+ try {
+ scripts = findScripts(search, PlatformUI.getWorkbench().getProgressService());
+ } catch (InterruptedException e) {
+ return;
+ } catch (CoreException e) {
+ MessageDialog.openError(getShell(), LaunchingMessages.ScriptLaunchShortcut_0, e.getMessage());
+ return;
+ }
+ IResource script = null;
+ if (scripts.length == 0) {
+ MessageDialog.openError(getShell(), LaunchingMessages.ScriptLaunchShortcut_1, emptyMessage);
+ } else if (scripts.length > 1) {
+ try {
+ script = chooseScript(scripts, selectMessage);
+ } catch (ModelException e) {
+ reportErorr(e);
+ return;
+ }
+ } else {
+ script = scripts[0];
+ }
+ if (script != null) {
+ launch(script, mode);
+ }
+ }
+
+ /**
+ * Prompts the user to select a type from the given types.
+ *
+ * @param types the types to choose from
+ * @param title the selection dialog title
+ *
+ * @return the selected type or <code>null</code> if none.
+ */
+ protected IResource chooseScript(IResource[] scripts, String title) throws ModelException {
+ ElementListSelectionDialog dialog = new ElementListSelectionDialog (getShell(), new WorkbenchLabelProvider() );
+ dialog.setElements(scripts);
+ dialog.setMessage(LaunchingMessages.ScriptLaunchShortcut_Choose_a_main_script_to_launch);
+ dialog.setTitle(title);
+ if (dialog.open() == Window.OK) {
+ return (IResource)dialog.getResult()[0];
+ }
+ return null;
+ }
+
+ /**
+ * Opens an error dialog on the given excpetion.
+ *
+ * @param exception
+ */
+ protected void reportErorr(CoreException exception) {
+ MessageDialog.openError(getShell(), LaunchingMessages.ScriptLaunchShortcut_3, exception.getStatus().getMessage());
+ }
+
+ public void launch(IEditorPart editor, String mode) {
+ IEditorInput editorInput = editor.getEditorInput();
+ if (editorInput == null)
+ return;
+ IResource script = ((IFileEditorInput) editorInput).getFile();
+ if (script != null)
+ launch(script, mode);
+ }
+
+ protected void launch (IResource script, String mode) {
+ ILaunchConfiguration config = findLaunchConfiguration(script, getConfigurationType());
+ if (config != null) {
+ DebugUITools.launch(config, mode);
+ }
+ }
+
+ protected ILaunchManager getLaunchManager() {
+ return DebugPlugin.getDefault().getLaunchManager();
+ }
+
+ /**
+ * Returns the type of configuration this shortcut is applicable to.
+ *
+ * @return the type of configuration this shortcut is applicable to
+ */
+ protected abstract ILaunchConfigurationType getConfigurationType();
+
+ /**
+ * Locate a configuration to relaunch for the given type. If one cannot be found, create one.
+ *
+ * @return a re-useable config or <code>null</code> if none
+ */
+ protected ILaunchConfiguration findLaunchConfiguration(IResource script, ILaunchConfigurationType configType) {
+ List candidateConfigs = Collections.EMPTY_LIST;
+ try {
+ ILaunchConfiguration[] configs = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(configType);
+ candidateConfigs = new ArrayList(configs.length);
+ for (int i = 0; i < configs.length; i++) {
+ ILaunchConfiguration config = configs[i];
+ if (config.getAttribute(IDLTKLaunchConfigurationConstants.ATTR_MAIN_SCRIPT_NAME, "").equals(script.getProjectRelativePath().toString())) { //$NON-NLS-1$
+ candidateConfigs.add(config);
+ }
+ }
+ } catch (CoreException e) {
+ DLTKLaunchingPlugin.log(e);
+ }
+
+ // If there are no existing configs associated with the script, create one.
+ // If there is exactly one config associated with the script, return it.
+ // Otherwise, if there is more than one config associated with the script, prompt the
+ // user to choose one.
+ int candidateCount = candidateConfigs.size();
+ if (candidateCount < 1) {
+ return createConfiguration(script);
+ } else if (candidateCount == 1) {
+ return (ILaunchConfiguration) candidateConfigs.get(0);
+ } else {
+ // Prompt the user to choose a config. A null result means the user
+ // cancelled the dialog, in which case this method returns null,
+ // since cancelling the dialog should also cancel launching anything.
+ ILaunchConfiguration config = chooseConfiguration(candidateConfigs);
+ if (config != null) {
+ return config;
+ }
+ }
+
+ return null;
+ }
+
+ protected abstract String getNature();
+
+ protected ILaunchConfiguration createConfiguration(IResource script) {
+ ILaunchConfiguration config = null;
+ ILaunchConfigurationWorkingCopy wc = null;
+ try {
+ ILaunchConfigurationType configType = getConfigurationType();
+ wc = configType.newInstance(null, getLaunchManager().generateUniqueLaunchConfigurationNameFrom(script.getName()));
+ wc.setAttribute(IDLTKLaunchConfigurationConstants.ATTR_NATURE, getNature());
+ wc.setAttribute(IDLTKLaunchConfigurationConstants.ATTR_PROJECT_NAME, script.getProject().getName());
+ wc.setAttribute(IDLTKLaunchConfigurationConstants.ATTR_MAIN_SCRIPT_NAME, script.getProjectRelativePath().toPortableString()/*script.getFullPath().toPortableString()*/);
+ wc.setMappedResources(new IResource[] {script.getProject()});
+ config = wc.doSave();
+ } catch (CoreException exception) {
+ exception.printStackTrace();
+ }
+ return config;
+ }
+
+
+ /**
+ * Convenience method to get the window that owns this action's Shell.
+ */
+ protected Shell getShell() {
+ return DLTKDebugUIPlugin.getActiveWorkbenchShell();
+ }
+
+
+ /**
+ * Show a selection dialog that allows the user to choose one of the specified
+ * launch configurations. Return the chosen config, or <code>null</code> if the
+ * user cancelled the dialog.
+ */
+ protected ILaunchConfiguration chooseConfiguration(List configList) {
+ IDebugModelPresentation labelProvider = DebugUITools.newDebugModelPresentation();
+ ElementListSelectionDialog dialog= new ElementListSelectionDialog(getShell(), labelProvider);
+ dialog.setElements(configList.toArray());
+ dialog.setTitle(DLTKLaunchMessages.scriptLaunchShortcut2_title);
+ dialog.setMessage(DLTKLaunchMessages.scriptLaunchShortcut2);
+ dialog.setMultipleSelection(false);
+ int result = dialog.open();
+ labelProvider.dispose();
+ if (result == Window.OK) {
+ return (ILaunchConfiguration) dialog.getFirstResult();
+ }
+ return null;
+ }
+
+
+ /**
+ * Returns the model elements corresponding to the given objects.
+ *
+ * @param objects selected objects
+ * @return corresponding Script elements
+ */
+ private IResource[] getScriptResources(Object[] objects, IProgressMonitor pm) {
+ List list= new ArrayList(objects.length);
+ for (int i = 0; i < objects.length; i++) {
+ Object object = objects[i];
+ try {
+ if (object instanceof IFile) {
+ IFile f = (IFile)object;
+ if (!f.getName().startsWith("."))
+ list.add(object);
+ } else
+ if (object instanceof IContainer) {
+ IContainer f = (IContainer)object;
+ IResource mem[] = f.members();
+ IResource res[] = getScriptResources(mem, pm);
+ for (int j = 0; j < res.length; j++) {
+ list.add(res[j]);
+ }
+ } else
+ if (object instanceof IModelElement) {
+ IModelElement elem = (IModelElement) object;
+ if (elem instanceof ISourceModule) {
+ IResource res = ((ISourceModule)elem).getCorrespondingResource();
+ if (res != null)
+ list.add(res);
+ }
+ else if (elem instanceof IParent) {
+ IParent proj = (IParent)elem;
+ IResource res[] = getScriptResources(proj.getChildren(), pm);
+ for (int j = 0; j < res.length; j++) {
+ list.add(res[j]);
+ }
+ }
+ }
+ } catch (CoreException e) {
+ }
+ }
+ return (IResource[]) list.toArray(new IResource[list.size()]);
+ }
+
+ /**
+ * Finds and returns the launchable scripts in the given selection of elements.
+ *
+ * @param elements scope to search for launchable types
+ * @param context progess reporting context
+ * @return launchable types, possibly empty
+ * @exception InterruptedException if the search is cancelled
+ * @exception org.eclipse.core.runtime.CoreException if the search fails
+ */
+ protected IResource[] findScripts(final Object[] elements, IRunnableContext context) throws InterruptedException, CoreException {
+ try {
+ final IResource[][] res= new IResource[1][];
+
+ IRunnableWithProgress runnable= new IRunnableWithProgress() {
+ public void run(IProgressMonitor pm) throws InvocationTargetException {
+ pm.beginTask(LaunchingMessages.LaunchShortcut_searchingForScripts, 1);
+ res[0] = getScriptResources(elements, pm);
+ pm.done();
+ }
+ };
+ context.run(true, true, runnable);
+
+ return res[0];
+ } catch (InvocationTargetException e) {
+ throw (CoreException)e.getTargetException();
+ }
+ }
+
+ /**
+ * Returns the title for type selection dialog for this launch shortcut.
+ *
+ * @return type selection dialog title
+ */
+ protected String getScriptSelectionTitle() {
+ return LaunchingMessages.LaunchShortcut_selectScriptToLaunch;
+ }
+
+ /**
+ * Returns an error message to use when the selection does not contain a launchable type.
+ *
+ * @return error message
+ */
+ protected String getSelectionEmptyMessage() {
+ return LaunchingMessages.LaunchShortcut_selectionContainsNoScript;
+ }
+
+
+}
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/launcher/WorkingDirectoryBlock.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/launcher/WorkingDirectoryBlock.java
new file mode 100644
index 0000000..330eca5
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/internal/debug/ui/launcher/WorkingDirectoryBlock.java
@@ -0,0 +1,456 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.dltk.internal.debug.ui.launcher;
+
+import java.io.File;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.variables.IStringVariableManager;
+import org.eclipse.core.variables.VariablesPlugin;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.ui.StringVariableSelectionDialog;
+import org.eclipse.dltk.core.DLTKCore;
+import org.eclipse.dltk.core.IDLTKProject;
+import org.eclipse.dltk.debug.ui.launchConfigurations.CommonScriptLaunchTab;
+import org.eclipse.dltk.debug.ui.messages.DLTKLaunchMessages;
+import org.eclipse.dltk.internal.launching.DLTKLaunchingPlugin;
+import org.eclipse.dltk.launching.IDLTKLaunchConfigurationConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.ContainerSelectionDialog;
+
+
+/**
+ * A control for setting the working directory associated with a launch
+ * configuration.
+ */
+public class WorkingDirectoryBlock extends CommonScriptLaunchTab {
+
+ // Local directory
+ private Button fWorkspaceButton;
+ private Button fFileSystemButton;
+ private Button fVariablesButton;
+
+ //bug 29565 fix
+ private Button fUseDefaultDirButton = null;
+ private Button fUseOtherDirButton = null;
+ private Text fOtherWorkingText = null;
+ private Text fWorkingDirText;
+
+ /**
+ * The last launch config this tab was initialized from
+ */
+ private ILaunchConfiguration fLaunchConfiguration;
+
+ /**
+ * A listener to update for text changes and widget selection
+ */
+ private class WidgetListener extends SelectionAdapter implements ModifyListener {
+ public void modifyText(ModifyEvent e) {
+ updateLaunchConfigurationDialog();
+ }//end modifyText
+ public void widgetSelected(SelectionEvent e) {
+ Object source= e.getSource();
+ if (source == fWorkspaceButton) {
+ handleWorkspaceDirBrowseButtonSelected();
+ }//end if
+ else if (source == fFileSystemButton) {
+ handleWorkingDirBrowseButtonSelected();
+ }//end if
+ else if (source == fVariablesButton) {
+ handleWorkingDirVariablesButtonSelected();
+ }//end if
+ else if(source == fUseDefaultDirButton) {
+ //only perform the action if this is the button that was selected
+ if(fUseDefaultDirButton.getSelection()) {
+ setDefaultWorkingDir();
+ }//end if
+ }//end if
+ else if(source == fUseOtherDirButton) {
+ //only perform the action if this is the button that was selected
+ if(fUseOtherDirButton.getSelection()) {
+ handleUseOtherWorkingDirButtonSelected();
+ }//end if
+ }//end if
+ }//end widgetSelected
+ }//end WidgetListener class
+
+ private WidgetListener fListener = new WidgetListener();
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ Font font = parent.getFont();
+
+ Group group = new Group(parent, SWT.NONE);
+ //PlatformUI.getWorkbench().getHelpSystem().setHelp(group, IScriptDebugHelpContextIds.WORKING_DIRECTORY_BLOCK);
+ GridLayout workingDirLayout = new GridLayout();
+ workingDirLayout.numColumns = 2;
+ workingDirLayout.makeColumnsEqualWidth = false;
+ group.setLayout(workingDirLayout);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ group.setLayoutData(gd);
+ group.setFont(font);
+ setControl(group);
+
+ group.setText(DLTKLaunchMessages.WorkingDirectoryBlock_12);
+
+ fUseDefaultDirButton = new Button(group, SWT.RADIO);
+ fUseDefaultDirButton.setText(DLTKLaunchMessages.WorkingDirectoryBlock_18);
+ fUseDefaultDirButton.setFont(font);
+ fUseDefaultDirButton.addSelectionListener(fListener);
+ fWorkingDirText = new Text(group, SWT.SINGLE | SWT.BORDER);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ fWorkingDirText.setLayoutData(gd);
+ fWorkingDirText.setFont(font);
+ fWorkingDirText.addModifyListener(fListener);
+ fWorkingDirText.setEnabled(false);
+
+ fUseOtherDirButton = new Button(group, SWT.RADIO);
+ fUseOtherDirButton.setText(DLTKLaunchMessages.WorkingDirectoryBlock_19);
+ fUseOtherDirButton.setFont(font);
+ fUseOtherDirButton.addSelectionListener(fListener);
+ fOtherWorkingText = new Text(group, SWT.SINGLE | SWT.BORDER);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ fOtherWorkingText.setLayoutData(gd);
+ fOtherWorkingText.setFont(font);
+ fOtherWorkingText.addModifyListener(fListener);
+
+ Composite buttonComp = new Composite(group, SWT.NONE);
+ GridLayout layout = new GridLayout(3, false);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ buttonComp.setLayout(layout);
+ gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
+ gd.horizontalSpan = 2;
+ buttonComp.setLayoutData(gd);
+ buttonComp.setFont(font);
+ fWorkspaceButton = createPushButton(buttonComp, DLTKLaunchMessages.WorkingDirectoryBlock_0, null);
+ fWorkspaceButton.addSelectionListener(fListener);
+
+ fFileSystemButton = createPushButton(buttonComp, DLTKLaunchMessages.WorkingDirectoryBlock_1, null);
+ fFileSystemButton.addSelectionListener(fListener);
+
+ fVariablesButton = createPushButton(buttonComp, DLTKLaunchMessages.WorkingDirectoryBlock_17, null);
+ fVariablesButton.addSelectionListener(fListener);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#dispose()
+ */
+ public void dispose() {}
+
+ /**
+ * Show a dialog that lets the user select a working directory
+ */
+ private void handleWorkingDirBrowseButtonSelected() {
+ DirectoryDialog dialog = new DirectoryDialog(getShell());
+ dialog.setMessage(DLTKLaunchMessages.WorkingDirectoryBlock_7);
+ String currentWorkingDir = getWorkingDirectoryText();
+ if (!currentWorkingDir.trim().equals("")) { //$NON-NLS-1$
+ File path = new File(currentWorkingDir);
+ if (path.exists()) {
+ dialog.setFilterPath(currentWorkingDir);
+ }//end if
+ }//end if
+ String selectedDirectory = dialog.open();
+ if (selectedDirectory != null) {
+ fOtherWorkingText.setText(selectedDirectory);
+ }//end if
+ }//end handleQWrokingDirBrowseBUttonSelected
+
+ /**
+ * Show a dialog that lets the user select a working directory from
+ * the workspace
+ */
+ private void handleWorkspaceDirBrowseButtonSelected() {
+ IContainer currentContainer= getContainer();
+ if (currentContainer == null) {
+ currentContainer = ResourcesPlugin.getWorkspace().getRoot();
+ }//end if
+ ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), currentContainer, false, DLTKLaunchMessages.WorkingDirectoryBlock_4);
+ dialog.showClosedProjects(false);
+ dialog.open();
+ Object[] results = dialog.getResult();
+ if ((results != null) && (results.length > 0) && (results[0] instanceof IPath)) {
+ IPath path = (IPath)results[0];
+ String containerName = path.makeRelative().toString();
+ setOtherWorkingDirectoryText("${workspace_loc:" + containerName + "}"); //$NON-NLS-1$ //$NON-NLS-2$
+ }//end if
+ }//end handleWorkspaceDirBrowseButtonSelected
+
+ /**
+ * Returns the selected workspace container,or <code>null</code>
+ */
+ protected IContainer getContainer() {
+ String path = getWorkingDirectoryText();
+ if (path.length() > 0) {
+ IResource res = null;
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ if (path.startsWith("${workspace_loc:")) { //$NON-NLS-1$
+ IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager();
+ try {
+ path = manager.performStringSubstitution(path, false);
+ IContainer[] containers = root.findContainersForLocation(new Path(path));
+ if (containers.length > 0) {
+ res = containers[0];
+ }//end if
+ }//end try
+ catch (CoreException e) {}
+ }//end if
+ else {
+ res = root.findMember(path);
+ }//end else
+ if (res instanceof IContainer) {
+ return (IContainer)res;
+ }//end if
+ }//end if
+ return null;
+ }//end getContainer
+
+ /**
+ * The default working dir radio button has been selected.
+ */
+ private void handleUseDefaultWorkingDirButtonSelected() {
+ fWorkspaceButton.setEnabled(false);
+ fOtherWorkingText.setEnabled(false);
+ fVariablesButton.setEnabled(false);
+ fFileSystemButton.setEnabled(false);
+ fUseOtherDirButton.setSelection(false);
+ }
+
+ /**
+ * The other working dir radio button has been selected
+ *
+ *
+ */
+ private void handleUseOtherWorkingDirButtonSelected() {
+ fOtherWorkingText.setEnabled(true);
+ fWorkspaceButton.setEnabled(true);
+ fVariablesButton.setEnabled(true);
+ fFileSystemButton.setEnabled(true);
+ updateLaunchConfigurationDialog();
+ }
+
+ /**
+ * The working dir variables button has been selected
+ */
+ private void handleWorkingDirVariablesButtonSelected() {
+ StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell());
+ dialog.open();
+ String variableText = dialog.getVariableExpression();
+ if (variableText != null) {
+ fOtherWorkingText.insert(variableText);
+ }//end if
+ }//end handleWorkingDirVariablesButtonSelected
+
+ /**
+ * Convenience method to get the workspace root.
+ */
+ protected IWorkspaceRoot getWorkspaceRoot() {
+ return ResourcesPlugin.getWorkspace().getRoot();
+ }
+
+ /**
+ * Sets the default working directory
+ */
+ protected void setDefaultWorkingDir() {
+ try {
+ ILaunchConfiguration config = getLaunchConfiguration();
+ if (config != null) {
+ String projectName = config.getAttribute(IDLTKLaunchConfigurationConstants.ATTR_PROJECT_NAME, "");
+ if (!projectName.equals("")) {
+ IDLTKProject project = DLTKCore.create(getWorkspaceRoot()).getScriptProject(projectName);
+ if (project != null) {
+ setDefaultWorkingDirectoryText("${workspace_loc:" + project.getPath().makeRelative().toOSString() + "}"); //$NON-NLS-1$//$NON-NLS-2$
+ return;
+ }
+ }
+ }
+ }
+ catch (CoreException ce) {}
+ setDefaultWorkingDirectoryText(System.getProperty("user.dir")); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#isValid(org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ public boolean isValid(ILaunchConfiguration config) {
+ setErrorMessage(null);
+ setMessage(null);
+ // if variables are present, we cannot resolve the directory
+ String workingDirPath = getWorkingDirectoryText();
+ if (workingDirPath.indexOf("${") >= 0) { //$NON-NLS-1$
+ IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager();
+ try {
+ manager.validateStringVariables(workingDirPath);
+ }//end try
+ catch (CoreException e) {
+ setErrorMessage(e.getMessage());
+ return false;
+ }//end catch
+ }//end if
+ else if (workingDirPath.length() > 0) {
+ IContainer container = getContainer();
+ if (container == null) {
+ File dir = new File(workingDirPath);
+ if (dir.isDirectory()) {
+ return true;
+ }//end if
+ setErrorMessage(DLTKLaunchMessages.WorkingDirectoryBlock_10);
+ return false;
+ }//end if
+ } else if (workingDirPath.length() == 0) {
+ setErrorMessage(DLTKLaunchMessages.WorkingDirectoryBlock_20);
+ }
+ return true;
+ }//end isValid
+
+ /**
+ * Defaults are empty.
+ *
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ public void setDefaults(ILaunchConfigurationWorkingCopy config) {
+ config.setAttribute(IDLTKLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, (String)null);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ public void initializeFrom(ILaunchConfiguration configuration) {
+ setLaunchConfiguration(configuration);
+ try {
+ String wd = configuration.getAttribute(IDLTKLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, (String)null);
+ setDefaultWorkingDir();
+ if (wd != null) {
+ setOtherWorkingDirectoryText(wd);
+ }//end else
+ }//end try
+ catch (CoreException e) {
+ setErrorMessage(DLTKLaunchMessages.ArgumentsTab_Exception_occurred_reading_configuration___15 + e.getStatus().getMessage());
+ DLTKLaunchingPlugin.log(e);
+ }//end catch
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ public void performApply(ILaunchConfigurationWorkingCopy configuration) {
+ if(fUseDefaultDirButton.getSelection()) {
+ configuration.setAttribute(IDLTKLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, (String)null);
+ }//end if
+ else {
+ configuration.setAttribute(IDLTKLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, getWorkingDirectoryText());
+ }//end else
+ }//end performApply
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
+ */
+ public String getName() {
+ return DLTKLaunchMessages.WorkingDirectoryBlock_Working_Directory_8;
+ }//end getName
+
+ /**
+ * gets the path from the text box that is selected
+ * @return the working directory the user wishes to use
+ *
+ */
+ protected String getWorkingDirectoryText() {
+ if(fUseDefaultDirButton.getSelection()) {
+ return fWorkingDirText.getText().trim();
+ }//end if
+ return fOtherWorkingText.getText().trim();
+ }//end getWorkingDirectoryPath
+
+ /**
+ * sets the default working directory text
+ * @param dir the dir to set the widget to
+ *
+ */
+ protected void setDefaultWorkingDirectoryText(String dir) {
+ if(dir != null) {
+ fWorkingDirText.setText(dir);
+ fUseDefaultDirButton.setSelection(true);
+ handleUseDefaultWorkingDirButtonSelected();
+ }//end if
+ }//setDefaultWorkingDirectoryText
+
+ /**
+ * sets the other dir text
+ * @param dir the new text
+ *
+ */
+ protected void setOtherWorkingDirectoryText(String dir) {
+ if(dir != null) {
+ fOtherWorkingText.setText(dir);
+ fUseDefaultDirButton.setSelection(false);
+ fUseOtherDirButton.setSelection(true);
+ handleUseOtherWorkingDirButtonSelected();
+ }//end if
+ }//end setOtherWorkingDirectoryText
+
+ /**
+ * Sets thescriptproject currently specified by the
+ * given launch config, if any.
+ */
+ protected void setLaunchConfiguration(ILaunchConfiguration config) {
+ fLaunchConfiguration = config;
+ }
+
+ /**
+ * Returns the currentscriptproject context
+ */
+ protected ILaunchConfiguration getLaunchConfiguration() {
+ return fLaunchConfiguration;
+ }
+
+ /**
+ * Allows this entire block to be enabled/disabled
+ * @param enabled whether to enable it or not
+ */
+ protected void setEnabled(boolean enabled) {
+ fUseDefaultDirButton.setEnabled(enabled);
+ fUseOtherDirButton.setEnabled(enabled);
+ if(fOtherWorkingText.isEnabled()) {
+ fOtherWorkingText.setEnabled(enabled);
+ fWorkspaceButton.setEnabled(enabled);
+ fVariablesButton.setEnabled(enabled);
+ fFileSystemButton.setEnabled(enabled);
+ }//end if
+ // in the case where the 'other' text is selected and we want to enable
+ if(fUseOtherDirButton.getSelection() && enabled == true) {
+ fOtherWorkingText.setEnabled(enabled);
+ }//end if
+ }//end setEnabled
+
+}//end class
+