01: package org.drools.eclipse.dsl.editor;
02:
03: import org.drools.eclipse.dsl.editor.completion.DSLRuleCompletionProcessor;
04: import org.drools.eclipse.editors.DRLSourceViewerConfig;
05: import org.drools.eclipse.editors.completion.DefaultCompletionProcessor;
06: import org.drools.eclipse.editors.scanners.DRLPartionScanner;
07: import org.eclipse.jface.text.IDocument;
08: import org.eclipse.jface.text.contentassist.ContentAssistant;
09: import org.eclipse.jface.text.contentassist.IContentAssistant;
10: import org.eclipse.jface.text.source.ISourceViewer;
11:
12: /**
13: * Source viewer config wires up the syntax highlighting, partitioning
14: * and content assistance.
15: *
16: * @author Michael Neale
17: *
18: */
19: public class DSLRuleSourceViewerConfig extends DRLSourceViewerConfig {
20:
21: public DSLRuleSourceViewerConfig(DSLRuleEditor editor) {
22: super (editor);
23: }
24:
25: /**
26: * Get the appropriate content assistance, for each partition.
27: */
28: public IContentAssistant getContentAssistant(
29: ISourceViewer sourceViewer) {
30: ContentAssistant assistant = new ContentAssistant();
31: assistant.setContentAssistProcessor(
32: new DefaultCompletionProcessor(getEditor()),
33: IDocument.DEFAULT_CONTENT_TYPE);
34: assistant.setContentAssistProcessor(
35: new DSLRuleCompletionProcessor(getEditor()),
36: DRLPartionScanner.RULE_PART_CONTENT);
37: assistant
38: .setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
39: assistant.setAutoActivationDelay(0);
40: return assistant;
41: }
42: }
|