Search in sources :

Example 1 with FormPart

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

the class ScriptableOpenActionHandler method scriptable.

protected Scriptable scriptable(Presentation context) {
    Scriptable retval = null;
    ISapphirePart part = context.part();
    if (part instanceof DetailSectionPart) {
        DetailSectionPart pageBook = part.nearest(DetailSectionPart.class);
        FormPart currentPage = pageBook.getCurrentPage();
        Element element = currentPage.getLocalModelElement();
        retval = element.nearest(Scriptable.class);
    } else {
        Element modelElement = context.part().getLocalModelElement();
        if (modelElement instanceof Task) {
            Task task = modelElement.nearest(Task.class);
            ElementHandle<Scriptable> scriptable = task.getScriptedAssignment();
            retval = scriptable.content(false);
        } else {
            retval = modelElement.nearest(Scriptable.class);
        }
    }
    return retval;
}
Also used : Task(com.liferay.ide.kaleo.core.model.Task) FormPart(org.eclipse.sapphire.ui.forms.FormPart) Element(org.eclipse.sapphire.Element) ISapphirePart(org.eclipse.sapphire.ui.ISapphirePart) Scriptable(com.liferay.ide.kaleo.core.model.Scriptable) DetailSectionPart(org.eclipse.sapphire.ui.forms.DetailSectionPart)

Example 2 with FormPart

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

the class TemplateOpenActionHandler method notification.

protected Notification notification(Presentation context) {
    ISapphirePart part = context.part();
    if (part instanceof DetailSectionPart) {
        DetailSectionPart pageBook = part.nearest(DetailSectionPart.class);
        FormPart currentPage = pageBook.getCurrentPage();
        Element element = currentPage.getLocalModelElement();
        return element.nearest(Notification.class);
    }
    SapphirePart spPart = context.part();
    Element element = spPart.getLocalModelElement();
    return element.nearest(Notification.class);
}
Also used : FormPart(org.eclipse.sapphire.ui.forms.FormPart) Element(org.eclipse.sapphire.Element) ISapphirePart(org.eclipse.sapphire.ui.ISapphirePart) DetailSectionPart(org.eclipse.sapphire.ui.forms.DetailSectionPart) SapphirePart(org.eclipse.sapphire.ui.SapphirePart) ISapphirePart(org.eclipse.sapphire.ui.ISapphirePart)

Aggregations

Element (org.eclipse.sapphire.Element)2 ISapphirePart (org.eclipse.sapphire.ui.ISapphirePart)2 DetailSectionPart (org.eclipse.sapphire.ui.forms.DetailSectionPart)2 FormPart (org.eclipse.sapphire.ui.forms.FormPart)2 Scriptable (com.liferay.ide.kaleo.core.model.Scriptable)1 Task (com.liferay.ide.kaleo.core.model.Task)1 SapphirePart (org.eclipse.sapphire.ui.SapphirePart)1