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 127576 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/pde/internal/build/FeatureGenerator.java (-1 / +13 lines)
Lines 19-24 Link Here
19
import org.eclipse.pde.internal.build.site.PDEState;
19
import org.eclipse.pde.internal.build.site.PDEState;
20
20
21
public class FeatureGenerator extends AbstractScriptGenerator {
21
public class FeatureGenerator extends AbstractScriptGenerator {
22
	private static final String LAUNCHER_FEATURE_NAME = "org.eclipse.platform.launchers"; //$NON-NLS-1$
23
22
	private String featureId = null;
24
	private String featureId = null;
23
	private String productFile = null;
25
	private String productFile = null;
24
	private String[] pluginList = null;
26
	private String[] pluginList = null;
Lines 129-136 Link Here
129
			writer.printTag("plugin", parameters, true, true, true); //$NON-NLS-1$
131
			writer.printTag("plugin", parameters, true, true, true); //$NON-NLS-1$
130
		}
132
		}
131
		
133
		
134
		boolean hasLaunchers = false;
132
		for (Iterator iter = features.iterator(); iter.hasNext();) {
135
		for (Iterator iter = features.iterator(); iter.hasNext();) {
133
			String name = (String) iter.next();
136
			String name = (String) iter.next();
137
			if (name.equals(LAUNCHER_FEATURE_NAME)) {
138
				hasLaunchers = true;	
139
			}
134
			if (verify) {
140
			if (verify) {
135
				//this will throw an exception if the feature is not found.
141
				//this will throw an exception if the feature is not found.
136
				getSite(false).findFeature(name, null, true);
142
				getSite(false).findFeature(name, null, true);
Lines 139-145 Link Here
139
			parameters.put("id", name); //$NON-NLS-1$
145
			parameters.put("id", name); //$NON-NLS-1$
140
			parameters.put("version", "0.0.0");  //$NON-NLS-1$//$NON-NLS-2$
146
			parameters.put("version", "0.0.0");  //$NON-NLS-1$//$NON-NLS-2$
141
			writer.printTag("includes", parameters, true, true, true); //$NON-NLS-1$
147
			writer.printTag("includes", parameters, true, true, true); //$NON-NLS-1$
142
			
148
		}
149
		if (!hasLaunchers) {
150
			parameters.clear();
151
			parameters.put("id", LAUNCHER_FEATURE_NAME); //$NON-NLS-1$
152
			parameters.put("version", "0.0.0");  //$NON-NLS-1$//$NON-NLS-2$
153
			parameters.put("optional", "true");  //$NON-NLS-1$//$NON-NLS-2$
154
			writer.printTag("includes", parameters, true, true, true); //$NON-NLS-1$
143
		}
155
		}
144
		writer.endTag("feature"); //$NON-NLS-1$
156
		writer.endTag("feature"); //$NON-NLS-1$
145
		writer.close();
157
		writer.close();
(-)src/org/eclipse/pde/internal/build/ProductGenerator.java (-49 / +157 lines)
Lines 13-24 Link Here
13
import java.io.*;
13
import java.io.*;
14
import java.util.*;
14
import java.util.*;
15
import org.eclipse.core.runtime.CoreException;
15
import org.eclipse.core.runtime.CoreException;
16
import org.eclipse.core.runtime.Platform;
16
import org.eclipse.osgi.service.resolver.BundleDescription;
17
import org.eclipse.osgi.service.resolver.BundleDescription;
17
import org.eclipse.pde.internal.build.site.PDEState;
18
import org.eclipse.pde.internal.build.site.PDEState;
18
19
19
public class ProductGenerator extends AbstractScriptGenerator {
20
public class ProductGenerator extends AbstractScriptGenerator {
20
	private static final String BUNDLE_EQUINOX_COMMON = "org.eclipse.equinox.common"; //$NON-NLS-1$
21
	private static final String BUNDLE_EQUINOX_COMMON = "org.eclipse.equinox.common"; //$NON-NLS-1$
21
	private static final String BUNDLE_EQUINOX_REGISTRY = "org.eclipse.equinox.registry"; //$NON-NLS-1$
22
	private static final String BUNDLE_EQUINOX_REGISTRY = "org.eclipse.equinox.registry"; //$NON-NLS-1$
23
	private static final String BUNDLE_RUNTIME_COMPATIBILITY_REGISTRY = "org.eclipse.core.runtime.compatibility.registry"; //$NON-NLS-1$
22
	private static final String BUNDLE_EQUINOX_PREFERENCES = "org.eclipse.equinox.preferences"; //$NON-NLS-1$
24
	private static final String BUNDLE_EQUINOX_PREFERENCES = "org.eclipse.equinox.preferences"; //$NON-NLS-1$
23
	private static final String BUNDLE_OSGI = "org.eclipse.osgi"; //$NON-NLS-1$
25
	private static final String BUNDLE_OSGI = "org.eclipse.osgi"; //$NON-NLS-1$
24
	private static final String BUNDLE_CORE_JOBS = "org.eclipse.core.jobs"; //$NON-NLS-1$
26
	private static final String BUNDLE_CORE_JOBS = "org.eclipse.core.jobs"; //$NON-NLS-1$
Lines 27-34 Link Here
27
	private static final String BUNDLE_UPDATE_CONFIGURATOR = "org.eclipse.update.configurator"; //$NON-NLS-1$
29
	private static final String BUNDLE_UPDATE_CONFIGURATOR = "org.eclipse.update.configurator"; //$NON-NLS-1$
28
	private static final String START_LEVEL_2 = "@2:start"; //$NON-NLS-1$
30
	private static final String START_LEVEL_2 = "@2:start"; //$NON-NLS-1$
29
	private static final String START_LEVEL_3 = "@3:start"; //$NON-NLS-1$
31
	private static final String START_LEVEL_3 = "@3:start"; //$NON-NLS-1$
30
	private static final String START_LEVEL_4 = "@4:start"; //$NON-NLS-1$
32
31
	
32
	private String product = null;
33
	private String product = null;
33
	private ProductFile productFile = null;
34
	private ProductFile productFile = null;
34
	private String root = null;
35
	private String root = null;
Lines 40-82 Link Here
40
	 */
41
	 */
41
	public void generate() throws CoreException {
42
	public void generate() throws CoreException {
42
		initialize();
43
		initialize();
43
		
44
44
		if (productFile == null)
45
		if (productFile == null)
45
			return;
46
			return;
46
47
48
		//we need at least a product id
49
		if (productFile.getId() == null) {
50
			return;
51
		}
52
47
		String custom = findFile(productFile.getConfigIniPath(), false);
53
		String custom = findFile(productFile.getConfigIniPath(), false);
48
		String location = null, fileList = null;
54
		String location = null, fileList = null;
49
		for (Iterator iter = getConfigInfos().iterator(); iter.hasNext();) {
55
		for (Iterator iter = getConfigInfos().iterator(); iter.hasNext();) {
50
			Config config = (Config) iter.next();
56
			Config config = (Config) iter.next();
51
			location = DEFAULT_PRODUCT_ROOT_FILES_DIR + '/' + config.toStringReplacingAny(".", ANY_STRING); //$NON-NLS-1$
57
			location = DEFAULT_PRODUCT_ROOT_FILES_DIR + '/' + config.toStringReplacingAny(".", ANY_STRING); //$NON-NLS-1$
52
			
58
59
			String rootLocation = root + location;
60
			File rootDir = new File(rootLocation);
61
			if ((!rootDir.exists() && !rootDir.mkdirs()) || rootDir.isFile())
62
				continue; //we will fail trying to create the files, TODO log warning/error
63
53
			//add generated root files to build.properties
64
			//add generated root files to build.properties
54
			if (buildProperties != null) {
65
			if (buildProperties != null) {
55
				fileList = buildProperties.getProperty(ROOT_PREFIX + config.toString("."), ""); //$NON-NLS-1$ //$NON-NLS-2$
66
				fileList = buildProperties.getProperty(ROOT_PREFIX + config.toString("."), ""); //$NON-NLS-1$ //$NON-NLS-2$
56
				fileList += (fileList.length() > 0) ? ',' + location : location;
67
				fileList += (fileList.length() > 0) ? ',' + location : location;
57
				buildProperties.put(ROOT_PREFIX + config.toString("."), fileList); //$NON-NLS-1$
68
				buildProperties.put(ROOT_PREFIX + config.toString("."), fileList); //$NON-NLS-1$
58
			}
69
			}
59
			
70
60
			//configuration/config.ini
71
			//configuration/config.ini
61
			if (custom != null) {
72
			if (custom != null) {
62
				copyFile(custom, root + location + "/configuration/config.ini"); //$NON-NLS-1$
73
				copyFile(custom, rootLocation + "/configuration/config.ini"); //$NON-NLS-1$
63
			} else {
74
			} else {
64
				createConfigIni(config, root + location);				
75
				createConfigIni(config, rootLocation);
65
			}
76
			}
66
			
77
78
			//only the config.ini makes sense in the any config
79
			if (config.getOs().equals(Config.ANY))
80
				continue;
81
67
			//.eclipseproduct
82
			//.eclipseproduct
68
			createEclipseProductFile(root + location);
83
			createEclipseProductFile(rootLocation);
84
85
			//eclipse.ini
86
			createLauncherIniFile(rootLocation, config.getOs());
69
		}
87
		}
70
		
88
71
	}
89
	}
72
	
90
73
	private void initialize() throws CoreException {
91
	private void initialize() throws CoreException {
74
		loadProduct();
92
		loadProduct();
75
		
93
76
		PDEState state = getSite(false).getRegistry();
94
		PDEState state = getSite(false).getRegistry();
77
		refactoredRuntime = state.getResolvedBundle(BUNDLE_EQUINOX_COMMON) != null;
95
		refactoredRuntime = state.getResolvedBundle(BUNDLE_EQUINOX_COMMON) != null;
78
	}
96
	}
79
	
97
80
	private void loadProduct() throws CoreException {
98
	private void loadProduct() throws CoreException {
81
		if (product == null || product.startsWith("${")) { //$NON-NLS-1$
99
		if (product == null || product.startsWith("${")) { //$NON-NLS-1$
82
			productFile = null;
100
			productFile = null;
Lines 85-117 Link Here
85
		String productPath = findFile(product, false);
103
		String productPath = findFile(product, false);
86
		if (productPath == null)
104
		if (productPath == null)
87
			productPath = product;
105
			productPath = product;
88
		
106
89
		//the ProductFile uses the OS to determine which icons to return, we don't care so can use null
107
		//the ProductFile uses the OS to determine which icons to return, we don't care so can use null
90
		//this is better since this generator may be used for multiple OS's
108
		//this is better since this generator may be used for multiple OS's
91
		productFile = new ProductFile(productPath, null);
109
		productFile = new ProductFile(productPath, null);
92
	}
110
	}
93
	
111
94
	private void copyFile(String src, String dest) {
112
	private void copyFile(String src, String dest) {
95
		File source = new File(src);
113
		File source = new File(src);
96
		if (!source.exists())
114
		if (!source.exists())
97
			return;
115
			return;
98
		File destination = new File(dest);
116
		File destination = new File(dest);
99
		File destDir = destination.getParentFile();
117
		File destDir = destination.getParentFile();
100
		if (!destDir.exists())
118
		if ((!destDir.exists() && !destDir.mkdirs()) || destDir.isFile())
101
			destDir.mkdirs();
119
			return; //we will fail trying to create the file, TODO log warning/error
102
		
120
103
		InputStream in = null;
121
		InputStream in = null;
104
		OutputStream out = null;
122
		OutputStream out = null;
105
		try {
123
		try {
106
			in = new FileInputStream(source);
124
			in = new FileInputStream(source);
107
			out = new FileOutputStream(destination);
125
			out = new FileOutputStream(destination);
108
		
126
109
			//Transfer bytes from in to out
127
			//Transfer bytes from in to out
110
	        byte[] buf = new byte[1024];
128
			byte[] buf = new byte[1024];
111
	        int len;
129
			int len;
112
	        while ((len = in.read(buf)) > 0) {
130
			while ((len = in.read(buf)) > 0) {
113
	            out.write(buf, 0, len);
131
				out.write(buf, 0, len);
114
	        }
132
			}
115
		} catch (IOException e) {
133
		} catch (IOException e) {
116
			//nothing
134
			//nothing
117
		} finally {
135
		} finally {
Lines 132-162 Link Here
132
		}
150
		}
133
	}
151
	}
134
152
135
	
136
	private void createConfigIni(Config config, String location) throws CoreException {
153
	private void createConfigIni(Config config, String location) throws CoreException {
154
		File configDir = new File(location + "/configuration"); //$NON-NLS-1$
155
		if ((!configDir.exists() && !configDir.mkdirs()) || configDir.isFile())
156
			return; //we will fail trying to create the file, TODO log warning/error
157
137
		PDEState state = getSite(false).getRegistry();
158
		PDEState state = getSite(false).getRegistry();
138
		
159
139
		StringBuffer buffer = new StringBuffer();
160
		StringBuffer buffer = new StringBuffer();
140
		buffer.append("#Product Runtime Configuration File\n"); //$NON-NLS-1$
161
		buffer.append("#Product Runtime Configuration File\n"); //$NON-NLS-1$
141
		
162
142
		String splash = getSplashLocation(config);
163
		String splash = getSplashLocation(config);
143
		if (splash != null)
164
		if (splash != null)
144
			buffer.append("osgi.splashPath=" + splash + '\n'); //$NON-NLS-1$
165
			buffer.append("osgi.splashPath=" + splash + '\n'); //$NON-NLS-1$
145
166
167
		String application = productFile.getApplication();
168
		if (application != null)
169
			buffer.append("eclipse.application=" + application + '\n'); //$NON-NLS-1$
146
		buffer.append("eclipse.product=" + productFile.getId() + '\n'); //$NON-NLS-1$
170
		buffer.append("eclipse.product=" + productFile.getId() + '\n'); //$NON-NLS-1$
147
		buffer.append("osgi.bundles="); //$NON-NLS-1$
171
		buffer.append("osgi.bundles="); //$NON-NLS-1$
148
		if (productFile.useFeatures() || productFile.containsPlugin(BUNDLE_UPDATE_CONFIGURATOR)) {
172
		if (productFile.useFeatures() || productFile.containsPlugin(BUNDLE_UPDATE_CONFIGURATOR)) {
149
			if (refactoredRuntime) {
173
			if (refactoredRuntime) {
150
				buffer.append(BUNDLE_EQUINOX_COMMON);		buffer.append(START_LEVEL_2);	buffer.append(',');
174
				//org.eclipse.equinox.common@2:start,  
151
				buffer.append(BUNDLE_CORE_JOBS);			buffer.append(START_LEVEL_2);	buffer.append(',');
175
				buffer.append(BUNDLE_EQUINOX_COMMON);
152
				buffer.append(BUNDLE_EQUINOX_REGISTRY); 	buffer.append(START_LEVEL_2);	buffer.append(',');
176
				buffer.append(START_LEVEL_2);
153
				buffer.append(BUNDLE_EQUINOX_PREFERENCES);									buffer.append(',');
177
				buffer.append(',');
154
				buffer.append(BUNDLE_CORE_CONTENTTYPE);										buffer.append(',');
178
				//org.eclipse.core.jobs@2:start,
155
				buffer.append(BUNDLE_CORE_RUNTIME);			buffer.append(START_LEVEL_3);	buffer.append(',');
179
				buffer.append(BUNDLE_CORE_JOBS);
156
				buffer.append(BUNDLE_UPDATE_CONFIGURATOR);	buffer.append(START_LEVEL_4);	buffer.append('\n');
180
				buffer.append(START_LEVEL_2);
181
				buffer.append(',');
182
				//org.eclipse.core.runtime.compatibility.registry,
183
				buffer.append(BUNDLE_RUNTIME_COMPATIBILITY_REGISTRY);
184
				buffer.append(',');
185
				//org.eclipse.equinox.registry@2:start,
186
				buffer.append(BUNDLE_EQUINOX_REGISTRY);
187
				buffer.append(START_LEVEL_2);
188
				buffer.append(',');
189
				//org.eclipse.equinox.preferences,
190
				buffer.append(BUNDLE_EQUINOX_PREFERENCES);
191
				buffer.append(',');
192
				//org.eclipse.core.contenttype,
193
				buffer.append(BUNDLE_CORE_CONTENTTYPE);
194
				buffer.append(',');
195
				//org.eclipse.core.runtime@2:start,
196
				buffer.append(BUNDLE_CORE_RUNTIME);
197
				buffer.append(START_LEVEL_2);
198
				buffer.append(',');
199
				//org.eclipse.update.configurator@3:start
200
				buffer.append(BUNDLE_UPDATE_CONFIGURATOR);
201
				buffer.append(START_LEVEL_3);
202
				buffer.append('\n');
157
			} else {
203
			} else {
158
				buffer.append(BUNDLE_CORE_RUNTIME);			buffer.append(START_LEVEL_2);	buffer.append(',');
204
				buffer.append(BUNDLE_CORE_RUNTIME);
159
				buffer.append(BUNDLE_UPDATE_CONFIGURATOR);	buffer.append(START_LEVEL_3);	buffer.append('\n');
205
				buffer.append(START_LEVEL_2);
206
				buffer.append(',');
207
				buffer.append(BUNDLE_UPDATE_CONFIGURATOR);
208
				buffer.append(START_LEVEL_3);
209
				buffer.append('\n');
160
			}
210
			}
161
		} else {
211
		} else {
162
			Dictionary environment = new Hashtable(4);
212
			Dictionary environment = new Hashtable(4);
Lines 204-212 Link Here
204
254
205
		FileWriter writer = null;
255
		FileWriter writer = null;
206
		try {
256
		try {
207
			File configDir = new File(location + "/configuration"); //$NON-NLS-1$
208
			if (!configDir.exists())
209
				configDir.mkdirs();
210
			writer = new FileWriter(new File(configDir, "config.ini")); //$NON-NLS-1$
257
			writer = new FileWriter(new File(configDir, "config.ini")); //$NON-NLS-1$
211
			writer.write(buffer.toString());
258
			writer.write(buffer.toString());
212
		} catch (IOException e) {
259
		} catch (IOException e) {
Lines 222-245 Link Here
222
269
223
	}
270
	}
224
271
225
	private void createEclipseProductFile(String directory) throws CoreException  {
272
	private void createEclipseProductFile(String directory) throws CoreException {
226
		File dir = new File(directory);
273
		File dir = new File(directory);
227
		if (!dir.exists() || !dir.isDirectory())
274
		if ((!dir.exists() && !dir.mkdirs()) || dir.isFile())
228
			dir.mkdirs();
275
			return; //we will fail trying to create the file, TODO log warning/error
229
		
276
230
		Properties properties = new Properties();
277
		Properties properties = new Properties();
231
		properties.put("name", productFile.getProductName()); //$NON-NLS-1$
278
		if (productFile.getProductName() != null)
232
		properties.put("id", productFile.getId());		 //$NON-NLS-1$
279
			properties.put("name", productFile.getProductName()); //$NON-NLS-1$
280
		if (productFile.getId() != null)
281
			properties.put("id", productFile.getId()); //$NON-NLS-1$
233
282
234
		BundleDescription bundle = getSite(false).getRegistry().getResolvedBundle(getBrandingPlugin());
283
		BundleDescription bundle = getSite(false).getRegistry().getResolvedBundle(getBrandingPlugin());
235
		if (bundle != null)
284
		if (bundle != null)
236
			properties.put("version", bundle.getVersion().toString()); //$NON-NLS-1$
285
			properties.put("version", bundle.getVersion().toString()); //$NON-NLS-1$
237
		
286
238
		FileOutputStream stream = null;
287
		FileOutputStream stream = null;
239
		try {
288
		try {
240
			File file = new File(dir, ".eclipseproduct"); //$NON-NLS-1$
289
			File file = new File(dir, ".eclipseproduct"); //$NON-NLS-1$
241
			stream = new FileOutputStream(file);
290
			stream = new FileOutputStream(file);
242
			properties.store(stream, "Eclipse Product File");  //$NON-NLS-1$
291
			properties.store(stream, "Eclipse Product File"); //$NON-NLS-1$
243
			stream.flush();
292
			stream.flush();
244
		} catch (IOException e) {
293
		} catch (IOException e) {
245
			//nothing
294
			//nothing
Lines 256-261 Link Here
256
	
305
	
257
	private String getBrandingPlugin() {
306
	private String getBrandingPlugin() {
258
		String id = productFile.getId();
307
		String id = productFile.getId();
308
		if (id == null)
309
			return null;
259
		int dot = id.lastIndexOf('.');
310
		int dot = id.lastIndexOf('.');
260
		return (dot != -1) ? id.substring(0, dot) : null;
311
		return (dot != -1) ? id.substring(0, dot) : null;
261
	}
312
	}
Lines 293-302 Link Here
293
					}
344
					}
294
				}
345
				}
295
			}
346
			}
296
		}	
347
		}
297
		return buffer.toString();
348
		return buffer.toString();
298
	}
349
	}
299
	
350
351
	private void createLauncherIniFile(String directory, String os) {
352
		String launcher = getLauncherName();
353
354
		if (os.equals(Platform.OS_MACOSX)) {
355
				directory += "/" + launcher + ".app/Contents/MacOS"; //$NON-NLS-1$//$NON-NLS-2$
356
		}
357
		File dir = new File(directory);
358
		if ((!dir.exists() && !dir.mkdirs()) || dir.isFile())
359
			return; //we will fail trying to create the file TODO log warning/error
360
361
		String programArgs = productFile.getProgramArguments(os);
362
		String vmArgs = productFile.getVMArguments(os);
363
364
		if ((programArgs == null || programArgs.length() == 0) && (vmArgs == null || vmArgs.length() == 0))
365
			return;
366
367
		String lineDelimiter = Platform.OS_WIN32.equals(os) ? "\r\n" : "\n"; //$NON-NLS-1$ //$NON-NLS-2$
368
		PrintWriter writer = null;
369
		try {
370
			writer = new PrintWriter(new FileWriter(new File(dir, launcher + ".ini"))); //$NON-NLS-1$
371
			if (programArgs != null && programArgs.length() > 0) {
372
				StringTokenizer tokenizer = new StringTokenizer(programArgs);
373
				while (tokenizer.hasMoreTokens()) {
374
					writer.print(tokenizer.nextToken());
375
					writer.print(lineDelimiter);
376
				}
377
			}
378
			if (vmArgs != null && vmArgs.length() > 0) {
379
				writer.print("-vmargs"); //$NON-NLS-1$
380
				writer.print(lineDelimiter);
381
				StringTokenizer tokenizer = new StringTokenizer(vmArgs);
382
				while (tokenizer.hasMoreTokens()) {
383
					writer.print(tokenizer.nextToken());
384
					writer.print(lineDelimiter);
385
				}
386
			}
387
		} catch (IOException e) {
388
			//nothing
389
		} finally {
390
			if (writer != null) {
391
				writer.close();
392
			}
393
		}
394
	}
395
396
	private String getLauncherName() {
397
		String name = productFile.getLauncherName();
398
399
		if (name != null && name.length() > 0) {
400
			name = name.trim();
401
			if (name.endsWith(".exe")) //$NON-NLS-1$
402
				name = name.substring(0, name.length() - 4);
403
			return name;
404
		}
405
		return "eclipse"; //$NON-NLS-1$
406
	}
407
300
	public void setProduct(String product) {
408
	public void setProduct(String product) {
301
		this.product = product;
409
		this.product = product;
302
	}
410
	}
(-)src/org/eclipse/pde/internal/build/ProductFile.java (-75 / +273 lines)
Lines 25-99 Link Here
25
public class ProductFile extends DefaultHandler implements IPDEBuildConstants {
25
public class ProductFile extends DefaultHandler implements IPDEBuildConstants {
26
	private final static SAXParserFactory parserFactory = SAXParserFactory.newInstance();
26
	private final static SAXParserFactory parserFactory = SAXParserFactory.newInstance();
27
27
28
	private static final String PROGRAM_ARGS = "programArgs"; //$NON-NLS-1$
29
	private static final String PROGRAM_ARGS_LINUX = "programArgsLin"; //$NON-NLS-1$
30
	private static final String PROGRAM_ARGS_MAC = "programArgsMac"; //$NON-NLS-1$
31
	private static final String PROGRAM_ARGS_SOLARIS = "programArgsSol"; //$NON-NLS-1$
32
	private static final String PROGRAM_ARGS_WIN = "programArgsWin"; //$NON-NLS-1$
33
	private static final String VM_ARGS = "vmArgs"; //$NON-NLS-1$
34
	private static final String VM_ARGS_LINUX = "vmArgsLin"; //$NON-NLS-1$
35
	private static final String VM_ARGS_MAC = "vmArgsMac"; //$NON-NLS-1$
36
	private static final String VM_ARGS_SOLARIS = "vmArgsSol"; //$NON-NLS-1$
37
	private static final String VM_ARGS_WIN = "vmArgsWin"; //$NON-NLS-1$
38
	
28
	private static final String SOLARIS_LARGE = "solarisLarge"; //$NON-NLS-1$
39
	private static final String SOLARIS_LARGE = "solarisLarge"; //$NON-NLS-1$
29
	private static final String SOLARIS_MEDIUM = "solarisMedium"; //$NON-NLS-1$
40
	private static final String SOLARIS_MEDIUM = "solarisMedium"; //$NON-NLS-1$
30
	private static final String SOLARIS_SMALL = "solarisSmall"; //$NON-NLS-1$
41
	private static final String SOLARIS_SMALL = "solarisSmall"; //$NON-NLS-1$
31
	private static final String SOLARIS_TINY = "solarisTiny"; //$NON-NLS-1$
42
	private static final String SOLARIS_TINY = "solarisTiny"; //$NON-NLS-1$
32
33
	private static final String WIN32_16_LOW = "winSmallLow"; //$NON-NLS-1$
43
	private static final String WIN32_16_LOW = "winSmallLow"; //$NON-NLS-1$
34
	private static final String WIN32_16_HIGH = "winSmallHigh"; //$NON-NLS-1$
44
	private static final String WIN32_16_HIGH = "winSmallHigh"; //$NON-NLS-1$
35
	private static final String WIN32_32_LOW = "winMediumLow"; //$NON-NLS-1$
45
	private static final String WIN32_32_LOW = "winMediumLow"; //$NON-NLS-1$
36
	private static final String WIN32_32_HIGH = "winMediumHigh"; //$NON-NLS-1$
46
	private static final String WIN32_32_HIGH = "winMediumHigh"; //$NON-NLS-1$
37
	private static final String WIN32_48_LOW = "winLargeLow"; //$NON-NLS-1$
47
	private static final String WIN32_48_LOW = "winLargeLow"; //$NON-NLS-1$
38
	private static final String WIN32_48_HIGH = "winLargeHigh"; //$NON-NLS-1$
48
	private static final String WIN32_48_HIGH = "winLargeHigh"; //$NON-NLS-1$
39
49
	
50
	private static final String PRODUCT = "product"; //$NON-NLS-1$
51
	private static final String CONFIG_INI = "configIni"; //$NON-NLS-1$
52
	private static final String LAUNCHER = "launcher"; //$NON-NLS-1$
53
	private static final String LAUNCHER_ARGS = "launcherArgs"; //$NON-NLS-1$
54
	private static final String PLUGINS = "plugins"; //$NON-NLS-1$
55
	private static final String FEATURES = "features"; //$NON-NLS-1$
56
	private static final String SPLASH = "splash"; //$NON-NLS-1$
40
	private static final String P_USE_ICO = "useIco"; //$NON-NLS-1$
57
	private static final String P_USE_ICO = "useIco"; //$NON-NLS-1$
58
	
59
	//These constants form a small state machine to parse the .product file
60
	private static final int STATE_START = 0;
61
	private static final int STATE_PRODUCT = 1;
62
	private static final int STATE_LAUNCHER = 2;
63
	private static final int STATE_LAUNCHER_ARGS = 3;
64
	private static final int STATE_PLUGINS = 4;
65
	private static final int STATE_FEATURES = 5;
66
	private static final int STATE_PROGRAM_ARGS = 6;
67
	private static final int STATE_PROGRAM_ARGS_LINUX = 7;
68
	private static final int STATE_PROGRAM_ARGS_MAC = 8;
69
	private static final int STATE_PROGRAM_ARGS_SOLARIS = 9;
70
	private static final int STATE_PROGRAM_ARGS_WIN = 10;
71
	private static final int STATE_VM_ARGS = 11;
72
	private static final int STATE_VM_ARGS_LINUX = 12;
73
	private static final int STATE_VM_ARGS_MAC = 13;
74
	private static final int STATE_VM_ARGS_SOLARIS = 14;
75
	private static final int STATE_VM_ARGS_WIN = 15;
76
	
77
	private int state = STATE_START;
41
78
42
	private SAXParser parser;
79
	private SAXParser parser;
43
	private File location;
44
	private String currentOS = null;
80
	private String currentOS = null;
45
	private boolean useIco = false;
81
	private boolean useIco = false;
46
	private ArrayList result = new ArrayList(6);
82
	private ArrayList result = new ArrayList(6);
47
	private String launcherName = null;
83
	private String launcherName = null;
48
	private String icons[] = null;
84
	private String icons[] = null;
49
	private boolean parsed = false;
50
	private String configPath = null;
85
	private String configPath = null;
51
	private String id = null;
86
	private String id = null;
52
	private boolean useFeatures = false;
87
	private boolean useFeatures = false;
53
	private List plugins = null;
88
	private List plugins = null;
54
	private List features = null;
89
	private List features = null;
55
	private String splashLocation = null;
90
	private String splashLocation = null;
56
	private String productName;
91
	private String productName = null;
92
	private String application = null;
93
94
	private Properties  launcherArgs = new Properties();
95
	
96
	private static String normalize(String text) {
97
		if (text == null || text.trim().length() == 0)
98
			return ""; //$NON-NLS-1$
57
99
100
		text = text.replaceAll("\\r|\\n|\\f|\\t", " "); //$NON-NLS-1$ //$NON-NLS-2$
101
		return text.replaceAll("\\s+", " "); //$NON-NLS-1$ //$NON-NLS-2$
102
	}
103
	
58
	/**
104
	/**
59
	 * Constructs a feature parser.
105
	 * Constructs a feature parser.
60
	 */
106
	 */
61
	public ProductFile(String location, String os) throws CoreException {
107
	public ProductFile(String location, String os) throws CoreException {
62
		super();
108
		super();
63
		this.location = new File(location);
64
		this.currentOS = os;
109
		this.currentOS = os;
65
		try {
110
		try {
66
			parserFactory.setNamespaceAware(true);
111
			parserFactory.setNamespaceAware(true);
67
			parser = parserFactory.newSAXParser();
112
			parser = parserFactory.newSAXParser();
113
			InputStream in = new FileInputStream(location);
114
			parser.parse(new InputSource(in), this);
68
		} catch (ParserConfigurationException e) {
115
		} catch (ParserConfigurationException e) {
69
			throw new CoreException(new Status(IStatus.ERROR, PI_PDEBUILD, EXCEPTION_PRODUCT_FORMAT, e.getLocalizedMessage(), e));
116
			throw new CoreException(new Status(IStatus.ERROR, PI_PDEBUILD, EXCEPTION_PRODUCT_FORMAT, e.getLocalizedMessage(), e));
70
		} catch (SAXException e) {
117
		} catch (SAXException e) {
71
			throw new CoreException(new Status(IStatus.ERROR, PI_PDEBUILD, EXCEPTION_PRODUCT_FORMAT, e.getLocalizedMessage(), e));
118
			throw new CoreException(new Status(IStatus.ERROR, PI_PDEBUILD, EXCEPTION_PRODUCT_FORMAT, e.getLocalizedMessage(), e));
119
		} catch (FileNotFoundException e) {
120
			throw new CoreException(new Status(IStatus.ERROR, PI_PDEBUILD, EXCEPTION_PRODUCT_FORMAT, e.getLocalizedMessage(), e));
121
		} catch (IOException e) {
122
			throw new CoreException(new Status(IStatus.ERROR, PI_PDEBUILD, EXCEPTION_PRODUCT_FORMAT, e.getLocalizedMessage(), e));
72
		}
123
		}
73
	}
124
	}
74
125
75
	public String getLauncherName() {
126
	public String getLauncherName() {
76
		if (parsed)
77
			return launcherName;
78
		parse();
79
		return launcherName;
127
		return launcherName;
80
	}
128
	}
81
	
129
	
82
	public List getPlugins() {
130
	public List getPlugins() {
83
		if(!parsed)
131
		if (plugins == null)
84
			parse();
132
			return Collections.EMPTY_LIST;
85
		return plugins;
133
		return plugins;
86
	}
134
	}
87
	
135
	
88
	public List getFeatures() {
136
	public List getFeatures() {
89
		if(!parsed)
137
		if(features == null)
90
			parse();
138
			return Collections.EMPTY_LIST;
91
		return features;
139
		return features;
92
	}
140
	}
93
	
141
	
94
	public boolean containsPlugin(String plugin) {
142
	public boolean containsPlugin(String plugin) {
95
		if(!parsed)
96
			parse();
97
		return plugins != null && plugins.contains(plugin);
143
		return plugins != null && plugins.contains(plugin);
98
	}
144
	}
99
145
Lines 103-110 Link Here
103
	public String[] getIcons() {
149
	public String[] getIcons() {
104
		if (icons != null)
150
		if (icons != null)
105
			return icons;
151
			return icons;
106
		if (!parsed)
107
			parse();
108
		String[] temp = new String[result.size()];
152
		String[] temp = new String[result.size()];
109
		int i = 0;
153
		int i = 0;
110
		for (Iterator iter = result.iterator(); iter.hasNext();) {
154
		for (Iterator iter = result.iterator(); iter.hasNext();) {
Lines 118-199 Link Here
118
	}
162
	}
119
163
120
	public String getConfigIniPath() {
164
	public String getConfigIniPath() {
121
		if (!parsed)
122
			parse();
123
		return configPath;
165
		return configPath;
124
	}
166
	}
125
167
126
	public String getId() {
168
	public String getId() {
127
		if (!parsed)
128
			parse();
129
		return id;
169
		return id;
130
	}
170
	}
131
	
171
	
132
	public String getSplashLocation() {
172
	public String getSplashLocation() {
133
		if (!parsed)
134
			parse();
135
		return splashLocation;
173
		return splashLocation;
136
	}
174
	}
137
175
138
	public String getProductName() {
176
	public String getProductName() {
139
		if (!parsed)
140
			parse();
141
		return productName;
177
		return productName;
142
	}
178
	}
143
	
179
	
180
	public String getApplication() {
181
		return application;
182
	}
183
	
144
	public boolean useFeatures() {
184
	public boolean useFeatures() {
145
		if (!parsed)
146
			parse();
147
		return useFeatures;
185
		return useFeatures;
148
	}
186
	}
149
187
150
	private void parse() {
188
	public String getVMArguments(String os) {
151
		// mark us as parsed.  If we fail this time it is likely we will fail next time
189
		String key = null;
152
		// so don't even bother.
190
		if( os.equals(Platform.OS_WIN32)){
153
		parsed = true;
191
			key = VM_ARGS_WIN;
154
		InputStream in = null;
192
		} else if( os.equals(Platform.OS_LINUX)) {
155
		try {
193
			key = VM_ARGS_LINUX;
156
			in = new FileInputStream(location);
194
		} else if( os.equals(Platform.OS_MACOSX)) {
157
			try {
195
			key = VM_ARGS_MAC;
158
				parser.parse(new InputSource(in), this);
196
		} else if(os.equals(Platform.OS_SOLARIS)) {
159
			} catch (SAXException e) {
197
			key = VM_ARGS_SOLARIS;
160
				//Ignore
161
			} finally {
162
				in.close();
163
			}
164
		} catch (IOException e) {
165
			//Ignore
166
		}
198
		}
199
		
200
		String prefix = launcherArgs.getProperty(VM_ARGS);
201
		String platform = null, args = null;
202
		if (key != null)
203
			platform = launcherArgs.getProperty(key);
204
		if (prefix != null)
205
			args =  platform != null ? prefix + " " + platform : prefix; //$NON-NLS-1$
206
		else 
207
			args = platform != null ? platform : ""; //$NON-NLS-1$
208
		return normalize(args);
167
	}
209
	}
168
210
	
211
	public String getProgramArguments(String os) {
212
		String key = null;
213
		if( os.equals(Platform.OS_WIN32)){
214
			key = PROGRAM_ARGS_WIN;
215
		} else if( os.equals(Platform.OS_LINUX)) {
216
			key = PROGRAM_ARGS_LINUX;
217
		} else if( os.equals(Platform.OS_MACOSX)) {
218
			key = PROGRAM_ARGS_MAC;
219
		} else if(os.equals(Platform.OS_SOLARIS)) {
220
			key = PROGRAM_ARGS_SOLARIS;
221
		}
222
		
223
		String prefix = launcherArgs.getProperty(PROGRAM_ARGS);
224
		String platform = null, args = null;
225
		if (key != null)
226
			platform = launcherArgs.getProperty(key);
227
		if (prefix != null)
228
			args =  platform != null ? prefix + " " + platform : prefix; //$NON-NLS-1$
229
		else 
230
			args = platform != null ? platform : ""; //$NON-NLS-1$
231
		return normalize(args);
232
	}
233
	
169
	public void startElement(String uri, String localName, String qName, Attributes attributes) {
234
	public void startElement(String uri, String localName, String qName, Attributes attributes) {
170
		if ("launcher".equals(localName)) { //$NON-NLS-1$
235
		switch (state) {
171
			processLauncher(attributes);
236
			case STATE_START :
172
		} else if ("solaris".equals(localName)) { //$NON-NLS-1$
237
				if (PRODUCT.equals(localName)) {
173
			processSolaris(attributes);
238
					processProduct(attributes);
174
		} else if ("win".equals(localName)) { //$NON-NLS-1$
239
					state = STATE_PRODUCT;
175
			processWin(attributes);
240
				}
176
		} else if ("linux".equals(localName)) { //$NON-NLS-1$
241
				break;
177
			processLinux(attributes);
242
178
		} else if ("macosx".equals(localName)) { //$NON-NLS-1$
243
			case STATE_PRODUCT :
179
			processMac(attributes);
244
				if (CONFIG_INI.equals(localName)) {
180
		} else if ("ico".equals(localName)) { //$NON-NLS-1$
245
					processConfigIni(attributes);
181
			processIco(attributes);
246
				} else if (LAUNCHER.equals(localName)) {
182
		} else if ("bmp".equals(localName)) { //$NON-NLS-1$
247
					processLauncher(attributes);
183
			processBmp(attributes);
248
					state = STATE_LAUNCHER;
184
		} else if ("configIni".equals(localName)) { //$NON-NLS-1$
249
				} else if (PLUGINS.equals(localName)) {
185
			processConfigIni(attributes);
250
					state = STATE_PLUGINS;
186
		} else if ("product".equals(localName)) { //$NON-NLS-1$
251
				} else if (FEATURES.equals(localName)) {
187
			processProduct(attributes);
252
					state = STATE_FEATURES;
188
		} else if ("plugin".equals(localName)) { //$NON-NLS-1$
253
				} else if (LAUNCHER_ARGS.equals(localName)) {
189
			processPlugin(attributes);
254
					state = STATE_LAUNCHER_ARGS;
190
		} else if ("splash".equals(localName)) { //$NON-NLS-1$
255
				} else if (SPLASH.equals(localName)) {
191
			splashLocation = attributes.getValue("location"); //$NON-NLS-1$
256
					splashLocation = attributes.getValue("location"); //$NON-NLS-1$
192
		} else if ("feature".equals(localName)) { //$NON-NLS-1$
257
				}
193
			processFeature(attributes);
258
				break;
259
260
			case STATE_LAUNCHER :
261
				if (Platform.OS_SOLARIS.equals(localName)) {
262
					processSolaris(attributes);
263
				} else if ("win".equals(localName)) { //$NON-NLS-1$
264
					processWin(attributes);
265
				} else if (Platform.OS_LINUX.equals(localName)) {
266
					processLinux(attributes);
267
				} else if (Platform.OS_MACOSX.equals(localName)) {
268
					processMac(attributes);
269
				}
270
				if ("ico".equals(localName)) { //$NON-NLS-1$
271
					processIco(attributes);
272
				} else if ("bmp".equals(localName)) { //$NON-NLS-1$
273
					processBmp(attributes);
274
				}
275
				break;
276
277
			case STATE_LAUNCHER_ARGS :
278
				if (PROGRAM_ARGS.equals(localName)) {
279
					state = STATE_PROGRAM_ARGS;
280
				} else if (PROGRAM_ARGS_LINUX.equals(localName)) {
281
					state = STATE_PROGRAM_ARGS_LINUX;
282
				} else if (PROGRAM_ARGS_MAC.equals(localName)) {
283
					state = STATE_PROGRAM_ARGS_MAC;
284
				} else if (PROGRAM_ARGS_SOLARIS.equals(localName)) {
285
					state = STATE_PROGRAM_ARGS_SOLARIS;
286
				} else if (PROGRAM_ARGS_WIN.equals(localName)) {
287
					state = STATE_PROGRAM_ARGS_WIN;
288
				} else if (VM_ARGS.equals(localName)) {
289
					state = STATE_VM_ARGS;
290
				} else if (VM_ARGS_LINUX.equals(localName)) {
291
					state = STATE_VM_ARGS_LINUX;
292
				} else if (VM_ARGS_MAC.equals(localName)) {
293
					state = STATE_VM_ARGS_MAC;
294
				} else if (VM_ARGS_SOLARIS.equals(localName)) {
295
					state = STATE_VM_ARGS_SOLARIS;
296
				} else if (VM_ARGS_WIN.equals(localName)) {
297
					state = STATE_VM_ARGS_WIN;
298
				}
299
				break;
300
301
			case STATE_PLUGINS :
302
				if ("plugin".equals(localName)) { //$NON-NLS-1$
303
					processPlugin(attributes);
304
				}
305
				break;
306
307
			case STATE_FEATURES :
308
				if ("feature".equals(localName)) { //$NON-NLS-1$
309
					processFeature(attributes);
310
				}
311
				break;
194
		}
312
		}
195
	}
313
	}
196
314
315
	public void endElement(String uri, String localName, String qName) {
316
		switch (state) {
317
			case STATE_PLUGINS :
318
				if (PLUGINS.equals(localName))
319
					state = STATE_PRODUCT;
320
				break;
321
			case STATE_FEATURES :
322
				if (FEATURES.equals(localName))
323
					state = STATE_PRODUCT;
324
				break;
325
			case STATE_LAUNCHER_ARGS :
326
				if (LAUNCHER_ARGS.equals(localName))
327
					state = STATE_PRODUCT;
328
				break;
329
			case STATE_LAUNCHER :
330
				if (LAUNCHER.equals(localName))
331
					state = STATE_PRODUCT;
332
				break;
333
334
			case STATE_PROGRAM_ARGS :
335
			case STATE_PROGRAM_ARGS_LINUX :
336
			case STATE_PROGRAM_ARGS_MAC :
337
			case STATE_PROGRAM_ARGS_SOLARIS :
338
			case STATE_PROGRAM_ARGS_WIN :
339
			case STATE_VM_ARGS :
340
			case STATE_VM_ARGS_LINUX :
341
			case STATE_VM_ARGS_MAC :
342
			case STATE_VM_ARGS_SOLARIS :
343
			case STATE_VM_ARGS_WIN :
344
				state = STATE_LAUNCHER_ARGS;
345
				break;
346
		}
347
	}
348
	
349
	public void characters(char[] ch, int start, int length) {
350
		switch (state) {
351
			case STATE_PROGRAM_ARGS :
352
				addLaunchArgumentToMap(PROGRAM_ARGS, String.valueOf(ch, start, length));
353
				break;
354
			case STATE_PROGRAM_ARGS_LINUX :
355
				addLaunchArgumentToMap(PROGRAM_ARGS_LINUX, String.valueOf(ch, start, length));
356
				break;
357
			case STATE_PROGRAM_ARGS_MAC :
358
				addLaunchArgumentToMap(PROGRAM_ARGS_MAC, String.valueOf(ch, start, length));
359
				break;
360
			case STATE_PROGRAM_ARGS_SOLARIS :
361
				addLaunchArgumentToMap(PROGRAM_ARGS_SOLARIS, String.valueOf(ch, start, length));
362
				break;
363
			case STATE_PROGRAM_ARGS_WIN :
364
				addLaunchArgumentToMap(PROGRAM_ARGS_WIN, String.valueOf(ch, start, length));
365
				break;
366
			case STATE_VM_ARGS :
367
				addLaunchArgumentToMap(VM_ARGS, String.valueOf(ch, start, length));
368
				break;
369
			case STATE_VM_ARGS_LINUX :
370
				addLaunchArgumentToMap(VM_ARGS_LINUX, String.valueOf(ch, start, length));
371
				break;
372
			case STATE_VM_ARGS_MAC :
373
				addLaunchArgumentToMap(VM_ARGS_MAC, String.valueOf(ch, start, length));
374
				break;
375
			case STATE_VM_ARGS_SOLARIS :
376
				addLaunchArgumentToMap(VM_ARGS_SOLARIS, String.valueOf(ch, start, length));
377
				break;
378
			case STATE_VM_ARGS_WIN :
379
				addLaunchArgumentToMap(VM_ARGS_WIN, String.valueOf(ch, start, length));
380
				break;
381
		}
382
	}
383
	
384
	private void addLaunchArgumentToMap(String key, String value) {
385
		if (launcherArgs == null)
386
			launcherArgs = new Properties();
387
		
388
		String oldValue = launcherArgs.getProperty(key);
389
		if (oldValue != null)
390
			launcherArgs.setProperty(key, oldValue + value);
391
		else
392
			launcherArgs.setProperty(key, value);
393
	}
197
	private void processPlugin(Attributes attributes) {
394
	private void processPlugin(Attributes attributes) {
198
		if (plugins == null)
395
		if (plugins == null)
199
			plugins = new ArrayList();
396
			plugins = new ArrayList();
Lines 209-214 Link Here
209
	private void processProduct(Attributes attributes) {
406
	private void processProduct(Attributes attributes) {
210
		id = attributes.getValue("id"); //$NON-NLS-1$
407
		id = attributes.getValue("id"); //$NON-NLS-1$
211
		productName = attributes.getValue("name"); //$NON-NLS-1$
408
		productName = attributes.getValue("name"); //$NON-NLS-1$
409
		application = attributes.getValue("application"); //$NON-NLS-1$
212
		String use = attributes.getValue("useFeatures"); //$NON-NLS-1$
410
		String use = attributes.getValue("useFeatures"); //$NON-NLS-1$
213
		if (use != null)
411
		if (use != null)
214
			useFeatures = IBuildPropertiesConstants.TRUE.equalsIgnoreCase(use);
412
			useFeatures = IBuildPropertiesConstants.TRUE.equalsIgnoreCase(use);
Lines 233-239 Link Here
233
	}
431
	}
234
432
235
	private void processSolaris(Attributes attributes) {
433
	private void processSolaris(Attributes attributes) {
236
		if (!osMatch("solaris")) //$NON-NLS-1$
434
		if (!osMatch(Platform.OS_SOLARIS))
237
			return;
435
			return;
238
		result.add(attributes.getValue(SOLARIS_LARGE));
436
		result.add(attributes.getValue(SOLARIS_LARGE));
239
		result.add(attributes.getValue(SOLARIS_MEDIUM));
437
		result.add(attributes.getValue(SOLARIS_MEDIUM));
Lines 242-260 Link Here
242
	}
440
	}
243
441
244
	private void processWin(Attributes attributes) {
442
	private void processWin(Attributes attributes) {
245
		if (!osMatch("win32")) //$NON-NLS-1$
443
		if (!osMatch(Platform.OS_WIN32))
246
			return;
444
			return;
247
		useIco = "true".equals(attributes.getValue(P_USE_ICO)); //$NON-NLS-1$
445
		useIco = IBuildPropertiesConstants.TRUE.equalsIgnoreCase(attributes.getValue(P_USE_ICO));
248
	}
446
	}
249
447
250
	private void processIco(Attributes attributes) {
448
	private void processIco(Attributes attributes) {
251
		if (!osMatch("win32") || !useIco) //$NON-NLS-1$
449
		if (!osMatch(Platform.OS_WIN32) || !useIco) 
252
			return;
450
			return;
253
		result.add(attributes.getValue("path")); //$NON-NLS-1$
451
		result.add(attributes.getValue("path")); //$NON-NLS-1$
254
	}
452
	}
255
453
256
	private void processBmp(Attributes attributes) {
454
	private void processBmp(Attributes attributes) {
257
		if (!osMatch("win32") || useIco) //$NON-NLS-1$
455
		if (!osMatch(Platform.OS_WIN32) || useIco) 
258
			return;
456
			return;
259
		result.add(attributes.getValue(WIN32_16_HIGH));
457
		result.add(attributes.getValue(WIN32_16_HIGH));
260
		result.add(attributes.getValue(WIN32_16_LOW));
458
		result.add(attributes.getValue(WIN32_16_LOW));
Lines 265-277 Link Here
265
	}
463
	}
266
464
267
	private void processLinux(Attributes attributes) {
465
	private void processLinux(Attributes attributes) {
268
		if (!osMatch("linux")) //$NON-NLS-1$
466
		if (!osMatch(Platform.OS_LINUX)) 
269
			return;
467
			return;
270
		result.add(attributes.getValue("icon")); //$NON-NLS-1$
468
		result.add(attributes.getValue("icon")); //$NON-NLS-1$
271
	}
469
	}
272
470
273
	private void processMac(Attributes attributes) {
471
	private void processMac(Attributes attributes) {
274
		if (!osMatch("macosx")) //$NON-NLS-1$
472
		if (!osMatch(Platform.OS_MACOSX)) 
275
			return;
473
			return;
276
		result.add(attributes.getValue("icon")); //$NON-NLS-1$
474
		result.add(attributes.getValue("icon")); //$NON-NLS-1$
277
	}
475
	}
(-)src/org/eclipse/pde/internal/build/builder/FeatureBuildScriptGenerator.java (-1 / +6 lines)
Lines 541-547 Link Here
541
			generator.setBuildProperties(getBuildProperties());
541
			generator.setBuildProperties(getBuildProperties());
542
			generator.setRoot(featureRootLocation);
542
			generator.setRoot(featureRootLocation);
543
			generator.setWorkingDirectory(getWorkingDirectory());
543
			generator.setWorkingDirectory(getWorkingDirectory());
544
			generator.generate();
544
			try {
545
				generator.generate();
546
			} catch (CoreException e ) {
547
				//problem with the .product file
548
				//TODO Log warning/error
549
			}
545
		}
550
		}
546
		for (Iterator iter = getConfigInfos().iterator(); iter.hasNext();) {
551
		for (Iterator iter = getConfigInfos().iterator(); iter.hasNext();) {
547
			Config aConfig = (Config) iter.next();
552
			Config aConfig = (Config) iter.next();

Return to bug 127576