if ( input instanceof IPathEditorInput ) { IPath path = ( (IPathEditorInput) input ).getPath( ); try { if ( path.toOSString( ) .endsWith( IReportEditorContants.LIBRARY_FILE_EXTENTION ) ) { validModel = ModuleUtil.isValidLibrary( SessionHandleAdapter.getInstance( ) .getSessionHandle( ), path.toOSString( ), new FileInputStream( new File( path.toOSString( ) ) ) ); } else { validModel = ModuleUtil.isValidDesign( SessionHandleAdapter.getInstance( ) .getSessionHandle( ), path.toOSString( ), new FileInputStream( new File( path.toOSString( ) ) ) );
	public boolean canLeaveThePage( )	{		if ( isDirty( ) )		{			MessageDialog prefDialog = new MessageDialog( UIUtil.getDefaultShell( ),					Messages.getString( "XMLSourcePage.Error.Dialog.title" ),//$NON-NLS-1$					null,					Messages.getString( "XMLSourcePage.Error.Dialog.Message.PromptMsg" ),//$NON-NLS-1$					MessageDialog.INFORMATION,					new String[]{							Messages.getString( "XMLSourcePage.Error.Dialog.Message.Yes" ),//$NON-NLS-1$							Messages.getString( "XMLSourcePage.Error.Dialog.Message.No" ),//$NON-NLS-1$							Messages.getString( "XMLSourcePage.Error.Dialog.Message.Cancel" )}, 0 );//$NON-NLS-1$			int ret = prefDialog.open( );			switch ( ret )			{				case 0 :					doSave( null );					break;				case 1 :					if ( getEditorInput( ) != null )					{						this.setInput( getEditorInput( ) );					}					break;				case 2 :					return false;			}		}		IEditorInput input = getEditorInput( );		boolean validModel = false;		if ( input instanceof IPathEditorInput )		{			IPath path = ( (IPathEditorInput) input ).getPath( );			try			{				if ( path.toOSString( )						.endsWith( IReportEditorContants.LIBRARY_FILE_EXTENTION ) )				{					validModel = ModuleUtil.isValidLibrary( SessionHandleAdapter.getInstance( )							.getSessionHandle( ),							path.toOSString( ),							new FileInputStream( new File( path.toOSString( ) ) ) );				}				else				{					validModel = ModuleUtil.isValidDesign( SessionHandleAdapter.getInstance( )							.getSessionHandle( ),							path.toOSString( ),							new FileInputStream( new File( path.toOSString( ) ) ) );				}			}			catch ( FileNotFoundException e )			{				ExceptionHandler.handle( e );			}		}		if ( !validModel )		{			Display.getCurrent( ).beep( );			MessageDialog.openError( Display.getCurrent( ).getActiveShell( ),					Messages.getString( "XMLSourcePage.Error.Dialog.title" ), //$NON-NLS-1$					Messages.getString( "XMLSourcePage.Error.Dialog.Message.InvalidFile" ) ); //$NON-NLS-1$			return false;		}		return true;	}