本文整理匯總了Java中org.eclipse.swt.widgets.Display.isDisposed方法的典型用法代碼示例。如果您正苦於以下問題:Java Display.isDisposed方法的具體用法?Java Display.isDisposed怎麽用?Java Display.isDisposed使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.Display
的用法示例。
在下文中一共展示了Display.isDisposed方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: runEventLoop
import org.eclipse.swt.widgets.Display; //導入方法依賴的package包/類
private void runEventLoop(Shell loopShell) {
Display display;
if (getShell() == null) {
display = Display.getCurrent();
} else {
display = loopShell.getDisplay();
}
while (loopShell != null && !loopShell.isDisposed()) {
try {
if (!display.readAndDispatch()) {
display.sleep();
}
} catch (Throwable e) {
EclipseUtil.logError("UI problems on dispatch",e);
}
}
if (!display.isDisposed()) {
display.update();
}
}
示例2: 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 );
}
}
} );
}
}
示例3: 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 );
}
}
} );
}
}
示例4: showError
import org.eclipse.swt.widgets.Display; //導入方法依賴的package包/類
private void showError ( final IStatus status )
{
if ( !status.matches ( IStatus.ERROR ) )
{
return;
}
final Display display = PlatformUI.getWorkbench ().getDisplay ();
if ( !display.isDisposed () )
{
display.asyncExec ( new Runnable () {
@Override
public void run ()
{
if ( !display.isDisposed () )
{
ErrorDialog.openError ( PlatformUI.getWorkbench ().getActiveWorkbenchWindow ().getShell (), "Connection error", "Connection failed", status, IStatus.ERROR );
}
}
} );
}
}
示例5: setStyle
import org.eclipse.swt.widgets.Display; //導入方法依賴的package包/類
@Override
public void setStyle ( final Style style )
{
final Display display = Display.getDefault ();
if ( display.isDisposed () )
{
return;
}
Display.getDefault ().asyncExec ( new Runnable () {
@Override
public void run ()
{
if ( display.isDisposed () )
{
return;
}
performSetStyle ( style );
}
} );
}
示例6: triggerDataUpdate
import org.eclipse.swt.widgets.Display; //導入方法依賴的package包/類
@Override
public void triggerDataUpdate ()
{
final Display display = getDisplay ();
if ( display.isDisposed () )
{
return;
}
getDisplay ().asyncExec ( new Runnable () {
@Override
public void run ()
{
if ( display.isDisposed () )
{
return;
}
updateState ();
}
} );
}
示例7: 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 );
}
}
} );
}
}
示例8: 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);
});
}
}
}
示例9: 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 ) );
}
}
}
} );
}
}
示例10: getInstance
import org.eclipse.swt.widgets.Display; //導入方法依賴的package包/類
public static KeyInstanceManager getInstance ( final Display display )
{
if ( display == null )
{
SWT.error ( SWT.ERROR_NULL_ARGUMENT );
}
if ( Display.getCurrent () != display )
{
SWT.error ( SWT.ERROR_THREAD_INVALID_ACCESS );
}
if ( display.isDisposed () )
{
SWT.error ( SWT.ERROR_DEVICE_DISPOSED );
}
KeyInstanceManager mgr = instanceMap.get ( display );
if ( mgr != null )
{
return mgr;
}
mgr = new KeyInstanceManager ( display );
instanceMap.put ( display, mgr );
display.disposeExec ( new Runnable () {
@Override
public void run ()
{
disposeDisplay ( display );
}
} );
return mgr;
}
示例11: checkDisplay
import org.eclipse.swt.widgets.Display; //導入方法依賴的package包/類
public static boolean checkDisplay(Observer<?> observer, Display display) {
if (null == display) {
observer.onError(new NullPointerException("The given widget was null"));
return false;
} else if (display.isDisposed()) {
observer.onError(new IllegalStateException("The given widget is diposed"));
return false;
} else if (!(Thread.currentThread().equals(display.getThread()))) {
observer.onError(new IllegalStateException(
"Expected to be called on the main thread but was " + Thread.currentThread().getName()));
return false;
}
return true;
}
示例12: 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 );
}
});
}
示例13: update
import org.eclipse.swt.widgets.Display; //導入方法依賴的package包/類
private void update(CopyOnWriteList<UIUpdatable> updateables, boolean is_visible ) {
long start = 0;
Map<UIUpdatable, Long> mapTimeMap = DEBUG_TIMER ? new HashMap<UIUpdatable, Long>() : null;
Display display = Utils.getDisplay();
if (display == null || display.isDisposed()) {
return;
}
for ( UIUpdatable updateable: updateables ){
try {
if (DEBUG_TIMER) {
start = SystemTime.getCurrentTime();
}
if ( updateable instanceof UIUpdatableAlways ){
((UIUpdatableAlways)updateable).updateUI(is_visible);
}else{
updateable.updateUI();
}
if (DEBUG_TIMER) {
long diff = SystemTime.getCurrentTime() - start;
if (diff > 0) {
mapTimeMap.put(updateable, new Long(diff));
}
}
} catch (Throwable t) {
Logger.log(new LogEvent(LOGID,
"Error while trying to update UI Element "
+ updateable.getUpdateUIName(), t));
}
}
if (DEBUG_TIMER) {
makeDebugToolTip(mapTimeMap);
}
}
示例14: selectNetworks
import org.eclipse.swt.widgets.Display; //導入方法依賴的package包/類
@Override
public String[]
selectNetworks(
final String description,
final String[] tracker_networks )
{
final Display display = Utils.getDisplay();
if ( display.isDisposed()){
return( null );
}
final AESemaphore sem = new AESemaphore("NetworkClassifier");
final classifierDialog[] dialog = new classifierDialog[1];
try{
Utils.execSWTThread(
new AERunnable()
{
@Override
public void
runSupport()
{
dialog[0] = new classifierDialog( sem, display, description, tracker_networks );
}
});
}catch( Throwable e ){
Debug.printStackTrace( e );
return( null );
}
sem.reserve();
return( dialog[0].getSelection());
}