Search in sources :

Example 1 with ISapphirePart

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

the class WorkflowProjectAdapterService method convert.

@Override
public <A> A convert(Object object, Class<A> adapterType) {
    A retval = null;
    if (IProject.class.equals(adapterType)) {
        ISapphirePart sapphirePart = context().find(ISapphirePart.class);
        WorkflowDefinition workflowDefinition = sapphirePart.getLocalModelElement().nearest(WorkflowDefinition.class);
        IFile file = workflowDefinition.adapt(IFile.class);
        if (file != null) {
            retval = adapterType.cast(file.getProject());
        } else {
            // create support project
            WorkflowSupportManager workflowSupportManager = KaleoCore.getDefault().getWorkflowSupportManager();
            IEditorInput editorInput = workflowDefinition.adapt(IEditorInput.class);
            if (editorInput instanceof WorkflowDefinitionEditorInput) {
                WorkflowDefinitionEditorInput workflowInput = (WorkflowDefinitionEditorInput) editorInput;
                WorkflowDefinitionEntry workflowEntry = workflowInput.getWorkflowDefinitionEntry();
                IServer server = workflowEntry.getParent().getParent();
                workflowSupportManager.setCurrentServer(server);
            }
            IJavaProject supportProject = workflowSupportManager.getSupportProject();
            retval = adapterType.cast(supportProject.getProject());
        }
    }
    return retval;
}
Also used : WorkflowDefinitionEditorInput(com.liferay.ide.kaleo.ui.editor.WorkflowDefinitionEditorInput) WorkflowDefinitionEntry(com.liferay.ide.kaleo.ui.navigator.WorkflowDefinitionEntry) IServer(org.eclipse.wst.server.core.IServer) IFile(org.eclipse.core.resources.IFile) IJavaProject(org.eclipse.jdt.core.IJavaProject) WorkflowDefinition(com.liferay.ide.kaleo.core.model.WorkflowDefinition) ISapphirePart(org.eclipse.sapphire.ui.ISapphirePart) WorkflowSupportManager(com.liferay.ide.kaleo.core.WorkflowSupportManager) IEditorInput(org.eclipse.ui.IEditorInput)

Example 2 with ISapphirePart

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

the class UseNodeWizardsActionHandler method init.

@Override
public void init(SapphireAction action, ActionHandlerDef def) {
    super.init(action, def);
    if (action.getType() == SapphireActionType.TOGGLE) {
        ISapphirePart diagramPart = getPart();
        WorkflowDefinitionEditor definitionEditor = diagramPart.adapt(WorkflowDefinitionEditor.class);
        if (definitionEditor != null) {
            setChecked(definitionEditor.isNodeWizardsEnabled());
            definitionEditor.addPropertyListener(new IPropertyListener() {

                public void propertyChanged(Object source, int propId) {
                    if (propId == WorkflowDefinitionEditor.PROP_NODE_WIZARDS_ENABLED) {
                        setChecked(definitionEditor.isNodeWizardsEnabled());
                    }
                }
            });
        }
    }
}
Also used : ISapphirePart(org.eclipse.sapphire.ui.ISapphirePart) IPropertyListener(org.eclipse.ui.IPropertyListener) WorkflowDefinitionEditor(com.liferay.ide.kaleo.ui.editor.WorkflowDefinitionEditor)

Example 3 with ISapphirePart

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

the class UseNodeWizardsActionHandler method run.

@Override
protected Object run(Presentation context) {
    ISapphirePart part = context.part();
    WorkflowDefinitionEditor definitionEditor = part.adapt(WorkflowDefinitionEditor.class);
    definitionEditor.setNodeWizardsEnabled(isChecked());
    return null;
}
Also used : ISapphirePart(org.eclipse.sapphire.ui.ISapphirePart) WorkflowDefinitionEditor(com.liferay.ide.kaleo.ui.editor.WorkflowDefinitionEditor)

Example 4 with ISapphirePart

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

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

the class StartTransitionActionHandler method run.

@Override
protected Object run(Presentation context) {
    WorkflowDefinitionEditor editor = context.part().adapt(WorkflowDefinitionEditor.class);
    SapphireDiagramEditor diagramEditor = editor.getDiagramEditor();
    ISapphirePart part = context.part();
    DiagramNodePart diagramPart = part.nearest(DiagramNodePart.class);
    SapphireDiagramEditorPagePart editorPart = part.nearest(SapphireDiagramEditorPagePart.class);
    ConnectionPalette connectionPalette = editorPart.getConnectionPalettes().get(0);
    CreationFactory factory = new ConnectionCreationFactory(connectionPalette.getConnectionDef());
    ConnectionCreationTool tool = new ConnectionCreationTool(factory);
    diagramEditor.getEditDomain().setActiveTool(tool);
    Event e = new Event();
    e.x = diagramPart.getNodeBounds().getX();
    e.y = diagramPart.getNodeBounds().getY();
    e.widget = diagramEditor.getGraphicalViewer().getControl();
    e.button = 1;
    MouseEvent me = new MouseEvent(e);
    tool.mouseDown(me, diagramEditor.getGraphicalViewer());
    return null;
}
Also used : SapphireDiagramEditorPagePart(org.eclipse.sapphire.ui.diagram.editor.SapphireDiagramEditorPagePart) MouseEvent(org.eclipse.swt.events.MouseEvent) ConnectionCreationTool(org.eclipse.gef.tools.ConnectionCreationTool) SapphireDiagramEditor(org.eclipse.sapphire.ui.swt.gef.SapphireDiagramEditor) ConnectionPalette(org.eclipse.sapphire.ui.diagram.editor.SapphireDiagramEditorPagePart.ConnectionPalette) ConnectionCreationFactory(org.eclipse.sapphire.ui.swt.gef.ConnectionCreationFactory) CreationFactory(org.eclipse.gef.requests.CreationFactory) Event(org.eclipse.swt.widgets.Event) MouseEvent(org.eclipse.swt.events.MouseEvent) ConnectionCreationFactory(org.eclipse.sapphire.ui.swt.gef.ConnectionCreationFactory) ISapphirePart(org.eclipse.sapphire.ui.ISapphirePart) DiagramNodePart(org.eclipse.sapphire.ui.diagram.editor.DiagramNodePart) WorkflowDefinitionEditor(com.liferay.ide.kaleo.ui.editor.WorkflowDefinitionEditor)

Aggregations

ISapphirePart (org.eclipse.sapphire.ui.ISapphirePart)8 WorkflowDefinitionEditor (com.liferay.ide.kaleo.ui.editor.WorkflowDefinitionEditor)3 Element (org.eclipse.sapphire.Element)3 DiagramNodePart (org.eclipse.sapphire.ui.diagram.editor.DiagramNodePart)3 SapphireDiagramEditorPagePart (org.eclipse.sapphire.ui.diagram.editor.SapphireDiagramEditorPagePart)3 SapphirePart (org.eclipse.sapphire.ui.SapphirePart)2 DetailSectionPart (org.eclipse.sapphire.ui.forms.DetailSectionPart)2 FormPart (org.eclipse.sapphire.ui.forms.FormPart)2 SapphireDiagramEditor (org.eclipse.sapphire.ui.swt.gef.SapphireDiagramEditor)2 WorkflowSupportManager (com.liferay.ide.kaleo.core.WorkflowSupportManager)1 Scriptable (com.liferay.ide.kaleo.core.model.Scriptable)1 Task (com.liferay.ide.kaleo.core.model.Task)1 WorkflowDefinition (com.liferay.ide.kaleo.core.model.WorkflowDefinition)1 WorkflowDefinitionEditorInput (com.liferay.ide.kaleo.ui.editor.WorkflowDefinitionEditorInput)1 WorkflowDefinitionEntry (com.liferay.ide.kaleo.ui.navigator.WorkflowDefinitionEntry)1 ArrayList (java.util.ArrayList)1 IFile (org.eclipse.core.resources.IFile)1 GraphicalEditPart (org.eclipse.gef.GraphicalEditPart)1 GraphicalViewer (org.eclipse.gef.GraphicalViewer)1 CreationFactory (org.eclipse.gef.requests.CreationFactory)1