diff options
author | sminto | 2010-05-20 19:54:01 +0000 |
---|---|---|
committer | sminto | 2010-05-20 19:54:01 +0000 |
commit | 8ecefc87ec414a9f572390d725830ccd1b8acfbb (patch) | |
tree | 6f5bd23cc417ba846ad15197e231be24c02153a0 | |
parent | 1831092a51ea7c753d7d764a2d715fcd5be0c99f (diff) | |
download | org.eclipse.mylyn.incubator-8ecefc87ec414a9f572390d725830ccd1b8acfbb.tar.gz org.eclipse.mylyn.incubator-8ecefc87ec414a9f572390d725830ccd1b8acfbb.tar.xz org.eclipse.mylyn.incubator-8ecefc87ec414a9f572390d725830ccd1b8acfbb.zip |
ASSIGNED - bug 296745: [monitor] fix usage of deprecated Preferences.IPropertyChangeListener
https://bugs.eclipse.org/bugs/show_bug.cgi?id=296745
3 files changed, 15 insertions, 26 deletions
diff --git a/org.eclipse.mylyn.examples.monitor.study/src/org/eclipse/mylyn/examples/monitor/study/MylynUserStudyExamplePlugin.java b/org.eclipse.mylyn.examples.monitor.study/src/org/eclipse/mylyn/examples/monitor/study/MylynUserStudyExamplePlugin.java index 6fdcd5d5..8f48f99e 100644 --- a/org.eclipse.mylyn.examples.monitor.study/src/org/eclipse/mylyn/examples/monitor/study/MylynUserStudyExamplePlugin.java +++ b/org.eclipse.mylyn.examples.monitor.study/src/org/eclipse/mylyn/examples/monitor/study/MylynUserStudyExamplePlugin.java @@ -12,7 +12,6 @@ package org.eclipse.mylyn.examples.monitor.study; import org.eclipse.jdt.internal.ui.JavaPlugin; -import org.eclipse.mylyn.internal.context.core.ContextCorePlugin; import org.eclipse.mylyn.internal.monitor.ui.MonitorUiPlugin; import org.eclipse.mylyn.internal.monitor.usage.UiUsageMonitorPlugin; import org.eclipse.pde.internal.ui.PDEPlugin; @@ -44,24 +43,21 @@ public class MylynUserStudyExamplePlugin extends AbstractUIPlugin { public void earlyStartup() { final IWorkbench workbench = PlatformUI.getWorkbench(); workbench.getDisplay().asyncExec(new Runnable() { - @SuppressWarnings("deprecation") public void run() { MylynUserStudyExamplePlugin.getDefault().selectionMonitor = new SelectionMonitor(); MonitorUiPlugin.getDefault().getSelectionMonitors().add( MylynUserStudyExamplePlugin.getDefault().selectionMonitor); UiUsageMonitorPlugin.getDefault().addMonitoredPreferences( - WorkbenchPlugin.getDefault().getPluginPreferences()); - // MylarUsageMonitorPlugin.getDefault().addMonitoredPreferences( - // MylarUiPlugin.getDefault().getPluginPreferences()); + WorkbenchPlugin.getDefault().getPreferenceStore()); UiUsageMonitorPlugin.getDefault().addMonitoredPreferences( - JavaPlugin.getDefault().getPluginPreferences()); + JavaPlugin.getDefault().getPreferenceStore()); UiUsageMonitorPlugin.getDefault().addMonitoredPreferences( - WorkbenchPlugin.getDefault().getPluginPreferences()); + WorkbenchPlugin.getDefault().getPreferenceStore()); UiUsageMonitorPlugin.getDefault().addMonitoredPreferences( - EditorsPlugin.getDefault().getPluginPreferences()); + EditorsPlugin.getDefault().getPreferenceStore()); UiUsageMonitorPlugin.getDefault().addMonitoredPreferences( - PDEPlugin.getDefault().getPluginPreferences()); + PDEPlugin.getDefault().getPreferenceStore()); } }); } @@ -72,22 +68,17 @@ public class MylynUserStudyExamplePlugin extends AbstractUIPlugin { super.start(context); } - @SuppressWarnings("deprecation") @Override public void stop(BundleContext context) throws Exception { super.stop(context); plugin = null; MonitorUiPlugin.getDefault().getSelectionMonitors().remove(selectionMonitor); - UiUsageMonitorPlugin.getDefault().removeMonitoredPreferences( - WorkbenchPlugin.getDefault().getPluginPreferences()); - UiUsageMonitorPlugin.getDefault().removeMonitoredPreferences( - ContextCorePlugin.getDefault().getPluginPreferences()); - UiUsageMonitorPlugin.getDefault().removeMonitoredPreferences(JavaPlugin.getDefault().getPluginPreferences()); - UiUsageMonitorPlugin.getDefault().removeMonitoredPreferences( - WorkbenchPlugin.getDefault().getPluginPreferences()); - UiUsageMonitorPlugin.getDefault().removeMonitoredPreferences(EditorsPlugin.getDefault().getPluginPreferences()); - UiUsageMonitorPlugin.getDefault().removeMonitoredPreferences(PDEPlugin.getDefault().getPluginPreferences()); + UiUsageMonitorPlugin.getDefault().removeMonitoredPreferences(WorkbenchPlugin.getDefault().getPreferenceStore()); + UiUsageMonitorPlugin.getDefault().removeMonitoredPreferences(JavaPlugin.getDefault().getPreferenceStore()); + UiUsageMonitorPlugin.getDefault().removeMonitoredPreferences(WorkbenchPlugin.getDefault().getPreferenceStore()); + UiUsageMonitorPlugin.getDefault().removeMonitoredPreferences(EditorsPlugin.getDefault().getPreferenceStore()); + UiUsageMonitorPlugin.getDefault().removeMonitoredPreferences(PDEPlugin.getDefault().getPreferenceStore()); } /** diff --git a/org.eclipse.mylyn.monitor.usage/src/org/eclipse/mylyn/internal/monitor/usage/UiUsageMonitorPlugin.java b/org.eclipse.mylyn.monitor.usage/src/org/eclipse/mylyn/internal/monitor/usage/UiUsageMonitorPlugin.java index a7887b2a..afa590fe 100644 --- a/org.eclipse.mylyn.monitor.usage/src/org/eclipse/mylyn/internal/monitor/usage/UiUsageMonitorPlugin.java +++ b/org.eclipse.mylyn.monitor.usage/src/org/eclipse/mylyn/internal/monitor/usage/UiUsageMonitorPlugin.java @@ -20,12 +20,12 @@ import java.util.List; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.ListenerList; -import org.eclipse.core.runtime.Preferences; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.IJobChangeEvent; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.core.runtime.jobs.JobChangeAdapter; import org.eclipse.jface.action.IAction; +import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.mylyn.commons.core.StatusHandler; import org.eclipse.mylyn.internal.context.core.InteractionContextManager; import org.eclipse.mylyn.internal.monitor.ui.ActionExecutionMonitor; @@ -241,16 +241,14 @@ public class UiUsageMonitorPlugin extends AbstractUIPlugin { getPreferenceStore().setValue(MonitorPreferenceConstants.PREF_MONITORING_STARTED, true); } - @SuppressWarnings("deprecation") - public void addMonitoredPreferences(Preferences preferences) { + public void addMonitoredPreferences(IPreferenceStore preferences) { if (preferenceMonitor == null) { preferenceMonitor = new PreferenceChangeMonitor(); } preferences.addPropertyChangeListener(preferenceMonitor); } - @SuppressWarnings("deprecation") - public void removeMonitoredPreferences(Preferences preferences) { + public void removeMonitoredPreferences(IPreferenceStore preferences) { if (preferenceMonitor != null) { preferences.removePropertyChangeListener(preferenceMonitor); } else { diff --git a/org.eclipse.mylyn.sandbox.tests/src/org/eclipse/mylyn/sandbox/tests/StatisticsReportingTest.java b/org.eclipse.mylyn.sandbox.tests/src/org/eclipse/mylyn/sandbox/tests/StatisticsReportingTest.java index c632fdc0..31c41cd9 100644 --- a/org.eclipse.mylyn.sandbox.tests/src/org/eclipse/mylyn/sandbox/tests/StatisticsReportingTest.java +++ b/org.eclipse.mylyn.sandbox.tests/src/org/eclipse/mylyn/sandbox/tests/StatisticsReportingTest.java @@ -143,7 +143,7 @@ public class StatisticsReportingTest extends TestCase { @SuppressWarnings("unused") public void testFilteredModeDetection() throws IOException { - UiUsageMonitorPlugin.getDefault().addMonitoredPreferences(ContextUiPlugin.getDefault().getPluginPreferences()); + UiUsageMonitorPlugin.getDefault().addMonitoredPreferences(ContextUiPlugin.getDefault().getPreferenceStore()); UiUsageMonitorPlugin.getDefault().getInteractionLogger().clearInteractionHistory(); mockExplorerSelection("A.java"); @@ -185,7 +185,7 @@ public class StatisticsReportingTest extends TestCase { assertEquals(2, filtered); UiUsageMonitorPlugin.getDefault().removeMonitoredPreferences( - ContextUiPlugin.getDefault().getPluginPreferences()); + ContextUiPlugin.getDefault().getPreferenceStore()); } }); |