Java Code Examples for org.eclipse.core.runtime.Preferences#isDefault()

The following examples show how to use org.eclipse.core.runtime.Preferences#isDefault() . 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: PreferenceWrapper.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public void setValue( String name, double value )
{
	double oldValue = getDouble( name );
	if ( this.preferenceType == SPECIAL_TYPE && project != null )
	{
		Preferences preference = prefs.getReportPreference( project );
		if ( preference != null )
		{
			if ( preference.isDefault( name ) || oldValue != value )
			{
				preference.setValue( name, value );
				firePreferenceChangeEvent( name,
						new Double( oldValue ),
						new Double( value ) );
			}
			return;
		}
	}
	if ( oldValue != value )
	{
		prefsStore.setValue( name, value );
		firePreferenceChangeEvent( name,
				new Double( oldValue ),
				new Double( value ) );
	}
}
 
Example 2
Source File: PreferenceWrapper.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public void setValue( String name, float value )
{
	float oldValue = getFloat( name );
	if ( this.preferenceType == SPECIAL_TYPE && project != null )
	{
		Preferences preference = prefs.getReportPreference( project );
		if ( preference != null )
		{
			if ( preference.isDefault( name ) || oldValue != value )
			{
				preference.setValue( name, value );
				firePreferenceChangeEvent( name,
						new Float( oldValue ),
						new Float( value ) );
			}
			return;
		}
	}
	if ( oldValue != value )
	{
		prefsStore.setValue( name, value );
		firePreferenceChangeEvent( name,
				new Float( oldValue ),
				new Float( value ) );
	}
}
 
Example 3
Source File: PreferenceWrapper.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public void setValue( String name, int value )
{
	int oldValue = getInt( name );
	if ( this.preferenceType == SPECIAL_TYPE && project != null )
	{
		Preferences preference = prefs.getReportPreference( project );
		if ( preference != null )
		{
			if ( preference.isDefault( name ) || oldValue != value )
			{
				preference.setValue( name, value );
				firePreferenceChangeEvent( name,
						Integer.valueOf( oldValue ),
						Integer.valueOf( value ) );
			}
			return;
		}
	}
	if ( oldValue != value )
	{
		prefsStore.setValue( name, value );
		firePreferenceChangeEvent( name,
				Integer.valueOf( oldValue ),
				Integer.valueOf( value ) );
	}
}
 
Example 4
Source File: PreferenceWrapper.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public void setValue( String name, long value )
{
	long oldValue = getLong( name );
	if ( this.preferenceType == SPECIAL_TYPE && project != null )
	{
		Preferences preference = prefs.getReportPreference( project );
		if ( preference != null )
		{
			if ( preference.isDefault( name ) || oldValue != value )
			{
				preference.setValue( name, value );
				firePreferenceChangeEvent( name,
						Long.valueOf( oldValue ),
						Long.valueOf( value ) );
			}
			return;
		}
	}
	if ( oldValue != value )
	{
		prefsStore.setValue( name, value );
		firePreferenceChangeEvent( name,
				Long.valueOf( oldValue ),
				Long.valueOf( value ) );
	}
}
 
Example 5
Source File: PreferenceWrapper.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public void setValue( String name, String value )
{
	String oldValue = getString( name );
	if ( this.preferenceType == SPECIAL_TYPE && project != null )
	{
		Preferences preference = prefs.getReportPreference( project );
		if ( preference != null )
		{
			if ( preference.isDefault( name ) || !oldValue.equals( value ) )
			{
				preference.setValue( name, value );
				firePreferenceChangeEvent( name, oldValue, value );
			}
			return;
		}
	}
	if ( !oldValue.equals( value ) )
	{
		prefsStore.setValue( name, value );
		firePreferenceChangeEvent( name, oldValue, value );
	}
}
 
Example 6
Source File: PreferenceWrapper.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public void setValue( String name, boolean value )
{
	boolean oldValue = getBoolean( name );
	if ( this.preferenceType == SPECIAL_TYPE && project != null )
	{
		Preferences preference = prefs.getReportPreference( project );
		if ( preference != null )
		{
			if ( preference.isDefault( name ) || oldValue != value )
			{
				preference.setValue( name, value );
				firePreferenceChangeEvent( name,
						Boolean.valueOf( oldValue ),
						Boolean.valueOf( value ) );
			}
			return;
		}
	}
	if ( oldValue != value )
	{
		prefsStore.setValue( name, value );
		firePreferenceChangeEvent( name,
				Boolean.valueOf( oldValue ),
				Boolean.valueOf( value ) );
	}
}
 
Example 7
Source File: IDEReportPreferenceFactory.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public boolean hasSpecialSettings( Object adaptable, String name )
{
	IProject project = getProject( adaptable );
	if ( project == null )
		return false;
	else
	{
		Preferences preference = getReportPreference( adaptable );
		if ( preference != null )
			return !preference.isDefault( name );
		else
			return false;
	}
}
 
Example 8
Source File: MultiPageEditorContributor.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the uima pref string.
 *
 * @param key the key
 * @param defaultValue the default value
 * @return the uima pref string
 */
private static String getUimaPrefString(String key, String defaultValue) {
  TAEConfiguratorPlugin plugin = TAEConfiguratorPlugin.getDefault();
  Preferences prefs = plugin.getPluginPreferences();
  boolean isDefault = prefs.isDefault(key);
  if (isDefault)
    prefs.setDefault(key, defaultValue);
  return prefs.getString(key);
}
 
Example 9
Source File: MultiPageEditorContributor.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the uima pref boolean.
 *
 * @param key the key
 * @param defaultValue the default value
 * @return the uima pref boolean
 */
private static boolean getUimaPrefBoolean(String key, boolean defaultValue) {
  TAEConfiguratorPlugin plugin = TAEConfiguratorPlugin.getDefault();
  Preferences prefs = plugin.getPluginPreferences();
  boolean isDefault = prefs.isDefault(key);
  if (isDefault)
    prefs.setDefault(key, defaultValue);
  return prefs.getBoolean(key);
}
 
Example 10
Source File: MultiPageEditorContributor.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the uima pref int.
 *
 * @param key the key
 * @param defaultValue the default value
 * @return the uima pref int
 */
private static int getUimaPrefInt(String key, int defaultValue) {
  TAEConfiguratorPlugin plugin = TAEConfiguratorPlugin.getDefault();
  Preferences prefs = plugin.getPluginPreferences();
  boolean isDefault = prefs.isDefault(key);
  if (isDefault)
    prefs.setDefault(key, defaultValue);
  return prefs.getInt(key);
}