Lines 1-470
Link Here
|
1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2006, 2009 IBM Corporation and others. |
2 |
* Copyright (c) 2006, 2010 IBM Corporation and others. |
3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
6 |
* http://www.eclipse.org/legal/epl-v10.html |
6 |
* http://www.eclipse.org/legal/epl-v10.html |
7 |
* |
7 |
* |
8 |
* Contributors: |
8 |
* Contributors: |
9 |
* IBM Corporation - initial API and implementation |
9 |
* IBM Corporation - initial API and implementation |
10 |
*******************************************************************************/ |
10 |
*******************************************************************************/ |
11 |
package org.eclipse.pde.internal.core.exports; |
11 |
package org.eclipse.pde.internal.core.exports; |
12 |
|
12 |
|
13 |
import java.io.*; |
13 |
import java.io.*; |
14 |
import java.lang.reflect.InvocationTargetException; |
14 |
import java.lang.reflect.InvocationTargetException; |
15 |
import java.net.MalformedURLException; |
15 |
import java.net.MalformedURLException; |
16 |
import java.net.URL; |
16 |
import java.net.URL; |
17 |
import java.util.*; |
17 |
import java.util.*; |
18 |
import org.eclipse.core.resources.IResource; |
18 |
import org.eclipse.core.resources.IResource; |
19 |
import org.eclipse.core.runtime.*; |
19 |
import org.eclipse.core.runtime.*; |
20 |
import org.eclipse.osgi.service.resolver.BundleDescription; |
20 |
import org.eclipse.osgi.service.resolver.BundleDescription; |
21 |
import org.eclipse.osgi.util.NLS; |
21 |
import org.eclipse.osgi.util.NLS; |
22 |
import org.eclipse.pde.core.plugin.*; |
22 |
import org.eclipse.pde.core.plugin.*; |
23 |
import org.eclipse.pde.internal.build.*; |
23 |
import org.eclipse.pde.internal.build.*; |
24 |
import org.eclipse.pde.internal.core.*; |
24 |
import org.eclipse.pde.internal.core.*; |
25 |
import org.eclipse.pde.internal.core.ifeature.IFeature; |
25 |
import org.eclipse.pde.internal.core.ifeature.IFeature; |
26 |
import org.eclipse.pde.internal.core.ifeature.IFeatureModel; |
26 |
import org.eclipse.pde.internal.core.ifeature.IFeatureModel; |
27 |
import org.eclipse.pde.internal.core.iproduct.*; |
27 |
import org.eclipse.pde.internal.core.iproduct.*; |
28 |
import org.eclipse.pde.internal.core.iproduct.IProduct; |
28 |
import org.eclipse.pde.internal.core.iproduct.IProduct; |
29 |
import org.eclipse.pde.internal.core.util.CoreUtility; |
29 |
import org.eclipse.pde.internal.core.util.CoreUtility; |
30 |
import org.w3c.dom.Element; |
30 |
import org.w3c.dom.Element; |
31 |
|
31 |
|
32 |
public class ProductExportOperation extends FeatureExportOperation { |
32 |
public class ProductExportOperation extends FeatureExportOperation { |
33 |
private static final String STATUS_MESSAGE = "!MESSAGE"; //$NON-NLS-1$ |
33 |
private static final String STATUS_MESSAGE = "!MESSAGE"; //$NON-NLS-1$ |
34 |
private static final String STATUS_ENTRY = "!ENTRY"; //$NON-NLS-1$ |
34 |
private static final String STATUS_ENTRY = "!ENTRY"; //$NON-NLS-1$ |
35 |
private static final String STATUS_SUBENTRY = "!SUBENTRY"; //$NON-NLS-1$ |
35 |
private static final String STATUS_SUBENTRY = "!SUBENTRY"; //$NON-NLS-1$ |
36 |
private static final String ECLIPSE_APP_MACOS = "Eclipse.app/Contents/MacOS"; //$NON-NLS-1$ |
36 |
private static final String ECLIPSE_APP_MACOS = "Eclipse.app/Contents/MacOS"; //$NON-NLS-1$ |
37 |
private static final String ECLIPSE_APP_CONTENTS = "Eclipse.app/Contents"; //$NON-NLS-1$ |
37 |
private static final String ECLIPSE_APP_CONTENTS = "Eclipse.app/Contents"; //$NON-NLS-1$ |
38 |
private String fFeatureLocation; |
38 |
private String fFeatureLocation; |
39 |
private String fRoot; |
39 |
private String fRoot; |
40 |
private IProduct fProduct; |
40 |
private IProduct fProduct; |
41 |
|
41 |
|
42 |
protected static String errorMessage; |
42 |
protected static String errorMessage; |
43 |
|
43 |
|
44 |
public static void setErrorMessage(String message) { |
44 |
public static void setErrorMessage(String message) { |
45 |
errorMessage = message; |
45 |
errorMessage = message; |
46 |
} |
46 |
} |
47 |
|
47 |
|
48 |
public static String getErrorMessage() { |
48 |
public static String getErrorMessage() { |
49 |
return errorMessage; |
49 |
return errorMessage; |
50 |
} |
50 |
} |
51 |
|
51 |
|
52 |
public static IStatus parseErrorMessage(CoreException e) { |
52 |
public static IStatus parseErrorMessage(CoreException e) { |
53 |
if (errorMessage == null) |
53 |
if (errorMessage == null) |
54 |
return null; |
54 |
return null; |
55 |
|
55 |
|
56 |
MultiStatus status = null; |
56 |
MultiStatus status = null; |
57 |
StringTokenizer tokenizer = new StringTokenizer(errorMessage, "\n"); //$NON-NLS-1$ |
57 |
StringTokenizer tokenizer = new StringTokenizer(errorMessage, "\n"); //$NON-NLS-1$ |
58 |
for (; tokenizer.hasMoreTokens();) { |
58 |
for (; tokenizer.hasMoreTokens();) { |
59 |
String line = tokenizer.nextToken().trim(); |
59 |
String line = tokenizer.nextToken().trim(); |
60 |
if (line.startsWith(STATUS_ENTRY) && tokenizer.hasMoreElements()) { |
60 |
if (line.startsWith(STATUS_ENTRY) && tokenizer.hasMoreElements()) { |
61 |
String next = tokenizer.nextToken(); |
61 |
String next = tokenizer.nextToken(); |
62 |
if (next.startsWith(STATUS_MESSAGE)) { |
62 |
if (next.startsWith(STATUS_MESSAGE)) { |
63 |
status = new MultiStatus(PDECore.PLUGIN_ID, 0, next.substring(8), null); |
63 |
status = new MultiStatus(PDECore.PLUGIN_ID, 0, next.substring(8), null); |
64 |
} |
64 |
} |
65 |
} else if (line.startsWith(STATUS_SUBENTRY) && tokenizer.hasMoreElements() && status != null) { |
65 |
} else if (line.startsWith(STATUS_SUBENTRY) && tokenizer.hasMoreElements() && status != null) { |
66 |
String next = tokenizer.nextToken(); |
66 |
String next = tokenizer.nextToken(); |
67 |
if (next.startsWith(STATUS_MESSAGE)) { |
67 |
if (next.startsWith(STATUS_MESSAGE)) { |
68 |
status.add(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, next.substring(8))); |
68 |
status.add(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, next.substring(8))); |
69 |
} |
69 |
} |
70 |
} |
70 |
} |
71 |
} |
71 |
} |
72 |
if (status != null) |
72 |
if (status != null) |
73 |
return status; |
73 |
return status; |
74 |
|
74 |
|
75 |
//parsing didn't work, just set the message |
75 |
//parsing didn't work, just set the message |
76 |
return new MultiStatus(PDECore.PLUGIN_ID, 0, new IStatus[] {e.getStatus()}, errorMessage, null); |
76 |
return new MultiStatus(PDECore.PLUGIN_ID, 0, new IStatus[] {e.getStatus()}, errorMessage, null); |
77 |
} |
77 |
} |
78 |
|
78 |
|
79 |
public ProductExportOperation(FeatureExportInfo info, String name, IProduct product, String root) { |
79 |
public ProductExportOperation(FeatureExportInfo info, String name, IProduct product, String root) { |
80 |
super(info, name); |
80 |
super(info, name); |
81 |
fProduct = product; |
81 |
fProduct = product; |
82 |
fRoot = root; |
82 |
fRoot = root; |
83 |
} |
83 |
} |
84 |
|
84 |
|
85 |
/* (non-Javadoc) |
85 |
/* (non-Javadoc) |
86 |
* @see org.eclipse.pde.internal.core.exports.FeatureExportOperation#run(org.eclipse.core.runtime.IProgressMonitor) |
86 |
* @see org.eclipse.pde.internal.core.exports.FeatureExportOperation#run(org.eclipse.core.runtime.IProgressMonitor) |
87 |
*/ |
87 |
*/ |
88 |
protected IStatus run(IProgressMonitor monitor) { |
88 |
protected IStatus run(IProgressMonitor monitor) { |
89 |
String[][] configurations = fInfo.targets; |
89 |
String[][] configurations = fInfo.targets; |
90 |
if (configurations == null) |
90 |
if (configurations == null) |
91 |
configurations = new String[][] {{TargetPlatform.getOS(), TargetPlatform.getWS(), TargetPlatform.getOSArch(), TargetPlatform.getNL()}}; |
91 |
configurations = new String[][] {{TargetPlatform.getOS(), TargetPlatform.getWS(), TargetPlatform.getOSArch(), TargetPlatform.getNL()}}; |
92 |
|
92 |
|
93 |
cleanupBuildRepo(); |
93 |
cleanupBuildRepo(); |
94 |
errorMessage = null; |
94 |
errorMessage = null; |
95 |
|
95 |
|
96 |
try { |
96 |
try { |
97 |
monitor.beginTask("", 10); //$NON-NLS-1$ |
97 |
monitor.beginTask("", 10); //$NON-NLS-1$ |
98 |
try { |
98 |
try { |
99 |
// create a feature to wrap all plug-ins and features |
99 |
// create a feature to wrap all plug-ins and features |
100 |
String featureID = "org.eclipse.pde.container.feature"; //$NON-NLS-1$ |
100 |
String featureID = "org.eclipse.pde.container.feature"; //$NON-NLS-1$ |
101 |
fFeatureLocation = fBuildTempLocation + File.separator + featureID; |
101 |
fFeatureLocation = fBuildTempLocation + File.separator + featureID; |
102 |
|
102 |
|
103 |
createFeature(featureID, fFeatureLocation, configurations, true); |
103 |
createFeature(featureID, fFeatureLocation, configurations, true); |
104 |
createBuildPropertiesFile(fFeatureLocation, configurations); |
104 |
createBuildPropertiesFile(fFeatureLocation, configurations); |
105 |
doExport(featureID, null, fFeatureLocation, configurations, new SubProgressMonitor(monitor, 8)); |
105 |
doExport(featureID, null, fFeatureLocation, configurations, new SubProgressMonitor(monitor, 8)); |
106 |
} catch (IOException e) { |
106 |
} catch (IOException e) { |
107 |
PDECore.log(e); |
107 |
PDECore.log(e); |
108 |
} catch (InvocationTargetException e) { |
108 |
} catch (InvocationTargetException e) { |
109 |
return new Status(IStatus.ERROR, PDECore.PLUGIN_ID, PDECoreMessages.FeatureBasedExportOperation_ProblemDuringExport, e.getTargetException()); |
109 |
return new Status(IStatus.ERROR, PDECore.PLUGIN_ID, PDECoreMessages.FeatureBasedExportOperation_ProblemDuringExport, e.getTargetException()); |
110 |
} catch (CoreException e) { |
110 |
} catch (CoreException e) { |
111 |
if (errorMessage != null) |
111 |
if (errorMessage != null) |
112 |
return parseErrorMessage(e); |
112 |
return parseErrorMessage(e); |
113 |
return e.getStatus(); |
113 |
return e.getStatus(); |
114 |
} finally { |
114 |
} finally { |
115 |
// Clean up generated files |
115 |
// Clean up generated files |
116 |
for (int j = 0; j < fInfo.items.length; j++) { |
116 |
for (int j = 0; j < fInfo.items.length; j++) { |
117 |
try { |
117 |
try { |
118 |
deleteBuildFiles(fInfo.items[j]); |
118 |
deleteBuildFiles(fInfo.items[j]); |
119 |
} catch (CoreException e) { |
119 |
} catch (CoreException e) { |
120 |
PDECore.log(e); |
120 |
PDECore.log(e); |
121 |
} |
121 |
} |
122 |
} |
122 |
} |
123 |
cleanup(null, new SubProgressMonitor(monitor, 1)); |
123 |
cleanup(null, new SubProgressMonitor(monitor, 1)); |
124 |
} |
124 |
} |
125 |
|
125 |
|
126 |
if (hasAntErrors()) { |
126 |
if (hasAntErrors()) { |
127 |
return new Status(IStatus.WARNING, PDECore.PLUGIN_ID, NLS.bind(PDECoreMessages.FeatureExportOperation_CompilationErrors, fInfo.destinationDirectory)); |
127 |
return new Status(IStatus.WARNING, PDECore.PLUGIN_ID, NLS.bind(PDECoreMessages.FeatureExportOperation_CompilationErrors, fInfo.destinationDirectory)); |
128 |
} |
128 |
} |
129 |
|
129 |
|
130 |
} finally { |
130 |
} finally { |
131 |
monitor.done(); |
131 |
monitor.done(); |
132 |
errorMessage = null; |
132 |
errorMessage = null; |
133 |
} |
133 |
} |
134 |
return Status.OK_STATUS; |
134 |
return Status.OK_STATUS; |
135 |
} |
135 |
} |
136 |
|
136 |
|
137 |
protected boolean groupedConfigurations() { |
137 |
protected boolean groupedConfigurations() { |
138 |
// we never group product exports |
138 |
// we never group product exports |
139 |
return false; |
139 |
return false; |
140 |
} |
140 |
} |
141 |
|
141 |
|
142 |
private void cleanupBuildRepo() { |
142 |
private void cleanupBuildRepo() { |
143 |
File metadataTemp = new File(fBuildTempMetadataLocation); |
143 |
File metadataTemp = new File(fBuildTempMetadataLocation); |
144 |
if (metadataTemp.exists()) { |
144 |
if (metadataTemp.exists()) { |
145 |
//make sure our build metadata repo is clean |
145 |
//make sure our build metadata repo is clean |
146 |
deleteDir(metadataTemp); |
146 |
deleteDir(metadataTemp); |
147 |
} |
147 |
} |
148 |
} |
148 |
} |
149 |
|
149 |
|
150 |
/* |
150 |
/* |
151 |
* (non-Javadoc) |
151 |
* (non-Javadoc) |
152 |
* |
152 |
* |
153 |
* @see org.eclipse.pde.internal.ui.wizards.exports.FeatureExportJob#getPaths() |
153 |
* @see org.eclipse.pde.internal.ui.wizards.exports.FeatureExportJob#getPaths() |
154 |
*/ |
154 |
*/ |
155 |
protected String[] getPaths() { |
155 |
protected String[] getPaths() { |
156 |
String[] paths = super.getPaths(); |
156 |
String[] paths = super.getPaths(); |
157 |
String[] all = new String[paths.length + 1]; |
157 |
String[] all = new String[paths.length + 1]; |
158 |
all[0] = fFeatureLocation + File.separator + "feature.xml"; //$NON-NLS-1$ |
158 |
all[0] = fFeatureLocation + File.separator + ICoreConstants.FEATURE_FILENAME_DESCRIPTOR; |
159 |
System.arraycopy(paths, 0, all, 1, paths.length); |
159 |
System.arraycopy(paths, 0, all, 1, paths.length); |
160 |
return all; |
160 |
return all; |
161 |
} |
161 |
} |
162 |
|
162 |
|
163 |
private void createBuildPropertiesFile(String featureLocation, String[][] configurations) { |
163 |
private void createBuildPropertiesFile(String featureLocation, String[][] configurations) { |
164 |
File file = new File(featureLocation); |
164 |
File file = new File(featureLocation); |
165 |
if (!file.exists() || !file.isDirectory()) |
165 |
if (!file.exists() || !file.isDirectory()) |
166 |
file.mkdirs(); |
166 |
file.mkdirs(); |
167 |
|
167 |
|
168 |
boolean hasLaunchers = PDECore.getDefault().getFeatureModelManager().getDeltaPackFeature() != null; |
168 |
boolean hasLaunchers = PDECore.getDefault().getFeatureModelManager().getDeltaPackFeature() != null; |
169 |
Properties properties = new Properties(); |
169 |
Properties properties = new Properties(); |
170 |
if (!hasLaunchers && configurations.length > 0) { |
170 |
if (!hasLaunchers && configurations.length > 0) { |
171 |
String rootPrefix = IBuildPropertiesConstants.ROOT_PREFIX + configurations[0][0] + "." + configurations[0][1] + "." + configurations[0][2]; //$NON-NLS-1$ //$NON-NLS-2$ |
171 |
String rootPrefix = IBuildPropertiesConstants.ROOT_PREFIX + configurations[0][0] + "." + configurations[0][1] + "." + configurations[0][2]; //$NON-NLS-1$ //$NON-NLS-2$ |
172 |
properties.put(rootPrefix, getRootFileLocations(hasLaunchers)); |
172 |
properties.put(rootPrefix, getRootFileLocations(hasLaunchers)); |
173 |
if (TargetPlatform.getOS().equals("macosx")) { //$NON-NLS-1$ |
173 |
if (TargetPlatform.getOS().equals("macosx")) { //$NON-NLS-1$ |
174 |
String plist = createMacInfoPList(); |
174 |
String plist = createMacInfoPList(); |
175 |
if (plist != null) |
175 |
if (plist != null) |
176 |
properties.put(rootPrefix + ".folder." + ECLIPSE_APP_CONTENTS, "absolute:file:" + plist); //$NON-NLS-1$ //$NON-NLS-2$ |
176 |
properties.put(rootPrefix + ".folder." + ECLIPSE_APP_CONTENTS, "absolute:file:" + plist); //$NON-NLS-1$ //$NON-NLS-2$ |
177 |
properties.put(rootPrefix + ".folder." + ECLIPSE_APP_MACOS, getLauncherLocations(hasLaunchers)); //$NON-NLS-1$ |
177 |
properties.put(rootPrefix + ".folder." + ECLIPSE_APP_MACOS, getLauncherLocations(hasLaunchers)); //$NON-NLS-1$ |
178 |
properties.put(rootPrefix + ".permissions.755", ECLIPSE_APP_MACOS + "/" + getLauncherName()); //$NON-NLS-1$ //$NON-NLS-2$ |
178 |
properties.put(rootPrefix + ".permissions.755", ECLIPSE_APP_MACOS + "/" + getLauncherName()); //$NON-NLS-1$ //$NON-NLS-2$ |
179 |
} else { |
179 |
} else { |
180 |
properties.put(rootPrefix, getLauncherLocations(hasLaunchers)); //To copy a folder |
180 |
properties.put(rootPrefix, getLauncherLocations(hasLaunchers)); //To copy a folder |
181 |
properties.put(rootPrefix + ".permissions.755", getLauncherName()); //$NON-NLS-1$ |
181 |
properties.put(rootPrefix + ".permissions.755", getLauncherName()); //$NON-NLS-1$ |
182 |
if (TargetPlatform.getWS().equals("motif") && TargetPlatform.getOS().equals("linux")) { //$NON-NLS-1$ //$NON-NLS-2$ |
182 |
if (TargetPlatform.getWS().equals("motif") && TargetPlatform.getOS().equals("linux")) { //$NON-NLS-1$ //$NON-NLS-2$ |
183 |
properties.put(rootPrefix + ".permissions.755", "libXm.so.2"); //$NON-NLS-1$ //$NON-NLS-2$ |
183 |
properties.put(rootPrefix + ".permissions.755", "libXm.so.2"); //$NON-NLS-1$ //$NON-NLS-2$ |
184 |
} |
184 |
} |
185 |
} |
185 |
} |
186 |
} |
186 |
} |
187 |
|
187 |
|
188 |
IJREInfo jreInfo = fProduct.getJREInfo(); |
188 |
IJREInfo jreInfo = fProduct.getJREInfo(); |
189 |
for (int i = 0; i < configurations.length; i++) { |
189 |
for (int i = 0; i < configurations.length; i++) { |
190 |
String[] config = configurations[i]; |
190 |
String[] config = configurations[i]; |
191 |
File vm = jreInfo != null ? jreInfo.getJVMLocation(config[0]) : null; |
191 |
File vm = jreInfo != null ? jreInfo.getJVMLocation(config[0]) : null; |
192 |
|
192 |
|
193 |
if (vm != null) { |
193 |
if (vm != null) { |
194 |
String rootPrefix = IBuildPropertiesConstants.ROOT_PREFIX + config[0] + "." + config[1] + //$NON-NLS-1$ |
194 |
String rootPrefix = IBuildPropertiesConstants.ROOT_PREFIX + config[0] + "." + config[1] + //$NON-NLS-1$ |
195 |
"." + config[2]; //$NON-NLS-1$ |
195 |
"." + config[2]; //$NON-NLS-1$ |
196 |
properties.put(rootPrefix + ".folder.jre", "absolute:" + vm.getAbsolutePath()); //$NON-NLS-1$ //$NON-NLS-2$ |
196 |
properties.put(rootPrefix + ".folder.jre", "absolute:" + vm.getAbsolutePath()); //$NON-NLS-1$ //$NON-NLS-2$ |
197 |
String perms = (String) properties.get(rootPrefix + ".permissions.755"); //$NON-NLS-1$ |
197 |
String perms = (String) properties.get(rootPrefix + ".permissions.755"); //$NON-NLS-1$ |
198 |
if (perms != null) { |
198 |
if (perms != null) { |
199 |
StringBuffer buffer = new StringBuffer(perms); |
199 |
StringBuffer buffer = new StringBuffer(perms); |
200 |
buffer.append(","); //$NON-NLS-1$ |
200 |
buffer.append(","); //$NON-NLS-1$ |
201 |
buffer.append("jre/bin/java"); //$NON-NLS-1$ |
201 |
buffer.append("jre/bin/java"); //$NON-NLS-1$ |
202 |
properties.put(rootPrefix + ".permissions.755", buffer.toString()); //$NON-NLS-1$ |
202 |
properties.put(rootPrefix + ".permissions.755", buffer.toString()); //$NON-NLS-1$ |
203 |
} |
203 |
} |
204 |
} |
204 |
} |
205 |
} |
205 |
} |
206 |
|
206 |
|
207 |
if (fInfo.exportSource && fInfo.exportSourceBundle) { |
207 |
if (fInfo.exportSource && fInfo.exportSourceBundle) { |
208 |
properties.put(IBuildPropertiesConstants.PROPERTY_INDIVIDUAL_SOURCE, "true"); //$NON-NLS-1$ |
208 |
properties.put(IBuildPropertiesConstants.PROPERTY_INDIVIDUAL_SOURCE, "true"); //$NON-NLS-1$ |
209 |
List workspacePlugins = Arrays.asList(PluginRegistry.getWorkspaceModels()); |
209 |
List workspacePlugins = Arrays.asList(PluginRegistry.getWorkspaceModels()); |
210 |
for (int i = 0; i < fInfo.items.length; i++) { |
210 |
for (int i = 0; i < fInfo.items.length; i++) { |
211 |
if (fInfo.items[i] instanceof IFeatureModel) { |
211 |
if (fInfo.items[i] instanceof IFeatureModel) { |
212 |
IFeature feature = ((IFeatureModel) fInfo.items[i]).getFeature(); |
212 |
IFeature feature = ((IFeatureModel) fInfo.items[i]).getFeature(); |
213 |
properties.put("generate.feature@" + feature.getId().trim() + ".source", feature.getId()); //$NON-NLS-1$ //$NON-NLS-2$ |
213 |
properties.put("generate.feature@" + feature.getId().trim() + ".source", feature.getId()); //$NON-NLS-1$ //$NON-NLS-2$ |
214 |
} else { |
214 |
} else { |
215 |
BundleDescription bundle = null; |
215 |
BundleDescription bundle = null; |
216 |
if (fInfo.items[i] instanceof IPluginModelBase) { |
216 |
if (fInfo.items[i] instanceof IPluginModelBase) { |
217 |
bundle = ((IPluginModelBase) fInfo.items[i]).getBundleDescription(); |
217 |
bundle = ((IPluginModelBase) fInfo.items[i]).getBundleDescription(); |
218 |
} |
218 |
} |
219 |
if (bundle == null) { |
219 |
if (bundle == null) { |
220 |
if (fInfo.items[i] instanceof BundleDescription) |
220 |
if (fInfo.items[i] instanceof BundleDescription) |
221 |
bundle = (BundleDescription) fInfo.items[i]; |
221 |
bundle = (BundleDescription) fInfo.items[i]; |
222 |
} |
222 |
} |
223 |
if (bundle == null) |
223 |
if (bundle == null) |
224 |
continue; |
224 |
continue; |
225 |
|
225 |
|
226 |
//it doesn't matter if we generate extra properties for platforms we aren't exporting for |
226 |
//it doesn't matter if we generate extra properties for platforms we aren't exporting for |
227 |
if (workspacePlugins.contains(PluginRegistry.findModel(bundle))) { |
227 |
if (workspacePlugins.contains(PluginRegistry.findModel(bundle))) { |
228 |
properties.put("generate.plugin@" + bundle.getSymbolicName().trim() + ".source", bundle.getSymbolicName()); //$NON-NLS-1$ //$NON-NLS-2$ |
228 |
properties.put("generate.plugin@" + bundle.getSymbolicName().trim() + ".source", bundle.getSymbolicName()); //$NON-NLS-1$ //$NON-NLS-2$ |
229 |
} |
229 |
} |
230 |
} |
230 |
} |
231 |
} |
231 |
} |
232 |
} |
232 |
} |
233 |
save(new File(file, "build.properties"), properties, "Build Configuration"); //$NON-NLS-1$ //$NON-NLS-2$ |
233 |
save(new File(file, ICoreConstants.BUILD_FILENAME_DESCRIPTOR), properties, "Build Configuration"); //$NON-NLS-1$ |
234 |
} |
234 |
} |
235 |
|
235 |
|
236 |
/* (non-Javadoc) |
236 |
/* (non-Javadoc) |
237 |
* @see org.eclipse.pde.internal.core.exports.FeatureExportOperation#publishingP2Metadata() |
237 |
* @see org.eclipse.pde.internal.core.exports.FeatureExportOperation#publishingP2Metadata() |
238 |
*/ |
238 |
*/ |
239 |
protected boolean publishingP2Metadata() { |
239 |
protected boolean publishingP2Metadata() { |
240 |
return fInfo.exportMetadata; |
240 |
return fInfo.exportMetadata; |
241 |
} |
241 |
} |
242 |
|
242 |
|
243 |
private String getLauncherLocations(boolean hasLaunchers) { |
243 |
private String getLauncherLocations(boolean hasLaunchers) { |
244 |
//get the launchers for the eclipse install |
244 |
//get the launchers for the eclipse install |
245 |
StringBuffer buffer = new StringBuffer(); |
245 |
StringBuffer buffer = new StringBuffer(); |
246 |
if (!hasLaunchers) { |
246 |
if (!hasLaunchers) { |
247 |
File homeDir = new File(TargetPlatform.getLocation()); |
247 |
File homeDir = new File(TargetPlatform.getLocation()); |
248 |
if (homeDir.exists() && homeDir.isDirectory()) { |
248 |
if (homeDir.exists() && homeDir.isDirectory()) { |
249 |
// try to retrieve the exact eclipse launcher path |
249 |
// try to retrieve the exact eclipse launcher path |
250 |
// see bug 205833 |
250 |
// see bug 205833 |
251 |
File file = null; |
251 |
File file = null; |
252 |
if (System.getProperties().get("eclipse.launcher") != null) { //$NON-NLS-1$ |
252 |
if (System.getProperties().get("eclipse.launcher") != null) { //$NON-NLS-1$ |
253 |
String launcherPath = System.getProperties().get("eclipse.launcher").toString(); //$NON-NLS-1$ |
253 |
String launcherPath = System.getProperties().get("eclipse.launcher").toString(); //$NON-NLS-1$ |
254 |
file = new File(launcherPath); |
254 |
file = new File(launcherPath); |
255 |
} |
255 |
} |
256 |
|
256 |
|
257 |
if (file != null && file.exists() && !file.isDirectory()) { |
257 |
if (file != null && file.exists() && !file.isDirectory()) { |
258 |
appendAbsolutePath(buffer, file); |
258 |
appendAbsolutePath(buffer, file); |
259 |
} else if (TargetPlatform.getOS().equals("macosx")) { //$NON-NLS-1$) |
259 |
} else if (TargetPlatform.getOS().equals("macosx")) { //$NON-NLS-1$) |
260 |
appendEclipsePath(buffer, new File(homeDir, ECLIPSE_APP_MACOS)); |
260 |
appendEclipsePath(buffer, new File(homeDir, ECLIPSE_APP_MACOS)); |
261 |
} else { |
261 |
} else { |
262 |
appendEclipsePath(buffer, homeDir); |
262 |
appendEclipsePath(buffer, homeDir); |
263 |
} |
263 |
} |
264 |
} |
264 |
} |
265 |
} |
265 |
} |
266 |
return buffer.toString(); |
266 |
return buffer.toString(); |
267 |
} |
267 |
} |
268 |
|
268 |
|
269 |
private String getRootFileLocations(boolean hasLaunchers) { |
269 |
private String getRootFileLocations(boolean hasLaunchers) { |
270 |
//Get the files that go in the root of the eclipse install, excluding the launcher |
270 |
//Get the files that go in the root of the eclipse install, excluding the launcher |
271 |
StringBuffer buffer = new StringBuffer(); |
271 |
StringBuffer buffer = new StringBuffer(); |
272 |
if (!hasLaunchers) { |
272 |
if (!hasLaunchers) { |
273 |
File homeDir = new File(TargetPlatform.getLocation()); |
273 |
File homeDir = new File(TargetPlatform.getLocation()); |
274 |
if (homeDir.exists() && homeDir.isDirectory()) { |
274 |
if (homeDir.exists() && homeDir.isDirectory()) { |
275 |
File file = new File(homeDir, "startup.jar"); //$NON-NLS-1$ |
275 |
File file = new File(homeDir, "startup.jar"); //$NON-NLS-1$ |
276 |
if (file.exists()) |
276 |
if (file.exists()) |
277 |
appendAbsolutePath(buffer, file); |
277 |
appendAbsolutePath(buffer, file); |
278 |
|
278 |
|
279 |
file = new File(homeDir, "libXm.so.2"); //$NON-NLS-1$ |
279 |
file = new File(homeDir, "libXm.so.2"); //$NON-NLS-1$ |
280 |
if (file.exists()) { |
280 |
if (file.exists()) { |
281 |
appendAbsolutePath(buffer, file); |
281 |
appendAbsolutePath(buffer, file); |
282 |
} |
282 |
} |
283 |
} |
283 |
} |
284 |
} |
284 |
} |
285 |
|
285 |
|
286 |
return buffer.toString(); |
286 |
return buffer.toString(); |
287 |
} |
287 |
} |
288 |
|
288 |
|
289 |
private void appendEclipsePath(StringBuffer buffer, File homeDir) { |
289 |
private void appendEclipsePath(StringBuffer buffer, File homeDir) { |
290 |
File file = null; |
290 |
File file = null; |
291 |
file = new File(homeDir, "eclipse"); //$NON-NLS-1$ |
291 |
file = new File(homeDir, "eclipse"); //$NON-NLS-1$ |
292 |
if (file.exists()) { |
292 |
if (file.exists()) { |
293 |
appendAbsolutePath(buffer, file); |
293 |
appendAbsolutePath(buffer, file); |
294 |
} |
294 |
} |
295 |
file = new File(homeDir, "eclipse.exe"); //$NON-NLS-1$ |
295 |
file = new File(homeDir, "eclipse.exe"); //$NON-NLS-1$ |
296 |
if (file.exists()) { |
296 |
if (file.exists()) { |
297 |
appendAbsolutePath(buffer, file); |
297 |
appendAbsolutePath(buffer, file); |
298 |
} |
298 |
} |
299 |
} |
299 |
} |
300 |
|
300 |
|
301 |
private void appendAbsolutePath(StringBuffer buffer, File file) { |
301 |
private void appendAbsolutePath(StringBuffer buffer, File file) { |
302 |
if (buffer.length() > 0) |
302 |
if (buffer.length() > 0) |
303 |
buffer.append(","); //$NON-NLS-1$ |
303 |
buffer.append(","); //$NON-NLS-1$ |
304 |
|
304 |
|
305 |
buffer.append("absolute:file:"); //$NON-NLS-1$ |
305 |
buffer.append("absolute:file:"); //$NON-NLS-1$ |
306 |
buffer.append(file.getAbsolutePath()); |
306 |
buffer.append(file.getAbsolutePath()); |
307 |
} |
307 |
} |
308 |
|
308 |
|
309 |
protected HashMap createAntBuildProperties(String[][] configs) { |
309 |
protected HashMap createAntBuildProperties(String[][] configs) { |
310 |
HashMap properties = super.createAntBuildProperties(configs); |
310 |
HashMap properties = super.createAntBuildProperties(configs); |
311 |
properties.put(IXMLConstants.PROPERTY_LAUNCHER_NAME, getLauncherName()); |
311 |
properties.put(IXMLConstants.PROPERTY_LAUNCHER_NAME, getLauncherName()); |
312 |
|
312 |
|
313 |
if (fProduct.includeLaunchers()) { |
313 |
if (fProduct.includeLaunchers()) { |
314 |
properties.put("excludeLaunchers", IBuildPropertiesConstants.TRUE); //$NON-NLS-1$ |
314 |
properties.put("excludeLaunchers", IBuildPropertiesConstants.TRUE); //$NON-NLS-1$ |
315 |
} |
315 |
} |
316 |
|
316 |
|
317 |
ILauncherInfo info = fProduct.getLauncherInfo(); |
317 |
ILauncherInfo info = fProduct.getLauncherInfo(); |
318 |
if (info != null) { |
318 |
if (info != null) { |
319 |
String icons = ""; //$NON-NLS-1$ |
319 |
String icons = ""; //$NON-NLS-1$ |
320 |
for (int i = 0; i < configs.length; i++) { |
320 |
for (int i = 0; i < configs.length; i++) { |
321 |
String images = null; |
321 |
String images = null; |
322 |
if (configs[i][0].equals("win32")) { //$NON-NLS-1$ |
322 |
if (configs[i][0].equals("win32")) { //$NON-NLS-1$ |
323 |
images = getWin32Images(info); |
323 |
images = getWin32Images(info); |
324 |
} else if (configs[i][0].equals("solaris")) { //$NON-NLS-1$ |
324 |
} else if (configs[i][0].equals("solaris")) { //$NON-NLS-1$ |
325 |
images = getSolarisImages(info); |
325 |
images = getSolarisImages(info); |
326 |
} else if (configs[i][0].equals("linux")) { //$NON-NLS-1$ |
326 |
} else if (configs[i][0].equals("linux")) { //$NON-NLS-1$ |
327 |
images = getExpandedPath(info.getIconPath(ILauncherInfo.LINUX_ICON)); |
327 |
images = getExpandedPath(info.getIconPath(ILauncherInfo.LINUX_ICON)); |
328 |
} else if (configs[i][0].equals("macosx")) { //$NON-NLS-1$ |
328 |
} else if (configs[i][0].equals("macosx")) { //$NON-NLS-1$ |
329 |
images = getExpandedPath(info.getIconPath(ILauncherInfo.MACOSX_ICON)); |
329 |
images = getExpandedPath(info.getIconPath(ILauncherInfo.MACOSX_ICON)); |
330 |
} |
330 |
} |
331 |
if (images != null) { |
331 |
if (images != null) { |
332 |
if (icons.length() > 0) |
332 |
if (icons.length() > 0) |
333 |
icons += ","; //$NON-NLS-1$ |
333 |
icons += ","; //$NON-NLS-1$ |
334 |
icons += images; |
334 |
icons += images; |
335 |
} |
335 |
} |
336 |
|
336 |
|
337 |
} |
337 |
} |
338 |
if (icons != null && icons.length() > 0) |
338 |
if (icons != null && icons.length() > 0) |
339 |
properties.put(IXMLConstants.PROPERTY_LAUNCHER_ICONS, icons); |
339 |
properties.put(IXMLConstants.PROPERTY_LAUNCHER_ICONS, icons); |
340 |
} |
340 |
} |
341 |
|
341 |
|
342 |
fAntBuildProperties.put(IXMLConstants.PROPERTY_COLLECTING_FOLDER, fRoot); |
342 |
fAntBuildProperties.put(IXMLConstants.PROPERTY_COLLECTING_FOLDER, fRoot); |
343 |
fAntBuildProperties.put(IXMLConstants.PROPERTY_ARCHIVE_PREFIX, fRoot); |
343 |
fAntBuildProperties.put(IXMLConstants.PROPERTY_ARCHIVE_PREFIX, fRoot); |
344 |
|
344 |
|
345 |
return properties; |
345 |
return properties; |
346 |
} |
346 |
} |
347 |
|
347 |
|
348 |
/* (non-Javadoc) |
348 |
/* (non-Javadoc) |
349 |
* @see org.eclipse.pde.internal.core.exports.FeatureExportOperation#setP2MetaDataProperties(java.util.Map) |
349 |
* @see org.eclipse.pde.internal.core.exports.FeatureExportOperation#setP2MetaDataProperties(java.util.Map) |
350 |
*/ |
350 |
*/ |
351 |
protected void setP2MetaDataProperties(Map map) { |
351 |
protected void setP2MetaDataProperties(Map map) { |
352 |
if (fInfo.exportMetadata) { |
352 |
if (fInfo.exportMetadata) { |
353 |
if (PDECore.getDefault().getFeatureModelManager().getDeltaPackFeature() == null) |
353 |
if (PDECore.getDefault().getFeatureModelManager().getDeltaPackFeature() == null) |
354 |
map.put(IXMLConstants.PROPERTY_LAUNCHER_PROVIDER, "org.eclipse.pde.container.feature"); //$NON-NLS-1$ |
354 |
map.put(IXMLConstants.PROPERTY_LAUNCHER_PROVIDER, "org.eclipse.pde.container.feature"); //$NON-NLS-1$ |
355 |
map.put(IXMLConstants.TARGET_P2_METADATA, IBuildPropertiesConstants.TRUE); |
355 |
map.put(IXMLConstants.TARGET_P2_METADATA, IBuildPropertiesConstants.TRUE); |
356 |
map.put(IBuildPropertiesConstants.PROPERTY_P2_FLAVOR, P2Utils.P2_FLAVOR_DEFAULT); |
356 |
map.put(IBuildPropertiesConstants.PROPERTY_P2_FLAVOR, P2Utils.P2_FLAVOR_DEFAULT); |
357 |
map.put(IBuildPropertiesConstants.PROPERTY_P2_PUBLISH_ARTIFACTS, IBuildPropertiesConstants.TRUE); |
357 |
map.put(IBuildPropertiesConstants.PROPERTY_P2_PUBLISH_ARTIFACTS, IBuildPropertiesConstants.TRUE); |
358 |
map.put(IBuildPropertiesConstants.PROPERTY_P2_COMPRESS, IBuildPropertiesConstants.TRUE); |
358 |
map.put(IBuildPropertiesConstants.PROPERTY_P2_COMPRESS, IBuildPropertiesConstants.TRUE); |
359 |
map.put(IBuildPropertiesConstants.PROPERTY_P2_GATHERING, Boolean.toString(publishingP2Metadata())); |
359 |
map.put(IBuildPropertiesConstants.PROPERTY_P2_GATHERING, Boolean.toString(publishingP2Metadata())); |
360 |
try { |
360 |
try { |
361 |
map.put(IBuildPropertiesConstants.PROPERTY_P2_BUILD_REPO, new File(fBuildTempMetadataLocation).toURL().toString()); |
361 |
map.put(IBuildPropertiesConstants.PROPERTY_P2_BUILD_REPO, new File(fBuildTempMetadataLocation).toURL().toString()); |
362 |
map.put(IBuildPropertiesConstants.PROPERTY_P2_METADATA_REPO, new File(fInfo.destinationDirectory + "/repository").toURL().toString()); //$NON-NLS-1$ |
362 |
map.put(IBuildPropertiesConstants.PROPERTY_P2_METADATA_REPO, new File(fInfo.destinationDirectory + "/repository").toURL().toString()); //$NON-NLS-1$ |
363 |
map.put(IBuildPropertiesConstants.PROPERTY_P2_ARTIFACT_REPO, new File(fInfo.destinationDirectory + "/repository").toURL().toString()); //$NON-NLS-1$ |
363 |
map.put(IBuildPropertiesConstants.PROPERTY_P2_ARTIFACT_REPO, new File(fInfo.destinationDirectory + "/repository").toURL().toString()); //$NON-NLS-1$ |
364 |
map.put(IBuildPropertiesConstants.PROPERTY_P2_METADATA_REPO_NAME, NLS.bind(PDECoreMessages.ProductExportOperation_0, fProduct.getProductId())); |
364 |
map.put(IBuildPropertiesConstants.PROPERTY_P2_METADATA_REPO_NAME, NLS.bind(PDECoreMessages.ProductExportOperation_0, fProduct.getProductId())); |
365 |
map.put(IBuildPropertiesConstants.PROPERTY_P2_ARTIFACT_REPO_NAME, NLS.bind(PDECoreMessages.ProductExportOperation_0, fProduct.getProductId())); |
365 |
map.put(IBuildPropertiesConstants.PROPERTY_P2_ARTIFACT_REPO_NAME, NLS.bind(PDECoreMessages.ProductExportOperation_0, fProduct.getProductId())); |
366 |
} catch (MalformedURLException e) { |
366 |
} catch (MalformedURLException e) { |
367 |
PDECore.log(e); |
367 |
PDECore.log(e); |
368 |
} |
368 |
} |
369 |
} |
369 |
} |
370 |
} |
370 |
} |
371 |
|
371 |
|
372 |
private String getLauncherName() { |
372 |
private String getLauncherName() { |
373 |
ILauncherInfo info = fProduct.getLauncherInfo(); |
373 |
ILauncherInfo info = fProduct.getLauncherInfo(); |
374 |
if (info != null) { |
374 |
if (info != null) { |
375 |
String name = info.getLauncherName(); |
375 |
String name = info.getLauncherName(); |
376 |
if (name != null && name.length() > 0) { |
376 |
if (name != null && name.length() > 0) { |
377 |
name = name.trim(); |
377 |
name = name.trim(); |
378 |
if (name.endsWith(".exe")) //$NON-NLS-1$ |
378 |
if (name.endsWith(".exe")) //$NON-NLS-1$ |
379 |
name = name.substring(0, name.length() - 4); |
379 |
name = name.substring(0, name.length() - 4); |
380 |
return name; |
380 |
return name; |
381 |
} |
381 |
} |
382 |
} |
382 |
} |
383 |
return "eclipse"; //$NON-NLS-1$ |
383 |
return "eclipse"; //$NON-NLS-1$ |
384 |
} |
384 |
} |
385 |
|
385 |
|
386 |
private String getWin32Images(ILauncherInfo info) { |
386 |
private String getWin32Images(ILauncherInfo info) { |
387 |
StringBuffer buffer = new StringBuffer(); |
387 |
StringBuffer buffer = new StringBuffer(); |
388 |
if (info.usesWinIcoFile()) { |
388 |
if (info.usesWinIcoFile()) { |
389 |
append(buffer, info.getIconPath(ILauncherInfo.P_ICO_PATH)); |
389 |
append(buffer, info.getIconPath(ILauncherInfo.P_ICO_PATH)); |
390 |
} else { |
390 |
} else { |
391 |
append(buffer, info.getIconPath(ILauncherInfo.WIN32_16_LOW)); |
391 |
append(buffer, info.getIconPath(ILauncherInfo.WIN32_16_LOW)); |
392 |
append(buffer, info.getIconPath(ILauncherInfo.WIN32_16_HIGH)); |
392 |
append(buffer, info.getIconPath(ILauncherInfo.WIN32_16_HIGH)); |
393 |
append(buffer, info.getIconPath(ILauncherInfo.WIN32_32_HIGH)); |
393 |
append(buffer, info.getIconPath(ILauncherInfo.WIN32_32_HIGH)); |
394 |
append(buffer, info.getIconPath(ILauncherInfo.WIN32_32_LOW)); |
394 |
append(buffer, info.getIconPath(ILauncherInfo.WIN32_32_LOW)); |
395 |
append(buffer, info.getIconPath(ILauncherInfo.WIN32_48_HIGH)); |
395 |
append(buffer, info.getIconPath(ILauncherInfo.WIN32_48_HIGH)); |
396 |
append(buffer, info.getIconPath(ILauncherInfo.WIN32_48_LOW)); |
396 |
append(buffer, info.getIconPath(ILauncherInfo.WIN32_48_LOW)); |
397 |
} |
397 |
} |
398 |
return buffer.length() > 0 ? buffer.toString() : null; |
398 |
return buffer.length() > 0 ? buffer.toString() : null; |
399 |
} |
399 |
} |
400 |
|
400 |
|
401 |
private String getSolarisImages(ILauncherInfo info) { |
401 |
private String getSolarisImages(ILauncherInfo info) { |
402 |
StringBuffer buffer = new StringBuffer(); |
402 |
StringBuffer buffer = new StringBuffer(); |
403 |
append(buffer, info.getIconPath(ILauncherInfo.SOLARIS_LARGE)); |
403 |
append(buffer, info.getIconPath(ILauncherInfo.SOLARIS_LARGE)); |
404 |
append(buffer, info.getIconPath(ILauncherInfo.SOLARIS_MEDIUM)); |
404 |
append(buffer, info.getIconPath(ILauncherInfo.SOLARIS_MEDIUM)); |
405 |
append(buffer, info.getIconPath(ILauncherInfo.SOLARIS_SMALL)); |
405 |
append(buffer, info.getIconPath(ILauncherInfo.SOLARIS_SMALL)); |
406 |
append(buffer, info.getIconPath(ILauncherInfo.SOLARIS_TINY)); |
406 |
append(buffer, info.getIconPath(ILauncherInfo.SOLARIS_TINY)); |
407 |
return buffer.length() > 0 ? buffer.toString() : null; |
407 |
return buffer.length() > 0 ? buffer.toString() : null; |
408 |
} |
408 |
} |
409 |
|
409 |
|
410 |
private void append(StringBuffer buffer, String path) { |
410 |
private void append(StringBuffer buffer, String path) { |
411 |
path = getExpandedPath(path); |
411 |
path = getExpandedPath(path); |
412 |
if (path != null) { |
412 |
if (path != null) { |
413 |
if (buffer.length() > 0) |
413 |
if (buffer.length() > 0) |
414 |
buffer.append(","); //$NON-NLS-1$ |
414 |
buffer.append(","); //$NON-NLS-1$ |
415 |
buffer.append(path); |
415 |
buffer.append(path); |
416 |
} |
416 |
} |
417 |
} |
417 |
} |
418 |
|
418 |
|
419 |
private String getExpandedPath(String path) { |
419 |
private String getExpandedPath(String path) { |
420 |
if (path == null || path.length() == 0) |
420 |
if (path == null || path.length() == 0) |
421 |
return null; |
421 |
return null; |
422 |
IResource resource = PDECore.getWorkspace().getRoot().findMember(new Path(path)); |
422 |
IResource resource = PDECore.getWorkspace().getRoot().findMember(new Path(path)); |
423 |
if (resource != null) { |
423 |
if (resource != null) { |
424 |
IPath fullPath = resource.getLocation(); |
424 |
IPath fullPath = resource.getLocation(); |
425 |
return fullPath == null ? null : fullPath.toOSString(); |
425 |
return fullPath == null ? null : fullPath.toOSString(); |
426 |
} |
426 |
} |
427 |
return null; |
427 |
return null; |
428 |
} |
428 |
} |
429 |
|
429 |
|
430 |
protected void setupGenerator(BuildScriptGenerator generator, String featureID, String versionId, String[][] configs, String featureLocation) throws CoreException { |
430 |
protected void setupGenerator(BuildScriptGenerator generator, String featureID, String versionId, String[][] configs, String featureLocation) throws CoreException { |
431 |
super.setupGenerator(generator, featureID, versionId, configs, featureLocation); |
431 |
super.setupGenerator(generator, featureID, versionId, configs, featureLocation); |
432 |
generator.setGenerateVersionsList(true); |
432 |
generator.setGenerateVersionsList(true); |
433 |
if (fProduct != null) |
433 |
if (fProduct != null) |
434 |
generator.setProduct(fProduct.getModel().getInstallLocation()); |
434 |
generator.setProduct(fProduct.getModel().getInstallLocation()); |
435 |
} |
435 |
} |
436 |
|
436 |
|
437 |
private String createMacInfoPList() { |
437 |
private String createMacInfoPList() { |
438 |
String entryName = TargetPlatformHelper.getTargetVersion() >= 3.3 ? "macosx/Info.plist" //$NON-NLS-1$ |
438 |
String entryName = TargetPlatformHelper.getTargetVersion() >= 3.3 ? "macosx/Info.plist" //$NON-NLS-1$ |
439 |
: "macosx/Info.plist.32"; //$NON-NLS-1$ |
439 |
: "macosx/Info.plist.32"; //$NON-NLS-1$ |
440 |
URL url = PDECore.getDefault().getBundle().getEntry(entryName); |
440 |
URL url = PDECore.getDefault().getBundle().getEntry(entryName); |
441 |
if (url == null) |
441 |
if (url == null) |
442 |
return null; |
442 |
return null; |
443 |
|
443 |
|
444 |
File plist = null; |
444 |
File plist = null; |
445 |
InputStream in = null; |
445 |
InputStream in = null; |
446 |
String location = fFeatureLocation; |
446 |
String location = fFeatureLocation; |
447 |
|
447 |
|
448 |
try { |
448 |
try { |
449 |
in = url.openStream(); |
449 |
in = url.openStream(); |
450 |
File dir = new File(location, ECLIPSE_APP_CONTENTS); |
450 |
File dir = new File(location, ECLIPSE_APP_CONTENTS); |
451 |
dir.mkdirs(); |
451 |
dir.mkdirs(); |
452 |
plist = new File(dir, "Info.plist"); //$NON-NLS-1$ |
452 |
plist = new File(dir, "Info.plist"); //$NON-NLS-1$ |
453 |
CoreUtility.readFile(in, plist); |
453 |
CoreUtility.readFile(in, plist); |
454 |
return plist.getAbsolutePath(); |
454 |
return plist.getAbsolutePath(); |
455 |
} catch (IOException e) { |
455 |
} catch (IOException e) { |
456 |
// nothing to do |
456 |
// nothing to do |
457 |
} finally { |
457 |
} finally { |
458 |
try { |
458 |
try { |
459 |
if (in != null) |
459 |
if (in != null) |
460 |
in.close(); |
460 |
in.close(); |
461 |
} catch (IOException e) { |
461 |
} catch (IOException e) { |
462 |
} |
462 |
} |
463 |
} |
463 |
} |
464 |
return null; |
464 |
return null; |
465 |
} |
465 |
} |
466 |
|
466 |
|
467 |
protected void setAdditionalAttributes(Element plugin, BundleDescription bundle) { |
467 |
protected void setAdditionalAttributes(Element plugin, BundleDescription bundle) { |
468 |
plugin.setAttribute("unpack", Boolean.toString(CoreUtility.guessUnpack(bundle))); //$NON-NLS-1$ |
468 |
plugin.setAttribute("unpack", Boolean.toString(CoreUtility.guessUnpack(bundle))); //$NON-NLS-1$ |
469 |
} |
469 |
} |
470 |
} |
470 |
} |