Changeset 1224
- Timestamp:
- 07/12/08 15:04:57 (2 months ago)
- Files:
-
- trunk/descent.core/src/descent/core/JavaCore.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/codeassist/CompletionEngine.java (modified) (4 diffs)
- trunk/descent.core/src/descent/internal/codeassist/impl/AssistOptions.java (modified) (3 diffs)
- trunk/descent.core/src/descent/internal/core/JavaCorePreferenceInitializer.java (modified) (1 diff)
- trunk/descent.ui/src/descent/internal/ui/preferences/CodeAssistConfigurationBlock.java (modified) (7 diffs)
- trunk/descent.ui/src/descent/internal/ui/preferences/PreferencesMessages.java (modified) (1 diff)
- trunk/descent.ui/src/descent/internal/ui/preferences/PreferencesMessages.properties (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/descent.core/src/descent/core/JavaCore.java
r1157 r1224 914 914 */ 915 915 public static final String CODEASSIST_DEPRECATION_CHECK = PLUGIN_ID + ".codeComplete.deprecationCheck"; //$NON-NLS-1$ 916 /** 917 * Possible configurable option ID. 918 * @see #getDefaultOptions() 919 * @since 3.2 920 */ 921 public static final String CODEASSIST_NON_IMPORTED_VARIABLES_CHECK = PLUGIN_ID + ".codeComplete.nonImportedVariablesCheck"; //$NON-NLS-1$ 922 /** 923 * Possible configurable option ID. 924 * @see #getDefaultOptions() 925 * @since 3.2 926 */ 927 public static final String CODEASSIST_NON_IMPORTED_ALIASES_CHECK = PLUGIN_ID + ".codeComplete.nonImportedAliasesCheck"; //$NON-NLS-1$ 928 /** 929 * Possible configurable option ID. 930 * @see #getDefaultOptions() 931 * @since 3.2 932 */ 933 public static final String CODEASSIST_NON_IMPORTED_TYPEDEFS_CHECK = PLUGIN_ID + ".codeComplete.nonImportedTypedefsCheck"; //$NON-NLS-1$ 934 /** 935 * Possible configurable option ID. 936 * @see #getDefaultOptions() 937 * @since 3.2 938 */ 939 public static final String CODEASSIST_NON_IMPORTED_FUNCTIONS_CHECK = PLUGIN_ID + ".codeComplete.nonImportedFunctionsCheck"; //$NON-NLS-1$ 940 /** 941 * Possible configurable option ID. 942 * @see #getDefaultOptions() 943 * @since 3.2 944 */ 945 public static final String CODEASSIST_NON_IMPORTED_MODULES_TO_IGNORE = PLUGIN_ID + ".codeComplete.nonImportedModulesToIgnore"; //$NON-NLS-1$ 916 946 /** 917 947 * Possible configurable option ID. trunk/descent.core/src/descent/internal/codeassist/CompletionEngine.java
r1222 r1224 3098 3098 } 3099 3099 3100 if (isImported(packageName) ) {3100 if (isImported(packageName) || isIgnored(packageName)) { 3101 3101 return; 3102 3102 } … … 3168 3168 3169 3169 public void acceptField(char[] packageName, char[] name, char[] typeName, char[][] enclosingTypeNames, long modifiers, int declarationStart, AccessRestriction accessRestriction) { 3170 if (!options.wantNonImportedVariables && (modifiers & Flags.AccAlias) == 0 && (modifiers & Flags.AccTypedef) == 0) { 3171 return; 3172 } 3173 if (!options.wantNonImportedAliases && (modifiers & Flags.AccAlias) != 0) { 3174 return; 3175 } 3176 if (!options.wantNonImportedTypedefs && (modifiers & Flags.AccTypedef) != 0) { 3177 return; 3178 } 3179 3170 3180 if (packageName == null || packageName.length == 0) { 3171 3181 return; 3172 3182 } 3173 3183 3174 if (isImported(packageName) ) {3184 if (isImported(packageName) || isIgnored(packageName)) { 3175 3185 return; 3176 3186 } … … 3235 3245 3236 3246 public void acceptMethod(char[] packageName, char[] name, char[][] enclosingTypeNames, char[] signature, char[] templateParametersSignature, long modifiers, int declarationStart, AccessRestriction accessRestriction) { 3247 if (!options.wantNonImportedFunctions) { 3248 return; 3249 } 3250 3237 3251 if (packageName == null || packageName.length == 0) { 3238 3252 return; 3239 3253 } 3240 3254 3241 if (isImported(packageName) ) {3255 if (isImported(packageName) || isIgnored(packageName)) { 3242 3256 return; 3243 3257 } … … 3456 3470 return false; 3457 3471 } 3472 3473 private boolean isIgnored(char[] fullyQualifiedName) { 3474 if (options.ignoredNonImportedModules.size() == 0) { 3475 return false; 3476 } 3477 3478 for(char[] key : options.ignoredNonImportedModules.keys()) { 3479 if (key != null) { 3480 if (CharOperation.match(key, fullyQualifiedName, false)) { 3481 return true; 3482 } 3483 } 3484 } 3485 return false; 3486 } 3458 3487 3459 3488 } trunk/descent.core/src/descent/internal/codeassist/impl/AssistOptions.java
r210 r1224 13 13 import java.util.Map; 14 14 15 import descent.core.JavaCore; 15 16 import descent.core.compiler.CharOperation; 17 import descent.internal.compiler.parser.HashtableOfCharArrayAndObject; 16 18 17 19 public class AssistOptions { … … 65 67 public char[][] localSuffixes = null; 66 68 public char[][] argumentSuffixes = null; 69 public boolean wantNonImportedVariables = true; 70 public boolean wantNonImportedAliases = true; 71 public boolean wantNonImportedTypedefs = true; 72 public boolean wantNonImportedFunctions = true; 73 public HashtableOfCharArrayAndObject ignoredNonImportedModules = new HashtableOfCharArrayAndObject(); 67 74 68 75 /** … … 205 212 } else if (DISABLED.equals(optionValue)) { 206 213 this.checkDeprecation = false; 214 } 215 } 216 if ((optionValue = optionsMap.get(JavaCore.CODEASSIST_NON_IMPORTED_VARIABLES_CHECK)) != null) { 217 if (ENABLED.equals(optionValue)) { 218 this.wantNonImportedVariables = false; 219 } else if (DISABLED.equals(optionValue)) { 220 this.wantNonImportedVariables = true; 221 } 222 } 223 if ((optionValue = optionsMap.get(JavaCore.CODEASSIST_NON_IMPORTED_ALIASES_CHECK)) != null) { 224 if (ENABLED.equals(optionValue)) { 225 this.wantNonImportedAliases = false; 226 } else if (DISABLED.equals(optionValue)) { 227 this.wantNonImportedAliases = true; 228 } 229 } 230 if ((optionValue = optionsMap.get(JavaCore.CODEASSIST_NON_IMPORTED_TYPEDEFS_CHECK)) != null) { 231 if (ENABLED.equals(optionValue)) { 232 this.wantNonImportedTypedefs = false; 233 } else if (DISABLED.equals(optionValue)) { 234 this.wantNonImportedTypedefs = true; 235 } 236 } 237 if ((optionValue = optionsMap.get(JavaCore.CODEASSIST_NON_IMPORTED_FUNCTIONS_CHECK)) != null) { 238 if (ENABLED.equals(optionValue)) { 239 this.wantNonImportedFunctions = false; 240 } else if (DISABLED.equals(optionValue)) { 241 this.wantNonImportedFunctions = true; 242 } 243 } 244 if ((optionValue = optionsMap.get(JavaCore.CODEASSIST_NON_IMPORTED_MODULES_TO_IGNORE)) != null) { 245 if (optionValue instanceof String) { 246 String moduleNames = (String) optionValue; 247 String[] strings = moduleNames.split(","); 248 for(String string : strings) { 249 ignoredNonImportedModules.put(string.trim().toCharArray(), this); 250 } 207 251 } 208 252 } trunk/descent.core/src/descent/internal/core/JavaCorePreferenceInitializer.java
r1141 r1224 91 91 defaultOptionsMap.put(JavaCore.CODEASSIST_VISIBILITY_CHECK, JavaCore.DISABLED); 92 92 defaultOptionsMap.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, JavaCore.DISABLED); 93 defaultOptionsMap.put(JavaCore.CODEASSIST_NON_IMPORTED_VARIABLES_CHECK, JavaCore.DISABLED); 94 defaultOptionsMap.put(JavaCore.CODEASSIST_NON_IMPORTED_ALIASES_CHECK, JavaCore.DISABLED); 95 defaultOptionsMap.put(JavaCore.CODEASSIST_NON_IMPORTED_TYPEDEFS_CHECK, JavaCore.DISABLED); 96 defaultOptionsMap.put(JavaCore.CODEASSIST_NON_IMPORTED_FUNCTIONS_CHECK, JavaCore.DISABLED); 97 defaultOptionsMap.put(JavaCore.CODEASSIST_NON_IMPORTED_MODULES_TO_IGNORE, ""); 93 98 defaultOptionsMap.put(JavaCore.CODEASSIST_IMPLICIT_QUALIFICATION, JavaCore.DISABLED); 94 99 defaultOptionsMap.put(JavaCore.CODEASSIST_FIELD_PREFIXES, ""); //$NON-NLS-1$ trunk/descent.ui/src/descent/internal/ui/preferences/CodeAssistConfigurationBlock.java
r1034 r1224 60 60 private static final Key PREF_CODEASSIST_DISCOURAGED_REFERENCE_CHECK= getJDTCoreKey(JavaCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK); 61 61 private static final Key PREF_CODEASSIST_DEPRECATION_CHECK= getJDTCoreKey(JavaCore.CODEASSIST_DEPRECATION_CHECK); 62 private static final Key PREF_CODEASSIST_NON_IMPORTED_VARIABLES_CHECK= getJDTCoreKey(JavaCore.CODEASSIST_NON_IMPORTED_VARIABLES_CHECK); 63 private static final Key PREF_CODEASSIST_NON_IMPORTED_ALIASES_CHECK= getJDTCoreKey(JavaCore.CODEASSIST_NON_IMPORTED_ALIASES_CHECK); 64 private static final Key PREF_CODEASSIST_NON_IMPORTED_TYPEDEFS_CHECK= getJDTCoreKey(JavaCore.CODEASSIST_NON_IMPORTED_TYPEDEFS_CHECK); 65 private static final Key PREF_CODEASSIST_NON_IMPORTED_FUNCTIONS_CHECK= getJDTCoreKey(JavaCore.CODEASSIST_NON_IMPORTED_FUNCTIONS_CHECK); 66 private static final Key PREF_CODEASSIST_NON_IMPORTED_MODULES_TO_IGNORE= getJDTCoreKey(JavaCore.CODEASSIST_NON_IMPORTED_MODULES_TO_IGNORE); 67 62 68 private static final Key PREF_CODEASSIST_CAMEL_CASE_MATCH= getJDTCoreKey(JavaCore.CODEASSIST_CAMEL_CASE_MATCH); 63 69 … … 80 86 PREF_CODEASSIST_DISCOURAGED_REFERENCE_CHECK, 81 87 PREF_CODEASSIST_DEPRECATION_CHECK, 88 PREF_CODEASSIST_NON_IMPORTED_VARIABLES_CHECK, 89 PREF_CODEASSIST_NON_IMPORTED_ALIASES_CHECK, 90 PREF_CODEASSIST_NON_IMPORTED_TYPEDEFS_CHECK, 91 PREF_CODEASSIST_NON_IMPORTED_FUNCTIONS_CHECK, 92 PREF_CODEASSIST_NON_IMPORTED_MODULES_TO_IGNORE, 82 93 PREF_CODEASSIST_CAMEL_CASE_MATCH, 83 94 }; … … 213 224 addCheckBox(composite, label, PREF_CODEASSIST_DEPRECATION_CHECK, enabledDisabled, 0); 214 225 226 label= PreferencesMessages.CodeAssistConfigurationBlock_hideNonImportedVariables_label; 227 addCheckBox(composite, label, PREF_CODEASSIST_NON_IMPORTED_VARIABLES_CHECK, enabledDisabled, 0); 228 229 label= PreferencesMessages.CodeAssistConfigurationBlock_hideNonImportedAliases_label; 230 addCheckBox(composite, label, PREF_CODEASSIST_NON_IMPORTED_ALIASES_CHECK, enabledDisabled, 0); 231 232 label= PreferencesMessages.CodeAssistConfigurationBlock_hideNonImportedTypedefs_label; 233 addCheckBox(composite, label, PREF_CODEASSIST_NON_IMPORTED_TYPEDEFS_CHECK, enabledDisabled, 0); 234 235 label= PreferencesMessages.CodeAssistConfigurationBlock_hideNonImportedFunctions_label; 236 addCheckBox(composite, label, PREF_CODEASSIST_NON_IMPORTED_FUNCTIONS_CHECK, enabledDisabled, 0); 237 215 238 label= PreferencesMessages.CodeAssistConfigurationBlock_matchCamelCase_label; 216 239 addCheckBox(composite, label, PREF_CODEASSIST_CAMEL_CASE_MATCH, enabledDisabled, 0); 240 241 label= PreferencesMessages.CodeAssistConfigurationBlock_hideNonImportedModulesToIgnore_label; 242 addLabelledTextField(composite, label, PREF_CODEASSIST_NON_IMPORTED_MODULES_TO_IGNORE, 0, 4, true); 217 243 } 218 244 … … 238 264 239 265 label= PreferencesMessages.JavaEditorPreferencePage_autoActivationDelay; 240 addLabelledTextField(composite, label, PREF_CODEASSIST_AUTOACTIVATION_DELAY, 4, 0, true);266 addLabelledTextField(composite, label, PREF_CODEASSIST_AUTOACTIVATION_DELAY, 4, 0, false); 241 267 242 268 label= PreferencesMessages.JavaEditorPreferencePage_autoActivationTriggersForJava; … … 247 273 } 248 274 249 protected Text addLabelledTextField(Composite parent, String label, Key key, int textlimit, int indent, boolean dummy) {275 protected Text addLabelledTextField(Composite parent, String label, Key key, int textlimit, int indent, boolean enter) { 250 276 PixelConverter pixelConverter= new PixelConverter(parent); 277 278 GridData data; 251 279 252 280 Label labelControl= new Label(parent, SWT.WRAP); 253 281 labelControl.setText(label); 254 labelControl.setLayoutData(new GridData()); 282 283 data = new GridData(); 284 if (enter) { 285 data.horizontalSpan = 3; 286 } 287 labelControl.setLayoutData(data); 255 288 256 289 Text textBox= new Text(parent, SWT.BORDER | SWT.SINGLE); 257 290 textBox.setData(key); 258 textBox.setLayoutData(new GridData()); 291 292 data = new GridData(); 293 textBox.setLayoutData(data); 259 294 260 295 fLabels.put(textBox, labelControl); … … 266 301 textBox.addModifyListener(getTextModifyListener()); 267 302 268 GridDatadata= new GridData(GridData.HORIZONTAL_ALIGN_FILL);303 data= new GridData(GridData.HORIZONTAL_ALIGN_FILL); 269 304 if (textlimit != 0) { 270 305 textBox.setTextLimit(textlimit); … … 272 307 } 273 308 data.horizontalIndent= indent; 274 data.horizontalSpan= 2; 309 if (enter) { 310 data.horizontalSpan= 3; 311 } else { 312 data.horizontalSpan= 2; 313 } 275 314 textBox.setLayoutData(data); 276 315 trunk/descent.ui/src/descent/internal/ui/preferences/PreferencesMessages.java
r632 r1224 746 746 public static String ProblemSeveritiesConfigurationBlock_pb_fall_through_case; 747 747 public static String CodeAssistConfigurationBlock_hideDeprecated_label; 748 public static String CodeAssistConfigurationBlock_hideNonImportedVariables_label; 749 public static String CodeAssistConfigurationBlock_hideNonImportedAliases_label; 750 public static String CodeAssistConfigurationBlock_hideNonImportedTypedefs_label; 751 public static String CodeAssistConfigurationBlock_hideNonImportedFunctions_label; 752 public static String CodeAssistConfigurationBlock_hideNonImportedModulesToIgnore_label; 748 753 public static String CleanUpPreferencePage_Description; 749 754 public static String CleanUpPreferencePage_Title; trunk/descent.ui/src/descent/internal/ui/preferences/PreferencesMessages.properties
r632 r1224 841 841 CodeAssistConfigurationBlock_hideDiscouraged_label=Hide dis&couraged references 842 842 CodeAssistConfigurationBlock_hideDeprecated_label=&Hide deprecated references 843 CodeAssistConfigurationBlock_hideNonImportedVariables_label=Hide non-imported &variables 844 CodeAssistConfigurationBlock_hideNonImportedAliases_label=Hide non-imported &aliases 845 CodeAssistConfigurationBlock_hideNonImportedTypedefs_label=Hide non-imported &typedefs 846 CodeAssistConfigurationBlock_hideNonImportedFunctions_label=Hide non-imported &functions 847 CodeAssistConfigurationBlock_hideNonImportedModulesToIgnore_label=Always hide symbols from these modules if they are not imported (e.g.: std.c.windows.*, std.compiler): 843 848 844 849 # {0} will be replaced by the keyboard shortcut for the command (e.g. "Ctrl+Space", or "no shortcut")
