Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Becker2013-03-06 16:16:25 -0500
committerFrank Becker2013-04-03 14:33:39 -0400
commitcbb1a7dd766212e4fb8f82005c39b49644700332 (patch)
tree9b07b23b4cc377c89394465a7509b622afb5e9fb
parent77b5432b77c14b1317751eac67156805d00053bc (diff)
downloadorg.eclipse.mylyn.incubator-cbb1a7dd766212e4fb8f82005c39b49644700332.tar.gz
org.eclipse.mylyn.incubator-cbb1a7dd766212e4fb8f82005c39b49644700332.tar.xz
org.eclipse.mylyn.incubator-cbb1a7dd766212e4fb8f82005c39b49644700332.zip
402585: NPE in UiUsageMonitorPlugin.stop
Change-Id: Iefc191ee7886ee5c3b8572962ba3779fc0bd863c Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=402585
-rw-r--r--org.eclipse.mylyn.monitor.usage/src/org/eclipse/mylyn/internal/monitor/usage/UiUsageMonitorPlugin.java33
1 files changed, 21 insertions, 12 deletions
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 5e9829b5..b3b369db 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
@@ -52,6 +52,7 @@ import org.osgi.framework.BundleContext;
/**
* @author Mik Kersten
* @author Shawn Minto
+ * @author Frank Becker
*/
public class UiUsageMonitorPlugin extends AbstractUIPlugin {
@@ -258,8 +259,9 @@ public class UiUsageMonitorPlugin extends AbstractUIPlugin {
}
public boolean isObfuscationEnabled() {
- return UiUsageMonitorPlugin.getDefault().getPreferenceStore().getBoolean(
- MonitorPreferenceConstants.PREF_MONITORING_OBFUSCATE)
+ return UiUsageMonitorPlugin.getDefault()
+ .getPreferenceStore()
+ .getBoolean(MonitorPreferenceConstants.PREF_MONITORING_OBFUSCATE)
|| (studyParameters != null && studyParameters.forceObfuscation());
}
@@ -286,10 +288,14 @@ public class UiUsageMonitorPlugin extends AbstractUIPlugin {
// ContextCore.getPluginPreferences().removePropertyChangeListener(DATA_DIR_MOVE_LISTENER);
MonitorUiPlugin.getDefault().removeWindowPerspectiveListener(perspectiveMonitor);
- workbench.getActivitySupport().getActivityManager().removeActivityManagerListener(activityMonitor);
- if (workbench.getDisplay() != null && !workbench.getDisplay().isDisposed()) {
- workbench.getDisplay().removeFilter(SWT.Selection, menuMonitor);
- workbench.removeWindowListener(windowMonitor);
+ if (workbench != null) {
+ if (workbench.getActivitySupport() != null) {
+ workbench.getActivitySupport().getActivityManager().removeActivityManagerListener(activityMonitor);
+ }
+ if (workbench.getDisplay() != null && !workbench.getDisplay().isDisposed()) {
+ workbench.getDisplay().removeFilter(SWT.Selection, menuMonitor);
+ workbench.removeWindowListener(windowMonitor);
+ }
}
// uninstallBrowserMonitor(workbench);
@@ -366,15 +372,18 @@ public class UiUsageMonitorPlugin extends AbstractUIPlugin {
public Date getLastTransmitDate() {
Date lastTransmit;
- if (UiUsageMonitorPlugin.getDefault().getPreferenceStore().contains(
- MonitorPreferenceConstants.PREF_PREVIOUS_TRANSMIT_DATE)) {
+ if (UiUsageMonitorPlugin.getDefault()
+ .getPreferenceStore()
+ .contains(MonitorPreferenceConstants.PREF_PREVIOUS_TRANSMIT_DATE)) {
- lastTransmit = new Date(UiUsageMonitorPlugin.getDefault().getPreferenceStore().getLong(
- MonitorPreferenceConstants.PREF_PREVIOUS_TRANSMIT_DATE));
+ lastTransmit = new Date(UiUsageMonitorPlugin.getDefault()
+ .getPreferenceStore()
+ .getLong(MonitorPreferenceConstants.PREF_PREVIOUS_TRANSMIT_DATE));
} else {
lastTransmit = new Date();
- UiUsageMonitorPlugin.getDefault().getPreferenceStore().setValue(
- MonitorPreferenceConstants.PREF_PREVIOUS_TRANSMIT_DATE, lastTransmit.getTime());
+ UiUsageMonitorPlugin.getDefault()
+ .getPreferenceStore()
+ .setValue(MonitorPreferenceConstants.PREF_PREVIOUS_TRANSMIT_DATE, lastTransmit.getTime());
}
return lastTransmit;
}

Back to the top