use of com.liferay.ide.kaleo.core.WorkflowSupportManager 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;
}
Aggregations