Search in sources :

Example 56 with Preferences

use of org.osgi.service.prefs.Preferences in project azure-tools-for-java by Microsoft.

the class PreferenceUtil method getPreferenceKeys.

public static String[] getPreferenceKeys() {
    String[] keys = null;
    try {
        Preferences prefs = PluginUtil.getPrefs(com.microsoft.azuretools.core.utils.Messages.prefFileName);
        keys = prefs.keys();
    } catch (BackingStoreException e) {
        Activator.getDefault().log("Error", e);
    }
    return keys;
}
Also used : BackingStoreException(org.osgi.service.prefs.BackingStoreException) Preferences(org.osgi.service.prefs.Preferences)

Example 57 with Preferences

use of org.osgi.service.prefs.Preferences in project azure-tools-for-java by Microsoft.

the class PreferenceUtil method savePreferences.

public static void savePreferences(String name, String[] values) {
    Preferences prefs = PluginUtil.getPrefs(com.microsoft.azuretools.core.utils.Messages.prefFileName);
    prefs.put(name, convertToPreference(values));
    try {
        prefs.flush();
    } catch (BackingStoreException e) {
        Activator.getDefault().log("Error", e);
    }
}
Also used : BackingStoreException(org.osgi.service.prefs.BackingStoreException) Preferences(org.osgi.service.prefs.Preferences)

Example 58 with Preferences

use of org.osgi.service.prefs.Preferences in project azure-tools-for-java by Microsoft.

the class PreferenceUtil method savePreference.

public static void savePreference(String name, String value) {
    try {
        Preferences prefs = PluginUtil.getPrefs(com.microsoft.azuretools.core.utils.Messages.prefFileName);
        prefs.put(name, value);
        prefs.flush();
    } catch (BackingStoreException e) {
        Activator.getDefault().log("Error", e);
    }
}
Also used : BackingStoreException(org.osgi.service.prefs.BackingStoreException) Preferences(org.osgi.service.prefs.Preferences)

Example 59 with Preferences

use of org.osgi.service.prefs.Preferences in project jop by jop-devel.

the class JOPUIUtils method setProjectSetting.

public static void setProjectSetting(ILaunchConfiguration configuration, String key, String value) {
    String projectName = getProjectName(configuration);
    if (projectName == null) {
        return;
    }
    IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
    IScopeContext scopeContext = new ProjectScope(project);
    Preferences projectPrefs = scopeContext.getNode(IJOPUIConstants.PLUGIN_ID);
    projectPrefs.put(key, value);
}
Also used : ProjectScope(org.eclipse.core.resources.ProjectScope) IScopeContext(org.eclipse.core.runtime.preferences.IScopeContext) Preferences(org.osgi.service.prefs.Preferences) IProject(org.eclipse.core.resources.IProject)

Example 60 with Preferences

use of org.osgi.service.prefs.Preferences in project jop by jop-devel.

the class JOPPropertyPage method performOk.

/* (non-Javadoc)
     * @see org.eclipse.jface.preference.FieldEditorPreferencePage#performOk()
     */
@Override
public boolean performOk() {
    IScopeContext scopeContext = new ProjectScope(getProject());
    Preferences projectPrefs = scopeContext.getNode(IJOPUIConstants.PLUGIN_ID);
    if (isValid()) {
        projectPrefs.put(IJOPLaunchConfigurationConstants.ATTR_JOP_HOME, jopDirectoryEditor.getStringValue());
        projectPrefs.put(IJOPLaunchConfigurationConstants.ATTR_QUARTUS_PROJECT, quartusProjectFileEditor.getStringValue());
    }
    return super.performOk();
}
Also used : ProjectScope(org.eclipse.core.resources.ProjectScope) IScopeContext(org.eclipse.core.runtime.preferences.IScopeContext) Preferences(org.osgi.service.prefs.Preferences)

Aggregations

Preferences (org.osgi.service.prefs.Preferences)157 BackingStoreException (org.osgi.service.prefs.BackingStoreException)82 EclipsePreferences (org.eclipse.core.internal.preferences.EclipsePreferences)41 IEclipsePreferences (org.eclipse.core.runtime.preferences.IEclipsePreferences)37 ProjectScope (org.eclipse.core.resources.ProjectScope)18 IScopeContext (org.eclipse.core.runtime.preferences.IScopeContext)14 IStatus (org.eclipse.core.runtime.IStatus)10 IOException (java.io.IOException)7 Test (org.junit.Test)7 IProject (org.eclipse.core.resources.IProject)6 Status (org.eclipse.core.runtime.Status)6 PerformanceTestRunner (org.eclipse.core.tests.harness.PerformanceTestRunner)6 InstanceScope (org.eclipse.core.runtime.preferences.InstanceScope)5 ISecurePreferences (org.eclipse.equinox.security.storage.ISecurePreferences)5 Field (java.lang.reflect.Field)4 ArrayList (java.util.ArrayList)4 ExportedPreferences (org.eclipse.core.internal.preferences.ExportedPreferences)4 IExportedPreferences (org.eclipse.core.runtime.preferences.IExportedPreferences)4 ContentTypeEncodingPreferences (org.eclipse.wst.sse.core.internal.encoding.ContentTypeEncodingPreferences)4 IEncodedDocument (org.eclipse.wst.sse.core.internal.provisional.document.IEncodedDocument)4