if ( targetObj == null || transferData == null ) return CONTAIN_NO;  if ( transferData instanceof StructuredSelection ) { return handleValidateTargetCanContain( targetObj, ( (StructuredSelection) transferData ).toArray( ), validateContainer ); } else if ( transferData instanceof Object[] ) { Object[] array = (Object[]) transferData; if ( array.length == 1 ) { return handleValidateTargetCanContain( targetObj, array[0], validateContainer ); } int canContainAll = CONTAIN_NO; for ( int i = 0; i < array.length; i++ ) { int canContain = handleValidateTargetCanContain( targetObj, array[i], validateContainer ); if ( i == 0 ) { canContainAll = canContain; } if ( canContain == CONTAIN_NO || canContain != canContainAll ) { return CONTAIN_NO; } } return canContainAll; } else {  if ( transferData instanceof DesignElementHandle ) { return handleValidateTargetCanContainByContainer( targetObj, (DesignElementHandle) transferData, validateContainer ); } else if ( transferData instanceof ColumnBandData ) { if ( targetObj instanceof ColumnHandle ) { return handleValidateContainColumnPaste( (ColumnHandle) targetObj, (ColumnBandData) transferData, false ) ? CONTAIN_PARENT : CONTAIN_NO; } return CONTAIN_NO; } else if ( transferData instanceof IDesignElement ) { DesignElementHandle childHandle = ( (IDesignElement) transferData ) .getHandle( SessionHandleAdapter.getInstance( ) .getReportDesignHandle( ).getModule( ) ); return handleValidateTargetCanContainByContainer( targetObj, childHandle, validateContainer ); } else if ( transferData instanceof SlotHandle ) { SlotHandle slot = (SlotHandle) transferData; Object[] childHandles = slot.getContents( ).toArray( ); return handleValidateTargetCanContainByContainer( targetObj, childHandles, validateContainer ); } else if ( transferData instanceof IStructure ) { return handleValidateTargetCanContainStructure( targetObj, (IStructure) transferData ) ? CONTAIN_THIS : CONTAIN_NO; } else if ( transferData instanceof EmbeddedImageHandle ) { return targetObj instanceof EmbeddedImageNode ? CONTAIN_THIS : CONTAIN_NO; } else { return CONTAIN_NO; } }
return handleValidateTargetCanContain( targetObj, transferData, true ) != CONTAIN_NO;
	public static int handleValidateTargetCanContain( Object targetObj,			Object transferData, boolean validateContainer )	{		if ( targetObj == null || transferData == null )			return CONTAIN_NO;		if ( transferData instanceof StructuredSelection )		{			return handleValidateTargetCanContain( targetObj,					( (StructuredSelection) transferData ).toArray( ),					validateContainer );		}		else if ( transferData instanceof Object[] )		{			Object[] array = (Object[]) transferData;			if ( array.length == 1 )			{				return handleValidateTargetCanContain( targetObj, array[0],						validateContainer );			}			int canContainAll = CONTAIN_NO;			for ( int i = 0; i < array.length; i++ )			{				int canContain = handleValidateTargetCanContain( targetObj,						array[i], validateContainer );				if ( i == 0 )				{					canContainAll = canContain;				}				if ( canContain == CONTAIN_NO || canContain != canContainAll )				{					return CONTAIN_NO;				}			}			return canContainAll;		}		else		{			// Gets handle to test if can contain			if ( transferData instanceof DesignElementHandle )			{				return handleValidateTargetCanContainByContainer( targetObj,						(DesignElementHandle) transferData, validateContainer );			}			else if ( transferData instanceof ColumnBandData )			{				if ( targetObj instanceof ColumnHandle )				{					return handleValidateContainColumnPaste(							(ColumnHandle) targetObj,							(ColumnBandData) transferData, false )							? CONTAIN_PARENT							: CONTAIN_NO;				}				return CONTAIN_NO;			}			else if ( transferData instanceof IDesignElement )			{				DesignElementHandle childHandle = ( (IDesignElement) transferData )						.getHandle( SessionHandleAdapter.getInstance( )								.getReportDesignHandle( ).getModule( ) );				return handleValidateTargetCanContainByContainer( targetObj,						childHandle, validateContainer );			}			else if ( transferData instanceof SlotHandle )			{				SlotHandle slot = (SlotHandle) transferData;				Object[] childHandles = slot.getContents( ).toArray( );				return handleValidateTargetCanContainByContainer( targetObj,						childHandles, validateContainer );			}			else if ( transferData instanceof IStructure )			{				return handleValidateTargetCanContainStructure( targetObj,						(IStructure) transferData ) ? CONTAIN_THIS : CONTAIN_NO;			}			else if ( transferData instanceof EmbeddedImageHandle )			{				return targetObj instanceof EmbeddedImageNode						? CONTAIN_THIS						: CONTAIN_NO;			}			else			{				return CONTAIN_NO;			}		}	}