Search in sources :

Example 1 with WorkflowSelectionProvider

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);
}
Also used : ActivityImpl(com.centurylink.mdw.plugin.designer.model.ActivityImpl) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) WorkflowSelectionProvider(com.centurylink.mdw.plugin.designer.WorkflowSelectionProvider)

Example 2 with WorkflowSelectionProvider

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);
}
Also used : WorkflowSelectionProvider(com.centurylink.mdw.plugin.designer.WorkflowSelectionProvider)

Example 3 with WorkflowSelectionProvider

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);
}
Also used : WorkflowSelectionProvider(com.centurylink.mdw.plugin.designer.WorkflowSelectionProvider)

Example 4 with WorkflowSelectionProvider

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);
}
Also used : IWorkbenchListener(org.eclipse.ui.IWorkbenchListener) WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) TaskTemplateDocument(com.centurylink.mdw.task.TaskTemplateDocument) IFile(org.eclipse.core.resources.IFile) PageChangedEvent(org.eclipse.jface.dialogs.PageChangedEvent) IPageChangedListener(org.eclipse.jface.dialogs.IPageChangedListener) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) PartInitException(org.eclipse.ui.PartInitException) IWorkbenchPartReference(org.eclipse.ui.IWorkbenchPartReference) WorkflowSelectionProvider(com.centurylink.mdw.plugin.designer.WorkflowSelectionProvider) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) StructuredTextEditor(org.eclipse.wst.sse.ui.StructuredTextEditor) JSONException(org.json.JSONException) PartInitException(org.eclipse.ui.PartInitException) IPartListener2(org.eclipse.ui.IPartListener2) IWorkbench(org.eclipse.ui.IWorkbench) JSONObject(org.json.JSONObject) FileEditorInput(org.eclipse.ui.part.FileEditorInput) TaskVO(com.centurylink.mdw.model.value.task.TaskVO)

Example 5 with WorkflowSelectionProvider

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());
}
Also used : IFile(org.eclipse.core.resources.IFile) FileEditorInput(org.eclipse.ui.part.FileEditorInput) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess) WorkflowSelectionProvider(com.centurylink.mdw.plugin.designer.WorkflowSelectionProvider)

Aggregations

WorkflowSelectionProvider (com.centurylink.mdw.plugin.designer.WorkflowSelectionProvider)5 WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)2 IFile (org.eclipse.core.resources.IFile)2 FileEditorInput (org.eclipse.ui.part.FileEditorInput)2 TaskVO (com.centurylink.mdw.model.value.task.TaskVO)1 ActivityImpl (com.centurylink.mdw.plugin.designer.model.ActivityImpl)1 WorkflowPackage (com.centurylink.mdw.plugin.designer.model.WorkflowPackage)1 WorkflowProcess (com.centurylink.mdw.plugin.designer.model.WorkflowProcess)1 TaskTemplateDocument (com.centurylink.mdw.task.TaskTemplateDocument)1 IPageChangedListener (org.eclipse.jface.dialogs.IPageChangedListener)1 PageChangedEvent (org.eclipse.jface.dialogs.PageChangedEvent)1 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)1 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)1 IPartListener2 (org.eclipse.ui.IPartListener2)1 IWorkbench (org.eclipse.ui.IWorkbench)1 IWorkbenchListener (org.eclipse.ui.IWorkbenchListener)1 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)1 IWorkbenchPartReference (org.eclipse.ui.IWorkbenchPartReference)1 PartInitException (org.eclipse.ui.PartInitException)1 StructuredTextEditor (org.eclipse.wst.sse.ui.StructuredTextEditor)1