diff options
Diffstat (limited to 'org.eclipse.osbp.preferences.ui.page/src/org/eclipse/osbp/preferences/ui/data/ProductProjectScope.java')
-rw-r--r-- | org.eclipse.osbp.preferences.ui.page/src/org/eclipse/osbp/preferences/ui/data/ProductProjectScope.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/org.eclipse.osbp.preferences.ui.page/src/org/eclipse/osbp/preferences/ui/data/ProductProjectScope.java b/org.eclipse.osbp.preferences.ui.page/src/org/eclipse/osbp/preferences/ui/data/ProductProjectScope.java index 65bb024..bb75b11 100644 --- a/org.eclipse.osbp.preferences.ui.page/src/org/eclipse/osbp/preferences/ui/data/ProductProjectScope.java +++ b/org.eclipse.osbp.preferences.ui.page/src/org/eclipse/osbp/preferences/ui/data/ProductProjectScope.java @@ -25,12 +25,12 @@ import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.preferences.IEclipsePreferences; import org.eclipse.core.runtime.preferences.IScopeContext; +import org.eclipse.osbp.preferences.ProductConfigurationPrefs; import org.osgi.service.prefs.BackingStoreException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.eclipse.osbp.preferences.ProductConfigurationPrefs; - +@SuppressWarnings("restriction") public final class ProductProjectScope implements IScopeContext { private static final Logger LOGGER = LoggerFactory.getLogger(ProductProjectScope.class); @@ -61,7 +61,7 @@ public final class ProductProjectScope implements IScopeContext { * @see org.eclipse.core.runtime.preferences.IScopeContext#getLocation() */ public IPath getLocation() { - IProject project = ((IResource) context).getProject(); + IProject project = context.getProject(); IResource resource = ProductConfigurationPrefs.getPrefsFile(project); if (resource == null) { IPath location = project.getLocation(); @@ -95,7 +95,7 @@ public final class ProductProjectScope implements IScopeContext { Class<?> preferenceClass = preference.getClass(); Method getLoadLevel = preferenceClass.getDeclaredMethod("getLoadLevel"); getLoadLevel.setAccessible(true); - ProjectPreferences loadLevelInstance = (ProjectPreferences) getLoadLevel.invoke(preference); + ProjectPreferences loadLevelInstance = (ProjectPreferences) getLoadLevel.invoke(preference); Class<?>loadLevelClass = loadLevelInstance.getClass(); Field fileField = loadLevelClass.getDeclaredField("file"); fileField.setAccessible(true); @@ -103,7 +103,8 @@ public final class ProductProjectScope implements IScopeContext { if ((activeFile == null) || !activeFile.getFullPath().toOSString().equals(prefsFile.getFullPath().toOSString())) { fileField.set(loadLevelInstance, prefsFile); preference.sync(); - LOGGER.info("set preference file to: "+prefsFile.getFullPath().toOSString()); + String msg = prefsFile.getFullPath().toOSString(); + LOGGER.info("set preference file to: {}", msg); } } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException | BackingStoreException | NoSuchMethodException | SecurityException | InvocationTargetException x) { |