use of org.osgi.service.prefs.BackingStoreException in project xtext-xtend by eclipse.
the class JavaProjectPreferencesInitializer method addOwnFileExtensionsToJavaBuildResourceCopyFilter.
@SuppressWarnings("restriction")
@Inject
public void addOwnFileExtensionsToJavaBuildResourceCopyFilter(FileExtensionProvider extensionProvider) {
@SuppressWarnings("deprecation") IScopeContext defaultScope = new DefaultScope();
// The class org.eclipse.jdt.internal.launching.LaunchingPreferenceInitializer has this very nasty habit
// of replacing all RESOURCE_COPY_FILTERs with its own filter. Calling getNode(LaunchingPlugin.ID_PLUGIN)
// causes LaunchingPreferenceInitializer to be executed that afterwards we can append our filters safely.
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=395366
defaultScope.getNode(org.eclipse.jdt.internal.launching.LaunchingPlugin.ID_PLUGIN);
IEclipsePreferences dnode = defaultScope.getNode(JavaCore.PLUGIN_ID);
if (dnode == null)
return;
Set<String> filters = Sets.newLinkedHashSet();
for (String filter : dnode.get(JavaCore.CORE_JAVA_BUILD_RESOURCE_COPY_FILTER, "").split(",")) {
String trimmed = filter.trim();
if (!"".equals(trimmed))
filters.add(trimmed);
}
for (String ext : extensionProvider.getFileExtensions()) filters.add("*." + ext);
dnode.put(JavaCore.CORE_JAVA_BUILD_RESOURCE_COPY_FILTER, Joiner.on(", ").join(filters));
try {
dnode.flush();
} catch (BackingStoreException e) {
log.error("Error saving preferences", e);
}
}
use of org.osgi.service.prefs.BackingStoreException in project linuxtools by eclipse.
the class STCSourceNotFoundEditor method addSourceMappingToCommon.
private void addSourceMappingToCommon(IPath missingPath, IPath newSourcePath) throws CoreException {
AbstractSourceLookupDirector director = CDebugCorePlugin.getDefault().getCommonSourceLookupDirector();
addSourceMappingToDirector(missingPath, newSourcePath, director);
try {
InstanceScope.INSTANCE.getNode(CDebugCorePlugin.PLUGIN_ID).flush();
} catch (BackingStoreException e) {
IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, Messages.STCSourceNotFoundEditor_failed_saving_settings_for_content_type + CDebugCorePlugin.PLUGIN_ID, e);
throw new CoreException(status);
}
}
Aggregations