Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » From fully-qualified OS pathname to IResource
From fully-qualified OS pathname to IResource [message #325897] Sun, 02 March 2008 06:42 Go to next message
Eclipse UserFriend
Originally posted by: fraserofthenight.gmail.com

Hi,

I know this question has probably been asked a million times before, but
a cursory search didn't come up with anything. How do I get an IResource
from a fully-qualified OS-specific pathname? It may not eb physically
within the workspace (i.e. if a project resides on a path outside the
workspace root). For example, if I have something like:

"C:\Users\name\projects\project1\foo\bar\baz.d"

How do I get an IResource form that?
Re: From fully-qualified OS pathname to IResource [message #325900 is a reply to message #325897] Sun, 02 March 2008 12:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Robert,

IWorkspaceRoot.findFilesForLocation. There might be more than one...


Robert Fraser wrote:
> Hi,
>
> I know this question has probably been asked a million times before,
> but a cursory search didn't come up with anything. How do I get an
> IResource from a fully-qualified OS-specific pathname? It may not eb
> physically within the workspace (i.e. if a project resides on a path
> outside the workspace root). For example, if I have something like:
>
> "C:\Users\name\projects\project1\foo\bar\baz.d"
>
> How do I get an IResource form that?
Re: From fully-qualified OS pathname to IResource [message #325906 is a reply to message #325900] Sun, 02 March 2008 18:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: marc_e.ye.olde.spam.buster.cablespeed.com

I've had success with this:
File file = ...whatever();

IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot();
IFile fileResource = wsroot.getFileForLocation(new
Path(file.getAbsolutePath()));

best,

marc


"Ed Merks" <merks@ca.ibm.com> wrote in message
news:fqe4ur$pko$1@build.eclipse.org...
> Robert,
>
> IWorkspaceRoot.findFilesForLocation. There might be more than one...
>
>
> Robert Fraser wrote:
>> Hi,
>>
>> I know this question has probably been asked a million times before, but
>> a cursory search didn't come up with anything. How do I get an IResource
>> from a fully-qualified OS-specific pathname? It may not eb physically
>> within the workspace (i.e. if a project resides on a path outside the
>> workspace root). For example, if I have something like:
>>
>> "C:\Users\name\projects\project1\foo\bar\baz.d"
>>
>> How do I get an IResource form that?
Re: From fully-qualified OS pathname to IResource [message #325915 is a reply to message #325906] Mon, 03 March 2008 08:59 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: fraserofthenight.gmail.com

Excellent! Thank you both for your replies & patience!

Marc E wrote:
> I've had success with this:
> File file = ...whatever();
>
> IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot();
> IFile fileResource = wsroot.getFileForLocation(new
> Path(file.getAbsolutePath()));
>
> best,
>
> marc
>
>
> "Ed Merks" <merks@ca.ibm.com> wrote in message
> news:fqe4ur$pko$1@build.eclipse.org...
>> Robert,
>>
>> IWorkspaceRoot.findFilesForLocation. There might be more than one...
>>
>>
>> Robert Fraser wrote:
>>> Hi,
>>>
>>> I know this question has probably been asked a million times before, but
>>> a cursory search didn't come up with anything. How do I get an IResource
>>> from a fully-qualified OS-specific pathname? It may not eb physically
>>> within the workspace (i.e. if a project resides on a path outside the
>>> workspace root). For example, if I have something like:
>>>
>>> "C:\Users\name\projects\project1\foo\bar\baz.d"
>>>
>>> How do I get an IResource form that?
Re: From fully-qualified OS pathname to IResource [message #325918 is a reply to message #325915] Mon, 03 March 2008 12:30 Go to previous message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------060208000705020406070501
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Robert,

Funny you should mention patience. I just happened to blog about that
very topic last week. :-P


Patience is a Virtue
< http://ed-merks.blogspot.com/2008/02/patience-is-virtue.html>


Robert Fraser wrote:
> Excellent! Thank you both for your replies & patience!
>
> Marc E wrote:
>> I've had success with this:
>> File file = ...whatever();
>>
>> IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot();
>> IFile fileResource = wsroot.getFileForLocation(new
>> Path(file.getAbsolutePath()));
>>
>> best,
>>
>> marc
>>
>>
>> "Ed Merks" <merks@ca.ibm.com> wrote in message
>> news:fqe4ur$pko$1@build.eclipse.org...
>>> Robert,
>>>
>>> IWorkspaceRoot.findFilesForLocation. There might be more than one...
>>>
>>>
>>> Robert Fraser wrote:
>>>> Hi,
>>>>
>>>> I know this question has probably been asked a million times
>>>> before, but a cursory search didn't come up with anything. How do I
>>>> get an IResource from a fully-qualified OS-specific pathname? It
>>>> may not eb physically within the workspace (i.e. if a project
>>>> resides on a path outside the workspace root). For example, if I
>>>> have something like:
>>>>
>>>> "C:\Users\name\projects\project1\foo\bar\baz.d"
>>>>
>>>> How do I get an IResource form that?


--------------060208000705020406070501
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Robert,<br>
<br>
Funny you should mention patience.&nbsp; I just happened to blog about that
very topic last week.&nbsp; :-P<br>
<blockquote>
<h3 class="post-title entry-title"><a
href=" http://ed-merks.blogspot.com/2008/02/patience-is-virtue.html">Patience
is a Virtue</a></h3>
</blockquote>
<br>
Robert Fraser wrote:
<blockquote cite="mid:fqgem8$bvv$1@build.eclipse.org" type="cite">Excellent!
Thank you both for your replies &amp; patience!
<br>
<br>
Marc E wrote:
<br>
<blockquote type="cite">I've had success with this:
<br>
File file = ...whatever();
<br>
<br>
IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot();
<br>
IFile fileResource = wsroot.getFileForLocation(new
Path(file.getAbsolutePath()));
<br>
<br>
best,
<br>
<br>
marc
<br>
<br>
<br>
"Ed Merks" <a class="moz-txt-link-rfc2396E" href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a> wrote in message
<a class="moz-txt-link-freetext" href="news:fqe4ur$pko$1@build.eclipse.org">news:fqe4ur$pko$1@build.eclipse.org</a>...
<br>
<blockquote type="cite">Robert,
<br>
<br>
IWorkspaceRoot.findFilesForLocation.&nbsp; There might be more than one...
<br>
<br>
<br>
Robert Fraser wrote:
<br>
<blockquote type="cite">Hi,
<br>
<br>
I know this question has probably been asked a million times before,
but a cursory search didn't come up with anything. How do I get an
IResource from a fully-qualified OS-specific pathname? It may not eb
physically within the workspace (i.e. if a project resides on a path
outside the workspace root). For example, if I have something like:
<br>
<br>
"C:\Users\name\projects\project1\foo\bar\baz.d"
<br>
<br>
How do I get an IResource form that? </blockquote>
</blockquote>
</blockquote>
</blockquote>
<br>
</body>
</html>

--------------060208000705020406070501--
Previous Topic:Questions about my TextEditor
Next Topic:Eclipse NLS class in non-osgi environment
Goto Forum:
  


Current Time: Sun Jul 07 08:25:41 GMT 2024

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

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

Back to the top