|
Lines 21-26
Link Here
|
| 21 |
|
21 |
|
| 22 |
import org.eclipse.core.runtime.FileLocator; |
22 |
import org.eclipse.core.runtime.FileLocator; |
| 23 |
import org.eclipse.core.runtime.Path; |
23 |
import org.eclipse.core.runtime.Path; |
|
|
24 |
import org.eclipse.tptp.platform.agentcontroller.config.FileFilterImpl; |
| 24 |
import org.eclipse.tptp.platform.agentcontroller.config.IConfigUtility; |
25 |
import org.eclipse.tptp.platform.agentcontroller.config.IConfigUtility; |
| 25 |
import org.eclipse.tptp.platform.agentcontroller.config.SetConfig; |
26 |
import org.eclipse.tptp.platform.agentcontroller.config.SetConfig; |
| 26 |
|
27 |
|
|
Lines 32-37
Link Here
|
| 32 |
String result; |
33 |
String result; |
| 33 |
|
34 |
|
| 34 |
try{ |
35 |
try{ |
|
|
36 |
|
| 35 |
org.osgi.framework.Bundle bundle = org.eclipse.core.runtime.Platform.getBundle(pluginAlias); |
37 |
org.osgi.framework.Bundle bundle = org.eclipse.core.runtime.Platform.getBundle(pluginAlias); |
| 36 |
File f = FileLocator.getBundleFile(bundle); |
38 |
File f = FileLocator.getBundleFile(bundle); |
| 37 |
|
39 |
|
|
Lines 40-47
Link Here
|
| 40 |
} |
42 |
} |
| 41 |
|
43 |
|
| 42 |
if(f.exists() && !f.isDirectory()){ |
44 |
if(f.exists() && !f.isDirectory()){ |
| 43 |
//return the path of jar file |
45 |
//228856 |
| 44 |
return f.getAbsolutePath(); |
46 |
if("org.eclipse.swt".equalsIgnoreCase(pluginAlias)){ |
|
|
47 |
return AddAllSWTJars(f); |
| 48 |
}else |
| 49 |
//return the path of jar file |
| 50 |
return f.getAbsolutePath(); |
| 45 |
}else if (f.isDirectory()){ |
51 |
}else if (f.isDirectory()){ |
| 46 |
return locateBundleJarFile(f.getCanonicalPath()); |
52 |
return locateBundleJarFile(f.getCanonicalPath()); |
| 47 |
}else if(!f.exists()){ |
53 |
}else if(!f.exists()){ |
|
Lines 79-86
Link Here
|
| 79 |
return classpath.substring(0, classpath.length() - 1); // removing the last file.pathSeparator |
85 |
return classpath.substring(0, classpath.length() - 1); // removing the last file.pathSeparator |
| 80 |
}else { |
86 |
}else { |
| 81 |
return new String("null"); |
87 |
return new String("null"); |
|
|
88 |
} |
| 89 |
} |
| 90 |
|
| 91 |
private String AddAllSWTJars(File swtJar){ |
| 92 |
|
| 93 |
// <Eclipse>/plugin contains three swt jar: org.eclipse.swt_<version>.jar, org.eclipse.swt.<platform>_<version>.jar |
| 94 |
// and org.eclipse.swt.<platform>.source_<version>.jar. FileLocator returns the path to the first one. |
| 95 |
// We need the path of the 2nd jar. |
| 96 |
|
| 97 |
StringBuffer path = new StringBuffer(); |
| 98 |
if(swtJar == null) |
| 99 |
return "null"; |
| 100 |
|
| 101 |
File dir = swtJar.getParentFile(); |
| 102 |
File[] jars = dir.listFiles(new FileFilterImpl("^org.eclipse.swt.*")); |
| 103 |
|
| 104 |
for(int i = 0; i < jars.length; i++) { |
| 105 |
path.append(jars[i].getAbsolutePath() + File.pathSeparator); |
| 82 |
} |
106 |
} |
|
|
107 |
String classpath = path.toString(); |
| 108 |
if(classpath.length() > 1) { |
| 109 |
return classpath.substring(0, classpath.length() - 1); // removing the last file.pathSeparator |
| 110 |
}else { |
| 111 |
return new String("null"); |
| 112 |
} |
| 83 |
|
113 |
|
| 84 |
|
|
|
| 85 |
} |
114 |
} |
| 86 |
} |
115 |
} |