Java Code Examples for org.eclipse.jface.preference.IPreferenceStore#getDefaultString()

The following examples show how to use org.eclipse.jface.preference.IPreferenceStore#getDefaultString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JavaFoldingStructureProviderRegistry.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Instantiates and returns the provider that is currently configured in the
 * preferences.
 *
 * @return the current provider according to the preferences
 */
public IJavaFoldingStructureProvider getCurrentFoldingProvider() {
	IPreferenceStore preferenceStore= JavaPlugin.getDefault().getPreferenceStore();
	String currentProviderId= preferenceStore.getString(PreferenceConstants.EDITOR_FOLDING_PROVIDER);
	JavaFoldingStructureProviderDescriptor desc= getFoldingProviderDescriptor(currentProviderId);

	// Fallback to default if extension has gone
	if (desc == null) {
		String message= Messages.format(FoldingMessages.JavaFoldingStructureProviderRegistry_warning_providerNotFound_resetToDefault, currentProviderId);
		JavaPlugin.log(new Status(IStatus.WARNING, JavaPlugin.getPluginId(), IStatus.OK, message, null));

		String defaultProviderId= preferenceStore.getDefaultString(PreferenceConstants.EDITOR_FOLDING_PROVIDER);

		desc= getFoldingProviderDescriptor(defaultProviderId);
		Assert.isNotNull(desc);

		preferenceStore.setToDefault(PreferenceConstants.EDITOR_FOLDING_PROVIDER);
	}

	try {
		return desc.createProvider();
	} catch (CoreException e) {
		JavaPlugin.log(e);
		return null;
	}
}
 
Example 2
Source File: TypeFilterPreferencePage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void initialize(boolean fromDefault) {
	IPreferenceStore store= getPreferenceStore();

	String enabled= fromDefault ? store.getDefaultString(PREF_FILTER_ENABLED) : store.getString(PREF_FILTER_ENABLED);
	String disabled= fromDefault ? store.getDefaultString(PREF_FILTER_DISABLED) : store.getString(PREF_FILTER_DISABLED);

	ArrayList<String> res= new ArrayList<String>();

	String[] enabledEntries= unpackOrderList(enabled);
	for (int i= 0; i < enabledEntries.length; i++) {
		res.add(enabledEntries[i]);
	}
	String[] disabledEntries= unpackOrderList(disabled);
	for (int i= 0; i < disabledEntries.length; i++) {
		res.add(disabledEntries[i]);
	}

	fFilterListField.setElements(res);
	fFilterListField.setCheckedElements(Arrays.asList(enabledEntries));
	
	boolean hideForbidden= getJDTCoreOption(JavaCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK, fromDefault);
	fHideForbiddenField.setSelection(hideForbidden);
	boolean hideDiscouraged= getJDTCoreOption(JavaCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK, fromDefault);
	fHideDiscouragedField.setSelection(hideDiscouraged);
}
 
Example 3
Source File: MembersOrderPreferencePage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected void performDefaults() {
	IPreferenceStore prefs= JavaPlugin.getDefault().getPreferenceStore();
	String str= prefs.getDefaultString(PREF_OUTLINE_SORT_OPTION);
	if (str != null)
		fSortOrderList.setElements(parseList(str));
	else
		fSortOrderList.setElements(parseList(ALL_SORTMEMBER_ENTRIES));

	str= prefs.getDefaultString(PREF_VISIBILITY_SORT_OPTION);
	if (str != null)
		fVisibilityOrderList.setElements(parseList(str));
	else
		fVisibilityOrderList.setElements(parseList(ALL_VISIBILITY_ENTRIES));

	fUseVisibilitySortField.setSelection(prefs.getDefaultBoolean(PREF_USE_VISIBILITY_SORT_OPTION));

	super.performDefaults();
}
 
Example 4
Source File: UserActivityEvents.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
private void initializeDefaults() {
	IPreferenceStore store = getPreferenceStore();
	String json = store.getDefaultString(Preferences.USERMONITORING_DISABLEMENTS);
	disablements = gson.fromJson(json, UserActivityDisablements.class);
	resolveDependenciesAndUnusages();
	updateEventButtons();
	updateMetricButtons();
}
 
Example 5
Source File: CloudSdkPreferenceArea.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@VisibleForTesting
void loadSdkManagement(boolean loadDefault) {
  IPreferenceStore preferenceStore = getPreferenceStore();
  String value;
  if (loadDefault) {
    value = preferenceStore.getDefaultString(CloudSdkPreferences.CLOUD_SDK_MANAGEMENT);
  } else {
    value = preferenceStore.getString(CloudSdkPreferences.CLOUD_SDK_MANAGEMENT);
  }

  boolean manual = CloudSdkManagementOption.MANUAL.name().equals(value);
  chooseSdk.setSelection(manual);
}
 
Example 6
Source File: AutomaticUpdatesPreferencePage.java    From tlaplus with MIT License 5 votes vote down vote up
private int getFuzzyRecurrence(IPreferenceStore pref, boolean useDefault) {
	String day = useDefault ? pref.getDefaultString(AutomaticUpdateScheduler.P_FUZZY_RECURRENCE) : pref.getString(AutomaticUpdateScheduler.P_FUZZY_RECURRENCE);
	for (int i = 0; i < AutomaticUpdateScheduler.FUZZY_RECURRENCE.length; i++)
		if (AutomaticUpdateScheduler.FUZZY_RECURRENCE[i].equals(day))
			return i;
	return 0;
}
 
Example 7
Source File: IndentGuidePreferencePage.java    From IndentGuide with MIT License 5 votes vote down vote up
@Override
protected void performDefaults() {
  super.performDefaults();
  final IPreferenceStore store = getPreferenceStore();
  enabled.setSelection(store
      .getDefaultBoolean(PreferenceConstants.ENABLED));
  lineAlpha.setSelection(store
      .getDefaultInt(PreferenceConstants.LINE_ALPHA));
  int index = store.getDefaultInt(PreferenceConstants.LINE_STYLE) - 1;
  if (index < 0 || index >= styles.length) {
    index = 0;
  }
  lineStyle.setText(styles[index]);
  lineWidth.setSelection(store
      .getDefaultInt(PreferenceConstants.LINE_WIDTH));
  lineShift.setSelection(store
      .getDefaultInt(PreferenceConstants.LINE_SHIFT));
  colorFieldEditor.loadDefault();
  drawLeftEnd.setSelection(store
      .getDefaultBoolean(PreferenceConstants.DRAW_LEFT_END));
  drawBlankLine.setSelection(store
      .getDefaultBoolean(PreferenceConstants.DRAW_BLANK_LINE));
  skipCommentBlock.setSelection(store
      .getDefaultBoolean(PreferenceConstants.SKIP_COMMENT_BLOCK));
  enableControls(enabled.getSelection());
  for (final TreeItem item : contentTypesTree.getItems()) {
    checkItems(item, false);
  }
  final String type = store.getDefaultString(PreferenceConstants.CONTENT_TYPES);
  final String types[] = type.split("\\|");
  for (final TreeItem child : contentTypesTree.getItems()) {
    checkContentType(child, types);
  }
}
 
Example 8
Source File: TLCChainedPreferenceStore.java    From tlaplus with MIT License 4 votes vote down vote up
public String getDefaultString(String name) {
	IPreferenceStore visibleStore= getVisibleStore(name);
	if (visibleStore != null)
		return visibleStore.getDefaultString(name);
	return STRING_DEFAULT_DEFAULT;
}
 
Example 9
Source File: EditorAppearanceColorsComponent.java    From goclipse with Eclipse Public License 1.0 4 votes vote down vote up
public void loadStoreDefaults(IPreferenceStore store) {
	String colorPrefValue = store.getDefaultString(colorKey);
	boolean useSystemDefaultPrefValue = useSystemDefaultKey == null ? false :
		store.getDefaultBoolean(useSystemDefaultKey);
	setValues(colorPrefValue, useSystemDefaultPrefValue);
}