Search in sources :

Example 1 with WorkflowDefinitionEditor

use of com.liferay.ide.kaleo.ui.editor.WorkflowDefinitionEditor 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 2 with WorkflowDefinitionEditor

use of com.liferay.ide.kaleo.ui.editor.WorkflowDefinitionEditor 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 3 with WorkflowDefinitionEditor

use of com.liferay.ide.kaleo.ui.editor.WorkflowDefinitionEditor 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)

Example 4 with WorkflowDefinitionEditor

use of com.liferay.ide.kaleo.ui.editor.WorkflowDefinitionEditor in project liferay-ide by liferay.

the class NewNodeAddActionHandler method run.

@Override
public Object run(Presentation context) {
    Object retval = null;
    if (canRunWizard(context)) {
        NewNodeOp op = createOp(context);
        WorkflowDefinition oldWorkflowDefinition = (WorkflowDefinition) getModelElement();
        WorkflowDefinition newWorkflowDefinition = op.getWorkflowDefinition().content(true);
        newWorkflowDefinition.copy(oldWorkflowDefinition);
        // When WorkflowDefinition.getSchemaVersion(),
        // VersionedSchemaDefaultValueService.compute()
        // can't get the version, always returns the default value, directly
        // set the schema version here.
        newWorkflowDefinition.setSchemaVersion(oldWorkflowDefinition.getSchemaVersion().content());
        NewNodeOpWizard wizard = createNewNodeWizard(op, this, context);
        WorkflowDefinitionEditor definitionEditor = context.part().adapt(WorkflowDefinitionEditor.class);
        op.setUseNodeWizards(definitionEditor.isNodeWizardsEnabled());
        runWizard(context, wizard);
        definitionEditor.setNodeWizardsEnabled(op.isUseNodeWizards().content());
    } else {
        retval = insertDiagramPart(context, true);
    }
    return retval;
}
Also used : NewNodeOpWizard(com.liferay.ide.kaleo.ui.wizard.NewNodeOpWizard) NewNodeOp(com.liferay.ide.kaleo.core.op.NewNodeOp) WorkflowDefinition(com.liferay.ide.kaleo.core.model.WorkflowDefinition) WorkflowDefinitionEditor(com.liferay.ide.kaleo.ui.editor.WorkflowDefinitionEditor)

Aggregations

WorkflowDefinitionEditor (com.liferay.ide.kaleo.ui.editor.WorkflowDefinitionEditor)4 ISapphirePart (org.eclipse.sapphire.ui.ISapphirePart)3 WorkflowDefinition (com.liferay.ide.kaleo.core.model.WorkflowDefinition)1 NewNodeOp (com.liferay.ide.kaleo.core.op.NewNodeOp)1 NewNodeOpWizard (com.liferay.ide.kaleo.ui.wizard.NewNodeOpWizard)1 CreationFactory (org.eclipse.gef.requests.CreationFactory)1 ConnectionCreationTool (org.eclipse.gef.tools.ConnectionCreationTool)1 DiagramNodePart (org.eclipse.sapphire.ui.diagram.editor.DiagramNodePart)1 SapphireDiagramEditorPagePart (org.eclipse.sapphire.ui.diagram.editor.SapphireDiagramEditorPagePart)1 ConnectionPalette (org.eclipse.sapphire.ui.diagram.editor.SapphireDiagramEditorPagePart.ConnectionPalette)1 ConnectionCreationFactory (org.eclipse.sapphire.ui.swt.gef.ConnectionCreationFactory)1 SapphireDiagramEditor (org.eclipse.sapphire.ui.swt.gef.SapphireDiagramEditor)1 MouseEvent (org.eclipse.swt.events.MouseEvent)1 Event (org.eclipse.swt.widgets.Event)1 IPropertyListener (org.eclipse.ui.IPropertyListener)1