Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 269201 | Differences between
and this patch

Collapse All | Expand All

(-)ui/org/eclipse/jdt/internal/ui/jarpackagerfat/FatJarRsrcUrlAntExporter.java (-4 / +35 lines)
Lines 10-15 Link Here
10
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 219530 [jar application] add Jar-in-Jar ClassLoader option
10
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 219530 [jar application] add Jar-in-Jar ClassLoader option
11
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 262766 [jar exporter] ANT file for Jar-in-Jar option contains relative path to jar-rsrc-loader.zip
11
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 262766 [jar exporter] ANT file for Jar-in-Jar option contains relative path to jar-rsrc-loader.zip
12
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 262763 [jar exporter] remove Built-By attribute in ANT files from Fat JAR Exporter
12
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 262763 [jar exporter] remove Built-By attribute in ANT files from Fat JAR Exporter
13
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 269201 [jar exporter] ant file produced by Export runnable jar contains absolut paths instead of relative to workspace
13
 *******************************************************************************/
14
 *******************************************************************************/
14
package org.eclipse.jdt.internal.ui.jarpackagerfat;
15
package org.eclipse.jdt.internal.ui.jarpackagerfat;
15
16
Lines 74-80 Link Here
74
75
75
	protected void buildANTScript(OutputStream outputStream, String projectName, IPath absJarfile, String mainClass, SourceInfo[] sourceInfos) throws IOException {
76
	protected void buildANTScript(OutputStream outputStream, String projectName, IPath absJarfile, String mainClass, SourceInfo[] sourceInfos) throws IOException {
76
77
77
		String absJarname= absJarfile.toString();
78
		String destDir= makeWorkspaceRelativePath(absJarfile.toFile().getParent());
79
		String destName= absJarfile.removeFileExtension().toFile().getName();
78
80
79
		DocumentBuilder docBuilder= null;
81
		DocumentBuilder docBuilder= null;
80
		DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance();
82
		DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance();
Lines 98-109 Link Here
98
		project.appendChild(comment);
100
		project.appendChild(comment);
99
		document.appendChild(project);
101
		document.appendChild(project);
100
102
103
		// <property name="workspace" location="C:/eclipse/workspace-runnableJar" />
104
		Element property= document.createElement("property"); //$NON-NLS-1$
105
		property.setAttribute("name", "workspace"); //$NON-NLS-1$ //$NON-NLS-2$
106
		property.setAttribute("location", getWorkspaceDir()); //$NON-NLS-1$ 
107
		project.appendChild(property);
108
109
		// <property name="destdir" location="c:/xx" />
110
		property= document.createElement("property"); //$NON-NLS-1$
111
		property.setAttribute("name", "destdir"); //$NON-NLS-1$ //$NON-NLS-2$
112
		property.setAttribute("location", destDir); //$NON-NLS-1$ 
113
		project.appendChild(property);
114
115
		// <property name="destname" value="runnableJarOutput" />
116
		property= document.createElement("property"); //$NON-NLS-1$
117
		property.setAttribute("name", "destname"); //$NON-NLS-1$ //$NON-NLS-2$
118
		property.setAttribute("value", destName); //$NON-NLS-1$ 
119
		project.appendChild(property);
120
121
		// <property name="destjar" location="${destdir}/${destname}.jar" />
122
		property= document.createElement("property"); //$NON-NLS-1$
123
		property.setAttribute("name", "destjar"); //$NON-NLS-1$ //$NON-NLS-2$
124
		property.setAttribute("location", "${destdir}" + File.separator + "${destname}.jar"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ 
125
		project.appendChild(property);
126
101
		Element target= document.createElement("target"); //$NON-NLS-1$
127
		Element target= document.createElement("target"); //$NON-NLS-1$
102
		target.setAttribute("name", "create_run_jar"); //$NON-NLS-1$ //$NON-NLS-2$
128
		target.setAttribute("name", "create_run_jar"); //$NON-NLS-1$ //$NON-NLS-2$
103
		project.appendChild(target);
129
		project.appendChild(target);
104
130
131
		// <mkdir dir="${destdir}" />
132
		Element mkdir= document.createElement("mkdir"); //$NON-NLS-1$
133
		mkdir.setAttribute("dir", "${destdir}"); //$NON-NLS-1$ //$NON-NLS-2$
134
		project.appendChild(mkdir);
135
105
		Element jar= document.createElement("jar"); //$NON-NLS-1$
136
		Element jar= document.createElement("jar"); //$NON-NLS-1$
106
		jar.setAttribute("destfile", absJarname); //$NON-NLS-1$s 
137
		jar.setAttribute("destfile", "${destjar}"); //$NON-NLS-1$ //$NON-NLS-2$s 
107
		target.appendChild(jar);
138
		target.appendChild(jar);
108
139
109
		Element manifest= document.createElement("manifest"); //$NON-NLS-1$
140
		Element manifest= document.createElement("manifest"); //$NON-NLS-1$
Lines 147-158 Link Here
147
			if (sourceInfo.isJar) {
178
			if (sourceInfo.isJar) {
148
				File jarFile= new File(sourceInfo.absPath);
179
				File jarFile= new File(sourceInfo.absPath);
149
				Element fileset= document.createElement("zipfileset"); //$NON-NLS-1$
180
				Element fileset= document.createElement("zipfileset"); //$NON-NLS-1$
150
				fileset.setAttribute("dir", jarFile.getParent()); //$NON-NLS-1$
181
				fileset.setAttribute("dir", makeWorkspaceRelativePath(jarFile.getParent())); //$NON-NLS-1$
151
				fileset.setAttribute("includes", jarFile.getName()); //$NON-NLS-1$ 
182
				fileset.setAttribute("includes", jarFile.getName()); //$NON-NLS-1$ 
152
				jar.appendChild(fileset);
183
				jar.appendChild(fileset);
153
			} else {
184
			} else {
154
				Element fileset= document.createElement("fileset"); //$NON-NLS-1$
185
				Element fileset= document.createElement("fileset"); //$NON-NLS-1$
155
				fileset.setAttribute("dir", sourceInfo.absPath); //$NON-NLS-1$
186
				fileset.setAttribute("dir", makeWorkspaceRelativePath(sourceInfo.absPath)); //$NON-NLS-1$
156
				jar.appendChild(fileset);
187
				jar.appendChild(fileset);
157
			}
188
			}
158
		}
189
		}
(-)ui/org/eclipse/jdt/internal/ui/jarpackagerfat/UnpackFatJarAntExporter.java (-4 / +37 lines)
Lines 10-18 Link Here
10
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 83258 [jar exporter] Deploy java application as executable jar
10
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 83258 [jar exporter] Deploy java application as executable jar
11
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 262766 [jar exporter] ANT file for Jar-in-Jar option contains relative path to jar-rsrc-loader.zip
11
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 262766 [jar exporter] ANT file for Jar-in-Jar option contains relative path to jar-rsrc-loader.zip
12
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 262763 [jar exporter] remove Built-By attribute in ANT files from Fat JAR Exporter
12
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 262763 [jar exporter] remove Built-By attribute in ANT files from Fat JAR Exporter
13
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 269201 [jar exporter] ant file produced by Export runnable jar contains absolut paths instead of relative to workspace
13
 *******************************************************************************/
14
 *******************************************************************************/
14
package org.eclipse.jdt.internal.ui.jarpackagerfat;
15
package org.eclipse.jdt.internal.ui.jarpackagerfat;
15
16
17
import java.io.File;
16
import java.io.FileOutputStream;
18
import java.io.FileOutputStream;
17
import java.io.IOException;
19
import java.io.IOException;
18
import java.io.OutputStream;
20
import java.io.OutputStream;
Lines 46-52 Link Here
46
48
47
	protected void buildANTScript(IPath antScriptLocation, String projectName, IPath absJarfile, String mainClass, SourceInfo[] sourceInfos) throws IOException {
49
	protected void buildANTScript(IPath antScriptLocation, String projectName, IPath absJarfile, String mainClass, SourceInfo[] sourceInfos) throws IOException {
48
		OutputStream outputStream= new FileOutputStream(antScriptLocation.toFile());
50
		OutputStream outputStream= new FileOutputStream(antScriptLocation.toFile());
49
		String absJarname= absJarfile.toString();
51
52
		String destDir= makeWorkspaceRelativePath(absJarfile.toFile().getParent());
53
		String destName= absJarfile.removeFileExtension().toFile().getName();
50
54
51
		DocumentBuilder docBuilder= null;
55
		DocumentBuilder docBuilder= null;
52
		DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance();
56
		DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance();
Lines 70-81 Link Here
70
		project.appendChild(comment);
74
		project.appendChild(comment);
71
		document.appendChild(project);
75
		document.appendChild(project);
72
76
77
		// <property name="workspace" location="C:/eclipse/workspace-runnableJar" />
78
		Element property= document.createElement("property"); //$NON-NLS-1$
79
		property.setAttribute("name", "workspace"); //$NON-NLS-1$ //$NON-NLS-2$
80
		property.setAttribute("location", getWorkspaceDir()); //$NON-NLS-1$ 
81
		project.appendChild(property);
82
83
		// <property name="destdir" location="c:/xx" />
84
		property= document.createElement("property"); //$NON-NLS-1$
85
		property.setAttribute("name", "destdir"); //$NON-NLS-1$ //$NON-NLS-2$
86
		property.setAttribute("location", destDir); //$NON-NLS-1$ 
87
		project.appendChild(property);
88
89
		// <property name="destname" value="runnableJarOutput" />
90
		property= document.createElement("property"); //$NON-NLS-1$
91
		property.setAttribute("name", "destname"); //$NON-NLS-1$ //$NON-NLS-2$
92
		property.setAttribute("value", destName); //$NON-NLS-1$ 
93
		project.appendChild(property);
94
95
		// <property name="destjar" location="${destdir}/${destname}.jar" />
96
		property= document.createElement("property"); //$NON-NLS-1$
97
		property.setAttribute("name", "destjar"); //$NON-NLS-1$ //$NON-NLS-2$
98
		property.setAttribute("location", "${destdir}" + File.separator + "${destname}.jar"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ 
99
		project.appendChild(property);
100
73
		Element target= document.createElement("target"); //$NON-NLS-1$
101
		Element target= document.createElement("target"); //$NON-NLS-1$
74
		target.setAttribute("name", "create_run_jar"); //$NON-NLS-1$ //$NON-NLS-2$
102
		target.setAttribute("name", "create_run_jar"); //$NON-NLS-1$ //$NON-NLS-2$
75
		project.appendChild(target);
103
		project.appendChild(target);
76
104
105
		// <mkdir dir="${destdir}" />
106
		Element mkdir= document.createElement("mkdir"); //$NON-NLS-1$
107
		mkdir.setAttribute("dir", "${destdir}"); //$NON-NLS-1$ //$NON-NLS-2$
108
		project.appendChild(mkdir);
109
77
		Element jar= document.createElement("jar"); //$NON-NLS-1$
110
		Element jar= document.createElement("jar"); //$NON-NLS-1$
78
		jar.setAttribute("destfile", absJarname); //$NON-NLS-1$s
111
		jar.setAttribute("destfile", "${destjar}"); //$NON-NLS-1$ //$NON-NLS-2$
79
		jar.setAttribute("filesetmanifest", "mergewithoutmain"); //$NON-NLS-1$ //$NON-NLS-2$
112
		jar.setAttribute("filesetmanifest", "mergewithoutmain"); //$NON-NLS-1$ //$NON-NLS-2$
80
		target.appendChild(jar);
113
		target.appendChild(jar);
81
114
Lines 96-107 Link Here
96
			SourceInfo sourceInfo= sourceInfos[i];
129
			SourceInfo sourceInfo= sourceInfos[i];
97
			if (sourceInfo.isJar) {
130
			if (sourceInfo.isJar) {
98
				Element zipfileset= document.createElement("zipfileset"); //$NON-NLS-1$
131
				Element zipfileset= document.createElement("zipfileset"); //$NON-NLS-1$
99
				zipfileset.setAttribute("src", sourceInfo.absPath); //$NON-NLS-1$
132
				zipfileset.setAttribute("src", makeWorkspaceRelativePath(sourceInfo.absPath)); //$NON-NLS-1$
100
				zipfileset.setAttribute("excludes", "META-INF/*.SF"); //$NON-NLS-1$ //$NON-NLS-2$
133
				zipfileset.setAttribute("excludes", "META-INF/*.SF"); //$NON-NLS-1$ //$NON-NLS-2$
101
				jar.appendChild(zipfileset);
134
				jar.appendChild(zipfileset);
102
			} else {
135
			} else {
103
				Element fileset= document.createElement("fileset"); //$NON-NLS-1$
136
				Element fileset= document.createElement("fileset"); //$NON-NLS-1$
104
				fileset.setAttribute("dir", sourceInfo.absPath); //$NON-NLS-1$
137
				fileset.setAttribute("dir", makeWorkspaceRelativePath(sourceInfo.absPath)); //$NON-NLS-1$
105
				jar.appendChild(fileset);
138
				jar.appendChild(fileset);
106
			}
139
			}
107
		}
140
		}
(-)ui/org/eclipse/jdt/internal/ui/jarpackagerfat/UnpackJarAntExporter.java (-12 / +53 lines)
Lines 10-15 Link Here
10
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 219530 [jar application] add Jar-in-Jar ClassLoader option
10
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 219530 [jar application] add Jar-in-Jar ClassLoader option
11
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 262766 [jar exporter] ANT file for Jar-in-Jar option contains relative path to jar-rsrc-loader.zip
11
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 262766 [jar exporter] ANT file for Jar-in-Jar option contains relative path to jar-rsrc-loader.zip
12
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 262763 [jar exporter] remove Built-By attribute in ANT files from Fat JAR Exporter
12
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 262763 [jar exporter] remove Built-By attribute in ANT files from Fat JAR Exporter
13
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 269201 [jar exporter] ant file produced by Export runnable jar contains absolut paths instead of relative to workspace
13
 *******************************************************************************/
14
 *******************************************************************************/
14
package org.eclipse.jdt.internal.ui.jarpackagerfat;
15
package org.eclipse.jdt.internal.ui.jarpackagerfat;
15
16
Lines 50-58 Link Here
50
51
51
	protected void buildANTScript(IPath antScriptLocation, String projectName, IPath absJarfile, String mainClass, SourceInfo[] sourceInfos) throws IOException {
52
	protected void buildANTScript(IPath antScriptLocation, String projectName, IPath absJarfile, String mainClass, SourceInfo[] sourceInfos) throws IOException {
52
		OutputStream outputStream = new FileOutputStream(antScriptLocation.toFile());
53
		OutputStream outputStream = new FileOutputStream(antScriptLocation.toFile());
53
		String absJarname= absJarfile.toString();
54
54
		String subfolder= absJarfile.removeFileExtension().lastSegment() + "_lib"; //$NON-NLS-1$
55
		String destDir= makeWorkspaceRelativePath(absJarfile.toFile().getParent());
55
		String absSubfolder= absJarfile.removeLastSegments(1).append(subfolder).toString();
56
		String destName= absJarfile.removeFileExtension().lastSegment();
56
57
57
		DocumentBuilder docBuilder= null;
58
		DocumentBuilder docBuilder= null;
58
		DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance();
59
		DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance();
Lines 76-87 Link Here
76
		project.appendChild(comment);
77
		project.appendChild(comment);
77
		document.appendChild(project);
78
		document.appendChild(project);
78
79
80
		// <property name="workspace" location="C:/eclipse/workspace-runnableJar" />
81
		Element property= document.createElement("property"); //$NON-NLS-1$
82
		property.setAttribute("name", "workspace"); //$NON-NLS-1$ //$NON-NLS-2$
83
		property.setAttribute("location", getWorkspaceDir()); //$NON-NLS-1$ 
84
		project.appendChild(property);
85
86
		// <property name="destdir" location="c:/xx" />
87
		property= document.createElement("property"); //$NON-NLS-1$
88
		property.setAttribute("name", "destdir"); //$NON-NLS-1$ //$NON-NLS-2$
89
		property.setAttribute("location", destDir); //$NON-NLS-1$ 
90
		project.appendChild(property);
91
92
		// <property name="destname" value="runnableJarOutput" />
93
		property= document.createElement("property"); //$NON-NLS-1$
94
		property.setAttribute("name", "destname"); //$NON-NLS-1$ //$NON-NLS-2$
95
		property.setAttribute("value", destName); //$NON-NLS-1$ 
96
		project.appendChild(property);
97
98
		// <property name="destjar" location="${destdir}/${destname}.jar" />
99
		property= document.createElement("property"); //$NON-NLS-1$
100
		property.setAttribute("name", "destjar"); //$NON-NLS-1$ //$NON-NLS-2$
101
		property.setAttribute("location", "${destdir}" + File.separator + "${destname}.jar"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ 
102
		project.appendChild(property);
103
104
		// <property name="subdirname" value="${destname}_lib" />
105
		property= document.createElement("property"); //$NON-NLS-1$
106
		property.setAttribute("name", "subdirname"); //$NON-NLS-1$ //$NON-NLS-2$
107
		property.setAttribute("value", "${destname}_lib"); //$NON-NLS-1$ //$NON-NLS-2$ 
108
		project.appendChild(property);
109
110
		// <property name="subdir" location="${destdir}/${subdirname}" />
111
		property= document.createElement("property"); //$NON-NLS-1$
112
		property.setAttribute("name", "subdir"); //$NON-NLS-1$ //$NON-NLS-2$
113
		property.setAttribute("location", "${destdir}" + File.separator + "${subdirname}"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ 
114
		project.appendChild(property);
115
79
		Element target= document.createElement("target"); //$NON-NLS-1$
116
		Element target= document.createElement("target"); //$NON-NLS-1$
80
		target.setAttribute("name", "create_run_jar"); //$NON-NLS-1$ //$NON-NLS-2$
117
		target.setAttribute("name", "create_run_jar"); //$NON-NLS-1$ //$NON-NLS-2$
81
		project.appendChild(target);
118
		project.appendChild(target);
82
119
120
		// <mkdir dir="${destdir}" />
121
		Element mkdir= document.createElement("mkdir"); //$NON-NLS-1$
122
		mkdir.setAttribute("dir", "${destdir}"); //$NON-NLS-1$ //$NON-NLS-2$
123
		project.appendChild(mkdir);
124
83
		Element jar= document.createElement("jar"); //$NON-NLS-1$
125
		Element jar= document.createElement("jar"); //$NON-NLS-1$
84
		jar.setAttribute("destfile", absJarname); //$NON-NLS-1$s 
126
		jar.setAttribute("destfile", "${destjar}"); //$NON-NLS-1$ //$NON-NLS-2$ 
85
		target.appendChild(jar);
127
		target.appendChild(jar);
86
128
87
		Element manifest= document.createElement("manifest"); //$NON-NLS-1$
129
		Element manifest= document.createElement("manifest"); //$NON-NLS-1$
Lines 99-105 Link Here
99
		for (int i= 0; i < sourceInfos.length; i++) {
141
		for (int i= 0; i < sourceInfos.length; i++) {
100
			SourceInfo sourceInfo= sourceInfos[i];
142
			SourceInfo sourceInfo= sourceInfos[i];
101
			if (sourceInfo.isJar) {
143
			if (sourceInfo.isJar) {
102
				classPath.append(" ").append(subfolder).append("/") //$NON-NLS-1$ //$NON-NLS-2$
144
				classPath.append(" ").append("${subdirname}").append("/") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
103
						.append(new File(sourceInfo.absPath).getName());
145
						.append(new File(sourceInfo.absPath).getName());
104
			}
146
			}
105
		}
147
		}
Lines 111-128 Link Here
111
			SourceInfo sourceInfo= sourceInfos[i];
153
			SourceInfo sourceInfo= sourceInfos[i];
112
			if (!sourceInfo.isJar) {
154
			if (!sourceInfo.isJar) {
113
				Element fileset= document.createElement("fileset"); //$NON-NLS-1$
155
				Element fileset= document.createElement("fileset"); //$NON-NLS-1$
114
				fileset.setAttribute("dir", sourceInfo.absPath); //$NON-NLS-1$
156
				fileset.setAttribute("dir", makeWorkspaceRelativePath(sourceInfo.absPath)); //$NON-NLS-1$
115
				jar.appendChild(fileset);
157
				jar.appendChild(fileset);
116
			}
158
			}
117
		}
159
		}
118
160
119
		
120
		Element delete= document.createElement("delete"); //$NON-NLS-1$
161
		Element delete= document.createElement("delete"); //$NON-NLS-1$
121
		delete.setAttribute("dir", absSubfolder); //$NON-NLS-1$s 
162
		delete.setAttribute("dir", "${subdir}"); //$NON-NLS-1$ //$NON-NLS-2$s 
122
		target.appendChild(delete);
163
		target.appendChild(delete);
123
164
124
		Element mkdir= document.createElement("mkdir"); //$NON-NLS-1$
165
		mkdir= document.createElement("mkdir"); //$NON-NLS-1$
125
		mkdir.setAttribute("dir", absSubfolder); //$NON-NLS-1$s 
166
		mkdir.setAttribute("dir", "${subdir}"); //$NON-NLS-1$ //$NON-NLS-2$s 
126
		target.appendChild(mkdir);
167
		target.appendChild(mkdir);
127
168
128
		// add libraries
169
		// add libraries
Lines 130-137 Link Here
130
			SourceInfo sourceInfo= sourceInfos[i];
171
			SourceInfo sourceInfo= sourceInfos[i];
131
			if (sourceInfo.isJar) {
172
			if (sourceInfo.isJar) {
132
				Element copy= document.createElement("copy"); //$NON-NLS-1$
173
				Element copy= document.createElement("copy"); //$NON-NLS-1$
133
				copy.setAttribute("file", sourceInfo.absPath); //$NON-NLS-1$
174
				copy.setAttribute("file", makeWorkspaceRelativePath(sourceInfo.absPath)); //$NON-NLS-1$
134
				copy.setAttribute("todir", absSubfolder); //$NON-NLS-1$
175
				copy.setAttribute("todir", "${subdir}"); //$NON-NLS-1$ //$NON-NLS-2$
135
				target.appendChild(copy);
176
				target.appendChild(copy);
136
			}
177
			}
137
		}
178
		}
(-)ui/org/eclipse/jdt/internal/ui/jarpackagerfat/FatJarAntExporter.java (+30 lines)
Lines 11-19 Link Here
11
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 220257 [jar application] ANT build file does not create Class-Path Entry in Manifest
11
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 220257 [jar application] ANT build file does not create Class-Path Entry in Manifest
12
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 219530 [jar application] add Jar-in-Jar ClassLoader option
12
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 219530 [jar application] add Jar-in-Jar ClassLoader option
13
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 262766 [jar exporter] ANT file for Jar-in-Jar option contains relative path to jar-rsrc-loader.zip
13
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 262766 [jar exporter] ANT file for Jar-in-Jar option contains relative path to jar-rsrc-loader.zip
14
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 269201 [jar exporter] ant file produced by Export runnable jar contains absolut paths instead of relative to workspace
14
 *******************************************************************************/
15
 *******************************************************************************/
15
package org.eclipse.jdt.internal.ui.jarpackagerfat;
16
package org.eclipse.jdt.internal.ui.jarpackagerfat;
16
17
18
import java.io.File;
17
import java.io.FileNotFoundException;
19
import java.io.FileNotFoundException;
18
import java.io.IOException;
20
import java.io.IOException;
19
import java.util.ArrayList;
21
import java.util.ArrayList;
Lines 25-30 Link Here
25
import org.eclipse.core.runtime.Path;
27
import org.eclipse.core.runtime.Path;
26
import org.eclipse.core.runtime.Status;
28
import org.eclipse.core.runtime.Status;
27
29
30
import org.eclipse.core.resources.ResourcesPlugin;
31
28
import org.eclipse.debug.core.ILaunchConfiguration;
32
import org.eclipse.debug.core.ILaunchConfiguration;
29
33
30
import org.eclipse.jdt.internal.corext.util.Messages;
34
import org.eclipse.jdt.internal.corext.util.Messages;
Lines 64-69 Link Here
64
	private IPath fAbsJarfile;
68
	private IPath fAbsJarfile;
65
	private IPath fAntScriptLocation;
69
	private IPath fAntScriptLocation;
66
70
71
	private String fWorkspaceDir;
72
67
	/**
73
	/**
68
	 * Create an instance of the ANT exporter. An ANT exporter can generate an ANT script
74
	 * Create an instance of the ANT exporter. An ANT exporter can generate an ANT script
69
	 * at the given ant script location for the given launch configuration
75
	 * at the given ant script location for the given launch configuration
Lines 75-80 Link Here
75
		fLaunchConfiguration= launchConfiguration;
81
		fLaunchConfiguration= launchConfiguration;
76
		fAbsJarfile= jarLocation;
82
		fAbsJarfile= jarLocation;
77
		fAntScriptLocation= antScriptLocation;
83
		fAntScriptLocation= antScriptLocation;
84
		try {
85
			fWorkspaceDir= ResourcesPlugin.getWorkspace().getRoot().getLocation().toFile().getCanonicalPath();
86
		} catch (Exception e) {
87
			JavaPlugin.log(e);
88
			fWorkspaceDir= "?"; //$NON-NLS-1$
89
		}
78
	}
90
	}
79
91
80
	/**
92
	/**
Lines 164-169 Link Here
164
		return result;
176
		return result;
165
	}
177
	}
166
178
179
	protected String getWorkspaceDir() {
180
		return fWorkspaceDir;
181
	}
182
183
	protected String makeWorkspaceRelativePath(String path) {
184
		String variablePath;
185
		try {
186
			variablePath= new File(path).getCanonicalPath().toString();
187
			if (variablePath.equals(getWorkspaceDir()))
188
				return "${workspace}"; //$NON-NLS-1$
189
			if (variablePath.startsWith(getWorkspaceDir() + File.separator))
190
				return "${workspace}" + variablePath.substring(getWorkspaceDir().length()); //$NON-NLS-1$
191
		} catch (IOException e) {
192
			JavaPlugin.log(e);
193
		}
194
		return path;
195
	}
196
167
	/**
197
	/**
168
	 * Create an ANT script at the given location.
198
	 * Create an ANT script at the given location.
169
	 * 
199
	 * 

Return to bug 269201