KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > debug > ui > snippeteditor > JavaSnippetViewerConfiguration


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11
12 package org.eclipse.jdt.internal.debug.ui.snippeteditor;
13
14
15 import org.eclipse.jdt.internal.debug.ui.JDIContentAssistPreference;
16 import org.eclipse.jdt.ui.text.JavaSourceViewerConfiguration;
17 import org.eclipse.jdt.ui.text.JavaTextTools;
18 import org.eclipse.jface.preference.IPreferenceStore;
19 import org.eclipse.jface.text.IDocument;
20 import org.eclipse.jface.text.contentassist.ContentAssistant;
21 import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
22 import org.eclipse.jface.text.contentassist.IContentAssistant;
23 import org.eclipse.jface.text.reconciler.IReconciler;
24 import org.eclipse.jface.text.source.ISourceViewer;
25
26 /**
27  * The source viewer configuration for the Java snippet editor.
28  */

29 public class JavaSnippetViewerConfiguration extends JavaSourceViewerConfiguration {
30     
31     public JavaSnippetViewerConfiguration(JavaTextTools tools, IPreferenceStore preferenceStore, JavaSnippetEditor editor) {
32         super(tools.getColorManager(), preferenceStore, editor, null);
33     }
34     
35     /**
36      * @see JDIViewerConfiguration#getContentAssistantProcessor()
37      */

38     public IContentAssistProcessor getContentAssistantProcessor() {
39         return new JavaSnippetCompletionProcessor((JavaSnippetEditor)getEditor());
40     }
41     
42     /**
43      * @see SourceViewerConfiguration#getContentAssistant(ISourceViewer)
44      */

45     public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
46
47         ContentAssistant assistant = new ContentAssistant();
48         assistant.setContentAssistProcessor(
49             getContentAssistantProcessor(),
50             IDocument.DEFAULT_CONTENT_TYPE);
51
52         JDIContentAssistPreference.configure(assistant, getColorManager());
53
54         assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
55         assistant.setInformationControlCreator(
56             getInformationControlCreator(sourceViewer));
57
58         return assistant;
59     }
60     
61     /* (non-Javadoc)
62      * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getReconciler(org.eclipse.jface.text.source.ISourceViewer)
63      */

64     public IReconciler getReconciler(ISourceViewer sourceViewer) {
65         return null;
66     }
67 }
68
Popular Tags