Search in sources :

Example 1 with PortletMode

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

the class PortletModeImageService method compute.

@Override
protected ImageData compute() {
    String portletMode = null;
    Element element = context(Element.class);
    ImageData imageData = null;
    if (element instanceof CustomPortletMode) {
        CustomPortletMode iCustomPortletMode = (CustomPortletMode) element;
        portletMode = String.valueOf(iCustomPortletMode.getPortletMode().content());
    } else if (element instanceof PortletMode) {
        PortletMode iPortletMode = (PortletMode) element;
        portletMode = iPortletMode.getPortletMode().content();
    }
    if (portletMode != null) {
        if ("VIEW".equalsIgnoreCase(portletMode)) {
            imageData = IMG_VIEW;
        } else if ("EDIT".equalsIgnoreCase(portletMode)) {
            imageData = IMG_EDIT;
        } else if ("HELP".equalsIgnoreCase(portletMode)) {
            imageData = IMG_HELP;
        }
    }
    if (imageData == null) {
        imageData = IMG_DEFAULT;
    }
    return imageData;
}
Also used : ImageData(org.eclipse.sapphire.ImageData) Element(org.eclipse.sapphire.Element) CustomPortletMode(com.liferay.ide.portlet.core.model.CustomPortletMode) CustomPortletMode(com.liferay.ide.portlet.core.model.CustomPortletMode) PortletMode(com.liferay.ide.portlet.core.model.PortletMode)

Aggregations

CustomPortletMode (com.liferay.ide.portlet.core.model.CustomPortletMode)1 PortletMode (com.liferay.ide.portlet.core.model.PortletMode)1 Element (org.eclipse.sapphire.Element)1 ImageData (org.eclipse.sapphire.ImageData)1