Reputation: 8740
I have one Core project and some other project that extends core. I know how to extend outline and how to add pages to extended outlines, but my problems are menus.
I would like to extend menu on extended project.
I find some example on web and I think that I understand, but this is not working for me.
What I have is :
<extension
name=""
point="org.eclipse.scout.rt.extension.client.desktopExtensions">
<desktopExtension
class="com.sixt.leasing.pd.scout.client.ui.desktop.DesktopExtension"
active="true">
</desktopExtension>
</extension>
<extension
point="org.eclipse.scout.rt.extension.client.menus">
<menuContribution
active="true"
class="com.sixt.leasing.pd.scout.client.menu.JobRunnerMenu"
order="22">
<desktop
class="com.sixt.leasing.core.scout.client.ui.desktop.Desktop">
</desktop>
</menuContribution>
</extension>
inside plugin.xml
and my JobRunnerMenu look like :
public class JobRunnerMenu extends AbstractExtensibleMenu {
@Override
protected String getConfiguredText() {
return TEXTS.get("Job");
}
@Override
protected void execAction() throws ProcessingException {
// TODO Auto-generated method stub.
super.execAction();
}
@Override
protected void execToggleAction(final boolean selected) throws ProcessingException {
// TODO Auto-generated method stub.
super.execToggleAction(selected);
}
}
What am I missing ? Why this don't work?
Upvotes: 0
Views: 60
Reputation: 9507
Related forum thread: Multi Modul - Menu Extension
I just tested this pattern and it works as expected.
Here is the content of my plugin.xml
(in the client extension):
<extension
point="org.eclipse.scout.rt.extension.client.menus">
<menuContribution
active="true"
class="myapp.extension.client.menu.MyMenu"
order="22">
<desktop
class="myapp.client.ui.desktop.Desktop">
</desktop>
</menuContribution>
</extension>
Because the “menuContribution” defines a “desktop” as container, the menu you will add is contributed to the Desktop. Usually those menus are top-level menus and contain child menus.
public class MyMenu extends AbstractExtensibleMenu {
@Override
protected String getConfiguredText() {
return "My Menu";
}
public class MessageBoxTestMenu extends AbstractExtensibleMenu {
@Override
protected String getConfiguredText() {
return "Test MessageBox";
}
@Override
protected void execAction() throws ProcessingException {
MessageBox.showOkMessage(null, "This is a test", null);
}
}
}
The result:
Upvotes: 1
Reputation: 8740
I am sorry to mislead with this question.
The above code work, my problem was, that I didn't have added a client in product file. This cause client not to be available so extension could't be added.
Thanks for answer anyway, and yes AbstractExtensibleDesktop is absolutely needed.
Upvotes: 0
Reputation: 4870
Make that your desktop extends the base class AbstractExtensibleDesktop. The regular AbstractDesktop
class does not load extensions.
Should that be the case, a breakpoint at AbstractExtensibleDesktop#AbstractExtensibleDesktop should provide for a good starting point to debug.
Upvotes: 0