summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-07-31 10:03:57 (EDT)
committerEike Stepper2007-07-31 10:03:57 (EDT)
commit17cd61c152db6b255ecb5a38981e23db5322d48a (patch)
tree18fd56e219c6807cea0befb6ad6405b8814836a8
parent4908045d687ec1677d36a226f33086e5fead33a0 (diff)
downloadcdo-17cd61c152db6b255ecb5a38981e23db5322d48a.zip
cdo-17cd61c152db6b255ecb5a38981e23db5322d48a.tar.gz
cdo-17cd61c152db6b255ecb5a38981e23db5322d48a.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/widgets/LogDialog.java25
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/widgets/MonitorDialog.java10
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/widgets/MonitorLogDialog.java17
3 files changed, 43 insertions, 9 deletions
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/widgets/LogDialog.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/widgets/LogDialog.java
index 338a3dc..8ef43bf 100644
--- a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/widgets/LogDialog.java
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/widgets/LogDialog.java
@@ -10,6 +10,8 @@
**************************************************************************/
package org.eclipse.net4j.ui.widgets;
+import org.eclipse.net4j.util.io.IORuntimeException;
+
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.swt.SWT;
@@ -22,6 +24,9 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;
@@ -92,6 +97,26 @@ public class LogDialog extends BaseDialog
currentStyleRange.length += text.length();
}
+ public void append(Throwable t)
+ {
+ try
+ {
+ checkStyleRange();
+ ByteArrayOutputStream bytes = new ByteArrayOutputStream();
+ String message = t.getMessage() + "\n";
+ bytes.write(message.getBytes());
+ t.printStackTrace(new PrintStream(bytes));
+
+ String text = bytes.toString();
+ log.append(text);
+ currentStyleRange.length += text.length();
+ }
+ catch (IOException ex)
+ {
+ throw new IORuntimeException(ex);
+ }
+ }
+
@Override
public boolean close()
{
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/widgets/MonitorDialog.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/widgets/MonitorDialog.java
index 69f6d41..a30ddb4 100644
--- a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/widgets/MonitorDialog.java
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/widgets/MonitorDialog.java
@@ -31,12 +31,10 @@ public class MonitorDialog extends ProgressMonitorDialog
private String title;
- private Exception exception;
+ private IDialogSettings settings;
private MonitorLogDialog log;
- private IDialogSettings settings;
-
public MonitorDialog(Shell parentShell, int shellStyle, String title, IDialogSettings settings)
{
super(parentShell);
@@ -68,11 +66,7 @@ public class MonitorDialog extends ProgressMonitorDialog
}
catch (RuntimeException ex)
{
- exception = WrappedException.unwrap(ex);
- // log.append(exception.getMessage());
- // ByteArrayOutputStream bytes = new ByteArrayOutputStream();
- // exception.printStackTrace(new PrintStream(bytes));
- // log.append(bytes);
+ log.append(ex);
throw ex;
}
finally
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/widgets/MonitorLogDialog.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/widgets/MonitorLogDialog.java
index 7452862..f7ad6dc 100644
--- a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/widgets/MonitorLogDialog.java
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/widgets/MonitorLogDialog.java
@@ -21,6 +21,8 @@ public class MonitorLogDialog extends LogDialog implements OMMonitorHandler
private TextStyle red;
+ private TextStyle green;
+
public MonitorLogDialog(Shell parentShell, int shellStyle, String title, String message, IDialogSettings settings)
{
super(parentShell, shellStyle, title, message, settings);
@@ -28,6 +30,7 @@ public class MonitorLogDialog extends LogDialog implements OMMonitorHandler
normal = new TextStyle(null, display.getSystemColor(SWT.COLOR_DARK_GRAY), null);
blue = new TextStyle(null, display.getSystemColor(SWT.COLOR_BLUE), null);
red = new TextStyle(null, display.getSystemColor(SWT.COLOR_RED), null);
+ green = new TextStyle(null, display.getSystemColor(SWT.COLOR_GREEN), null);
}
public MonitorLogDialog(Shell parentShell, String title, String message, IDialogSettings settings)
@@ -60,6 +63,11 @@ public class MonitorLogDialog extends LogDialog implements OMMonitorHandler
return red;
}
+ public TextStyle getGreen()
+ {
+ return green;
+ }
+
public void handleTask(String task, int level)
{
setTextStyle(blue);
@@ -71,7 +79,7 @@ public class MonitorLogDialog extends LogDialog implements OMMonitorHandler
{
if (msg.startsWith(emphasizePrefix))
{
- setTextStyle(red);
+ setTextStyle(green);
}
else
{
@@ -81,4 +89,11 @@ public class MonitorLogDialog extends LogDialog implements OMMonitorHandler
append(msg);
append("\n");
}
+
+ @Override
+ public void append(Throwable t)
+ {
+ setTextStyle(red);
+ super.append(t);
+ }
} \ No newline at end of file