本文整理汇总了Java中org.eclipse.core.runtime.preferences.IEclipsePreferences.flush方法的典型用法代码示例。如果您正苦于以下问题:Java IEclipsePreferences.flush方法的具体用法?Java IEclipsePreferences.flush怎么用?Java IEclipsePreferences.flush使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.runtime.preferences.IEclipsePreferences
的用法示例。
在下文中一共展示了IEclipsePreferences.flush方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: save
import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
@Override
public IStatus save() {
try {
final IEclipsePreferences node = InstanceScope.INSTANCE.getNode(QUALIFIER);
for (final Entry<Binary, URI> entry : getOrCreateState().entrySet()) {
final URI path = entry.getValue();
if (null != path) {
final File file = new File(path);
if (file.isDirectory()) {
node.put(entry.getKey().getId(), file.getAbsolutePath());
}
} else {
// Set to default.
node.put(entry.getKey().getId(), "");
}
}
node.flush();
return OK_STATUS;
} catch (final BackingStoreException e) {
final String message = "Unexpected error when trying to persist binary preferences.";
LOGGER.error(message, e);
return statusHelper.createError(message, e);
}
}
示例2: save
import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
@Override
public void save() throws BackingStoreException {
// Save Themes in the
// "${workspace_loc}/metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.tm4e.ui.prefs"
String json = PreferenceHelper.toJsonThemes(
Arrays.stream(getThemes()).filter(t -> t.getPluginId() == null).collect(Collectors.toList()));
IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(TMUIPlugin.PLUGIN_ID);
prefs.put(PreferenceConstants.THEMES, json);
// Save Theme associations in the
// "${workspace_loc}/metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.tm4e.ui.prefs"
json = PreferenceHelper.toJsonThemeAssociations(Arrays.stream(getAllThemeAssociations())
.filter(t -> t.getPluginId() == null).collect(Collectors.toList()));
prefs.put(PreferenceConstants.THEME_ASSOCIATIONS, json);
// Save preferences
prefs.flush();
}
示例3: setPreferenceShellPath
import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
public static void setPreferenceShellPath(IPath path)
{
IEclipsePreferences prefs = EclipseUtil.instanceScope().getNode(CorePlugin.PLUGIN_ID);
if (path != null)
{
prefs.put(ICorePreferenceConstants.PREF_SHELL_EXECUTABLE_PATH, path.toOSString());
}
else
{
prefs.remove(ICorePreferenceConstants.PREF_SHELL_EXECUTABLE_PATH);
}
try
{
prefs.flush();
}
catch (BackingStoreException e)
{
IdeLog.logError(CorePlugin.getDefault(), "Saving preferences failed.", e); //$NON-NLS-1$
}
shellPath = null;
shellEnvironment = null;
}
示例4: remove
import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
protected synchronized void remove(IServer server) {
dataByServer.remove(server);
String serverId = server.getAttribute(DockerFoundryServer.PROP_SERVER_ID, (String) null);
if (serverId != null) {
IEclipsePreferences node = new InstanceScope().getNode(DockerFoundryPlugin.PLUGIN_ID);
node.remove(KEY_MODULE_MAPPING_LIST + ":" + serverId); //$NON-NLS-1$
try {
node.flush();
}
catch (BackingStoreException e) {
DockerFoundryPlugin
.getDefault()
.getLog()
.log(new Status(IStatus.ERROR, DockerFoundryPlugin.PLUGIN_ID,
"Failed to remove application mappings", e)); //$NON-NLS-1$
}
}
}
示例5: setFilePermissions
import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
/**
* 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);
}
}
示例6: doSave
import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
@Override
protected IStatus doSave(final ExternalLibraryPreferenceModel modelToSave) {
final IEclipsePreferences node = InstanceScope.INSTANCE.getNode(QUALIFIER);
node.put(CONFIGURATION_KEY, modelToSave.toJsonString());
try {
node.flush();
return OK_STATUS;
} catch (final BackingStoreException e) {
final String message = "Unexpected error when trying to persist external library preferences.";
LOGGER.error(message, e);
return statusHelper.createError(message, e);
}
}
示例7: saveSettings
import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
public EclipsePreferencesSerializer<T> saveSettings(final T settings) {
IEclipsePreferences preferences = ConfigurationScope.INSTANCE.getNode(prefereneceId);
Gson gson = new Gson();
preferences.put(preferenceKey, gson.toJson(settings));
try {
preferences.flush();
} catch (BackingStoreException e) {
throw new RuntimeException(e);
}
return this;
}
示例8: remove
import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
/**
* Remove preferences for the passed project
*
* @param project
* @param values
* @throws BackingStoreException
*/
public static void remove(IProject project, String[] values) throws BackingStoreException {
IEclipsePreferences projectPreferences = getProjectPreference(project);
for (int i = 0; i < values.length; i++) {
projectPreferences.remove(values[i]);
}
projectPreferences.flush();
}
示例9: saveLastDb
import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
public static void saveLastDb(DbInfo lastDb, IProject project) {
IEclipsePreferences prefs = PgDbProject.getPrefs(project);
if (prefs != null) {
prefs.put(PROJ_PREF.LAST_DB_STORE, lastDb.toString());
try {
prefs.flush();
} catch (BackingStoreException ex) {
Log.log(ex);
}
}
}
示例10: saveLastDb
import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
public static void saveLastDb(DbInfo lastDb, IEditorInput inputForProject) {
IResource res = ResourceUtil.getResource(inputForProject);
if (res != null) {
IEclipsePreferences prefs = PgDbProject.getPrefs(res.getProject());
if (prefs != null) {
prefs.put(PROJ_PREF.LAST_DB_STORE_EDITOR, lastDb.toString());
try {
prefs.flush();
} catch (BackingStoreException ex) {
Log.log(ex);
}
}
}
}
示例11: folderChoosed
import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
public void folderChoosed(String folderPath) {
this.folderPath = folderPath;
doResetProvider();
IEclipsePreferences node = ConfigurationScope.INSTANCE.getNode(PrefEditorPlugin.PLUGIN_ID);
node.put(CHOOSED_FOLDER_PREF, folderPath);
try {
node.flush();
} catch (BackingStoreException e) {
PrefEditorPlugin.log(e);
}
setViewerTitle(folderPath);
}
示例12: saveChoosedPage
import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
protected void saveChoosedPage(int selectionIndex) {
IEclipsePreferences node = InstanceScope.INSTANCE.getNode(PrefEditorPlugin.PLUGIN_ID);
node.putInt(CHOOSED_PAGE_PREF, selectionIndex);
try {
node.flush();
} catch (BackingStoreException e) {
PrefEditorPlugin.log(e);
}
}
示例13: saveBoolPref
import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
protected void saveBoolPref(String key, boolean value) {
IEclipsePreferences node = InstanceScope.INSTANCE.getNode(PrefEditorPlugin.PLUGIN_ID);
node.putBoolean(key, value);
try {
node.flush();
} catch (BackingStoreException e) {
PrefEditorPlugin.log(e);
}
}
示例14: flush
import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
protected void flush(IEclipsePreferences node) {
try {
node.flush();
} catch (BackingStoreException e) {
MessageDialog.openError(Display.getDefault().getActiveShell(), "Error saving preference", "Error saving preference value for node " + node.name() + " . Check error log for details");
PrefEditorPlugin.log(e);
}
}
示例15: savePrevFolderChoices
import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
public static void savePrevFolderChoices(String[] choices) {
IEclipsePreferences node = InstanceScope.INSTANCE.getNode(PrefEditorPlugin.PLUGIN_ID);
node.put(PREV_FOLDERS_KEY, String.join(";", choices));
try {
node.flush();
} catch (BackingStoreException e) {
PrefEditorPlugin.log(e);
}
}