|
Lines 11-20
Link Here
|
| 11 |
package org.eclipse.pde.internal.core; |
11 |
package org.eclipse.pde.internal.core; |
| 12 |
|
12 |
|
| 13 |
import java.io.File; |
13 |
import java.io.File; |
|
|
14 |
import java.net.MalformedURLException; |
| 14 |
import java.net.URL; |
15 |
import java.net.URL; |
| 15 |
import java.util.*; |
16 |
import java.util.*; |
| 16 |
import org.eclipse.core.runtime.Path; |
17 |
import org.eclipse.core.runtime.Path; |
| 17 |
import org.eclipse.pde.core.plugin.IPluginBase; |
|
|
| 18 |
import org.eclipse.pde.core.plugin.IPluginModelBase; |
18 |
import org.eclipse.pde.core.plugin.IPluginModelBase; |
| 19 |
import org.eclipse.pde.internal.core.target.AbstractTargetHandle; |
19 |
import org.eclipse.pde.internal.core.target.AbstractTargetHandle; |
| 20 |
import org.eclipse.pde.internal.core.target.provisional.NameVersionDescriptor; |
20 |
import org.eclipse.pde.internal.core.target.provisional.NameVersionDescriptor; |
|
Lines 63-100
Link Here
|
| 63 |
} |
63 |
} |
| 64 |
} |
64 |
} |
| 65 |
} |
65 |
} |
| 66 |
// enable pooled bundles properly (only if part of the profile) |
|
|
| 67 |
String pooled = pref.getString(ICoreConstants.POOLED_BUNDLES); |
| 68 |
if (pooled != null && pooled.trim().length() > 0) { |
| 69 |
if (ICoreConstants.VALUE_SAVED_NONE.equals(pooled)) { |
| 70 |
// all pooled bundles are disabled |
| 71 |
for (int i = 0; i < fModels.length; i++) { |
| 72 |
if (AbstractTargetHandle.BUNDLE_POOL.isPrefixOf(new Path(fModels[i].getInstallLocation()))) { |
| 73 |
fModels[i].setEnabled(false); |
| 74 |
} |
| 75 |
} |
| 76 |
} else { |
| 77 |
StringTokenizer tokenizer = new StringTokenizer(pooled, ","); //$NON-NLS-1$ |
| 78 |
Set enabled = new HashSet(); |
| 79 |
while (tokenizer.hasMoreTokens()) { |
| 80 |
String id = tokenizer.nextToken(); |
| 81 |
if (tokenizer.hasMoreTokens()) { |
| 82 |
String ver = tokenizer.nextToken(); |
| 83 |
if (ICoreConstants.VALUE_SAVED_NONE.equals(ver)) { // indicates null version |
| 84 |
ver = null; |
| 85 |
} |
| 86 |
enabled.add(new NameVersionDescriptor(id, ver)); |
| 87 |
} |
| 88 |
} |
| 89 |
for (int i = 0; i < fModels.length; i++) { |
| 90 |
if (AbstractTargetHandle.BUNDLE_POOL.isPrefixOf(new Path(fModels[i].getInstallLocation()))) { |
| 91 |
IPluginBase base = fModels[i].getPluginBase(); |
| 92 |
NameVersionDescriptor desc = new NameVersionDescriptor(base.getId(), base.getVersion()); |
| 93 |
fModels[i].setEnabled(enabled.contains(desc)); |
| 94 |
} |
| 95 |
} |
| 96 |
} |
| 97 |
} |
| 98 |
} |
66 |
} |
| 99 |
|
67 |
|
| 100 |
public void setModels(IPluginModelBase[] models) { |
68 |
public void setModels(IPluginModelBase[] models) { |
|
Lines 111-134
Link Here
|
| 111 |
if (tokenizer.countTokens() == 0) |
79 |
if (tokenizer.countTokens() == 0) |
| 112 |
return base; |
80 |
return base; |
| 113 |
|
81 |
|
| 114 |
File[] extraLocations = new File[tokenizer.countTokens()]; |
82 |
List extraLocations = new ArrayList(tokenizer.countTokens()); |
| 115 |
for (int i = 0; i < extraLocations.length; i++) { |
83 |
boolean addPool = false; |
|
|
84 |
while (tokenizer.hasMoreTokens()) { |
| 116 |
String location = tokenizer.nextToken(); |
85 |
String location = tokenizer.nextToken(); |
| 117 |
File dir = new File(location, "plugins"); //$NON-NLS-1$ |
86 |
if (AbstractTargetHandle.BUNDLE_POOL.isPrefixOf(new Path(location))) { |
| 118 |
if (!dir.exists() || !dir.isDirectory()) |
87 |
addPool = true; |
| 119 |
dir = new File(location); |
88 |
} else { |
| 120 |
extraLocations[i] = dir; |
89 |
File dir = new File(location, "plugins"); //$NON-NLS-1$ |
|
|
90 |
if (!dir.exists() || !dir.isDirectory()) |
| 91 |
dir = new File(location); |
| 92 |
extraLocations.add(dir); |
| 93 |
} |
| 121 |
} |
94 |
} |
| 122 |
URL[] additional = PluginPathFinder.scanLocations(extraLocations); |
95 |
URL[] additional = PluginPathFinder.scanLocations((File[]) extraLocations.toArray(new File[extraLocations.size()])); |
|
|
96 |
URL[] result = append(base, additional); |
| 123 |
|
97 |
|
| 124 |
if (additional.length == 0) |
98 |
// add pooled bundles (only if part of the profile) |
| 125 |
return base; |
99 |
if (addPool) { |
|
|
100 |
String pooled = pref.getString(ICoreConstants.POOLED_URLS); |
| 101 |
if (pooled != null && pooled.trim().length() > 0) { |
| 102 |
if (ICoreConstants.VALUE_SAVED_NONE.equals(pooled)) { |
| 103 |
// none |
| 104 |
} else { |
| 105 |
tokenizer = new StringTokenizer(pooled, ","); //$NON-NLS-1$ |
| 106 |
List urls = new ArrayList(tokenizer.countTokens()); |
| 107 |
while (tokenizer.hasMoreTokens()) { |
| 108 |
String extForm = tokenizer.nextToken(); |
| 109 |
try { |
| 110 |
urls.add(new URL(extForm)); |
| 111 |
} catch (MalformedURLException e) { |
| 112 |
// TODO Auto-generated catch block |
| 113 |
} |
| 114 |
} |
| 115 |
additional = (URL[]) urls.toArray(new URL[urls.size()]); |
| 116 |
result = append(result, additional); |
| 117 |
} |
| 118 |
} |
| 119 |
} |
| 126 |
|
120 |
|
|
|
121 |
return result; |
| 122 |
} |
| 123 |
|
| 124 |
private URL[] append(URL[] base, URL[] additional) { |
| 125 |
if (additional.length == 0) { |
| 126 |
return base; |
| 127 |
} |
| 127 |
URL[] result = new URL[base.length + additional.length]; |
128 |
URL[] result = new URL[base.length + additional.length]; |
| 128 |
System.arraycopy(base, 0, result, 0, base.length); |
129 |
System.arraycopy(base, 0, result, 0, base.length); |
| 129 |
System.arraycopy(additional, 0, result, base.length, additional.length); |
130 |
System.arraycopy(additional, 0, result, base.length, additional.length); |
| 130 |
|
|
|
| 131 |
return result; |
131 |
return result; |
| 132 |
} |
132 |
} |
| 133 |
|
|
|
| 134 |
} |
133 |
} |