try { if ( UIUtil.includeLibrary( moduleHandle, library ) ) { EmbeddedImage image = StructureFactory.newEmbeddedImageFrom( (EmbeddedImageHandle) dragObj, moduleHandle ); DNDUtil.addEmbeddedImageHandle( getTargetEditPart( ).getModel( ), image ); } } catch ( Exception e ) { ExceptionHandler.handle( e ); }
	protected void handleDrop( )	{		boolean isScalarparameter = false;		boolean isResultSetColumn = false;		boolean isEmbeddImage = false;		final Object template = TemplateTransfer.getInstance( ).getTemplate( );		Assert.isNotNull( template );		Assert.isTrue( handleValidateDrag( template ) );		updateTargetRequest( );		updateTargetEditPart( );		AbstractToolHandleExtends preHandle = null;		String transName = null;		if ( template instanceof String )		{			transName = TRANS_LABEL_CREATE_ELEMENT;			preHandle = BasePaletteFactory.getAbstractToolHandleExtendsFromPaletteName( template );		}		else if ( handleValidateInsert( template ) )		{			transName = InsertInLayoutAction.DISPLAY_TEXT;			Object objectType = getFactory( template ).getObjectType( );			if ( objectType instanceof DataSetHandle )			{				preHandle = new DataSetToolExtends( );			}			else if ( objectType instanceof DataSetItemModel )			{				preHandle = new DataSetColumnToolExtends( );			}			else if ( objectType instanceof ResultSetColumnHandle )			{				isResultSetColumn = true;				preHandle = new DataSetColumnToolExtends( );			}			else if ( objectType instanceof ScalarParameterHandle )			{				isScalarparameter = true;				preHandle = new ParameterToolExtends( );			}		}		else if ( handleValidateLibrary( template ) )		{			Object dragObj = getSingleTransferData( template );			if ( dragObj instanceof EmbeddedImageHandle )			{				// Extend the EmbeddedImage from Library to ouline view				DNDUtil.copyHandles( dragObj, getTargetEditPart( ).getModel( ) );				isEmbeddImage = true;				preHandle = new ImageToolExtends( );			}			else				preHandle = new LibraryElementsToolHandleExtends( (DesignElementHandle) dragObj );		}		else if ( handleValidateOutline( template ) )		{			Object dragObj = getSingleTransferData( template );			if ( dragObj instanceof EmbeddedImageHandle )			{				isEmbeddImage = true;				preHandle = new ImageToolExtends( );			}		}		if ( preHandle != null )		{			SessionHandleAdapter.getInstance( )					.getReportDesignHandle( )					.getCommandStack( )					.startTrans( transName );			preHandle.setRequest( this.getCreateRequest( ) );			preHandle.setTargetEditPart( getTargetEditPart( ) );			Command command = this.getCommand( );			if ( command != null && command.canExecute( ) )			{				if ( !( preHandle.preHandleMouseUp( ) ) )				{					SessionHandleAdapter.getInstance( )							.getReportDesignHandle( )							.getCommandStack( )							.rollback( );					return;				}			}			boolean isTheme = checkTheme( preHandle,					getSingleTransferData( template ) );			if ( isTheme )			{				SessionHandleAdapter.getInstance( )						.getReportDesignHandle( )						.getCommandStack( )						.commit( );			}			else			{				super.handleDrop( );				// fix bugzilla#145284				if ( !preHandle.postHandleCreation( ) )				{					SessionHandleAdapter.getInstance( )							.getReportDesignHandle( )							.getCommandStack( )							.rollback( );					return;				}				SessionHandleAdapter.getInstance( )						.getReportDesignHandle( )						.getCommandStack( )						.commit( );				if ( isScalarparameter || isResultSetColumn )				{					Request request = new Request( ReportRequest.CREATE_SCALARPARAMETER_OR_RESULTSETCOLUMN );					selectAddedObject( request );				}				else if ( isEmbeddImage )				{					Object dragObj = getSingleTransferData( template );					final Object model = getCreateRequest( ).getExtendedData( )							.get( DesignerConstants.KEY_NEWOBJECT );					try					{						( (ImageHandle) model ).setImageName( ( (EmbeddedImageHandle) dragObj ).getName( ) );					}					catch ( SemanticException e )					{						ExceptionHandler.handle( e );					}					CommandStack stack = SessionHandleAdapter.getInstance( )							.getCommandStack( );					stack.startTrans( IMG_TRANS_MSG );					stack.commit( );				}				else					selectAddedObject( );			}		}	}