Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » ICompilationUnit persistence
ICompilationUnit persistence [message #211505] Wed, 03 August 2005 22:46 Go to next message
Eclipse UserFriend
Originally posted by: craig.officeextend.com

I'm writing an eclipse plug-in (an screen design editor) and I'm a
relative newbie. This can be a dangerous combination. At one point in my
code, I have a reference to an ICompilationUnit. I would like to find an
easy way to save some data about this unit into my proprietary XML. It
looks like I need to perhaps save the project name and some path
information. Then when the file is reopened, I'd like to again have
access to the same ICompilationUnit.

So something like:

<controller>
<controllerProject>
FooBar
</controllerProject>
<controllerPath>
com.expd.arch.TestController.java
</controllerPath>
</controller>

Can someone point me to the correct API calls to make this happen?
Re: ICompilationUnit persistence [message #211549 is a reply to message #211505] Thu, 04 August 2005 08:30 Go to previous messageGo to next message
Markus KellerFriend
Messages: 294
Registered: July 2009
Senior Member
Craig Fransen wrote:

> I'm writing an eclipse plug-in (an screen design editor) and I'm a
> relative newbie. This can be a dangerous combination. At one point in
> my code, I have a reference to an ICompilationUnit. I would like to
> find an easy way to save some data about this unit into my proprietary
> XML. It looks like I need to perhaps save the project name and some
> path information. Then when the file is reopened, I'd like to again
> have access to the same ICompilationUnit.
>
> So something like:
>
> <controller>
> <controllerProject>
> FooBar
> </controllerProject>
> <controllerPath>
> com.expd.arch.TestController.java
> </controllerPath>
> </controller>
>
> Can someone point me to the correct API calls to make this happen?
>

You could use IJavaElement#getHandleIdentifier() to save the reference and
JavaCore#create(String) to re-create the ICompilationUnit.

Markus
Re: ICompilationUnit persistence [message #211645 is a reply to message #211549] Thu, 04 August 2005 21:58 Go to previous message
Eclipse UserFriend
Originally posted by: craig.officeextend.com

Perfect. Thank you.
Previous Topic:Retreiving the path to a plugin
Next Topic:CVS: how to find which version a branch was created from?
Goto Forum:
  


Current Time: Sat Apr 27 01:36:34 GMT 2024

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

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

Back to the top