use of com.liferay.ide.portlet.core.model.PortletApp in project liferay-ide by liferay.
the class PortletModePossibleValueService method compute.
// provided by Portlet Specification and Liferay
/**
* (non-Javadoc)
*
* @see org.eclipse.sapphire.modeling.PossibleValuesService#fillPossibleValues(java.
* util.SortedSet)
*/
@Override
protected void compute(Set<String> values) {
PortletApp portletApp = context(PortletApp.class);
for (int i = 0; i < DEFAULT_MODES.length; i++) {
values.add(DEFAULT_MODES[i]);
}
// Add the ones defined in portlet.xml
List<CustomPortletMode> customPortletModes = portletApp.getCustomPortletModes();
for (CustomPortletMode iCustomPortletMode : customPortletModes) {
String customPortletMode = iCustomPortletMode.getPortletMode().text(false);
if (customPortletMode != null) {
values.add(customPortletMode);
}
}
}
use of com.liferay.ide.portlet.core.model.PortletApp in project liferay-ide by liferay.
the class CreatePortletAppResourceBundleActionHandler method run.
/**
* (non-Javadoc)
*
* @see
* org.eclipse.sapphire.ui.SapphireActionHandler#run(org.eclipse.sapphire.ui.
* SapphireRenderingContext)
*/
@Override
protected Object run(Presentation context) {
Element element = getModelElement();
IProject project = element.adapt(IProject.class);
Property property = property();
Value<Path> resourceBundle = element.property((ValueProperty) property.definition());
String resourceBundleText = resourceBundle.text();
int index = resourceBundleText.lastIndexOf(".");
if (index == -1) {
index = resourceBundleText.length();
}
String packageName = resourceBundleText.substring(0, index);
String defaultRBFileName = PortletUtil.convertJavaToIoFileName(resourceBundleText, GenericResourceBundlePathService.RB_FILE_EXTENSION);
IFolder rbSourecFolder = getResourceBundleFolderLocation(project, defaultRBFileName);
IPath entryPath = rbSourecFolder.getLocation();
if (getModelElement() instanceof PortletApp) {
List<IFile> missingRBFiles = new ArrayList<>();
StringBuilder rbFileBuffer = new StringBuilder("#Portlet Application Resource Bundle \n");
IFile rbFile = wroot.getFileForLocation(entryPath.append(defaultRBFileName));
missingRBFiles.add(rbFile);
createFiles(context, project, packageName, missingRBFiles, rbFileBuffer);
setEnabled(false);
Property modelElement = getModelElement().property(property().definition());
modelElement.refresh();
}
return null;
}
use of com.liferay.ide.portlet.core.model.PortletApp in project liferay-ide by liferay.
the class WindowStatesPossibleValueService method initPossibleValuesService.
@Override
protected void initPossibleValuesService() {
super.initPossibleValuesService();
PortletApp portletApp = context(PortletApp.class);
Listener listener = new FilteredListener<PropertyContentEvent>() {
@Override
protected void handleTypedEvent(PropertyContentEvent event) {
refreshValues();
}
};
portletApp.attach(listener, PortletApp.PROP_CUSTOM_WINDOW_STATES.name());
refreshValues();
portletApp.attach(new FilteredListener<ElementDisposeEvent>() {
@Override
protected void handleTypedEvent(ElementDisposeEvent event) {
portletApp.detach(listener, PortletApp.PROP_CUSTOM_WINDOW_STATES.name());
}
});
this.initialized = true;
}
use of com.liferay.ide.portlet.core.model.PortletApp 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()));
}
}
}
}
Aggregations