Project: JDT
Bug 140886 [api] Offer simpler access to proposal computers preferences
Reported: 2006-05-09 14:53:16 | Status: resolved fixed

Since Mylar has a policy of ensuring no manual preference configuration on install, we have a wizard that automatically sets our proposal computers as the default. However, this currently involves the hack of duplicating the current preference functionality (code is below). 1) Would it be possible to expose this proposal computer inclusion setting preference page behavior to avoid the duplication (internally for now, perhaps candidate for API later)? 2) If not, what is the mechanism to ensure that the new proposal computers are registered with existing editors? Currently the code below doesn't register them until restart, but changing the settings in the prefs page take effect immediately. ------------------------- public static void installContentAssist(IPreferenceStore javaPrefs, boolean mylarContentAssist) { String oldValue = javaPrefs.getString(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES); StringTokenizer tokenizer = new StringTokenizer(oldValue, SEPARATOR_CODEASSIST); Set<String> disabledIds = new HashSet<String>(); while (tokenizer.hasMoreTokens()) { disabledIds.add((String) tokenizer.nextElement()); } if (!mylarContentAssist) { disabledIds.remove(ASSIST_JDT_TYPE); disabledIds.remove(ASSIST_JDT_NOTYPE); disabledIds.add(ASSIST_MYLAR_NOTYPE); disabledIds.add(ASSIST_MYLAR_TYPE); } else { disabledIds.add(ASSIST_JDT_TYPE); disabledIds.add(ASSIST_JDT_NOTYPE); disabledIds.remove(ASSIST_MYLAR_NOTYPE); disabledIds.remove(ASSIST_MYLAR_TYPE); } String newValue = ""; for (String id : disabledIds) { newValue += id + SEPARATOR_CODEASSIST; } javaPrefs.setValue(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES, newValue); } if (!mylarContentAssist) { disabledIds.remove(ASSIST_JDT_TYPE); disabledIds.remove(ASSIST_JDT_NOTYPE); disabledIds.add(ASSIST_MYLAR_NOTYPE); disabledIds.add(ASSIST_MYLAR_TYPE); } else { disabledIds.add(ASSIST_JDT_TYPE); disabledIds.add(ASSIST_JDT_NOTYPE); disabledIds.remove(ASSIST_MYLAR_NOTYPE); disabledIds.remove(ASSIST_MYLAR_TYPE); } String newValue = ""; for (String id : disabledIds) { newValue += id + SEPARATOR_CODEASSIST; } javaPrefs.setValue(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES, newValue); }

Files changed in fix:
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/PreferenceConstants.java