Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » How to properly include a Feature into another Feature(Adding a sub feature to an Eclipse Feature.)
How to properly include a Feature into another Feature [message #1792748] Mon, 23 July 2018 13:23 Go to next message
Ovidiu Tomuta is currently offline Ovidiu TomutaFriend
Messages: 12
Registered: September 2017
Junior Member
Hello!

In my RCP application I have a main Feature that contains a couple of plugins. My secondary Feature contains some other plugins which are not mandatory for the application to run. How can I include this secondary Feature in the main one ? I already tried adding it to the main Feature's "Include Features" tab but it doesn't activate. I also used the "Compute" option to add the required Dependencies in my secondary Feature.

Note that the secondary Feature activates if I add it to the Debug Configurations Feature list but I don't want to do this. I only want to add it to the main Feature's list of included features/plugins. Is it possible to get it to work like this ?

Thank you all.
Re: How to properly include a Feature into another Feature [message #1792750 is a reply to message #1792748] Mon, 23 July 2018 14:01 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 788
Registered: January 2012
Senior Member

Hi Ovidiu. What do you mean by "fails to activate"? Features don't actually do anything: they're a way of grouping together bundles that must be co-installed to provide some kind of functionality.

Including a feature within another feature should ensure the included-feature's bundles are installed.

Brian.


Eclipse Platform committer. Ask me about Eclipse support, training, and consulting.
Re: How to properly include a Feature into another Feature [message #1792753 is a reply to message #1792750] Mon, 23 July 2018 14:14 Go to previous messageGo to next message
Ovidiu Tomuta is currently offline Ovidiu TomutaFriend
Messages: 12
Registered: September 2017
Junior Member
Hello Brian.

By failing to activate I mean, as you said, that the Feature's bundles are not getting installed. I have a toolbar in my main Feature and a couple of tool items. In my secondary feature I have some plugins that contribute with some other tool items to that toolbar from the main Feature.
Re: How to properly include a Feature into another Feature [message #1792774 is a reply to message #1792753] Mon, 23 July 2018 17:35 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 788
Registered: January 2012
Senior Member

Could you post your feature.xmls?

Eclipse Platform committer. Ask me about Eclipse support, training, and consulting.
Re: How to properly include a Feature into another Feature [message #1792791 is a reply to message #1792774] Tue, 24 July 2018 07:20 Go to previous messageGo to next message
Ovidiu Tomuta is currently offline Ovidiu TomutaFriend
Messages: 12
Registered: September 2017
Junior Member
Sure. Here is my main Feature:

<?xml version="1.0" encoding="UTF-8"?>
<feature
id="com.tomuta.ovidiu.feature.main"
label="TOMUTA main feature"
version="1.0.0.qualifier"
provider-name="TOMUTA">

<description url="http://www.example.com/description">
[Enter Feature Description here.]
</description>

<copyright url="http://www.example.com/copyright">
[Enter Copyright Description here.]
</copyright>

<license url="http://www.example.com/license">
[Enter License Description here.]
</license>

<includes
id="com.tomuta.ovidiu.feature.secondary"
version="1.0.0.qualifier"
name="TOMUTA secondary feature"/>

<requires>
<import plugin="org.eclipse.ui" version="3.108.0" match="greaterOrEqual"/>
<import plugin="com.tomuta.ovidiu.client"/>
<import plugin="javax.inject"/>
<import plugin="org.eclipse.core.commands"/>
<import plugin="org.eclipse.core.runtime"/>
<import plugin="org.eclipse.e4.core.commands"/>
<import plugin="org.eclipse.e4.core.contexts"/>
<import plugin="org.eclipse.e4.core.di"/>
<import plugin="org.eclipse.e4.core.di.annotations"/>
<import plugin="org.eclipse.e4.core.di.extensions"/>
<import plugin="org.eclipse.e4.core.services"/>
<import plugin="org.eclipse.e4.ui.di"/>
<import plugin="org.eclipse.e4.ui.model.workbench"/>
<import plugin="org.eclipse.e4.ui.workbench"/>
<import plugin="org.eclipse.jface"/>
<import plugin="org.eclipse.osgi"/>
<import plugin="org.eclipse.swt"/>
<import plugin="org.eclipse.ui.ide"/>
<import plugin="org.eclipse.ui.forms"/>
<import plugin="org.eclipse.ui.workbench"/>
<import plugin="org.eclipse.osgi.services"/>
<import plugin="com.tomuta.ovidiu.toolitem"/>
<import plugin="org.apache.servicemix.bundles.avalon-framework"/>
<import plugin="org.apache.commons.lang"/>
<import plugin="org.apache.fop"/>
<import plugin="org.apache.poi.3-17"/>
<import plugin="org.apache.servicemix.bundles.xmlgraphics-commons"/>
<import plugin="org.eclipse.core.jobs"/>
<import plugin="org.eclipse.e4.ui.model.workbench" version="1.2.0.v20160229-1459" match="greaterOrEqual"/>
<import plugin="com.tomuta.lucian.table"/>
<import plugin="com.tomuta.lucian.common"/>
<import plugin="com.tomuta.ovidiu.common.table"/>
<import plugin="org.eclipse.core.expressions"/>
<import plugin="org.eclipse.equinox.preferences"/>
<import plugin="org.eclipse.e4.core.di" version="1.6.100" match="greaterOrEqual"/>
<import plugin="org.eclipse.e4.ui.di" version="1.2.100" match="greaterOrEqual"/>
<import plugin="com.tomuta.ovidiu.resources"/>
<import plugin="org.eclipse.core.databinding"/>
<import plugin="org.eclipse.core.databinding.beans"/>
<import plugin="org.eclipse.core.databinding.observable"/>
<import plugin="org.eclipse.core.databinding.property"/>
<import plugin="org.eclipse.jface.databinding"/>
<import plugin="org.junit"/>
<import plugin="ca.odell.glazedlists"/>
<import plugin="com.tomuta.ovidiu.zonadate"/>
<import plugin="org.eclipse.nebula.widgets.nattable.core"/>
<import plugin="javax.annotation"/>
<import plugin="org.eclipse.nebula.widgets.nattable.extension.glazedlists"/>
<import plugin="SingleEmbeddedViewer"/>
<import plugin="org.junit" version="4.12.0" match="greaterOrEqual"/>
</requires>

<plugin
id="com.tomuta.ovidiu.toolitem"
download-size="0"
install-size="0"
version="1.0.0.qualifier"
unpack="false"/>

<plugin
id="com.tomuta.ovidiu.toolitem.impl"
download-size="0"
install-size="0"
version="1.0.0.qualifier"
unpack="false"/>

<plugin
id="com.tomuta.ovidiu.client"
download-size="0"
install-size="0"
version="1.0.0.qualifier"
unpack="false"/>

<plugin
id="com.tomuta.ovidiu.client.9P.fragment"
download-size="0"
install-size="0"
version="1.0.0.qualifier"
fragment="true"
unpack="false"/>

<plugin
id="com.tomuta.ovidiu.client.5P.fragment"
download-size="0"
install-size="0"
version="1.0.0.qualifier"
fragment="true"
unpack="false"/>

<plugin
id="com.tomuta.ovidiu.zonadate"
download-size="0"
install-size="0"
version="1.0.0.qualifier"
unpack="false"/>

<plugin
id="com.tomuta.ovidiu.main.fragment"
download-size="0"
install-size="0"
version="1.0.0.qualifier"
fragment="true"
unpack="false"/>

<plugin
id="com.tomuta.ovidiu.resources"
download-size="0"
install-size="0"
version="1.0.0.qualifier"
unpack="false"/>

<plugin
id="com.tomuta.ovidiu.welcome"
download-size="0"
install-size="0"
version="1.0.0.qualifier"
unpack="false"/>

<plugin
id="com.tomuta.ovidiu.common.table"
download-size="0"
install-size="0"
version="1.0.0.qualifier"
unpack="false"/>

</feature>


And here is my secondary one:

<?xml version="1.0" encoding="UTF-8"?>
<feature
id="com.tomuta.ovidiu.feature.secondary"
label="TOMUTA secondary feature"
version="1.0.0.qualifier"
provider-name="TOMUTA">

<description url="http://www.example.com/description">
[Enter Feature Description here.]
</description>

<copyright url="http://www.example.com/copyright">
[Enter Copyright Description here.]
</copyright>

<license url="http://www.example.com/license">
[Enter License Description here.]
</license>

<requires>
<import plugin="org.eclipse.e4.ui.workbench"/>
<import plugin="com.tomuta.lucian.api.framework"/>
<import plugin="com.tomuta.ovidiu.toolitem"/>
<import plugin="com.tomuta.ovidiu.toolitem.impl"/>
<import plugin="com.tomuta.ovidiu.client"/>
<import plugin="javax.inject"/>
<import plugin="org.eclipse.jface"/>
<import plugin="org.eclipse.swt"/>
<import plugin="org.eclipse.ui.forms"/>
<import plugin="com.tomuta.ovidiu.zonadate" version="1.0.0"/>
<import plugin="org.eclipse.e4.ui.model.workbench" version="2.0.1.v20170713-1800" match="greaterOrEqual"/>
<import plugin="org.eclipse.e4.core.di"/>
<import plugin="org.eclipse.core.resources"/>
<import plugin="org.eclipse.core.runtime"/>
<import plugin="org.eclipse.ui"/>
<import plugin="com.tomuta.lucian.table"/>
<import plugin="com.tomuta.ovidiu.common.table"/>
<import plugin="com.tomuta.ovidiu.resources"/>
<import plugin="org.apache.commons.lang"/>
<import plugin="org.eclipse.core.databinding"/>
<import plugin="org.eclipse.core.databinding.beans"/>
<import plugin="org.eclipse.core.databinding.observable"/>
<import plugin="org.eclipse.core.databinding.property"/>
<import plugin="org.eclipse.core.expressions"/>
<import plugin="org.eclipse.e4.core.contexts"/>
<import plugin="org.eclipse.e4.ui.di"/>
<import plugin="org.eclipse.jface.databinding"/>
<import plugin="org.eclipse.nebula.widgets.nattable.core"/>
<import plugin="org.eclipse.ui.ide"/>
<import plugin="org.eclipse.ui.workbench"/>
<import plugin="org.junit"/>
<import plugin="org.eclipse.osgi"/>
<import feature="com.tomuta.ovidiu.feature.main" version="1.0.0.qualifier" match="compatible"/>
</requires>

<plugin
id="com.tomuta.ovidiu.toolitem.secondary"
download-size="0"
install-size="0"
version="1.0.0.qualifier"
unpack="false"/>

</feature>
Re: How to properly include a Feature into another Feature [message #1792826 is a reply to message #1792791] Tue, 24 July 2018 13:50 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 788
Registered: January 2012
Senior Member

Your features look ok.

Quote:

By failing to activate I mean, as you said, that the Feature's bundles are not getting installed. I have a toolbar in my main Feature and a couple of tool items. In my secondary feature I have some plugins that contribute with some other tool items to that toolbar from the main Feature.


How have you determined whether the secondary feature's bundle isn't being installed?

Perhaps you could post your plugin.xml from your bundle that creates the toolbar (which I'm guessing is com.tomuta.ovidiu.toolitem?), and the plugin.xml for the bundle contributing to the toolbar (com.tomuta.ovidiu.toolitem.secondary).

It would be nice to know if the platform provided a way to see `<menuContributions>` that will never match...

Brian.

Brian.


Eclipse Platform committer. Ask me about Eclipse support, training, and consulting.
Re: How to properly include a Feature into another Feature [message #1792887 is a reply to message #1792826] Wed, 25 July 2018 11:39 Go to previous messageGo to next message
Ovidiu Tomuta is currently offline Ovidiu TomutaFriend
Messages: 12
Registered: September 2017
Junior Member
The Tool Item from my secondary feature is not visible + the Activator class from my secondary plugin is not even being called (break point not toggled). It works fine when adding the second feature to Debug Configs. so I suppose there is not problem with the plugin from it.

I realized that if I export my main feature, the plugins from the second feature are exported as well, so the dependency must be fine. Maybe there is no way to make the second feature to work without adding it to Debug Configs. ?

[Updated on: Wed, 25 July 2018 12:13]

Report message to a moderator

Re: How to properly include a Feature into another Feature [message #1792901 is a reply to message #1792887] Wed, 25 July 2018 13:21 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 788
Registered: January 2012
Senior Member

Is your secondary plugin marked as 'Bundle-ActivationPolicy: lazy' (aka Activate this plugin when one of its classes are loaded)?

Eclipse Platform committer. Ask me about Eclipse support, training, and consulting.
Re: How to properly include a Feature into another Feature [message #1792903 is a reply to message #1792901] Wed, 25 July 2018 13:52 Go to previous message
Ovidiu Tomuta is currently offline Ovidiu TomutaFriend
Messages: 12
Registered: September 2017
Junior Member
It was marked yeah. Unmarked it but unfortunately I got the same result.

After more debugging I found out what is the order the plugins get activated: (toolitem3 is the plugin from the secondary feature)

Without adding second feature to Debug.Configs: core->toolbar->common->toolitem1->toolitem2

Adding second feature to Debug. Configs: core->toolbar->toolitem3->common->toolitem1->toolitem2

[Updated on: Wed, 25 July 2018 13:53]

Report message to a moderator

Previous Topic:Programmatically update all tooltips when context changes?
Next Topic:How to apply CSS style to MCompositePart?
Goto Forum:
  


Current Time: Sat Nov 17 17:58:18 GMT 2018

Powered by FUDForum. Page generated in 0.02627 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top