Java Code Examples for org.osgi.service.prefs.Preferences#put()

The following examples show how to use org.osgi.service.prefs.Preferences#put() . 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: ProjectNameFilterAwareWorkingSetManager.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public IStatus saveState(final IProgressMonitor monitor) {
	final IStatus superSaveResult = super.saveState(monitor);

	if (superSaveResult.isOK()) {

		final Preferences node = getPreferences();
		node.put(ORDERED_FILTERS_KEY, Joiner.on(SEPARATOR).join(orderedWorkingSetFilters));

		try {
			node.flush();
		} catch (final BackingStoreException e) {
			final String message = "Error occurred while saving state to preference store.";
			LOGGER.error(message, e);
			return statusHelper.createError(message, e);
		}

		return statusHelper.OK();
	}

	return superSaveResult;
}
 
Example 2
Source File: AnalysisPreferenceInitializer.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void initializeDefaultPreferences() {
    Preferences node = DefaultScope.INSTANCE.getNode(DEFAULT_SCOPE);

    for (int i = 0; i < AnalysisPreferences.completeSeverityMap.length; i++) {
        Object[] s = AnalysisPreferences.completeSeverityMap[i];
        node.putInt((String) s[1], (Integer) s[2]);

    }
    node.put(NAMES_TO_IGNORE_UNUSED_VARIABLE, DEFAULT_NAMES_TO_IGNORE_UNUSED_VARIABLE);
    node.put(NAMES_TO_IGNORE_UNUSED_IMPORT, DEFAULT_NAMES_TO_IGNORE_UNUSED_IMPORT);
    node.put(NAMES_TO_CONSIDER_GLOBALS, DEFAULT_NAMES_TO_CONSIDER_GLOBALS);
    node.putBoolean(DO_CODE_ANALYSIS, DEFAULT_DO_CODE_ANALYSIS);
    node.putBoolean(DO_AUTO_IMPORT, DEFAULT_DO_AUT_IMPORT);
    node.putBoolean(DO_AUTO_IMPORT_ON_ORGANIZE_IMPORTS, DEFAULT_DO_AUTO_IMPORT_ON_ORGANIZE_IMPORTS);
    node.putBoolean(DO_IGNORE_IMPORTS_STARTING_WITH_UNDER, DEFAULT_DO_IGNORE_FIELDS_WITH_UNDER);

    //pep8 related.
    node.putBoolean(USE_PEP8_CONSOLE, DEFAULT_USE_PEP8_CONSOLE);
    node.putBoolean(PEP8_USE_SYSTEM, DEFAULT_PEP8_USE_SYSTEM);
}
 
Example 3
Source File: PyLintPrefInitializer.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
public static void initializeDefaultPreferences() {
    Preferences node = DefaultScope.INSTANCE.getNode(SharedCorePlugin.DEFAULT_PYDEV_PREFERENCES_SCOPE);

    node.put(PyLintPreferences.PYLINT_FILE_LOCATION, "");
    node.putBoolean(PyLintPreferences.USE_PYLINT, PyLintPreferences.DEFAULT_USE_PYLINT);

    node.putInt(PyLintPreferences.SEVERITY_ERRORS, PyLintPreferences.DEFAULT_SEVERITY_ERRORS);
    node.putInt(PyLintPreferences.SEVERITY_WARNINGS, PyLintPreferences.DEFAULT_SEVERITY_WARNINGS);
    node.putInt(PyLintPreferences.SEVERITY_FATAL, PyLintPreferences.DEFAULT_SEVERITY_FATAL);
    node.putInt(PyLintPreferences.SEVERITY_CODING_STANDARD, PyLintPreferences.DEFAULT_SEVERITY_CODING_STANDARD);
    node.putInt(PyLintPreferences.SEVERITY_REFACTOR, PyLintPreferences.DEFAULT_SEVERITY_REFACTOR);

    node.putBoolean(PyLintPreferences.USE_CONSOLE, PyLintPreferences.DEFAULT_USE_CONSOLE);
    node.put(PyLintPreferences.PYLINT_ARGS, PyLintPreferences.DEFAULT_PYLINT_ARGS);

}
 
Example 4
Source File: MergeFileAssociationPreferencePage.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
public boolean performOk() {
	MergeFileAssociation[] currentAssociations = getMergeFileAssociations();
	for (int i = 0; i < currentAssociations.length; i++) {
		currentAssociations[i].remove();
	}
	for (int i = 0; i < mergeFileAssociations.length; i++) {
		Preferences prefs = MergeFileAssociation.getParentPreferences().node(mergeFileAssociations[i].getFileType());
		if (mergeFileAssociations[i].getMergeProgram() == null) prefs.put("mergeProgram", ""); //$NON-NLS-1$ //$NON-NLS-1$ //$NON-NLS-2$
		else prefs.put("mergeProgram", mergeFileAssociations[i].getMergeProgram()); //$NON-NLS-1$
		if (mergeFileAssociations[i].getParameters() == null)prefs.put("parameters", ""); //$NON-NLS-1$ //$NON-NLS-1$ //$NON-NLS-2$ 
		else prefs.put("parameters", mergeFileAssociations[i].getParameters()); //$NON-NLS-1$
		prefs.putInt("type", mergeFileAssociations[i].getType()); //$NON-NLS-1$
		try {
			prefs.flush();
		} catch (BackingStoreException e) {}
	}
	return super.performOk();
}
 
Example 5
Source File: Activator.java    From hybris-commerce-eclipse-plugin with Apache License 2.0 6 votes vote down vote up
public void resetPlatform(String platformHome) {
	
	try {
		Preferences preferences = InstanceScope.INSTANCE.getNode("com.hybris.hyeclipse.preferences");
		preferences.put("platform_home", platformHome);
		preferences.flush();
	}
	catch (BackingStoreException e) {
		logError("Failed to persist platform_home", e);
	}
	
	getTypeSystemExporter().setPlatformHome(null);
	getTypeSystemExporter().nullifySystemConfig();
	getTypeSystemExporter().nullifyPlatformConfig();
	getTypeSystemExporter().nullifyTypeSystem();
	getTypeSystemExporter().nullifyAllTypes();
	getTypeSystemExporter().nullifyAllTypeNames();
}
 
Example 6
Source File: BazelProjectSupport.java    From eclipse with Apache License 2.0 6 votes vote down vote up
private static void addSettings(IProject project, String workspaceRoot, List<String> targets,
    List<String> buildFlags) throws BackingStoreException {
  IScopeContext projectScope = new ProjectScope(project);
  Preferences projectNode = projectScope.getNode(Activator.PLUGIN_ID);
  int i = 0;
  for (String target : targets) {
    projectNode.put("target" + i, target);
    i++;
  }
  projectNode.put("workspaceRoot", workspaceRoot);
  i = 0;
  for (String flag : buildFlags) {
    projectNode.put("buildFlag" + i, flag);
    i++;
  }
  projectNode.flush();
}
 
Example 7
Source File: StaticAnalyzerPreferences.java    From CogniCrypt with Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected void storeValues() {
	preferences.setValue(Constants.AUTOMATED_ANALYSIS, automatedAnalysisCheckBox.getSelection());
	preferences.setValue(Constants.PROVIDER_DETECTION_ANALYSIS, providerDetectionCheckBox.getSelection());
	preferences.setValue(Constants.SHOW_SECURE_OBJECTS, secureObjectsCheckBox.getSelection());
	preferences.setValue(Constants.ANALYSE_DEPENDENCIES, analyseDependenciesCheckBox.getSelection());
	preferences.setValue(Constants.CALL_GRAPH_SELECTION, CGSelection.getSelectionIndex());
	preferences.setValue(Constants.FORBIDDEN_METHOD_MARKER_TYPE, forbidden.getSelectionIndex());
	preferences.setValue(Constants.CONSTRAINT_ERROR_MARKER_TYPE, constraint.getSelectionIndex());
	preferences.setValue(Constants.INCOMPLETE_OPERATION_MARKER_TYPE, incompleteOp.getSelectionIndex());
	preferences.setValue(Constants.NEVER_TYPEOF_MARKER_TYPE, neverType.getSelectionIndex());
	preferences.setValue(Constants.REQUIRED_PREDICATE_MARKER_TYPE, reqPred.getSelectionIndex());
	preferences.setValue(Constants.TYPESTATE_ERROR_MARKER_TYPE, typestate.getSelectionIndex());

	for (Iterator<Ruleset> itr = listOfRulesets.iterator(); itr.hasNext();) {
		Ruleset ruleset = (Ruleset) itr.next();

		Preferences subPref = rulePreferences.node(ruleset.getFolderName());
		subPref.putBoolean("CheckboxState", ruleset.isChecked());
		subPref.put("FolderName", ruleset.getFolderName());
		subPref.put("SelectedVersion", ruleset.getSelectedVersion());
		subPref.put("Url", ruleset.getUrl());
	}
}
 
Example 8
Source File: WorkingSetManagerBrokerImpl.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
private IStatus saveState() {

		final Preferences node = getPreferences();
		// Top level element.
		node.putBoolean(IS_WORKINGSET_TOP_LEVEL_KEY, workingSetTopLevel.get());

		// Active working set manager.
		final WorkingSetManager activeManager = getActiveManager();
		final String activeId = activeManager == null ? null : activeManager.getId();
		node.put(ACTIVE_MANAGER_KEY, Strings.nullToEmpty(activeId));

		try {
			node.flush();
			return OK_STATUS;
		} catch (final BackingStoreException e) {
			final String message = "Unexpected error when trying to persist working set broker state.";
			LOGGER.error(message, e);
			return statusHelper.createError(message, e);
		}
	}
 
Example 9
Source File: WorkingSetManagerImpl.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public IStatus saveState(final IProgressMonitor monitor) {

	final Preferences node = getPreferences();

	// Save ordered labels.
	node.put(ORDERED_IDS_KEY, Joiner.on(SEPARATOR).join(orderedWorkingSetIds));

	// Save visible labels.
	node.put(VISIBLE_IDS_KEY, Joiner.on(SEPARATOR).join(visibleWorkingSetIds));

	try {
		node.flush();
	} catch (final BackingStoreException e) {
		final String message = "Error occurred while saving state to preference store.";
		LOGGER.error(message, e);
		return statusHelper.createError(message, e);
	}

	return statusHelper.OK();
}
 
Example 10
Source File: ManualAssociationAwareWorkingSetManager.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public IStatus saveState(final IProgressMonitor monitor) {
	final IStatus superSaveResult = super.saveState(monitor);

	if (superSaveResult.isOK()) {

		final Preferences node = getPreferences();

		try {
			final String associationString = projectAssociationsToJsonString(projectAssociations);
			node.put(ORDERED_ASSOCIATIONS_KEY, associationString);
			node.flush();
		} catch (final BackingStoreException e) {
			final String message = "Error occurred while saving state to preference store.";
			LOGGER.error(message, e);
			return statusHelper.createError(message, e);
		}

		resetEclipseWorkingSetsBaseOnCurrentState();

		return statusHelper.OK();
	}

	return superSaveResult;
}
 
Example 11
Source File: DefaultRulePreferences.java    From CogniCrypt with Eclipse Public License 2.0 5 votes vote down vote up
public static void addDefaults() {
	Preferences rulePreferences = InstanceScope.INSTANCE.getNode(de.cognicrypt.core.Activator.PLUGIN_ID);
	String[] listOfNodes;
	try {
		listOfNodes = rulePreferences.childrenNames();
		if (listOfNodes.length == 0) {
			Section ini = Utils.getConfig().get(Constants.INI_URL_HEADER);
			List<Ruleset> listOfRulesets = new ArrayList<Ruleset>() {
		 		private static final long serialVersionUID = 1L;
		 		{
		 			add(new Ruleset(ini.get(Constants.INI_JCA_NEXUS), true));
		 			add(new Ruleset(ini.get(Constants.INI_BC_NEXUS)));
		 			add(new Ruleset(ini.get(Constants.INI_TINK_NEXUS)));
		 			add(new Ruleset(ini.get(Constants.INI_BCJCA_NEXUS)));
		 		}
		 	};
		 	for (Iterator<Ruleset> itr = listOfRulesets.iterator(); itr.hasNext();) {
	 			Ruleset ruleset = (Ruleset) itr.next();
	
	 			Preferences subPref = rulePreferences.node(ruleset.getFolderName());
	 			subPref.putBoolean("CheckboxState", ruleset.isChecked());
	 			subPref.put("FolderName", ruleset.getFolderName());
	 			subPref.put("SelectedVersion", ruleset.getSelectedVersion());
	 			subPref.put("Url", ruleset.getUrl());
	 		}
		}
	} catch (BackingStoreException e) {
		Activator.getDefault().logError(e);
	}
}
 
Example 12
Source File: TimeZoneInitializer.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void initializeDefaultPreferences ()
{
    String defaultTimeZone = TimeZone.getDefault ().getID ();
    for ( final IConfigurationElement ele : Platform.getExtensionRegistry ().getConfigurationElementsFor ( EXTP_CFG_ID ) )
    {
        if ( !Activator.TIME_ZONE_KEY.equals ( ele.getName () ) )
        {
            continue;
        }
        defaultTimeZone = ele.getAttribute ( "id" ); //$NON-NLS-1$
    }
    final Preferences node = DefaultScope.INSTANCE.getNode ( Activator.PLUGIN_ID );
    node.put ( Activator.TIME_ZONE_KEY, defaultTimeZone );
}
 
Example 13
Source File: MypyPrefInitializer.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
public static void initializeDefaultPreferences() {
    Preferences node = DefaultScope.INSTANCE.getNode(SharedCorePlugin.DEFAULT_PYDEV_PREFERENCES_SCOPE);

    node.put(MypyPreferences.MYPY_FILE_LOCATION, "");
    node.putBoolean(MypyPreferences.USE_MYPY, MypyPreferences.DEFAULT_USE_MYPY);

    node.putBoolean(MypyPreferences.MYPY_USE_CONSOLE, MypyPreferences.DEFAULT_MYPY_USE_CONSOLE);
    node.put(MypyPreferences.MYPY_ARGS, MypyPreferences.DEFAULT_MYPY_ARGS);
    node.putBoolean(MypyPreferences.MYPY_ADD_PROJECT_FOLDERS_TO_MYPYPATH, MypyPreferences.DEFAULT_MYPY_ADD_PROJECT_FOLDERS_TO_MYPYPATH);

}
 
Example 14
Source File: MinimapPreferenceInitializer.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void initializeDefaultPreferences() {
    Preferences node = DefaultScope.INSTANCE.getNode(SharedUiPlugin.PLUGIN_ID);

    node.putBoolean(MinimapOverviewRulerPreferencesPage.USE_MINIMAP, true);
    node.putBoolean(MinimapOverviewRulerPreferencesPage.SHOW_VERTICAL_SCROLLBAR, false);
    node.putBoolean(MinimapOverviewRulerPreferencesPage.SHOW_HORIZONTAL_SCROLLBAR, true);
    node.putBoolean(MinimapOverviewRulerPreferencesPage.SHOW_MINIMAP_CONTENTS, false);
    node.putInt(MinimapOverviewRulerPreferencesPage.MINIMAP_WIDTH, 25); // Change default from 70 -> 25
    node.put(MinimapOverviewRulerPreferencesPage.MINIMAP_SELECTION_COLOR,
            StringConverter.asString(new RGB(51, 153, 255)));

}
 
Example 15
Source File: AddInPreferenceInitializer.java    From M2Doc with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void initializeDefaultPreferences() {
    final Preferences preferences = InstanceScope.INSTANCE.getNode(SCOPE);
    preferences.put(HOST_PREFERENCE, DEFAULT_HOST);
    preferences.put(PORT_PREFERENCE, String.valueOf(DEFAULT_PORT));
}
 
Example 16
Source File: SVNRepositoryLocation.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Return a preferences node that contains suitabel defaults for a
 * repository location.
 * @return  a preferences node
 */
public static Preferences getDefaultPreferences() {
	Preferences defaults = new DefaultScope().getNode(SVNProviderPlugin.ID).node(DEFAULT_REPOSITORY_SETTINGS_NODE);
	defaults.put(PREF_SERVER_ENCODING, getDefaultEncoding());
	return defaults;
}
 
Example 17
Source File: SVNRepositoryLocation.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public void storePreferences() {
	Preferences prefs = internalGetPreferences();
	// Must store at least one preference in the node
	prefs.put(PREF_LOCATION, getLocation());
	flushPreferences();
}
 
Example 18
Source File: PydevConsolePreferencesInitializer.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void initializeDefaultPreferences() {
    Preferences node = DefaultScope.INSTANCE.getNode("org.python.pydev.debug");

    //text
    node.put(PydevConsoleConstants.PREF_CONTINUE_PROMPT, PydevConsoleConstants.DEFAULT_CONTINUE_PROMPT);
    node.put(PydevConsoleConstants.PREF_NEW_PROMPT, PydevConsoleConstants.DEFAULT_NEW_PROMPT);

    node.put(PydevConsoleConstants.CONSOLE_INPUT_COLOR,
            StringConverter.asString(PydevConsoleConstants.DEFAULT_CONSOLE_SYS_IN_COLOR));

    node.put(PydevConsoleConstants.CONSOLE_OUTPUT_COLOR,
            StringConverter.asString(PydevConsoleConstants.DEFAULT_CONSOLE_SYS_OUT_COLOR));

    node.put(PydevConsoleConstants.CONSOLE_ERROR_COLOR,
            StringConverter.asString(PydevConsoleConstants.DEFAULT_CONSOLE_SYS_ERR_COLOR));

    node.put(PydevConsoleConstants.CONSOLE_PROMPT_COLOR,
            StringConverter.asString(PydevConsoleConstants.DEFAULT_CONSOLE_PROMPT_COLOR));

    node.put(PydevConsoleConstants.CONSOLE_BACKGROUND_COLOR,
            StringConverter.asString(PydevConsoleConstants.DEFAULT_CONSOLE_BACKGROUND_COLOR));

    node.put(PydevConsoleConstants.DEBUG_CONSOLE_BACKGROUND_COLOR,
            StringConverter.asString(PydevConsoleConstants.DEFAULT_DEBUG_CONSOLE_BACKGROUND_COLOR));

    node.put(PydevConsoleConstants.INTERACTIVE_CONSOLE_VM_ARGS,
            PydevConsoleConstants.DEFAULT_INTERACTIVE_CONSOLE_VM_ARGS);

    node.put(PydevConsoleConstants.INTERACTIVE_CONSOLE_ENCODING,
            PydevConsoleConstants.DEFAULT_INTERACTIVE_CONSOLE_ENCODING);

    node.put(PydevConsoleConstants.INITIAL_INTERPRETER_CMDS,
            PydevConsoleConstants.DEFAULT_INITIAL_INTERPRETER_CMDS);

    node.put(PydevConsoleConstants.DJANGO_INTERPRETER_CMDS, PydevConsoleConstants.DEFAULT_DJANGO_INTERPRETER_CMDS);

    node.putInt(PydevConsoleConstants.INTERACTIVE_CONSOLE_MAXIMUM_CONNECTION_ATTEMPTS,
            PydevConsoleConstants.DEFAULT_INTERACTIVE_CONSOLE_MAXIMUM_CONNECTION_ATTEMPTS);

    node.putBoolean(PydevConsoleConstants.INTERACTIVE_CONSOLE_FOCUS_ON_CONSOLE_START,
            PydevConsoleConstants.DEFAULT_INTERACTIVE_CONSOLE_FOCUS_ON_CONSOLE_START);

    node.putBoolean(PydevConsoleConstants.INTERACTIVE_CONSOLE_FOCUS_ON_SEND_COMMAND,
            PydevConsoleConstants.DEFAULT_INTERACTIVE_CONSOLE_FOCUS_ON_SEND_COMMAND);

    node.putBoolean(PydevConsoleConstants.INTERACTIVE_CONSOLE_TAB_COMPLETION,
            PydevConsoleConstants.DEFAULT_INTERACTIVE_CONSOLE_TAB_COMPLETION);

    node.putBoolean(PydevConsoleConstants.INTERACTIVE_CONSOLE_CONNECT_DEBUG_SESSION,
            PydevConsoleConstants.DEFAULT_INTERACTIVE_CONSOLE_CONNECT_DEBUG_SESSION);

    node.putBoolean(PydevConsoleConstants.INTERACTIVE_CONSOLE_SEND_INITIAL_COMMAND_WHEN_CREATED_FROM_EDITOR,
            PydevConsoleConstants.DEFAULT_INTERACTIVE_CONSOLE_SEND_INITIAL_COMMAND_WHEN_CREATED_FROM_EDITOR);

    node.put(PydevConsoleConstants.INTERACTIVE_CONSOLE_ENABLE_GUI_ON_STARTUP,
            PydevConsoleConstants.DEFAULT_INTERACTIVE_CONSOLE_ENABLE_GUI_ON_STARTUP);

    node.putBoolean(PydevConsoleConstants.INTERACTIVE_CONSOLE_UMD_ENABLED,
            PydevConsoleConstants.DEFAULT_INTERACTIVE_CONSOLE_UMD_ENABLED);

    node.putBoolean(PydevConsoleConstants.INTERACTIVE_CONSOLE_UMD_VERBOSE,
            PydevConsoleConstants.DEFAULT_INTERACTIVE_CONSOLE_UMD_VERBOSE);

    node.put(PydevConsoleConstants.INTERACTIVE_CONSOLE_UMD_EXCLUDE_MODULE_LIST,
            PydevConsoleConstants.DEFAULT_INTERACTIVE_CONSOLE_UMD_EXCLUDE_MODULE_LIST);
}
 
Example 19
Source File: PyDevCorePreferencesInitializer.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
public static void initializeDefaultPreferences() {
    Preferences node = DefaultScope.INSTANCE.getNode(SharedCorePlugin.DEFAULT_PYDEV_PREFERENCES_SCOPE);

    //ironpython
    node.put(IInterpreterManager.IRONPYTHON_INTERNAL_SHELL_VM_ARGS,
            IInterpreterManager.IRONPYTHON_DEFAULT_INTERNAL_SHELL_VM_ARGS);

    //text
    node.putBoolean(PyDevTypingPreferences.SMART_INDENT_PAR, PyDevTypingPreferences.DEFAULT_SMART_INDENT_PAR);
    node.putBoolean(PyDevTypingPreferences.AUTO_PAR, PyDevTypingPreferences.DEFAULT_AUTO_PAR);
    node.putBoolean(PyDevTypingPreferences.INDENT_AFTER_PAR_AS_PEP8,
            PyDevTypingPreferences.DEFAULT_INDENT_AFTER_PAR_AS_PEP8);
    node.putBoolean(PyDevTypingPreferences.AUTO_LINK, PyDevTypingPreferences.DEFAULT_AUTO_LINK);
    node.putBoolean(PyDevTypingPreferences.AUTO_INDENT_TO_PAR_LEVEL,
            PyDevTypingPreferences.DEFAULT_AUTO_INDENT_TO_PAR_LEVEL);
    node.putBoolean(PyDevTypingPreferences.AUTO_DEDENT_ELSE, PyDevTypingPreferences.DEFAULT_AUTO_DEDENT_ELSE);
    node.putInt(PyDevTypingPreferences.AUTO_INDENT_AFTER_PAR_WIDTH,
            PyDevTypingPreferences.DEFAULT_AUTO_INDENT_AFTER_PAR_WIDTH);
    node.putBoolean(PyDevTypingPreferences.AUTO_COLON, PyDevTypingPreferences.DEFAULT_AUTO_COLON);
    node.putBoolean(PyDevTypingPreferences.AUTO_BRACES, PyDevTypingPreferences.DEFAULT_AUTO_BRACES);
    node.putBoolean(PyDevTypingPreferences.AUTO_WRITE_IMPORT_STR,
            PyDevTypingPreferences.DEFAULT_AUTO_WRITE_IMPORT_STR);
    node.putBoolean(PyDevTypingPreferences.AUTO_LITERALS, PyDevTypingPreferences.DEFAULT_AUTO_LITERALS);
    node.putBoolean(PyDevTypingPreferences.SMART_LINE_MOVE, PyDevTypingPreferences.DEFAULT_SMART_LINE_MOVE);

    node.putInt(PyDevCoreEditorPreferences.TAB_WIDTH, PyDevCoreEditorPreferences.DEFAULT_TAB_WIDTH);

    //checkboxes
    node.putBoolean(PyDevCoreEditorPreferences.SUBSTITUTE_TABS, PyDevCoreEditorPreferences.DEFAULT_SUBSTITUTE_TABS);
    node.putBoolean(PyDevTypingPreferences.AUTO_ADD_SELF, PyDevTypingPreferences.DEFAULT_AUTO_ADD_SELF);
    node.putBoolean(PyDevCoreEditorPreferences.GUESS_TAB_SUBSTITUTION,
            PyDevCoreEditorPreferences.DEFAULT_GUESS_TAB_SUBSTITUTION);

    //code formatting
    node.putBoolean(PyFormatterPreferences.USE_ASSIGN_WITH_PACES_INSIDER_PARENTESIS,
            PyFormatterPreferences.DEFAULT_USE_ASSIGN_WITH_PACES_INSIDE_PARENTESIS);
    node.putBoolean(PyFormatterPreferences.USE_OPERATORS_WITH_SPACE,
            PyFormatterPreferences.DEFAULT_USE_OPERATORS_WITH_SPACE);
    node.putBoolean(PyFormatterPreferences.USE_SPACE_AFTER_COMMA,
            PyFormatterPreferences.DEFAULT_USE_SPACE_AFTER_COMMA);
    node.putBoolean(PyFormatterPreferences.ADD_NEW_LINE_AT_END_OF_FILE,
            PyFormatterPreferences.DEFAULT_ADD_NEW_LINE_AT_END_OF_FILE);
    node.putBoolean(PyFormatterPreferences.FORMAT_ONLY_CHANGED_LINES,
            PyFormatterPreferences.DEFAULT_FORMAT_ONLY_CHANGED_LINES);
    node.putBoolean(PyFormatterPreferences.TRIM_LINES, PyFormatterPreferences.DEFAULT_TRIM_LINES);
    node.putBoolean(PyFormatterPreferences.USE_SPACE_FOR_PARENTESIS,
            PyFormatterPreferences.DEFAULT_USE_SPACE_FOR_PARENTESIS);
    node.putInt(PyFormatterPreferences.SPACES_BEFORE_COMMENT,
            PyFormatterPreferences.DEFAULT_SPACES_BEFORE_COMMENT);
    node.putInt(PyFormatterPreferences.SPACES_IN_START_COMMENT,
            PyFormatterPreferences.DEFAULT_SPACES_IN_START_COMMENT);
    node.putBoolean(PyFormatterPreferences.MANAGE_BLANK_LINES,
            PyFormatterPreferences.DEFAULT_MANAGE_BLANK_LINES);
    node.putInt(PyFormatterPreferences.BLANK_LINES_TOP_LEVEL,
            PyFormatterPreferences.DEFAULT_BLANK_LINES_TOP_LEVEL);
    node.putInt(PyFormatterPreferences.BLANK_LINES_INNER,
            PyFormatterPreferences.DEFAULT_BLANK_LINES_INNER);
    node.put(PyFormatterPreferences.BLACK_FORMATTER_LOCATION_OPTION,
            PyFormatterPreferences.DEFAULT_BLACK_FORMATTER_LOCATION_OPTION);

    //file types
    node.put(FileTypesPreferences.VALID_SOURCE_FILES, FileTypesPreferences.DEFAULT_VALID_SOURCE_FILES);
    node.put(FileTypesPreferences.FIRST_CHOICE_PYTHON_SOURCE_FILE,
            FileTypesPreferences.DEFAULT_FIRST_CHOICE_PYTHON_SOURCE_FILE);

    //general interpreters
    node.putBoolean(InterpreterGeneralPreferences.NOTIFY_NO_INTERPRETER_PY,
            InterpreterGeneralPreferences.DEFAULT_NOTIFY_NO_INTERPRETER_PY);
    node.putBoolean(InterpreterGeneralPreferences.NOTIFY_NO_INTERPRETER_JY,
            InterpreterGeneralPreferences.DEFAULT_NOTIFY_NO_INTERPRETER_JY);
    node.putBoolean(InterpreterGeneralPreferences.NOTIFY_NO_INTERPRETER_IP,
            InterpreterGeneralPreferences.DEFAULT_NOTIFY_NO_INTERPRETER_IP);

    node.putBoolean(InterpreterGeneralPreferences.CHECK_CONSISTENT_ON_STARTUP,
            InterpreterGeneralPreferences.DEFAULT_CHECK_CONSISTENT_ON_STARTUP);

    node.putBoolean(InterpreterGeneralPreferences.UPDATE_INTERPRETER_INFO_ON_FILESYSTEM_CHANGES,
            InterpreterGeneralPreferences.DEFAULT_UPDATE_INTERPRETER_INFO_ON_FILESYSTEM_CHANGES);

}
 
Example 20
Source File: PyCodeCompletionInitializer.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void initializeDefaultPreferences() {
    Preferences node = DefaultScope.INSTANCE.getNode(SharedCorePlugin.DEFAULT_PYDEV_PREFERENCES_SCOPE);

    //use?
    node.putBoolean(PyCodeCompletionPreferences.USE_CODECOMPLETION,
            PyCodeCompletionPreferences.DEFAULT_USE_CODECOMPLETION);
    node.putBoolean(PyCodeCompletionPreferences.USE_CODE_COMPLETION_ON_DEBUG_CONSOLES,
            PyCodeCompletionPreferences.DEFAULT_USE_CODE_COMPLETION_ON_DEBUG_CONSOLES);
    node.putBoolean(PyCodeCompletionPreferences.MATCH_BY_SUBSTRING_IN_CODE_COMPLETION,
            PyCodeCompletionPreferences.DEFAULT_MATCH_BY_SUBSTRING_IN_CODE_COMPLETION);

    //Request
    node.putBoolean(PyCodeCompletionPreferences.AUTOCOMPLETE_ON_DOT,
            PyCodeCompletionPreferences.DEFAULT_AUTOCOMPLETE_ON_DOT);
    node.putBoolean(PyCodeCompletionPreferences.USE_AUTOCOMPLETE,
            PyCodeCompletionPreferences.DEFAULT_USE_AUTOCOMPLETE);
    node.putBoolean(PyCodeCompletionPreferences.AUTOCOMPLETE_ON_PAR,
            PyCodeCompletionPreferences.DEFAULT_AUTOCOMPLETE_ON_PAR);
    node.putBoolean(PyCodeCompletionPreferences.AUTOCOMPLETE_ON_ALL_ASCII_CHARS,
            PyCodeCompletionPreferences.DEFAULT_AUTOCOMPLETE_ON_ALL_ASCII_CHARS);
    node.putInt(PyCodeCompletionPreferences.MAX_MILLIS_FOR_COMPLETION,
            PyCodeCompletionPreferences.DEFAULT_MAX_MILLIS_FOR_COMPLETION);

    //When to apply
    node.putBoolean(PyCodeCompletionPreferences.APPLY_COMPLETION_ON_DOT,
            PyCodeCompletionPreferences.DEFAULT_APPLY_COMPLETION_ON_DOT);
    node.putBoolean(PyCodeCompletionPreferences.APPLY_COMPLETION_ON_LPAREN,
            PyCodeCompletionPreferences.DEFAULT_APPLY_COMPLETION_ON_LPAREN);
    node.putBoolean(PyCodeCompletionPreferences.APPLY_COMPLETION_ON_RPAREN,
            PyCodeCompletionPreferences.DEFAULT_APPLY_COMPLETION_ON_RPAREN);

    //others
    node.putInt(PyCodeCompletionPreferences.ATTEMPTS_CODECOMPLETION,
            PyCodeCompletionPreferences.DEFAULT_ATTEMPTS_CODECOMPLETION);
    node.putInt(PyCodeCompletionPreferences.AUTOCOMPLETE_DELAY,
            PyCodeCompletionPreferences.DEFAULT_AUTOCOMPLETE_DELAY);
    node.putInt(PyCodeCompletionPreferences.ARGUMENTS_DEEP_ANALYSIS_N_CHARS,
            PyCodeCompletionPreferences.DEFAULT_ARGUMENTS_DEEP_ANALYSIS_N_CHARS);
    node.putBoolean(PyCodeCompletionPreferences.PUT_LOCAL_IMPORTS_IN_TOP_OF_METHOD,
            PyCodeCompletionPreferences.DEFAULT_PUT_LOCAL_IMPORTS_IN_TOP_OF_METHOD);

    //Debug
    node.putBoolean(PyLoggingPreferences.DEBUG_CODE_COMPLETION,
            PyLoggingPreferences.DEFAULT_DEBUG_CODE_COMPLETION);
    node.putBoolean(PyLoggingPreferences.DEBUG_ANALYSIS_REQUESTS,
            PyLoggingPreferences.DEFAULT_DEBUG_ANALYSIS_REQUESTS);
    node.putBoolean(PyLoggingPreferences.DEBUG_INTERPRETER_AUTO_UPDATE,
            PyLoggingPreferences.DEFAULT_DEBUG_INTERPRETER_AUTO_UPDATE);

    // Code completion context insensitive
    node.putBoolean(PyCodeCompletionPreferences.USE_KEYWORDS_CODE_COMPLETION,
            PyCodeCompletionPreferences.DEFAULT_USE_KEYWORDS_CODE_COMPLETION);
    node.putBoolean(PyCodeCompletionPreferences.ADD_SPACE_WHEN_NEEDED,
            PyCodeCompletionPreferences.DEFAULT_ADD_SPACES_WHEN_NEEDED);
    node.putBoolean(PyCodeCompletionPreferences.ADD_SPACE_AND_COLON_WHEN_NEEDED,
            PyCodeCompletionPreferences.DEFAULT_ADD_SPACES_AND_COLON_WHEN_NEEDED);
    node.putBoolean(PyCodeCompletionPreferences.FORCE_PY3K_PRINT_ON_PY2,
            PyCodeCompletionPreferences.DEFAULT_FORCE_PY3K_PRINT_ON_PY2);
    node.put(PyCodeCompletionPreferences.KEYWORDS_CODE_COMPLETION,
            PyCodeCompletionPreferences.DEFAULT_KEYWORDS_CODE_COMPLETION);
    node.putInt(PyCodeCompletionPreferences.CHARS_FOR_CTX_INSENSITIVE_MODULES_COMPLETION,
            PyCodeCompletionPreferences.DEFAULT_CHARS_FOR_CTX_INSENSITIVE_MODULES_COMPLETION);
    node.putInt(PyCodeCompletionPreferences.CHARS_FOR_CTX_INSENSITIVE_TOKENS_COMPLETION,
            PyCodeCompletionPreferences.DEFAULT_CHARS_FOR_CTX_INSENSITIVE_TOKENS_COMPLETION);

}