Java Code Examples for org.eclipse.swt.SWT#ERROR_WIDGET_DISPOSED

The following examples show how to use org.eclipse.swt.SWT#ERROR_WIDGET_DISPOSED . 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: ProgressDialogEx.java    From SWET with MIT License 5 votes vote down vote up
private void async(Runnable callback) {
	if (disposed)
		throw new SWTException(SWT.ERROR_WIDGET_DISPOSED);
	display.asyncExec(() -> {
		if (progressTitle.isDisposed() || progressBar.isDisposed())
			return;
		callback.run();
	});
}
 
Example 2
Source File: ModelViewController.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected void disposeController() {
	if (getView() != null) {
		try {
			getView().dispose();
		} catch (SWTException e) {
			if( e.code != SWT.ERROR_WIDGET_DISPOSED ) {
				throw e;
			}
		}
	}

	super.disposeController();
}
 
Example 3
Source File: ManageableTableTreeEx.java    From SWET with MIT License 4 votes vote down vote up
public Display getDisplay() {
	TableTree parent = this.parent;
	if (parent == null)
		throw new SWTError(SWT.ERROR_WIDGET_DISPOSED);
	return parent.getDisplay();
}
 
Example 4
Source File: DefaultDataSetWizard.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public boolean performFinish( )
{
	if ( !canFinish( ) )
		return false;

	if ( useTransaction )
	{
		// Start the transaction
		Utility.getCommandStack( ).startTrans( CREATE_DATA_SET_TRANS_NAME );
	}
	dataSetHandle = dataSetPage.createSelectedDataSet( );

	if ( dataSetHandle != null )
	{
		if ( dataSetHandle instanceof ScriptDataSetHandle )
		{
			columnDefPage.saveResult( dataSetHandle );
		}
		//If we are using transactions
		//commit it
		if ( useTransaction )
		{
			Utility.getCommandStack( ).commit( );
		}
		try
		{
			createSelectedDataSetTearDown( dataSetHandle );
			DataSetUIUtil.updateColumnCache( dataSetHandle, false );
		}
		catch ( Exception e )
		{
			if ( e instanceof SWTException )
			{
				SWTException swtException = (SWTException) e;
				if ( swtException.code == SWT.ERROR_WIDGET_DISPOSED )
					Utility.log( e );
			}
			
			Throwable cause = e.getCause( );
			if ( cause != null && ( cause instanceof org.eclipse.birt.data.engine.core.DataException ) )
			{
				Logger logger = Logger.getLogger( DefaultDataSetWizard.class.getName( ) );
				logger.log( Level.WARNING, e.getLocalizedMessage( ), e );
			}
			else
			{
				ExceptionHandler.handle( e );
			}
		}
	}
	else
	{
		//If we are using transactions
		//rollback it
		if ( useTransaction )
		{
			Utility.getCommandStack( ).rollback( );
		}
		return false;
	}
	return true;
}