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;
}
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());
}
}
});
}
}
}
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;
}
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;
}
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;
}
Aggregations