Revision 38689

View differences:

tags/v2_0_0_Build_2050/extensions/org.gvsig.exportto.app/prepare-workspace.xml
1
<project name="org.gvsig.initial.build" default="prepare-workspace">
2

  
3
	<dirname property="org.gvsig.initial.build.basedir" file="${ant.file.org.gvsig.initial.build}" />
4

  
5
	<property name="workspace.basedir" value="${org.gvsig.initial.build.basedir}/.." />
6
	<property name="build.basedir" value="${workspace.basedir}/org.gvsig.maven.base.build" description="Eclipse workspace location" />
7
	<property name="build.jar.version" value="1.0.8-SNAPSHOT" />
8
	<property name="build.jar.file" value="org.gvsig.maven.base.build-${build.jar.version}.jar" />
9

  
10
	<property name="ant.libs.dir" location="${build.basedir}" description="Additional ant tasks libs folder" />
11

  
12
	<target name="check-maven-base-build-available">
13
		<available file="${user.home}/.m2/repository/org/gvsig/org.gvsig.maven.base.build/${build.jar.version}/${build.jar.file}" property="maven-base-build-available" />
14
	</target>
15

  
16
	<target name="get-maven-base-build-local" depends="check-maven-base-build-available" if="maven-base-build-available">
17
		<!-- Unzip de build jar file from the maven repository into the workspace root folder -->
18
		<copy todir="${workspace.basedir}" preservelastmodified="false" filtering="false">
19
			<zipfileset src="${user.home}/.m2/repository/org/gvsig/org.gvsig.maven.base.build/${build.jar.version}/${build.jar.file}">
20
				<patternset>
21
					<exclude name="META-INF/**" />
22
				</patternset>
23
			</zipfileset>
24
		</copy>
25
	</target>
26

  
27
	<target name="get-maven-base-build-remote" depends="check-maven-base-build-available" unless="maven-base-build-available">
28
		<mkdir dir="target" />
29

  
30
		<!-- Download the build jar file -->
31
		<get src="http://devel.gvsig.org/m2repo/j2se/org/gvsig/org.gvsig.maven.base.build/${build.jar.version}/${build.jar.file}" dest="target/${build.jar.file}" verbose="true" />
32

  
33
		<!-- Unzip de build jar file into the workspace root folder -->
34
		<copy todir="${workspace.basedir}" preservelastmodified="false" filtering="false">
35
			<zipfileset src="target/${build.jar.file}">
36
				<patternset>
37
					<exclude name="META-INF/**" />
38
				</patternset>
39
			</zipfileset>
40
		</copy>
41

  
42
	</target>
43
	
44
	<target name="find.depends.natives.file">
45
	    <condition property="depends.natives.file.exists">
46
            <available file="${org.gvsig.initial.build.basedir}/DEPENDS_ON_NATIVE_LIBRARIES"/>
47
	    </condition>	
48
	</target>
49
	
50
	<target name="find.gvsig.platform.properties.file" 
51
			depends="find.depends.natives.file"
52
			if="depends.natives.file.exists">
53
	    <condition property="gvsig.platform.exists">
54
            <available file="${user.home}/.gvsig.platform.properties"/>
55
	    </condition>	
56
	</target>
57
	
58
	<target name="check.gvsig.platform.properties" 
59
			depends="find.gvsig.platform.properties.file">
60
		<fail if="depends.natives.file.exists" unless="gvsig.platform.exists">
61
ERROR!!
62
	
63
You have to define your gvSIG platform properties, 
64
by creating the file: ${user.home}/.gvsig.platform.properties
65
with the following content:
66

  
67
native_platform=linux
68
native_distribution=all
69
native_compiler=gcc4
70
native_arch=i386
71
native_libraryType=dynamic
72
export native_classifier=${native_platform}-${native_distribution}-${native_compiler}-${native_arch}-${native_libraryType}
73

  
74
Replace the fifth initial variables values with the ones appropiate 
75
to your platform.
76
	
77
If you use maven in the command line, you can use the previous file also
78
to define the MAVEN_OPTS environment variable, by adding to your 
79
.bash_rc file something like this:
80

  
81
if [ -f "${HOME}/.gvsig.platform.properties" ]
82
then
83
    . ${HOME}/.gvsig.platform.properties
84
    export MAVEN_OPTS="-Xmx256M -XX:MaxPermSize=64m -Dnative-classifier=${native_classifier}"
85
else
86
    export MAVEN_OPTS="-Xmx256M -XX:MaxPermSize=64m"
87
fi
88

  
89
It will work if you use the bash shell. In any other case or platform, you'll
90
have to define your MAVEN_OPTS environment variable and set the 
91
"native-classifier" parameter directly.
92
		</fail>			
93
	
94
	</target>
95

  
96
	<target name="prepare-workspace" depends="get-maven-base-build-local,get-maven-base-build-remote,check.gvsig.platform.properties">
97

  
98
		<mkdir dir="target" />
99

  
100
		<chmod dir="${build.basedir}/maven/bin" perm="u+x" includes="m2,mvn,mvnDebug" />
101

  
102
		<!-- Copy the maven launchers to the workspace metadata folder -->
103
		<copy todir="${workspace.basedir}/.metadata">
104
			<fileset dir="${build.basedir}/eclipse-launchers">
105
				<exclude name="**/org.eclipse.jdt.core.prefs" />
106
				<exclude name="**/org.eclipse.core.variables.prefs" />
107
			</fileset>
108
		</copy>
109

  
110
		<concat destfile="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs" append="true">
111
			<filelist dir="${build.basedir}/eclipse-launchers/.plugins/org.eclipse.core.runtime/.settings" files="org.eclipse.jdt.core.prefs" />
112
		</concat>
113
		<concat destfile="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.variables.prefs" append="true">
114
			<filelist dir="${build.basedir}/eclipse-launchers/.plugins/org.eclipse.core.runtime/.settings" files="org.eclipse.core.variables.prefs" />
115
		</concat>
116

  
117
		<!-- Configure the eclipse workspace -->
118
		<ant antfile="${build.basedir}/maven-goals.xml" target="mvn-configure-eclipse-workspace" />
119

  
120
		<!-- Configure the gvSIG profile -->
121
		<ant antfile="${build.basedir}/check-gvsig-profile.xml" />
122

  
123
		<property name="user-settings-file-location" value="${user.home}/.m2/settings.xml" />
124

  
125
		<taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask">
126
			<classpath>
127
				<pathelement location="${ant.libs.dir}/com.oopsconsultancy.xmltask-1.16.1.jar" />
128
			</classpath>
129
		</taskdef>
130

  
131
		<xmltask source="${user-settings-file-location}" dest="${user-settings-file-location}">
132
			<copy path="//:settings/:profiles/:profile[:id/text() = 'gvsig-install']/:properties/:gvsig.install.dir/text()" property="current-gvsig-location" />
133
		</xmltask>
134

  
135
		<replace file="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs" token="@GVSIG_HOME@" value="${current-gvsig-location}" />
136
		<replace file="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.variables.prefs" token="@GVSIG_HOME@" value="${current-gvsig-location}" />
137

  
138
		<!-- Compile, install and generate eclipse projects -->
139
		<ant antfile="${build.basedir}/maven-goals.xml" target="mvn-install-and-eclipse-eclipse" />
140

  
141
		<echo>INFORMATION!!!</echo>
142
		<echo>Restart eclipse and then proceed to import the subprojects contained into the main project</echo>
143

  
144
		<!-- TODO: copiar al proyecto de configuraciĆ³n general -->
145
	</target>
146

  
147
	<target name="clean">
148
		<delete dir="target" />
149
	</target>
150
	
151
</project>
0 152

  
tags/v2_0_0_Build_2050/extensions/org.gvsig.exportto.app/pom.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2

  
3
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5
    <modelVersion>4.0.0</modelVersion>
6
    <artifactId>org.gvsig.exportto.app</artifactId>
7
    <packaging>pom</packaging>
8
    <version>1.0.0-SNAPSHOT</version>
9
    <name>org.gvsig.exportto.app</name>
10
    <description>Extension of the Exportto example project</description>
11
    <parent>
12
        <groupId>org.gvsig</groupId>
13
        <artifactId>org.gvsig.maven.base.extension.pom</artifactId>
14
        <version>1.0.8-SNAPSHOT</version>
15
    </parent>
16

  
17
    <scm>
18
        <connection>scm:svn:https://devel.gvsig.org/svn/gvsig-desktop/branches/v2_0_0_prep/extensions/org.gvsig.exportto.app</connection>
19
        <developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-desktop/branches/v2_0_0_prep/extensions/org.gvsig.exportto.app</developerConnection>
20
        <url>https://devel.gvsig.org/redmine/projects/gvsig-desktop/repository/show/branches/v2_0_0_prep/extensions/org.gvsig.exportto.app</url>
21
    </scm>
22

  
23
    <developers>
24
        <developer>
25
            <id>jpiera</id>
26
            <name>Jorge Piera</name>
27
            <email>jpiera@gvsig.org</email>
28
            <roles>
29
                <role>Architect</role>
30
                <role>Developer</role>
31
            </roles>
32
        </developer>
33
        <developer>
34
            <id>jjdelcerro</id>
35
            <name>Joaqu?n Jos? del Cerro</name>
36
            <email>jjdelcerro@gvsig.org</email>
37
            <roles>
38
                <role>Architect</role>
39
            </roles>
40
        </developer>
41
    </developers>
42

  
43
    <repositories>
44
        <repository>
45
            <id>gvsig-public-http-repository</id>
46
            <name>gvSIG maven public HTTP repository</name>
47
            <url>http://devel.gvsig.org/m2repo/j2se</url>
48
            <releases>
49
                <enabled>true</enabled>
50
                <updatePolicy>daily</updatePolicy>
51
                <checksumPolicy>warn</checksumPolicy>
52
            </releases>
53
            <snapshots>
54
                <enabled>true</enabled>
55
                <updatePolicy>daily</updatePolicy>
56
                <checksumPolicy>warn</checksumPolicy>
57
            </snapshots>
58
        </repository>
59
    </repositories>
60
    <dependencyManagement>
61
        <dependencies>          
62
            <dependency>
63
                <groupId>org.gvsig</groupId>
64
                <artifactId>org.gvsig.core.maven.dependencies</artifactId>
65
                <version>2.0.1-SNAPSHOT</version>
66
                <type>pom</type>
67
                <scope>import</scope>
68
            </dependency>
69
            <dependency>
70
                <groupId>org.gvsig</groupId>
71
                <artifactId>org.gvsig.andami</artifactId>
72
                <version>2.0-SNAPSHOT</version>
73
            </dependency>
74
            <dependency>
75
                <groupId>org.gvsig</groupId>
76
                <artifactId>org.gvsig.app</artifactId>
77
                <version>2.0-SNAPSHOT</version>
78
            </dependency>
79
            <dependency>
80
                <groupId>org.gvsig</groupId>
81
                <artifactId>org.gvsig.app.document.table.app.mainplugin</artifactId>
82
                <version>2.0.0-SNAPSHOT</version>
83
            </dependency>
84
            <dependency>
85
                <groupId>org.gvsig</groupId>
86
                <artifactId>org.gvsig.exportto.lib.api</artifactId>
87
                <version>1.0.0-SNAPSHOT</version>
88
            </dependency>
89
            <dependency>
90
                <groupId>org.gvsig</groupId>
91
                <artifactId>org.gvsig.exportto.swing.spi</artifactId>
92
                <version>1.0.0-SNAPSHOT</version>
93
            </dependency>
94
            <dependency>
95
                <groupId>org.gvsig</groupId>
96
                <artifactId>org.gvsig.exportto.lib.impl</artifactId>
97
                <version>1.0.0-SNAPSHOT</version>
98
                <scope>runtime</scope>
99
            </dependency>
100
            <dependency>
101
                <groupId>org.gvsig</groupId>
102
                <artifactId>org.gvsig.exportto.swing.api</artifactId>
103
                <version>1.0.0-SNAPSHOT</version>
104
            </dependency>
105
            <dependency>
106
                <groupId>org.gvsig</groupId>
107
                <artifactId>org.gvsig.exportto.swing.impl</artifactId>
108
                <version>1.0.0-SNAPSHOT</version>
109
                <scope>runtime</scope>
110
            </dependency>
111
            <dependency>
112
                <groupId>org.gvsig</groupId>
113
                <artifactId>org.gvsig.exportto.swing.prov.generic</artifactId>
114
                <version>1.0.0-SNAPSHOT</version>
115
                <scope>runtime</scope>
116
            </dependency>
117
            <dependency>
118
                <groupId>org.gvsig</groupId>
119
                <artifactId>org.gvsig.exportto.swing.prov.file</artifactId>
120
                <version>1.0.0-SNAPSHOT</version>
121
                <scope>runtime</scope>
122
            </dependency>
123
            <dependency>
124
                <groupId>org.gvsig</groupId>
125
                <artifactId>org.gvsig.exportto.swing.prov.shape</artifactId>
126
                <version>1.0.0-SNAPSHOT</version>
127
                <scope>runtime</scope>
128
            </dependency>
129
            <dependency>
130
                <groupId>org.gvsig</groupId>
131
                <artifactId>org.gvsig.exportto.swing.prov.dxf</artifactId>
132
                <version>1.0.0-SNAPSHOT</version>
133
                <scope>runtime</scope>
134
            </dependency>
135
            <dependency>
136
                <groupId>org.gvsig</groupId>
137
                <artifactId>org.gvsig.exportto.swing.prov.jdbc</artifactId>
138
                <version>1.0.0-SNAPSHOT</version>
139
                <scope>runtime</scope>
140
            </dependency>
141
            <dependency>
142
                <groupId>org.gvsig</groupId>
143
                <artifactId>org.gvsig.exportto.swing.prov.postgresql</artifactId>
144
                <version>1.0.0-SNAPSHOT</version>
145
                <scope>runtime</scope>
146
            </dependency>
147
            <dependency>
148
                <groupId>org.gvsig</groupId>
149
                <artifactId>org.gvsig.exportto.swing.prov.mysql</artifactId>
150
                <version>1.0.0-SNAPSHOT</version>
151
                <scope>runtime</scope>
152
            </dependency>
153
            <dependency>
154
                <groupId>org.gvsig</groupId>
155
                <artifactId>org.gvsig.exportto.swing.prov.dbf</artifactId>
156
                <version>1.0.0-SNAPSHOT</version>
157
                <scope>runtime</scope>
158
            </dependency>            
159
        </dependencies>
160
    </dependencyManagement>
161

  
162
    <modules>
163
        <module>org.gvsig.exportto.app.extension</module>
164
    </modules>
165
    <properties>
166
    	<package.info.state>devel</package.info.state>
167
    	<!-- alpha-devel -->
168
    </properties>
169

  
170
</project>
0 171

  
tags/v2_0_0_Build_2050/extensions/org.gvsig.exportto.app/README.txt
1
The first time you checkout the current project to a new workspace, 
2
you have to prepare it to be able to work easily with maven from
3
eclipse itself.
4

  
5
Perform the following steps:
6

  
7
1.- Launch the *prepare-workspace.xml* ant build file. 
8
    You can do it by loading the file into the ant view, 
9
    and running the default task, or right-clicking the 
10
    file from the package explorer or the navigator and
11
    select the option: *Run as > Ant build*. 
12
    
13
2.- Restart eclipse.
14

  
15
3.- Import the subprojects of the project you have just checked out.
16

  
17
Those steps are only needed once per workspace.     
18

  
0 19

  
tags/v2_0_0_Build_2050/extensions/org.gvsig.exportto.app/distribution/distribution.xml
1
<assembly>
2
</assembly>
0 3

  
tags/v2_0_0_Build_2050/extensions/org.gvsig.exportto.app/org.gvsig.exportto.app.extension/src/main/resources/config.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<plugin-config>
3
	<depends plugin-name="org.gvsig.app" />
4
    <depends plugin-name="org.gvsig.app.document.table.app.mainplugin" />
5
    <depends plugin-name="org.gvsig.geodb" />
6

  
7
	<resourceBundle name="text"/>
8
	<libraries library-dir="lib"/>
9
	<extensions>
10
		<extension class-name="org.gvsig.exportto.app.extension.ExporttoLayerExtension"
11
			description=""
12
			active="true"
13
			priority="1">
14
			<menu text="Layer/export_to"
15
				position="600500000"
16
				action-command="Exportto"/>				
17
		</extension>		
18
		<extension class-name="org.gvsig.exportto.app.extension.ExporttoTableExtension"
19
            description=""
20
            active="true"
21
            priority="1">
22
            <menu text="Table/export_to"
23
                position="600850000"
24
                action-command="Exportto"/>             
25
        </extension>        
26
        <extension class-name="org.gvsig.exportto.app.extension.ExporttoPreferencesExtension"
27
            description=""
28
            active="true"
29
            priority="1">
30
        </extension>        
31
	</extensions>
32
</plugin-config>
0 33

  
tags/v2_0_0_Build_2050/extensions/org.gvsig.exportto.app/org.gvsig.exportto.app.extension/src/main/resources/build.number
1
#Build Number for ANT. Do not edit!
2
#Tue Apr 28 16:00:47 CEST 2009
3
build.number=2005
tags/v2_0_0_Build_2050/extensions/org.gvsig.exportto.app/org.gvsig.exportto.app.extension/src/main/resources/org/gvsig/exportto/app/extension/i18n/text.properties
1
add_table_to_project=Desea a?adir la tabla al proyecto?
2
add_table=A?adir tabla
3
exportto_preferences=Exportar a
4
exportto_preferences_panel_description=Marque los formatos de exportaci?n a que quiera activar o desactivar
0 5

  
tags/v2_0_0_Build_2050/extensions/org.gvsig.exportto.app/org.gvsig.exportto.app.extension/src/main/resources/org/gvsig/exportto/app/extension/i18n/text_en.properties
1
add_table_to_project=Add the table to the project?
2
add_table=Add table
3
exportto_preferences=Export to
4
exportto_preferences_panel_description=Enable or disable "export to" formats
0 5

  
tags/v2_0_0_Build_2050/extensions/org.gvsig.exportto.app/org.gvsig.exportto.app.extension/src/main/resources/plugin-persistence.def
1
<?xml version="1.0"?>
2
<!--
3
Definitions of plugin persistence org.gvsig.exportto.app.extension.  
4
 -->
5
<definitions>
6
  <version>1.0.0</version>
7
  <classes>
8
    <class name="org.gvsig.exportto.app.extension">
9
      <description>Persistence of the Exportto plugin</description>
10
      <fields>
11
        <field name="enabledProviders" type="Set" classOfItems="java.lang.String" mandatory="false">
12
          <description>List of export to provider names enabled by the user</description>
13
        </field>
14
        <field name="disabledProviders" type="Set" classOfItems="java.lang.String" mandatory="false">
15
          <description>List of export to provider names disabled by the user</description>
16
        </field>
17
      </fields>
18
    </class>
19
  </classes>
20
</definitions>  
tags/v2_0_0_Build_2050/extensions/org.gvsig.exportto.app/org.gvsig.exportto.app.extension/src/main/java/org/gvsig/exportto/app/extension/ExporttoWindowListener.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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
 */
22
package org.gvsig.exportto.app.extension;
23

  
24
import org.gvsig.andami.PluginServices;
25
import org.gvsig.andami.ui.mdiManager.IWindow;
26
import org.gvsig.exportto.swing.JExporttoServicePanelListener;
27

  
28
/**
29
 * @author gvSIG Team
30
 * @version $Id$
31
 * 
32
 */
33
public class ExporttoWindowListener implements JExporttoServicePanelListener {
34

  
35
    private IWindow exporttoWindow = null;
36

  
37
    public ExporttoWindowListener(IWindow exporttoWindow) {
38
        super();
39
        this.exporttoWindow = exporttoWindow;
40
    }
41

  
42
    public void close() {
43
        PluginServices.getMDIManager().closeWindow(exporttoWindow);
44
    }
45

  
46
}
0 47

  
tags/v2_0_0_Build_2050/extensions/org.gvsig.exportto.app/org.gvsig.exportto.app.extension/src/main/java/org/gvsig/exportto/app/extension/ExporttoPreferencesExtension.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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
 */
22
package org.gvsig.exportto.app.extension;
23

  
24
import java.util.Iterator;
25
import java.util.Locale;
26
import java.util.Set;
27

  
28
import org.slf4j.Logger;
29
import org.slf4j.LoggerFactory;
30

  
31
import org.gvsig.andami.IconThemeHelper;
32
import org.gvsig.andami.PluginServices;
33
import org.gvsig.andami.plugins.Extension;
34
import org.gvsig.exportto.app.extension.preferences.ExporttoPreferencesPage;
35
import org.gvsig.exportto.swing.spi.ExporttoSwingProviderFactory;
36
import org.gvsig.exportto.swing.spi.ExporttoSwingProviderLocator;
37
import org.gvsig.exportto.swing.spi.ExporttoSwingProviderManager;
38
import org.gvsig.i18n.Messages;
39
import org.gvsig.tools.ToolsLocator;
40
import org.gvsig.tools.dynobject.DynObject;
41
import org.gvsig.tools.extensionpoint.ExtensionPoint;
42
import org.gvsig.tools.extensionpoint.ExtensionPointManager;
43
import org.gvsig.tools.service.ServiceException;
44

  
45
/**
46
 * Andami extension to register the ExportTo preferences panel.
47
 * 
48
 * @author gvSIG Team
49
 * @version $Id$
50
 */
51
public class ExporttoPreferencesExtension extends Extension {
52

  
53
    private static final Logger LOG = LoggerFactory
54
        .getLogger(ExporttoPreferencesExtension.class);
55

  
56
    /**
57
     * The name of the preferences property with the names of the hidden
58
     * ExporttoSwingProviderFactory.
59
     */
60
    public static final String PREFERENCE_DISABLED_PROVIDERS =
61
        "disabledProviders";
62
    public static final String PREFERENCE_ENABLED_PROVIDERS =
63
        "enabledProviders";
64

  
65
    public void initialize() {
66
        if (!Messages.hasLocales()) {
67
            Messages.addLocale(Locale.getDefault());
68
        }
69
        Messages.addResourceFamily(
70
            "org.gvsig.exportto.app.extension.i18n.text",
71
            ExporttoLayerExtension.class.getClassLoader(),
72
            ExporttoLayerExtension.class.getClass().getName());
73

  
74
        ExporttoSwingProviderManager providerManager =
75
            ExporttoSwingProviderLocator.getManager();
76
        // Load from preferences the list of Exportto Providers to ignore.
77
        DynObject preferences = this.getPlugin().getPluginProperties();
78
        @SuppressWarnings("unchecked")
79
        Set<String> disabledProviders =
80
            (Set<String>) preferences
81
                .getDynValue(PREFERENCE_DISABLED_PROVIDERS);
82
        if (disabledProviders != null) {
83
            for (Iterator<String> iterator = disabledProviders.iterator(); iterator
84
                .hasNext();) {
85
                ExporttoSwingProviderFactory factory;
86
                String providerName = null;
87
                try {
88
                    providerName = iterator.next();
89
                    factory =
90
                        providerManager
91
                            .getExporttoSwingProviderFactory(providerName);
92
                    providerManager.enableProvider(factory, Boolean.FALSE);
93
                } catch (ServiceException e) {
94
                    LOG.warn("Disabled exportto swing provider " + providerName
95
                        + " is not available", e);
96
                }
97
            }
98
        }
99
        @SuppressWarnings("unchecked")
100
        Set<String> enabledProviders =
101
            (Set<String>) preferences.getDynValue(PREFERENCE_ENABLED_PROVIDERS);
102
        if (enabledProviders != null) {
103
            for (Iterator<String> iterator = enabledProviders.iterator(); iterator
104
                .hasNext();) {
105
                ExporttoSwingProviderFactory factory;
106
                String providerName = null;
107
                try {
108
                    providerName = iterator.next();
109
                    factory =
110
                        providerManager
111
                            .getExporttoSwingProviderFactory(providerName);
112
                    providerManager.enableProvider(factory, Boolean.TRUE);
113
                } catch (ServiceException e) {
114
                    LOG.warn("Enabled exportto swing provider " + providerName
115
                        + " is not available", e);
116
                }
117
            }
118
        }
119

  
120
        // Register preferences page
121
        ExtensionPointManager extensionPoints =
122
            ToolsLocator.getExtensionPointManager();
123
        ExtensionPoint ep = extensionPoints.add("AplicationPreferences", "");
124

  
125
        IconThemeHelper.registerIcon("preferences", "export-to-preferences", this);
126

  
127
        ep.append("ExporttoPreferencesPage", "", new ExporttoPreferencesPage());
128
    }
129

  
130
    public void execute(String actionCommand) {
131
        // Nothing to do
132
    }
133

  
134
    public boolean isEnabled() {
135
        return true;
136
    }
137

  
138
    public boolean isVisible() {
139
        return false;
140
    }
141

  
142
}
tags/v2_0_0_Build_2050/extensions/org.gvsig.exportto.app/org.gvsig.exportto.app.extension/src/main/java/org/gvsig/exportto/app/extension/LoadTableAction.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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
 */
22
package org.gvsig.exportto.app.extension;
23

  
24
import javax.swing.JComponent;
25
import javax.swing.JOptionPane;
26

  
27
import org.slf4j.Logger;
28
import org.slf4j.LoggerFactory;
29

  
30
import org.gvsig.andami.PluginServices;
31
import org.gvsig.app.ApplicationLocator;
32
import org.gvsig.app.project.ProjectManager;
33
import org.gvsig.app.project.documents.table.TableDocument;
34
import org.gvsig.app.project.documents.table.TableManager;
35
import org.gvsig.exportto.ExporttoServiceFinishAction;
36
import org.gvsig.fmap.dal.DALLocator;
37
import org.gvsig.fmap.dal.DataManager;
38
import org.gvsig.fmap.dal.DataStoreParameters;
39
import org.gvsig.fmap.dal.exception.DataException;
40
import org.gvsig.fmap.dal.exception.InitializeException;
41
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException;
42
import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
43
import org.gvsig.fmap.dal.feature.FeatureStore;
44

  
45
/**
46
 * @author gvSIG Team
47
 * @version $Id$
48
 * 
49
 */
50
public class LoadTableAction implements ExporttoServiceFinishAction {
51

  
52
    private static final Logger LOG = LoggerFactory
53
        .getLogger(LoadLayerAction.class);
54
    private static final DataManager DATA_MANAGER = DALLocator.getDataManager();
55

  
56
    public LoadTableAction() {
57
        super();
58
    }
59

  
60
    public void finished(String tableName,
61
        DataStoreParameters dataStoreParameters) {
62

  
63
        int res =
64
            JOptionPane.showConfirmDialog((JComponent) PluginServices
65
                .getMDIManager().getActiveWindow(), PluginServices.getText(
66
                this, "add_table_to_project"), PluginServices.getText(this,
67
                "add_table"), JOptionPane.YES_NO_OPTION);
68

  
69
        if (res == JOptionPane.YES_OPTION) {
70
            try {
71
                FeatureStore featureStore =
72
                    (FeatureStore) DATA_MANAGER.openStore(
73
                        dataStoreParameters.getDataStoreName(),
74
                        dataStoreParameters);
75
                TableDocument tableDocument =
76
                    (TableDocument) ProjectManager.getInstance()
77
                        .createDocument(TableManager.TYPENAME, tableName);
78
                tableDocument.setStore(featureStore);
79

  
80
                ApplicationLocator.getManager().getProjectManager()
81
                    .getCurrentProject().add(tableDocument);
82
                // FeatureTableDocumentPanel featureTableDocumentPanel =
83
                // new FeatureTableDocumentPanel(tableDocument);
84
                //
85
                // MDI_MANAGER.addWindow(featureTableDocumentPanel);
86
            } catch (ValidateDataParametersException e) {
87
                LOG.error("Error opening the exported table", e);
88
            } catch (InitializeException e) {
89
                LOG.error("Error opening the exported table", e);
90
            } catch (ProviderNotRegisteredException e) {
91
                LOG.error("Error opening the exported table", e);
92
            } catch (DataException e) {
93
                LOG.error("Error opening the exported table", e);
94
            }
95
        }
96
    }
97
}
0 98

  
tags/v2_0_0_Build_2050/extensions/org.gvsig.exportto.app/org.gvsig.exportto.app.extension/src/main/java/org/gvsig/exportto/app/extension/GvSIGExporttoWindowManager.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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
 */
22
package org.gvsig.exportto.app.extension;
23

  
24
import java.awt.event.ComponentEvent;
25
import java.awt.event.ComponentListener;
26
import java.util.HashMap;
27
import java.util.Map;
28

  
29
import javax.swing.JPanel;
30

  
31
import org.gvsig.andami.PluginServices;
32
import org.gvsig.andami.ui.mdiManager.IWindow;
33
import org.gvsig.exportto.swing.ExporttoWindowManager;
34
import org.gvsig.exportto.swing.JExporttoServicePanel;
35

  
36
/**
37
 * {@link ExporttoWindowManager} implementation to show Exportto
38
 * windows as gvSIG windows
39
 * 
40
 * @author gvSIG Team
41
 * @version $Id$
42
 */
43
public class GvSIGExporttoWindowManager implements ExporttoWindowManager,
44
    ComponentListener {
45

  
46
    private Map<JPanel, IWindow> panelToWindow = new HashMap<JPanel, IWindow>();
47

  
48
    public void showWindow(JExporttoServicePanel panel, String title, int mode) {
49
        ExporttoWindow window = new ExporttoWindow(panel, title, mode);
50
        panel
51
            .setExporttoServicePanelListener(new ExporttoWindowListener(window));
52

  
53
        panel.addComponentListener(this);
54

  
55
        panelToWindow.put(panel, window);
56

  
57
        PluginServices.getMDIManager().addCentredWindow(window);
58
    }
59

  
60
    public void componentHidden(ComponentEvent componentEvent) {
61
        JPanel panel = (JPanel) componentEvent.getSource();
62
        IWindow window = panelToWindow.get(panel);
63
        PluginServices.getMDIManager().closeWindow(window);
64
        panelToWindow.remove(panel);
65
    }
66

  
67
    public void componentMoved(ComponentEvent e) {
68
        // Nothing to do
69
    }
70

  
71
    public void componentResized(ComponentEvent e) {
72
        // Nothing to do
73
    }
74

  
75
    public void componentShown(ComponentEvent e) {
76
        // Nothing to do
77
    }
78
}
0 79

  
tags/v2_0_0_Build_2050/extensions/org.gvsig.exportto.app/org.gvsig.exportto.app.extension/src/main/java/org/gvsig/exportto/app/extension/ExporttoTableExtension.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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
 */
22
package org.gvsig.exportto.app.extension;
23

  
24
import org.gvsig.andami.PluginServices;
25
import org.gvsig.andami.plugins.Extension;
26
import org.gvsig.andami.ui.mdiManager.IWindow;
27
import org.gvsig.app.ApplicationLocator;
28
import org.gvsig.app.ApplicationManager;
29
import org.gvsig.app.project.documents.table.TableDocument;
30
import org.gvsig.app.project.documents.table.gui.FeatureTableDocumentPanel;
31
import org.gvsig.exportto.swing.ExporttoSwingLocator;
32
import org.gvsig.exportto.swing.ExporttoSwingManager;
33
import org.gvsig.exportto.swing.ExporttoWindowManager;
34
import org.gvsig.exportto.swing.JExporttoServicePanel;
35
import org.gvsig.fmap.dal.feature.FeatureStore;
36

  
37
/**
38
 * @author gvSIG Team
39
 * @version $Id$
40
 * 
41
 */
42
public class ExporttoTableExtension extends Extension {
43

  
44
    private ExporttoSwingManager swingManager;
45
    private static final ApplicationManager APPLICATION_MANAGER =
46
        ApplicationLocator.getManager();
47

  
48
    public void initialize() {
49

  
50
    }
51

  
52
    @Override
53
    public void postInitialize() {
54
        super.postInitialize();
55
        swingManager = ExporttoSwingLocator.getSwingManager();
56
    }
57

  
58
    public void execute(String actionCommand) {
59
        org.gvsig.andami.ui.mdiManager.IWindow f =
60
            PluginServices.getMDIManager().getActiveWindow();
61

  
62
        if (f instanceof FeatureTableDocumentPanel) {
63
            FeatureTableDocumentPanel featureTableDocumentPanel =
64
                (FeatureTableDocumentPanel) f;
65
            TableDocument tableDocument =
66
                (TableDocument) featureTableDocumentPanel.getDocument();
67
            showExportto(tableDocument.getStore());
68
        }
69
    }
70

  
71
    private void showExportto(FeatureStore featureStore) {
72
        JExporttoServicePanel panel =
73
            swingManager
74
                .createExportto(
75
                    featureStore,
76
                    null,
77
                    new LoadTableAction(),
78
                    new int[] { ExporttoSwingManager.VECTORIAL_TABLE_WITHOUT_GEOMETRY });
79

  
80
        swingManager.getWindowManager().showWindow(panel, "Exportto",
81
            ExporttoWindowManager.MODE_WINDOW);
82

  
83
    }
84

  
85
    public boolean isEnabled() {
86
        return true;
87
    }
88

  
89
    public boolean isVisible() {
90
        IWindow window = APPLICATION_MANAGER.getUIManager().getActiveWindow();
91

  
92
        if (window == null) {
93
            return false;
94
        }
95

  
96
        if (window instanceof FeatureTableDocumentPanel) {
97
            return true;
98
        }
99
        return false;
100
    }
101
}
0 102

  
tags/v2_0_0_Build_2050/extensions/org.gvsig.exportto.app/org.gvsig.exportto.app.extension/src/main/java/org/gvsig/exportto/app/extension/LoadLayerAction.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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
 */
22
package org.gvsig.exportto.app.extension;
23

  
24
import javax.swing.JComponent;
25
import javax.swing.JOptionPane;
26

  
27
import org.slf4j.Logger;
28
import org.slf4j.LoggerFactory;
29

  
30
import org.gvsig.andami.PluginServices;
31
import org.gvsig.exportto.ExporttoServiceFinishAction;
32
import org.gvsig.fmap.dal.DataStoreParameters;
33
import org.gvsig.fmap.mapcontext.MapContext;
34
import org.gvsig.fmap.mapcontext.MapContextLocator;
35
import org.gvsig.fmap.mapcontext.MapContextManager;
36
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
37
import org.gvsig.fmap.mapcontext.layers.FLayer;
38

  
39
/**
40
 * @author gvSIG Team
41
 * @version $Id$
42
 * 
43
 */
44
public class LoadLayerAction implements ExporttoServiceFinishAction {
45

  
46
    private static final Logger LOG = LoggerFactory
47
        .getLogger(LoadLayerAction.class);
48
    private static final MapContextManager MAP_CONTEXT_MANAGER =
49
        MapContextLocator.getMapContextManager();
50

  
51
    private MapContext mapContext = null;
52

  
53
    public LoadLayerAction(MapContext mapContext) {
54
        super();
55
        this.mapContext = mapContext;
56
    }
57

  
58
    public void finished(String layerName,
59
        DataStoreParameters dataStoreParameters) {
60
        try {
61
            int res =
62
                JOptionPane.showConfirmDialog((JComponent) PluginServices
63
                    .getMDIManager().getActiveWindow(), PluginServices.getText(
64
                    this, "insertar_en_la_vista_la_capa_creada"),
65
                    PluginServices.getText(this, "insertar_capa"),
66
                    JOptionPane.YES_NO_OPTION);
67

  
68
            if (res == JOptionPane.YES_OPTION) {
69
                FLayer layer =
70
                    MAP_CONTEXT_MANAGER.createLayer(layerName,
71
                        dataStoreParameters);
72
                mapContext.getLayers().addLayer(layer);
73
            }
74

  
75
        } catch (LoadLayerException e) {
76
            LOG.error("Error loading the exported layer", e);
77
        }
78
    }
79
}
0 80

  
tags/v2_0_0_Build_2050/extensions/org.gvsig.exportto.app/org.gvsig.exportto.app.extension/src/main/java/org/gvsig/exportto/app/extension/ExporttoWindow.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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
 */
22
package org.gvsig.exportto.app.extension;
23

  
24
import java.awt.BorderLayout;
25
import java.awt.Dimension;
26

  
27
import javax.swing.JPanel;
28

  
29
import org.gvsig.andami.ui.mdiManager.IWindow;
30
import org.gvsig.andami.ui.mdiManager.WindowInfo;
31
import org.gvsig.exportto.swing.ExporttoWindowManager;
32

  
33
/**
34
 * {@link IWindow} to show a Exportto.
35
 * 
36
 * @author gvSIG Team
37
 * @version $Id$
38
 */
39
public class ExporttoWindow extends JPanel implements IWindow {
40

  
41
    private static final long serialVersionUID = -4401123724140025094L;
42

  
43
    private WindowInfo info;
44

  
45
    private Object profile = WindowInfo.EDITOR_PROFILE;
46

  
47
    /**
48
     * Constructor.
49
     * 
50
     * @param panel
51
     *            the panel to show
52
     * @param title
53
     *            the window title
54
     * @param mode
55
     *            the window mode
56
     * @see {@link ExporttoWindowManager#MODE_DIALOG}
57
     * @see {@link ExporttoWindowManager#MODE_TOOL}
58
     * @see {@link ExporttoWindowManager#MODE_WINDOW}
59
     */
60
    public ExporttoWindow(JPanel panel, String title, int mode) {
61
        this.setLayout(new BorderLayout());
62
        add(panel, BorderLayout.CENTER);
63
        Dimension dimension = new Dimension(800, 400);
64
        setSize(dimension);
65
        int code =
66
            WindowInfo.ICONIFIABLE | WindowInfo.MAXIMIZABLE
67
                | WindowInfo.RESIZABLE;
68
        switch (mode) {
69
        case ExporttoWindowManager.MODE_DIALOG:
70
            code |= WindowInfo.MODALDIALOG;
71
            profile = WindowInfo.DIALOG_PROFILE;
72
            break;
73
        case ExporttoWindowManager.MODE_TOOL:
74
            code |= WindowInfo.PALETTE;
75
            profile = WindowInfo.TOOL_PROFILE;
76
            break;
77
        case ExporttoWindowManager.MODE_WINDOW:
78
        default:
79
            code |= WindowInfo.MODELESSDIALOG;
80
            profile = WindowInfo.EDITOR_PROFILE;
81
        }
82
        info = new WindowInfo(code);
83
        info.setTitle(title);
84
        info.setMinimumSize(dimension);
85
    }
86

  
87
    public WindowInfo getWindowInfo() {
88
        return info;
89
    }
90

  
91
    public Object getWindowProfile() {
92
        return profile;
93
    }
94
}
0 95

  
tags/v2_0_0_Build_2050/extensions/org.gvsig.exportto.app/org.gvsig.exportto.app.extension/src/main/java/org/gvsig/exportto/app/extension/ExporttoLayerExtension.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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
 */
22
package org.gvsig.exportto.app.extension;
23

  
24
import java.util.Locale;
25

  
26
import org.cresques.cts.IProjection;
27

  
28
import org.gvsig.andami.messages.NotificationManager;
29
import org.gvsig.andami.plugins.Extension;
30
import org.gvsig.andami.ui.mdiManager.IWindow;
31
import org.gvsig.app.ApplicationLocator;
32
import org.gvsig.app.ApplicationManager;
33
import org.gvsig.app.project.documents.view.ViewDocument;
34
import org.gvsig.app.project.documents.view.ViewManager;
35
import org.gvsig.app.project.documents.view.gui.DefaultViewPanel;
36
import org.gvsig.exportto.swing.ExporttoSwingLocator;
37
import org.gvsig.exportto.swing.ExporttoSwingManager;
38
import org.gvsig.exportto.swing.ExporttoWindowManager;
39
import org.gvsig.exportto.swing.JExporttoServicePanel;
40
import org.gvsig.fmap.mapcontext.MapContext;
41
import org.gvsig.fmap.mapcontext.layers.FLayer;
42
import org.gvsig.fmap.mapcontext.layers.FLayers;
43
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
44
import org.gvsig.i18n.Messages;
45

  
46
/**
47
 * @author gvSIG Team
48
 * @version $Id$
49
 * 
50
 */
51
public class ExporttoLayerExtension extends Extension {
52

  
53
    private ExporttoSwingManager swingManager;
54
    private static final ApplicationManager APPLICATION_MANAGER =
55
        ApplicationLocator.getManager();
56

  
57
    public void initialize() {
58
        if (!Messages.hasLocales()) {
59
            Messages.addLocale(Locale.getDefault());
60
        }
61
        Messages.addResourceFamily(
62
            "org.gvsig.exportto.app.extension.i18n.text",
63
            ExporttoLayerExtension.class.getClassLoader(),
64
            ExporttoLayerExtension.class.getClass().getName());
65
    }
66

  
67
    @Override
68
    public void postInitialize() {
69
        super.postInitialize();
70
        // Asignamos el locator e iniciamos la instancia
71
        swingManager = ExporttoSwingLocator.getSwingManager();
72

  
73
        swingManager.registerWindowManager(new GvSIGExporttoWindowManager());
74
    }
75

  
76
    public void execute(String actionCommand) {
77
        ApplicationManager application = ApplicationLocator.getManager();
78
        ViewDocument view =
79
            (ViewDocument) application.getActiveDocument(ViewManager.TYPENAME);
80
        if (view != null) {
81
            MapContext mapContext = view.getMapContext();
82
            FLayers layers = mapContext.getLayers();
83
            FLayer[] actives = layers.getActives();
84
            try {
85
                for (int i = 0; i < actives.length; i++) {
86
                    if (actives[i] instanceof FLyrVect) {
87
                        FLyrVect fLyrVect = (FLyrVect) actives[i];
88
                        showExportto(fLyrVect, mapContext.getProjection(),
89
                            mapContext);
90
                    }
91
                }
92
            } catch (Exception e) {
93
                NotificationManager.showMessageError(e.getMessage(), e);
94
            }
95
        }
96
    }
97

  
98
    public int showExportto(FLyrVect fLyrVect, IProjection projection,
99
        MapContext mapContext) {
100

  
101
        JExporttoServicePanel panel =
102
            swingManager
103
                .createExportto(
104
                    fLyrVect.getFeatureStore(),
105
                    projection,
106
                    new LoadLayerAction(mapContext),
107
                    new int[] { ExporttoSwingManager.VECTORIAL_TABLE_WITH_GEOMETRY });
108

  
109
        swingManager.getWindowManager().showWindow(panel, "Exportto",
110
            ExporttoWindowManager.MODE_WINDOW);
111

  
112
        return panel.getStatus();
113

  
114
    }
115

  
116
    public boolean isEnabled() {
117
        ApplicationManager application = ApplicationLocator.getManager();
118
        ViewDocument view =
119
            (ViewDocument) application.getActiveDocument(ViewManager.TYPENAME);
120
        if (view != null) {
121
            FLayer[] actives = view.getMapContext().getLayers().getActives();
122
            for (int i = 0; i < actives.length; i++) {
123
                if (actives[i] instanceof FLyrVect) {
124
                    return true;
125
                }
126
            }
127
        }
128
        return false;
129
    }
130

  
131
    public boolean isVisible() {
132
        IWindow window = APPLICATION_MANAGER.getUIManager().getActiveWindow();
133

  
134
        if (window == null) {
135
            return false;
136
        }
137

  
138
        if (window instanceof DefaultViewPanel) {
139
            return true;
140
        }
141
        return false;
142
    }
143
}
0 144

  
tags/v2_0_0_Build_2050/extensions/org.gvsig.exportto.app/org.gvsig.exportto.app.extension/src/main/java/org/gvsig/exportto/app/extension/package.html
1
<?xml version="1.0" encoding="UTF-8" ?>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml">
4
<head>
5
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6
<title>org.gvsig.exportto package documentation</title>
7
</head>
8
<body>
9

  
10
	<p>Exportto gvSIG extension</p>
11
	
12
	<p>
13
	Shows Exportto into gvSIG.
14
	</p>
15

  
16
</body>
17
</html>
0 18

  
tags/v2_0_0_Build_2050/extensions/org.gvsig.exportto.app/org.gvsig.exportto.app.extension/src/main/java/org/gvsig/exportto/app/extension/preferences/ExporttoPreferencesPage.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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
 */
22
package org.gvsig.exportto.app.extension.preferences;
23

  
24
import java.util.HashSet;
25
import java.util.List;
26
import java.util.Set;
27

  
28
import javax.swing.ImageIcon;
29
import javax.swing.JLabel;
30
import javax.swing.JPanel;
31

  
32
import org.gvsig.andami.IconThemeHelper;
33
import org.gvsig.andami.PluginServices;
34
import org.gvsig.andami.PluginsLocator;
35
import org.gvsig.andami.preferences.AbstractPreferencePage;
36
import org.gvsig.andami.preferences.StoreException;
37
import org.gvsig.exportto.app.extension.ExporttoPreferencesExtension;
38
import org.gvsig.exportto.swing.preferences.ExporttoSwingPreferencesComponent;
39
import org.gvsig.exportto.swing.spi.ExporttoSwingProviderFactory;
40
import org.gvsig.exportto.swing.spi.ExporttoSwingProviderLocator;
41
import org.gvsig.exportto.swing.spi.ExporttoSwingProviderManager;
42
import org.gvsig.i18n.Messages;
43
import org.gvsig.tools.dynobject.DynObject;
44

  
45
/**
46
 * Exportto related preferences page.
47
 * 
48
 * @author gvSIG Team
49
 * @version $Id$
50
 */
51
public class ExporttoPreferencesPage extends AbstractPreferencePage {
52

  
53
    private static final long serialVersionUID = -5751805016601819817L;
54

  
55
    //private ImageIcon icon;
56

  
57
    private ExporttoSwingProviderManager manager;
58

  
59
    private ExporttoSwingPreferencesComponent preferences;
60

  
61
    /**
62
     * Constructor.
63
     */
64
    public ExporttoPreferencesPage() {
65
        //icon = PluginServices.getIconTheme().get("exportto-properties");
66

  
67
        manager = ExporttoSwingProviderLocator.getManager();
68
        addComponent(new JLabel(
69
            Messages.getText("exportto_preferences_panel_description")));
70
        preferences = manager.createExporttoSwingProvidersPreferences();
71
        addComponent(preferences.asJComponent());
72
    }
73

  
74
    public String getID() {
75
        return getClass().getName();
76
    }
77

  
78
    public String getTitle() {
79
        return Messages.getText("exportto_preferences");
80
    }
81

  
82
    public JPanel getPanel() {
83
        return this;
84
    }
85

  
86
    public void initializeValues() {
87
        // Nothing to do
88
    }
89

  
90
    public void initializeDefaults() {
91
        preferences.initializeDefaults();
92
    }
93

  
94
    public ImageIcon getIcon() {
95
        return IconThemeHelper.getImageIcon("export-to-preferences");
96
    }
97

  
98
    public boolean isValueChanged() {
99
        return preferences.isValueChanged();
100
    }
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff