private void doInvokeExportMarshallers(final BpmnMemoryModel model) throws InvocationTargetException, InterruptedException { final Collection<ExportMarshaller> marshallers = ExtensionPointUtil.getExportMarshallers(); final ExportMarshallerRunnable runnable = new ExportMarshallerRunnable(model, marshallers); final IProgressService progressService = PlatformUI.getWorkbench().getProgressService(); progressService.busyCursorWhile(runnable); }
private void fillProcessesList(final TableViewer tableViewer) { final IProgressService ps = PlatformUI.getWorkbench().getProgressService(); try { ps.busyCursorWhile( new IRunnableWithProgress() { @Override public void run(final IProgressMonitor pm) { final TracedProcess[] processesList = ProcessHelper.getProcsOnTracedNodes(); TraceBackend.getInstance().setProcesses(processesList); } }); } catch (final Exception e) { ErlLogger.error(e); } }
/** * The action has been activated. The argument of the method represents the 'real' action sitting * in the workbench UI. * * @see IWorkbenchWindowActionDelegate#run */ public void run(IAction action) { final SettingsDialog sd = new SettingsDialog(window.getShell()); if (sd.open() == Dialog.OK) { if (SWTHelper.askYesNo( "Wirklich Datenbank anonymisieren", "Achtung! Diese Aktion macht die Datenbank unwiderruflich unbrauchbar! Wirklich anonymisieren?")) { zufallsnamen = sd.replaceNames; IWorkbench wb = PlatformUI.getWorkbench(); IProgressService ps = wb.getProgressService(); try { ps.busyCursorWhile( new IRunnableWithProgress() { public void run(IProgressMonitor pm) { pm.beginTask("Anonymisiere Datenbank", TOTAL); int jobs = 1; if (sd.replaceKons) { jobs++; } if (sd.deleteDocs) { jobs++; } if (sd.purgeDB) { jobs++; } doShakeNames(pm, TOTAL / jobs); if (sd.replaceKons) { doShakeKons(pm, TOTAL / jobs); } if (sd.deleteDocs) { new DocumentRemover().run(pm, TOTAL / jobs); } if (sd.purgeDB) { doPurgeDB(pm, TOTAL / jobs); } pm.done(); } }); } catch (InvocationTargetException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }
private RenameSupport undoAndCreateRenameSupport(String newName) throws CoreException { // Assumption: the linked mode model should be shut down by now. final ISourceViewer viewer = fEditor.getViewer(); try { if (!fOriginalName.equals(newName)) { IWorkbenchWindow workbenchWindow = fEditor.getSite().getWorkbenchWindow(); // undo workbenchWindow.run( false, true, new IRunnableWithProgress() { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { if (viewer instanceof ITextViewerExtension6) { IUndoManager undoManager = ((ITextViewerExtension6) viewer).getUndoManager(); if (undoManager instanceof IUndoManagerExtension) { IUndoManagerExtension undoManagerExtension = (IUndoManagerExtension) undoManager; IUndoContext undoContext = undoManagerExtension.getUndoContext(); IOperationHistory operationHistory = OperationHistoryFactory.getOperationHistory(); while (undoManager.undoable()) { if (fStartingUndoOperation != null && fStartingUndoOperation.equals( operationHistory.getUndoOperation(undoContext))) { return; } undoManager.undo(); } } } } }); // wait for analysis IProgressService progressService = PlatformUI.getWorkbench().getProgressService(); progressService.busyCursorWhile( new IRunnableWithProgress() { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { monitor.beginTask("Waiting for background analysis...", IProgressMonitor.UNKNOWN); try { RefactoringUtils.waitResolvedCompilationUnit(fEditor, monitor); RefactoringUtils.waitReadyForRefactoring(monitor); } finally { monitor.done(); } } }); // by some reason "busyCursorWhile" looses focus, so restore it fEditor.setFocus(); // get new Element, after background build finished prepareElement(); if (fDartElement == null) { return null; } } } catch (InvocationTargetException e) { throw new CoreException( new Status( IStatus.ERROR, DartToolsPlugin.getPluginId(), ReorgMessages.RenameLinkedMode_error_saving_editor, e)); } catch (InterruptedException e) { // canceling is OK return null; } viewer.setSelectedRange(fOriginalSelection.x, fOriginalSelection.y); if (newName.length() == 0) { return null; } return RenameSupport.create(fDartElement, newName); }
/* * (non-Javadoc) * * @see org.mwc.debrief.core.interfaces.IPlotLoader#loadFile(org.mwc.cmap.plotViewer.editors.CorePlotEditor, * org.eclipse.ui.IEditorInput) */ public void loadFile( final PlotEditor thePlot, final InputStream inputStream, final String fileName) { final Layers theLayers = (Layers) thePlot.getAdapter(Layers.class); try { // hmm, is there anything in the file? final int numAvailable = inputStream.available(); if (numAvailable > 0) { final IWorkbench wb = PlatformUI.getWorkbench(); final IProgressService ps = wb.getProgressService(); ps.busyCursorWhile( new IRunnableWithProgress() { public void run(final IProgressMonitor pm) { // right, better suspend the LayerManager extended updates from // firing theLayers.suspendFiringExtended(true); try { DebriefPlugin.logError(Status.INFO, "about to start loading:" + fileName, null); // quick check, is this a KMZ if (fileName.endsWith(".tif")) { // create a layer name from the filename File tmpFile = new File(fileName); String layerName = tmpFile.getName(); // ok - get loading going final ExternallyManagedDataLayer dl = new ExternallyManagedDataLayer( ChartBoundsWrapper.WORLDIMAGE_TYPE, layerName, fileName); theLayers.addThisLayer(dl); } DebriefPlugin.logError(Status.INFO, "completed loading:" + fileName, null); // and inform the plot editor thePlot.loadingComplete(this); DebriefPlugin.logError(Status.INFO, "parent plot informed", null); } catch (final RuntimeException e) { DebriefPlugin.logError(Status.ERROR, "Problem loading datafile:" + fileName, e); } finally { // ok, allow the layers object to inform anybody what's // happening // again theLayers.suspendFiringExtended(false); // and trigger an update ourselves // theLayers.fireExtended(); } } }); } } catch (final InvocationTargetException e) { DebriefPlugin.logError(Status.ERROR, "Problem loading tif:" + fileName, e); } catch (final InterruptedException e) { DebriefPlugin.logError(Status.ERROR, "Problem loading tif:" + fileName, e); } catch (final IOException e) { DebriefPlugin.logError(Status.ERROR, "Problem loading tif:" + fileName, e); } finally { } // } // ok, load the data... DebriefPlugin.logError(Status.INFO, "Successfully loaded tuf file", null); }