34ca88695a5be3d695f02f36e51a6f0bfe407e1d
[phpeclipse.git] /
1 /*
2  * Created on 25.08.2004
3  *
4  * TODO To change the template for this generated file go to
5  * Window - Preferences - Java - Code Style - Code Templates
6  */
7 package net.sourceforge.phpeclipse.html.ui.internal.text;
8
9 import net.sourceforge.phpeclipse.xml.ui.internal.text.XMLConfiguration;
10 import net.sourceforge.phpeclipse.xml.ui.internal.text.XMLPartitionScanner;
11 import net.sourceforge.phpeclipse.xml.ui.text.XMLTextTools;
12
13 import org.eclipse.jface.text.IDocument;
14 import org.eclipse.jface.text.contentassist.ContentAssistant;
15 import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
16 import org.eclipse.jface.text.contentassist.IContentAssistant;
17 import org.eclipse.jface.text.source.ISourceViewer;
18 import org.eclipse.ui.texteditor.ITextEditor;
19
20 /**
21  * @author khartlage
22  * 
23  * TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code Templates
24  */
25 public class HTMLConfiguration extends XMLConfiguration {
26   public HTMLConfiguration(XMLTextTools tools) {
27     this(tools, null);
28   }
29
30   public HTMLConfiguration(XMLTextTools tools, ITextEditor editor) {
31     super(tools, editor);
32   }
33
34   public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
35     ContentAssistant assistant = new ContentAssistant();
36     assistant.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
37
38     IContentAssistProcessor processor = new HTMLCompletionProcessor();
39     assistant.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE);
40     assistant.setContentAssistProcessor(processor, XMLPartitionScanner.XML_TAG);
41     assistant.setContentAssistProcessor(processor, XMLPartitionScanner.XML_PI);
42     assistant.setContentAssistProcessor(processor, XMLPartitionScanner.XML_COMMENT);
43     assistant.setContentAssistProcessor(processor, XMLPartitionScanner.XML_DECL);
44     assistant.setContentAssistProcessor(processor, XMLPartitionScanner.XML_TAG);
45     assistant.setContentAssistProcessor(processor, XMLPartitionScanner.XML_ATTRIBUTE);
46     assistant.setContentAssistProcessor(processor, XMLPartitionScanner.XML_CDATA);
47
48     assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
49     assistant.setInformationControlCreator(getInformationControlCreator(sourceViewer));
50
51     return assistant;
52   }
53 }