Java Code Examples for org.eclipse.core.runtime.preferences.IEclipsePreferences

The following examples show how to use org.eclipse.core.runtime.preferences.IEclipsePreferences. These examples are extracted from open source projects. 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
public void close() throws JavaModelException {
	if (JavaProject.hasJavaNature(this.project)) {
		// Get cached preferences if exist
		JavaModelManager.PerProjectInfo perProjectInfo = JavaModelManager.getJavaModelManager().getPerProjectInfo(this.project, false);
		if (perProjectInfo != null && perProjectInfo.preferences != null) {
			IEclipsePreferences eclipseParentPreferences = (IEclipsePreferences) perProjectInfo.preferences.parent();
			if (this.preferencesNodeListener != null) {
				eclipseParentPreferences.removeNodeChangeListener(this.preferencesNodeListener);
				this.preferencesNodeListener = null;
			}
			if (this.preferencesChangeListener != null) {
				perProjectInfo.preferences.removePreferenceChangeListener(this.preferencesChangeListener);
				this.preferencesChangeListener = null;
			}
		}
	}
	super.close();
}
 
Example 2
Source Project: ice   Source File: ExecutableEntry.java    License: Eclipse Public License 1.0 6 votes vote down vote up
/**
 * This operation loads the ExecutableEntry from Eclipse Preferences. 
 * @param prefId
 */
public void loadFromPreferences(String prefId) {
	// Get the Application preferences
	IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(prefId);
	try {
		for (String key : prefs.keys()) {
			String pref = prefs.get(key, "");
			if (!pref.isEmpty()) {
				allowedValues.add(pref);
				allowedValueToURI.put(pref, URI.create(key));
			}
		}
	} catch (BackingStoreException e) {
		logger.error(getClass().getName() + " Exception!", e);
	}

	if (!allowedValues.isEmpty()) {
		allowedValues.add(0, "Select Application");
		setDefaultValue(allowedValues.get(0));
	} else {
		allowedValues.add("Import Application");
		setDefaultValue(allowedValues.get(0));
	}
}
 
Example 3
@Override
public void initializeDefaultPreferences()
{
	IEclipsePreferences prefs = EclipseUtil.defaultScope().getNode(CSSPlugin.PLUGIN_ID);

	// prefs.putBoolean(com.aptana.editor.common.preferences.IPreferenceConstants.LINK_OUTLINE_WITH_EDITOR, true);
	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(
			com.aptana.editor.common.contentassist.IPreferenceConstants.COMPLETION_PROPOSAL_ACTIVATION_CHARACTERS,
			".#:"); //$NON-NLS-1$
	prefs.put(
			com.aptana.editor.common.contentassist.IPreferenceConstants.CONTEXT_INFORMATION_ACTIVATION_CHARACTERS,
			"(,"); //$NON-NLS-1$
	prefs.put(com.aptana.editor.common.contentassist.IPreferenceConstants.PROPOSAL_TRIGGER_CHARACTERS,
			StringUtil.EMPTY);

	// mark occurrences
	// prefs.putBoolean(com.aptana.editor.common.preferences.IPreferenceConstants.EDITOR_MARK_OCCURRENCES, true);
}
 
Example 4
/**
 * Does its best at determining the default value for the given key. Checks
 * the given object's type and then looks in the list of defaults to see if
 * a value exists. If not or if there is a problem converting the value, the
 * default default value for that type is returned.
 *
 * @param key
 *            the key to search
 * @param obj
 *            the object who default we are looking for
 * @return Object or <code>null</code>
 */
Object getDefault(String key, Object obj) {
	IEclipsePreferences defaults = getDefaultPreferences();
	if (obj instanceof String) {
		return defaults.get(key, STRING_DEFAULT_DEFAULT);
	} else if (obj instanceof Integer) {
		return Integer.valueOf(defaults.getInt(key, INT_DEFAULT_DEFAULT));
	} else if (obj instanceof Double) {
		return Double.valueOf(defaults.getDouble(key, DOUBLE_DEFAULT_DEFAULT));
	} else if (obj instanceof Float) {
		return Float.valueOf(defaults.getFloat(key, FLOAT_DEFAULT_DEFAULT));
	} else if (obj instanceof Long) {
		return Long.valueOf(defaults.getLong(key, LONG_DEFAULT_DEFAULT));
	} else if (obj instanceof Boolean) {
		return defaults.getBoolean(key, BOOLEAN_DEFAULT_DEFAULT) ? Boolean.TRUE
				: Boolean.FALSE;
	} else {
		return null;
	}
}
 
Example 5
Source Project: tracecompass   Source File: FilterViewerTest.java    License: Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Initialization, creates a temp trace
 *
 * @throws IOException
 *             should not happen
 */
@BeforeClass
public static void init() throws IOException {
    IEclipsePreferences defaultPreferences = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID);
    defaultPreferences.put(ITmfTimePreferencesConstants.TIME_ZONE, "GMT-05:00");
    TmfTimestampFormat.updateDefaultFormats();

    SWTBotUtils.initialize();
    Thread.currentThread().setName("SWTBot Thread"); // for the debugger
    /* set up for swtbot */
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout()));
    fBot = new SWTWorkbenchBot();

    /* finish waiting for eclipse to load */
    WaitUtils.waitForJobs();
    fFileLocation = File.createTempFile("sample", ".xml");
    try (BufferedRandomAccessFile braf = new BufferedRandomAccessFile(fFileLocation, "rw")) {
        braf.writeBytes(TRACE_START);
        for (int i = 0; i < 100; i++) {
            braf.writeBytes(makeEvent(i * 100, i % 4));
        }
        braf.writeBytes(TRACE_END);
    }
}
 
Example 6
private void updateParallelBuild(int maxConcurrentBuilds) {
	IWorkspace workspace = ResourcesPlugin.getWorkspace();
	IWorkspaceDescription description = workspace.getDescription();
	if (description.getMaxConcurrentBuilds() == maxConcurrentBuilds) {
		return;
	}

	description.setMaxConcurrentBuilds(maxConcurrentBuilds);
	try {
		workspace.setDescription(description);
	} catch (CoreException e) {
		JavaLanguageServerPlugin.logException("Problems setting maxConcurrentBuilds from workspace.", e);
	}

	String stringValue = maxConcurrentBuilds != 1 ? Boolean.TRUE.toString() : Boolean.FALSE.toString();
	IEclipsePreferences pref = InstanceScope.INSTANCE.getNode(IMavenConstants.PLUGIN_ID);
	pref.put(MavenPreferenceConstants.P_BUILDER_USE_NULL_SCHEDULING_RULE, stringValue);
	pref = InstanceScope.INSTANCE.getNode(JavaCore.PLUGIN_ID);
}
 
Example 7
public void clearPreferences(IProject project)
{
	if (project != null)
	{
		// Save to the project scope
		IEclipsePreferences preferences = new ProjectScope(project).getNode(CommonEditorPlugin.PLUGIN_ID);
		preferences.remove(IPreferenceConstants.USER_AGENT_PREFERENCE);
		try
		{
			preferences.flush();
		}
		catch (BackingStoreException e)
		{
			// ignore
		}
	}
}
 
Example 8
/**
 * @param uiPrefs
 * @param allOptions
 */
private void addAll(IEclipsePreferences uiPrefs, Map<String, String> allOptions) {
	try {
		String[] keys= uiPrefs.keys();
		for (int i= 0; i < keys.length; i++) {
			String key= keys[i];
			String val= uiPrefs.get(key, null);
			if (val != null) {
				allOptions.put(key, val);
			}
		}
	} catch (BackingStoreException e) {
		// ignore
	}

}
 
Example 9
private void setPreferenceNodeId() {
	// a hack to ensure unit tests work in Eclipse and CLI builds on Mac
	Bundle bundle = Platform.getBundle(JDT_UI_PLUGIN);
	if (bundle != null && bundle.getState() != Bundle.ACTIVE) {
		// start the org.eclipse.jdt.ui plugin if it exists
		try {
			bundle.start();
		} catch (BundleException e) {
			JavaLanguageServerPlugin.logException(e.getMessage(), e);
		}
	}
	// if preferenceNodeId is already set, we have to nullify it
	// https://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=4c731bc9cc7e1cfd2e67746171aede8d7719e9c1
	JavaManipulation.setPreferenceNodeId(null);
	// Set the ID to use for preference lookups
	JavaManipulation.setPreferenceNodeId(IConstants.PLUGIN_ID);

	IEclipsePreferences fDefaultPreferenceStore = DefaultScope.INSTANCE.getNode(JavaManipulation.getPreferenceNodeId());
	fDefaultPreferenceStore.put(MembersOrderPreferenceCacheCommon.APPEARANCE_MEMBER_SORT_ORDER, DEFAULT_MEMBER_SORT_ORDER);
	fDefaultPreferenceStore.put(CodeGenerationSettingsConstants.CODEGEN_USE_OVERRIDE_ANNOTATION, Boolean.TRUE.toString());

	// initialize MembersOrderPreferenceCacheCommon used by BodyDeclarationRewrite
	MembersOrderPreferenceCacheCommon preferenceCache = JavaManipulationPlugin.getDefault().getMembersOrderPreferenceCacheCommon();
	preferenceCache.install();
}
 
Example 10
public IEclipsePreferences preApply(IEclipsePreferences node) {
	// the node does not need to be the root of the hierarchy
	Preferences root = node.node("/"); //$NON-NLS-1$
	try {
		// we must not create empty preference nodes, so first check if the node exists
		if (root.nodeExists(InstanceScope.SCOPE)) {
			Preferences instance = root.node(InstanceScope.SCOPE);
			// we must not create empty preference nodes, so first check if the node exists
			if (instance.nodeExists(JavaCore.PLUGIN_ID)) {
				cleanJavaCore(instance.node(JavaCore.PLUGIN_ID));
			}
		}
	} catch (BackingStoreException e) {
		// do nothing
	}
	return super.preApply(node);
}
 
Example 11
private void configureJDTCore() {
	// JDT settings
	IEclipsePreferences prefs = Util.getNode("org.eclipse.jdt.core"); // does all
	if(null == prefs) {
		return;
	}
	
	prefs.put("org.eclipse.jdt.core.compiler.problem.noEffectAssignment", "error");
	prefs.put("org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation", "warning");
	prefs.put("org.eclipse.jdt.core.compiler.problem.comparingIdentical", "error");
	prefs.put("org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod", "warning");
	prefs.put("org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable", "warning");
	prefs.put("org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments", "warning");
	
	configureSaveActions(prefs);
	Util.savePrefs(prefs);
}
 
Example 12
public void testIntegration() throws Exception {
    IEclipsePreferences preferences = new InMemoryEclipsePreferences();
    PyParserManager pyParserManager = PyParserManager.getPyParserManager(preferences);

    Document doc = new Document();
    PyEditStub pyEdit = new PyEditStub(doc, new PydevFileEditorInputStub());
    pyParserManager.attachParserTo(pyEdit);
    checkParserChanged(pyEdit, 1);

    doc.replace(0, 0, "\r\ntest");
    checkParserChanged(pyEdit, 2);

    pyParserManager.attachParserTo(pyEdit);
    checkParserChanged(pyEdit, 3);

    doc.replace(0, 0, "\r\ntest"); //after this change, only 1 reparse should be asked, as the editor and doc is the same
    checkParserChanged(pyEdit, 4);

    pyParserManager.notifyEditorDisposed(pyEdit);
    doc.replace(0, 0, "\r\ntest"); //after this change, only 1 reparse should be asked, as the editor and doc is the same
    waitABit();
    assertEquals(4, pyEdit.parserChanged);

    assertEquals(0, pyParserManager.getParsers().size());
}
 
Example 13
/**
 * Saves the 'use project settings' as a preference in the store using the
 * {@link #useProjectSettingsPreferenceName()} as the key. If not project specific, all affected keys are removed
 * from the project preferences.
 */
private void saveUseProjectSettings(boolean isProjectSpecific) throws IOException {
	final FixedScopedPreferenceStore store = (FixedScopedPreferenceStore) getPreferenceStore();
	if (!isProjectSpecific) {
		// remove all the keys (written by various field editors)
		IEclipsePreferences storePreferences = store.getStorePreferences();
		for (FieldEditor field : editors) {
			storePreferences.remove(field.getPreferenceName());
		}
		// Also remove the master key (i.e. use default/default == false when later reading).
		storePreferences.remove(useProjectSettingsPreferenceName());
	} else {
		store.setValue(useProjectSettingsPreferenceName(), Boolean.toString(isProjectSpecific));
	}
	store.save();
}
 
Example 14
/**
 * Dispose the preference store listener.
 */
private void disposePreferenceStoreListener() {

	IEclipsePreferences root = (IEclipsePreferences) Platform
			.getPreferencesService().getRootNode().node(
					Plugin.PLUGIN_PREFERENCE_SCOPE);
	try {
		if (!(root.nodeExists(nodeQualifier))) {
			return;
		}
	} catch (BackingStoreException e) {
		return;// No need to report here as the node won't have the
		// listener
	}

	IEclipsePreferences preferences = getStorePreferences();
	if (preferences == null) {
		return;
	}
	if (preferencesListener != null) {
		preferences.removePreferenceChangeListener(preferencesListener);
		preferencesListener = null;
	}
}
 
Example 15
Source Project: dsl-devkit   Source File: ValidPreferenceStore.java    License: Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Does its best at determining the default value for the given key. Checks
 * the given object's type and then looks in the list of defaults to see if
 * a value exists. If not or if there is a problem converting the value, the
 * default default value for that type is returned.
 *
 * @param key
 *          the key to search
 * @param object
 *          the object who default we are looking for
 * @return Object or <code>null</code>
 */
Object getDefault(final String key, final Object object) {
  final IEclipsePreferences defaults = getDefaultPreferences();
  if (object instanceof String) {
    return defaults.get(key, STRING_DEFAULT_DEFAULT);
  } else if (object instanceof Integer) {
    return Integer.valueOf(defaults.getInt(key, INT_DEFAULT_DEFAULT));
  } else if (object instanceof Double) {
    return new Double(defaults.getDouble(key, DOUBLE_DEFAULT_DEFAULT));
  } else if (object instanceof Float) {
    return new Float(defaults.getFloat(key, FLOAT_DEFAULT_DEFAULT));
  } else if (object instanceof Long) {
    return Long.valueOf(defaults.getLong(key, LONG_DEFAULT_DEFAULT));
  } else if (object instanceof Boolean) {
    return defaults.getBoolean(key, BOOLEAN_DEFAULT_DEFAULT) ? Boolean.TRUE : Boolean.FALSE;
  } else {
    return null;
  }
}
 
Example 16
public Hashtable getDefaultOptions(){

		Hashtable defaultOptions = new Hashtable(10);

		// see JavaCorePreferenceInitializer#initializeDefaultPluginPreferences() for changing default settings
		// If modified, also modify the method getDefaultOptionsNoInitialization()
		IEclipsePreferences defaultPreferences = getDefaultPreferences();

		// initialize preferences to their default
		Iterator iterator = this.optionNames.iterator();
		while (iterator.hasNext()) {
		    String propertyName = (String) iterator.next();
		    String value = defaultPreferences.get(propertyName, null);
		    if (value != null) defaultOptions.put(propertyName, value);
		}
		// get encoding through resource plugin
		defaultOptions.put(JavaCore.CORE_ENCODING, JavaCore.getEncoding());
		// backward compatibility
		addDeprecatedOptions(defaultOptions);

		return defaultOptions;
	}
 
Example 17
@Override
public void initializeDefaultPreferences()
{
	IEclipsePreferences node = DefaultScope.INSTANCE.getNode(FrameworkUtil.getBundle(getClass()).getSymbolicName());

	if (node != null)
	{
		node.put("rootPageValue", "DEFAULT ROOT PAGE VALUE");
		node.put("page1", "DEFAULT PAGE 1 VALUE");
		node.put("page2", "DEFAULT PAGE 2 VALUE");
	
		node.put("prefCombo", "value2");
		node.put("prefColor", StringConverter.asString(new RGB(0,255,0)));
		node.putBoolean("prefBoolean",true);
		node.put("prefString","Default string value");
		
		try { node.flush();  }  catch (BackingStoreException e) { }
	}		
	
	
	
}
 
Example 18
Source Project: goclipse   Source File: PreferenceHelper.java    License: Eclipse Public License 1.0 5 votes vote down vote up
@Override
public final void setInstanceScopeValue(T value) throws CommonException {
	IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(getQualifier());
	setPrefValue(prefs, value);
	try {
		prefs.flush();
	} catch(BackingStoreException e) {
		throwCommonException(e);
	}
}
 
Example 19
/**
 * initialize properties for direct access of node.js server (start an
 * internal process)
 * 
 * @param node
 */
private void initializeNodejsPreferences(IEclipsePreferences node) {
	// By default use the embedded Node.js install (if exists)
	if (!useBundledNodeJsEmbedded(node)) {
		// Use installed node.js in case there is no embedded install.
		node.putBoolean(TypeScriptCorePreferenceConstants.USE_NODEJS_EMBEDDED, false);
	} else {
		node.putBoolean(TypeScriptCorePreferenceConstants.USE_NODEJS_EMBEDDED, true);
	}
	node.put(TypeScriptCorePreferenceConstants.NODEJS_PATH, IDENodejsProcessHelper.getNodejsPath());
}
 
Example 20
private void initializeTypeScriptRuntimePreferences(IEclipsePreferences node,
		ITypeScriptRepository defaultRepository) {
	if (defaultRepository != null) {
		node.put(TypeScriptCorePreferenceConstants.EMBEDDED_TYPESCRIPT_ID, defaultRepository.getName());
		node.putBoolean(TypeScriptCorePreferenceConstants.USE_EMBEDDED_TYPESCRIPT, true);
	} else {
		node.putBoolean(TypeScriptCorePreferenceConstants.USE_EMBEDDED_TYPESCRIPT, false);
	}
	node.put(TypeScriptCorePreferenceConstants.INSTALLED_TYPESCRIPT_PATH, "");
}
 
Example 21
Source Project: APICloud-Studio   Source File: DialogUtils.java    License: GNU General Public License v3.0 5 votes vote down vote up
public static void setShouldShowDialog(String dialogKey, boolean shouldShow)
{
	final IEclipsePreferences prefs = (EclipseUtil.instanceScope()).getNode(UIEplPlugin.PLUGIN_ID);
	String[] keys = prefs.get(IEplPreferenceConstants.HIDDEN_MESSAGES, StringUtil.EMPTY).split(","); //$NON-NLS-1$
	Set<String> keysSet = CollectionsUtil.newSet(keys);

	if (shouldShow)
	{
		if (!keysSet.contains(dialogKey))
		{
			// Do nothing
			return;
		}
		keysSet.remove(dialogKey);
	}
	else
	{
		if (keysSet.contains(dialogKey))
		{
			// Do nothing
			return;
		}
		keysSet.add(dialogKey);
	}

	prefs.put(IEplPreferenceConstants.HIDDEN_MESSAGES, StringUtil.join(",", keysSet)); //$NON-NLS-1$
	try
	{
		prefs.flush();
	}
	catch (Exception e)
	{
		IdeLog.logError(UIPlugin.getDefault(), e);
	}
}
 
Example 22
Source Project: APICloud-Studio   Source File: UIPlugin.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * Remove the auto-build action listener.
 */
private void removeAutoBuildListener()
{
	if (autoBuildListener != null)
	{
		IEclipsePreferences node = EclipseUtil.instanceScope().getNode(ResourcesPlugin.PI_RESOURCES);
		node.removePreferenceChangeListener(autoBuildListener);
		autoBuildListener = null;
	}
}
 
Example 23
public static boolean hasProjectSpecificSettings(IScopeContext context, KeySet[] keySets) {
	for (int i= 0; i < keySets.length; i++) {
        KeySet keySet= keySets[i];
        IEclipsePreferences preferences= context.getNode(keySet.getNodeName());
        for (final Iterator<String> keyIter= keySet.getKeys().iterator(); keyIter.hasNext();) {
            final String key= keyIter.next();
            Object val= preferences.get(key, null);
            if (val != null) {
            	return true;
            }
           }
       }
	return false;
}
 
Example 24
Source Project: xds-ide   Source File: PreferenceKey.java    License: Eclipse Public License 1.0 5 votes vote down vote up
private IEclipsePreferences getNode(IScopeContext context, IWorkingCopyManager manager) {
    IEclipsePreferences node= context.getNode(fQualifier);
    if (manager != null) {
        return manager.getWorkingCopy(node);
    }
    return node;
}
 
Example 25
@Test
public void testStaticFavoriteImports_field() {
  try {
    final String defaultprefs = PreferenceConstants.getPreference(PreferenceConstants.CODEASSIST_FAVORITE_STATIC_MEMBERS, null);
    final IEclipsePreferences jdtPreference = InstanceScope.INSTANCE.getNode(JavaUI.ID_PLUGIN);
    try {
      String _name = StaticClassExample.class.getName();
      String _plus = (_name + ".*");
      jdtPreference.put(PreferenceConstants.CODEASSIST_FAVORITE_STATIC_MEMBERS, _plus);
      ContentAssistProcessorTestBuilder _newBuilder = this.newBuilder();
      StringConcatenation _builder = new StringConcatenation();
      _builder.append("package mypack");
      _builder.newLine();
      _builder.append("class Bar{");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("def void foo(){");
      _builder.newLine();
      ContentAssistProcessorTestBuilder _applyProposal = _newBuilder.append(_builder.toString()).applyProposal("STATICFIELD");
      StringConcatenation _builder_1 = new StringConcatenation();
      _builder_1.append("package mypack");
      _builder_1.newLine();
      _builder_1.newLine();
      _builder_1.append("import static org.eclipse.xtend.ide.tests.data.contentassist.StaticClassExample.STATICFIELD");
      _builder_1.newLine();
      _builder_1.newLine();
      _builder_1.append("class Bar{");
      _builder_1.newLine();
      _builder_1.append("\t");
      _builder_1.append("def void foo(){");
      _builder_1.newLine();
      _builder_1.append("STATICFIELD");
      _applyProposal.expectContent(_builder_1.toString());
    } finally {
      jdtPreference.put(PreferenceConstants.CODEASSIST_FAVORITE_STATIC_MEMBERS, defaultprefs);
    }
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
Example 26
public static void setGwtMavenModuleShortName(IProject project, String gwtMavenModuleShortName)
    throws BackingStoreException {
  IEclipsePreferences prefs = getProjectProperties(project);
  if (gwtMavenModuleShortName == null) {
    try {
      prefs.remove(GWT_MAVEN_MODULE_SHORT_NAME);
    } catch (Exception e) {
      e.printStackTrace();
    }
  } else {
    prefs.put(GWT_MAVEN_MODULE_SHORT_NAME, gwtMavenModuleShortName);
    prefs.flush();
  }
}
 
Example 27
Source Project: Pydev   Source File: ScopedPreferences.java    License: Eclipse Public License 1.0 5 votes vote down vote up
@Override
public String getString(IEclipsePreferences instancePreferences, IEclipsePreferences defaultPreferences,
        String keyInPreferenceStore,
        IAdaptable adaptable) {
    Object object = getFromProjectOrUserSettings(keyInPreferenceStore, adaptable);
    if (object != null) {
        return object.toString();
    }
    // Ok, not in project or user settings: get it from the workspace settings.
    return instancePreferences.get(keyInPreferenceStore, defaultPreferences.get(keyInPreferenceStore, ""));
}
 
Example 28
Source Project: APICloud-Studio   Source File: Theme.java    License: GNU General Public License v3.0 5 votes vote down vote up
private void delete(IScopeContext context)
{
	try
	{
		IEclipsePreferences prefs = context.getNode(ThemePlugin.PLUGIN_ID);
		Preferences preferences = prefs.node(ThemeManager.THEMES_NODE);
		preferences.remove(getName());
		preferences.flush();
	}
	catch (BackingStoreException e)
	{
		IdeLog.logError(ThemePlugin.getDefault(), e);
	}
}
 
Example 29
Source Project: Pydev   Source File: ScopedPreferences.java    License: Eclipse Public License 1.0 5 votes vote down vote up
@Override
public boolean getBoolean(IEclipsePreferences instancePreferences, IEclipsePreferences defaultPreferences,
        String keyInPreferenceStore, IAdaptable adaptable) {
    Object object = getFromProjectOrUserSettings(keyInPreferenceStore, adaptable);
    if (object != null) {
        return toBoolean(object);
    }
    // Ok, not in project or user settings: get it from the workspace settings.
    return instancePreferences.getBoolean(keyInPreferenceStore,
            defaultPreferences.getBoolean(keyInPreferenceStore, false));
}
 
Example 30
/**
 * Ends the recording process. No other changes to the preference tree are
 * recorded after this method is called.
 * 
 * @throws IllegalStateException if {@code startRecording()} had not been
 *         previously called, or if recording has already completed on this
 *         object.
 */
public void endRecording() {
  synchronized (lock) {
    Preconditions.checkState(currState == State.RECORDING, "Recorder object is not currently recording");

    currState = State.COMPLETE;

    for (IEclipsePreferences node : recordedNodes) {
      node.removeNodeChangeListener(listener);
      node.removePreferenceChangeListener(listener);
    }

    recordedNodes.clear();
  }
}