Statistics
| Revision:

gvsig-geoprocess / org.gvsig.geoprocess / trunk / org.gvsig.geoprocess / org.gvsig.geoprocess.app / org.gvsig.geoprocess.app.sextante / src / main / java / org / gvsig / geoprocess / app / sextante / SextanteAlgorithmsExtension.java @ 556

History | View | Annotate | Download (2.35 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2012 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.geoprocess.app.sextante;
25

    
26
import java.util.HashMap;
27
import java.util.Map;
28

    
29
import es.unex.sextante.core.GeoAlgorithm;
30
import es.unex.sextante.core.Sextante;
31

    
32
import org.gvsig.andami.PluginServices;
33
import org.gvsig.andami.PluginsLocator;
34
import org.gvsig.andami.PluginsManager;
35
import org.gvsig.andami.plugins.Extension;
36
import org.gvsig.geoprocess.extension.GeoprocessExtension;
37

    
38
/**
39
 * Sextante algorithms extension.
40
 *
41
 * @author gvSIG Team
42
 * @version $Id$
43
 */
44
public class SextanteAlgorithmsExtension extends Extension {
45

    
46
    public void execute(String actionCommand) {
47
        // Nothing to do
48
    }
49

    
50
    public void initialize() {
51

    
52
        // HACK: The initialize method removes all previously registered
53
        // algorithms, so we must get them before and add again afterwards.
54
        Map<String, HashMap<String, GeoAlgorithm>> algorithms =
55
            Sextante.getAlgorithms();
56

    
57
        // The sextante algorithms jar files are copied into the
58
        // org.gvsig.geoprocess.app.mainplugin plugin as sextante looks
59
        // for resource bundles using its own classloader
60
                Sextante.initialize((this.getPlugin().getPluginDirectory().getAbsolutePath()) + "/lib");
61
                // Read previous algorithms just in case
62
                if (algorithms != null) {
63
                        Sextante.getAlgorithms().putAll(algorithms);
64
                }
65
    }
66

    
67
    public boolean isEnabled() {
68
        return true;
69
    }
70

    
71
    public boolean isVisible() {
72
        return true;
73
    }
74
}