protected void endTableEdit(TableCursor tableCursor, ControlEditor editor, final CommitEditRunnable commitEditRunnable, TableItem row, int column, String newValue) throws Exception { if (commitEditRunnable == null) { return; } commitEditRunnable.setTableCursor(tableCursor); commitEditRunnable.setEditor(editor); commitEditRunnable.setRow(row); commitEditRunnable.setColumn(column); commitEditRunnable.setNewValue(newValue); BusyIndicator.showWhile(row.getDisplay(), commitEditRunnable); Exception error = commitEditRunnable.getError(); if (error != null) { throw error; } }
protected void buttonPressed(int buttonId) { switch (buttonId) { case DETAILS_ID: BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() { public void run() { IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); InstallationDialog dialog = new InstallationDialog(getShell(), workbenchWindow); dialog.setModalParent(CustomAboutDialog.this); dialog.open(); } }); break; default: super.buttonPressed(buttonId); break; } }
public static void expandAll(final TreeViewer treeViewer, final String context) { AvroSchemaLogger.logMsg(context + " BEGIN", false); BusyIndicator.showWhile(Display.getCurrent(), new Runnable() { @Override public void run() { long time1 = System.currentTimeMillis(); try { treeViewer.getTree().setRedraw(false); treeViewer.expandAll(); } finally { treeViewer.getTree().setRedraw(true); long time2 = System.currentTimeMillis(); long delay = time2 - time1; AvroSchemaLogger.logMsg(context + " END : " + delay + " ms", false); } } }); }
public static void run(final TreeViewer treeViewer, final Runnable runnable, final String context) { AvroSchemaLogger.logMsg(context + " BEGIN", false); BusyIndicator.showWhile(Display.getCurrent(), new Runnable() { @Override public void run() { long time1 = System.currentTimeMillis(); try { treeViewer.getTree().setRedraw(false); runnable.run(); } finally { treeViewer.getTree().setRedraw(true); long time2 = System.currentTimeMillis(); long delay = time2 - time1; AvroSchemaLogger.logMsg(context + " END : " + delay + " ms", false); } } }); }
@Override public void runInUI(IRunnableContext context, IRunnableWithProgress runnable, ISchedulingRule rule) throws InvocationTargetException, InterruptedException { final RunnableWithStatus runnableWithStatus = new RunnableWithStatus( context, runnable, rule); uiSynchronize.syncExec(new Runnable() { @Override public void run() { BusyIndicator.showWhile(getDisplay(), runnableWithStatus); } }); IStatus status = runnableWithStatus.getStatus(); if (!status.isOK()) { Throwable exception = status.getException(); if (exception instanceof InvocationTargetException) throw (InvocationTargetException) exception; else if (exception instanceof InterruptedException) throw (InterruptedException) exception; else // should be OperationCanceledException throw new InterruptedException(exception.getMessage()); } }
/** * Handles the user typing control-enter on an existing link in the editor. */ private void openLinkUnderSelection() { log.debug("opening link under selection"); //$NON-NLS-1$ BusyIndicator.showWhile(getDisplay(), new Runnable() { @Override public void run() { // More immediate feedback. hideToolTip(); final Object linkObject = evaluate("return editor.getLinkUnderSelection() || '';"); //$NON-NLS-1$ if ((linkObject instanceof String) && linkObject.toString().length() > 0) { openLink((String) linkObject); } } }); }
/** * Handles the user clicking (or typing control-enter on) an existing link * in the editor. */ private void openLinkUnderMouseCursor() { log.debug("opening link under mouse cursor"); //$NON-NLS-1$ BusyIndicator.showWhile(getDisplay(), new Runnable() { @Override public void run() { // More immediate feedback. hideToolTip(); final Object linkObject = evaluate("return editor.getLinkUnderMouseCursor() || '';"); //$NON-NLS-1$ if ((linkObject instanceof String) && linkObject.toString().length() > 0) { openLink((String) linkObject); } } }); }
@Override protected void doRun(final TFSRepository repository) { final Change change = (Change) adaptSelectionFirstElement(Change.class); final String[] localItem = new String[1]; BusyIndicator.showWhile(Display.getDefault(), new Runnable() { @Override public void run() { localItem[0] = getLocalItemToView(change, repository); } }); final IWorkbenchPage workbenchPage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); ViewFileHelper.viewLocalFileOrFolder(localItem[0], workbenchPage, inModalContext); }
private SVNTreeConflict getTreeConflict(final IResource resource) { treeConflict = null; BusyIndicator.showWhile(Display.getDefault(), new Runnable() { public void run() { ISVNClientAdapter client = null; try { client = SVNWorkspaceRoot.getSVNResourceFor(resource).getRepository().getSVNClient(); ISVNStatus[] statuses = client.getStatus(resource.getLocation().toFile(), true, true, true); for (int i = 0; i < statuses.length; i++) { if (statuses[i].hasTreeConflict()) { treeConflict = new SVNTreeConflict(statuses[i]); break; } } } catch (Exception e) { SVNUIPlugin.log(IStatus.ERROR, e.getMessage(), e); } finally { SVNWorkspaceRoot.getSVNResourceFor(resource).getRepository().returnSVNClient(client); } } }); return treeConflict; }
private SVNTreeConflict getTreeConflict(final IResource resource) { BusyIndicator.showWhile(Display.getDefault(), new Runnable() { public void run() { ISVNClientAdapter client = null; try { client = SVNWorkspaceRoot.getSVNResourceFor(resource).getRepository().getSVNClient(); ISVNStatus[] statuses = client.getStatus(resource.getLocation().toFile(), true, true, true); for (int i = 0; i < statuses.length; i++) { if (statuses[i].hasTreeConflict()) { treeConflict = new SVNTreeConflict(statuses[i]); break; } } } catch (Exception e) { SVNUIPlugin.log(IStatus.ERROR, e.getMessage(), e); } finally { SVNWorkspaceRoot.getSVNResourceFor(resource).getRepository().returnSVNClient(client); } } }); return treeConflict; }
private void updateProjectSelector() { final Credential credential = accountSelector.getSelectedCredential(); if (credential == null) { projectSelector.setProjects(new ArrayList<GcpProject>()); return; } BusyIndicator.showWhile(projectSelector.getDisplay(), new Runnable() { @Override public void run() { try { List<GcpProject> gcpProjects = projectRepository.getProjects(credential); projectSelector.setProjects(gcpProjects); } catch (ProjectRepositoryException e) { logger.log(Level.WARNING, "Could not retrieve GCP project information from server.", e); //$NON-NLS-1$ } } }); }
public static void showDynamicHelp() { // This may take a while, so use the busy indicator BusyIndicator.showWhile(null, new Runnable() { public void run() { getActiveWindow().getWorkbench().getHelpSystem().displayDynamicHelp(); // the following ensure that the help view receives focus // prior to adding this, it would not receive focus if // it was opened into a folder or was already // open in a folder in which another part had focus IViewPart helpView = findView("org.eclipse.help.ui.HelpView"); if (helpView != null && getActiveWindow() != null && getActiveWindow().getActivePage() != null) { getActiveWindow().getActivePage().activate(helpView); } } }); }
@Override protected void okPressed() { final boolean[] shouldProceed = new boolean[] {false}; BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() { public void run() { try { CloudFoundryPlugin.getCloudFoundryClientFactory().getCloudFoundryOperations(url).getCloudInfo(); shouldProceed[0] = true; } catch (Exception e) { shouldProceed[0] = MessageDialog.openQuestion(getParentShell(), Messages.CloudUrlDialog_TEXT_INVALID_URL, NLS.bind(Messages.CloudUrlDialog_TEXT_CONN_FAILED, url)); } } }); if (shouldProceed[0]) { super.okPressed(); } }
/** * @see org.eclipse.swt.dnd.DropTargetListener#drop(org.eclipse.swt.dnd.DropTargetEvent) */ @Override public void drop(DropTargetEvent event) { Object data = event.data; if (data instanceof String[]) { final String[] strings = (String[]) data; BusyIndicator.showWhile(null, new Runnable() { @Override public void run() { for (int i = 0; i < strings.length; i++) { processString(strings[i]); } } }); } }
public void checkStateChanged(final CheckStateChangedEvent event) { BusyIndicator.showWhile(fTreeViewer.getControl().getDisplay(), new Runnable() { public void run() { if(event.getCheckable().equals(fTreeViewer)) treeItemChecked(event.getElement(), event.getChecked()); else listItemChecked(event.getElement(), event.getChecked(), true); notifyCheckStateChangeListeners(event); } } ); }
public void selectionChanged(final SelectionChangedEvent event) { BusyIndicator.showWhile(getTable().getShell().getDisplay(), new Runnable() { public void run() { IStructuredSelection selection = (IStructuredSelection)event.getSelection(); Object selectedElement = selection.getFirstElement(); if(selectedElement == null) { fCurrentTreeSelection = null; fListViewer.setInput(fCurrentTreeSelection); return; } else { populateListViewer(selectedElement); return; } } } ); }
/** * The <code>TextOperationAction</code> implementation of this <code>IAction</code> method runs the operation with * the current operation code. */ @Override @Execute public void run() { if (fOperationCode == -1 || fOperationTarget == null) return; ITextViewer viewer = getTextViewer(); if (viewer == null) return; if (!fRunsOnReadOnly && !canModifyViewer()) return; Display display = null; Shell shell = viewer.getTextWidget().getShell(); if (shell != null && !shell.isDisposed()) display = shell.getDisplay(); BusyIndicator.showWhile(display, new Runnable() { public void run() { fOperationTarget.doOperation(fOperationCode); } }); }
/** * The <code>TextOperationAction</code> implementation of this <code>IAction</code> method runs the operation with * the current operation code. */ @Override public void run() { if (fOperationCode == -1 || fOperationTarget == null) return; ITextViewer viewer = getTextViewer(); if (viewer == null) return; if (!canModifyViewer()) return; Display display = null; Shell shell = viewer.getTextWidget().getShell(); if (shell != null && !shell.isDisposed()) display = shell.getDisplay(); BusyIndicator.showWhile(display, new Runnable() { public void run() { fOperationTarget.doOperation(fOperationCode); } }); }
private static void internalOpen(final URL url, final boolean useExternalBrowser) { BusyIndicator.showWhile(null, new Runnable() { public void run() { URL helpSystemUrl= PlatformUI.getWorkbench().getHelpSystem().resolve(url.toExternalForm(), true); try { IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport(); IWebBrowser browser; if (useExternalBrowser) browser= browserSupport.getExternalBrowser(); else browser= browserSupport.createBrowser(null); browser.openURL(helpSystemUrl); } catch (PartInitException ex) { } } }); }
private void configureWorkspaceSettings() { String preferenceNodeId = this.getPreferenceNodeId(); IPreferencePage preferencePage = newPreferencePage(); final IPreferenceNode preferenceNode = new PreferenceNode(preferenceNodeId, preferencePage); PreferenceManager manager = new PreferenceManager(); manager.addToRoot(preferenceNode); final PreferenceDialog dialog = new PreferenceDialog(this.getControl().getShell(), manager); BusyIndicator.showWhile(this.getControl().getDisplay(), new Runnable() { @Override public void run() { dialog.create(); dialog.setMessage(preferenceNode.getLabelText()); dialog.open(); } }); }
@Override protected void okPressed() { final boolean[] shouldProceed = new boolean[] {false}; BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() { public void run() { try { DockerFoundryPlugin.getCloudFoundryClientFactory().getCloudFoundryOperations(url).getCloudInfo(); shouldProceed[0] = true; } catch (Exception e) { shouldProceed[0] = MessageDialog.openQuestion(getParentShell(), Messages.CloudUrlDialog_TEXT_INVALID_URL, NLS.bind(Messages.CloudUrlDialog_TEXT_CONN_FAILED, url)); } } }); if (shouldProceed[0]) { super.okPressed(); } }
/** * Show a single preference pages * * @param id * - the preference page identification * @param page * - the preference page */ protected void showPreferencePage(String id, IPreferencePage page, final IProject project) { final IPreferenceNode targetNode = new PreferenceNode(id, page); PreferenceManager manager = new PreferenceManager(); manager.addToRoot(targetNode); Shell shell = getControl().getShell(); final PreferenceDialog dialog = project == null ? new PreferenceDialog(shell, manager) : new PropertyDialog(shell, manager, new StructuredSelection(project)); BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() { public void run() { dialog.create(); dialog.setMessage(targetNode.getLabelText()); dialog.open(); } }); }
@Override protected void exportWithProgress(File file, JRExportProgressMonitor monitor) throws Throwable { final java.io.File f = file.getAbsoluteFile(); final Throwable[] ex = new Throwable[1]; BusyIndicator.showWhile(null, new Runnable() { public void run() { try { JRSaver.saveObject(getReportViewer().getReport(), f); } catch (Throwable e) { ex[0] = e; } } }); if (ex[0] != null) throw ex[0]; }
/** * Tries to find opened editors matching given resource roots. The editors will be closed without confirmation and * only if the editor resource does not exists anymore. * * @param resourceRoots * non null array with deleted resource tree roots * @param deletedOnly * true to close only editors on resources which do not exist */ static void closeMatchingEditors(final List<? extends IResource> resourceRoots, final boolean deletedOnly) { if (resourceRoots.isEmpty()) { return; } final Runnable runnable = () -> SafeRunner.run(new SafeRunnable(IDEWorkbenchMessages.ErrorOnCloseEditors) { @Override public void run() { final IWorkbenchWindow w = getActiveWindow(); if (w != null) { final List<IEditorReference> toClose = getMatchingEditors(resourceRoots, w, deletedOnly); if (toClose.isEmpty()) { return; } closeEditors(toClose, w); } } }); BusyIndicator.showWhile(PlatformUI.getWorkbench().getDisplay(), runnable); }
@Override public void create() { BusyIndicator.showWhile(null, new Runnable() { @Override public void run() { access$superCreate(); fViewer.setCheckedElements( getInitialElementSelections().toArray()); fViewer.expandToLevel(2); if (fExisting != null) { for (Iterator iter= fExisting.iterator(); iter.hasNext();) { fViewer.reveal(iter.next()); } } updateOKStatus(); } }); }
/** * This method allows us to open the preference dialog on the specific page, in this case the perspective page * * @param id * the id of pref page to show * @param page * the actual page to show Copied from org.eclipse.debug.internal.ui.SWTUtil */ public static void showPreferencePage(String id, IPreferencePage page) { final IPreferenceNode targetNode = new PreferenceNode(id, page); PreferenceManager manager = new PreferenceManager(); manager.addToRoot(targetNode); final PreferenceDialog dialog = new PreferenceDialog(UIUtils.getActiveShell(), manager); BusyIndicator.showWhile(getStandardDisplay(), new Runnable() { public void run() { dialog.create(); dialog.setMessage(targetNode.getLabelText()); dialog.open(); } }); }
@Override protected void okPressed() { BusyIndicator.showWhile(Display.getCurrent(), new Runnable() { @Override public void run() { // stop downloading images _mpProfile.resetAll(false); // model is saved in the dialog opening code updateModelFromUI(); } }); super.okPressed(); }
private void deleteOfflineFiles() { final Display display = Display.getCurrent(); if (MessageDialog.openConfirm( display.getActiveShell(), Messages.prefPage_cache_dlg_confirmDelete_title, NLS.bind(Messages.prefPage_cache_dlg_confirmDelete_message, _tileCacheDir.getAbsolutePath()))) { BusyIndicator.showWhile(display, new Runnable() { public void run() { _lblInfoWaitingValue.setText(Messages.prefPage_cache_status_deletingFiles); _lblInfoWaitingValue.pack(true); deleteDir(_tileCacheDir); getOfflineInfo(); } }); } }
@Override public ArrayList<TourData> getSelectedTours() { // get selected tour id's final Set<Long> tourIds = getSelectedTourIDs(); /* * show busyindicator when multiple tours needs to be retrieved from the database */ final ArrayList<TourData> selectedTourData = new ArrayList<TourData>(); if (tourIds.size() > 1) { BusyIndicator.showWhile(Display.getCurrent(), new Runnable() { @Override public void run() { getSelectedTourData(selectedTourData, tourIds); } }); } else { getSelectedTourData(selectedTourData, tourIds); } return selectedTourData; }
/** * enables/disables the controls which belong to the tour * * @param isChecked */ private void enableTours(final boolean isChecked) { final boolean isEnabled = !isChecked; // load tour data into the viewer if not yet done if (isEnabled && _isTourViewerInitialized == false) { BusyIndicator.showWhile(null, new Runnable() { @Override public void run() { // initialize the data before the view input is set _rootItem = new TVIWizardCompareRoot(); _tourViewer.setInput(this); _isTourViewerInitialized = true; } }); } _tourViewer.getControl().setEnabled(isEnabled); }
private void refilterViewer() { BusyIndicator.showWhile(_viewerContainer.getDisplay(), new Runnable() { @Override public void run() { _viewerContainer.setRedraw(false); { // keep selection final ISelection selectionBackup = getViewerSelection(); final Object[] checkedElements = _markerViewer.getCheckedElements(); { _markerViewer.refresh(false); } updateUI_SelectTourMarker(selectionBackup, checkedElements); } _viewerContainer.setRedraw(true); } }); }
public void sortGallery(final GallerySorting gallerySorting) { // check if resorting is needed if (_currentSorting == gallerySorting) { return; } /* * deselect all, this could be better implemented to keep selection, but is not yet done */ deselectAll(); // set new sorting algorithm _currentSorting = gallerySorting; BusyIndicator.showWhile(_display, new Runnable() { @Override public void run() { sortGallery_10_Runnable(); } }); }
@Override protected void okPressed() { net.tourbook.ui.UI.disableAllControls(_inputContainer); BusyIndicator.showWhile(Display.getCurrent(), new Runnable() { @Override public void run() { try { doExport(); } catch (final IOException e) { StatusUtil.log(e); } } }); super.okPressed(); }
@Override protected void okPressed() { net.tourbook.ui.UI.disableAllControls(_inputContainer); BusyIndicator.showWhile(Display.getCurrent(), new Runnable() { @Override public void run() { try { doPrint(); } catch (final Exception e) { e.printStackTrace(); displayErrorMessage(e); } } }); super.okPressed(); }
@Override protected void okPressed() { UI.disableAllControls(_inputContainer); BusyIndicator.showWhile(Display.getCurrent(), new Runnable() { public void run() { try { doExport(); } catch (final IOException e) { e.printStackTrace(); } } }); super.okPressed(); }
@Override protected void okPressed() { BusyIndicator.showWhile(Display.getCurrent(), new Runnable() { public void run() { // stop downloading images _mpProfile.resetAll(false); // model is saved in the dialog opening code updateModelFromUI(); } }); super.okPressed(); }