Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 248227

Summary: [ds tooling] Cannot add a Class as a Provided Service
Product: [Eclipse Project] PDE Reporter: Simon Archer <sja.eclipse>
Component: UIAssignee: Chris Aniszczyk <caniszczyk>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: caniszczyk
Version: 3.5   
Target Milestone: 3.5 M3   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
org.eclipse.pde.ds.ui.patch
none
mylyn/context/zip none

Description Simon Archer CLA 2008-09-22 21:40:57 EDT
Eclipse 3.5M2

However crazy it might seem, the DS spec allows a class to be listed as a Provided Service.  The Overview page's Provided Service section only allows interfaces to be added.

I am hesitating to even mention this.
Comment 1 Simon Archer CLA 2008-09-23 09:18:00 EDT
Having pondered this for a while I feel that we should:

- Allow you to add both classes and interfaces as provided service.

- Add a PDE compiler preference that flags the case where a class is a provided service.  The default should probably be Warning and both the form-based editor and the source editor should be decorated appropriately.

Comment 2 Chris Aniszczyk CLA 2008-09-23 11:31:30 EDT
What's an example of a class as a provided service?

I'm trying to think of the use case here :)
Comment 3 Simon Archer CLA 2008-09-23 11:55:24 EDT
Well, a class as a provided service is typically a class that does not implement an interface.  Imagine if you were OSGi-ifying a Java library and you wanted to provide services for classes that you do not own... In this case you'd likely have to just provide a class as a service.  It's also a technique for saying "This is the ONLY implementation of the service, period!", which I realize is rare and should not be encouraged since it implies tight coupling.

Nobody should be registering classes as services, unless they have no choice. I'm only suggesting that the DS tooling support it because the OSGi spec allows it.
Comment 4 Rafael Oliveira Nóbrega CLA 2008-09-23 19:50:12 EDT
Should I implement this change?

I will add: doOpenSelectionDialog(IJavaElementSearchConstants.CONSIDER_CLASSES_AND_INTERFACES);

is that ok? 
Comment 5 Chris Aniszczyk CLA 2008-09-23 20:03:54 EDT
yap, seems like a fair change.

We can open another bug report to deal with reporting messages if people indeed select a class.
Comment 6 Chris Aniszczyk CLA 2008-09-29 15:17:39 EDT
Rafael, you have this one?
Comment 7 Chris Aniszczyk CLA 2008-09-29 15:58:04 EDT
Created attachment 113802 [details]
org.eclipse.pde.ds.ui.patch

Simple fix.
Comment 8 Chris Aniszczyk CLA 2008-09-29 15:58:06 EDT
Created attachment 113804 [details]
mylyn/context/zip
Comment 9 Chris Aniszczyk CLA 2008-09-29 15:58:20 EDT
done.

> 20090929