5.3.2.4.3. Registering new action with UIExtensionManager service

Edit the configuration.xml file as below:


<configuration xmlns="http://www.exoplatform.org/xml/ns/kernel_1_2.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.exoplatform.org/xml/ns/kernel_1_2.xsd http://www.exoplatform.org/xml/ns/kernel_1_2.xsd">
    <external-component-plugins>
    <target-component>org.exoplatform.webui.ext.UIExtensionManager</target-component>
    <component-plugin>
        <name>add.action</name>
        <set-method>registerUIExtensionPlugin</set-method>
        <type>org.exoplatform.webui.ext.UIExtensionPlugin</type>
        <init-params>
            <object-param>
                <name>ViewSource</name>
                <object type="org.exoplatform.webui.ext.UIExtension">
                    <field name="type"><string>org.exoplatform.wiki.webui.control.MoreExtensionContainer</string></field>
                    <field name="rank"><int>1000</int></field>
                    <field name="name"><string>ViewSource</string></field>
                    <field name="component"><string>com.acme.ViewSourceActionComponent</string></field>
                </object>
            </object-param>
        </init-params>
    </component-plugin>
    </external-component-plugins>
</configuration>

Pay attention to the action name (ViewSource) and the component name (com.acme.ViewSourceActionComponent).

The configuration for UIExtension is explained here.

As noticed before, your action listener extends the MoreExtensionContainer class. Here you see it is passed to the type field. You can decide which menu your action is plugged in, by choosing one of types below:

TypeDescription
org.exoplatform.wiki.webui.control.UIPageToolBarActions will be placed in Toolbar in the View mode.
org.exoplatform.wiki.webui.control.AddExtensionContainerActions will be plugged in the Add Page menu in the View mode.
org.exoplatform.wiki.webui.control.MoreExtensionContainerActions will be plugged in the More menu in the View mode.
org.exoplatform.wiki.webui.control.UISubmitToolBarActions will be placed in Toolbar in the Edit mode.
org.exoplatform.wiki.webui.control.UIEditorTabsActions will be placed in the Editor tabs.
org.exoplatform.wiki.webui.control.BrowseExtensionContainerActions will be plugged in the Browse menu in the View mode.
org.exoplatform.wiki.webui.popup.UIWikiSettingContainerActions will be placed in the Setting tabs.
Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus