Is adding the split attribute to the Import-Package really the best
solution? It assures that the importer gets only part of the package, and it
also makes a mess of the manifest. Surely it's better to ensure that an
aggregating bundle exists... then importers can simply import org.eclipse.ui
without even being aware of the split, and they will see the whole package.

Unfortunately the normal aggregating bundle in this particular case appears
to be "org.eclipse.ui.ide" which is unlikely to be appropriate for an RCP
application But it would not be difficult to create an alternative
aggregator that has no IDE gunk in it.

Note there is another split package in core Eclipse, but most RCP developers
don't even notice it. The "org.eclipse.core.runtime" package is split across
2 bundles, "org.eclipse.equinox.registry" and "org.eclipse.equinox.common".
Those two bundles export it with mandatory attributes, and the bundle
"org.eclipse.core.runtime" aggregates and re-exports without attributes. If
we simply import the package without attributes, we get the whole (i.e.
aggregated) package, which is what we want 99.99% of the time. The mandatory
attributes are only used by importers if they really, really want one of the
partial exports. As mentioned, most RCP developers don't have any problems
with this split because they always have the aggregator installed.

My apologies for continuing this Eclipse thread here, but it still seems
relevant to general OSGi principles. I think it highlights just how
confusing split packages can be!

Regards,
Neil

On Wed, Sep 8, 2010 at 9:28 AM, Wim Jongman <wim.jong...@gmail.com> wrote:

> Hi Simon and Thomas,
>
> Thanks for your help. After Thomas explained the problem I found a blog
> about split packages. To help future lost souls, it is here [1].
>
> Best regards,
>
> Wim
>
> [1]
> http://eclipsesource.com/blogs/2009/07/14/why-i-cant-recommend-using-import-package/
>
>
> On Wed, Sep 8, 2010 at 5:34 AM, Thomas Watson <tjwat...@us.ibm.com> wrote:
>
>>  If you look at the exports of the two packages from the org.eclipse.ui
>> bundle you will notice the following for the org.eclipse.ui and
>> org.eclipse.ui.part package exports:
>>
>> ui.workbench=split;mandatory:="ui.workbench"
>>
>> This indicates that the packages org.eclipse.ui and org.eclipse.ui.part
>> are split packages. The org.eclipse.ui bundle aggregates the parts of these
>> packages into "complete" packages. If you want to only import the "parts" of
>> these packages as exported by the org.eclipse.ui.workbench bundle then you
>> must specify the mandatory matching attribute ui.workbench=split attribute
>> on your import package statement:
>>
>> Import-Package: org.eclipse.ui; ui.workbench=split, org.eclipse.ui.part;
>> ui.workbench=split
>>
>> Hope that helps. You should ask eclipse specific questions in the eclipse
>> forums.
>>
>> Tom
>>
>>
>>
>> [image: Inactive hide details for Wim Jongman ---09/07/2010 01:28:08
>> PM---Hi, My bundle 231 is installed. If I do a diag on it it says]Wim
>> Jongman ---09/07/2010 01:28:08 PM---Hi, My bundle 231 is installed. If I do
>> a diag on it it says that it cannot resolve org.eclipse.ui and
>> org.eclipse.ui.part. How
>>
>>
>> From:
>> Wim Jongman <wim.jong...@gmail.com>
>> To:
>> OSGi Developer Mail List <osgi-dev@mail.osgi.org>
>> Date:
>> 09/07/2010 01:28 PM
>> Subject:
>> [osgi-dev] Resolution problem
>> ------------------------------
>>
>>
>>
>> Hi,
>>
>> My bundle 231 is installed. If I do a diag on it it says that it cannot
>> resolve org.eclipse.ui and org.eclipse.ui.part. However, these two packages
>> are exported by org.eclipse.ui.workbench which is in my list (80). My other
>> bundles who also import the packages but now thru import bundle of
>> org.eclipse.ui which re-exports o.e.ui.workbench are fine.
>>
>> If I change 231 to import bundle instead of import package, all is fine.
>>
>> What am I missing here? Below is my relevant bundle list, the diag of the
>> unresolved bundle and an inquiry on the packages it says it cannot resolve.
>>
>> Thanks for looking at this.
>>
>> Regards,
>>
>> Wim
>>
>>
>>
>>
>>
>>
>>
>>
>> 80 ACTIVE      org.eclipse.ui.workbench_3.6.0.I20100603-1100
>> 231 INSTALLED   com.remainsoftware.gravity.core.ui_1.0.0.qualifier
>>
>> osgi> diag 231
>> reference:file:/C:/Users/jongw/Workspaces/Gravity/com.remainsoftware.gravity.core.ui/
>> [231]
>>   Direct constraints which are unresolved:
>>     Missing imported package org.eclipse.ui_0.0.0.
>>     Missing imported package org.eclipse.ui.part_0.0.0.
>>
>> osgi> packages org.eclipse.ui
>> org.eclipse.ui;
>> version="0.0.0"<org.eclipse.ui.workbench_3.6.0.I20100603-1100 [80]>
>>   com.remainsoftware.gravity.icons_1.0.0 [9] imports
>>   org.eclipse.gef_3.6.0.v20100525-1225 [65] imports
>>   org.eclipse.ui_3.6.0.I20100603-1100 [78] imports
>>   org.eclipse.ui.views.log_1.0.100.v20100423 [79] imports
>>   com.remainsoftware.gravity.application_1.0.0.qualifier [84] imports
>>   org.eclipse.ui.forms_3.5.0.v20100427 [213] imports
>>
>> osgi> packages org.eclipse.ui.part
>> org.eclipse.ui.part;
>> version="0.0.0"<org.eclipse.ui.workbench_3.6.0.I20100603-1100 [80]>
>>   com.remainsoftware.gravity.icons_1.0.0 [9] imports
>>   org.eclipse.gef_3.6.0.v20100525-1225 [65] imports
>>   org.eclipse.ui_3.6.0.I20100603-1100 [78] imports
>>   org.eclipse.ui.views.log_1.0.100.v20100423 [79] imports
>>   com.remainsoftware.gravity.application_1.0.0.qualifier [84] imports
>>   org.eclipse.ui.forms_3.5.0.v20100427 [213] imports
>>
>> osgi> _______________________________________________
>> OSGi Developer Mail List
>> osgi-dev@mail.osgi.org
>> https://mail.osgi.org/mailman/listinfo/osgi-dev
>>
>>
>> _______________________________________________
>> OSGi Developer Mail List
>> osgi-dev@mail.osgi.org
>> https://mail.osgi.org/mailman/listinfo/osgi-dev
>>
>
>
> _______________________________________________
> OSGi Developer Mail List
> osgi-dev@mail.osgi.org
> https://mail.osgi.org/mailman/listinfo/osgi-dev
>

<<graycol.gif>>

<<ecblank.gif>>

_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to