testdev/ite/src/com.nokia.testfw.stf.configeditor/src/com/nokia/testfw/stf/configeditor/editors/ConfigSourceEditorConfiguration.java
changeset 1 96906a986c3b
equal deleted inserted replaced
0:f1112f777ce9 1:96906a986c3b
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 package com.nokia.testfw.stf.configeditor.editors;
       
    20 
       
    21 import org.eclipse.jface.text.IDocument;
       
    22 import org.eclipse.jface.text.contentassist.ContentAssistant;
       
    23 import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
       
    24 import org.eclipse.jface.text.contentassist.IContentAssistant;
       
    25 import org.eclipse.jface.text.presentation.IPresentationReconciler;
       
    26 import org.eclipse.jface.text.presentation.PresentationReconciler;
       
    27 import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
       
    28 import org.eclipse.jface.text.source.ISourceViewer;
       
    29 import org.eclipse.jface.text.source.SourceViewerConfiguration;
       
    30 
       
    31 /**
       
    32  * Config source editor configuration
       
    33  * 
       
    34  */
       
    35 public class ConfigSourceEditorConfiguration extends SourceViewerConfiguration {
       
    36     /* (non-Javadoc)
       
    37      * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getPresentationReconciler(org.eclipse.jface.text.source.ISourceViewer)
       
    38      */
       
    39     public IPresentationReconciler getPresentationReconciler( ISourceViewer sourceViewer ) {
       
    40 		PresentationReconciler pr = new PresentationReconciler();
       
    41 		DefaultDamagerRepairer ddr = new DefaultDamagerRepairer( new ConfigSourceScaner() );
       
    42 		pr.setRepairer(ddr, IDocument.DEFAULT_CONTENT_TYPE);
       
    43 		pr.setDamager(ddr, IDocument.DEFAULT_CONTENT_TYPE);
       
    44 		return pr;
       
    45     }
       
    46     
       
    47     /* (non-Javadoc)
       
    48      * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getContentAssistant(org.eclipse.jface.text.source.ISourceViewer)
       
    49      */
       
    50     public IContentAssistant getContentAssistant( ISourceViewer sourceViewer ) {
       
    51 		ContentAssistant contentAssistant = new ContentAssistant();
       
    52 		
       
    53 
       
    54 		IContentAssistProcessor contentAssistProcessor = new ConfigSourceEditorContentAssistProcessor();
       
    55 		contentAssistant.setContentAssistProcessor( contentAssistProcessor, IDocument.DEFAULT_CONTENT_TYPE);
       
    56 		contentAssistant.setInformationControlCreator(getInformationControlCreator( sourceViewer ));
       
    57 		contentAssistant.enableAutoActivation(true);
       
    58 		contentAssistant.setAutoActivationDelay(500);
       
    59 		
       
    60 		return contentAssistant;
       
    61     }
       
    62 }