use of com.liferay.ide.kaleo.ui.util.UploadWorkflowFileJob in project liferay-ide by liferay.
the class WorkflowDropAdapterAssistant method handleDrop.
@Override
public IStatus handleDrop(CommonDropAdapter aDropAdapter, DropTargetEvent aDropTargetEvent, Object aTarget) {
if (aTarget instanceof WorkflowDefinitionsFolder) {
WorkflowDefinitionsFolder folder = (WorkflowDefinitionsFolder) aTarget;
IKaleoConnection kaleoConnection = KaleoCore.getKaleoConnection(folder.getParent());
TransferData transferData = aDropTargetEvent.currentDataType;
if (LocalSelectionTransfer.getTransfer().isSupportedType(transferData)) {
Object dropData = LocalSelectionTransfer.getTransfer().getSelection();
if (dropData instanceof IStructuredSelection) {
IStructuredSelection selection = (IStructuredSelection) dropData;
Object element = selection.getFirstElement();
if (element instanceof IFile) {
IFile file = (IFile) element;
Runnable runnable = new Runnable() {
public void run() {
folder.clearCache();
Runnable runnable = new Runnable() {
public void run() {
IViewPart serversView = UIUtil.showView("org.eclipse.wst.server.ui.ServersView");
CommonViewer viewer = (CommonViewer) serversView.getAdapter(CommonViewer.class);
viewer.refresh(true);
}
};
Display.getDefault().asyncExec(runnable);
}
};
new UploadWorkflowFileJob(kaleoConnection, file, runnable).schedule();
}
}
}
}
return Status.OK_STATUS;
}
use of com.liferay.ide.kaleo.ui.util.UploadWorkflowFileJob 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