1 /*******************************************************************************
2 * Copyright (c) 2000, 2004 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package net.sourceforge.phpdt.internal.codeassist.impl;
15 import net.sourceforge.phpdt.core.compiler.CharOperation;
17 public class AssistOptions {
21 public static final String OPTION_PerformVisibilityCheck =
22 "net.sourceforge.phpdt.core.codeComplete.visibilityCheck"; //$NON-NLS-1$
23 public static final String OPTION_ForceImplicitQualification =
24 "net.sourceforge.phpdt.core.codeComplete.forceImplicitQualification"; //$NON-NLS-1$
25 public static final String OPTION_FieldPrefixes =
26 "net.sourceforge.phpdt.core.codeComplete.fieldPrefixes"; //$NON-NLS-1$
27 public static final String OPTION_StaticFieldPrefixes =
28 "net.sourceforge.phpdt.core.codeComplete.staticFieldPrefixes"; //$NON-NLS-1$
29 public static final String OPTION_LocalPrefixes =
30 "net.sourceforge.phpdt.core.codeComplete.localPrefixes"; //$NON-NLS-1$
31 public static final String OPTION_ArgumentPrefixes =
32 "net.sourceforge.phpdt.core.codeComplete.argumentPrefixes"; //$NON-NLS-1$
33 public static final String OPTION_FieldSuffixes =
34 "net.sourceforge.phpdt.core.codeComplete.fieldSuffixes"; //$NON-NLS-1$
35 public static final String OPTION_StaticFieldSuffixes =
36 "net.sourceforge.phpdt.core.codeComplete.staticFieldSuffixes"; //$NON-NLS-1$
37 public static final String OPTION_LocalSuffixes =
38 "net.sourceforge.phpdt.core.codeComplete.localSuffixes"; //$NON-NLS-1$
39 public static final String OPTION_ArgumentSuffixes =
40 "net.sourceforge.phpdt.core.codeComplete.argumentSuffixes"; //$NON-NLS-1$
41 public static final String ENABLED = "enabled"; //$NON-NLS-1$
42 public static final String DISABLED = "disabled"; //$NON-NLS-1$
44 public boolean checkVisibility = false;
45 public boolean forceImplicitQualification = false;
46 public char[][] fieldPrefixes = null;
47 public char[][] staticFieldPrefixes = null;
48 public char[][] localPrefixes = null;
49 public char[][] argumentPrefixes = null;
50 public char[][] fieldSuffixes = null;
51 public char[][] staticFieldSuffixes = null;
52 public char[][] localSuffixes = null;
53 public char[][] argumentSuffixes = null;
56 * Initializing the assist options with default settings
58 public AssistOptions() {
59 // Initializing the assist options with default settings
63 * Initializing the assist options with external settings
65 public AssistOptions(Map settings) {
71 public void set(Map optionsMap) {
74 if ((optionValue = optionsMap.get(OPTION_PerformVisibilityCheck)) != null) {
75 if (ENABLED.equals(optionValue)) {
76 this.checkVisibility = true;
77 } else if (DISABLED.equals(optionValue)) {
78 this.checkVisibility = false;
81 if ((optionValue = optionsMap.get(OPTION_ForceImplicitQualification)) != null) {
82 if (ENABLED.equals(optionValue)) {
83 this.forceImplicitQualification = true;
84 } else if (DISABLED.equals(optionValue)) {
85 this.forceImplicitQualification = false;
88 if ((optionValue = optionsMap.get(OPTION_FieldPrefixes)) != null) {
89 if (optionValue instanceof String) {
90 String stringValue = (String) optionValue;
91 if (stringValue.length() > 0){
92 this.fieldPrefixes = CharOperation.splitAndTrimOn(',', stringValue.toCharArray());
94 this.fieldPrefixes = null;
98 if ((optionValue = optionsMap.get(OPTION_StaticFieldPrefixes)) != null) {
99 if (optionValue instanceof String) {
100 String stringValue = (String) optionValue;
101 if (stringValue.length() > 0){
102 this.staticFieldPrefixes = CharOperation.splitAndTrimOn(',', stringValue.toCharArray());
104 this.staticFieldPrefixes = null;
108 if ((optionValue = optionsMap.get(OPTION_LocalPrefixes)) != null) {
109 if (optionValue instanceof String) {
110 String stringValue = (String) optionValue;
111 if (stringValue.length() > 0){
112 this.localPrefixes = CharOperation.splitAndTrimOn(',', stringValue.toCharArray());
114 this.localPrefixes = null;
118 if ((optionValue = optionsMap.get(OPTION_ArgumentPrefixes)) != null) {
119 if (optionValue instanceof String) {
120 String stringValue = (String) optionValue;
121 if (stringValue.length() > 0){
122 this.argumentPrefixes = CharOperation.splitAndTrimOn(',', stringValue.toCharArray());
124 this.argumentPrefixes = null;
128 if ((optionValue = optionsMap.get(OPTION_FieldSuffixes)) != null) {
129 if (optionValue instanceof String) {
130 String stringValue = (String) optionValue;
131 if (stringValue.length() > 0){
132 this.fieldSuffixes = CharOperation.splitAndTrimOn(',', stringValue.toCharArray());
134 this.fieldSuffixes = null;
138 if ((optionValue = optionsMap.get(OPTION_StaticFieldSuffixes)) != null) {
139 if (optionValue instanceof String) {
140 String stringValue = (String) optionValue;
141 if (stringValue.length() > 0){
142 this.staticFieldSuffixes = CharOperation.splitAndTrimOn(',', stringValue.toCharArray());
144 this.staticFieldSuffixes = null;
148 if ((optionValue = optionsMap.get(OPTION_LocalSuffixes)) != null) {
149 if (optionValue instanceof String) {
150 String stringValue = (String) optionValue;
151 if (stringValue.length() > 0){
152 this.localSuffixes = CharOperation.splitAndTrimOn(',', stringValue.toCharArray());
154 this.localSuffixes = null;
158 if ((optionValue = optionsMap.get(OPTION_ArgumentSuffixes)) != null) {
159 if (optionValue instanceof String) {
160 String stringValue = (String) optionValue;
161 if (stringValue.length() > 0){
162 this.argumentSuffixes = CharOperation.splitAndTrimOn(',', stringValue.toCharArray());
164 this.argumentSuffixes = null;