Bug 219993 - Request handle support in C Model for CDT+Mylyn
Summary: Request handle support in C Model for CDT+Mylyn
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-core (show other bugs)
Version: 5.0   Edit
Hardware: PC Linux
: P3 enhancement (vote)
Target Milestone: 5.0 M6   Edit
Assignee: Anton Leherbauer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-22 12:08 EST by Jeff Johnston CLA
Modified: 2008-03-12 09:38 EDT (History)
2 users (show)

See Also:


Attachments
Sample CDT handle/model element code example (2.80 KB, text/plain)
2008-02-29 16:36 EST, Jeff Johnston CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff Johnston CLA 2008-02-22 12:08:07 EST
To add CDT Mylyn support, interfaces are required to store a String handle for a model element which can be used later to retrieve the model element.  The handle is stable across Workspace sessions.  

For Java, the IJavaElement interface provides getHandleIdentifier() and the JavaCore class provides a create(String handle) method.

It is proposed that corresponding CDT interfaces be added.  Thus, org.eclipse.cdt.core.model.ICElement interface needs to add:  

   public String getHandleIdentifier();

and org.eclipse.cdt.core.model.CoreModel needs to add:

   public ICElement create(String handle);
Comment 1 Doug Schaefer CLA 2008-02-22 13:20:36 EST
Cool. I have no problem with that.
Comment 2 Anton Leherbauer CLA 2008-02-29 04:37:03 EST
(In reply to comment #0)
> It is proposed that corresponding CDT interfaces be added.  Thus,
> org.eclipse.cdt.core.model.ICElement interface needs to add:  
>    public String getHandleIdentifier();
> and org.eclipse.cdt.core.model.CoreModel needs to add:
>    public ICElement create(String handle);

Are you going to provide a patch for that or are you expecting us to provide API and implementation?
Comment 3 Jeff Johnston CLA 2008-02-29 16:36:24 EST
Created attachment 91253 [details]
Sample CDT handle/model element code example
Comment 4 Jeff Johnston CLA 2008-02-29 16:39:24 EST
(In reply to comment #2)
> (In reply to comment #0)
> > It is proposed that corresponding CDT interfaces be added.  Thus,
> > org.eclipse.cdt.core.model.ICElement interface needs to add:  
> >    public String getHandleIdentifier();
> > and org.eclipse.cdt.core.model.CoreModel needs to add:
> >    public ICElement create(String handle);
> 
> Are you going to provide a patch for that or are you expecting us to provide
> API and implementation?
> 

I am expecting you to provide implementation if you are ok with the proposed API (which matches the JDT support).  I personally hacked together a working implementation that has a single static routine for creating the handles and one for deciphering them.  I have included my hacks as an attachment if that is of any help.

Comment 5 Anton Leherbauer CLA 2008-03-11 10:41:25 EDT
I am going to add the API + implementation.
Comment 6 Anton Leherbauer CLA 2008-03-12 09:38:50 EDT
The API is in place. I added a JUnit test to verify basic functionality.
Note that binary elements (i.e. the Binaries and Archives containers and everythin below) are not supported. The identifier created for those elements will be that of the project.
I did some tests with the plug-in attached to bug 162558, but due to exceptions I am not quite sure how well it all plays together.