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 ); } if ( editpart instanceof LabelEditPart ) { Object handle = ( (LabelEditPart) editpart ).getModel( ); if ( handle instanceof TextItemHandle ) { if ( ( (TextItemHandle) handle ).getContent( ) != null ) return; } else if ( handle instanceof DataItemHandle ) { if ( ( (DataItemHandle) handle ).getValueExpr( ) != null ) return; } else if ( handle instanceof LabelHandle ) { if ( ( (LabelHandle) handle ).getText( ) != null ) return; }  ( (LabelEditPart) editpart ).performDirectEdit( ); } 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( )			{				Object editpart = viewer.getEditPartRegistry( ).get( model );				if ( editpart instanceof EditPart )				{					viewer.flush( );					viewer.select( (EditPart) editpart );				}				if ( editpart instanceof LabelEditPart )				{					Object handle = ( (LabelEditPart) editpart ).getModel( );					if ( handle instanceof TextItemHandle )					{						if ( ( (TextItemHandle) handle ).getContent( ) != null )							return;					}					else if ( handle instanceof DataItemHandle )					{						if ( ( (DataItemHandle) handle ).getValueExpr( ) != null )							return;					}					else if ( handle instanceof LabelHandle )					{						if ( ( (LabelHandle) handle ).getText( ) != null )							return;					}					( (LabelEditPart) editpart ).performDirectEdit( );				}				if (editpart != null)				{					viewer.reveal( (EditPart) editpart );				}			}		} );	}