Revision: 5275
http://sourceforge.net/p/jump-pilot/code/5275
Author: edso
Date: 2016-12-27 16:19:02 +0000 (Tue, 27 Dec 2016)
Log Message:
-----------
reworked sextante initialization so that it always uses the folder where
sextante_gui.jar is located as base folder
some reformatting/cleaning
Modified Paths:
--------------
plug-ins/SextantePlugIn/src/es/unex/sextante/openjump/extensions/SextanteExtension.java
plug-ins/SextantePlugIn/src/es/unex/sextante/openjump/extensions/SextanteToolboxPlugin.java
Added Paths:
-----------
plug-ins/SextantePlugIn/lib/
plug-ins/SextantePlugIn/workbench-properties.xml
Removed Paths:
-------------
plug-ins/SextantePlugIn/openjump-lib/
plug-ins/SextantePlugIn/sextante-lib/
plug-ins/SextantePlugIn/src/es/unex/sextante/openjump/init/
Modified:
plug-ins/SextantePlugIn/src/es/unex/sextante/openjump/extensions/SextanteExtension.java
===================================================================
---
plug-ins/SextantePlugIn/src/es/unex/sextante/openjump/extensions/SextanteExtension.java
2016-12-27 16:16:00 UTC (rev 5274)
+++
plug-ins/SextantePlugIn/src/es/unex/sextante/openjump/extensions/SextanteExtension.java
2016-12-27 16:19:02 UTC (rev 5275)
@@ -1,65 +1,111 @@
package es.unex.sextante.openjump.extensions;
-import com.vividsolutions.jump.workbench.WorkbenchContext;
+import java.io.File;
+import java.net.URL;
+
+import com.vividsolutions.jump.workbench.Logger;
import com.vividsolutions.jump.workbench.plugin.Extension;
import com.vividsolutions.jump.workbench.plugin.PlugInContext;
import com.vividsolutions.jump.workbench.ui.plugin.FeatureInstaller;
+import es.unex.sextante.core.Sextante;
+import es.unex.sextante.gui.core.SextanteGUI;
+import es.unex.sextante.openjump.core.OpenJUMPOutputFactory;
+import es.unex.sextante.openjump.gui.OpenJUMPGUIFactory;
+import es.unex.sextante.openjump.gui.OpenJUMPInputFactory;
+import es.unex.sextante.openjump.gui.OpenJUMPPostProcessTaskFactory;
+
public class SextanteExtension extends Extension {
- /*
- * Version History
- *
- * @ Sextante 1.0 2013-04-01 Sextante 1.0 Internationalized 2013-05-25 (Add
- * Language codes from Kosmo Sextante (ca,es,fi,hr,it), add French)
- *
- * @ Sextante 1.0.1 2016-08-10 Correct bug #480. Added Sextante Data
- * Explorer
- *
- * @ Sextante 1.0.2 2016-10-31 Added Pick coordinates plugin. Better
- * integration between OpenJUMP and Sextante data model Upgraded
- * documentation with a new help dialog style Fix bugs #410 and #427
- *
- * @ Sextante 1.0.2b 2016-10-31 Help dialog now shows all documentation
- * related to algorithm. Convert Help Dialog to Detached windows
- *
- * @ Sextante 1.0 OpenJUMP binding 2016-11-28 Help framework now works also
- * on other plugins and algorithms. Solved bug related on Advanced option
- * panel. Added new icons to Results, Pick coordinates and Layer explorer.
- * Changed number version as Sextante embedded into GvSIGCE is 1.0.0 and it
- * is newer than OpenJUMP one (2009?)
- */
+ /*
+ * Version History
+ *
+ * @ Sextante 1.0 2013-04-01 Sextante 1.0 Internationalized 2013-05-25 (Add
+ * Language codes from Kosmo Sextante (ca,es,fi,hr,it), add French)
+ *
+ * @ Sextante 1.0.1 2016-08-10 Correct bug #480. Added Sextante Data Explorer
+ *
+ * @ Sextante 1.0.2 2016-10-31 Added Pick coordinates plugin. Better
+ * integration between OpenJUMP and Sextante data model Upgraded
documentation
+ * with a new help dialog style Fix bugs #410 and #427
+ *
+ * @ Sextante 1.0.2b 2016-10-31 Help dialog now shows all documentation
+ * related to algorithm. Convert Help Dialog to Detached windows
+ *
+ * @ Sextante 1.0 OpenJUMP binding 2016-11-28 Help framework now works also
on
+ * other plugins and algorithms. Solved bug related on Advanced option panel.
+ * Added new icons to Results, Pick coordinates and Layer explorer. Changed
+ * number version as Sextante embedded into GvSIGCE is 1.0.0 and it is newer
+ * than OpenJUMP one (2009?)
+ */
- private static final String NAME = "Sextante 1.0";
- private static final String VERSION = "OpenJUMP binding 2016-12-06";
+ private static final String NAME = "Sextante 1.0";
+ private static final String VERSION = "OpenJUMP binding 2016-12-27";
- public String getName() {
- return NAME;
+ public String getName() {
+ return NAME;
+ }
+
+ public String getVersion() {
+ return VERSION;
+ }
+
+ public void configure(PlugInContext context) throws Exception {
+
+ Logger.debug(">> starting Sextante initialization");
+
+ URL sextGUIJarUrl = SextanteGUI.class.getProtectionDomain().getCodeSource()
+ .getLocation();
+ Logger.debug("SextanteGUI claims to be in " + sextGUIJarUrl);
+ File sextDir = null;
+ if (sextGUIJarUrl == null) {
+ Logger.error("Location of SextanteGUI is null.");
+ return;
}
- public String getVersion() {
- return VERSION;
+ File sextGUIJarFile = new File(sextGUIJarUrl.getFile());
+ if (!sextGUIJarFile.isFile()) {
+ Logger.error(sextGUIJarFile + " is not a file!");
+ return;
}
- public void configure(PlugInContext context) throws Exception {
- WorkbenchContext workbenchContext = context.getWorkbenchContext();
- FeatureInstaller featureInstaller = new FeatureInstaller(
- workbenchContext);
+ sextDir = sextGUIJarFile.getParentFile();
+ if (!sextDir.isDirectory()) {
+ Logger.error("Sextante folder " + sextDir + " is not a folder!");
+ return;
+ }
- new SextanteToolboxPlugin().initialize(context);
- new SextanteModelerPlugin().initialize(context);
- new SextanteHistoryPlugin().initialize(context);
- new SextanteCommandLinePlugin().initialize(context);
- new SextanteResultsPlugin().initialize(context);
- new SextanteDataExplorerPlugin().initialize(context);
- new SextantePickCoordinatesPlugIn().initialize(context);
- featureInstaller.addMenuSeparator(new String[] { "Sextante" });
- new SextanteSettingsPlugin().initialize(context);
+ Logger.debug("found sextante folder " + sextDir);
+ String sextDirString = sextDir.toString();
+ // String sextHelpDirString = new File(sextDir, "help").toString();
- featureInstaller.addMenuSeparator(new String[] { "Sextante" });
+ Sextante.initialize(sextDirString);
+ SextanteGUI.setSextantePath(sextDirString);
+ SextanteGUI.initialize(sextDirString);
- new SextanteHelpPlugIn().initialize(context);
+ SextanteGUI.setGUIFactory(new OpenJUMPGUIFactory());
+ SextanteGUI.setMainFrame(context.getWorkbenchFrame());
- }
+ SextanteGUI.setInputFactory(new OpenJUMPInputFactory(context
+ .getWorkbenchContext()));
+ SextanteGUI.setOutputFactory(new OpenJUMPOutputFactory(context
+ .getWorkbenchContext()));
+ SextanteGUI.setPostProcessTaskFactory(new
OpenJUMPPostProcessTaskFactory());
+ FeatureInstaller featureInstaller = FeatureInstaller.getInstance();
+ new SextanteToolboxPlugin().initialize(context);
+ new SextanteModelerPlugin().initialize(context);
+ new SextanteHistoryPlugin().initialize(context);
+ new SextanteCommandLinePlugin().initialize(context);
+ new SextanteResultsPlugin().initialize(context);
+ new SextanteDataExplorerPlugin().initialize(context);
+ new SextantePickCoordinatesPlugIn().initialize(context);
+ featureInstaller.addMenuSeparator(new String[] { "Sextante" });
+ new SextanteSettingsPlugin().initialize(context);
+ featureInstaller.addMenuSeparator(new String[] { "Sextante" });
+ new SextanteHelpPlugIn().initialize(context);
+
+ Logger.debug("<< Successfully finished Sextante initialization.");
+ }
+
}
Modified:
plug-ins/SextantePlugIn/src/es/unex/sextante/openjump/extensions/SextanteToolboxPlugin.java
===================================================================
---
plug-ins/SextantePlugIn/src/es/unex/sextante/openjump/extensions/SextanteToolboxPlugin.java
2016-12-27 16:16:00 UTC (rev 5274)
+++
plug-ins/SextantePlugIn/src/es/unex/sextante/openjump/extensions/SextanteToolboxPlugin.java
2016-12-27 16:19:02 UTC (rev 5275)
@@ -1,217 +1,42 @@
package es.unex.sextante.openjump.extensions;
-import java.io.File;
-
import javax.swing.ImageIcon;
-import javax.swing.JFrame;
-import org.apache.log4j.Logger;
-
import com.vividsolutions.jump.workbench.plugin.PlugIn;
import com.vividsolutions.jump.workbench.plugin.PlugInContext;
-import es.unex.sextante.core.Sextante;
import es.unex.sextante.gui.core.SextanteGUI;
-import es.unex.sextante.gui.toolbox.ToolboxPanel;
-import es.unex.sextante.openjump.core.OpenJUMPOutputFactory;
-import es.unex.sextante.openjump.gui.OpenJUMPGUIFactory;
-import es.unex.sextante.openjump.gui.OpenJUMPInputFactory;
-import es.unex.sextante.openjump.gui.OpenJUMPPostProcessTaskFactory;
-import es.unex.sextante.openjump.init.OJSextanteApiInitialiser;
import es.unex.sextante.openjump.language.I18NPlug;
public class SextanteToolboxPlugin implements PlugIn {
- public boolean execute(final PlugInContext context) throws Exception {
+ public boolean execute(final PlugInContext context) throws Exception {
- SextanteGUI.getGUIFactory().showToolBoxDialog();
+ SextanteGUI.getGUIFactory().showToolBoxDialog();
- return true;
+ return true;
- }
+ }
- protected static ToolboxPanel m_Toolbox;
+ public String getName() {
- public String getName() {// Giuseppe Aruta - PlugIn Internationalized
- // 2013_05_25//
+ return I18NPlug
+
.getI18N("es.unex.sextante.kosmo.extensions.SextanteToolboxPlugin.Sextante-toolbox");
- return I18NPlug
-
.getI18N("es.unex.sextante.kosmo.extensions.SextanteToolboxPlugin.Sextante-toolbox");
+ }
- }
+ public void initialize(final PlugInContext context) throws Exception {
- public void initialize(final PlugInContext context) throws Exception {
+ context.getFeatureInstaller().addMainMenuPlugin(this,
+ new String[] { "Sextante" }, getName(), false, getIcon(), null);
- // System.out.println("starting Sextante initialization >>");
- LOGGER.debug("starting Sextante initialization >>");
- String jarspath = getJarsFolder();
- try {
+ }
- // [Giuseppe Aruta 6/12/2016] - Begin of First modification
+ public ImageIcon getIcon() {
- // --- comment out lines
- // Sextante.initialize(jarspath);
- // Sextante.initialize();
- // SextanteGUI.setSextantePath(getHelpPath());
- // SextanteGUI.initialize();
- // --- end of comment out lines
+ return new ImageIcon(SextanteGUI.class.getClassLoader().getResource(
+ "images/module2.png"));
- // ---- New lines-----
- Sextante.initialize(jarspath);
- SextanteGUI.setSextantePath(jarspath);
- SextanteGUI.initialize(jarspath);
- // ---- End of new lines-----
+ }
- // [Giuseppe Aruta 6/12/2016] - End of first modification
-
- SextanteGUI.setGUIFactory(new OpenJUMPGUIFactory());
- JFrame frame = context.getWorkbenchFrame();
- SextanteGUI.setMainFrame(frame);
-
- SextanteGUI.setInputFactory(new OpenJUMPInputFactory(context
- .getWorkbenchContext()));
- SextanteGUI.setOutputFactory(new OpenJUMPOutputFactory(context
- .getWorkbenchContext()));
- SextanteGUI
- .setPostProcessTaskFactory(new
OpenJUMPPostProcessTaskFactory());
-
- OJSextanteApiInitialiser.isInitialized = true;
-
- context.getFeatureInstaller().addMainMenuPlugin(this,
- new String[] { "Sextante" }, getName(), false, getIcon(),
- null);
-
- } catch (Exception e) {// this is most likely thrown while Debugging
- // with the eclipse IDE.
- // System.out.println("Sextante not initialized!");
- // System.out
- // .println("Check for problems with Sextante initialization, path
for libs and resources: "
- // + jarspath);
- // System.out.println("Check if image 'terminal.png' exist");
- // System.out.println("Check also for Sextante help classes path: "
- // + getHelpPath());
- // System.out.println("=> Will do 2nd try with OJ-IDE-Dev
settings: ");
- LOGGER.debug("Error: " + e);
- LOGGER.debug("Sextante not initialized!");
- LOGGER.debug("Check for problems with Sextante initialization,
path for libs and resources: "
- + jarspath);
- LOGGER.debug("Check if image 'terminal.png' exist");
- LOGGER.debug("Check also for Sextante help classes path: "
- + getHelpPath());
- LOGGER.debug("=> Will do 2nd try with OJ-IDE-Dev settings: ");
- // == do a second trial ==
-
- String idePathSextante = System.getProperty("user.dir")
- + "/lib/plus/sextante";
-
- // [Giuseppe Aruta 6/12/2016] - Second modification
-
- // --- comment out lines
- // String idePathSHelp = System.getProperty("user.dir")
- // + "/lib/plus/sextante_help";
- // --- end of comment out lines
-
- // ---- new lines-----
- String idePathSHelp = System.getProperty("user.dir")
- + "/lib/plus/sextante/help";
- // --- end of new lines-----
-
- // [Giuseppe Aruta 6/12/2016] - End of Second modification
-
- SextanteGUI.setSextantePath(idePathSHelp);
- System.out.println("=> looking for algorithms and image in: "
- + idePathSextante);
- try {
-
- // [Giuseppe Aruta 6/12/2016] - Third modification
-
- // --- comment out lines
- // Sextante.initialize(idePathSextante);
- // Sextante.initialize();
- // SextanteGUI.setSextantePath(idePathSHelp);
- // --- end of comment out lines
-
- // --- new lines-----
- Sextante.initialize(idePathSextante);
- SextanteGUI.setSextantePath(idePathSextante);
- SextanteGUI.initialize(idePathSextante);
- // --- end of new lines-----
-
- // [Giuseppe Aruta 6/12/2016] - End of third modification
-
- SextanteGUI.setGUIFactory(new OpenJUMPGUIFactory());
- SextanteGUI.setMainFrame(context.getWorkbenchFrame());
- SextanteGUI.setInputFactory(new OpenJUMPInputFactory(context
- .getWorkbenchContext()));
- SextanteGUI.setOutputFactory(new OpenJUMPOutputFactory(context
- .getWorkbenchContext()));
- SextanteGUI
- .setPostProcessTaskFactory(new
OpenJUMPPostProcessTaskFactory());
-
- OJSextanteApiInitialiser.isInitialized = true;
-
- // System.out
- // .println("Success initializing Sextante at 2nd trial!");
- LOGGER.debug("Success initializing Sextante at 2nd trial!");
- context.getFeatureInstaller().addMainMenuPlugin(this,
- new String[] { "Sextante" }, getName(), false,
- getIcon(), null);
- } catch (Exception e1) {// this is most likely thrown while
- // Debugging with the eclipse IDE.
-
- // System.out
- // .println("No success with Sextante initialization -
printing error log:");
- LOGGER.debug(
- "No success with Sextante initialization - printing
error log:",
- e1);
- e1.printStackTrace();
- }
- }
- }
-
- private String getJarsFolder() {
-
- // [Giuseppe Aruta 6/12/2016] - fourth modification
-
- // --- comment out lines
- // final String sPath = System.getProperty("user.dir")
- // + "/lib/ext/sextante";
- // --- end of comment out lines
-
- // --- new lines-----
- final String sPath = System.getProperty("user.dir")
- .concat(File.separator).concat("lib").concat(File.separator)
- .concat("ext").concat(File.separator).concat("sextante");
- // --- end of new lines-----
-
- // [Giuseppe Aruta 6/12/2016] - End of third modification
-
- return sPath;
-
- }
-
- private static final Logger LOGGER = Logger
- .getLogger(SextanteToolboxPlugin.class);
-
- private String getHelpPath() {
- String str = System.getProperty("user.dir") + "/lib/ext/sextante_help";
-
- System.out.println("Sextante help path folder: " + str);
- return str;
- }
-
- // [Giuseppe Aruta 6/12/2016] this method is not used
- private String getSextantePath() {
- String str = System.getProperty("user.dir") + File.separator
- + "sextante";
- return str;
- }
-
- public ImageIcon getIcon() {
-
- return new ImageIcon(SextanteGUI.class.getClassLoader().getResource(
- "images/module2.png"));
-
- }
-
}
Added: plug-ins/SextantePlugIn/workbench-properties.xml
===================================================================
--- plug-ins/SextantePlugIn/workbench-properties.xml
(rev 0)
+++ plug-ins/SextantePlugIn/workbench-properties.xml 2016-12-27 16:19:02 UTC
(rev 5275)
@@ -0,0 +1,5 @@
+<workbench>
+ <extension>
+ es.unex.sextante.openjump.extensions.SextanteExtension
+ </extension>
+</workbench>
\ No newline at end of file
Property changes on: plug-ins/SextantePlugIn/workbench-properties.xml
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Jump-pilot-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel