Revision 39263

View differences:

tags/v2_0_0_Build_2058/extensions/org.gvsig.mkmvnproject/build.xml
1
<project name="gvSIG-build-config" default="mvn-install" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
2

  
3
	<property name="maven.folder" 
4
		location="${basedir}/src/main/resources/maven" />
5
	
6
	<!-- Maven ant tasks registration -->
7
	<path id="maven-ant-tasks.classpath" 
8
		path="${maven.folder}/lib/maven-ant-tasks-2.0.10.jar" />
9
	<typedef resource="org/apache/maven/artifact/ant/antlib.xml" 
10
		uri="antlib:org.apache.maven.artifact.ant"
11
		classpathref="maven-ant-tasks.classpath" />
12
	
13
	<!-- Maven targets -->
14
	<macrodef name="maven">
15
		<attribute name="arg" />
16
		<sequential>
17
			<echo>mvn @{arg}</echo>
18
			<artifact:mvn mavenHome="${maven.folder}" fork="true"
19
				failonerror="true" maxmemory="256M">
20
				<arg line="@{arg}" />
21
				<jvmarg value="-XX:MaxPermSize=64M" />
22
			</artifact:mvn>
23
		</sequential>
24
	</macrodef>
25

  
26
	<!-- Utility targets -->
27
	<target name="cancel">
28
		<fail>User canceled</fail>
29
	</target>
30

  
31
	<target name="mvn-clean" description="Cleans all artifacts">
32
		<maven arg="clean" />
33
	</target>
34

  
35
	<target name="mvn-compile" description="Compiles all source code">
36
		<maven arg="compile" />
37
	</target>
38

  
39
	<target name="mvn-test" description="Launches unit tests">
40
		<maven arg="test" />
41
	</target>
42

  
43
	<target name="mvn-install" description="Compiles and installs">
44
		<maven arg="install" />
45
	</target>
46
	
47
	<target name="mvn-install-ignore-tests" description="Compiles and installs and ignore tests">
48
	        <maven arg="install -Dmaven.test.failure.ignore" />
49
	    </target>
50
	
51
	<target name="mvn-install-without-tests"
52
		description="Compiles and installs without launching tests">
53
		<maven arg="-Dmaven.test.skip=true install" />
54
	</target>
55

  
56
	<target name="mvn-reinstall" 
57
		description="Performs a clean install">
58
		<maven arg="clean install" />
59
	</target>
60

  
61
	<target name="mvn-reinstall-without-tests"
62
		description="Performs a clean install without launching tests">
63
		<maven arg="-Dmaven.test.skip=true clean install" />
64
	</target>
65

  
66
	<target name="mvn-deploy" 
67
		description="Compiles, installs and deploys">
68
		<maven arg="deploy" />
69
	</target>
70

  
71
	<target name="mvn-deploy-release" 
72
			description="Compiles, installs and deploys for release">
73
		<maven arg="-P release deploy" />
74
	</target>
75

  
76
	<target name="mvn-eclipse-clean"
77
		description="Cleans the maven generated eclipse project files">
78
		<maven arg="eclipse:clean" />
79
	</target>
80

  
81
	<target name="mvn-eclipse-eclipse"
82
		description="Generates an eclipse project configuration from the pom.xml">
83
		<maven arg="eclipse:eclipse" />
84
	</target>
85

  
86
	<target name="mvn-site"
87
		description="Generates the project site documentation">
88
		<maven arg="site" />
89
	</target>
90
</project>
0 91

  
tags/v2_0_0_Build_2058/extensions/org.gvsig.mkmvnproject/distribution/distribution.xml
1
<assembly>
2
	<id>distribution</id>
3
	<formats>
4
		<format>dir</format>
5
	</formats>
6
	<fileSets>
7
		<!-- Estructure for the extension -->
8
		<fileSet>
9
			<directory>src/main/resources/scripts</directory>
10
			<outputDirectory>${extension.install.dir.name}/scripts</outputDirectory>
11
		</fileSet>
12
		<fileSet>
13
			<directory>src/main/resources/compilationcheck</directory>
14
			<outputDirectory>${extension.install.dir.name}/compilationcheck</outputDirectory>
15
		</fileSet>
16
		<fileSet>
17
			<directory>src/main/resources/config</directory>
18
			<outputDirectory>${extension.install.dir.name}</outputDirectory>
19
		</fileSet>
20
		<fileSet>
21
			<directory>target/templates-zips</directory>
22
			<outputDirectory>${extension.install.dir.name}/templates
23
			</outputDirectory>
24
		</fileSet>
25
	</fileSets>
26
    <files>
27
        <file>
28
            <source>package.info</source>
29
            <outputDirectory>${extension.install.dir.name}
30
            </outputDirectory>
31
        </file>
32
    </files>
33
	<dependencySets>
34
		<dependencySet>
35
			<outputDirectory>${extension.install.dir.name}/${library-dir}
36
			</outputDirectory>
37
			<includes>
38
				<include>org.gvsig:org.gvsig.mkmvnproject</include>
39
				<include>ant-contrib:ant-contrib</include>
40
				<include>org.apache.ant:ant</include>
41
				<include>org.apache.ant:ant-launcher</include>
42
				<include>org.apache.ant:ant-nodeps</include>
43
                <include>org.apache.ant:ant-apache-oro</include>
44
				<include>com.sardak:antform</include>
45
				<include>org.tigris.antelope:antelopetasks</include>				
46
			</includes>
47
		</dependencySet>
48
	</dependencySets>
49
</assembly>
0 50

  
tags/v2_0_0_Build_2058/extensions/org.gvsig.mkmvnproject/buildNumber.properties
1
#maven.buildNumber.plugin properties file
2
#Mon Nov 05 17:09:48 CET 2012
3
buildNumber=2071
tags/v2_0_0_Build_2058/extensions/org.gvsig.mkmvnproject/src/main/resources/config/text.properties
1
_Java_compiler_not_found_near_current_JRE_nor_in_JAVA_HOME=No se ha encontrado compilador Java junto a JRE actual ni en la ubicaci?n indicada por JAVA_HOME
2
_Continue_question=?Desea continuar?
3
_Searching_JDK=Buscando JDK
4
_gvSIG_is_running_on_JDK=gvSIG se est? ejecutando sobre un JDK
5
_gvSIG_is_not_running_on_JDK=gvSIG no se est? ejecutando sobre un JDK
6
_JAVA_HOME_is_not_set=La variable de entorno JAVA_HOME no est? declarada
7
_JAVA_HOME_is_set_to=La variable de entorno JAVA_HOME tiene el valor
8
_You_might_need_to_run_gvSIG_on_JDK_or_set_JAVA_HOME_properly=Es probable que necesite ejecutar gvSIG sobre un JDK o establecer JAVA_HOME correctamente
9
_Visit_gvSIG_website_for_details=Visite la p?gina web de gvSIG para m?s informaci?n
10
_Detected_settings=Configuraci?n detectada
11
_On_Linux_make_JAVA_HOME_point_to_JDK_1_5_higher=En Linux, aseg?rese de que la variable de entorno JAVA_HOME apunta a un JDK 1.5 ? superior
12
_On_Windows_run_JDK_use_devel_exe=En Windows, aseg?rese de que gvSIG se ejecuta sobre un JDK y use 'gvsig-desktop-devel.exe' para iniciarlo
13
_Make_maven_project_plugin=Complemento para crear proyecto maven
14
_Requirements_for_this_plugin=Requisitos para este plugin
15
_Mandatory_platform_properties_file_not_found=No se ha encontrado el archivo necesario: [USUARIO]/.gvsig.platform.properties
16
_Use_this_text_editor_to_write_it=Use este editor de texto para crearlo
17
_Cancel=Cancelar
18
_Suggested=Ejemplo
19
_Accept=Aceptar
20
_Save=Guardar
21
_Checking_platform_properties=Comprobando propiedades del sistema
22
_There_are_unsaved_changes_Continue_question=Hay cambios no guardados. ?Desea continuar?
23
_Not_saved=No se ha guardado
24
_Unable_to_store_file=No se pudo guardar archivo
25
_Error=Error
26

  
27

  
tags/v2_0_0_Build_2058/extensions/org.gvsig.mkmvnproject/src/main/resources/config/text_en.properties
1
_Java_compiler_not_found_near_current_JRE_nor_in_JAVA_HOME=Java compiler not found near current JRE nor in location pointed by JAVA_HOME
2
_Continue_question=Would you like to continue?
3
_Searching_JDK=Searching JDK
4
_gvSIG_is_running_on_JDK=gvSIG is running on JDK
5
_gvSIG_is_not_running_on_JDK=gvSIG is not running on JDK
6
_JAVA_HOME_is_not_set=Environment variable JAVA_HOME is not set
7
_JAVA_HOME_is_set_to=Environment variable JAVA_HOME is set to
8
_You_might_need_to_run_gvSIG_on_JDK_or_set_JAVA_HOME_properly=You might need to run gvSIG on JDK or set JAVA_HOME properly
9
_Visit_gvSIG_website_for_details=Visit gvSIG website for details
10
_Detected_settings=Detected settings
11
_On_Linux_make_JAVA_HOME_point_to_JDK_1_5_higher=On Linux, make sure the environment variable JAVA_HOME points at JDK 1.5 or higher
12
_On_Windows_run_JDK_use_devel_exe=On Windows, make sure you are running gvSIG on a JDK and start it with 'gvsig-desktop-devel.exe'
13
_Make_maven_project_plugin=Make maven project plugin
14
_Requirements_for_this_plugin=Requirements for this plugin
15
_Mandatory_platform_properties_file_not_found=Mandatory file not found: [USER]/.gvsig.platform.properties
16
_Use_this_text_editor_to_write_it=Use this text editor to create it
17
_Cancel=Cancel
18
_Suggested=Example
19
_Accept=Accept
20
_Save=Save
21
_Checking_platform_properties=Checking platform properties
22
_There_are_unsaved_changes_Continue_question=There are unsaved changes. Continue anyway?
23
_Not_saved=Not saved
24
_Unable_to_store_file=Unable to store file
25
_Error=Error
tags/v2_0_0_Build_2058/extensions/org.gvsig.mkmvnproject/src/main/resources/config/config.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<plugin-config>
3
	<depends plugin-name="org.gvsig.app" />
4
	<resourceBundle name="text"/>
5
	<libraries library-dir="lib"/>
6
	<extensions>
7
		<extension class-name="org.gvsig.mkmvnproject.MakeMavenProjectExtension"
8
			description=""
9
			active="true"
10
			priority="1">
11
			<menu text="tools/Development/Create Plugin"
12
				position="7009080"
13
				action-command="gvSIGProjectWizard"/>
14
		</extension>		
15
	</extensions>
16
</plugin-config>
0 17

  
tags/v2_0_0_Build_2058/extensions/org.gvsig.mkmvnproject/src/main/resources/scripts/landregistryviewer.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<project name="gvSIG-make-maven-project" default="mkproject-build" basedir=".">
3

  
4
	<!-- Get current file location folder -->
5
	<dirname property="gvSIG-make-maven-project.basedir" file="${ant.file.gvSIG-make-maven-project}" />
6

  
7
	<!-- Libraries folder in the gvSIG extension -->
8
	<property name="lib.folder" location="${gvSIG-make-maven-project.basedir}/../lib" />
9
	<!-- Templates folder in the gvSIG extension -->
10
	<property name="templates.folder" location="${gvSIG-make-maven-project.basedir}/../templates" />
11

  
12
	<property name="gvsiglogo" location="${basedir}/../gvSIG.png" />
13

  
14
	<!-- Load some ant external utility tasks -->
15
	<property name="antform.lib" location="${lib.folder}/antform-2.0.jar" />
16
	<property name="antcontrib.lib" location="${lib.folder}/ant-contrib-1.0b3.jar" />
17
	<property name="antelope.lib" location="${lib.folder}/antelopetasks-3.2.10.jar" />
18

  
19
	<taskdef resource="net/sf/antcontrib/antlib.xml">
20
		<classpath>
21
			<pathelement location="${antcontrib.lib}" />
22
		</classpath>
23
	</taskdef>
24

  
25
	<taskdef name="antform" classname="com.sardak.antform.AntForm" classpath="${antform.lib}" />
26

  
27
	<taskdef name="antmenu" classname="com.sardak.antform.AntMenu" classpath="${antform.lib}" />
28

  
29
	<taskdef name="stringutil" classname="ise.antelope.tasks.StringUtilTask" classpath="${antelope.lib}" />
30

  
31
	<target name="mkproject-build-cancelled">
32
		<antform title="Project creation cancelled" width="${form.width}" image="${gvsiglogo}">
33
			<textProperty label="" editable="false" columns="40" property="form.title" />
34
			<label>Creation cancelled.</label>
35
			<separator />
36
			<controlbar>
37
				<button type="cancel" label=" Close " />
38
			</controlbar>
39
		</antform>
40
	</target>
41

  
42
	<target name="mkproject-build">
43
		<echo>
44
  Project name: "${project.name}"
45
  Project name capitalized: "${project.name.capitalized}"
46
  Project name lowercase: ${project.name.lowercase}"
47
  Group id: "${project.group.id}"
48
  ArtifactId: "${project.artifact.id}"
49
  Project folder: "${project.folder}"
50
        </echo>
51

  
52
		<echo>Unzipping the basic template project</echo>
53
		<unzip src="${templates.folder}/landregistryviewer.zip" dest="${project.folder}" />
54

  
55
		<!-- Calculate the project artifact id as PATH -->
56
		<propertyregex property="project.artifact.id.folder" input="${project.artifact.id}" regexp="([^\.]*).([^\.]*)" replace="\1${file.separator}\2" />
57

  
58
		<echo>Renaming folder ${project.folder}/org.gvsig.landregistryviewer to 
59
            ${project.folder}/${project.artifact.id}</echo>
60

  
61
		<move todir="${project.folder}">
62
			<fileset dir="${project.folder}">
63
				<include name="org.gvsig.landregistryviewer/**/*.txt" />
64
				<include name="org.gvsig.landregistryviewer/**/*.java" />
65
				<include name="org.gvsig.landregistryviewer/**/*.xml" />
66
				<include name="org.gvsig.landregistryviewer/**/org.gvsig.tools.library.Library" />
67
				<include name="org.gvsig.landregistryviewer.app/**/org.gvsig.tools.library.Library" />
68
				<include name="org.gvsig.landregistryviewer.app/**/*.txt" />
69
				<include name="org.gvsig.landregistryviewer.app/**/*.xml" />
70
				<include name="org.gvsig.landregistryviewer.app/**/*.java" />
71
 			</fileset>
72
			<mapper>
73
				<filtermapper>
74
					<replacestring from="org.gvsig.landregistryviewer" to="${project.artifact.id}" />
75
					<replacestring from="org${file.separator}gvsig${file.separator}landregistryviewer" to="${project.artifact.id.folder}" />
76
					<replacestring from="LandRegistryViewer" to="${project.name.capitalized}" />
77
				</filtermapper>
78
			</mapper>
79
			<filterchain>
80
				<tokenfilter>
81
					<replacestring from="org.gvsig.landregistryviewer" to="${project.artifact.id}" />
82
				</tokenfilter>
83
				<tokenfilter>
84
					<replacestring from="LandRegistryViewer" to="${project.name.capitalized}" />
85
					<replacestring from="Land Registry Viewer" to="${project.name.capitalized}" />
86
					<replacestring from="gvsig-landregistryviewer" to="gvsig-${project.name.lowercase}" />
87
				</tokenfilter>
88
				<tokenfilter>
89
					<replacestring from="LandRegistryViewer" to="${project.name.capitalized}" />
90
					<replacestring from="Land Registry Viewer" to="${project.name.capitalized}" />
91
					<replacestring from="gvsig-landregistryviewer" to="gvsig-${project.name.lowercase}" />
92
				</tokenfilter>
93
			</filterchain>
94
		</move>
95
		<move todir="${project.folder}">
96
			<fileset dir="${project.folder}">
97
                                <include name="org.gvsig.landregistryviewer/**" />
98
                                <include name="org.gvsig.landregistryviewer.app/**" />
99
			</fileset>
100
			<mapper>
101
				<filtermapper>
102
					<replacestring from="org.gvsig.landregistryviewer" to="${project.artifact.id}" />
103
					<replacestring from="org${file.separator}gvsig${file.separator}landregistryviewer" to="${project.artifact.id.folder}" />
104
					<replacestring from="LandRegistryViewer" to="${project.name.capitalized}" />
105
				</filtermapper>
106
			</mapper>
107
		</move>
108
<!--
109
		<delete dir="${project.folder}/org.gvsig.landregistryviewer"/>
110
		<delete dir="${project.folder}/org.gvsig.landregistryviewer.app"/>
111
-->
112
	</target>
113

  
114

  
115
</project>
0 116

  
tags/v2_0_0_Build_2058/extensions/org.gvsig.mkmvnproject/src/main/resources/scripts/fortunecookies-basic.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<project name="gvSIG-make-cookies-basic-project" default="mkproject-build" basedir=".">
3

  
4
	<!-- Get current file location folder -->
5
	<dirname property="gvSIG-make-cookies-basic-project.basedir" file="${ant.file.gvSIG-make-cookies-basic-project}" />
6

  
7
	<target name="mkproject-build">
8
	    <ant dir="${gvSIG-make-cookies-basic-project.basedir}" antfile="fortunecookies.xml" target="mkproject-build-basic" />
9
	</target>
10

  
11
</project>
tags/v2_0_0_Build_2058/extensions/org.gvsig.mkmvnproject/src/main/resources/scripts/fortunecookies.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<project name="gvSIG-make-maven-project" default="mkproject-build-basic" basedir=".">
3

  
4
	<!-- Get current file location folder -->
5
	<dirname property="gvSIG-make-maven-project.basedir" file="${ant.file.gvSIG-make-maven-project}" />
6

  
7
	<!-- Libraries folder in the gvSIG extension -->
8
	<property name="lib.folder" location="${gvSIG-make-maven-project.basedir}/../lib" />
9
	<!-- Templates folder in the gvSIG extension -->
10
	<property name="templates.folder" location="${gvSIG-make-maven-project.basedir}/../templates" />
11

  
12
	<property name="gvsiglogo" location="${basedir}/../gvSIG.png" />
13

  
14
	<!-- Load some ant external utility tasks -->
15
	<property name="antform.lib" location="${lib.folder}/antform-2.0.jar" />
16
	<property name="antcontrib.lib" location="${lib.folder}/ant-contrib-1.0b3.jar" />
17
	<property name="antelope.lib" location="${lib.folder}/antelopetasks-3.2.10.jar" />
18

  
19
	<taskdef resource="net/sf/antcontrib/antlib.xml">
20
		<classpath>
21
			<pathelement location="${antcontrib.lib}" />
22
		</classpath>
23
	</taskdef>
24

  
25
	<taskdef name="antform" classname="com.sardak.antform.AntForm" classpath="${antform.lib}" />
26

  
27
	<taskdef name="antmenu" classname="com.sardak.antform.AntMenu" classpath="${antform.lib}" />
28

  
29
	<taskdef name="stringutil" classname="ise.antelope.tasks.StringUtilTask" classpath="${antelope.lib}" />
30

  
31
	<target name="mkproject-build-cancelled">
32
		<antform title="Project creation cancelled" width="${form.width}" image="${gvsiglogo}">
33
			<textProperty label="" editable="false" columns="40" property="form.title" />
34
			<label>Creation cancelled.</label>
35
			<separator />
36
			<controlbar>
37
				<button type="cancel" label=" Close " />
38
			</controlbar>
39
		</antform>
40
	</target>
41

  
42
    <target name="mkproject-build-basic">
43
        <antcall target="mkproject-build">
44
            <param name="project.type" value="1" />
45
        </antcall>
46
    </target>
47
    
48
    <target name="mkproject-build-provider">
49
        <antcall target="mkproject-build">
50
            <param name="project.type" value="2" />
51
        </antcall>
52
    </target>
53
    
54
	<target name="mkproject-build">
55
		<echo>
56
  Project name: "${project.name}"
57
  Project name capitalized: "${project.name.capitalized}"
58
  Project name lowercase: ${project.name.lowercase}"
59
  Group id: "${project.group.id}"
60
  ArtifactId: "${project.artifact.id}"
61
  Project folder: "${project.folder}"
62
  Project type: "${project.type}"
63
        </echo>
64

  
65
		<if>
66
			<equals arg1="${project.type}" arg2="1" />
67
			<then>
68
				<echo>Unzipping the basic template project</echo>
69
				<unzip src="${templates.folder}/fortunecookies-basic.zip" dest="${project.folder}" />
70
			</then>
71
			<else>
72
				<echo>Unzipping the provider based implementation template project</echo>
73
				<unzip src="${templates.folder}/fortunecookies-pbi.zip" dest="${project.folder}" />
74
			</else>
75
		</if>
76

  
77
		<!-- Calculate the project artifact id as PATH -->
78
		<propertyregex property="project.artifact.id.folder" input="${project.artifact.id}" regexp="([^\.]*).([^\.]*)" replace="\1${file.separator}\2" />
79

  
80
		<echo>Renaming folder ${project.folder}/org.gvsig.fortunecookies to 
81
            ${project.folder}/${project.artifact.id}</echo>
82
		<move todir="${project.folder}">
83
			<fileset dir="${project.folder}">
84
				<include name="org.gvsig.fortunecookies/**" />
85
				<include name="org.gvsig.fortunecookies.app/**" />
86
			</fileset>
87
			<mapper>
88
				<filtermapper>
89
					<replacestring from="org.gvsig.fortunecookies" to="${project.artifact.id}" />
90
					<replacestring from="org${file.separator}gvsig${file.separator}fortunecookies" to="${project.artifact.id.folder}" />
91
					<replacestring from="FortuneCookie" to="${project.name.capitalized}" />
92
				</filtermapper>
93
			</mapper>
94
			<filterchain>
95
				<tokenfilter>
96
					<!-- Replace fortune cookie server url as it contains the FortuneCookie word in it. -->
97
					<replacestring from="http://www.fullerdata.com/FortuneCookie/FortuneCookie.asmx/GetFortuneCookie" to="FC_URL_TO_PRESERVE" />
98
				</tokenfilter>
99
				<tokenfilter>
100
					<replacestring from="org.gvsig.fortunecookies" to="${project.artifact.id}" />
101
				</tokenfilter>
102
				<tokenfilter>
103
					<replacestring from="FortuneCookies" to="${project.name.capitalized}" />
104
					<replacestring from="Fortune Cookies" to="${project.name.capitalized}" />
105
					<replacestring from="Fortune cookies" to="${project.name.capitalized}" />
106
					<replacestring from="fortune cookies" to="${project.name.capitalized}" />
107
					<replacestring from="gvsig-fortunecookies" to="gvsig-${project.name.lowercase}" />
108
					<replacestring from="fortunecookies" to="${project.name.capitalized}" />
109
				</tokenfilter>
110
				<tokenfilter>
111
					<replacestring from="FortuneCookie" to="${project.name.capitalized}" />
112
					<replacestring from="Fortune Cookie" to="${project.name.capitalized}" />
113
					<replacestring from="Fortune cookie" to="${project.name.capitalized}" />
114
					<replacestring from="fortune cookie" to="${project.name.capitalized}" />
115
					<replacestring from="gvsig-fortunecookie" to="gvsig-${project.name.lowercase}" />
116
					<replacestring from="fortunecookie" to="${project.name.capitalized}" />
117
				</tokenfilter>
118
				<tokenfilter>
119
					<!-- Restore the fortune cookie server URL -->
120
					<replacestring from="FC_URL_TO_PRESERVE" to="http://www.fullerdata.com/FortuneCookie/FortuneCookie.asmx/GetFortuneCookie" />
121
				</tokenfilter>
122
			</filterchain>
123
		</move>
124
		
125
	</target>
126

  
127

  
128
</project>
0 129

  
tags/v2_0_0_Build_2058/extensions/org.gvsig.mkmvnproject/src/main/resources/scripts/mkmvnproject.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<project name="gvSIG-make-maven-project" default="mkproject" basedir=".">
3

  
4
	<!-- Get current file location folder -->
5
	<dirname property="gvSIG-make-maven-project.basedir" file="${ant.file.gvSIG-make-maven-project}" />
6

  
7
	<!-- Libraries folder in the gvSIG extension -->
8
	<property name="lib.folder" location="${gvSIG-make-maven-project.basedir}/../lib" />
9
	<!-- Templates folder in the gvSIG extension -->
10
	<property name="templates.folder" location="${gvSIG-make-maven-project.basedir}/../templates" />
11

  
12
	<property name="gvsiglogo" location="${basedir}/../gvSIG.png" />
13

  
14
	<!-- Load some ant external utility tasks -->
15
	<property name="antform.lib" location="${lib.folder}/antform-2.0.jar" />
16
	<property name="antcontrib.lib" location="${lib.folder}/ant-contrib-1.0b3.jar" />
17
	<property name="antelope.lib" location="${lib.folder}/antelopetasks-3.2.10.jar" />
18

  
19
	<property name="form.width" value="700" />
20
	<property name="form.height" value="550" />
21
	<property name="form.columns" value="40" />
22

  
23

  
24
	<taskdef resource="net/sf/antcontrib/antlib.xml">
25
		<classpath>
26
			<pathelement location="${antcontrib.lib}" />
27
		</classpath>
28
	</taskdef>
29

  
30
	<taskdef name="antform" classname="com.sardak.antform.AntForm" classpath="${antform.lib}" />
31

  
32
	<taskdef name="antmenu" classname="com.sardak.antform.AntMenu" classpath="${antform.lib}" />
33

  
34
	<taskdef name="stringutil" classname="ise.antelope.tasks.StringUtilTask" classpath="${antelope.lib}" />
35

  
36

  
37
	<!-- 
38
	================ begin specific code of templates ================= 
39
	-->
40
	<property name="template.fortunecookies-basic.option" value="1 - General project based on Fortune cookies basic example project" />
41
	<property name="template.fortunecookies-basic.description1" value="Create a general pourpose project with the multimodule" />
42
	<property name="template.fortunecookies-basic.description2" value="structure. It has no GEO logic and is based on a basic" />
43
	<property name="template.fortunecookies-basic.description3" value="API/implementation separation" />
44

  
45
    <property name="template.fortunecookies-provider.option" value="2 - General project based on Fortune cookies example project" />
46
    <property name="template.fortunecookies-provider.description1" value="Create a general pourpose project with the multimodule" />
47
    <property name="template.fortunecookies-provider.description2" value="structure. It has no GEO logic and is based on" />
48
    <property name="template.fortunecookies-provider.description3" value="API/SPI/implementation separation and providers"  />
49

  
50
	<property name="template.landregistryviewer.option" value="3 - Basic plugin with spatial support" />
51
	<property name="template.landregistryviewer.description1" value="Create a project based in the LandRegistryViewer example." />
52
	<property name="template.landregistryviewer.description2" value="Uses access to View, MapControl and datasources." />
53
	<property name="template.landregistryviewer.description3" value="" />
54

  
55
	<property name="templates" value="fortunecookies-basic,fortunecookies-provider,landregistryviewer" />
56
	<!-- 
57
	================ End specific code of templates ================= 
58
	-->
59

  
60
	<target name="mkproject" depends="mkproject-prompt-basic-data">
61
		<description>Creates a new gvSIG project</description>
62
	</target>
63

  
64
	<target name="mkproject-prompt-basic-data">
65

  
66
		<property name="project.group.id" value="org.gvsig" />
67

  
68
		<antform title="Create project" width="${form.width}" image="${gvsiglogo}">
69
			<textProperty label="" editable="false" columns="${form.columns}" property="form.title" />
70
			<textProperty label="Name : " property="project.name" required="true" />
71
			<label>                               For the project name, use the java class naming rules. 
72
                               Ex: FortuneCookie or LandRegistryViewer</label>
73
			<textProperty label="Group Id : " property="project.group.id" required="true" />
74

  
75
			<fileSelectionProperty label="Create project in : " property="project.folder" directoryChooser="true" editable="false" required="true" />
76
			<separator />
77
			<label>Select the template to use:</label>
78

  
79
			<!-- 
80
			================ begin specific code of templates ================= 
81
			-->
82
			<checkSelectionProperty property="template.landregistryviewer.check" values="${template.landregistryviewer.option}" label="" />
83
			<label>                                         ${template.landregistryviewer.description1}
84
                                         ${template.landregistryviewer.description2}
85
                                         ${template.landregistryviewer.description3}</label>
86

  
87
			<checkSelectionProperty property="template.fortunecookies-basic.check" values="${template.fortunecookies-basic.option}" label="" />
88
			<label>                                         ${template.fortunecookies-basic.description1}
89
                                         ${template.fortunecookies-basic.description2}
90
                                         ${template.fortunecookies-basic.description3}</label>
91
            <checkSelectionProperty property="template.fortunecookies-provider.check" values="${template.fortunecookies-provider.option}" label="" />
92
            <label>                                         ${template.fortunecookies-provider.description1}
93
                                         ${template.fortunecookies-provider.description2}
94
                                         ${template.fortunecookies-provider.description3}</label>
95
			<!-- 
96
			================ End specific code of templates ================= 
97
			-->
98
			<separator />
99
			<controlbar>
100
				<button type="cancel" label=" Cancel " target="mkproject-build-cancelled" />
101
				<button type="ok" label=" Next " target="mkproject-fixnames" />
102
			</controlbar>
103
		</antform>
104
	</target>
105

  
106
	<target name="mkproject-fixnames">
107

  
108
		<!-- Trim project name and group id -->
109
		<stringutil string="${project.name}" property="project.name">
110
			<trim />
111
		</stringutil>
112
		<stringutil string="${project.group.id}" property="project.group.id">
113
			<trim />
114
		</stringutil>
115

  
116
		<!-- Lower case project name -->
117
		<stringutil string="${project.name}" property="project.name.lowercase">
118
			<lowercase />
119
		</stringutil>
120

  
121
		<!-- Capitalize project name, just in case -->
122
		<stringutil string="${project.name}" property="project.name.capitalized.end">
123
			<substring beginindex="1" />
124
		</stringutil>
125
		<stringutil string="${project.name}" property="project.name.capitalized.beginning">
126
			<substring endindex="1" />
127
			<uppercase />
128
		</stringutil>
129
		<property name="project.name.capitalized" value="${project.name.capitalized.beginning}${project.name.capitalized.end}" />
130

  
131
		<!-- Create artifactID with project.group.id + . + project.name.lowercase -->
132
		<property name="project.artifact.id" value="${project.group.id}.${project.name.lowercase}" />
133

  
134
		<for list="${templates}" param="template">
135
			<sequential>
136
				<var name="template.name" value="@{template}" />
137
				<var name="check.name" value="template.${template.name}.check" />
138
				<propertycopy override="true" name="arg1" from="${check.name}" />
139
				<propertycopy override="true" name="arg2" from="template.${template.name}.option" />
140
				<if>
141
					<and>
142
						<isset property="selected.template" />
143
						<equals arg1="${arg1}" arg2="${arg2}" />
144
					</and>
145
					<then>
146
						<antcall target="fail">
147
							<param name="message" value="Only one template can be selected" />
148
						</antcall>
149
					</then>
150
				</if>
151
				<if>
152
					<equals arg1="${arg1}" arg2="${arg2}" />
153
					<then>
154
						<echo>selected.template = "${template.name}"</echo>
155
						<property name="selected.template" value="${template.name}" />
156
					</then>
157
				</if>
158
			</sequential>
159
		</for>
160
		<antcall target="mkproject-confirm" inheritall="true" />
161
	</target>
162

  
163
	<target name="mkproject-confirm">
164
		<antform title="Confirm the creation" width="${form.width}" image="${gvsiglogo}">
165
			<textProperty label="" editable="false" columns="${form.columns}" property="form.title" />
166
			<label>The data used for the creation of project are:</label>
167
			<textProperty label="Project" editable="false" property="project.name" />
168
			<textProperty label="Project name capitalized" editable="false" property="project.name.capitalized" />
169
			<textProperty label="Project name lowercase" editable="false" property="project.name.lowercase" />
170
			<textProperty label="Group Id" editable="false" property="project.group.id" />
171
			<textProperty label="Artifact Id" editable="false" property="project.artifact.id" />
172
			<textProperty label="Folder" editable="false" property="project.folder" />
173
			<textProperty label="Template" editable="false" property="selected.template" />
174
			<label>Continue ?</label>
175
			<separator />
176
			<controlbar>
177
				<button type="cancel" label=" Cancel " target="mkproject-build-cancelled" />
178
				<button type="ok" label=" Previous " target="mkproject-prompt-basic-data" />
179
				<button type="ok" label=" Next " target="mkproject-build" />
180
			</controlbar>
181
		</antform>
182
	</target>
183

  
184
	<target name="mkproject-build">
185
		<echo>
186
  Project name: "${project.name}"
187
  Project name capitalized: "${project.name.capitalized}"
188
  Project name lowercase: ${project.name.lowercase}"
189
  Group id: "${project.group.id}"
190
  ArtifactId: "${project.artifact.id}"
191
  Project folder: "${project.folder}"
192
  Selected template: "${selected.template}"
193
        </echo>
194
		<!--  call specific code of the selected template -->
195
		<ant antfile="${selected.template}.xml" inheritall="false">
196
			<property name="project.name" value="${project.name}" />
197
			<property name="project.name.capitalized" value="${project.name.capitalized}" />
198
			<property name="project.name.lowercase" value="${project.name.lowercase}" />
199
			<property name="project.group.id" value="${project.group.id}" />
200
			<property name="project.artifact.id" value="${project.artifact.id}" />
201
			<property name="project.folder" value="${project.folder}" />
202
			<property name="form.width" value="${form.width}" />
203
			<property name="form.height" value="${form.height}" />
204
			<property name="form.columns" value="${form.columns}" />
205
		</ant>
206
		<if>
207
			<resourceexists>
208
				<file file="${project.folder}/${project.artifact.id}" />
209
			</resourceexists>
210
			<then>
211
				<antcall target="mkproject-prepare-workspace" inheritall="true" />
212
				<antcall target="mkproject-build-succesfully" inheritall="true" />
213
			</then>
214
			<else>
215
				<antcall target="mkproject-build-cancelled" inheritall="true" />
216
			</else>
217
		</if>
218
	</target>
219

  
220
	<target name="mkproject-prepare-workspace">
221
		<ant dir="${project.folder}/${project.artifact.id}" antfile="prepare-workspace.xml" target="prepare-workspace" />
222
		<if>
223
			<resourceexists>
224
				<file file="${project.folder}/${project.artifact.id}.app" />
225
			</resourceexists>
226
			<then>
227
				<ant dir="${project.folder}/${project.artifact.id}.app" antfile="../org.gvsig.maven.base.build/maven-goals.xml" target="mvn-install-and-eclipse-eclipse" />
228
			</then>
229
		</if>
230
	</target>
231

  
232
	<target name="mkproject-build-succesfully">
233
		<antform title="Project creation" width="${form.width}" image="${gvsiglogo}">
234
			<textProperty label="" editable="false" columns="${form.columns}" property="form.title" />
235
			<label>Project ${project.name} was created succesfully</label>
236
			<controlbar>
237
				<button type="ok" label=" Close " />
238
			</controlbar>
239
		</antform>
240
	</target>
241

  
242
	<target name="mkproject-build-cancelled">
243
		<antform title="Project creation cancelled" width="${form.width}" image="${gvsiglogo}">
244
			<textProperty label="" editable="false" columns="40" property="form.title" />
245
			<label>Creation cancelled.</label>
246
			<separator />
247
			<controlbar>
248
				<button type="cancel" label=" Close " />
249
			</controlbar>
250
		</antform>
251
	</target>
252

  
253
	<target name="fail">
254
		<echo>${message}</echo>
255
		<fail message="${message}" />
256
	</target>
257

  
258
</project>
0 259

  
tags/v2_0_0_Build_2058/extensions/org.gvsig.mkmvnproject/src/main/resources/scripts/checkjdk.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<project name="check-jdk-project" default="default" basedir="..">
3
	
4
	<property name="src_folder" location="compilationcheck" />
5

  
6
	<target name="default">
7
		
8
		<javac srcdir="${src_folder}"
9
			destdir="${src_folder}"
10
			executable="${executable}"
11
			fork="true"
12
			debug="on" />
13
	</target>
14

  
15
</project>
tags/v2_0_0_Build_2058/extensions/org.gvsig.mkmvnproject/src/main/resources/scripts/fortunecookies-provider.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<project name="gvSIG-make-cookies-provider-project" default="mkproject-build" basedir=".">
3

  
4
	<!-- Get current file location folder -->
5
	<dirname property="gvSIG-make-cookies-provider-project.basedir" file="${ant.file.gvSIG-make-cookies-provider-project}" />
6

  
7
	<target name="mkproject-build">
8
	    <ant dir="${gvSIG-make-cookies-provider-project.basedir}" antfile="fortunecookies.xml" target="mkproject-build-provider" />
9
	</target>
10

  
11
</project>
tags/v2_0_0_Build_2058/extensions/org.gvsig.mkmvnproject/src/main/resources/compilationcheck/DummyClass.java
1
public class DummyClass extends Exception {
2
    
3
    public DummyClass() {
4
        super("X");
5
        method();
6
    }
7
    
8
    public void method() {
9
        System.out.println("Nothing to do here!");
10
    }
11

  
12
    
13
}
tags/v2_0_0_Build_2058/extensions/org.gvsig.mkmvnproject/src/main/java/org/gvsig/mkmvnproject/MakeMavenProjectExtension.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.mkmvnproject;
23

  
24
import java.awt.Component;
25
import java.awt.GridBagConstraints;
26
import java.io.File;
27
import java.io.IOException;
28
import java.net.URL;
29

  
30
import javax.swing.JOptionPane;
31

  
32
import org.apache.tools.ant.BuildListener;
33
import org.apache.tools.ant.DefaultLogger;
34
import org.apache.tools.ant.Project;
35
import org.apache.tools.ant.ProjectHelper;
36
import org.slf4j.Logger;
37
import org.slf4j.LoggerFactory;
38

  
39
import org.gvsig.andami.PluginServices;
40
import org.gvsig.andami.messages.NotificationManager;
41
import org.gvsig.andami.plugins.Extension;
42
import org.gvsig.andami.ui.mdiManager.IWindow;
43
import org.gvsig.i18n.Messages;
44
import org.gvsig.mkmvnproject.gui.CreatePluginConsoleWindow;
45
import org.gvsig.mkmvnproject.gui.settings.PlatformPropertiesWindow;
46

  
47
/**
48
 * Extension to launch the project creation from templates.
49
 * 
50
 * @author gvSIG team
51
 * @version $Id$
52
 */
53
public class MakeMavenProjectExtension extends Extension {
54

  
55
    private static final String ANT_BUILD_FILE = "mkmvnproject.xml";
56
    private static final String ANT_CHECK_JDK = "checkjdk.xml";
57

  
58
	private static final String ANT_TARGET = "mkproject";
59
	
60
	public static final String GVSIG_PLATFORM_PROPERTIES_FILE_NAME =
61
	    ".gvsig.platform.properties";
62

  
63
	private static final Logger LOG = LoggerFactory
64
			.getLogger(MakeMavenProjectExtension.class);
65

  
66
	private boolean enabled = true;
67

  
68
	private final Object lock = new Object();
69

  
70
	public void execute(String actionCommand) {
71
	    
72
	    /*
73
	     * Problem is that for some reason  dummy file cannot be
74
	     * compiled, but this plugin works (?)
75
	     * 
76
	    if (!checkJDK()) {
77
	        return;
78
	    }
79
	    */
80

  
81
	    if (!checkPlatformProperties()) {
82
	        return;
83
	    }
84
	    
85
        // ==========================================================
86
		// TODO: add support to parallel executions in Andami??
87

  
88
        // Create messages console
89
	    CreatePluginConsoleWindow console = null;
90

  
91
        if (console == null) {
92
            try {
93
                console = new CreatePluginConsoleWindow();
94
            } catch (IOException e) {
95
                NotificationManager.addWarning("Error creating the console", e);
96
            }
97
        }
98
        if (console != null) {
99
            PluginServices.getMDIManager().addWindow(console, GridBagConstraints.LAST_LINE_START);
100
        }
101

  
102
		try {
103
			// Disable extension so it can't be executed again.
104
			synchronized (lock) {
105
				enabled = false;
106
			}
107
			new CreatePluginThread(console).start();
108
		} finally {
109
			synchronized (lock) {
110
				// create plugin process finish. Enable extension.
111
				enabled = true;
112
			}
113
		}
114
	}
115

  
116
	/**
117
	 * Checks existence of file:
118
	 * 
119
	 * USER_HOME/.gvsig.platform.properties
120
	 * 
121
	 * If not present, show text area with suggested content.
122
	 * 
123
     * @return whether the mentioned file is present or the
124
     * user has created it here and accepts to continue.
125
     *  
126
     */
127
    private boolean checkPlatformProperties() {
128
        
129
        String user_home = System.getProperty("user.home");
130
        File the_file = new File(
131
            user_home +
132
            File.separator +
133
            GVSIG_PLATFORM_PROPERTIES_FILE_NAME);
134

  
135
        Component parent_window = getActiveWindowComponent();
136

  
137
        try {
138
            if (the_file.exists()) {
139
                // ok file exists
140
                LOG.info("Found platform properties file: "
141
                    + the_file.getAbsolutePath());
142
                return true;
143
            }
144
            
145
            boolean is_windows = isThisWindows();
146
            PlatformPropertiesWindow ppw = new PlatformPropertiesWindow(
147
                the_file, is_windows);
148
            PluginServices.getMDIManager().addCentredWindow(ppw);
149
            // it's a modal dialog
150
            return ppw.validSettings();
151
            
152
        } catch (Exception ex) {
153
            
154
            String _msg =
155
                Messages.getText("_Error_while_checking_platform_properties")
156
                + "\n\n[ " + ex.getMessage() + " ]";
157
            String _tit = Messages.getText(
158
                "_Checking_platform_properties");
159
            JOptionPane.showMessageDialog(
160
                parent_window,
161
                _msg, _tit,
162
                JOptionPane.ERROR_MESSAGE);
163
        }
164
        return false;
165
        
166
    }
167

  
168

  
169
    /**
170
     * @return whether we are running on a windows system
171
     */
172
    private boolean isThisWindows() {
173
        String os = System.getProperty("os.name").toLowerCase();
174
        return (os.indexOf("win") >= 0);
175
    }
176

  
177
    /**
178
     * Check and possibly show JDK and JAVA_HOME settings and
179
     * prompt user with suggestion.
180
     * 
181
     * @return whether JDK is detected or user accepts to
182
     * continue anyway
183
     */
184
    private boolean checkJDK() {
185
        
186
        boolean this_is_jdk = false;
187
        try {
188
            this_is_jdk = jdkAvailable();
189
        } catch (Exception ex) {
190
            LOG.info("While searching for JDK : " + ex.getMessage(), ex);
191
            this_is_jdk = false;
192
        }
193
        
194
        if (this_is_jdk) {
195
            return true;
196
        }
197
        
198
        String env_j_h = System.getenv("JAVA_HOME");
199
        
200
        String jdk_str = null;
201
        if (this_is_jdk) {
202
            jdk_str = Messages.getText("_gvSIG_is_running_on_JDK");
203
        } else {
204
            jdk_str = Messages.getText("_gvSIG_is_not_running_on_JDK");
205
        }
206
        
207
        String jh_str = null;
208
        if (env_j_h == null) {
209
            jh_str = Messages.getText("_JAVA_HOME_is_not_set");
210
        } else {
211
            jh_str = Messages.getText("_JAVA_HOME_is_set_to")
212
                + " '" + env_j_h + "'";
213
        }
214
        
215
        String recomm = "";
216
        if (true) { // !this_is_jdk && env_j_h == null) {
217
            recomm = "\n\n"
218
                + Messages.getText("_Requirements_for_this_plugin") + ":\n\n"
219
                + "- " + Messages.getText("_On_Linux_make_JAVA_HOME_point_to_JDK_1_5_higher");
220
            recomm = recomm + ".    \n- "
221
            + Messages.getText("_On_Windows_run_JDK_use_devel_exe") + ".";
222
        }
223
        
224
        String tot_msg = Messages.getText("_Detected_settings") + ":"
225
            + "\n\n"
226
            + "- " + jdk_str + "\n"
227
            + "- " + jh_str + "     " + recomm + "\n\n"
228
                + Messages.getText("_Continue_question");
229
            
230
        int opt = JOptionPane.showConfirmDialog(
231
            null, // getActiveWindowComponent(),
232
            tot_msg,
233
            Messages.getText("_Make_maven_project_plugin") + " - " + 
234
            Messages.getText("_Searching_JDK"),
235
            JOptionPane.YES_NO_OPTION,
236
            (recomm.length() == 0) ?
237
                JOptionPane.INFORMATION_MESSAGE : JOptionPane.WARNING_MESSAGE
238
            );
239
        
240
        return (opt == JOptionPane.YES_OPTION);
241
    }
242

  
243
    /**
244
     * @return
245
     */
246
    private Component getActiveWindowComponent() {
247
        
248
        IWindow iw = PluginServices.getMDIManager().getActiveWindow();
249
        if (iw instanceof Component) {
250
            return (Component) iw;
251
        } else {
252
            return null;
253
        }
254
    }
255

  
256

  
257
    private boolean jdkAvailable() throws Exception {
258
        
259
        ClassLoader loader = this.getClass().getClassLoader();
260
        URL class_file_url = loader.getResource("compilationcheck/DummyClass.class");
261
        File class_file = null;
262
        
263
        // deleting compiled test file if existed
264
        if (class_file_url != null) {
265
            class_file = new File(class_file_url.getFile());
266
            if (class_file.exists()) {
267
                class_file.delete();
268
            }
269
        }
270
        
271
        URL build = loader.getResource("scripts/" + ANT_CHECK_JDK);
272

  
273
        String execut = null;
274
        /*
275
        // first attempt: javac from JAVA_HOME
276
        execut =
277
            System.getenv().get("JAVA_HOME")
278
            + File.separator + "bin" + File.separator + "javac";
279
        
280
        if (execut != null) {
281
            this.runScript(build, "default", null, "executable", execut);
282
            class_file_url = loader.getResource("compilationcheck/DummyClass.class");
283
            if (class_file_url != null) {
284
                // OK, test file is not compiled
285
                return true;
286
            }
287
        }
288
        */
289
        
290
        // second attempt: java.home (jre)
291
        execut = System.getProperty("java.home");
292
        int ind = execut.lastIndexOf(File.separator);
293
        // one up, then bin/javac
294
        execut = execut.substring(0, ind)
295
            + File.separator
296
            + "bin" + File.separator + "javac";
297
        
298
        this.runScript(build, "default", null, "executable", execut);
299
        class_file_url = loader.getResource("compilationcheck/DummyClass.class");
300
        // if test file not compiled, then false
301
        return (class_file_url != null);
302
    }
303

  
304
    /**
305
	 * Thread to launch the ant base plugin creation project.
306
	 * 
307
	 * @author gvSIG Team
308
	 * @version $Id$
309
	 */
310
	private final class CreatePluginThread extends Thread {
311

  
312
		private final CreatePluginConsoleWindow console;
313

  
314
		/**
315
		 * Constructor.
316
		 * 
317
		 * @param console
318
		 */
319
		public CreatePluginThread(CreatePluginConsoleWindow console) {
320
			this.console = console;
321
			setName("Create plugin execution thread");
322
			setDaemon(true);
323
		}
324

  
325
		@Override
326
		public void run() {
327
			DefaultLogger log = new DefaultLogger();
328
			log.setMessageOutputLevel(Project.MSG_INFO);
329

  
330
			if (console != null) {
331
				log.setErrorPrintStream(console.getErrorPrintStream());
332
				log.setOutputPrintStream(console.getPrintStream());
333
			} else {
334
				LOG.warn("Console window not available, will use the default console for Ant");
335
				log.setErrorPrintStream(System.err);
336
				log.setOutputPrintStream(System.out);
337
			}
338

  
339
			
340
			
341
            ClassLoader loader = this.getClass().getClassLoader();
342
            URL build = loader.getResource("scripts/" + ANT_BUILD_FILE);
343
            runScript(build, ANT_TARGET, log);
344
		}
345
	}
346

  
347

  
348
	private void runScript(
349
	        URL build,
350
	        String target,
351
	        BuildListener blistener) {
352
	    
353
        runScript(build, target, blistener, null, null);
354
	    
355
	}
356

  
357
	private void runScript(
358
	    URL build,
359
	    String target,
360
	    BuildListener blistener,
361
	    String prop, String val) {
362
	    
363
	    LOG.info("Starting runScript:\n"
364
	        + "    build = " + build.toString() + "\n"
365
	        + "    property name = " + prop + "\n"
366
            + "    property value = " + val);
367
	        
368

  
369
        File file = new File(build.getFile());
370

  
371
        final Project ant = new Project();
372
        if (blistener != null) {
373
            ant.addBuildListener(blistener);
374
        }
375
        ant.setUserProperty("ant.file", file.getAbsolutePath());
376
        
377
        if (prop != null && val != null) {
378
            ant.setUserProperty(prop, val);
379
        }
380
        
381
        ant.init();
382
        ProjectHelper.getProjectHelper().parse(ant, file);
383

  
384
        LOG.info("Starting ant task with the file {} and the target {}",
385
                file, target);
386
        ant.executeTarget(target);
387
	}
388

  
389
	public void initialize() {
390
		// Nothing to do
391
	}
392

  
393
	public boolean isEnabled() {
394
		return enabled;
395
	}
396

  
397
	public boolean isVisible() {
398
		return true;
399
	}
400
	
401

  
402
}
0 403

  
tags/v2_0_0_Build_2058/extensions/org.gvsig.mkmvnproject/src/main/java/org/gvsig/mkmvnproject/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.fortunecookies package documentation</title>
7
</head>
8
<body>
9

  
10
	<p>gvSIG Project creation from templates plugins.</p>
11
	
12
	<p>
13
	It allows to create new development projects for gvSIG from templates.
14
	</p>
15

  
16
</body>
17
</html>
tags/v2_0_0_Build_2058/extensions/org.gvsig.mkmvnproject/src/main/java/org/gvsig/mkmvnproject/gui/CreatePluginConsoleWindow.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.mkmvnproject.gui;
23

  
24
import java.awt.Dimension;
25
import java.io.IOException;
26

  
27
import org.gvsig.andami.ui.mdiManager.IWindow;
28
import org.gvsig.andami.ui.mdiManager.IWindowListener;
29
import org.gvsig.andami.ui.mdiManager.WindowInfo;
30

  
31
/**
32
 * A gvSIG window which shows the execution log messages of the create plugin
33
 * process.
34
 * 
35
 * @author gvSIG Team
36
 * @version $Id$
37
 */
38
public class CreatePluginConsoleWindow extends CreatePluginConsolePanel
39
		implements IWindow, IWindowListener {
40

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

  
43
	private WindowInfo info;
44

  
45
	private Object profile = WindowInfo.EDITOR_PROFILE;
46

  
47
	/**
48
	 * Constructor.
49
	 * 
50
	 * @throws IOException
51
	 *             if there is an error creating the console streams
52
	 */
53
	public CreatePluginConsoleWindow() throws IOException {
54
		super();
55
		initializeWindow();
56
	}
57

  
58
	/**
59
	 * Constructor.
60
	 * 
61
	 * @param isDoubleBuffered
62
	 *            if the panel must be double buffered.
63
	 * @throws IOException
64
	 *             if there is an error creating the console streams
65
	 */
66
	public CreatePluginConsoleWindow(boolean isDoubleBuffered) throws IOException {
67
		super(isDoubleBuffered);
68
		initializeWindow();
69
	}
70

  
71
	/**
72
	 * Initializes the window.
73
	 */
74
	private void initializeWindow() {
75
		Dimension dimension = new Dimension(600, 300);
76
		setSize(dimension);
77
		int code = WindowInfo.ICONIFIABLE | WindowInfo.MAXIMIZABLE
78
				| WindowInfo.RESIZABLE | WindowInfo.MODELESSDIALOG;
79
		profile = WindowInfo.EDITOR_PROFILE;
80
		info = new WindowInfo(code);
81
		info.setTitle("Console");
82
		info.setMinimumSize(dimension);
83
	}
84

  
85
	public WindowInfo getWindowInfo() {
86
		return info;
87
	}
88

  
89
	public Object getWindowProfile() {
90
		return profile;
91
	}
92

  
93
	public void windowActivated() {
94
		// Nothing to do
95
	}
96

  
97
	public void windowClosed() {
98
		super.closeConsole();
99
	}
100

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

  
25
import java.awt.BorderLayout;
26
import java.awt.Font;
27
import java.awt.GridBagConstraints;
28
import java.awt.GridBagLayout;
29
import java.awt.GridLayout;
30
import java.awt.Insets;
31
import java.awt.event.ActionEvent;
32
import java.awt.event.ActionListener;
33
import java.io.File;
34
import java.io.FileOutputStream;
35
import java.io.IOException;
36

  
37
import javax.swing.JButton;
38
import javax.swing.JLabel;
39
import javax.swing.JOptionPane;
40
import javax.swing.JPanel;
41
import javax.swing.JScrollBar;
42
import javax.swing.JScrollPane;
43
import javax.swing.JTextArea;
44
import javax.swing.event.DocumentEvent;
45
import javax.swing.event.DocumentListener;
46

  
47
import org.slf4j.Logger;
48
import org.slf4j.LoggerFactory;
49

  
50
import org.gvsig.andami.PluginServices;
51
import org.gvsig.andami.ui.mdiManager.IWindow;
52
import org.gvsig.andami.ui.mdiManager.WindowInfo;
53
import org.gvsig.i18n.Messages;
54

  
55

  
56
/**
57
 * This dialog lets the user write the file .gvsig.platform.properties
58
 * 
59
 * @author jldominguez
60
 *
61
 */
62
public class PlatformPropertiesWindow extends JPanel
63
implements IWindow, ActionListener, DocumentListener {
64
    
65
    private static final Logger logger =
66
        LoggerFactory.getLogger(PlatformPropertiesWindow.class);
67
    
68
    private WindowInfo winfo = null;
69
    private File targetFile = null;
70
    private boolean isWindows = false;
71
    
72
    private JPanel northPanel = null;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff