20 |
20 |
21 import java.io.File; |
21 import java.io.File; |
22 import java.io.IOException; |
22 import java.io.IOException; |
23 import java.net.URISyntaxException; |
23 import java.net.URISyntaxException; |
24 import java.net.URL; |
24 import java.net.URL; |
|
25 import java.net.URLEncoder; |
25 |
26 |
26 import org.eclipse.core.runtime.FileLocator; |
27 import org.eclipse.core.runtime.FileLocator; |
27 import org.eclipse.core.runtime.IConfigurationElement; |
28 import org.eclipse.core.runtime.IConfigurationElement; |
28 import org.eclipse.core.runtime.Path; |
29 import org.eclipse.core.runtime.Path; |
29 import org.eclipse.core.runtime.Platform; |
30 import org.eclipse.core.runtime.Platform; |
48 final String path = element.getAttribute("file"); |
49 final String path = element.getAttribute("file"); |
49 final Bundle bundle = Platform.getBundle(name); |
50 final Bundle bundle = Platform.getBundle(name); |
50 final URL url = FileLocator.find(bundle, new Path(path), null); |
51 final URL url = FileLocator.find(bundle, new Path(path), null); |
51 try { |
52 try { |
52 final URL fileURL = FileLocator.toFileURL(url); |
53 final URL fileURL = FileLocator.toFileURL(url); |
53 final File file = new File(fileURL.toURI()); |
54 final File file = new File(fileURL.getPath()); |
54 final IIncludePathEntry entry = JavaScriptCore.newLibraryEntry(new Path(file.getAbsolutePath()), null, |
55 final IIncludePathEntry entry = JavaScriptCore.newLibraryEntry(new Path(file.getAbsolutePath()), null, |
55 null); |
56 null); |
56 entries = new IIncludePathEntry[] { entry }; |
57 entries = new IIncludePathEntry[] { entry }; |
57 } catch (IOException e) { |
58 } catch (IOException e) { |
58 TMWCore.log(String.format("Can't find file %s in plugin %s", path, name), e); |
|
59 } catch (URISyntaxException e) { |
|
60 TMWCore.log(String.format("Can't find file %s in plugin %s", path, name), e); |
59 TMWCore.log(String.format("Can't find file %s in plugin %s", path, name), e); |
61 } |
60 } |
62 } |
61 } |
63 return entries; |
62 return entries; |
64 } |
63 } |