summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-07-30 13:25:07 (EDT)
committerEike Stepper2007-07-30 13:25:07 (EDT)
commit5d3c732134cb081daf89c5b6a1ad85bd0641777d (patch)
treefac2e8ca1f1f72e145e1bf99f8b4c95021345152
parent0dd2c49605294377ac21c3c855f24fca1e2d31da (diff)
downloadcdo-5d3c732134cb081daf89c5b6a1ad85bd0641777d.zip
cdo-5d3c732134cb081daf89c5b6a1ad85bd0641777d.tar.gz
cdo-5d3c732134cb081daf89c5b6a1ad85bd0641777d.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/monitor/LegacyMonitor.java31
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/IMessageHandler.java19
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/MonitorUtil.java7
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/MonitoredJob.java3
4 files changed, 58 insertions, 2 deletions
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/monitor/LegacyMonitor.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/monitor/LegacyMonitor.java
index 3beb032..2ba11a0 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/monitor/LegacyMonitor.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/monitor/LegacyMonitor.java
@@ -10,14 +10,20 @@
**************************************************************************/
package org.eclipse.net4j.internal.util.om.monitor;
+import org.eclipse.net4j.internal.util.bundle.OM;
+import org.eclipse.net4j.util.om.monitor.IMessageHandler;
+
/**
* @author Eike Stepper
*/
public final class LegacyMonitor extends Monitor
{
- public LegacyMonitor()
+ private IMessageHandler messageHandler;
+
+ public LegacyMonitor(IMessageHandler messageHandler)
{
super(null, 0);
+ this.messageHandler = messageHandler;
}
private LegacyMonitor(LegacyMonitor parent, int workFromParent)
@@ -30,4 +36,27 @@ public final class LegacyMonitor extends Monitor
{
return new LegacyMonitor(this, workFromParent);
}
+
+ @Override
+ protected void message(String msg, int level)
+ {
+ if (getParent() != null)
+ {
+ super.message(msg, level);
+ }
+ else
+ {
+ if (messageHandler != null)
+ {
+ try
+ {
+ messageHandler.handleMessage(msg, level);
+ }
+ catch (RuntimeException ex)
+ {
+ OM.LOG.error(ex);
+ }
+ }
+ }
+ }
}
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/IMessageHandler.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/IMessageHandler.java
new file mode 100644
index 0000000..fc89439
--- /dev/null
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/IMessageHandler.java
@@ -0,0 +1,19 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.util.om.monitor;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IMessageHandler
+{
+ public void handleMessage(String msg, int level);
+}
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/MonitorUtil.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/MonitorUtil.java
index ca5946f..d5f06e9 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/MonitorUtil.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/MonitorUtil.java
@@ -66,9 +66,14 @@ public final class MonitorUtil
*/
public static final class Legacy
{
+ public static void startMonitoring(IMessageHandler messageHandler)
+ {
+ MON.startMonitoring(new LegacyMonitor(messageHandler));
+ }
+
public static void startMonitoring()
{
- MON.startMonitoring(new LegacyMonitor());
+ MON.startMonitoring(new LegacyMonitor(null));
}
public static void stopMonitoring()
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/MonitoredJob.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/MonitoredJob.java
index 3c30aa2..20fd846 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/MonitoredJob.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/MonitoredJob.java
@@ -10,6 +10,8 @@
**************************************************************************/
package org.eclipse.net4j.util.om.monitor;
+import org.eclipse.net4j.internal.util.bundle.OM;
+
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -39,6 +41,7 @@ public abstract class MonitoredJob extends Job
}
catch (Exception ex)
{
+ OM.LOG.error(ex);
return new Status(IStatus.ERROR, bundleID, ex.getMessage(), ex);
}
finally