Search in sources :

Example 1 with ListSelectionService

use of org.eclipse.sapphire.ui.ListSelectionService 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 2 with ListSelectionService

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

the class ListSelectionEditHandler method run.

@Override
protected Object run(Presentation context) {
    Object retval = null;
    ListSelectionService selectionService = getSelectionService();
    if (selectionService != null) {
        List<Element> selection = selectionService.selection();
        retval = edit(selection.get(0), context);
    }
    return retval;
}
Also used : Element(org.eclipse.sapphire.Element) ListSelectionService(org.eclipse.sapphire.ui.ListSelectionService)

Aggregations

ListSelectionService (org.eclipse.sapphire.ui.ListSelectionService)2 Element (org.eclipse.sapphire.Element)1 Event (org.eclipse.sapphire.Event)1 ImageData (org.eclipse.sapphire.ImageData)1 Listener (org.eclipse.sapphire.Listener)1