5.8. Adding a Contextual menu enty

Warning

You are looking at documentation for an older release. Not what you want? See the current release documentation.

This section details how to add a Contextual menu enty which is an action that could be accessed via a right click.

For example, a TestButton button will be displayed in Sites Explorer when right click on a content. Clicking on this button TestButton will display a message in the log.

To add that button, please follow these steps:

  1. Create a Maven project having the following directory structure:

    Where:

  2. Create a new action class TestButtonActionComponent which should extend from UIAbstractManagerComponent. You should also create its corresponding listener TestButtonActionListener which extends from UIActionBarActionListener.

    You can view the complete class here.

  3. In the configuration.xml file, register the new action under UIExtensionManager target-component as a component-plugin as follows.

    Note

    Some notes should be respected for the java class TestButtonActionComponent:

    • TestButton will be used to label the action.

    • TestButtonActionComponent is the class name of your action.

    • There is a matching rule between the action name (TestButton) and the listener class name (TestButtonActionListener): The listener class name = the action name + ActionListener.

  4. Build your project using this command: mvn clean install

  5. Copy the .jar file (target/action-example-1.0.jar) to the lib folder of eXo Platform.

  6. Restart the server.

Testing the added Rightclick action

  1. Log in to the platform and go to Sites Explorer.

  2. Upload a document.

  3. Right click on this document, the TestButton is added to the action list and the message log is displayed after clicking on it.

Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus