Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Get IFile from IWorkspaceRoot and location String
Get IFile from IWorkspaceRoot and location String [message #22657] Wed, 17 September 2008 16:01 Go to next message
Paul Reiners is currently offline Paul ReinersFriend
Messages: 19
Registered: July 2009
Junior Member
You can assume the Java package for all these Eclipse classes is
org.eclipse.core.resources.

I want to get an IFile corresponding to a location String I have:

" platform:/resource/Tracbility_All_Supported_lib/processes/ga stuff/globalht/GlobalHTInterface.wsdl "

I have the enclosing IWorkspace and IWorkspaceRoot. If I had the IPath
corresponding to the location above, I could simply call
IWorkspaceRoot.getFileForLocation(IPath).

How do I get the corresponding IPath from the location String? Or is
there some other way to get the corresponding IFile?
Re: Get IFile from IWorkspaceRoot and location String [message #22703 is a reply to message #22657] Wed, 17 September 2008 17:39 Go to previous message
Paul Reiners is currently offline Paul ReinersFriend
Messages: 19
Registered: July 2009
Junior Member
To answer my own question, this works:

String platformLocationString = portTypeContainer
.getLocation();
String locationString = platformLocationString
.substring("platform:/resource/".length());
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IWorkspaceRoot workspaceRoot = workspace.getRoot();
IFile wSDLFile = (IFile) workspaceRoot
.findMember(locationString);


Paul Reiners wrote:
> You can assume the Java package for all these Eclipse classes is
> org.eclipse.core.resources.
>
> I want to get an IFile corresponding to a location String I have:
>
> " platform:/resource/Tracbility_All_Supported_lib/processes/ga stuff/globalht/GlobalHTInterface.wsdl "
>
>
> I have the enclosing IWorkspace and IWorkspaceRoot. If I had the IPath
> corresponding to the location above, I could simply call
> IWorkspaceRoot.getFileForLocation(IPath).
>
> How do I get the corresponding IPath from the location String? Or is
> there some other way to get the corresponding IFile?
Re: Get IFile from IWorkspaceRoot and location String [message #580722 is a reply to message #22657] Wed, 17 September 2008 17:39 Go to previous message
Paul Reiners is currently offline Paul ReinersFriend
Messages: 19
Registered: July 2009
Junior Member
To answer my own question, this works:

String platformLocationString = portTypeContainer
.getLocation();
String locationString = platformLocationString
.substring("platform:/resource/".length());
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IWorkspaceRoot workspaceRoot = workspace.getRoot();
IFile wSDLFile = (IFile) workspaceRoot
.findMember(locationString);


Paul Reiners wrote:
> You can assume the Java package for all these Eclipse classes is
> org.eclipse.core.resources.
>
> I want to get an IFile corresponding to a location String I have:
>
> " platform:/resource/Tracbility_All_Supported_lib/processes/ga stuff/globalht/GlobalHTInterface.wsdl "
>
>
> I have the enclosing IWorkspace and IWorkspaceRoot. If I had the IPath
> corresponding to the location above, I could simply call
> IWorkspaceRoot.getFileForLocation(IPath).
>
> How do I get the corresponding IPath from the location String? Or is
> there some other way to get the corresponding IFile?
Previous Topic:Get IFile from IWorkspaceRoot and location String
Next Topic:export wizard and team provider
Goto Forum:
  


Current Time: Fri Apr 19 17:05:23 GMT 2024

Powered by FUDForum. Page generated in 0.01393 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top