Search in sources :

Example 1 with ResolveCancelledException

use of org.bndtools.core.resolve.ResolveCancelledException in project bndtools by bndtools.

the class ResolutionChoiceInteractCallback method processCandidates.

public void processCandidates(final Requirement requirement, Set<Capability> wired, final List<Capability> candidates) {
    if (wired.size() > 0 || candidates.size() < 2)
        return;
    final Display display = PlatformUI.getWorkbench().getDisplay();
    final AtomicInteger resultRef = new AtomicInteger();
    Runnable runnable = new Runnable() {

        public void run() {
            Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
            if (!shell.isDisposed()) {
                ResolutionChoiceSelectionDialog dialog = new ResolutionChoiceSelectionDialog(shell, requirement, candidates);
                resultRef.set(dialog.open());
            } else {
                resultRef.set(IDialogConstants.CANCEL_ID);
            }
        }
    };
    display.syncExec(runnable);
    int result = resultRef.get();
    if (result == IDialogConstants.CANCEL_ID)
        throw new ResolveCancelledException();
}
Also used : ResolveCancelledException(org.bndtools.core.resolve.ResolveCancelledException) Shell(org.eclipse.swt.widgets.Shell) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Display(org.eclipse.swt.widgets.Display)

Aggregations

AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 ResolveCancelledException (org.bndtools.core.resolve.ResolveCancelledException)1 Display (org.eclipse.swt.widgets.Display)1 Shell (org.eclipse.swt.widgets.Shell)1