本文整理汇总了Java中org.eclipse.swt.widgets.Display.asyncExec方法的典型用法代码示例。如果您正苦于以下问题:Java Display.asyncExec方法的具体用法?Java Display.asyncExec怎么用?Java Display.asyncExec使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.Display
的用法示例。
在下文中一共展示了Display.asyncExec方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: triggerErrorLabel
import org.eclipse.swt.widgets.Display; //导入方法依赖的package包/类
private void triggerErrorLabel ( final String string )
{
final Display d = this.errorLabel.getDisplay ();
if ( !d.isDisposed () )
{
d.asyncExec ( new Runnable () {
@Override
public void run ()
{
if ( !GeneratorView.this.errorLabel.isDisposed () )
{
GeneratorView.this.errorLabel.setText ( string );
}
}
} );
}
}
示例2: notifyError
import org.eclipse.swt.widgets.Display; //导入方法依赖的package包/类
/**
* Notify error using message box (thread safe).
* @param message The message to display
* @param error The error that occurred
*/
public void notifyError ( final String message, final Throwable error )
{
final Display display = getWorkbench ().getDisplay ();
if ( !display.isDisposed () )
{
display.asyncExec ( new Runnable () {
@Override
public void run ()
{
final Shell shell = getWorkbench ().getActiveWorkbenchWindow ().getShell ();
logger.debug ( "Shell disposed: {}", shell.isDisposed () );
if ( !shell.isDisposed () )
{
final IStatus status = new OperationStatus ( IStatus.ERROR, PLUGIN_ID, 0, message + ":" + error.getMessage (), error );
ErrorDialog.openError ( shell, null, message, status );
}
}
} );
}
}
示例3: handleSetResult
import org.eclipse.swt.widgets.Display; //导入方法依赖的package包/类
protected void handleSetResult ( final FactoryInformation factory, final String connectionUri )
{
final Display display = getSite ().getShell ().getDisplay ();
if ( !display.isDisposed () )
{
display.asyncExec ( new Runnable () {
@Override
public void run ()
{
if ( !display.isDisposed () )
{
setResult ( factory, connectionUri );
}
}
} );
}
}
示例4: messageBoxWithoutReturnCode
import org.eclipse.swt.widgets.Display; //导入方法依赖的package包/类
private static void messageBoxWithoutReturnCode(final String message, int options) {
final Display display = getDisplay();
Runnable runnable = new Runnable() {
public void run() {
try {
messageBox(null, message, SWT.OK | SWT.ICON_INFORMATION);
}
catch (Exception e){
ConvertigoPlugin.logException(e, "Error while trying to open message box");
}
};
};
if (display.getThread() != Thread.currentThread()) {
display.asyncExec(runnable);
} else {
display.syncExec(runnable);
}
}
示例5: asyncRefreshCommonViewer
import org.eclipse.swt.widgets.Display; //导入方法依赖的package包/类
private void asyncRefreshCommonViewer(final ProjectExplorer explorer, final boolean resetInput) {
// do deferred initialization
this.getWorkingSetManagers().stream()
.filter(m -> (m instanceof IDeferredInitializer))
.map(m -> (IDeferredInitializer) m)
.filter(m -> m.isInitializationRequired())
.forEach(m -> {
m.lateInit();
});
final CommonViewer viewer = explorer.getCommonViewer();
final Display d = getDisplay();
if (!d.isDisposed()) {
if (resetInput) {
d.asyncExec(() -> {
if (!viewer.getTree().isDisposed())
viewer.setInput(viewer.getInput());
});
} else {
d.asyncExec(() -> {
if (!viewer.getTree().isDisposed())
viewer.refresh(true);
});
}
}
}
示例6: stopEclipseUI
import org.eclipse.swt.widgets.Display; //导入方法依赖的package包/类
/**
* Stop Eclipse UI.
*/
private void stopEclipseUI() {
if (PlatformUI.isWorkbenchRunning()==false) return;
final IWorkbench workbench = PlatformUI.getWorkbench();
final Display display = workbench.getDisplay();
display.asyncExec(new Runnable() {
public void run() {
if (!display.isDisposed()) {
workbench.close();
}
}
});
}
示例7: fireChangeEvent
import org.eclipse.swt.widgets.Display; //导入方法依赖的package包/类
protected final void fireChangeEvent ( final Collection<?> changes )
{
final LabelProviderChangedEvent event = new LabelProviderChangedEvent ( ViewerLabelProvider.this, changes.toArray () );
final ILabelProviderListener[] listenerArray = ViewerLabelProvider.this.listeners.toArray ( new ILabelProviderListener[ViewerLabelProvider.this.listeners.size ()] );
final Display display = getDisplay ();
if ( !display.isDisposed () )
{
display.asyncExec ( new Runnable () {
public void run ()
{
for ( final ILabelProviderListener listener : listenerArray )
{
try
{
listener.labelProviderChanged ( event );
}
catch ( final Exception e )
{
Policy.getLog ().log ( new Status ( IStatus.ERROR, Policy.JFACE_DATABINDING, e.getLocalizedMessage (), e ) );
}
}
}
} );
}
}
示例8: slow
import org.eclipse.swt.widgets.Display; //导入方法依赖的package包/类
public static void slow(SWTAsync t) {
t.logTimeStats = false;
if (inDisplayThread()) {
t.run();
} else {
Display d2 = Application.display;
d2.asyncExec(t);
}
}
示例9: ConfirmationDialogFuture
import org.eclipse.swt.widgets.Display; //导入方法依赖的package包/类
public ConfirmationDialogFuture ( final Display display, final Shell parentShell, final Callback[] callbacks, final String dialogTitle )
{
display.asyncExec ( new Runnable () {
@Override
public void run ()
{
openDialog ( display, parentShell, callbacks, dialogTitle );
}
} );
}
示例10: setTextLabel
import org.eclipse.swt.widgets.Display; //导入方法依赖的package包/类
public void setTextLabel(String text) {
final Display display = getParentShell().getDisplay();
final String labelText = text;
display.asyncExec(new Runnable() {
public void run() {
if (!labelProgression.isDisposed())
labelProgression.setText(labelText);
}
});
}
示例11: run
import org.eclipse.swt.widgets.Display; //导入方法依赖的package包/类
public static void run(Display d, SWTAsync t) {
if (inDisplayThread()) {
t.run();
} else {
d.asyncExec(t);
}
}
示例12: resolvedAction
import org.eclipse.swt.widgets.Display; //导入方法依赖的package包/类
private Consumer<QuickAccessElement> resolvedAction(Display display, PersistedWorkingSet<QuickAccessElement> historyStore) {
return (item) -> {
display.asyncExec(item::execute);
historyStore.addToHistory(item);
historyStore.save();
};
}
示例13: exec
import org.eclipse.swt.widgets.Display; //导入方法依赖的package包/类
public static void exec(Display d, Runnable r) {
try {
d.asyncExec(r);
} catch (SWTException ex) {
if (ex.code != SWT.ERROR_WIDGET_DISPOSED) {
throw ex;
}
// do nothing: UI is already dead
}
}
示例14: openChat
import org.eclipse.swt.widgets.Display; //导入方法依赖的package包/类
@Override
public void
openChat(
final ChatInstance chat )
{
final Display display = Display.getDefault();
if ( display.isDisposed()){
return;
}
display.asyncExec(
new Runnable()
{
@Override
public void
run()
{
if ( display.isDisposed()){
return;
}
BuddyPluginViewBetaChat.createChatWindow( BuddyPluginView.this, plugin, chat );
}
});
}
示例15: subInvoke
import org.eclipse.swt.widgets.Display; //导入方法依赖的package包/类
@Override
protected Object subInvoke(Object proxy, Method method, Object[] args) throws Throwable {
Display currentDisplay = Display.getCurrent();
Display widgetDisplay = null;
Widget widget = getWidget();
if (widget != null) {
if (widget.isDisposed()) {
// System.err.println("ERROR: Invoking: " + method.getName() + " on Widget: " + widget +
// " which is disposed.");
return null;
}
widgetDisplay = widget.getDisplay();
}
if (currentDisplay == null && widgetDisplay == null) {
// The current thread is not a UI thread but no widget display was provided so...
return baseInvoke(proxy, method, args);
}
else if (currentDisplay != null && (widgetDisplay == null || currentDisplay == widgetDisplay)) {
// Current thread is the widget's UI thread (or at least *a* UI thread).
return baseInvoke(proxy, method, args);
}
else {
// Current thread is not the widget's UI thread.
IBaseInvokeRunnable runnable = createBaseInvokeRunnable(proxy, method, args);
if (isAsync()) {
widgetDisplay.asyncExec(runnable);
return null;
}
widgetDisplay.syncExec(runnable);
Throwable error = runnable.getError();
if (error != null) {
throw error;
}
return runnable.getResult();
}
}