Java Code Examples for org.eclipse.core.runtime.preferences.IEclipsePreferences#putDouble()

The following examples show how to use org.eclipse.core.runtime.preferences.IEclipsePreferences#putDouble() . 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: PreferenceInitializer.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void initializeDefaultPreferences()
{
	IEclipsePreferences prefs = EclipseUtil.defaultScope().getNode(CSSCorePlugin.PLUGIN_ID);

	prefs.putDouble(IPreferenceConstants.CSS_INDEX_VERSION, 0);

	// Set CSS Stylesheet validator to be on by default for reconcile, off for build, use default set of filters.
	prefs.putBoolean(PreferenceUtil.getEnablementPreferenceKey(CSSValidator.ID, BuildType.BUILD), false);
	prefs.putBoolean(PreferenceUtil.getEnablementPreferenceKey(CSSValidator.ID, BuildType.RECONCILE), true);
	prefs.put(PreferenceUtil.getFiltersKey(CSSValidator.ID),
			StringUtil.join(AbstractBuildParticipant.FILTER_DELIMITER, CSSValidator.DEFAULT_FILTERS));

	// Set up CSS Parser validator to be on for build and reconcile
	prefs.putBoolean(PreferenceUtil.getEnablementPreferenceKey(CSSParserValidator.ID, BuildType.BUILD), true);
	prefs.putBoolean(PreferenceUtil.getEnablementPreferenceKey(CSSParserValidator.ID, BuildType.BUILD), true);
}
 
Example 2
Source File: SVGMetadataLoader.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * updateVersionPreference
 */
private void updateVersionPreference()
{
	IEclipsePreferences prefs = (EclipseUtil.instanceScope()).getNode(SVGPlugin.PLUGIN_ID);

	prefs.putDouble(IPreferenceConstants.SVG_INDEX_VERSION, SVGIndexConstants.INDEX_VERSION);

	try
	{
		prefs.flush();
	}
	catch (BackingStoreException e)
	{
	}
}
 
Example 3
Source File: PreferenceInitializer.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void initializeDefaultPreferences()
{
	IEclipsePreferences prefs = (EclipseUtil.defaultScope()).getNode(SVGPlugin.PLUGIN_ID);

	prefs.putDouble(IPreferenceConstants.SVG_INDEX_VERSION, 0);
}
 
Example 4
Source File: BuildParticipantWorkingCopy.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private void setPreferences(IEclipsePreferences prefs, Map<String, ? extends Object> preferences)
{
	if (CollectionsUtil.isEmpty(preferences))
	{
		return;
	}

	for (Map.Entry<String, ? extends Object> entry : preferences.entrySet())
	{
		Object value = entry.getValue();
		if (value instanceof Boolean)
		{
			prefs.putBoolean(entry.getKey(), (Boolean) value);
		}
		else if (value instanceof Long)
		{
			prefs.putLong(entry.getKey(), (Long) value);
		}
		else if (value instanceof Integer)
		{
			prefs.putInt(entry.getKey(), (Integer) value);
		}
		else if (value instanceof Double)
		{
			prefs.putDouble(entry.getKey(), (Double) value);
		}
		else if (value != null)
		{
			prefs.put(entry.getKey(), value.toString());
		}
	}
}
 
Example 5
Source File: MetadataLoader.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Update the current metadata index version number so that it matches the value returned by getIndexVersion. This
 * is called once the metadata index has been updated
 */
protected void updateVersionPreference()
{
	IEclipsePreferences prefs = (EclipseUtil.instanceScope()).getNode(this.getPluginId());

	prefs.putDouble(this.getIndexVersionKey(), this.getIndexVersion());

	try
	{
		prefs.flush();
	}
	catch (BackingStoreException e)
	{
	}
}
 
Example 6
Source File: PreferenceInitializer.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void initializeDefaultPreferences()
{
	IEclipsePreferences prefs = (EclipseUtil.defaultScope()).getNode(HTMLPlugin.PLUGIN_ID);

	// prefs.putBoolean(com.aptana.editor.common.preferences.IPreferenceConstants.LINK_OUTLINE_WITH_EDITOR, true);
	prefs.putDouble(IPreferenceConstants.HTML_INDEX_VERSION, 0);
	prefs.put(
			com.aptana.editor.common.contentassist.IPreferenceConstants.COMPLETION_PROPOSAL_ACTIVATION_CHARACTERS,
			"</>=&'\" "); //$NON-NLS-1$
	prefs.putBoolean(IPreferenceConstants.HTML_AUTO_CLOSE_TAG_PAIRS, true);
	prefs.putBoolean(IPreferenceConstants.HTML_REMOTE_HREF_PROPOSALS,
			IPreferenceConstants.DEFAULT_REMOTE_HREF_PROPOSALS_VALUE);
	prefs.putBoolean(com.aptana.editor.common.preferences.IPreferenceConstants.EDITOR_AUTO_INDENT, true);
	prefs.putBoolean(com.aptana.editor.common.preferences.IPreferenceConstants.EDITOR_ENABLE_FOLDING, true);
	prefs.put(IPreferenceConstants.HTML_OUTLINE_TAG_ATTRIBUTES_TO_SHOW, DEFAULT_TAG_ATTRIBUTES_TO_SHOW);

	// mark occurrences
	// prefs.putBoolean(com.aptana.editor.common.preferences.IPreferenceConstants.EDITOR_MARK_OCCURRENCES, true);

	// Set Tidy validator to be on by default for reconcile
	prefs.putBoolean(PreferenceUtil.getEnablementPreferenceKey(HTMLTidyValidator.ID, BuildType.BUILD), false);
	prefs.putBoolean(PreferenceUtil.getEnablementPreferenceKey(HTMLTidyValidator.ID, BuildType.RECONCILE), true);
	prefs.putInt(HTMLTidyValidator.ProblemType.IdNameAttributeMismatch.getPrefKey(),
			IProblem.Severity.ERROR.intValue());

	// Set Parser Errors to be on by default for both
	prefs.putBoolean(PreferenceUtil.getEnablementPreferenceKey(HTMLParserValidator.ID, BuildType.BUILD), true);
	prefs.putBoolean(PreferenceUtil.getEnablementPreferenceKey(HTMLParserValidator.ID, BuildType.RECONCILE), true);
}
 
Example 7
Source File: PreferenceInitializer.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void initializeDefaultPreferences()
{
	IEclipsePreferences prefs = EclipseUtil.defaultScope().getNode(JSCorePlugin.PLUGIN_ID);

	prefs.putDouble(IPreferenceConstants.JS_INDEX_VERSION, 0);

	// Warn on missing semicolons
	prefs.put(IPreferenceConstants.PREF_MISSING_SEMICOLON_SEVERITY, IProblem.Severity.WARNING.id());

	// Set up JS Parser validator to be on for build and reconcile
	prefs.putBoolean(PreferenceUtil.getEnablementPreferenceKey(JSParserValidator.ID, BuildType.BUILD), true);
	prefs.putBoolean(PreferenceUtil.getEnablementPreferenceKey(JSParserValidator.ID, BuildType.RECONCILE), true);

	// Set up JSLint prefs
	// Set default options
	// @formatter:off
	prefs.put(IPreferenceConstants.JS_LINT_OPTIONS, "{\n" + //$NON-NLS-1$
			"  \"laxLineEnd\": true,\n" + //$NON-NLS-1$
			"  \"undef\": true,\n" + //$NON-NLS-1$
			"  \"browser\": true,\n" + //$NON-NLS-1$
			"  \"jscript\": true,\n" + //$NON-NLS-1$
			"  \"debug\": true,\n" + //$NON-NLS-1$
			"  \"maxerr\": 100000,\n" + //$NON-NLS-1$
			"  \"white\": true,\n" + //$NON-NLS-1$
			"  \"predef\": [\n" + //$NON-NLS-1$
			"    \"Ti\",\n" + //$NON-NLS-1$
			"    \"Titanium\",\n" + //$NON-NLS-1$
			"    \"alert\",\n" + //$NON-NLS-1$
			"    \"require\",\n" + //$NON-NLS-1$
			"    \"exports\",\n" + //$NON-NLS-1$
			"    \"native\",\n" + //$NON-NLS-1$
			"    \"implements\",\n" + //$NON-NLS-1$
			"  ]\n" + //$NON-NLS-1$
			"}"); //$NON-NLS-1$
	// @formatter:on

	// Set default JSLint filters
	String[] defaultJSLintFilters = new String[] {
			"Missing space between .+", "Unexpected '\\(space\\)'\\.", //$NON-NLS-1$ //$NON-NLS-2$
			"Expected '.+' at column \\d+, not column \\d+\\.", "Unexpected space between .+", "Expected exactly one space between .+" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
	prefs.put(PreferenceUtil.getFiltersKey(JSLintValidator.ID),
			PreferenceUtil.serializeFilters(defaultJSLintFilters));

	// Migrate the old filter prefs to new validator
	IEclipsePreferences cepPrefs = EclipseUtil.instanceScope().getNode("com.aptana.editor.common"); //$NON-NLS-1$
	String oldKey = MessageFormat.format("{0}:{1}", IJSConstants.CONTENT_TYPE_JS, //$NON-NLS-1$
			"com.aptana.editor.common.filterExpressions"); //$NON-NLS-1$
	String oldFilters = cepPrefs.get(oldKey, null);
	if (oldFilters != null)
	{
		try
		{
			String[] oldFilterArray = oldFilters.split(AbstractBuildParticipant.FILTER_DELIMITER);
			String[] combined = ArrayUtil.flatten(oldFilterArray, defaultJSLintFilters);

			IEclipsePreferences newPrefs = EclipseUtil.instanceScope().getNode(JSCorePlugin.PLUGIN_ID);
			newPrefs.put(PreferenceUtil.getFiltersKey(JSLintValidator.ID),
					PreferenceUtil.serializeFilters(combined));
			newPrefs.flush();
			cepPrefs.remove(oldKey);
		}
		catch (BackingStoreException e)
		{
			// ignore
		}
	}
}