Search in sources :

Example 1 with MasterDetailsEditorPagePart

use of org.eclipse.sapphire.ui.forms.MasterDetailsEditorPagePart in project liferay-ide by liferay.

the class CreatePortletActionHandler method run.

/**
 * (non-Javadoc)
 *
 * @see
 * SapphireActionHandler#run(org.eclipse.sapphire.ui.
 * SapphireRenderingContext)
 */
@Override
protected Object run(Presentation context) {
    PortletApp rootModel = (PortletApp) context.part().getModelElement();
    Portlet portlet = rootModel.getPortlets().insert();
    // Open the dialog to capture the mandatory properties
    SapphireDialog dialog = new SapphireDialog(((SwtPresentation) context).shell(), portlet, DefinitionLoader.sdef(PortletXmlEditor.class).dialog());
    if ((dialog != null) && (Dialog.OK == dialog.open())) {
        // Select the node
        MasterDetailsEditorPagePart page = getPart().nearest(MasterDetailsEditorPagePart.class);
        MasterDetailsContentNodePart root = page.outline().getRoot();
        MasterDetailsContentNodePart node = root.findNode(portlet);
        if (node != null) {
            node.select();
        }
        try {
            rootModel.resource().save();
        } catch (ResourceStoreException rse) {
        // Log it in PorletUI Plugin
        }
        return portlet;
    } else {
        rootModel.getPortlets().remove(portlet);
        portlet = null;
        try {
            rootModel.resource().save();
        } catch (ResourceStoreException rse) {
        // Log it in PorletUI Plugin
        }
        return null;
    }
}
Also used : ResourceStoreException(org.eclipse.sapphire.modeling.ResourceStoreException) Portlet(com.liferay.ide.portlet.core.model.Portlet) MasterDetailsContentNodePart(org.eclipse.sapphire.ui.forms.MasterDetailsContentNodePart) MasterDetailsEditorPagePart(org.eclipse.sapphire.ui.forms.MasterDetailsEditorPagePart) SapphireDialog(org.eclipse.sapphire.ui.forms.swt.SapphireDialog) PortletApp(com.liferay.ide.portlet.core.model.PortletApp)

Example 2 with MasterDetailsEditorPagePart

use of org.eclipse.sapphire.ui.forms.MasterDetailsEditorPagePart 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)

Aggregations

PortletApp (com.liferay.ide.portlet.core.model.PortletApp)2 MasterDetailsContentNodePart (org.eclipse.sapphire.ui.forms.MasterDetailsContentNodePart)2 MasterDetailsEditorPagePart (org.eclipse.sapphire.ui.forms.MasterDetailsEditorPagePart)2 EventDefinition (com.liferay.ide.portlet.core.model.EventDefinition)1 Portlet (com.liferay.ide.portlet.core.model.Portlet)1 ResourceStoreException (org.eclipse.sapphire.modeling.ResourceStoreException)1 SapphireDialog (org.eclipse.sapphire.ui.forms.swt.SapphireDialog)1