本文整理汇总了Java中org.eclipse.swt.widgets.Display.syncExec方法的典型用法代码示例。如果您正苦于以下问题:Java Display.syncExec方法的具体用法?Java Display.syncExec怎么用?Java Display.syncExec使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.Display
的用法示例。
在下文中一共展示了Display.syncExec方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: stop
import org.eclipse.swt.widgets.Display; //导入方法依赖的package包/类
@Override
public void stop ()
{
if ( !PlatformUI.isWorkbenchRunning () )
{
return;
}
final IWorkbench workbench = PlatformUI.getWorkbench ();
final Display display = workbench.getDisplay ();
display.syncExec ( new Runnable () {
@Override
public void run ()
{
if ( !display.isDisposed () )
{
workbench.close ();
}
}
} );
}
示例2: 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);
}
}
示例3: stop
import org.eclipse.swt.widgets.Display; //导入方法依赖的package包/类
@Override
public void stop() {
final IWorkbench workbench = PlatformUI.getWorkbench();
if (workbench == null)
return;
final Display display = workbench.getDisplay();
display.syncExec(new Runnable() {
@Override
public void run() {
if (!display.isDisposed())
workbench.close();
}
});
}
示例4: stop
import org.eclipse.swt.widgets.Display; //导入方法依赖的package包/类
public void stop() {
if (!PlatformUI.isWorkbenchRunning())
return;
final IWorkbench workbench = PlatformUI.getWorkbench();
final Display display = workbench.getDisplay();
display.syncExec(new Runnable() {
public void run() {
if (!display.isDisposed())
workbench.close();
}
});
}
示例5: loadAncestor
import org.eclipse.swt.widgets.Display; //导入方法依赖的package包/类
private void loadAncestor(IFile file) {
Display display = Display.getCurrent();
Runnable longJob = new Runnable() {
public void run() {
display.syncExec(new Runnable() {
public void run() {
ancestors = JDTManager.findAvailableExecutionContextAncestors(file);
}
});
display.wake();
}
};
BusyIndicator.showWhile(display, longJob);
}
示例6: loadVertices
import org.eclipse.swt.widgets.Display; //导入方法依赖的package包/类
/**
*
*/
private void loadVertices() {
Display display = Display.getCurrent();
Runnable longJob = new Runnable() {
public void run() {
display.syncExec(new Runnable() {
public void run() {
IFile ifile = ResourceManager.toIFile(selection);
String modelFileName = null;
try {
modelFileName = ResourceManager.getAbsolutePath(ifile);
context = GraphWalkerFacade.getContext(modelFileName);
updateUI();
} catch (Exception e) {
ResourceManager.logException(e);
JUnitGW4ETestUIPage.this.setErrorMessage(
"Unable to load the graph model. See error logs in the Error View.");
return;
}
comboReachedVertexViewer.setInput(_loadVertices(context));
}
});
display.wake();
}
};
BusyIndicator.showWhile(display, longJob);
}
示例7: loadAncestor
import org.eclipse.swt.widgets.Display; //导入方法依赖的package包/类
private void loadAncestor(IFile file) {
Display display = Display.getCurrent();
Runnable longJob = new Runnable() {
public void run() {
display.syncExec(new Runnable() {
public void run() {
ancestors = JDTManager.findAvailableExecutionContextAncestors(file);
}
});
display.wake();
}
};
BusyIndicator.showWhile(display, longJob);
}
示例8: loadBuildPolicies
import org.eclipse.swt.widgets.Display; //导入方法依赖的package包/类
/**
*
*/
public void loadBuildPolicies() {
Display display = Display.getCurrent();
Runnable longJob = new Runnable() {
public void run() {
display.syncExec(new Runnable() {
public void run() {
List<BuildPolicy> policies;
try {
if (file!=null) {
policies = BuildPolicyManager.getBuildPolicies(file, false);
} else {
policies = new ArrayList<BuildPolicy>();
}
} catch (Exception e) {
// DialogManager.displayErrorMessage(MessageUtil.getString("error"), e.getMessage(),e);
// throw new RuntimeException(e);
policies = new ArrayList<BuildPolicy>();
}
BuildPolicy[] input = policies.stream().filter(item -> !item.hasTimeDuratioStopCondition())
.toArray(BuildPolicy[]::new);
setInput(input);
}
});
display.wake();
}
};
BusyIndicator.showWhile(display, longJob);
}
示例9: getSWTImage
import org.eclipse.swt.widgets.Display; //导入方法依赖的package包/类
private Image getSWTImage() {
Shell shell = getShell();
final Display display;
if (shell == null || shell.isDisposed()) {
shell = getParentShell();
}
if (shell == null || shell.isDisposed()) {
display = Display.getCurrent();
// The dialog should be always instantiated in UI thread.
// However it was possible to instantiate it in other threads
// (the code worked in most cases) so the assertion covers
// only the failing scenario. See bug 107082 for details.
Assert.isNotNull(display,
"The dialog should be created in UI thread"); //$NON-NLS-1$
} else {
display = shell.getDisplay();
}
final Image[] image = new Image[1];
display.syncExec(new Runnable() {
public void run() {
image[0] = display.getSystemImage(SWT.ICON_QUESTION);
}
});
return image[0];
}
示例10: 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();
}
}
示例11: sync
import org.eclipse.swt.widgets.Display; //导入方法依赖的package包/类
public static void sync(@Nullable Display display, Runnable task) {
if(display == null) display = getDisplay(); display.syncExec(task);
}
示例12: ShellSlider
import org.eclipse.swt.widgets.Display; //导入方法依赖的package包/类
/**
* Slide In
*
* @param shell
* @param direction
* @param endBounds
*/
public ShellSlider(final Shell shell, int direction, final Rectangle endBounds) {
this.shell = shell;
this.endBounds = endBounds;
this.slideIn = true;
this.direction = direction;
if (shell == null || shell.isDisposed())
return;
Display display = shell.getDisplay();
display.syncExec(new Runnable() {
@Override
public void run() {
if (shell.isDisposed())
return;
switch (ShellSlider.this.direction) {
case SWT.UP:
default:
shell.setLocation(endBounds.x, endBounds.y);
Rectangle displayBounds = null;
try {
boolean ok = false;
Monitor[] monitors = shell.getDisplay().getMonitors();
for (int i = 0; i < monitors.length; i++) {
Monitor monitor = monitors[i];
displayBounds = monitor.getBounds();
if (displayBounds.contains(endBounds.x, endBounds.y)) {
ok = true;
break;
}
}
if (!ok) {
displayBounds = shell.getMonitor().getBounds();
}
} catch (Throwable t) {
displayBounds = shell.getDisplay().getBounds();
}
shellBounds = new Rectangle(endBounds.x, displayBounds.y
+ displayBounds.height, endBounds.width, 0);
break;
}
shell.setBounds(shellBounds);
shell.setVisible(true);
if (DEBUG)
System.out.println("Slide In: " + shell.getText());
}
});
}