Skip to main content



      Home
Home » Newcomers » Newcomers » JDT: how to get the workspace from *.internal.compiler.Compiler.process()
JDT: how to get the workspace from *.internal.compiler.Compiler.process() [message #218117] Tue, 26 June 2007 13:54 Go to next message
Eclipse UserFriend
Originally posted by: g_karab.cs.concordia.ca

Hi guys,

I have posted the following under the jdt group but I got no reply so I
am asking here as well in the hope I will get some pointers.

I am wondering if there is an "easy" way to obtain the full path name of
the file containing the compilation unit being processed? The
CompilationUnitDeclaration.getFileName() returns a partial path name
relative to the workspace AFAIK. Another workaround to this will be to
be able to obtain the current workspace but I can't see how I can do this.

Of course I can use the Compiler.lookupEnvironment.nameEnvironment and
search for it. Is there any other way?

Any help/ideas is appreciated.

TIA,

George
Re: JDT: how to get the workspace from *.internal.compiler.Compiler.process() [message #218151 is a reply to message #218117] Tue, 26 June 2007 16:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: csae7511.uibk.ac.at

Hi,

what about ResourcesPlugin.getWorkspace() (from plugin
org.eclipse.core.resources) and then search for your file - this should
be possible, since you have the relative path.
When you have the corresponding IFile, it should be no problem to get
the full path (using some method from FileLocator).

HTH,
Stefan

George Karabotsos schrieb:
> Hi guys,
>
> I have posted the following under the jdt group but I got no reply so I
> am asking here as well in the hope I will get some pointers.
>
> I am wondering if there is an "easy" way to obtain the full path name of
> the file containing the compilation unit being processed? The
> CompilationUnitDeclaration.getFileName() returns a partial path name
> relative to the workspace AFAIK. Another workaround to this will be to
> be able to obtain the current workspace but I can't see how I can do this.
>
> Of course I can use the Compiler.lookupEnvironment.nameEnvironment and
> search for it. Is there any other way?
>
> Any help/ideas is appreciated.
>
> TIA,
>
> George
Re: JDT: how to get the workspace from *.internal.compiler.Compiler.process() [message #218183 is a reply to message #218151] Tue, 26 June 2007 19:22 Go to previous message
Eclipse UserFriend
Originally posted by: g_karab.cs.concordia.ca

Thank you so much Stefan for pointing me to the ResourcesPlugin class.
Invoking
ResourcesPlugin.getWorkspace().getRoot().getRawLocation().to String();
gets me the workspace :).

Thanks again for the pointer!

George


Stefan Zugal wrote:
> Hi,
>
> what about ResourcesPlugin.getWorkspace() (from plugin
> org.eclipse.core.resources) and then search for your file - this should
> be possible, since you have the relative path.
> When you have the corresponding IFile, it should be no problem to get
> the full path (using some method from FileLocator).
>
> HTH,
> Stefan
>
> George Karabotsos schrieb:
>> Hi guys,
>>
>> I have posted the following under the jdt group but I got no reply so
>> I am asking here as well in the hope I will get some pointers.
>>
>> I am wondering if there is an "easy" way to obtain the full path name
>> of the file containing the compilation unit being processed? The
>> CompilationUnitDeclaration.getFileName() returns a partial path name
>> relative to the workspace AFAIK. Another workaround to this will be
>> to be able to obtain the current workspace but I can't see how I can
>> do this.
>>
>> Of course I can use the Compiler.lookupEnvironment.nameEnvironment and
>> search for it. Is there any other way?
>>
>> Any help/ideas is appreciated.
>>
>> TIA,
>>
>> George
Previous Topic:XML Editor plugin
Next Topic:Putting the existing source code into Project
Goto Forum:
  


Current Time: Thu Mar 13 15:32:28 EDT 2025

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

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

Back to the top