use of com.liferay.ide.portlet.core.model.PortletApp in project liferay-ide by liferay.
the class WindowStatesPossibleValueService method refreshValues.
private void refreshValues() {
PortletApp portletApp = context(PortletApp.class);
if ((portletApp != null) && !portletApp.disposed()) {
Set<String> newValues = new TreeSet<>();
for (int i = 0; i < DEFAULT_STATES.length; i++) {
newValues.add(DEFAULT_STATES[i]);
}
List<CustomWindowState> customWindowStates = portletApp.getCustomWindowStates();
for (CustomWindowState iCustomWindowState : customWindowStates) {
String customWindowState = iCustomWindowState.getWindowState().text(false);
if (customWindowState != null) {
newValues.add(customWindowState);
}
}
if (!this.values.equals(newValues)) {
this.values = Collections.unmodifiableSet(newValues);
}
if (this.initialized || this.readPriorToInit) {
refresh();
}
}
}
use of com.liferay.ide.portlet.core.model.PortletApp in project liferay-ide by liferay.
the class PublicRenderParameterValuesService method compute.
/**
* (non-Javadoc)
*
* @see org.eclipse.sapphire.modeling.PossibleValuesService#fillPossibleValues(java.
* util.SortedSet)
*/
@Override
protected void compute(Set<String> values) {
PortletApp portletApp = context(PortletApp.class);
ElementList<PublicRenderParameter> publicRenderParameters = portletApp.getPublicRenderParameters();
for (PublicRenderParameter renderParameter : publicRenderParameters) {
String indentifer = renderParameter.getIdentifier().content();
values.add(indentifer);
}
}
use of com.liferay.ide.portlet.core.model.PortletApp 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;
}
}
use of com.liferay.ide.portlet.core.model.PortletApp 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;
}
use of com.liferay.ide.portlet.core.model.PortletApp in project liferay-ide by liferay.
the class PortletXmlTests method portletXmlRead.
@Test
public void portletXmlRead() throws Exception {
final PortletApp portletApp = portletApp(PORTLET_XML);
assertNotNull(portletApp);
final ElementList<Portlet> portlets = portletApp.getPortlets();
assertNotNull(portlets);
assertEquals(1, portlets.size());
final Portlet portlet = portlets.get(0);
assertNotNull(portlet);
assertEquals("1", portlet.getPortletName().content());
assertEquals("Sample JSP", portlet.getDisplayName().content());
assertEquals("com.liferay.samplejsp.portlet.JSPPortlet", portlet.getPortletClass().text());
final Param param = portlet.getInitParams().get(0);
assertNotNull(param);
assertEquals("view-jsp", param.getName().content());
assertEquals("/view.jsp", param.getValue().content());
assertEquals(new Integer(0), portlet.getExpirationCache().content());
final Supports supports = portlet.getSupports();
assertNotNull(supports);
assertEquals("text/html", supports.getMimeType().content());
final PortletInfo info = portlet.getPortletInfo();
assertEquals("Sample JSP", info.getTitle().content());
assertEquals("Sample JSP", info.getShortTitle().content());
assertEquals("Sample JSP", info.getKeywords().content());
final ElementList<SecurityRoleRef> roles = portlet.getSecurityRoleRefs();
assertEquals(4, roles.size());
final SecurityRoleRef role = roles.get(1);
assertNotNull(role);
assertEquals("guest", role.getRoleName().content());
}
Aggregations