use of com.centurylink.mdw.plugin.designer.WorkflowSelectionProvider in project mdw-designer by CenturyLinkCloud.
the class ToolboxView method init.
@Override
public void init(IViewSite site) throws PartInitException {
super.init(site);
toolboxWrapper = ToolboxWrapper.getInstance();
WorkflowSelectionProvider selectionProvider = new WorkflowSelectionProvider(toolboxWrapper.getProcess());
selectionProvider.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
if (event.getSelection() instanceof ActivityImpl) {
ActivityImpl impl = (ActivityImpl) event.getSelection();
actionGroup.getDeleteAction().setEnabled(event.getSelection() != null && impl != null && impl.isUserAuthorized(UserRoleVO.ASSET_DESIGN));
} else {
actionGroup.getDeleteAction().setEnabled(false);
}
}
});
site.setSelectionProvider(selectionProvider);
toolboxWrapper.setSelectionProvider(selectionProvider);
toolboxWrapper.addDirtyStateListener(this);
}
use of com.centurylink.mdw.plugin.designer.WorkflowSelectionProvider in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerView method init.
@Override
public void init(IViewSite site) throws PartInitException {
super.init(site);
selectionProvider = new WorkflowSelectionProvider(null);
site.setSelectionProvider(selectionProvider);
}
use of com.centurylink.mdw.plugin.designer.WorkflowSelectionProvider in project mdw-designer by CenturyLinkCloud.
the class ProcessHierarchyView method init.
@Override
public void init(IViewSite site) throws PartInitException {
super.init(site);
WorkflowSelectionProvider selectionProvider = new WorkflowSelectionProvider(null);
site.setSelectionProvider(selectionProvider);
}
use of com.centurylink.mdw.plugin.designer.WorkflowSelectionProvider in project mdw-designer by CenturyLinkCloud.
the class TaskTemplateEditor method init.
@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
setSite(site);
textEditor = new StructuredTextEditor() {
@Override
public boolean isEditable() {
return false;
}
@Override
public boolean isEditorInputModifiable() {
return false;
}
@Override
public boolean isEditorInputReadOnly() {
return true;
}
@Override
public boolean isDirty() {
return false;
}
};
textEditor.setEditorPart(this);
if (input instanceof FileEditorInput) {
setInput(input);
IFile file = ((FileEditorInput) input).getFile();
WorkflowProject project = WorkflowProjectManager.getInstance().getWorkflowProject(file.getProject());
// force initialization
project.getDesignerProxy();
WorkflowPackage pkg = project.getPackage((IFolder) file.getParent());
taskTemplate = (TaskTemplate) pkg.getTaskTemplate(file);
// refresh from file system to make sure we're in sync
try {
Long taskId = taskTemplate.getId();
int version = taskTemplate.getVersion();
file.refreshLocal(IResource.DEPTH_ZERO, null);
String content = new String(PluginUtil.readFile(file));
TaskVO taskVO;
if (content.trim().startsWith("{")) {
taskVO = new TaskVO(new JSONObject(content));
} else {
TaskTemplateDocument doc = TaskTemplateDocument.Factory.parse(content);
com.centurylink.mdw.task.TaskTemplate fileTemplate = doc.getTaskTemplate();
taskVO = new TaskVO(fileTemplate);
}
taskTemplate.setTaskVO(taskVO);
taskVO.setName(file.getName());
taskVO.setTaskId(taskId);
taskTemplate.setId(taskId);
taskTemplate.setVersion(version);
taskVO.setPackageName(pkg.getName());
} catch (Exception ex) {
throw new PartInitException(ex.getMessage(), ex);
}
} else {
throw new PartInitException("Invalid input: " + input);
}
selectionProvider = new WorkflowSelectionProvider(taskTemplate);
site.setSelectionProvider(selectionProvider);
setPartName(taskTemplate.getName());
addPageChangedListener(new IPageChangedListener() {
public void pageChanged(PageChangedEvent event) {
if (getSelectedPage() == pages.get("Variables")) {
reconcileVariables();
}
}
});
partListener = new IPartListener2() {
public void partOpened(IWorkbenchPartReference partRef) {
// do nothing
}
public void partActivated(IWorkbenchPartReference partRef) {
IWorkbenchPart part = partRef.getPart(false);
if (part == TaskTemplateEditor.this && getSelectedPage() == pages.get("Variables"))
reconcileVariables();
}
public void partBroughtToTop(IWorkbenchPartReference partRef) {
// do nothing
}
public void partDeactivated(IWorkbenchPartReference partRef) {
// do nothing
}
public void partClosed(IWorkbenchPartReference partRef) {
// do nothing
}
public void partVisible(IWorkbenchPartReference partRef) {
// do nothing
}
public void partHidden(IWorkbenchPartReference partRef) {
// do nothing
}
public void partInputChanged(IWorkbenchPartReference partRef) {
// do nothing
}
};
getSite().getPage().addPartListener(partListener);
workbenchListener = new IWorkbenchListener() {
public boolean preShutdown(IWorkbench workbench, boolean forced) {
return MdwPlugin.getActivePage().closeEditor(TaskTemplateEditor.this, true);
}
public void postShutdown(IWorkbench workbench) {
// do nothing
}
};
PlatformUI.getWorkbench().addWorkbenchListener(workbenchListener);
}
use of com.centurylink.mdw.plugin.designer.WorkflowSelectionProvider in project mdw-designer by CenturyLinkCloud.
the class ProcessEditor method init.
@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
setSite(site);
if (input instanceof WorkflowProcess) {
setInput(input);
process = (WorkflowProcess) input;
} else if (input instanceof FileEditorInput) {
IFile file = ((FileEditorInput) input).getFile();
String processName = file.getName().substring(0, file.getName().length() - (file.getFileExtension().length() + 1));
WorkflowProject project = WorkflowProjectManager.getInstance().getWorkflowProject(file.getProject());
// force initialization
project.getDesignerProxy();
process = project.getProcess(processName);
setInput(process);
}
process.addElementChangeListener(this);
selectionProvider = new WorkflowSelectionProvider(process);
site.setSelectionProvider(selectionProvider);
if (process.hasInstanceInfo())
setPartName(process.getProcessInstance().getId().toString() + " - " + process.getName());
else
setPartName(process.getLabel());
}
Aggregations