Multi Modul - Menu Extension [message #1554417] |
Fri, 09 January 2015 02:20  |
Eclipse User |
|
|
|
I'm working on a multi modul scout application as described in https://www.eclipse.org/forums/index.php/t/243162/
Actually I'm facing a problem with Menu Extensions.
Lets assume we have a "Masterdata modul" which treats for example customers. Within this masterdata module I have a customer table page and on this customer table page a menu which enables some actions to work on the selected customer.
Now I have an additional "order module" which has a dependency to the "Masterdata modul". Within this "order module" I like to add an action "Create new order" to the menu on the above described customer tale page. In plain Eclipse, this would be done with menu extensions. How can I do this with Scout?
TIA
Rene
|
|
|
|
|
|
Re: Multi Modul - Menu Extension [message #1630856 is a reply to message #1580076] |
Mon, 23 February 2015 07:42   |
Eclipse User |
|
|
|
Sorry for the delay. It took me a long time to figure out how it works.
----------------------------------------------------------------------------------
Luna Version
Your PersonsTablePage (in the core) needs to be from type: AbstractExtensiblePageWithTable.
Beside this, nothing else is required.
The Menu "Create New Order" is defined in the Extension. It is from type AbstractMenu (exactly as you would do directly in the Table).
The binding is done in the plugin.xml file: You can define an extension to the extension point "org.eclipse.scout.rt.extension.client.menus". Define an menuContribution (the menu) for the PersonsTablePage.

If you open plugin.xml, the XML looks like this:
<extension
point="org.eclipse.scout.rt.extension.client.menus">
<menuContribution
active="true"
class="myext.client.CreateNewOrderMenu">
<page
class="mycore.client.pages.PersonsTablePage">
</page>
</menuContribution>
</extension>
You can register:
* menuContribution
* menuModification
* menuRemoval
Few remarks:
* We consider the community support for the Luna release over (SR2 will be published by the end of the week).
* We had several troubles with this pattern. This is why we developed something new for mars. If you are starting a project now, you might consider using the Mars Version (for example 4.2 is a non-official intermediary release, preparing the mars version coming up next June. Mars Version will be 5.0).
* We do not know yet how long we want to support this pattern. On the long term, we will only invest in the extensibility pattern introduced with mars.
----------------------------------------------------------------------------------
Mars Version
You have probably seen the wiki page: Scout Extensibility concept
The extension looks like this:
public class PersonsTableExtension extends AbstractTableExtension<PersonsTablePage.Table> {
public PersonsTableExtension(Table owner) {
super(owner);
}
@Order(2000.0)
public class CreateNewOrderMenu extends AbstractMenu {
@Override
protected String getConfiguredText() {
return TEXTS.get("CreateNewOrder");
}
@Override
protected void execAction() throws ProcessingException {
MessageBox.showOkMessage("Simulation", "Info on the person", getOwner().getFirstNameColumn().getSelectedValue() + " " + getOwner().getLastNameColumn().getSelectedValue());
}
}
}
For the moment, we have an equinox startup problem. We need to ensure that the extension bundle is loaded soon enough. The current workaround is to add the extension bundle "myext.client" in the osgi.bundles parameter (in config.ini):
osgi.bundles=org.eclipse.equinox.common@2\:start,org.eclipse.update.configurator@3\:start,org.eclipse.core.runtime@start,myext.client@4\:start
I will discuss this with my coworker and come up with a better idea.
.
|
|
|
|
Powered by
FUDForum. Page generated in 0.04202 seconds