use of com.liferay.ide.kaleo.ui.navigator.WorkflowDefinitionsFolder in project liferay-ide by liferay.
the class AbstractWorkflowDefinitionAction method selectionChanged.
@SuppressWarnings("rawtypes")
public void selectionChanged(IStructuredSelection sel) {
if (sel.isEmpty()) {
setEnabled(false);
return;
}
boolean enabled = false;
Iterator iterator = sel.iterator();
while (iterator.hasNext()) {
Object obj = iterator.next();
if (obj instanceof WorkflowDefinitionEntry) {
WorkflowDefinitionEntry node = (WorkflowDefinitionEntry) obj;
if (accept(node)) {
enabled = true;
}
} else if (obj instanceof WorkflowDefinitionsFolder) {
WorkflowDefinitionsFolder node = (WorkflowDefinitionsFolder) obj;
if (accept(node)) {
enabled = true;
}
} else {
setEnabled(false);
return;
}
}
setEnabled(enabled);
}
use of com.liferay.ide.kaleo.ui.navigator.WorkflowDefinitionsFolder in project liferay-ide by liferay.
the class PublishWorkflowDefinitionAction method perform.
@Override
public void perform(Object node) {
if (getSelectionProvider() instanceof CommonViewer && node instanceof WorkflowDefinitionEntry) {
WorkflowDefinitionEntry definitionNode = (WorkflowDefinitionEntry) node;
Job publishJob = new Job("Publishing workflow draft definition") {
@Override
protected IStatus run(IProgressMonitor monitor) {
IKaleoConnection kaleoConnection = KaleoCore.getKaleoConnection(definitionNode.getParent().getParent());
try {
kaleoConnection.publishKaleoDraftDefinition(definitionNode.getName(), definitionNode.getTitleMap(), definitionNode.getContent(), definitionNode.getCompanyId() + "", definitionNode.getUserId() + "", definitionNode.getGroupId() + "");
} catch (KaleoAPIException kapie) {
kapie.printStackTrace();
}
WorkflowDefinitionsFolder definitionsFolder = (WorkflowDefinitionsFolder) definitionNode.getParent();
CommonViewer viewer = (CommonViewer) getSelectionProvider();
Display.getDefault().asyncExec(new Runnable() {
public void run() {
definitionsFolder.clearCache();
viewer.refresh(true);
}
});
return Status.OK_STATUS;
}
};
publishJob.schedule();
}
}
use of com.liferay.ide.kaleo.ui.navigator.WorkflowDefinitionsFolder in project liferay-ide by liferay.
the class RefreshWorkflowDefinitionsAction method perform.
@Override
public void perform(Object node) {
if (getSelectionProvider() instanceof CommonViewer) {
if (node instanceof WorkflowDefinitionsFolder) {
((WorkflowDefinitionsFolder) node).clearCache();
}
CommonViewer viewer = (CommonViewer) getSelectionProvider();
Display.getDefault().asyncExec(new Runnable() {
public void run() {
viewer.refresh(true);
}
});
}
}
use of com.liferay.ide.kaleo.ui.navigator.WorkflowDefinitionsFolder in project liferay-ide by liferay.
the class UploadNewWorkflowDefinitionAction method perform.
@Override
public void perform(Object node) {
if (getSelectionProvider() instanceof CommonViewer && node instanceof WorkflowDefinitionsFolder) {
IFile workspaceFile = promptForWorkspaceFile();
if ((workspaceFile == null) || !FileUtil.exists(workspaceFile)) {
return;
}
String errorMsgs = KaleoUtil.checkWorkflowDefinitionForErrors(workspaceFile);
if (!CoreUtil.empty(errorMsgs)) {
MessageDialog.openError(Display.getDefault().getActiveShell(), "Upload Kaleo Workflow", "Unable to upload kaleo workflow:\n\n" + errorMsgs);
return;
}
WorkflowDefinitionsFolder definitionsFolder = (WorkflowDefinitionsFolder) node;
IKaleoConnection kaleoConnection = KaleoCore.getKaleoConnection(definitionsFolder.getParent());
Runnable runnable = new Runnable() {
public void run() {
CommonViewer viewer = (CommonViewer) getSelectionProvider();
Runnable runnable = new Runnable() {
public void run() {
definitionsFolder.clearCache();
viewer.refresh(true);
}
};
Display.getDefault().asyncExec(runnable);
}
};
Job upload = new UploadWorkflowFileJob(kaleoConnection, workspaceFile, runnable);
upload.schedule();
}
}
Aggregations