|Access EMF Model from Resources of Deployed plugin- "Not workspace" [message #1223213]
||Sun, 22 December 2013 19:55
| Salwa Alzahmi
Registered: June 2013
I have an EMF model stored in my plugin under directory /models/devices.pvt
so to access the files in the deployed plugin I used :
Bundle bundle = Platform.getBundle("com.arean.system");
String filePath = FileLocator.resolve(bundle.getEntry("/models/devices.pvt ")).getFile();
Is there is a way to create IFile from the file path.
usually I used blow code to access the one in the workspace , but definitely it is not the same when access plugin resources.
IFile modelFile = ResourcesPlugin.getWorkspace().getRoot().getFile(path.append(fileName));
|Re: Access EMF Model from Resources of Deployed plugin- &quot;Not workspace&quot; [message #1223410 is a reply to message #1223405]
||Mon, 23 December 2013 09:53
| Ed Merks
Registered: July 2009
Firstly you can only have IFiles for things in the workspace, and this
file is not in the workspace, so no you can't get that. Secondly, it is
a resource in your bundle so you should not be modifying it. Thirdly,
there's org.eclipse.emf.common.ui.URIEditorInput for opening an editor
for a URI.
On 23/12/2013 10:39 AM, Salwa Alzahmi wrote:
> Hi Ed and thank for your reply,
> I have used this to load the resources ..
> ResourceSet resourceSet = new ResourceSetImpl();
> URI fileUri =
> false) ;
> resource .load(null);
> still I need to get the IFile to this resources , so I can set it as
> an input to my editor . ???
Powered by FUDForum
. Page generated in 0.06600 seconds