Skip to main content
summaryrefslogtreecommitdiffstats
blob: c2c130b307329bd66ec064d7c4933b21531f9e68 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/*******************************************************************************
 * Copyright (c) 2000, 2003 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials 
 * are made available under the terms of the Common Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.wst.jsdt.internal.codeassist.impl;
import java.util.Iterator;
import java.util.Map;
import org.eclipse.wst.jsdt.core.compiler.CharOperation;
public class AssistOptions {
	/**
	 * Option IDs
	 */
	public static final String OPTION_PerformVisibilityCheck = "org.eclipse.wst.jsdt.core.codeComplete.visibilityCheck"; //$NON-NLS-1$
	public static final String OPTION_ForceImplicitQualification = "org.eclipse.wst.jsdt.core.codeComplete.forceImplicitQualification"; //$NON-NLS-1$
	public static final String OPTION_FieldPrefixes = "org.eclipse.wst.jsdt.core.codeComplete.fieldPrefixes"; //$NON-NLS-1$
	public static final String OPTION_StaticFieldPrefixes = "org.eclipse.wst.jsdt.core.codeComplete.staticFieldPrefixes"; //$NON-NLS-1$
	public static final String OPTION_LocalPrefixes = "org.eclipse.wst.jsdt.core.codeComplete.localPrefixes"; //$NON-NLS-1$
	public static final String OPTION_ArgumentPrefixes = "org.eclipse.wst.jsdt.core.codeComplete.argumentPrefixes"; //$NON-NLS-1$
	public static final String OPTION_FieldSuffixes = "org.eclipse.wst.jsdt.core.codeComplete.fieldSuffixes"; //$NON-NLS-1$
	public static final String OPTION_StaticFieldSuffixes = "org.eclipse.wst.jsdt.core.codeComplete.staticFieldSuffixes"; //$NON-NLS-1$
	public static final String OPTION_LocalSuffixes = "org.eclipse.wst.jsdt.core.codeComplete.localSuffixes"; //$NON-NLS-1$
	public static final String OPTION_ArgumentSuffixes = "org.eclipse.wst.jsdt.core.codeComplete.argumentSuffixes"; //$NON-NLS-1$
	public static final String ENABLED = "enabled"; //$NON-NLS-1$
	public static final String DISABLED = "disabled"; //$NON-NLS-1$
	public boolean checkVisibility = false;
	public boolean forceImplicitQualification = false;
	public char[][] fieldPrefixes = null;
	public char[][] staticFieldPrefixes = null;
	public char[][] localPrefixes = null;
	public char[][] argumentPrefixes = null;
	public char[][] fieldSuffixes = null;
	public char[][] staticFieldSuffixes = null;
	public char[][] localSuffixes = null;
	public char[][] argumentSuffixes = null;
	/** 
	 * Initializing the assist options with default settings
	 */
	public AssistOptions() {
		// Initializing the assist options with default settings
	}
	/** 
	 * Initializing the assist options with external settings
	 */
	public AssistOptions(Map settings) {
		if (settings == null)
			return;
		// filter options which are related to the assist component
		Iterator entries = settings.entrySet().iterator();
		while (entries.hasNext()) {
			Map.Entry entry = (Map.Entry) entries.next();
			if (!(entry.getKey() instanceof String))
				continue;
			if (!(entry.getValue() instanceof String))
				continue;
			String optionID = (String) entry.getKey();
			String optionValue = (String) entry.getValue();
			if (optionID.equals(OPTION_PerformVisibilityCheck)) {
				if (optionValue.equals(ENABLED)) {
					this.checkVisibility = true;
				} else if (optionValue.equals(DISABLED)) {
					this.checkVisibility = false;
				}
				continue;
			} else if (optionID.equals(OPTION_ForceImplicitQualification)) {
				if (optionValue.equals(ENABLED)) {
					this.forceImplicitQualification = true;
				} else if (optionValue.equals(DISABLED)) {
					this.forceImplicitQualification = false;
				}
				continue;
			} else if (optionID.equals(OPTION_FieldPrefixes)) {
				if (optionValue.length() == 0) {
					this.fieldPrefixes = null;
				} else {
					this.fieldPrefixes = CharOperation.splitAndTrimOn(',',
							optionValue.toCharArray());
				}
				continue;
			} else if (optionID.equals(OPTION_StaticFieldPrefixes)) {
				if (optionValue.length() == 0) {
					this.staticFieldPrefixes = null;
				} else {
					this.staticFieldPrefixes = CharOperation.splitAndTrimOn(
							',', optionValue.toCharArray());
				}
				continue;
			} else if (optionID.equals(OPTION_LocalPrefixes)) {
				if (optionValue.length() == 0) {
					this.localPrefixes = null;
				} else {
					this.localPrefixes = CharOperation.splitAndTrimOn(',',
							optionValue.toCharArray());
				}
				continue;
			} else if (optionID.equals(OPTION_ArgumentPrefixes)) {
				if (optionValue.length() == 0) {
					this.argumentPrefixes = null;
				} else {
					this.argumentPrefixes = CharOperation.splitAndTrimOn(',',
							optionValue.toCharArray());
				}
				continue;
			} else if (optionID.equals(OPTION_FieldSuffixes)) {
				if (optionValue.length() == 0) {
					this.fieldSuffixes = null;
				} else {
					this.fieldSuffixes = CharOperation.splitAndTrimOn(',',
							optionValue.toCharArray());
				}
				continue;
			} else if (optionID.equals(OPTION_StaticFieldSuffixes)) {
				if (optionValue.length() == 0) {
					this.staticFieldSuffixes = null;
				} else {
					this.staticFieldSuffixes = CharOperation.splitAndTrimOn(
							',', optionValue.toCharArray());
				}
				continue;
			} else if (optionID.equals(OPTION_LocalSuffixes)) {
				if (optionValue.length() == 0) {
					this.localSuffixes = null;
				} else {
					this.localSuffixes = CharOperation.splitAndTrimOn(',',
							optionValue.toCharArray());
				}
				continue;
			} else if (optionID.equals(OPTION_ArgumentSuffixes)) {
				if (optionValue.length() == 0) {
					this.argumentSuffixes = null;
				} else {
					this.argumentSuffixes = CharOperation.splitAndTrimOn(',',
							optionValue.toCharArray());
				}
				continue;
			}
		}
	}
}

Back to the top