Search in sources :

Example 1 with ImageData

use of org.eclipse.sapphire.ImageData in project liferay-ide by liferay.

the class WindowStateImageService method compute.

@Override
protected ImageData compute() {
    String strWindowState = null;
    Element element = context(Element.class);
    ImageData imageData = null;
    if (element instanceof CustomWindowState) {
        CustomWindowState customWindowState = (CustomWindowState) element;
        strWindowState = String.valueOf(customWindowState.getWindowState().content());
    } else if (element instanceof WindowState) {
        WindowState windowState = (WindowState) element;
        strWindowState = windowState.getWindowState().content();
    }
    if ("MAXIMIZED".equalsIgnoreCase(strWindowState)) {
        imageData = IMG_MAXIMIZED;
    } else if ("MINIMIZED".equalsIgnoreCase(strWindowState)) {
        imageData = IMG_MINIMIZED;
    }
    if (imageData == null) {
        imageData = IMG_DEFAULT;
    }
    return imageData;
}
Also used : WindowState(com.liferay.ide.portlet.core.model.WindowState) CustomWindowState(com.liferay.ide.portlet.core.model.CustomWindowState) CustomWindowState(com.liferay.ide.portlet.core.model.CustomWindowState) ImageData(org.eclipse.sapphire.ImageData) Element(org.eclipse.sapphire.Element)

Example 2 with ImageData

use of org.eclipse.sapphire.ImageData in project liferay-ide by liferay.

the class DefaultListAddActionHandler method init.

@Override
public void init(SapphireAction action, ActionHandlerDef def) {
    super.init(action, def);
    ImageData typeSpecificAddImage = _type.image();
    if (typeSpecificAddImage != null) {
        addImage(typeSpecificAddImage);
    }
    setLabel(_type.getLabel(false, CapitalizationType.TITLE_STYLE, false));
}
Also used : ImageData(org.eclipse.sapphire.ImageData)

Example 3 with ImageData

use of org.eclipse.sapphire.ImageData in project liferay-ide by liferay.

the class ListSelectionEditHandler method init.

@Override
public void init(SapphireAction action, ActionHandlerDef def) {
    super.init(action, def);
    ImageData typeImage = typeImage();
    if (typeImage != null) {
        addImage(typeImage);
    }
    ListSelectionService selectionService = action.getPart().service(ListSelectionService.class);
    Listener selectionListener = new Listener() {

        @Override
        public void handle(Event event) {
            refreshEnablementState();
        }
    };
    if (selectionService != null) {
        selectionService.attach(selectionListener);
    }
}
Also used : Listener(org.eclipse.sapphire.Listener) ImageData(org.eclipse.sapphire.ImageData) Event(org.eclipse.sapphire.Event) ListSelectionService(org.eclipse.sapphire.ui.ListSelectionService)

Example 4 with ImageData

use of org.eclipse.sapphire.ImageData in project liferay-ide by liferay.

the class ColumnImageService method compute.

@Override
public ImageData compute() {
    ImageData imageData = null;
    Column column = context(Column.class);
    if (column.isPrimary().content()) {
        imageData = _IMG_COLUMN_PRIMARY;
    } else {
        imageData = _IMG_COLUMN;
    }
    return imageData;
}
Also used : Column(com.liferay.ide.service.core.model.Column) ImageData(org.eclipse.sapphire.ImageData)

Example 5 with ImageData

use of org.eclipse.sapphire.ImageData 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

ImageData (org.eclipse.sapphire.ImageData)7 Element (org.eclipse.sapphire.Element)2 CustomPortletMode (com.liferay.ide.portlet.core.model.CustomPortletMode)1 CustomWindowState (com.liferay.ide.portlet.core.model.CustomWindowState)1 PortletMode (com.liferay.ide.portlet.core.model.PortletMode)1 WindowState (com.liferay.ide.portlet.core.model.WindowState)1 IPortletFramework (com.liferay.ide.project.core.IPortletFramework)1 Column (com.liferay.ide.service.core.model.Column)1 Event (org.eclipse.sapphire.Event)1 Listener (org.eclipse.sapphire.Listener)1 PossibleValuesService (org.eclipse.sapphire.PossibleValuesService)1 Property (org.eclipse.sapphire.Property)1 ValueImageService (org.eclipse.sapphire.services.ValueImageService)1 ValueLabelService (org.eclipse.sapphire.services.ValueLabelService)1 ListSelectionService (org.eclipse.sapphire.ui.ListSelectionService)1 SwtResourceCache (org.eclipse.sapphire.ui.forms.swt.SwtResourceCache)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 Image (org.eclipse.swt.graphics.Image)1 Button (org.eclipse.swt.widgets.Button)1