use of com.liferay.ide.kaleo.core.op.NewWorkflowDefinitionOp in project liferay-ide by liferay.
the class NewWorkflowDefinitionHandler method execute.
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
NewWorkflowDefinitionOp op = NewWorkflowDefinitionOp.TYPE.instantiate();
NewWorkflowDefinitionWizard wizard = new NewWorkflowDefinitionWizard(op);
WizardDialog dialog = new WizardDialog(window.getShell(), wizard);
dialog.open();
return null;
}
use of com.liferay.ide.kaleo.core.op.NewWorkflowDefinitionOp in project liferay-ide by liferay.
the class NewWorkflowDefinitionAdapter method convert.
@Override
public <A> A convert(Object object, Class<A> adapterType) {
if (adapterType.equals(IProject.class)) {
NewWorkflowDefinitionOp op = context().find(NewWorkflowDefinitionOp.class);
ReferenceValue<String, IProject> referProject = op.getProject();
if (referProject != null) {
IProject project = referProject.target();
if (project != null) {
return adapterType.cast(project);
}
}
}
return null;
}
use of com.liferay.ide.kaleo.core.op.NewWorkflowDefinitionOp in project liferay-ide by liferay.
the class NewWorkflowDefinitionWizard method init.
public void init(IWorkbench workbench, IStructuredSelection selection) {
if (selection instanceof IStructuredSelection) {
IProject selectedProject = null;
IContainer selectedFolder = null;
IStructuredSelection sel = (IStructuredSelection) selection;
Object selectedObject = sel.getFirstElement();
if (selectedObject instanceof IProject) {
selectedProject = (IProject) selectedObject;
} else if (selectedObject instanceof IJavaProject) {
selectedProject = ((IJavaProject) selectedObject).getProject();
} else if (selectedObject instanceof IContainer) {
selectedFolder = (IContainer) selectedObject;
selectedProject = selectedFolder.getProject();
} else if (selectedObject instanceof IFile) {
selectedFolder = ((IFile) selectedObject).getParent();
selectedProject = selectedFolder.getProject();
}
if (selectedProject != null) {
NewWorkflowDefinitionOp op = element().nearest(NewWorkflowDefinitionOp.class);
op.setProject(selectedProject.getName());
if (selectedFolder != null) {
op.setFolder(selectedFolder.getProjectRelativePath().toPortableString());
}
}
}
}
use of com.liferay.ide.kaleo.core.op.NewWorkflowDefinitionOp in project liferay-ide by liferay.
the class EmailAddressValidationService method _getSchemaVersion.
private Version _getSchemaVersion() {
Version schemaVersion = new Version(KaleoCore.DEFAULT_KALEO_VERSION);
if (context(WorkflowDefinition.class) != null) {
WorkflowDefinition workflowDefinition = context(WorkflowDefinition.class);
Value<Version> version = workflowDefinition.getSchemaVersion();
schemaVersion = version.content();
} else if (context(NewNodeOp.class) != null) {
NewNodeOp newNodeOp = context(NewNodeOp.class);
ElementHandle<WorkflowDefinition> workflowDef = newNodeOp.getWorkflowDefinition();
WorkflowDefinition workflowDefinition = workflowDef.content();
Value<Version> version = workflowDefinition.getSchemaVersion();
schemaVersion = version.content();
} else if (context(NewWorkflowDefinitionOp.class) != null) {
NewWorkflowDefinitionOp newWorkflowDenitionOp = context(NewWorkflowDefinitionOp.class);
ReferenceValue<String, IProject> opProject = newWorkflowDenitionOp.getProject();
IProject project = opProject.target();
ILiferayProject liferayProj = LiferayCore.create(project);
ILiferayPortal portal = liferayProj.adapt(ILiferayPortal.class);
if (portal != null) {
schemaVersion = new Version(portal.getVersion());
}
}
return schemaVersion;
}
Aggregations