-
-
- dark-row
-
-
- light-row
-
-
-
-
-
-
-
-
- ( - )
-
-
-
- -
-
-
-
- |
-
-
-
- Operating Systems: |
- |
-
-
-
- Windows Systems: |
- |
-
-
-
- Languages: |
- |
-
-
-
- Architecture: |
- |
+
+
+
+
+
+
+
+ org.jkiss.dbeaver-update
+
+
+
+ org.jkiss.dbeaver-update
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ dark-row
+
+
+ light-row
+
+
+
+
+
+
+
+
+
+
+ (
+
+ -
+
+ )
+
+
+
+
+
+ -
+
+
+
+
+
+ |
+
+
+
+
+ Operating Systems: |
+
+
+ |
+
+
+
+
+ Windows Systems: |
+
+
+ |
+
+
+
+
+ Languages: |
+
+
+ |
+
+
+
+
+ Architecture: |
+
+
+ |
+
+
+
+ |
+
+
+
+
+
+ |
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ dark-row
+
+
+ light-row
+
+
+
+
+
+
+
+
+
+
+ (
+
+ -
+
+ )
+
+
+
+
+
+ -
+
+
+
+
+
+
+ |
+
+
+
+
+ Operating Systems: |
+
+
+ |
+
+
+
+
+ Windows Systems: |
+
+
+ |
+
+
+
+
+ Languages: |
+
+
+ |
+
+
+
+
+ Architecture: |
+
+
+ |
+
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+ dark-row
+
+
+ light-row
+
+
+
+
+
+
+
+
+
+
+ (
+
+ -
+
+ )
+
+
+
+
+
+ -
+
+
+
+
+
+
+ |
+
+
+
+
+ Operating Systems: |
+
+
+ |
+
+
+
+
+ Windows Systems: |
+
+
+ |
+
+
+
+
+ Languages: |
+
+
+ |
+
+
+
+
+ Architecture: |
+
+
+ |
+
+
+
+ |
+
+
+
+
-
-
-
-
|
|
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
- dark-row
-
-
- light-row
-
-
-
-
-
-
-
-
- ( - )
-
-
-
- -
-
-
-
- |
-
-
-
- Operating Systems: |
- |
-
-
-
- Windows Systems: |
- |
-
-
-
- Languages: |
- |
-
-
-
- Architecture: |
- |
-
-
-
- |
-
-
-
-
-
-
-
-
-
-
- dark-row
-
-
- light-row
-
-
-
-
-
-
-
-
- ( - )
-
-
-
- -
-
-
-
- |
-
-
-
- Operating Systems: |
- |
-
-
-
- Windows Systems: |
- |
-
-
-
- Languages: |
- |
-
-
-
- Architecture: |
- |
-
-
-
- |
-
-
-
-
-
-
-
-
-
+
diff --git a/plugins/dependencies/.gitignore b/plugins/dependencies/.gitignore
new file mode 100644
index 0000000..ae3c172
--- /dev/null
+++ b/plugins/dependencies/.gitignore
@@ -0,0 +1 @@
+/bin/
diff --git a/plugins/org.orbisgis.core/.gitignore b/plugins/org.orbisgis.core/.gitignore
new file mode 100644
index 0000000..ae3c172
--- /dev/null
+++ b/plugins/org.orbisgis.core/.gitignore
@@ -0,0 +1 @@
+/bin/
diff --git a/plugins/org.orbisgis.groovyeditor/.gitignore b/plugins/org.orbisgis.groovyeditor/.gitignore
new file mode 100644
index 0000000..ae3c172
--- /dev/null
+++ b/plugins/org.orbisgis.groovyeditor/.gitignore
@@ -0,0 +1 @@
+/bin/
diff --git a/plugins/org.orbisgis.groovyeditor/bin/META-INF/MANIFEST.MF b/plugins/org.orbisgis.groovyeditor/bin/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..001c6d7
--- /dev/null
+++ b/plugins/org.orbisgis.groovyeditor/bin/META-INF/MANIFEST.MF
@@ -0,0 +1,23 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Groovy editor
+Bundle-SymbolicName: org.orbisgis.groovyeditor;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Vendor: OrbisGIS
+Automatic-Module-Name: org.orbisgis.groovyconsole
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.core.expressions,
+ org.eclipse.core.filesystem,
+ org.eclipse.ui,
+ org.eclipse.jface.text,
+ org.eclipse.ui.editors,
+ org.eclipse.ui.ide,
+ org.eclipse.ui.workbench.texteditor,
+ org.jkiss.dbeaver.model,
+ org.jkiss.dbeaver.ui.editors.sql,
+ org.orbisgis.core,
+ dependencies
+Bundle-ActivationPolicy: lazy
+Bundle-Activator: org.orbisgis.ui.editors.groovy.GroovyActivator
diff --git a/plugins/org.orbisgis.groovyeditor/bin/README.md b/plugins/org.orbisgis.groovyeditor/bin/README.md
new file mode 100644
index 0000000..0952780
--- /dev/null
+++ b/plugins/org.orbisgis.groovyeditor/bin/README.md
@@ -0,0 +1,60 @@
+Groovy Editor (GE) is a UI console to run Groovy script in an RCP eclipse environment.
+Groovy Editor (GE) can be used in the [DBeaver tool](https://dbeaver.io/).
+
+[DBeaver](https://dbeaver.io/) is a free and opensource multi-platform database tool to query, explore and manage data. Since the 6.2.2 version,the OrbisGIS team collaborates with the DBeaver team to integrate its own components : database, scripting console, map viewer...
+
+
+For example, DBeaver supports the [H2GIS](http://h2gis.org/)-[H2 database](https://www.h2database.com/) engine.
+
+
+To install the Groovy console
+
+1. Go to the Main menu `Help` -> `Install New Software...`
+2. In the `Work with` field, paste the following URL https://raw.githubusercontent.com/orbisgis/orbisrcp/p2-repository/ (which is an extension P2 repository URL) and press `Enter`
+3. Check the `OrbisGIS` item and check the `Groovy Editor` plugin. You can select the `H2GIS driver` too.
+4. Click `Next` -> `Finish` and Restart DBeaver.
+
+![](https://github.com/orbisgis/geoclimate/blob/master/docs/resources/images/for_users/dbeaver_install_plugins.png)
+
+
+
+
+
+------
+
+### Remarks
+
+#### Accept the license
+
+You may be asked to accept the open license ([LGPL v3](https://www.gnu.org/licenses/lgpl-3.0.en.html)) of the `Groovy Editor` and the `h2gis_driver` . If so, check on `I accept the terms of the licence agreement` and click on `Finish`.
+
+![dbeaver_accept_licence](https://github.com/orbisgis/geoclimate/blob/master/docs/resources/images/for_users/dbeaver_accept_licence.png)
+
+
+
+#### Security warning
+
+You also may have a `Security Warning` since these two "plugins" are not officially developed by the DBeaver team. So you are asked to confirm the installation by clicking on `Install anyway`.
+
+![dbeaver_install_anyway](https://github.com/orbisgis/geoclimate/blob/master/docs/resources/images/for_users/dbeaver_install_anyway.png)
+
+------
+
+
+
+Once DBeaver has restarted, select the main menu `Groovy Editor`, click on `Open editor`, then you will have a Groovy Console.
+
+![](https://github.com/orbisgis/geoclimate/blob/master/docs/resources/images/for_users/dbeaver_groovy_console_text.png)
+
+
+
+| Icon | Action |
+| :----------------------------------------------------------: | :-------------------------------: |
+| ![dbeaver_groovy_console_execute](https://github.com/orbisgis/geoclimate/blob/master/docs/resources/images/for_users/dbeaver_groovy_console_execute.png) | Execute the selected instructions |
+| ![dbeaver_groovy_console_execute_all](https://github.com/orbisgis/geoclimate/blob/master/docs/resources/images/for_users/dbeaver_groovy_console_execute_all.png) | Execute all the console |
+| ![dbeaver_groovy_console_erase](https://github.com/orbisgis/geoclimate/blob/master/docs/resources/images/for_users/dbeaver_groovy_console_erase.png) | Clear the console |
+
+
+
+
+
diff --git a/plugins/org.orbisgis.groovyeditor/bin/build.properties b/plugins/org.orbisgis.groovyeditor/bin/build.properties
new file mode 100644
index 0000000..ebd472a
--- /dev/null
+++ b/plugins/org.orbisgis.groovyeditor/bin/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+bin.includes = META-INF/,\
+ plugin.xml,\
+ icons/, \
+ .
diff --git a/plugins/org.orbisgis.groovyeditor/bin/icons/dbvis.png b/plugins/org.orbisgis.groovyeditor/bin/icons/dbvis.png
new file mode 100644
index 0000000..edf4d20
Binary files /dev/null and b/plugins/org.orbisgis.groovyeditor/bin/icons/dbvis.png differ
diff --git a/plugins/org.orbisgis.groovyeditor/bin/icons/erase.png b/plugins/org.orbisgis.groovyeditor/bin/icons/erase.png
new file mode 100644
index 0000000..d8cbd77
Binary files /dev/null and b/plugins/org.orbisgis.groovyeditor/bin/icons/erase.png differ
diff --git a/plugins/org.orbisgis.groovyeditor/bin/icons/execute.png b/plugins/org.orbisgis.groovyeditor/bin/icons/execute.png
new file mode 100644
index 0000000..b247215
Binary files /dev/null and b/plugins/org.orbisgis.groovyeditor/bin/icons/execute.png differ
diff --git a/plugins/org.orbisgis.groovyeditor/bin/icons/execute_selection.png b/plugins/org.orbisgis.groovyeditor/bin/icons/execute_selection.png
new file mode 100644
index 0000000..4d60362
Binary files /dev/null and b/plugins/org.orbisgis.groovyeditor/bin/icons/execute_selection.png differ
diff --git a/plugins/org.orbisgis.groovyeditor/bin/icons/groovy_script.png b/plugins/org.orbisgis.groovyeditor/bin/icons/groovy_script.png
new file mode 100644
index 0000000..4269675
Binary files /dev/null and b/plugins/org.orbisgis.groovyeditor/bin/icons/groovy_script.png differ
diff --git a/plugins/org.orbisgis.groovyeditor/bin/icons/stop.png b/plugins/org.orbisgis.groovyeditor/bin/icons/stop.png
new file mode 100644
index 0000000..6c58278
Binary files /dev/null and b/plugins/org.orbisgis.groovyeditor/bin/icons/stop.png differ
diff --git a/plugins/org.orbisgis.groovyeditor/bin/plugin.xml b/plugins/org.orbisgis.groovyeditor/bin/plugin.xml
new file mode 100644
index 0000000..464bb85
--- /dev/null
+++ b/plugins/org.orbisgis.groovyeditor/bin/plugin.xml
@@ -0,0 +1,188 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plugins/org.orbisgis.groovyeditor/bin/pom.xml b/plugins/org.orbisgis.groovyeditor/bin/pom.xml
new file mode 100644
index 0000000..8858bce
--- /dev/null
+++ b/plugins/org.orbisgis.groovyeditor/bin/pom.xml
@@ -0,0 +1,36 @@
+
+
+ 4.0.0
+
+
+ org.orbisgis.rcp
+ plugins
+ 1.0.0-SNAPSHOT
+ ../
+
+ org.orbisgis.groovyeditor
+ 1.0.0-SNAPSHOT
+ eclipse-plugin
+
+
+
+ org.codehaus.groovy
+ groovy
+ compile
+
+
+ org.codehaus.groovy
+ groovy-sql
+ compile
+
+
+ org.orbisgis.rcp
+ org.orbisgis.core
+ 1.0.0-SNAPSHOT
+
+
+
+
diff --git a/plugins/org.orbisgis.groovyeditor/icons/add_jar.png b/plugins/org.orbisgis.groovyeditor/icons/add_jar.png
new file mode 100644
index 0000000..2488b9c
Binary files /dev/null and b/plugins/org.orbisgis.groovyeditor/icons/add_jar.png differ
diff --git a/plugins/org.orbisgis.groovyeditor/icons/dbvis.png b/plugins/org.orbisgis.groovyeditor/icons/dbvis.png
new file mode 100644
index 0000000..edf4d20
Binary files /dev/null and b/plugins/org.orbisgis.groovyeditor/icons/dbvis.png differ
diff --git a/plugins/org.orbisgis.groovyeditor/icons/folder_add.png b/plugins/org.orbisgis.groovyeditor/icons/folder_add.png
new file mode 100644
index 0000000..f41a2f1
Binary files /dev/null and b/plugins/org.orbisgis.groovyeditor/icons/folder_add.png differ
diff --git a/plugins/org.orbisgis.groovyeditor/icons/groovy.png b/plugins/org.orbisgis.groovyeditor/icons/groovy.png
new file mode 100644
index 0000000..1f2b62e
Binary files /dev/null and b/plugins/org.orbisgis.groovyeditor/icons/groovy.png differ
diff --git a/plugins/org.orbisgis.groovyeditor/icons/groovy_output.png b/plugins/org.orbisgis.groovyeditor/icons/groovy_output.png
new file mode 100644
index 0000000..659e375
Binary files /dev/null and b/plugins/org.orbisgis.groovyeditor/icons/groovy_output.png differ
diff --git a/plugins/org.orbisgis.groovyeditor/icons/jar.png b/plugins/org.orbisgis.groovyeditor/icons/jar.png
new file mode 100644
index 0000000..d3022cd
Binary files /dev/null and b/plugins/org.orbisgis.groovyeditor/icons/jar.png differ
diff --git a/plugins/org.orbisgis.groovyeditor/icons/project.png b/plugins/org.orbisgis.groovyeditor/icons/project.png
new file mode 100644
index 0000000..5daf695
Binary files /dev/null and b/plugins/org.orbisgis.groovyeditor/icons/project.png differ
diff --git a/plugins/org.orbisgis.groovyeditor/icons/script_code.png b/plugins/org.orbisgis.groovyeditor/icons/script_code.png
new file mode 100644
index 0000000..d55e3fe
Binary files /dev/null and b/plugins/org.orbisgis.groovyeditor/icons/script_code.png differ
diff --git a/plugins/org.orbisgis.groovyeditor/icons/show_classpath.png b/plugins/org.orbisgis.groovyeditor/icons/show_classpath.png
new file mode 100644
index 0000000..322446a
Binary files /dev/null and b/plugins/org.orbisgis.groovyeditor/icons/show_classpath.png differ
diff --git a/plugins/org.orbisgis.groovyeditor/plugin.xml b/plugins/org.orbisgis.groovyeditor/plugin.xml
index 8813281..8f4f30e 100644
--- a/plugins/org.orbisgis.groovyeditor/plugin.xml
+++ b/plugins/org.orbisgis.groovyeditor/plugin.xml
@@ -15,7 +15,7 @@
-
+
@@ -54,20 +54,39 @@
description="Delete all output groovy output (console)"
id="org.orbisgis.ui.editors.groovy.clearOutput"
name="Delete output content">
+
+
+ description="Add directory to classPath"
+ id="org.orbisgis.ui.editors.groovy.addDirectoryToClasspaths"
+ name="Add directory to classPath">
+
+
+
+
+
@@ -95,15 +114,29 @@
class="org.orbisgis.ui.editors.groovy.handlers.GroovyEditorActionHandler"
commandId="org.orbisgis.ui.editors.groovy.stopProcess">
+
+
+
+
+
+
+ name="Groovy Output"
+ icon="icons/groovy_output.png"
+ >
diff --git a/plugins/org.orbisgis.groovyeditor/src/org/orbisgis/ui/editors/groovy/ClassPathHandler.java b/plugins/org.orbisgis.groovyeditor/src/org/orbisgis/ui/editors/groovy/ClassPathHandler.java
new file mode 100644
index 0000000..31ee5b3
--- /dev/null
+++ b/plugins/org.orbisgis.groovyeditor/src/org/orbisgis/ui/editors/groovy/ClassPathHandler.java
@@ -0,0 +1,103 @@
+/*
+ * Groovy Editor (GE) is a library that brings a groovy console to the Eclipse RCP.
+ * GE is developed by CNRS http://www.cnrs.fr/.
+ *
+ * GE is part of the OrbisGIS project. GE is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU Lesser
+ * General Public License as published by the Free Software Foundation;
+ * version 3.0 of the License.
+ *
+ * GE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details http://www.gnu.org/licenses.
+ *
+ *
+ *For more information, please consult: http://www.orbisgis.org
+ *or contact directly: info_at_orbisgis.org
+ *
+ */
+package org.orbisgis.ui.editors.groovy;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+import org.orbisgis.ui.editors.groovy.ui.ScrollableDialog;
+
+/**
+ * Methods to handle the urls that are taken into account as classPaths in the groovyShell runtime.
+ *
+ * @author Adrien Bessy, CNRS
+ */
+public class ClassPathHandler{
+
+ static List urls = new ArrayList();
+
+ /**
+ * Open a dialog showing the list of urls.
+ *
+ */
+ public static void showClassPaths() {
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ ScrollableDialog dialog = new ScrollableDialog(shell, "List of class paths",urls);
+ dialog.open();
+ }
+
+ /**
+ * Add a directory path, choosen by the user, to the list of urls.
+ *
+ */
+ public static void addDirPathToPathList() {
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ DirectoryDialog dialog = new DirectoryDialog(shell);
+ String result = dialog.open();
+ try {
+ urls.add(new File(result).toURI().toURL());
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Add a jar path, choosen by the user, to the list of urls.
+ *
+ */
+ public static void addJarPathToPathList() {
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ FileDialog dialog = new FileDialog( shell, SWT.SINGLE );
+ String[] filterExt = { "*.jar" };
+ dialog.setFilterExtensions(filterExt);
+ String result = dialog.open();
+ try {
+ if (result != null) {
+ urls.add(new File(result + "!/").toURI().toURL());
+ }
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Transform the ArrayList of urls to URL[] and retrieve it.
+ *
+ */
+ static URL[] getUrlsInArray() throws MalformedURLException{
+ URL[] result;
+ if (urls != null) {
+ result = urls.toArray( new URL[0] );
+ }
+ else{
+ result = new URL[0];
+ }
+ return result;
+ }
+
+}
\ No newline at end of file
diff --git a/plugins/org.orbisgis.groovyeditor/src/org/orbisgis/ui/editors/groovy/GroovyEditor.java b/plugins/org.orbisgis.groovyeditor/src/org/orbisgis/ui/editors/groovy/GroovyEditor.java
index 6a6afd5..096e213 100644
--- a/plugins/org.orbisgis.groovyeditor/src/org/orbisgis/ui/editors/groovy/GroovyEditor.java
+++ b/plugins/org.orbisgis.groovyeditor/src/org/orbisgis/ui/editors/groovy/GroovyEditor.java
@@ -93,6 +93,9 @@ private void createControlsBar(Composite editorPanel) {
ToolbarButton.create(sideToolBar, getSite(), GroovyEditorCommands.CMD_EXECUTE_SELECTION);
ToolbarButton.create(sideToolBar, getSite(), GroovyEditorCommands.CMD_EXECUTE_SCRIPT);
ToolbarButton.create(sideToolBar, getSite(), GroovyEditorCommands.CMD_CLEAR);
+ ToolbarButton.create(sideToolBar, getSite(), GroovyEditorCommands.CMD_LIST_CLASSPATHS);
+ ToolbarButton.create(sideToolBar, getSite(), GroovyEditorCommands.CMD_ADD_DIR_TO_CLASSPATH);
+ ToolbarButton.create(sideToolBar, getSite(), GroovyEditorCommands.CMD_ADD_JAR_TO_CLASSPATH);
sideToolBar.setLayoutData(new GridData(GridData.FILL_VERTICAL | GridData.VERTICAL_ALIGN_BEGINNING));
}
diff --git a/plugins/org.orbisgis.groovyeditor/src/org/orbisgis/ui/editors/groovy/GroovyEditorCommands.java b/plugins/org.orbisgis.groovyeditor/src/org/orbisgis/ui/editors/groovy/GroovyEditorCommands.java
index 7e2451a..e042a76 100644
--- a/plugins/org.orbisgis.groovyeditor/src/org/orbisgis/ui/editors/groovy/GroovyEditorCommands.java
+++ b/plugins/org.orbisgis.groovyeditor/src/org/orbisgis/ui/editors/groovy/GroovyEditorCommands.java
@@ -24,4 +24,7 @@ public interface GroovyEditorCommands {
String CMD_CLEAR= "org.orbisgis.ui.editors.groovy.clear";
String CMD_GROOVY_DELETE_OUTPUT= "org.orbisgis.ui.editors.groovy.clearOutput";
String CMD_STOP_PROCESS= "org.orbisgis.ui.editors.groovy.stopProcess";
+ String CMD_LIST_CLASSPATHS= "org.orbisgis.ui.editors.groovy.listClasspaths";
+ String CMD_ADD_DIR_TO_CLASSPATH= "org.orbisgis.ui.editors.groovy.addDirectoryToClasspaths";
+ String CMD_ADD_JAR_TO_CLASSPATH= "org.orbisgis.ui.editors.groovy.addJarToClasspath";
}
diff --git a/plugins/org.orbisgis.groovyeditor/src/org/orbisgis/ui/editors/groovy/GroovyJob.java b/plugins/org.orbisgis.groovyeditor/src/org/orbisgis/ui/editors/groovy/GroovyJob.java
index cdf357a..141fd8d 100644
--- a/plugins/org.orbisgis.groovyeditor/src/org/orbisgis/ui/editors/groovy/GroovyJob.java
+++ b/plugins/org.orbisgis.groovyeditor/src/org/orbisgis/ui/editors/groovy/GroovyJob.java
@@ -18,7 +18,12 @@
*/
package org.orbisgis.ui.editors.groovy;
-import java.io.*;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.URLClassLoader;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
@@ -63,9 +68,10 @@ public GroovyJob(String name, String script) {
File outputFile = new File(System.getProperty("java.io.tmpdir") + File.separator + name + "_output.txt");
closeOutputPrintWriter();
createOutputPrintWriter(outputFile);
-
+
try {
- shell = new GroovyShell(Thread.currentThread().getContextClassLoader(), binding, configuratorConfig);
+ URLClassLoader classLoader = new URLClassLoader( ClassPathHandler.getUrlsInArray(), Thread.currentThread().getContextClassLoader() );
+ shell = new GroovyShell(classLoader, binding, configuratorConfig);
} catch (Exception e) {
LOGGER.warn("Unable to create GroovyShell instead.");
}
@@ -184,5 +190,9 @@ public int getStatus(){
return status;
}
}
+
+ public void setShell(GroovyShell shell) {
+ this.shell = shell;
+ }
}
diff --git a/plugins/org.orbisgis.groovyeditor/src/org/orbisgis/ui/editors/groovy/handlers/GroovyEditorActionHandler.java b/plugins/org.orbisgis.groovyeditor/src/org/orbisgis/ui/editors/groovy/handlers/GroovyEditorActionHandler.java
index 7fb92b6..4295a25 100644
--- a/plugins/org.orbisgis.groovyeditor/src/org/orbisgis/ui/editors/groovy/handlers/GroovyEditorActionHandler.java
+++ b/plugins/org.orbisgis.groovyeditor/src/org/orbisgis/ui/editors/groovy/handlers/GroovyEditorActionHandler.java
@@ -33,9 +33,10 @@
import org.jkiss.dbeaver.ui.navigator.database.DatabaseNavigatorView;
import org.jkiss.dbeaver.utils.RuntimeUtils;
import org.orbisgis.core.logger.Logger;
-import org.orbisgis.ui.editors.groovy.GroovyOutputConsole.GroovyConsoleContent;
+import org.orbisgis.ui.editors.groovy.ClassPathHandler;
import org.orbisgis.ui.editors.groovy.GroovyEditor;
import org.orbisgis.ui.editors.groovy.GroovyEditorCommands;
+import org.orbisgis.ui.editors.groovy.GroovyOutputConsole.GroovyConsoleContent;
public class GroovyEditorActionHandler extends AbstractHandler {
@@ -65,6 +66,15 @@ public Object execute(ExecutionEvent executionEvent) {
case GroovyEditorCommands.CMD_STOP_PROCESS:
editor.stop();
break;
+ case GroovyEditorCommands.CMD_LIST_CLASSPATHS:
+ ClassPathHandler.showClassPaths();
+ break;
+ case GroovyEditorCommands.CMD_ADD_DIR_TO_CLASSPATH:
+ ClassPathHandler.addDirPathToPathList();
+ break;
+ case GroovyEditorCommands.CMD_ADD_JAR_TO_CLASSPATH:
+ ClassPathHandler.addJarPathToPathList();
+ break;
default:
LOGGER.error("Unsupported SQL editor command: " + actionId);
break;
diff --git a/plugins/org.orbisgis.groovyeditor/src/org/orbisgis/ui/editors/groovy/syntax/GroovySourceViewerConfiguration.java b/plugins/org.orbisgis.groovyeditor/src/org/orbisgis/ui/editors/groovy/syntax/GroovySourceViewerConfiguration.java
index a0df48b..e615692 100644
--- a/plugins/org.orbisgis.groovyeditor/src/org/orbisgis/ui/editors/groovy/syntax/GroovySourceViewerConfiguration.java
+++ b/plugins/org.orbisgis.groovyeditor/src/org/orbisgis/ui/editors/groovy/syntax/GroovySourceViewerConfiguration.java
@@ -18,19 +18,28 @@
*/
package org.orbisgis.ui.editors.groovy.syntax;
+import java.util.Arrays;
+import java.util.List;
+
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.TextAttribute;
import org.eclipse.jface.text.presentation.IPresentationReconciler;
import org.eclipse.jface.text.presentation.PresentationReconciler;
-import org.eclipse.jface.text.rules.*;
+import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
+import org.eclipse.jface.text.rules.ICharacterScanner;
+import org.eclipse.jface.text.rules.IRule;
+import org.eclipse.jface.text.rules.IToken;
+import org.eclipse.jface.text.rules.ITokenScanner;
+import org.eclipse.jface.text.rules.MultiLineRule;
+import org.eclipse.jface.text.rules.NumberRule;
+import org.eclipse.jface.text.rules.RuleBasedScanner;
+import org.eclipse.jface.text.rules.SingleLineRule;
+import org.eclipse.jface.text.rules.Token;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.text.source.SourceViewerConfiguration;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Display;
-import java.util.Arrays;
-import java.util.List;
-
public class GroovySourceViewerConfiguration extends SourceViewerConfiguration {
public ITokenScanner tokenScanner;
diff --git a/plugins/org.orbisgis.groovyeditor/src/org/orbisgis/ui/editors/groovy/ui/ScrollableDialog.java b/plugins/org.orbisgis.groovyeditor/src/org/orbisgis/ui/editors/groovy/ui/ScrollableDialog.java
new file mode 100644
index 0000000..f7d4ed8
--- /dev/null
+++ b/plugins/org.orbisgis.groovyeditor/src/org/orbisgis/ui/editors/groovy/ui/ScrollableDialog.java
@@ -0,0 +1,117 @@
+/*
+ * Groovy Editor (GE) is a library that brings a groovy console to the Eclipse RCP.
+ * GE is developed by CNRS http://www.cnrs.fr/.
+ *
+ * GE is part of the OrbisGIS project. GE is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU Lesser
+ * General Public License as published by the Free Software Foundation;
+ * version 3.0 of the License.
+ *
+ * GE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details http://www.gnu.org/licenses.
+ *
+ *
+ *For more information, please consult: http://www.orbisgis.org
+ *or contact directly: info_at_orbisgis.org
+ *
+ */
+package org.orbisgis.ui.editors.groovy.ui;
+
+import java.net.URL;
+import java.util.List;
+
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.swt.SWT;
+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;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+
+/**
+ * Methods to create and handle a dialog showing a table of urls.
+ *
+ * @author Adrien Bessy, CNRS
+ */
+public class ScrollableDialog extends TitleAreaDialog {
+ private String title;
+ private List urls;
+
+ public ScrollableDialog(Shell parentShell, String title, List urls) {
+ super(parentShell);
+ this.title = title;
+ this.urls = urls;
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite composite = (Composite) super.createDialogArea (parent); // Let the dialog create the parent composite
+
+ GridData gridData = new GridData();
+ gridData.grabExcessHorizontalSpace = true;
+ gridData.horizontalAlignment = GridData.FILL;
+ gridData.grabExcessVerticalSpace = true; // Layout vertically, too!
+ gridData.verticalAlignment = GridData.FILL;
+
+ Table table = new Table(composite, SWT.BORDER | SWT.V_SCROLL);
+ table.setHeaderVisible(true);
+ String[] titles = { "Name", "Path" };
+
+ for (int loopIndex = 0; loopIndex < titles.length; loopIndex++) {
+ TableColumn column = new TableColumn(table, SWT.NULL);
+ column.setText(titles[loopIndex]);
+ }
+
+ for (int i = 0; i < urls.size(); i++) {
+ URL url = urls.get(i);
+ String path = url.getPath();
+ TableItem item = new TableItem(table, SWT.NULL);
+ if (path.toString() != "") {
+ String[] parts = path.toString().split("/");
+ int length = parts.length;
+ item.setText(0, parts[length-1].replace("!", ""));
+ item.setText(1, path.toString());
+ }
+ }
+
+ for (int loopIndex = 0; loopIndex < titles.length; loopIndex++) {
+ table.getColumn(loopIndex).pack();
+ }
+
+ table.setLayoutData(gridData);
+
+ return composite;
+ }
+
+ @Override
+ public void create() {
+ super.create();
+ // This is not necessary; the dialog will become bigger as the text grows but at the same time,
+ // the user will be able to see all (or at least more) of the error message at once
+ //getShell ().setSize (300, 300);
+ setTitle(title);
+ }
+
+ @Override
+ protected void createButtonsForButtonBar(Composite parent) {
+ Button okButton = createButton(parent, OK, "OK", true);
+ okButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ close();
+ }
+ });
+ }
+
+ @Override
+ protected boolean isResizable() {
+ return true; // Allow the user to change the dialog size!
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.orbisgis.h2gis/.gitignore b/plugins/org.orbisgis.h2gis/.gitignore
new file mode 100644
index 0000000..ae3c172
--- /dev/null
+++ b/plugins/org.orbisgis.h2gis/.gitignore
@@ -0,0 +1 @@
+/bin/
diff --git a/plugins/org.orbisgis.h2gis/bin/META-INF/MANIFEST.MF b/plugins/org.orbisgis.h2gis/bin/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..54bf3d8
--- /dev/null
+++ b/plugins/org.orbisgis.h2gis/bin/META-INF/MANIFEST.MF
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.orbisgis.h2gis;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Release-Date: 20200302
+Require-Bundle: org.jkiss.dbeaver.model,org.jkiss.dbeaver.data.gis,org
+ .jkiss.dbeaver.ext.generic,org.jkiss.dbeaver.ext.h2
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Bundle-Vendor: %Bundle-Vendor
+Bundle-ClassPath: .
+Bundle-Localization: OSGI-INF/l10n/bundle
+Automatic-Module-Name: org.jkiss.dbeaver.ext.h2gis
diff --git a/plugins/org.orbisgis.h2gis/bin/OSGI-INF/l10n/bundle.properties b/plugins/org.orbisgis.h2gis/bin/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 0000000..794d37f
--- /dev/null
+++ b/plugins/org.orbisgis.h2gis/bin/OSGI-INF/l10n/bundle.properties
@@ -0,0 +1,5 @@
+#Properties file for org.jkiss.dbeaver.ext.h2gis
+Bundle-Vendor = JKISS
+Bundle-Name = DBeaver H2GIS Support
+
+datasource.h2gis.description=H2GIS datasource
diff --git a/plugins/org.orbisgis.h2gis/bin/README.md b/plugins/org.orbisgis.h2gis/bin/README.md
new file mode 100644
index 0000000..6c4d839
--- /dev/null
+++ b/plugins/org.orbisgis.h2gis/bin/README.md
@@ -0,0 +1,10 @@
+Plugin to install the current development version of H2GIS.
+
+To install the last H2GIS snaptshot version :
+
+1. Go to the Main menu `Help` -> `Install New Software...`
+2. In the `Work with` field, paste the following URL https://raw.githubusercontent.com/orbisgis/orbisrcp/p2-repository/ (which is an extension P2 repository URL) and press `Enter`
+3. Check the `OrbisGIS` item and the plugin `H2GIS driver`
+4. Click `Next` -> `Finish` and Restart DBeaver.
+
+![](https://github.com/orbisgis/geoclimate/blob/master/docs/resources/images/for_users/dbeaver_install_plugins.png)
diff --git a/plugins/org.orbisgis.h2gis/bin/build.properties b/plugins/org.orbisgis.h2gis/bin/build.properties
new file mode 100644
index 0000000..13a8aa7
--- /dev/null
+++ b/plugins/org.orbisgis.h2gis/bin/build.properties
@@ -0,0 +1,7 @@
+source.. = src/
+output.. = target/classes/
+bin.includes = .,\
+ META-INF/,\
+ OSGI-INF/,\
+ icons/,\
+ plugin.xml
diff --git a/plugins/org.orbisgis.h2gis/bin/icons/h2gis_icon.png b/plugins/org.orbisgis.h2gis/bin/icons/h2gis_icon.png
new file mode 100644
index 0000000..3b2d8fd
Binary files /dev/null and b/plugins/org.orbisgis.h2gis/bin/icons/h2gis_icon.png differ
diff --git a/plugins/org.orbisgis.h2gis/bin/icons/h2gis_icon.svg b/plugins/org.orbisgis.h2gis/bin/icons/h2gis_icon.svg
new file mode 100644
index 0000000..c640dab
--- /dev/null
+++ b/plugins/org.orbisgis.h2gis/bin/icons/h2gis_icon.svg
@@ -0,0 +1,260 @@
+
+
+
+
diff --git a/plugins/org.orbisgis.h2gis/bin/icons/h2gis_icon_@2x.png b/plugins/org.orbisgis.h2gis/bin/icons/h2gis_icon_@2x.png
new file mode 100644
index 0000000..1102bfd
Binary files /dev/null and b/plugins/org.orbisgis.h2gis/bin/icons/h2gis_icon_@2x.png differ
diff --git a/plugins/org.orbisgis.h2gis/bin/icons/h2gis_icon_big.png b/plugins/org.orbisgis.h2gis/bin/icons/h2gis_icon_big.png
new file mode 100644
index 0000000..b08d5d5
Binary files /dev/null and b/plugins/org.orbisgis.h2gis/bin/icons/h2gis_icon_big.png differ
diff --git a/plugins/org.orbisgis.h2gis/bin/icons/h2gis_icon_big_@2x.png b/plugins/org.orbisgis.h2gis/bin/icons/h2gis_icon_big_@2x.png
new file mode 100644
index 0000000..6ef258c
Binary files /dev/null and b/plugins/org.orbisgis.h2gis/bin/icons/h2gis_icon_big_@2x.png differ
diff --git a/plugins/org.orbisgis.h2gis/bin/plugin.xml b/plugins/org.orbisgis.h2gis/bin/plugin.xml
new file mode 100644
index 0000000..ac280a4
--- /dev/null
+++ b/plugins/org.orbisgis.h2gis/bin/plugin.xml
@@ -0,0 +1,112 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plugins/org.orbisgis.h2gis/bin/pom.xml b/plugins/org.orbisgis.h2gis/bin/pom.xml
new file mode 100644
index 0000000..da35589
--- /dev/null
+++ b/plugins/org.orbisgis.h2gis/bin/pom.xml
@@ -0,0 +1,13 @@
+
+ 4.0.0
+
+ org.orbisgis.rcp
+ plugins
+ 1.0.0-SNAPSHOT
+ ../
+
+ org.orbisgis.h2gis
+ 1.0.0-SNAPSHOT
+ eclipse-plugin
+
+
\ No newline at end of file
|