Java Code Examples for org.eclipse.core.runtime.preferences.InstanceScope#INSTANCE

The following examples show how to use org.eclipse.core.runtime.preferences.InstanceScope#INSTANCE . 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: CleanUpPreferenceUtil.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public static Map<String, String> loadSaveParticipantOptions(IScopeContext context) {
	IEclipsePreferences node;
	if (hasSettingsInScope(context)) {
		node= context.getNode(JavaUI.ID_PLUGIN);
	} else {
		IScopeContext instanceScope= InstanceScope.INSTANCE;
		if (hasSettingsInScope(instanceScope)) {
			node= instanceScope.getNode(JavaUI.ID_PLUGIN);
		} else {
			return JavaPlugin.getDefault().getCleanUpRegistry().getDefaultOptions(CleanUpConstants.DEFAULT_SAVE_ACTION_OPTIONS).getMap();
		}
	}

	Map<String, String> result= new HashMap<String, String>();
	Set<String> keys= JavaPlugin.getDefault().getCleanUpRegistry().getDefaultOptions(CleanUpConstants.DEFAULT_SAVE_ACTION_OPTIONS).getKeys();
	for (Iterator<String> iterator= keys.iterator(); iterator.hasNext();) {
        String key= iterator.next();
        result.put(key, node.get(SAVE_PARTICIPANT_KEY_PREFIX + key, CleanUpOptions.FALSE));
       }

	return result;
}
 
Example 2
Source File: UIUtil.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public static Color getEclipseEditorBackground( )
{
	ScopedPreferenceStore preferenceStore = new ScopedPreferenceStore( InstanceScope.INSTANCE,
			"org.eclipse.ui.editors" );//$NON-NLS-1$
	Color color = null;
	if ( preferenceStore != null )
	{
		color = preferenceStore.getBoolean( AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT ) ? null
				: createColor( preferenceStore,
						AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND,
						Display.getCurrent( ) );
	}
	if ( color == null )
	{
		color = Display.getDefault( )
				.getSystemColor( SWT.COLOR_LIST_BACKGROUND );
	}
	return color;
}
 
Example 3
Source File: EclipseRefreshAndBuildHandler.java    From hybris-commerce-eclipse-plugin with Apache License 2.0 5 votes vote down vote up
protected boolean isAutoBuildEnabled()
{
	IPreferencesService service = Platform.getPreferencesService();
	String qualifier = ResourcesPlugin.getPlugin().getBundle().getSymbolicName();
	String key = "description.autobuilding";
	IScopeContext[] contexts = { InstanceScope.INSTANCE, ConfigurationScope.INSTANCE };
	return service.getBoolean(qualifier, key, false, contexts);
}
 
Example 4
Source File: SearchLabelProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public SearchLabelProvider(JavaSearchResultPage page) {
	super(DEFAULT_SEARCH_TEXTFLAGS, DEFAULT_SEARCH_IMAGEFLAGS);
	addLabelDecorator(new ProblemsLabelDecorator(null));

	fPage= page;
	fLabelProviderMap= new HashMap<IMatchPresentation, ILabelProvider>(5);

	fSearchPreferences= new ScopedPreferenceStore(InstanceScope.INSTANCE, NewSearchUI.PLUGIN_ID);
	fSearchPropertyListener= new IPropertyChangeListener() {
		public void propertyChange(PropertyChangeEvent event) {
			doSearchPropertyChange(event);
		}
	};
	fSearchPreferences.addPropertyChangeListener(fSearchPropertyListener);
}
 
Example 5
Source File: SynchronizePlatformWizard.java    From hybris-commerce-eclipse-plugin with Apache License 2.0 5 votes vote down vote up
protected boolean isAutoBuildEnabled()
{
	IPreferencesService service = Platform.getPreferencesService();
	String qualifier = ResourcesPlugin.getPlugin().getBundle().getSymbolicName();
	String key = "description.autobuilding";
	IScopeContext[] contexts = { InstanceScope.INSTANCE, ConfigurationScope.INSTANCE};
	return service.getBoolean( qualifier, key, false, contexts );
}
 
Example 6
Source File: PreferenceConstants.java    From uml2solidity with Eclipse Public License 1.0 5 votes vote down vote up
public static IPreferenceStore getPreferenceStore(IProject project) {
	if (project != null) {
		IPreferenceStore store = new ScopedPreferenceStore(new ProjectScope(project), Activator.PLUGIN_ID);
		if(store.getBoolean(PreferenceConstants.COMPILER_PROJECT_SETTINGS)|| store.getBoolean(PreferenceConstants.BUILDER_PROJECT_SETTINGS))
		return store;
	}
	return new ScopedPreferenceStore(InstanceScope.INSTANCE, Activator.PLUGIN_ID);//Activator.PLUGIN_ID);
}
 
Example 7
Source File: LineSeparators.java    From eclipse-encoding-plugin with Eclipse Public License 1.0 5 votes vote down vote up
public static String ofWorkspace() {
	IPreferencesService prefs = Platform.getPreferencesService();
	IScopeContext[] scopeContext = new IScopeContext[] { InstanceScope.INSTANCE };
	String lineSeparator = prefs.getString(Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR, null, scopeContext);
	if (lineSeparator == null) {
		lineSeparator = System.getProperty("line.separator");
	}
	return toLabel(lineSeparator);
}
 
Example 8
Source File: AbstractDeclarativeValidValidator.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * @return the preference store (based on Scopes, but without UI) for that validator.
 */
protected ValidPreferenceStore getValidPreferenceStore() {
  // we use this pattern because we cannot create the ValidPreferenceStore inside the constructor,
  // because the languageName in getPreferenceStoreName may not be initialized yet if it is injected.
  if (validPreferenceStore == null) {
    validPreferenceStore = new ValidPreferenceStore(InstanceScope.INSTANCE, getPreferenceStoreName());
  }
  return validPreferenceStore;
}
 
Example 9
Source File: Util.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Returns the line separator found in the given text.
 * If it is null, or not found return the line delimiter for the given project.
 * If the project is null, returns the line separator for the workspace.
 * If still null, return the system line separator.
 */
public static String getLineSeparator(String text, IJavaProject project) {
	String lineSeparator = null;

	// line delimiter in given text
	if (text != null && text.length() != 0) {
		lineSeparator = findLineSeparator(text.toCharArray());
		if (lineSeparator != null)
			return lineSeparator;
	}

	if (Platform.isRunning()) {
		// line delimiter in project preference
		IScopeContext[] scopeContext;
		if (project != null) {
			scopeContext= new IScopeContext[] { new ProjectScope(project.getProject()) };
			lineSeparator= Platform.getPreferencesService().getString(Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR, null, scopeContext);
			if (lineSeparator != null)
				return lineSeparator;
		}

		// line delimiter in workspace preference
		scopeContext= new IScopeContext[] { InstanceScope.INSTANCE };
		lineSeparator = Platform.getPreferencesService().getString(Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR, null, scopeContext);
		if (lineSeparator != null)
			return lineSeparator;
	}

	// system line delimiter
	return org.eclipse.jdt.internal.compiler.util.Util.LINE_SEPARATOR;
}
 
Example 10
Source File: AbstractValidPreferencePage.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Instantiates a new valid preference page for a given Xtext language.
 *
 * @param languageName
 *          the language name
 * @param fileExtensions
 *          the file extensions
 */
@Inject
public AbstractValidPreferencePage(@Named(Constants.LANGUAGE_NAME) final String languageName, @Named(Constants.FILE_EXTENSIONS) final String fileExtensions) {
  super();
  this.languageName = languageName;
  this.fileExtensions = fileExtensions;

  preferences = new ScopedPreferenceStore(InstanceScope.INSTANCE, getPreferenceStoreName());
  setPreferenceStore(preferences);
}
 
Example 11
Source File: GSPreferencePage.java    From slr-toolkit with Eclipse Public License 1.0 4 votes vote down vote up
public GSPreferencePage() {
	super(GRID);
	IPreferenceStore store = new ScopedPreferenceStore( InstanceScope.INSTANCE, "de.tudresden.slr.googlescholar");
	setPreferenceStore(store);
	setDescription("Preferences for the Google Scholar Import Feature of SLR Toolkit");
}
 
Example 12
Source File: Activator.java    From EasyShell with Eclipse Public License 2.0 4 votes vote down vote up
public IPreferenceStore getPreferenceStoreByVersion(String version) {
    String pluginNodeName = getBundle().getSymbolicName();
    return new ScopedPreferenceStore(InstanceScope.INSTANCE, pluginNodeName + "/" + version, pluginNodeName);
}
 
Example 13
Source File: Activator.java    From EasyShell with Eclipse Public License 2.0 4 votes vote down vote up
public IPreferenceStore getLegacyPreferenceStore() {
    String pluginNodeName = "com.tetrade.eclipse.plugins.easyshell";
    return new ScopedPreferenceStore(InstanceScope.INSTANCE, pluginNodeName, pluginNodeName);
}
 
Example 14
Source File: TestPreferencesRule.java    From google-cloud-eclipse with Apache License 2.0 4 votes vote down vote up
public IPreferenceStore getPreferenceStore() {
  return new ScopedPreferenceStore(InstanceScope.INSTANCE, storeId);
}
 
Example 15
Source File: CloudSdkPreferences.java    From google-cloud-eclipse with Apache License 2.0 4 votes vote down vote up
static IPreferenceStore getPreferenceStore() {
  return new ScopedPreferenceStore(InstanceScope.INSTANCE, BUNDLEID);
}
 
Example 16
Source File: MyPStoreProvider.java    From e4Preferences with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public IPreferenceStore getPreferenceStore()
{
	System.out.println("Use my preference Store for this plugin");
	return new ScopedPreferenceStore(InstanceScope.INSTANCE, "com.opcoach.e4.preferences.provider.example");
}
 
Example 17
Source File: PreferenceInitializer.java    From slr-toolkit with Eclipse Public License 1.0 4 votes vote down vote up
public void initializeDefaultPreferences() {
	System.out.println("init preferences");
	IPreferenceStore store = new ScopedPreferenceStore( InstanceScope.INSTANCE, "de.tudresden.slr.googlescholar");
	store.setValue(PreferenceConstants.P_MAX_WAIT, 30000);
	store.setValue(PreferenceConstants.P_MIN_WAIT, 5000);
}
 
Example 18
Source File: PreferenceInitializer.java    From uml2solidity with Eclipse Public License 1.0 4 votes vote down vote up
public void initializeDefaultPreferences() {
	IPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, Activator.PLUGIN_ID);
	
	store.setDefault(PreferenceConstants.GENERATE_HTML, true);
	store.setDefault(PreferenceConstants.GENERATE_CONTRACT_FILES, true);
	store.setDefault(PreferenceConstants.GENERATION_ALL_IN_ONE_FILE, false);
	store.setDefault(PreferenceConstants.GENERATE_MIX, true);
	store.setDefault(PreferenceConstants.GENERATE_WEB3, true);
	store.setDefault(PreferenceConstants.GENERATE_MARKDOWN, true);
	store.setDefault(PreferenceConstants.GENERATION_TARGET, "mix");
	store.setDefault(PreferenceConstants.GENERATION_TARGET_DOC, "doc");
	store.setDefault(PreferenceConstants.GENERATE_JS_CONTROLLER, true);
	store.setDefault(PreferenceConstants.GENERATE_JS_CONTROLLER_TARGET, "mix/js");
	store.setDefault(PreferenceConstants.GENERATE_JS_TEST, true);
	store.setDefault(PreferenceConstants.GENERATE_JS_TEST_TARGET, "mix/test");
	store.setDefault(PreferenceConstants.GENERATE_ABI_TARGET, "mix/abi");
	store.setDefault(PreferenceConstants.GENERATE_ABI, true);
	store.setDefault(PreferenceConstants.VERSION_PRAGMA, "pragma solidity ^0.4.0;");

	store.setDefault(PreferenceConstants.GENERATOR_PROJECT_SETTINGS, false);
	
	store.setDefault(PreferenceConstants.JS_FILE_HEADER, "// file header");
	store.setDefault(PreferenceConstants.CONTRACT_FILE_HEADER, "/*\n*\n*\n*/");
	
	store.setDefault(PreferenceConstants.GENERATE_JAVA_INTERFACE, true);
	store.setDefault(PreferenceConstants.GENERATE_JAVA_NONBLOCKING, false);
	store.setDefault(PreferenceConstants.GENERATION_JAVA_INTERFACE_TARGET, "src/");
	store.setDefault(PreferenceConstants.GENERATE_JAVA_TESTS, true);
	store.setDefault(PreferenceConstants.GENERATION_JAVA_TEST_TARGET, "test/");
	
	store.setDefault(PreferenceConstants.GENERATION_JAVA_2_SOLIDITY_TYPES, 
			"string,uint,uint256,int,address,bool,byte,bytes32");
	store.setDefault(PreferenceConstants.GENERATION_JAVA_2_SOLIDITY_TYPE_PREFIX+"string", "String");
	store.setDefault(PreferenceConstants.GENERATION_JAVA_2_SOLIDITY_TYPE_PREFIX+"uint", "Integer");
	store.setDefault(PreferenceConstants.GENERATION_JAVA_2_SOLIDITY_TYPE_PREFIX+"uint256", "Integer");
	store.setDefault(PreferenceConstants.GENERATION_JAVA_2_SOLIDITY_TYPE_PREFIX+"address", "org.adridadou.ethereum.propeller.values.EthAddress");
	store.setDefault(PreferenceConstants.GENERATION_JAVA_2_SOLIDITY_TYPE_PREFIX+"bool", "Boolean");
	store.setDefault(PreferenceConstants.GENERATION_JAVA_2_SOLIDITY_TYPE_PREFIX+"int", "Integer");
	store.setDefault(PreferenceConstants.GENERATION_JAVA_2_SOLIDITY_TYPE_PREFIX+"real", "Double");
	store.setDefault(PreferenceConstants.GENERATION_JAVA_2_SOLIDITY_TYPE_PREFIX+"byte", "Byte");
	store.setDefault(PreferenceConstants.GENERATION_JAVA_2_SOLIDITY_TYPE_PREFIX+"bytes32", "Byte[]");
}
 
Example 19
Source File: LaunchPreferences.java    From eclipse-extras with Eclipse Public License 1.0 4 votes vote down vote up
public static IPreferenceStore getPluginPreferenceStore() {
  return new ScopedPreferenceStore( InstanceScope.INSTANCE, LaunchExtrasPlugin.PLUGIN_ID );
}
 
Example 20
Source File: DartPreferenceInitializerTest.java    From dartboard with Eclipse Public License 2.0 4 votes vote down vote up
@Before
public void setup() {
	DART_SDK_LOC = Platform.getOS().equals(Platform.OS_WIN32) ? "C:\\Program Files\\Dart\\dart-sdk" : "/usr/lib/dart";
	preferenceStore = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.eclipse.dartboard");
	DefaultPreferences.resetPreferences(preferenceStore);
}