Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 371137 - org.eclipse.swtbot.eclipse.gef.finder does not resolve in an RCP scenario
Summary: org.eclipse.swtbot.eclipse.gef.finder does not resolve in an RCP scenario
Status: REOPENED
Alias: None
Product: SWTBot
Classification: Technology
Component: GEFBot (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Mariot Chauvin CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-09 15:35 EST by Berthold Daum CLA
Modified: 2012-02-22 05:57 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Berthold Daum CLA 2012-02-09 15:35:55 EST
Build Identifier: 20110916-0149

In the manifest of org.eclipse.swtbot.eclipse.gef.finder replace the import of packages org.eclipse.ui and org.eclipse.ui.part with a dependency from plug-in org.eclipse.ui.

Both packages are defined as split packages and thus require the presence of both plug-ins org.eclipse.ui and org.eclipse.ui.ide. This is usually not the case in a RCP scenario.

Reproducible: Always

Steps to Reproduce:
1. Set up a target platform with only RCP plug-ins and SwtBot plug-ins.
2.
3.
Comment 1 Mariot Chauvin CLA 2012-02-09 18:53:07 EST
I simply remove the import to org.eclipse.ui.part.
Code compiles and all tests succeed :)

See http://git.eclipse.org/c/swtbot/org.eclipse.swtbot.git/commit/?id=d2f6f1115cd3e04f61be18f38ccd04fe1281792a
Comment 2 Berthold Daum CLA 2012-02-10 13:40:57 EST
Didn't work for me. I had to remove the import to package org.eclipse.ui as well, and had to add the required plug-in org.eclipse.ui.
Comment 3 Mariot Chauvin CLA 2012-02-10 15:38:05 EST
Hum I am not sure to fully understand. We use package dependencies and not plug-ins, and I am not confident to mix depencencie kind is a good thing. BTW org.eclipse.swtbot.eclipse.ui plugin imports as well org.eclipse.ui package so you should have the same problem for that plug-in ?
Comment 4 Berthold Daum CLA 2012-02-10 18:12:23 EST
The problem is that both packages org.eclipse.ui and org.eclipse.ui.part are declared as split packages in plug-in org.eclipse.ui.workbench:

org.eclipse.ui.part;ui.workbench=split;mandatory:="ui.workbench",

and 

org.eclipse.ui.part;ui.workbench=split;mandatory:="ui.workbench",

OSGi requires a second plug-in to export these packages when resolving the imported packages. See also this thread:

http://eclipsesource.com/blogs/2009/07/14/why-i-cant-recommend-using-import-package/


I can't comment on the plug-in org.eclipse.swtbot.eclipse.ui. I installed "SWTBot for GEF Testing" that does not contain that plug-in.
Comment 5 Mariot Chauvin CLA 2012-02-18 11:39:27 EST
(In reply to comment #4)
> The problem is that both packages org.eclipse.ui and org.eclipse.ui.part are
> declared as split packages in plug-in org.eclipse.ui.workbench:
> 
> org.eclipse.ui.part;ui.workbench=split;mandatory:="ui.workbench",
> 
> and 
> 
> org.eclipse.ui.part;ui.workbench=split;mandatory:="ui.workbench",
> 
> OSGi requires a second plug-in to export these packages when resolving the
> imported packages. See also this thread:
> 
> http://eclipsesource.com/blogs/2009/07/14/why-i-cant-recommend-using-import-package/
> 
> 
> I can't comment on the plug-in org.eclipse.swtbot.eclipse.ui. I installed
> "SWTBot for GEF Testing" that does not contain that plug-in.

Thanks for the link, I have already have been hit by eclipse platform legacy hacks, but was not aware of the split nightmare. So here is a workaround we could try:

Change the import to :

Import-Package: org.eclipse.ui; ui.workbench="split"

And export ourselve an org.eclipse.ui split mock package to force OSGi resolution. Does it sound reasonable and could work ?
Comment 6 Berthold Daum CLA 2012-02-22 05:57:35 EST
That seems to work. I added 

Import-Package: org.eclipse.ui; ui.workbench="split", org.eclipse.ui.part; ui.workbench="split"

to the manifest of org.eclipse.swtbot.eclipse.gef.finder

and 

Export-Package: org.eclipse.ui, org.eclipse.ui.part

to the manifest of org.eclipse.swtbot.eclipse.finder