Search in sources :

Example 1 with Notification

use of com.liferay.ide.kaleo.core.model.Notification in project liferay-ide by liferay.

the class EditNotificationHandler method edit.

@Override
public Object edit(Element modelElement, Presentation context) {
    Notification notification = modelElement.nearest(Notification.class);
    IKaleoEditorHelper kaleoEditorHelper = KaleoUI.getKaleoEditorHelper(notification.getTemplateLanguage().text(true));
    kaleoEditorHelper.openEditor(getPart(), notification, Notification.PROP_TEMPLATE);
    return null;
}
Also used : IKaleoEditorHelper(com.liferay.ide.kaleo.ui.IKaleoEditorHelper) Notification(com.liferay.ide.kaleo.core.model.Notification)

Example 2 with Notification

use of com.liferay.ide.kaleo.core.model.Notification in project liferay-ide by liferay.

the class TemplateOpenActionHandler method run.

@Override
protected Object run(Presentation context) {
    try {
        Notification notification = notification(context);
        IKaleoEditorHelper kaleoEditorHelper = KaleoUI.getKaleoEditorHelper(notification.getTemplateLanguage().text(true));
        kaleoEditorHelper.openEditor(context.part(), notification, Notification.PROP_TEMPLATE);
    } catch (Exception e) {
        KaleoUI.logError("Could not open template editor.", e);
    }
    return null;
}
Also used : IKaleoEditorHelper(com.liferay.ide.kaleo.ui.IKaleoEditorHelper) Notification(com.liferay.ide.kaleo.core.model.Notification)

Example 3 with Notification

use of com.liferay.ide.kaleo.core.model.Notification in project liferay-ide by liferay.

the class NotificationsDiagramNodeEditHandlerFactory method create.

@Override
public List<SapphireActionHandler> create() {
    ListFactory<SapphireActionHandler> factory = ListFactory.start();
    Element element = getElement();
    if (element == null) {
        return factory.result();
    }
    List<ActionNotification> notifications = getNotifications();
    if (_listener == null) {
        _listener = new FilteredListener<PropertyEvent>() {

            @Override
            public void handleTypedEvent(PropertyEvent event) {
                broadcast(new Event());
            }
        };
    }
    element.attach(_listener, getListPropertyName());
    for (Notification notification : notifications) {
        notification.getName().attach(_listener);
        factory.add(new TemplateOpenActionHandler() {

            @Override
            public void init(SapphireAction sapphireAction, ActionHandlerDef def) {
                super.init(sapphireAction, def);
                String name = notification.getName().content(true);
                setLabel(empty(name) ? "<null>" : name);
                addImage(ActionNotification.TYPE.image());
            }

            @Override
            protected Notification notification(Presentation context) {
                return notification;
            }
        });
    }
    return factory.result();
}
Also used : Element(org.eclipse.sapphire.Element) PropertyEvent(org.eclipse.sapphire.PropertyEvent) Presentation(org.eclipse.sapphire.ui.Presentation) SapphireActionHandler(org.eclipse.sapphire.ui.SapphireActionHandler) ActionNotification(com.liferay.ide.kaleo.core.model.ActionNotification) ActionNotification(com.liferay.ide.kaleo.core.model.ActionNotification) Notification(com.liferay.ide.kaleo.core.model.Notification) ActionHandlerDef(org.eclipse.sapphire.ui.def.ActionHandlerDef) SapphireAction(org.eclipse.sapphire.ui.SapphireAction) Event(org.eclipse.sapphire.Event) PropertyEvent(org.eclipse.sapphire.PropertyEvent)

Aggregations

Notification (com.liferay.ide.kaleo.core.model.Notification)3 IKaleoEditorHelper (com.liferay.ide.kaleo.ui.IKaleoEditorHelper)2 ActionNotification (com.liferay.ide.kaleo.core.model.ActionNotification)1 Element (org.eclipse.sapphire.Element)1 Event (org.eclipse.sapphire.Event)1 PropertyEvent (org.eclipse.sapphire.PropertyEvent)1 Presentation (org.eclipse.sapphire.ui.Presentation)1 SapphireAction (org.eclipse.sapphire.ui.SapphireAction)1 SapphireActionHandler (org.eclipse.sapphire.ui.SapphireActionHandler)1 ActionHandlerDef (org.eclipse.sapphire.ui.def.ActionHandlerDef)1