public void shellActivated( ShellEvent e ) { if ( !shellActiveFlag ) { shellActiveFlag = true; Display.getCurrent( ).asyncExec( new Runnable( ) { public void run( ) { if ( lastActiveShell == getSite( ).getShell( ) ) { // don't active the current active editor shellActiveFlag = false; return; } else { lastActiveShell = getSite( ).getShell( ); IEditorPart editor = UIUtil.getActiveEditor( true ); if ( editor instanceof IPartListener ) { // update the SessionHandleAdapter's model. // If old selection is dataset or datasource, // the selection status will lost. ( (IPartListener) editor ).partActivated( editor ); } shellActiveFlag = false; } } } ); } }