Search code examples
menuextendseclipse-scout

Scout Eclipse extends Menu


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?


Solution

  • 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:

    Sceenshot


    • Are the absolute class names in your XML correct?
    • Is your extension correctly started?