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 = "net.sourceforge.phpdt.core.codeComplete.visibilityCheck"; //$NON-NLS-1$
23 public static final String OPTION_ForceImplicitQualification = "net.sourceforge.phpdt.core.codeComplete.forceImplicitQualification"; //$NON-NLS-1$
25 public static final String OPTION_FieldPrefixes = "net.sourceforge.phpdt.core.codeComplete.fieldPrefixes"; //$NON-NLS-1$
27 public static final String OPTION_StaticFieldPrefixes = "net.sourceforge.phpdt.core.codeComplete.staticFieldPrefixes"; //$NON-NLS-1$
29 public static final String OPTION_LocalPrefixes = "net.sourceforge.phpdt.core.codeComplete.localPrefixes"; //$NON-NLS-1$
31 public static final String OPTION_ArgumentPrefixes = "net.sourceforge.phpdt.core.codeComplete.argumentPrefixes"; //$NON-NLS-1$
33 public static final String OPTION_FieldSuffixes = "net.sourceforge.phpdt.core.codeComplete.fieldSuffixes"; //$NON-NLS-1$
35 public static final String OPTION_StaticFieldSuffixes = "net.sourceforge.phpdt.core.codeComplete.staticFieldSuffixes"; //$NON-NLS-1$
37 public static final String OPTION_LocalSuffixes = "net.sourceforge.phpdt.core.codeComplete.localSuffixes"; //$NON-NLS-1$
39 public static final String OPTION_ArgumentSuffixes = "net.sourceforge.phpdt.core.codeComplete.argumentSuffixes"; //$NON-NLS-1$
41 public static final String ENABLED = "enabled"; //$NON-NLS-1$
43 public static final String DISABLED = "disabled"; //$NON-NLS-1$
45 public boolean checkVisibility = false;
47 public boolean forceImplicitQualification = false;
49 public char[][] fieldPrefixes = null;
51 public char[][] staticFieldPrefixes = null;
53 public char[][] localPrefixes = null;
55 public char[][] argumentPrefixes = null;
57 public char[][] fieldSuffixes = null;
59 public char[][] staticFieldSuffixes = null;
61 public char[][] localSuffixes = null;
63 public char[][] argumentSuffixes = null;
66 * Initializing the assist options with default settings
68 public AssistOptions() {
69 // Initializing the assist options with default settings
73 * Initializing the assist options with external settings
75 public AssistOptions(Map settings) {
82 public void set(Map optionsMap) {
85 if ((optionValue = optionsMap.get(OPTION_PerformVisibilityCheck)) != null) {
86 if (ENABLED.equals(optionValue)) {
87 this.checkVisibility = true;
88 } else if (DISABLED.equals(optionValue)) {
89 this.checkVisibility = false;
92 if ((optionValue = optionsMap.get(OPTION_ForceImplicitQualification)) != null) {
93 if (ENABLED.equals(optionValue)) {
94 this.forceImplicitQualification = true;
95 } else if (DISABLED.equals(optionValue)) {
96 this.forceImplicitQualification = false;
99 if ((optionValue = optionsMap.get(OPTION_FieldPrefixes)) != null) {
100 if (optionValue instanceof String) {
101 String stringValue = (String) optionValue;
102 if (stringValue.length() > 0) {
103 this.fieldPrefixes = CharOperation.splitAndTrimOn(',',
104 stringValue.toCharArray());
106 this.fieldPrefixes = null;
110 if ((optionValue = optionsMap.get(OPTION_StaticFieldPrefixes)) != null) {
111 if (optionValue instanceof String) {
112 String stringValue = (String) optionValue;
113 if (stringValue.length() > 0) {
114 this.staticFieldPrefixes = CharOperation.splitAndTrimOn(
115 ',', stringValue.toCharArray());
117 this.staticFieldPrefixes = null;
121 if ((optionValue = optionsMap.get(OPTION_LocalPrefixes)) != null) {
122 if (optionValue instanceof String) {
123 String stringValue = (String) optionValue;
124 if (stringValue.length() > 0) {
125 this.localPrefixes = CharOperation.splitAndTrimOn(',',
126 stringValue.toCharArray());
128 this.localPrefixes = null;
132 if ((optionValue = optionsMap.get(OPTION_ArgumentPrefixes)) != null) {
133 if (optionValue instanceof String) {
134 String stringValue = (String) optionValue;
135 if (stringValue.length() > 0) {
136 this.argumentPrefixes = CharOperation.splitAndTrimOn(',',
137 stringValue.toCharArray());
139 this.argumentPrefixes = null;
143 if ((optionValue = optionsMap.get(OPTION_FieldSuffixes)) != null) {
144 if (optionValue instanceof String) {
145 String stringValue = (String) optionValue;
146 if (stringValue.length() > 0) {
147 this.fieldSuffixes = CharOperation.splitAndTrimOn(',',
148 stringValue.toCharArray());
150 this.fieldSuffixes = null;
154 if ((optionValue = optionsMap.get(OPTION_StaticFieldSuffixes)) != null) {
155 if (optionValue instanceof String) {
156 String stringValue = (String) optionValue;
157 if (stringValue.length() > 0) {
158 this.staticFieldSuffixes = CharOperation.splitAndTrimOn(
159 ',', stringValue.toCharArray());
161 this.staticFieldSuffixes = null;
165 if ((optionValue = optionsMap.get(OPTION_LocalSuffixes)) != null) {
166 if (optionValue instanceof String) {
167 String stringValue = (String) optionValue;
168 if (stringValue.length() > 0) {
169 this.localSuffixes = CharOperation.splitAndTrimOn(',',
170 stringValue.toCharArray());
172 this.localSuffixes = null;
176 if ((optionValue = optionsMap.get(OPTION_ArgumentSuffixes)) != null) {
177 if (optionValue instanceof String) {
178 String stringValue = (String) optionValue;
179 if (stringValue.length() > 0) {
180 this.argumentSuffixes = CharOperation.splitAndTrimOn(',',
181 stringValue.toCharArray());
183 this.argumentSuffixes = null;