blob: 1dc0faa0361e406383a29e35991da0d9494fe544 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
/*******************************************************************************
* Copyright (c) 2008 Code 9 and others. All rights reserved. This
* program and the accompanying materials are made available under the terms of
* the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Code 9 - initial API and implementation
******************************************************************************/
package org.eclipse.equinox.p2.publisher.eclipse;
import org.eclipse.equinox.internal.p2.publisher.eclipse.*;
import org.eclipse.equinox.internal.provisional.p2.core.Version;
public class BrandedExecutableAction extends EquinoxExecutableAction {
private ProductFile product;
public BrandedExecutableAction(ExecutablesDescriptor executables, String productLocation, String flavor, String configSpec) {
super();
this.executables = executables;
this.flavor = flavor;
this.configSpec = configSpec;
product = loadProduct(productLocation);
idBase = product.getProductName();
version = new Version(product.getVersion());
}
private ProductFile loadProduct(String productLocation) {
ProductFile result = null;
try {
result = new ProductFile(productLocation);
} catch (Exception e) {
//TODO
}
if (result == null)
throw new IllegalArgumentException("unable to load product file");
return result;
}
/**
* Brands a copy of the given executable descriptor with the information in the
* current product definition. The files described in the descriptor are also copied
* to a temporary location to avoid destructive modification
* @param descriptor the executable descriptor to brand.
* @return the new descriptor
*/
protected ExecutablesDescriptor brandExecutables(ExecutablesDescriptor descriptor) {
ExecutablesDescriptor result = new ExecutablesDescriptor(descriptor);
result.makeTemporaryCopy();
BrandingIron iron = new BrandingIron();
String os = parseConfigSpec(configSpec)[1];
iron.setIcons(product.getIcons(os));
iron.setName(product.getLauncherName());
iron.setOS(os);
iron.setRoot(result.getLocation().getAbsolutePath());
try {
iron.brand();
result.setExecutableName(product.getLauncherName(), true);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return result;
}
}
|