if ( model == null || viewer == null ) return;  Display.getCurrent( ).asyncExec( new Runnable( ) {  public void run( ) {  Object editpart = viewer.getEditPartRegistry( ).get( model );  if ( editpart instanceof EditPart ) { viewer.flush( ); viewer.select( (EditPart) editpart ); } else { return; } Request request = new Request( ReportRequest.CREATE_ELEMENT ); if ( ( (EditPart) editpart ).understandsRequest( request ) ) { ( (EditPart) editpart ).performRequest( request ); } if ( editpart != null ) { viewer.reveal( (EditPart) editpart ); } } } );
final Object model = getNewObjectFromRequest( ); final EditPartViewer viewer = getCurrentViewer( ); selectAddedObject( model, viewer );
	public static void selectAddedObject( final Object model,			final EditPartViewer viewer )	{		if ( model == null || viewer == null )			return;		Display.getCurrent( ).asyncExec( new Runnable( ) {			public void run( )			{				// modify				Object editpart = viewer.getEditPartRegistry( ).get( model );				if ( editpart instanceof EditPart )				{					viewer.flush( );					viewer.select( (EditPart) editpart );				}				else				{					return;				}				Request request = new Request( ReportRequest.CREATE_ELEMENT );				if ( ( (EditPart) editpart ).understandsRequest( request ) )				{					( (EditPart) editpart ).performRequest( request );				}				if ( editpart != null )				{					viewer.reveal( (EditPart) editpart );				}			}		} );	}