Search in sources :

Example 6 with MdwProgressMonitorDialog

use of com.centurylink.mdw.plugin.designer.dialogs.MdwProgressMonitorDialog in project mdw-designer by CenturyLinkCloud.

the class ExtensionModulesUpdater method doAdd.

private void doAdd(final ExtensionModule module, final Shell shell) {
    try {
        ProgressMonitorDialog pmDialog = new MdwProgressMonitorDialog(shell);
        pmDialog.run(true, true, new IRunnableWithProgress() {

            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                monitor.beginTask("Adding Extension Module: " + module.getName(), 105);
                monitor.worked(5);
                try {
                    if (module.addTo(project, monitor))
                        project.addExtension(module);
                    WorkflowProjectManager.getInstance().save(project);
                    monitor.done();
                } catch (InterruptedException ex) {
                    throw ex;
                } catch (Exception ex) {
                    PluginMessages.log(ex);
                    throw new InvocationTargetException(ex);
                }
            }
        });
    } catch (InvocationTargetException ex) {
        PluginMessages.uiError(shell, ex, "Add Extension Module", project);
    } catch (InterruptedException ex) {
        PluginMessages.log(ex);
        MessageDialog.openWarning(shell, "Add Extension Module", "Operation cancelled");
    }
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) MdwProgressMonitorDialog(com.centurylink.mdw.plugin.designer.dialogs.MdwProgressMonitorDialog) ProgressMonitorDialog(org.eclipse.jface.dialogs.ProgressMonitorDialog) MdwProgressMonitorDialog(com.centurylink.mdw.plugin.designer.dialogs.MdwProgressMonitorDialog) InvocationTargetException(java.lang.reflect.InvocationTargetException) ExtensionModuleException(com.centurylink.mdw.plugin.project.extensions.ExtensionModuleException) InvocationTargetException(java.lang.reflect.InvocationTargetException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress)

Example 7 with MdwProgressMonitorDialog

use of com.centurylink.mdw.plugin.designer.dialogs.MdwProgressMonitorDialog in project mdw-designer by CenturyLinkCloud.

the class ExtensionModulesUpdater method doUpdate.

private void doUpdate(final ExtensionModule module, final Shell shell) {
    try {
        ProgressMonitorDialog pmDialog = new MdwProgressMonitorDialog(shell);
        pmDialog.run(true, true, new IRunnableWithProgress() {

            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                monitor.beginTask("Updating Extension Module: " + module.getName(), 105);
                monitor.worked(5);
                try {
                    module.update(project, monitor);
                    monitor.done();
                } catch (InterruptedException ex) {
                    throw ex;
                } catch (Exception ex) {
                    PluginMessages.log(ex);
                    throw new InvocationTargetException(ex);
                }
            }
        });
    } catch (InvocationTargetException ex) {
        PluginMessages.uiError(shell, ex, "Update Extension Module", project);
    } catch (InterruptedException ex) {
        PluginMessages.log(ex);
        MessageDialog.openWarning(shell, "Update Extension Module", "Operation cancelled");
    }
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) MdwProgressMonitorDialog(com.centurylink.mdw.plugin.designer.dialogs.MdwProgressMonitorDialog) ProgressMonitorDialog(org.eclipse.jface.dialogs.ProgressMonitorDialog) MdwProgressMonitorDialog(com.centurylink.mdw.plugin.designer.dialogs.MdwProgressMonitorDialog) InvocationTargetException(java.lang.reflect.InvocationTargetException) ExtensionModuleException(com.centurylink.mdw.plugin.project.extensions.ExtensionModuleException) InvocationTargetException(java.lang.reflect.InvocationTargetException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress)

Example 8 with MdwProgressMonitorDialog

use of com.centurylink.mdw.plugin.designer.dialogs.MdwProgressMonitorDialog in project mdw-designer by CenturyLinkCloud.

the class ExtensionModulesUpdater method doRemove.

private void doRemove(final ExtensionModule module, final Shell shell) {
    try {
        ProgressMonitorDialog pmDialog = new MdwProgressMonitorDialog(shell);
        pmDialog.run(true, true, new IRunnableWithProgress() {

            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                monitor.beginTask("Removing Extension Module: " + module.getName(), 105);
                monitor.worked(5);
                try {
                    if (module.removeFrom(project, monitor))
                        project.removeExtension(module);
                    WorkflowProjectManager.getInstance().save(project);
                    monitor.done();
                } catch (InterruptedException ex) {
                    throw ex;
                } catch (Exception ex) {
                    PluginMessages.log(ex);
                    throw new InvocationTargetException(ex);
                }
            }
        });
    } catch (InvocationTargetException ex) {
        PluginMessages.uiError(shell, ex, "Remove Extension Module", project);
    } catch (InterruptedException ex) {
        PluginMessages.log(ex);
        MessageDialog.openWarning(shell, "Remove Extension Module", "Operation cancelled");
    }
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) MdwProgressMonitorDialog(com.centurylink.mdw.plugin.designer.dialogs.MdwProgressMonitorDialog) ProgressMonitorDialog(org.eclipse.jface.dialogs.ProgressMonitorDialog) MdwProgressMonitorDialog(com.centurylink.mdw.plugin.designer.dialogs.MdwProgressMonitorDialog) InvocationTargetException(java.lang.reflect.InvocationTargetException) ExtensionModuleException(com.centurylink.mdw.plugin.project.extensions.ExtensionModuleException) InvocationTargetException(java.lang.reflect.InvocationTargetException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress)

Example 9 with MdwProgressMonitorDialog

use of com.centurylink.mdw.plugin.designer.dialogs.MdwProgressMonitorDialog in project mdw-designer by CenturyLinkCloud.

the class ProcessExplorerContentProvider method getChildren.

public Object[] getChildren(Object parentElement) {
    if (parentElement instanceof WorkflowProject) {
        final WorkflowProject workflowProject = (WorkflowProject) parentElement;
        if (!workflowProject.isLoaded()) {
            try {
                IRunnableWithProgress loader = new IRunnableWithProgress() {

                    public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                        ProgressMonitor progressMonitor = new SwtProgressMonitor(monitor);
                        progressMonitor.start("Loading " + workflowProject.getLabel());
                        progressMonitor.progress(5);
                        try {
                            workflowProject.initialize(progressMonitor);
                            if (workflowProject.getDataAccess() != null) {
                                workflowProject.getTopLevelUserVisiblePackages(progressMonitor);
                                workflowProject.getArchivedUserVisiblePackagesFolder(progressMonitor);
                                progressMonitor.done();
                            }
                        } catch (Exception ex) {
                            throw new InvocationTargetException(ex);
                        }
                    }
                };
                ProgressMonitorDialog progMonDlg = new MdwProgressMonitorDialog(MdwPlugin.getShell());
                progMonDlg.run(true, false, loader);
            } catch (InvocationTargetException itx) {
                if (itx.getCause() instanceof DataUnavailableException) {
                    PluginMessages.log(itx);
                    MessageDialog.openWarning(MdwPlugin.getShell(), LOAD_WF_PROJECT, itx.getCause().getMessage());
                } else if (itx.getCause() instanceof DataAccessOfflineException) {
                    PluginMessages.log(itx);
                    MessageDialog.openError(MdwPlugin.getShell(), LOAD_WF_PROJECT, itx.getCause().getMessage());
                    return new WorkflowPackage[0];
                } else {
                    PluginMessages.uiError(itx, LOAD_WF_PROJECT, workflowProject);
                    return new WorkflowPackage[0];
                }
            } catch (Exception ex) {
                PluginMessages.uiError(ex, LOAD_WF_PROJECT, workflowProject);
                return new WorkflowPackage[0];
            }
        }
        if (workflowProject.getDataAccess() == null)
            return new WorkflowPackage[0];
        List<WorkflowPackage> topLevelPackages = workflowProject.getTopLevelUserVisiblePackages();
        Folder archivedPackageFolder = workflowProject.getArchivedUserVisiblePackagesFolder();
        int size = topLevelPackages.size();
        boolean showArchived = isShowArchivedItems(workflowProject);
        if (showArchived)
            size++;
        AutomatedTestSuite testSuite = workflowProject.getLegacyTestSuite();
        if (testSuite != null && !testSuite.isEmpty())
            size++;
        Object[] objects = new Object[size];
        for (int i = 0; i < topLevelPackages.size(); i++) objects[i] = topLevelPackages.get(i);
        int cur = topLevelPackages.size();
        if (showArchived) {
            objects[cur] = archivedPackageFolder;
            cur++;
        }
        if (testSuite != null && !testSuite.isEmpty())
            objects[cur] = testSuite;
        return objects;
    } else if (parentElement instanceof WorkflowPackage) {
        WorkflowPackage packageVersion = (WorkflowPackage) parentElement;
        if (packageVersion.isArchived() && packageVersion.hasDescendantPackageVersions()) {
            return packageVersion.getDescendantPackageVersions().toArray(new WorkflowPackage[0]);
        } else {
            List<WorkflowElement> elements = new ArrayList<>();
            IPreferenceStore prefsStore = MdwPlugin.getDefault().getPreferenceStore();
            if (!prefsStore.getBoolean(PreferenceConstants.PREFS_FILTER_PROCESSES_IN_PEX))
                elements.addAll(packageVersion.getProcesses());
            if (!prefsStore.getBoolean(PreferenceConstants.PREFS_FILTER_WORKFLOW_ASSETS_IN_PEX))
                elements.addAll(packageVersion.getAssets());
            if (!prefsStore.getBoolean(PreferenceConstants.PREFS_FILTER_EVENT_HANDLERS_IN_PEX))
                elements.addAll(packageVersion.getExternalEvents());
            if (prefsStore.getBoolean(PreferenceConstants.PREFS_SHOW_ACTIVITY_IMPLEMENTORS_IN_PEX))
                elements.addAll(packageVersion.getActivityImpls());
            if (!prefsStore.getBoolean(PreferenceConstants.PREFS_FILTER_TASK_TEMPLATES_IN_PEX))
                elements.addAll(packageVersion.getTaskTemplates());
            elements.addAll(packageVersion.getChildFolders());
            if (isSortPackageContentsAtoZ()) {
                Collections.sort(elements, new Comparator<WorkflowElement>() {

                    public int compare(WorkflowElement e1, WorkflowElement e2) {
                        return e1.getLabel().compareToIgnoreCase(e2.getLabel());
                    }
                });
            }
            return elements.toArray(new Object[0]);
        }
    } else if (parentElement instanceof WorkflowProcess) {
        WorkflowProcess processVersion = (WorkflowProcess) parentElement;
        if (processVersion.hasDescendantProcessVersions()) {
            return processVersion.getDescendantProcessVersions().toArray(new WorkflowProcess[0]);
        } else {
            return emptyARRAY;
        }
    } else if (parentElement instanceof Folder) {
        Folder folder = (Folder) parentElement;
        return folder.getChildren().toArray(new WorkflowElement[0]);
    } else if (parentElement instanceof AutomatedTestSuite) {
        AutomatedTestSuite testSuite = (AutomatedTestSuite) parentElement;
        return testSuite.getTestCases().toArray(new AutomatedTestCase[0]);
    } else if (parentElement instanceof AutomatedTestCase) {
        AutomatedTestCase testCase = (AutomatedTestCase) parentElement;
        if (!testCase.isLegacy())
            return emptyARRAY;
        List<LegacyExpectedResults> expectedResults = testCase.getLegacyExpectedResults();
        List<File> files = testCase.getFiles();
        Object[] objects = new Object[expectedResults.size() + files.size()];
        for (int i = 0; i < expectedResults.size(); i++) objects[i] = expectedResults.get(i);
        for (int i = expectedResults.size(); i < objects.length; i++) objects[i] = files.get(i - expectedResults.size());
        return objects;
    } else {
        return emptyARRAY;
    }
}
Also used : WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) SwtProgressMonitor(com.centurylink.mdw.plugin.designer.SwtProgressMonitor) MdwProgressMonitorDialog(com.centurylink.mdw.plugin.designer.dialogs.MdwProgressMonitorDialog) Folder(com.centurylink.mdw.plugin.designer.model.Folder) AutomatedTestSuite(com.centurylink.mdw.plugin.designer.model.AutomatedTestSuite) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress) Comparator(java.util.Comparator) ArrayList(java.util.ArrayList) List(java.util.List) AutomatedTestCase(com.centurylink.mdw.plugin.designer.model.AutomatedTestCase) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess) DataAccessOfflineException(com.centurylink.mdw.dataaccess.DataAccessOfflineException) MdwProgressMonitorDialog(com.centurylink.mdw.plugin.designer.dialogs.MdwProgressMonitorDialog) ProgressMonitorDialog(org.eclipse.jface.dialogs.ProgressMonitorDialog) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) DataAccessOfflineException(com.centurylink.mdw.dataaccess.DataAccessOfflineException) InvocationTargetException(java.lang.reflect.InvocationTargetException) DataUnavailableException(com.centurylink.mdw.designer.DataUnavailableException) InvocationTargetException(java.lang.reflect.InvocationTargetException) ProgressMonitor(com.centurylink.mdw.common.utilities.timer.ProgressMonitor) SwtProgressMonitor(com.centurylink.mdw.plugin.designer.SwtProgressMonitor) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) DataUnavailableException(com.centurylink.mdw.designer.DataUnavailableException) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) WorkflowElement(com.centurylink.mdw.plugin.designer.model.WorkflowElement)

Example 10 with MdwProgressMonitorDialog

use of com.centurylink.mdw.plugin.designer.dialogs.MdwProgressMonitorDialog in project mdw-designer by CenturyLinkCloud.

the class WebLogicServerConfigurator method doConfigure.

public void doConfigure(Shell shell) {
    setShell(shell);
    try {
        ProgressMonitorDialog pmDialog = new MdwProgressMonitorDialog(shell);
        pmDialog.run(true, true, this);
    } catch (InvocationTargetException ex) {
        PluginMessages.uiError(shell, ex, "Configure Server", getServerSettings().getProject());
    } catch (InterruptedException ex) {
        PluginMessages.log(ex);
        MessageDialog.openWarning(shell, "Configure Server", "Configuration cancelled");
    }
}
Also used : MdwProgressMonitorDialog(com.centurylink.mdw.plugin.designer.dialogs.MdwProgressMonitorDialog) MdwProgressMonitorDialog(com.centurylink.mdw.plugin.designer.dialogs.MdwProgressMonitorDialog) ProgressMonitorDialog(org.eclipse.jface.dialogs.ProgressMonitorDialog) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

MdwProgressMonitorDialog (com.centurylink.mdw.plugin.designer.dialogs.MdwProgressMonitorDialog)22 ProgressMonitorDialog (org.eclipse.jface.dialogs.ProgressMonitorDialog)22 InvocationTargetException (java.lang.reflect.InvocationTargetException)21 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)16 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)16 CoreException (org.eclipse.core.runtime.CoreException)9 IOException (java.io.IOException)8 WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)6 OperationCanceledException (org.eclipse.core.runtime.OperationCanceledException)6 Shell (org.eclipse.swt.widgets.Shell)6 IProject (org.eclipse.core.resources.IProject)4 WorkflowProcess (com.centurylink.mdw.plugin.designer.model.WorkflowProcess)3 ExtensionModuleException (com.centurylink.mdw.plugin.project.extensions.ExtensionModuleException)3 ConnectException (java.net.ConnectException)3 ArrayList (java.util.ArrayList)3 SubProgressMonitor (org.eclipse.core.runtime.SubProgressMonitor)3 ProgressMonitor (com.centurylink.mdw.common.utilities.timer.ProgressMonitor)2 SwtProgressMonitor (com.centurylink.mdw.plugin.designer.SwtProgressMonitor)2 WorkflowPackage (com.centurylink.mdw.plugin.designer.model.WorkflowPackage)2 ProjectConfigurator (com.centurylink.mdw.plugin.project.assembly.ProjectConfigurator)2