use of org.eclipse.sapphire.modeling.ResourceStoreException 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;
}
}
Aggregations