Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 248207 - [ds tooling] Code assist should work for <component> element
Summary: [ds tooling] Code assist should work for <component> element
Status: RESOLVED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.5 M3   Edit
Assignee: Chris Aniszczyk CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-22 18:13 EDT by Simon Archer CLA
Modified: 2008-09-30 21:59 EDT (History)
1 user (show)

See Also:


Attachments
DSContentAssistProcessor updates (1.40 KB, text/plain)
2008-09-22 19:39 EDT, Rafael Oliveira Nóbrega CLA
caniszczyk: iplog+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Archer CLA 2008-09-22 18:13:39 EDT
Using Eclipse 3.5M2.

Code assist does not work for the <component> element.  Steps...

1. Create a component.xml file and open it in the Service Component editor.

2. Remove everything from the file, apart from the following line:

<?xml version="1.0" encoding="UTF-8"?>

3. Now try and use code assist to add the <component> element, but you cannot.


The work around here is to close and reopen the file since the Service Component editor is "smart enough" to automatically add the missing <component> element, but even that is questionable behavior, but that's a whole other bug report.  :-)
Comment 1 Chris Aniszczyk CLA 2008-09-22 18:15:13 EDT
man, this is what we get for trying to include source editing in the first pass of the editor ;)
Comment 2 Chris Aniszczyk CLA 2008-09-22 18:15:42 EDT
Want to take a look at this Rafael?
Comment 3 Chris Aniszczyk CLA 2008-09-22 18:19:13 EDT
actually Simon, it's a problem if we are missing the component header as we
lose the ability to associate the editor with it... since we do it by content
type and using the <component> header ;)

but I still agree that as long as we are in the ds editor context, we should
offer that completion.
Comment 4 Rafael Oliveira Nóbrega CLA 2008-09-22 19:39:26 EDT
Created attachment 113209 [details]
DSContentAssistProcessor updates

That's what I thought:
If the user tries to use the code completion where the range is null, we suggest him to create a component element.

Know Issues: If you already have a component element, and calls the code completion outside its range, you can create two component elements in the same file. Is that a big problem?
Comment 5 Simon Archer CLA 2008-09-22 21:04:54 EDT
Supporting multiple <component> elements is actually a requirement!  But, to be XML compliant, the document must always have a single root element. Of course, in this case the single root element is not part of the scr namespace, which opens up all sorts of other issues not yet addressed by PDE.  For now I'm going refer you to the OSGi spec and this bug in the OSGi bugzilla that talks about this a little:

https://www.osgi.org/members/bugzilla/show_bug.cgi?id=590
Comment 6 Rafael Oliveira Nóbrega CLA 2008-09-23 07:42:12 EDT
Thanks Simon. :)

And what should we do? 
Let the code assistant creating multiple <component> elements without handling it?
Comment 7 Rafael Oliveira Nóbrega CLA 2008-09-29 19:30:53 EDT
Chris?
Comment 8 Chris Aniszczyk CLA 2008-09-30 15:43:43 EDT
done. Thanks Rafael!

> 20090930
Comment 9 Simon Archer CLA 2008-09-30 21:59:47 EDT
The code assist for "component" should not be suggested while inside a <component> element, or any other DS element.  This is likely to be tricky because technically speaking, putting a <component> element inside any XML is legal.  Leaving RESOLVED for now.  Purely FYI.