-/*
- * Copyright (C) 2007-2012 Argeo GmbH
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
package org.argeo.eclipse.ui.dialogs;
import java.io.PrintWriter;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
-/** Generic error dialog to be used in try/catch blocks */
+/**
+ * Generic error dialog to be used in try/catch blocks.
+ *
+ * @deprecated Use CMS dialogs instead.
+ */
+@Deprecated
public class ErrorFeedback extends TitleAreaDialog {
private static final long serialVersionUID = -8918084784628179044L;
if (e instanceof ThreadDeath)
throw (ThreadDeath) e;
- new ErrorFeedback(getDisplay().getActiveShell(), message, e).open();
+ new ErrorFeedback(newShell(), message, e).open();
}
public static void show(String message) {
- new ErrorFeedback(getDisplay().getActiveShell(), message, null).open();
+ new ErrorFeedback(newShell(), message, null).open();
+ }
+
+ private static Shell newShell() {
+ return new Shell(getDisplay(), SWT.NO_TRIM);
}
/** Tries to find a display */
public ErrorFeedback(Shell parentShell, String message, Throwable e) {
super(parentShell);
+ setShellStyle(SWT.NO_TRIM);
this.message = message;
this.exception = e;
log.error(message, e);
composite.setLayout(new GridLayout(2, false));
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- setMessage(message != null ? message
- + (exception != null ? ": " + exception.getMessage() : "")
- : exception != null ? exception.getMessage() : "Unkown Error",
- IMessageProvider.ERROR);
+ setMessage(message != null ? message + (exception != null ? ": " + exception.getMessage() : "")
+ : exception != null ? exception.getMessage() : "Unkown Error", IMessageProvider.ERROR);
if (exception != null) {
- Text stack = new Text(composite, SWT.MULTI | SWT.LEAD | SWT.BORDER
- | SWT.V_SCROLL | SWT.H_SCROLL);
+ Text stack = new Text(composite, SWT.MULTI | SWT.LEAD | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
stack.setEditable(false);
stack.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
StringWriter sw = new StringWriter();