/*******************************************************************************
 * Copyright (c) 2005 Actuate Corporation. All rights reserved. This program and
 * the accompanying materials are made available under the terms of the Eclipse
 * Public License v1.0 which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors: Actuate Corporation - initial API and implementation
 ******************************************************************************/

package org.eclipse.birt.report.data.oda.jdbc.ui.editors;

import org.eclipse.datatools.connectivity.oda.design.DataSetDesign;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.contentassist.ContentAssistant;
import org.eclipse.jface.text.contentassist.IContentAssistant;
import org.eclipse.jface.text.source.ISourceViewer;

/**
 * TODO: Please document
 * 
 * @version $Revision: 1.4 $ $Date: 2006/03/28 10:43:48 $
 */

public class JdbcSQLSourceViewerConfiguration extends
		SQLSourceViewerConfiguration
{

	private transient DataSetDesign handle = null;
    private transient JdbcSQLContentAssistProcessor contentAssist = null;

	/**
	 *  
	 */
	public JdbcSQLSourceViewerConfiguration( DataSetDesign ds )
	{
		super( );
		handle = ds;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getContentAssistant(org.eclipse.jface.text.source.ISourceViewer)
	 */
	public IContentAssistant getContentAssistant( ISourceViewer sourceViewer )
	{
		ContentAssistant assistant = new ContentAssistant( );
        contentAssist = new JdbcSQLContentAssistProcessor( handle );
		assistant.setContentAssistProcessor( contentAssist,
				IDocument.DEFAULT_CONTENT_TYPE );
		assistant.enableAutoActivation( true );
		assistant.setAutoActivationDelay( 500 );
		assistant.setProposalPopupOrientation( IContentAssistant.PROPOSAL_OVERLAY );
		return assistant;
	}
    
    public JdbcSQLContentAssistProcessor getContentAssistProcessor()
    {
        return contentAssist;
    }

}