private void autoSelectSingle(final IStructuredSelection prev) { IStructuredSelection curr = (IStructuredSelection) getSelection(); if (!curr.equals(prev) || curr.isEmpty()) { if (curr.size() == 0 && impls.size() == 1) { // pick a default automatically setSelection(new StructuredSelection(impls.get(0))); } } fireSelectionChanged(); }
/** * Updates the enablement status of this action. * * @param structured the selection to use to determine the enablement. * @param executeSynchronous */ public void updateEnablement(IStructuredSelection structured, boolean executeSynchronous) { if (structured.equals(this.selection) || PlatformUI.getWorkbench().isClosing()) return; NullProgressMonitor lastMonitor = monitor; monitor = new NullProgressMonitor(); lastMonitor.setCanceled(true); SetEnablement enablement = new SetEnablement(structured, monitor, executeSynchronous); if (!executeSynchronous) { setEnabled(false); // _p3: why oh why are those guys don't using their tool instead do every fancy homegrown // thread start stuff? // executor.execute(enablement); System.out.println("OpAction: FIXME _p3: falko ..."); } else { enablement.run(); } }