Package org.bndtools.core.resolve

Examples of org.bndtools.core.resolve.ResolveJob


                reallySave(monitor);
                return;
            }

            // Create resolver job and pre-validate
            final ResolveJob job = new ResolveJob(model);
            IStatus validation = job.validateBeforeRun();
            if (!validation.isOK()) {
                String message = "Unable to run the resolver. NB.: the file will still be saved.";
                ErrorDialog.openError(shell, "Resolution Validation Problem", message, validation, IStatus.ERROR | IStatus.WARNING);
                reallySave(monitor);
                return;
            }

            // Add operation to perform at the end of resolution (i.e. display
            // results and actually save the file)
            final UIJob completionJob = new UIJob(shell.getDisplay(), "Display Resolution Results") {
                @Override
                public IStatus runInUIThread(IProgressMonitor monitor) {
                    ResolutionResult result = job.getResolutionResult();
                    ResolutionWizard wizard = new ResolutionWizard(model, file, result);
                    if (result.getOutcome() != ResolutionResult.Outcome.Resolved /*|| !result.getResolve().getOptionalResources().isEmpty() */) {
                        WizardDialog dialog = new WizardDialog(shell, wizard);
                        if (dialog.open() != Window.OK) {
                            if (!wizard.performFinish()) {
                                MessageDialog.openError(shell, "Error", "Unable to store resolution results into Run Bundles list.");
                            }
                        }
                    } else {
                        if (!wizard.performFinish()) {
                            MessageDialog.openError(shell, "Error", "Unable to store resolution results into Run Bundles list.");
                        }
                    }
                    reallySave(monitor);
                    return Status.OK_STATUS;
                }
            };
            job.addJobChangeListener(new JobChangeAdapter() {
                @Override
                public void done(IJobChangeEvent event) {
                    completionJob.schedule();
                }
            });

            // Start job
            job.setUser(true);
            job.schedule();
        } else {
            // Not auto-resolving, just save
            reallySave(monitor);
        }
    }
View Full Code Here


                reallySave(monitor);
                return;
            }

            // Create resolver job and pre-validate
            final ResolveJob job = new ResolveJob(model);
            IStatus validation = job.validateBeforeRun();
            if (!validation.isOK()) {
                String message = "Unable to run the resolver. NB.: the file will still be saved.";
                ErrorDialog.openError(shell, "Resolution Validation Problem", message, validation, IStatus.ERROR | IStatus.WARNING);
                reallySave(monitor);
                return;
            }

            // Add operation to perform at the end of resolution (i.e. display
            // results and actually save the file)
            final UIJob completionJob = new UIJob(shell.getDisplay(), "Display Resolution Results") {
                @Override
                public IStatus runInUIThread(IProgressMonitor monitor) {
                    ResolutionResult result = job.getResolutionResult();
                    ResolutionWizard wizard = new ResolutionWizard(model, file, result);
                    if (result.getOutcome() != ResolutionResult.Outcome.Resolved /*|| !result.getResolve().getOptionalResources().isEmpty() */) {
                        WizardDialog dialog = new WizardDialog(shell, wizard);
                        if (dialog.open() != Window.OK) {
                            if (!wizard.performFinish()) {
                                MessageDialog.openError(shell, "Error", "Unable to store resolution results into Run Bundles list.");
                            }
                        }
                    } else {
                        if (!wizard.performFinish()) {
                            MessageDialog.openError(shell, "Error", "Unable to store resolution results into Run Bundles list.");
                        }
                    }
                    reallySave(monitor);
                    return Status.OK_STATUS;
                }
            };
            job.addJobChangeListener(new JobChangeAdapter() {
                @Override
                public void done(IJobChangeEvent event) {
                    completionJob.schedule();
                }
            });

            // Start job
            job.setUser(true);
            job.schedule();
        } else {
            // Not auto-resolving, just save
            reallySave(monitor);
        }
    }
View Full Code Here

        final IFile file = ResourceUtil.getFile(input);

        final Shell parentShell = page.getEditor().getSite().getShell();

        // Create the wizard and pre-validate
        final ResolveJob job = new ResolveJob(model);
        IStatus validation = job.validateBeforeRun();
        if (!validation.isOK()) {
            ErrorDialog errorDialog = new ErrorDialog(parentShell, "Validation Problem", null, validation, IStatus.ERROR | IStatus.WARNING) {
                @Override
                protected void createButtonsForButtonBar(Composite parent) {
                    // create OK, Cancel and Details buttons
                    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false);
                    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, true);
                    createDetailsButton(parent);
                }
            };
            int response = errorDialog.open();
            if (Window.CANCEL == response || validation.getSeverity() >= IStatus.ERROR)
                return;
        }

        // Add the operation to perform at the end of the resolution job (i.e.,
        // showing the result)
        final Runnable showResult = new Runnable() {
            public void run() {
                ResolutionWizard wizard = new ResolutionWizard(model, file, job.getResolutionResult());
                WizardDialog dialog = new WizardDialog(parentShell, wizard);
                dialog.open();
            }
        };
        job.addJobChangeListener(new JobChangeAdapter() {
            @Override
            public void done(IJobChangeEvent event) {
                Outcome outcome = job.getResolutionResult().getOutcome();
                if (outcome != Outcome.Cancelled)
                    parentShell.getDisplay().asyncExec(showResult);
            }
        });

        job.setUser(true);
        job.schedule();
    }
View Full Code Here

TOP

Related Classes of org.bndtools.core.resolve.ResolveJob

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.