use of com.centurylink.mdw.plugin.designer.model.WorkflowProcess in project mdw-designer by CenturyLinkCloud.
the class WorkflowElementActionHandler method exportAttributes.
public void exportAttributes(String attributePrefix, WorkflowElement element) {
if (element instanceof WorkflowPackage || element instanceof WorkflowProcess) {
ExportAttributesWizard exportAttributesWizard = new ExportAttributesWizard();
exportAttributesWizard.init(getWorkbench(), element);
exportAttributesWizard.setPrefix(attributePrefix);
new WizardDialog(getShell(), exportAttributesWizard).open();
}
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowProcess in project mdw-designer by CenturyLinkCloud.
the class MdwWorkbenchWindowAdvisor method postWindowOpen.
public void postWindowOpen() {
IWorkbenchPage activePage = Activator.getActivePage();
// check for updates
// IHandlerService handlerService = (IHandlerService)
// activePage.getWorkbenchWindow().getService(IHandlerService.class);
// try
// {
// Object result =
// handlerService.executeCommand("org.eclipse.equinox.p2.ui.sdk.update", null);
// System.out.println("result: " + result);
// if (result != null)
// System.out.println("result class: " + result.getClass().getName());
// }
// catch (Exception ex)
// {
// ex.printStackTrace();
// }
PluginMessages.log("MDW workbench startup...");
if (activePage != null) {
activePage.hideActionSet("com.centurylink.mdw.plugin.actionset.tools");
activePage.hideActionSet("com.centurylink.mdw.plugin.actionset.dev");
activePage.hideActionSet("com.centurylink.mdw.plugin.actionset.designerClassic");
activePage.hideActionSet("org.eclipse.ui.edit.text.actionSet.navigation");
activePage.hideActionSet("org.eclipse.ui.edit.text.actionSet.annotationNavigation");
activePage.hideActionSet("org.eclipse.ui.externaltools.ExternalToolsSet");
activePage.showActionSet("org.eclipse.search.menu");
// make sure the process explorer view is visible
try {
ProcessExplorerView processExplorerView = (ProcessExplorerView) activePage.showView("mdw.views.designer.processes");
if (mdwHost != null && mdwPort != null) {
final Shell shell = activePage.getActivePart().getSite().getShell();
BusyIndicator.showWhile(shell.getDisplay(), new Runnable() {
public void run() {
try {
discoveryException = null;
projectToImport = getWorkflowProject(mdwHost, mdwPort, mdwContextRoot);
if (projectToImport == null)
throw new DiscoveryException("Unable to discover workflow app at: " + mdwHost + ":" + mdwPort);
} catch (DiscoveryException ex) {
discoveryException = ex;
}
}
});
if (discoveryException != null)
throw discoveryException;
WorkflowProject existing = WorkflowProjectManager.getInstance().getRemoteWorkflowProject(projectToImport.getName());
if (existing != null)
WorkflowProjectManager.getInstance().deleteProject(existing);
ProgressMonitorDialog progMonDlg = new ProgressMonitorDialog(shell);
ProjectInflator projectInflator = new ProjectInflator(projectToImport, null);
projectInflator.inflateRemoteProject(progMonDlg);
ProjectImporter projectImporter = new ProjectImporter(projectToImport);
projectImporter.doImport();
processExplorerView.handleRefresh();
// handle preselected entity
if (preselectType != null && preselectType.trim().length() > 0 && preselectId != null && preselectId.trim().length() > 0) {
if (!preselectType.equals(PRESELECT_PROCESS_INSTANCE))
throw new UnsupportedOperationException("Unsupported preselect type: " + preselectType);
BusyIndicator.showWhile(shell.getDisplay(), new Runnable() {
public void run() {
// open the process instance
IWorkbenchPage page = MdwPlugin.getActivePage();
try {
WorkflowProcess instance = getProcessInstance(new Long(preselectId));
page.openEditor(instance, "mdw.editors.process");
page.showView("org.eclipse.ui.views.PropertySheet");
} catch (PartInitException ex) {
PluginMessages.uiError(ex, "Open Process Instance", projectToImport);
}
}
});
}
}
} catch (Exception ex) {
PluginMessages.uiError(ex, "Initialize Workspace");
}
}
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowProcess in project mdw-designer by CenturyLinkCloud.
the class MdwWorkbenchWindowAdvisor method getProcessInstance.
private WorkflowProcess getProcessInstance(Long processInstanceId) {
PluginDataAccess dataAccess = projectToImport.getDataAccess();
ProcessInstanceVO processInstanceInfo = dataAccess.getProcessInstance(processInstanceId);
ProcessVO processVO = new ProcessVO();
processVO.setProcessId(processInstanceInfo.getProcessId());
processVO.setProcessName(processInstanceInfo.getProcessName());
WorkflowProcess instanceVersion = new WorkflowProcess(projectToImport, processVO);
instanceVersion.setProcessInstance(processInstanceInfo);
return instanceVersion;
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowProcess in project mdw-designer by CenturyLinkCloud.
the class ProcessVersionsSection method drawWidgets.
public void drawWidgets(Composite composite, WorkflowElement selection) {
process = (WorkflowProcess) selection;
tableEditor = new TableEditor(process, TableEditor.TYPE_TABLE);
List<ColumnSpec> columnSpecs = new ArrayList<ColumnSpec>();
ColumnSpec packageColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Package", "package");
packageColSpec.width = 160;
columnSpecs.add(packageColSpec);
ColumnSpec versionColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Version", "version");
versionColSpec.width = 60;
columnSpecs.add(versionColSpec);
ColumnSpec idColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "ID", "id");
idColSpec.width = 65;
columnSpecs.add(idColSpec);
ColumnSpec createDateColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Created", "createDate");
createDateColSpec.width = 110;
columnSpecs.add(createDateColSpec);
ColumnSpec userColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "User", "user");
userColSpec.width = 75;
columnSpecs.add(userColSpec);
ColumnSpec commentsColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Comments", "comments");
commentsColSpec.width = 200;
columnSpecs.add(commentsColSpec);
ColumnSpec lockedToColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Locked To", "lockedTo");
lockedToColSpec.width = 75;
columnSpecs.add(lockedToColSpec);
ColumnSpec modDateColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Last Modified", "modDate");
modDateColSpec.width = 110;
columnSpecs.add(modDateColSpec);
tableEditor.setColumnSpecs(columnSpecs);
tableEditor.setReadOnly(true);
tableEditor.setContentProvider(new ProcessVersionContentProvider());
tableEditor.setLabelProvider(new ProcessVersionLabelProvider());
tableEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
openProcess((WorkflowProcess) newValue);
}
});
tableEditor.render(composite);
// right-click menu
tableEditor.getTable().addListener(SWT.MenuDetect, new Listener() {
public void handleEvent(Event event) {
tableEditor.getTable().setMenu(createContextMenu(tableEditor.getTable().getShell()));
}
});
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowProcess in project mdw-designer by CenturyLinkCloud.
the class ArtifactEditor method openTempFile.
public void openTempFile(IProgressMonitor monitor) {
tempFileEditor = null;
try {
IFolder folder = getTempFolder();
if (!folder.exists())
PluginUtil.createFoldersAsNeeded(getElement().getProject().getSourceProject(), folder, monitor);
final IFile file = getTempFile(folder);
final IWorkbenchPage activePage = MdwPlugin.getActivePage();
if (file.exists()) {
IEditorInput editorInput = new FileEditorInput(file);
tempFileEditor = activePage.findEditor(editorInput);
if (tempFileEditor == null) {
// we'll refresh from attribute value
new TempFileRemover(folder, file).remove(monitor);
} else {
// activate existing editor
tempFileEditor = IDE.openEditor(activePage, file, true);
}
}
if (tempFileEditor == null) {
// either the file didn't exist or it was not currently open,
// set from value
byte[] value = valueProvider.getArtifactContent();
if (value == null)
value = "".getBytes();
InputStream source = new ByteArrayInputStream(value);
file.create(source, true, monitor);
if (getElement().isReadOnly()) {
ResourceAttributes resourceAttrs = file.getResourceAttributes();
resourceAttrs.setReadOnly(true);
file.setResourceAttributes(resourceAttrs);
}
final Display display = Display.getCurrent();
if (display != null) {
display.syncExec(new Runnable() {
public void run() {
try {
if (!valueProvider.beforeTempFileOpened())
return;
tempFileEditor = IDE.openEditor(activePage, file, true);
if (tempFileEditor != null) {
// listen for artifact made dirty and
// propagate to process canvas
tempFileEditor.addPropertyListener(new IPropertyListener() {
public void propertyChanged(Object source, int propId) {
if (source instanceof EditorPart && propId == IWorkbenchPartConstants.PROP_DIRTY) {
if (((EditorPart) source).isDirty())
// process
fireValueChanged(null, true);
// editor
// should
// show
// dirty
}
}
});
// listen for artifact resource changes
ArtifactResourceListener resourceListener = new ArtifactResourceListener(getElement(), valueProvider, file);
getProject().addArtifactResourceListener(resourceListener);
// listen for workbench closed to prevent
// re-opening editor when the workbench is
// next opened
PlatformUI.getWorkbench().addWorkbenchListener(new ArtifactEditorWorkbenchListener(tempFileEditor));
}
valueProvider.afterTempFileOpened(tempFileEditor);
} catch (PartInitException ex) {
PluginMessages.log(ex);
}
}
});
}
// register to listen to process editor events
WorkflowProcess processVersion = null;
if (getElement() instanceof Activity)
processVersion = ((Activity) getElement()).getProcess();
else if (getElement() instanceof WorkflowProcess)
processVersion = (WorkflowProcess) getElement();
if (processVersion != null) {
IEditorPart processEditor = activePage.findEditor(processVersion);
if (processEditor != null && tempFileEditor != null)
((ProcessEditor) processEditor).addActiveScriptEditor(tempFileEditor);
}
}
} catch (Exception ex) {
PluginMessages.uiError(ex, "Open Temp File", getElement().getProject());
}
}
Aggregations