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

The following examples show how to use org.eclipse.core.runtime.preferences.IEclipsePreferences#putLong() . 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: PreferenceUtils.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Sets the specific permissions used for new files created when transferring.
 * 
 * @param permissions
 *            permissions in decimal form
 * @param direction
 *            indicates if this is for upload or download permissions
 */
public static void setFilePermissions(long permissions, PermissionDirection direction)
{
	IEclipsePreferences prefs = EclipseUtil.instanceScope().getNode(CoreIOPlugin.PLUGIN_ID);
	switch (direction)
	{
		case UPLOAD:
			prefs.putLong(IPreferenceConstants.UPLOAD_FILE_PERMISSION, permissions);
			break;
		case DOWNLOAD:
			prefs.putLong(IPreferenceConstants.DOWNLOAD_FILE_PERMISSION, permissions);
			break;
	}
	try
	{
		prefs.flush();
	}
	catch (BackingStoreException e)
	{
		IdeLog.logError(CoreIOPlugin.getDefault(), e);
	}
}
 
Example 2
Source File: PreferenceUtils.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Sets the specific permissions used for new folders created when transferring.
 * 
 * @param permissions
 *            permissions in decimal form
 * @param direction
 *            indicates if this is for upload or download permissions
 */
public static void setFolderPermissions(long permissions, PermissionDirection direction)
{
	IEclipsePreferences prefs = EclipseUtil.instanceScope().getNode(CoreIOPlugin.PLUGIN_ID);
	switch (direction)
	{
		case UPLOAD:
			prefs.putLong(IPreferenceConstants.UPLOAD_FOLDER_PERMISSION, permissions);
			break;
		case DOWNLOAD:
			prefs.putLong(IPreferenceConstants.DOWNLOAD_FOLDER_PERMISSION, permissions);
			break;
	}
	try
	{
		prefs.flush();
	}
	catch (BackingStoreException e)
	{
		IdeLog.logError(CoreIOPlugin.getDefault(), 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(CoreIOPlugin.PLUGIN_ID);
	prefs.putBoolean(IPreferenceConstants.UPLOAD_UPDATE_PERMISSIONS, true);
	prefs.putBoolean(IPreferenceConstants.UPLOAD_SPECIFIC_PERMISSIONS, true);
	prefs.putLong(IPreferenceConstants.UPLOAD_FILE_PERMISSION, DEFAULT_FILE_PERMISSIONS);
	prefs.putLong(IPreferenceConstants.UPLOAD_FOLDER_PERMISSION, DEFAULT_DIRECTORY_PERMISSIONS);
	prefs.putBoolean(IPreferenceConstants.DOWNLOAD_UPDATE_PERMISSIONS, true);
	prefs.putBoolean(IPreferenceConstants.DOWNLOAD_SPECIFIC_PERMISSIONS, true);
	prefs.putLong(IPreferenceConstants.DOWNLOAD_FILE_PERMISSION, DEFAULT_FILE_PERMISSIONS);
	prefs.putLong(IPreferenceConstants.DOWNLOAD_FOLDER_PERMISSION, DEFAULT_DIRECTORY_PERMISSIONS);
	prefs.put(IPreferenceConstants.GLOBAL_CLOAKING_EXTENSIONS, DEFAULT_CLOAK_EXPRESSIONS);
}
 
Example 4
Source File: ThemeManager.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Set specific pref values that we use to listen for when the theme has changed across our plugins. This ignals to
 * them the theme has been changed and they need to update their settings to match.
 * 
 * @param theme
 */
private void notifyThemeChangeListeners(Theme theme)
{
	IEclipsePreferences prefs = EclipseUtil.instanceScope().getNode(ThemePlugin.PLUGIN_ID);
	prefs.put(IPreferenceConstants.ACTIVE_THEME, theme.getName());
	prefs.putLong(THEME_CHANGED, System.currentTimeMillis());
	try
	{
		prefs.flush();
	}
	catch (BackingStoreException e)
	{
		IdeLog.logError(ThemePlugin.getDefault(), e);
	}
}
 
Example 5
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 6
Source File: TraceTypePreferences.java    From tracecompass with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Set the Initial time range
 *
 * @param traceType
 *            the trace type
 * @param value
 *            the time range in ns
 * @since 4.2
 */
public static void setInitialTimeRange(String traceType, long value) {
    IEclipsePreferences configurationPreferences = getEclipsePreference();
    configurationPreferences.putLong(getTracePreferenceKey(traceType), value);
}
 
Example 7
Source File: GdtPreferences.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Sets the last update time in milliseconds.
 *
 * @param lastUpdateTimeMillis
 *          date of the last update time in milliseconds
 */
public static void setLastUpdateTimeMillis(long lastUpdateTimeMillis) {
  IEclipsePreferences configurationPreferences = getConfigurationPreferences();
  configurationPreferences.putLong(LAST_UPDATE_TIME_MILLIS, lastUpdateTimeMillis);
  flushPreferences(configurationPreferences);
}