org.eclipse.swt.custom.BusyIndicator Java Examples

The following examples show how to use org.eclipse.swt.custom.BusyIndicator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GooglePreferencePage.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 访问api以验证 Key是否可用。 ;
 */
private void validator() {
	final String googleKey = googleKeyText.getText();
	BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {

		public void run() {
			// TODO Auto-generated method stub
			if (googleKey != null && !googleKey.trim().equals("")) {
				GoogleAPI.setHttpReferrer("http://www.heartsome.net");
				GoogleAPI.setKey(googleKey);
				try {
					String result = Translate.DEFAULT.execute("test", GoogleTransUtils.processLanguage("en-US"),
							GoogleTransUtils.processLanguage("zh-CN"));
					if (result.equals("测试")) {
						state = true;
					}
				} catch (GoogleAPIException e) {
					state = false;
				}
			} else {
				state = false;
			}
		}
	});
}
 
Example #2
Source File: ClipboardOperationAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void run() {
	if (fOperationCode == -1 || fOperationTarget == null)
		return;

	ITextEditor editor= getTextEditor();
	if (editor == null)
		return;

	if (!isReadOnlyOperation() && !validateEditorInputState())
		return;

	BusyIndicator.showWhile(getDisplay(), new Runnable() {
		public void run() {
			internalDoOperation();
		}
	});
}
 
Example #3
Source File: TextViewerShiftAction.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * 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() {
		@Override
		public void run() {
			fOperationTarget.doOperation(fOperationCode);
		}
	});
}
 
Example #4
Source File: OpenBrowserUtil.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
private static void internalOpen(final URL url, final boolean useExternalBrowser) {
	BusyIndicator.showWhile(null, new Runnable() {
		@Override
		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) {
			}
		}
	});
}
 
Example #5
Source File: JavaOutlinePage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void valueChanged(final boolean on, boolean store) {
	setChecked(on);
	BusyIndicator.showWhile(fOutlineViewer.getControl().getDisplay(), new Runnable() {
		public void run() {
			if (on) {
				fOutlineViewer.setComparator(fComparator);
				fDropSupport.setFeedbackEnabled(false);
			} else {
				fOutlineViewer.setComparator(fSourcePositonComparator);
				fDropSupport.setFeedbackEnabled(true);
			}
		}
	});

	if (store)
		JavaPlugin.getDefault().getPreferenceStore().setValue("LexicalSortingAction.isChecked", on); //$NON-NLS-1$
}
 
Example #6
Source File: ImportsAwareClipboardAction.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void run() {
	if (textOperationTarget == null)
		return;
	ITextEditor editor = getTextEditor();
	if (editor == null)
		return;
	if (isModifyOperation() && !validateEditorInputState())
		return;
	BusyIndicator.showWhile(getDisplay(), new Runnable() {
		@Override
		public void run() {
			internalDoOperation();
		}
	});
}
 
Example #7
Source File: RichTextEditor.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
private static void locateTemplateURL() {
	templateURL = RichTextEditor.class.getResource("resources/template.html");

	// if we are in an OSGi context, we need to convert the bundle URL to a file URL
	Bundle bundle = FrameworkUtil.getBundle(RichTextEditor.class);
	if (bundle != null) {
		try {
			templateURL = FileLocator.toFileURL(templateURL);
		} catch (IOException e) {
			e.printStackTrace();
		}
	} else if (templateURL.toString().startsWith("jar")) {
		BusyIndicator.showWhile(Display.getDefault(), new Runnable() {

			@Override
			public void run() {
				templateURL = ResourceHelper.getRichTextResource("template.html");
			}
		});
	}
}
 
Example #8
Source File: ExternalizeWizard.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public static void open(final ICompilationUnit unit, final Shell shell) {
	if (unit == null || !unit.exists()) {
		return;
	}
	Display display= shell != null ? shell.getDisplay() : Display.getCurrent();
	BusyIndicator.showWhile(display, new Runnable() {
		public void run() {
			NLSRefactoring refactoring= null;
			try {
				refactoring= NLSRefactoring.create(unit);
			} catch (IllegalArgumentException e) {
				// Loading a properties file can throw an IAE due to malformed Unicode escape sequence, see Properties#load for details.
				IStatus status= new Status(IStatus.ERROR, JavaPlugin.getPluginId(), e.getLocalizedMessage());
				ExceptionHandler.handle(status,
						NLSUIMessages.ExternalizeWizard_name,
						NLSUIMessages.ExternalizeWizard_error_message);
			}
			if (refactoring != null)
				new RefactoringStarter().activate(new ExternalizeWizard(refactoring), shell, ActionMessages.ExternalizeStringsAction_dialog_title, RefactoringSaveHelper.SAVE_REFACTORING);
		}
	});
}
 
Example #9
Source File: UIHelper.java    From tlaplus with MIT License 6 votes vote down vote up
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);
			}
		}
	});
}
 
Example #10
Source File: GcpLocalRunTab.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
private void updateProjectSelector() {
  Credential credential = accountSelector.getSelectedCredential();
  if (credential == null) {
    projectSelector.setProjects(new ArrayList<GcpProject>());
    return;
  }

  BusyIndicator.showWhile(projectSelector.getDisplay(), () -> {
    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$
    }
  });
}
 
Example #11
Source File: SWTUtil.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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();
		}
	});
}
 
Example #12
Source File: CopyAllSourceHandler.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * (non-Javadoc)
 * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
 */
public Object execute(ExecutionEvent event) throws ExecutionException {
	final IEditorPart editor = HandlerUtil.getActiveEditor(event);
	if (editor instanceof XLIFFEditorImplWithNatTable) {
		BusyIndicator.showWhile(HandlerUtil.getActiveWorkbenchWindow(event).getShell().getDisplay(), new Runnable() {
			public void run() {
				// fixed Bug #2638 XLIFF 编辑器:复制所有源文到目标时,译文处于编辑模式的文本段“未能”正确复制
				HsMultiActiveCellEditor.commit(true);
				XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor;
				XLFHandler handler = xliffEditor.getXLFHandler();
				handler.copyAllSource2Target();
				xliffEditor.redraw();
				HsMultiCellEditorControl.activeSourceAndTargetCell(xliffEditor);
			}
		});

	}
	return null;
}
 
Example #13
Source File: TmDbManagerDialog.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 执行查询
 * @param sysDbOp
 *            ;
 */
private void executeSearch(final SystemDBOperator sysDbOp) {
	BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
		public void run() {
			// 连接检查
			if (!sysDbOp.checkDbConnection()) {
				MessageDialog.openInformation(getShell(), Messages.getString("dialog.TmDbManagerDialog.msgTitle"),
						Messages.getString("dialog.TmDbManagerDialog.msg1"));
				setLastSelectedServer(null);
				return;
			}

			// 获取数据库信息,包括名称和语言
			List<DatabaseManagerDbListBean> temp = searchCurrServerDatabase(sysDbOp, currServer);

			currServerdbListInput.clear();
			if (temp != null) {
				currServerdbListInput.addAll(temp);
				if (temp.size() > 0) {
					getDbTableViewer().setSelection(new StructuredSelection(temp.get(0)));
				}
				setLastSelectedServer(currServer.getId());
			}
		}
	});
}
 
Example #14
Source File: OpenBrowserUtil.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
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);
			if (helpSystemUrl == null) { // can happen if org.eclipse.help.ui is not available
				return; // the resolve() method already wrote "Unable to instantiate help UI" to the log
			}
			try {
				IWorkbenchBrowserSupport browserSupport= PlatformUI.getWorkbench().getBrowserSupport();
				IWebBrowser browser;
				if (useExternalBrowser)
					browser= browserSupport.getExternalBrowser();
				else
					browser= browserSupport.createBrowser(null);
				browser.openURL(helpSystemUrl);
			} catch (PartInitException ex) {
				// XXX: show dialog?
				JavaPlugin.logErrorStatus("Opening Javadoc failed", ex.getStatus()); //$NON-NLS-1$
			}
		}
	});
}
 
Example #15
Source File: CopyAllSourceHandler.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * (non-Javadoc)
 * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
 */
public Object execute(ExecutionEvent event) throws ExecutionException {
	final IEditorPart editor = HandlerUtil.getActiveEditor(event);
	if (editor instanceof XLIFFEditorImplWithNatTable) {
		BusyIndicator.showWhile(HandlerUtil.getActiveWorkbenchWindow(event).getShell().getDisplay(), new Runnable() {
			public void run() {
				// fixed Bug #2638 XLIFF 编辑器:复制所有源文到目标时,译文处于编辑模式的文本段“未能”正确复制
				HsMultiActiveCellEditor.commit(true);
				XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor;
				XLFHandler handler = xliffEditor.getXLFHandler();
				handler.copyAllSource2Target();
				xliffEditor.redraw();
				HsMultiCellEditorControl.activeSourceAndTargetCell(xliffEditor);
			}
		});

	}
	return null;
}
 
Example #16
Source File: JavaOutlineInformationControl.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void run() {
	BusyIndicator.showWhile(fOutlineViewer.getControl().getDisplay(), new Runnable() {
		public void run() {
			fInnerLabelProvider.setShowDefiningType(isChecked());
			getDialogSettings().put(STORE_SORT_BY_DEFINING_TYPE_CHECKED, isChecked());

			setMatcherString(fPattern, false);
			fOutlineViewer.refresh(true);

			// reveal selection
			Object selectedElement= getSelectedElement();
			if (selectedElement != null)
				fOutlineViewer.reveal(selectedElement);
		}
	});
}
 
Example #17
Source File: LexicalSortingAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void valueChanged(final boolean on, boolean store) {
	setChecked(on);
	BusyIndicator.showWhile(fViewer.getControl().getDisplay(), new Runnable() {
		public void run() {
			if (on) {
				fViewer.setComparator(fComparator);
				fDropSupport.setFeedbackEnabled(false);
			} else {
				fViewer.setComparator(fSourcePositonComparator);
				fDropSupport.setFeedbackEnabled(true);
			}
		}
	});

	if (store)
		JavaPlugin.getDefault().getPreferenceStore().setValue(fPreferenceKey, on);
}
 
Example #18
Source File: SortCommandHandler.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean doCommand(final SortColumnCommand command) {

	final int columnIndex = command.getLayer().getColumnIndexByPosition(command.getColumnPosition());
	final SortDirectionEnum newSortDirection = sortModel.getSortDirection(columnIndex).getNextSortDirection();

	// Fire command - with busy indicator
	Runnable sortRunner = new Runnable() {
		public void run() {
			sortModel.sort(columnIndex, newSortDirection, command.isAccumulate());
		}
	};
	BusyIndicator.showWhile(null, sortRunner);

	// Fire event
	SortColumnEvent sortEvent = new SortColumnEvent(sortHeaderLayer, command.getColumnPosition());
	sortHeaderLayer.fireLayerEvent(sortEvent);

	return true;
}
 
Example #19
Source File: MultipleFolderSelectionDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void create() {

	BusyIndicator.showWhile(null, new Runnable() {
		public void run() {
			access$superCreate();

			fViewer.setCheckedElements(
				getInitialElementSelections().toArray());

			fViewer.expandToLevel(2);
			if (fExisting != null) {
				for (Iterator<Object> iter= fExisting.iterator(); iter.hasNext();) {
					fViewer.reveal(iter.next());
				}
			}

			updateOKStatus();
		}
	});

}
 
Example #20
Source File: CoreUtility.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates an extension.  If the extension plugin has not
 * been loaded a busy cursor will be activated during the duration of
 * the load.
 *
 * @param element the config element defining the extension
 * @param classAttribute the name of the attribute carrying the class
 * @return the extension object
 * @throws CoreException thrown if the creation failed
 */
public static Object createExtension(final IConfigurationElement element, final String classAttribute) throws CoreException {
	// If plugin has been loaded create extension.
	// Otherwise, show busy cursor then create extension.
	String pluginId = element.getContributor().getName();
	Bundle bundle = Platform.getBundle(pluginId);
	if (bundle != null && bundle.getState() == Bundle.ACTIVE ) {
		return element.createExecutableExtension(classAttribute);
	} else {
		final Object[] ret = new Object[1];
		final CoreException[] exc = new CoreException[1];
		BusyIndicator.showWhile(null, new Runnable() {
			public void run() {
				try {
					ret[0] = element.createExecutableExtension(classAttribute);
				} catch (CoreException e) {
					exc[0] = e;
				}
			}
		});
		if (exc[0] != null)
			throw exc[0];
		else
			return ret[0];
	}
}
 
Example #21
Source File: SortCommandHandler.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean doCommand(final SortColumnCommand command) {

	final int columnIndex = command.getLayer().getColumnIndexByPosition(command.getColumnPosition());
	final SortDirectionEnum newSortDirection = sortModel.getSortDirection(columnIndex).getNextSortDirection();

	// Fire command - with busy indicator
	Runnable sortRunner = new Runnable() {
		public void run() {
			sortModel.sort(columnIndex, newSortDirection, command.isAccumulate());
		}
	};
	BusyIndicator.showWhile(null, sortRunner);

	// Fire event
	SortColumnEvent sortEvent = new SortColumnEvent(sortHeaderLayer, command.getColumnPosition());
	sortHeaderLayer.fireLayerEvent(sortEvent);

	return true;
}
 
Example #22
Source File: CloseResourceAction.java    From gama with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #23
Source File: DeleteResourceAction.java    From gama with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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 = WorkbenchHelper.getWindow();
			if (w != null) {
				final List<IEditorReference> toClose = getMatchingEditors(resourceRoots, w, deletedOnly);
				if (toClose.isEmpty()) { return; }
				closeEditors(toClose, w);
			}
		}
	});
	BusyIndicator.showWhile(PlatformUI.getWorkbench().getDisplay(), runnable);
}
 
Example #24
Source File: MachineTranslationPreferencePage.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 访问goolge api以验证 Key是否可用。 ;
 */
private void googleValidator() {
	final String googleKey = googleKeyText.getText();
	BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {

		public void run() {
			// TODO Auto-generated method stub
			if (googleKey != null && !googleKey.trim().equals("")) {
				GoogleAPI.setHttpReferrer("http://www.heartsome.net");
				GoogleAPI.setKey(googleKey);
				try {
					String result = Translate.DEFAULT.execute("test", GoogleTransUtils.processLanguage("en-US"),
							GoogleTransUtils.processLanguage("zh-CN"));
					if (result.equals("测试")) {
						googleState = true;
					}
				} catch (GoogleAPIException e) {
					googleState = false;
				}
			} else {
				googleState = false;
			}
		}
	});
}
 
Example #25
Source File: MemberFilterActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void setMemberFilters(int[] propertyKeys, boolean[] propertyValues, boolean refresh) {
	if (propertyKeys.length == 0)
		return;
	Assert.isTrue(propertyKeys.length == propertyValues.length);

	for (int i= 0; i < propertyKeys.length; i++) {
		int filterProperty= propertyKeys[i];
		boolean set= propertyValues[i];

		IPreferenceStore store= JavaPlugin.getDefault().getPreferenceStore();
		boolean found= false;
		for (int j= 0; j < fFilterActions.length; j++) {
			int currProperty= fFilterActions[j].getFilterProperty();
			if (currProperty == filterProperty) {
				fFilterActions[j].setChecked(set);
				found= true;
				store.setValue(getPreferenceKey(filterProperty), set);
			}
		}
		if (found) {
			if (set) {
				fFilter.addFilter(filterProperty);
			} else {
				fFilter.removeFilter(filterProperty);
			}
		}
	}
	if (refresh) {
		fViewer.getControl().setRedraw(false);
		BusyIndicator.showWhile(fViewer.getControl().getDisplay(), new Runnable() {
			public void run() {
				fViewer.refresh();
			}
		});
		fViewer.getControl().setRedraw(true);
	}
}
 
Example #26
Source File: ShowQualifiedTypeNamesAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void run() {
	BusyIndicator.showWhile(fView.getSite().getShell().getDisplay(), new Runnable() {
		public void run() {
			fView.showQualifiedTypeNames(isChecked());
		}
	});
}
 
Example #27
Source File: ToggleCommentAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Implementation of the <code>IAction</code> prototype. Checks if the selected
 * lines are all commented or not and uncomments/comments them respectively.
 */
@Override
public void run() {
	if (fOperationTarget == null || fDocumentPartitioning == null || fPrefixesMap == null)
		return;

	ITextEditor editor= getTextEditor();
	if (editor == null)
		return;

	if (!validateEditorInputState())
		return;

	final int operationCode;
	if (isSelectionCommented(editor.getSelectionProvider().getSelection()))
		operationCode= ITextOperationTarget.STRIP_PREFIX;
	else
		operationCode= ITextOperationTarget.PREFIX;

	Shell shell= editor.getSite().getShell();
	if (!fOperationTarget.canDoOperation(operationCode)) {
		if (shell != null)
			MessageDialog.openError(shell, JavaEditorMessages.ToggleComment_error_title, JavaEditorMessages.ToggleComment_error_message);
		return;
	}

	Display display= null;
	if (shell != null && !shell.isDisposed())
		display= shell.getDisplay();

	BusyIndicator.showWhile(display, new Runnable() {
		public void run() {
			fOperationTarget.doOperation(operationCode);
		}
	});
}
 
Example #28
Source File: SortAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void run() {
	BusyIndicator.showWhile(fPage.getViewer().getControl().getDisplay(), new Runnable() {
		public void run() {
			fPage.setSortOrder(fSortOrder);
		}
	});
}
 
Example #29
Source File: JavaSynchronizationContentProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Executes the given runnable.
 *
 * @param runnable
 *            the runnable
 * @param control
 *            the control
 */
private void syncExec(final Runnable runnable, final Control control) {
	if (control != null && !control.isDisposed())
		control.getDisplay().syncExec(new Runnable() {

			public void run() {
				if (!control.isDisposed())
					BusyIndicator.showWhile(control.getDisplay(), runnable);
			}
		});
}
 
Example #30
Source File: SortByDefiningTypeAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void run() {
	BusyIndicator.showWhile(fMethodsViewer.getControl().getDisplay(), new Runnable() {
		public void run() {
			fMethodsViewer.sortByDefiningType(isChecked());
		}
	});
}