@Override public IStatus runInWorkspace(IProgressMonitor mon) throws CoreException { final long startTime = System.currentTimeMillis(); try { Display.getDefault() .asyncExec( new Runnable() { @Override public void run() { searchView.disableSearch(); } }); Activator.inheritVeriniceContextState(); final VeriniceSearchResult result = ServiceFactory.lookupSearchService().query(query); result.setVeriniceQuery(query); Display.getDefault() .asyncExec( new Runnable() { @Override public void run() { searchView.updateResultCombobox(result); if (LOG.isDebugEnabled()) { LOG.debug( "executing search for " + query.getQuery() + " lasts:\t" + String.valueOf(((System.currentTimeMillis() - startTime) / 1000)) + " seconds"); } } }); } finally { Display.getDefault() .asyncExec( new Runnable() { @Override public void run() { searchView.enableSearch(); } }); } return Status.OK_STATUS; }
/* (non-Javadoc) * @see org.eclipse.jface.action.Action#run() */ @Override public void run() { Activator.inheritVeriniceContextState(); IStructuredSelection selection = (IStructuredSelection) window.getSelectionService().getSelection(BsiModelView.ID); if (selection == null) { return; } final List<BausteinUmsetzung> selectedElements = new ArrayList<BausteinUmsetzung>(); EntityType entType = null; for (Iterator iter = selection.iterator(); iter.hasNext(); ) { Object o = iter.next(); if (o instanceof BausteinUmsetzung) { BausteinUmsetzung baustein = (BausteinUmsetzung) o; initParent(baustein); selectedElements.add(baustein); } } final KonsolidatorDialog dialog = new KonsolidatorDialog(window.getShell(), selectedElements); if (dialog.open() != Window.OK || dialog.getSource() == null) { return; } if (!KonsolidatorDialog.askConsolidate(window.getShell())) { return; } try { // close editors first: PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(true); PlatformUI.getWorkbench() .getProgressService() .busyCursorWhile( new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { Activator.inheritVeriniceContextState(); monitor.setTaskName(Messages.ShowKonsolidatorAction_2); monitor.beginTask(Messages.ShowKonsolidatorAction_3, selectedElements.size() + 1); BausteinUmsetzung source = dialog.getSource(); try { // change targets on server: KonsolidatorCommand command = new KonsolidatorCommand(selectedElements, source); command = ServiceFactory.lookupCommandService().executeCommand(command); // reload state from server: for (CnATreeElement element : command.getChangedElements()) { CnAElementFactory.getLoadedModel().databaseChildChanged(element); } } catch (CommandException e) { ExceptionUtil.log(e, Messages.ShowKonsolidatorAction_4); } monitor.done(); } }); } catch (InterruptedException e) { ExceptionUtil.log(e, Messages.ShowKonsolidatorAction_5); } catch (Exception e) { ExceptionUtil.log(e, Messages.ShowKonsolidatorAction_6); } }