76fbddd83868feecfe2146cc18d26eb5f45c420c
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / codeassist / impl / AssistOptions.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2001, 2002 International Business Machines Corp. and others.
3  * All rights reserved. This program and the accompanying materials 
4  * are made available under the terms of the Common Public License v0.5 
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v05.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 public class AssistOptions {
16         /**
17          * Option IDs
18          */
19         public static final String OPTION_PerformVisibilityCheck =
20                 "org.eclipse.jdt.core.codeComplete.visibilityCheck";    //$NON-NLS-1$
21         public static final String OPTION_ForceImplicitQualification =
22                 "org.eclipse.jdt.core.codeComplete.forceImplicitQualification";         //$NON-NLS-1$
23         public static final String ENABLED = "enabled"; //$NON-NLS-1$
24         public static final String DISABLED = "disabled"; //$NON-NLS-1$
25
26         public boolean checkVisibility = false;
27         public boolean forceImplicitQualification = false;
28
29         /** 
30          * Initializing the assist options with default settings
31          */
32         public AssistOptions() {
33         }
34
35         /** 
36          * Initializing the assist options with external settings
37          */
38         public AssistOptions(Map settings) {
39                 if (settings == null)
40                         return;
41
42                 // filter options which are related to the assist component
43                 Object[] entries = settings.entrySet().toArray();
44                 for (int i = 0, max = entries.length; i < max; i++) {
45                         Map.Entry entry = (Map.Entry) entries[i];
46                         if (!(entry.getKey() instanceof String))
47                                 continue;
48                         if (!(entry.getValue() instanceof String))
49                                 continue;
50                         String optionID = (String) entry.getKey();
51                         String optionValue = (String) entry.getValue();
52
53                         if (optionID.equals(OPTION_PerformVisibilityCheck)) {
54                                 if (optionValue.equals(ENABLED)) {
55                                         this.checkVisibility = true;
56                                 } else
57                                         if (optionValue.equals(DISABLED)) {
58                                                 this.checkVisibility = false;
59                                         }
60                                 continue;
61                         } else if (optionID.equals(OPTION_ForceImplicitQualification)) {
62                                 if (optionValue.equals(ENABLED)) {
63                                         this.forceImplicitQualification = true;
64                                 } else
65                                         if (optionValue.equals(DISABLED)) {
66                                                 this.forceImplicitQualification = false;
67                                         }
68                                 continue;
69                         } 
70                 }
71         }
72 }