|
|
|
|
Re: Multi Modul - Menu Extension [message #1630856 is a reply to message #1580076] |
Mon, 23 February 2015 12:42 |
Jeremie Bresson Messages: 1252 Registered: October 2011 |
Senior Member |
|
|
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.03721 seconds