1 package net.sourceforge.phpeclipse.xml.ui.internal.preferences;
3 import net.sourceforge.phpeclipse.ui.PreferenceConstants;
4 import net.sourceforge.phpeclipse.ui.templates.template.BasicCompletionProcessor;
5 import net.sourceforge.phpeclipse.xml.ui.internal.text.XMLPartitionScanner;
7 //import org.eclipse.jface.preference.IPreferenceStore;
8 import org.eclipse.jface.text.contentassist.ContentAssistant;
9 import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
11 public class ContentAssistPreference {
12 /** Preference key for html content assist auto activation triggers */
13 private final static String AUTOACTIVATION_TRIGGERS_HTML = PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_HTML;
15 /** Preference key for alphabetic ordering of proposals */
16 private final static String ORDER_PROPOSALS = PreferenceConstants.CODEASSIST_ORDER_PROPOSALS;
18 // private static BasicCompletionProcessor getHTMLProcessor(
19 // ContentAssistant assistant) {
20 // IContentAssistProcessor p = assistant
21 // .getContentAssistProcessor(XMLPartitionScanner.XML_TAG);
22 // if (p instanceof BasicCompletionProcessor)
23 // return (BasicCompletionProcessor) p;
27 // private static void configureHTMLProcessor(ContentAssistant assistant,
28 // IPreferenceStore store) {
29 // BasicCompletionProcessor hcp = getHTMLProcessor(assistant);
33 // String triggers = store.getString(AUTOACTIVATION_TRIGGERS_HTML);
34 // if (triggers != null)
35 // hcp.setCompletionProposalAutoActivationCharacters(triggers
39 // // boolean enabled = store.getBoolean(CASE_SENSITIVITY);
40 // // jdcp.restrictProposalsToMatchingCases(enabled);
42 // enabled = store.getBoolean(ORDER_PROPOSALS);
43 // // hcp.orderProposalsAlphabetically(enabled);
46 // private static void changeHTMLProcessor(ContentAssistant assistant,
47 // IPreferenceStore store, String key) {
48 // BasicCompletionProcessor jdcp = getHTMLProcessor(assistant);
52 // if (AUTOACTIVATION_TRIGGERS_HTML.equals(key)) {
53 // String triggers = store.getString(AUTOACTIVATION_TRIGGERS_HTML);
54 // if (triggers != null)
55 // jdcp.setCompletionProposalAutoActivationCharacters(triggers
57 // // } else if (CASE_SENSITIVITY.equals(key)) {
58 // // boolean enabled = store.getBoolean(CASE_SENSITIVITY);
59 // // jdcp.restrictProposalsToMatchingCases(enabled);
60 // } else if (ORDER_PROPOSALS.equals(key)) {
61 // boolean enable = store.getBoolean(ORDER_PROPOSALS);
62 // // jdcp.orderProposalsAlphabetically(enable);