Created a separated 'externaltools' plugin
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / codeassist / impl / AssistOptions.java
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
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package net.sourceforge.phpdt.internal.codeassist.impl;
12
13 import java.util.Map;
14
15 import net.sourceforge.phpdt.core.compiler.CharOperation;
16
17 public class AssistOptions {
18         /**
19          * Option IDs
20          */
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$
43
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;
54
55         /** 
56          * Initializing the assist options with default settings
57          */
58         public AssistOptions() {
59                 // Initializing the assist options with default settings
60         }
61
62         /** 
63          * Initializing the assist options with external settings
64          */
65         public AssistOptions(Map settings) {
66                 if (settings == null)
67                         return;
68
69                 set(settings);
70         }
71         public void set(Map optionsMap) {
72
73                 Object optionValue;
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;
79                         }
80                 }
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;
86                         }
87                 }
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());
93                                 } else {
94                                         this.fieldPrefixes = null;
95                                 }
96                         }
97                 }
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());
103                                 } else {
104                                         this.staticFieldPrefixes = null;
105                                 }
106                         }
107                 }
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());
113                                 } else {
114                                         this.localPrefixes = null;
115                                 }
116                         }
117                 }
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());
123                                 } else {
124                                         this.argumentPrefixes = null;
125                                 }
126                         }
127                 }
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());
133                                 } else {
134                                         this.fieldSuffixes = null;
135                                 }
136                         }
137                 }
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());
143                                 } else {
144                                         this.staticFieldSuffixes = null;
145                                 }
146                         }
147                 }
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());
153                                 } else {
154                                         this.localSuffixes = null;
155                                 }
156                         }
157                 }
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());
163                                 } else {
164                                         this.argumentSuffixes = null;
165                                 }
166                         }
167                 }
168         }
169 }