Search in sources :

Example 1 with EventDefinition

use of com.liferay.ide.portlet.core.model.EventDefinition in project liferay-ide by liferay.

the class DefinePortletEventHandler method run.

/**
 * (non-Javadoc)
 *
 * @see
 * SapphireActionHandler#run(org.eclipse.sapphire.ui.
 * SapphireRenderingContext)
 */
@Override
protected Object run(Presentation context) {
    PortletApp rootModel = (PortletApp) context.part().getModelElement();
    EventDefinition eventDefintion = rootModel.getEventDefinitions().insert();
    // Select the node
    MasterDetailsEditorPagePart page = getPart().nearest(MasterDetailsEditorPagePart.class);
    MasterDetailsContentNodePart root = page.outline().getRoot();
    MasterDetailsContentNodePart node = root.findNode(eventDefintion);
    if (node != null) {
        node.select();
    }
    return eventDefintion;
}
Also used : MasterDetailsContentNodePart(org.eclipse.sapphire.ui.forms.MasterDetailsContentNodePart) MasterDetailsEditorPagePart(org.eclipse.sapphire.ui.forms.MasterDetailsEditorPagePart) EventDefinition(com.liferay.ide.portlet.core.model.EventDefinition) PortletApp(com.liferay.ide.portlet.core.model.PortletApp)

Example 2 with EventDefinition

use of com.liferay.ide.portlet.core.model.EventDefinition in project liferay-ide by liferay.

the class QNamesPossibleValuesService method compute.

/**
 * (non-Javadoc)
 *
 * @see org.eclipse.sapphire.modeling.PossibleValuesService#fillPossibleValues(java.
 *      util.SortedSet)
 */
@Override
protected void compute(Set<String> values) {
    Element Element = context(Element.class);
    // values.add( param( "0" ) );
    PortletApp portletApp = context(Element.class).nearest(PortletApp.class);
    if (Element instanceof EventDefinitionRef) {
        ElementList<EventDefinition> eventDefs = portletApp.getEventDefinitions();
        for (EventDefinition eventDefinition : eventDefs) {
            if ((eventDefinition.getNamespaceURI().content() != null) && (eventDefinition.getLocalPart().content() != null)) {
                values.add(getQName(eventDefinition.getNamespaceURI().content(false), eventDefinition.getLocalPart().content()));
            }
        }
    } else if (Element instanceof SupportedPublicRenderParameter) {
        ElementList<PublicRenderParameter> publicRenderParameters = portletApp.getPublicRenderParameters();
        for (PublicRenderParameter publicRenderParam : publicRenderParameters) {
            if ((publicRenderParam.getNamespaceURI().content() != null) && (publicRenderParam.getLocalPart().content() != null)) {
                values.add(getQName(publicRenderParam.getNamespaceURI().content(false), publicRenderParam.getLocalPart().content()));
            }
        }
    }
}
Also used : EventDefinitionRef(com.liferay.ide.portlet.core.model.EventDefinitionRef) Element(org.eclipse.sapphire.Element) ElementList(org.eclipse.sapphire.ElementList) EventDefinition(com.liferay.ide.portlet.core.model.EventDefinition) SupportedPublicRenderParameter(com.liferay.ide.portlet.core.model.SupportedPublicRenderParameter) SupportedPublicRenderParameter(com.liferay.ide.portlet.core.model.SupportedPublicRenderParameter) PublicRenderParameter(com.liferay.ide.portlet.core.model.PublicRenderParameter) PortletApp(com.liferay.ide.portlet.core.model.PortletApp)

Aggregations

EventDefinition (com.liferay.ide.portlet.core.model.EventDefinition)2 PortletApp (com.liferay.ide.portlet.core.model.PortletApp)2 EventDefinitionRef (com.liferay.ide.portlet.core.model.EventDefinitionRef)1 PublicRenderParameter (com.liferay.ide.portlet.core.model.PublicRenderParameter)1 SupportedPublicRenderParameter (com.liferay.ide.portlet.core.model.SupportedPublicRenderParameter)1 Element (org.eclipse.sapphire.Element)1 ElementList (org.eclipse.sapphire.ElementList)1 MasterDetailsContentNodePart (org.eclipse.sapphire.ui.forms.MasterDetailsContentNodePart)1 MasterDetailsEditorPagePart (org.eclipse.sapphire.ui.forms.MasterDetailsEditorPagePart)1