📄 errortextwithcontinuedialog.java
字号:
/**
* Copyright (c) 2004 Craig Setera
* All Rights Reserved.
* Licensed under the Eclipse Public License - v 1.0
* For more information see http://www.eclipse.org/legal/epl-v10.html
*/
package eclipseme.ui.internal.dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
/**
* A dialog that shows a large amount of text and allows
* for continue or cancel. (Continue returns IDialogConstants.OK_ID).
* <p />
* Copyright (c) 2004 Craig Setera<br>
* All Rights Reserved.<br>
* Licensed under the Eclipse Public License - v 1.0<p/>
* <br>
* $Revision: 1.2 $
* <br>
* $Date: 2004/11/22 02:08:40 $
* <br>
* @author Craig Setera
*/
public class ErrorTextWithContinueDialog extends MessageDialog {
private String dialogMessage;
/**
* Prompt the user concerning whether to continue. Return
* a boolean indicating whether to continue.
*
* @param parentShell
* @param dialogTitle
* @param dialogMessage
* @return
*/
public static boolean promptToContinue(
Shell parentShell,
String dialogTitle,
String dialogMessage)
{
ErrorTextWithContinueDialog dialog = new ErrorTextWithContinueDialog(
parentShell,
dialogTitle,
dialogMessage);
return dialog.open() == 0;
}
/**
* Construct a new dialog.
*
* @param parentShell
* @param dialogTitle
* @param dialogMessage
*/
public ErrorTextWithContinueDialog(
Shell parentShell,
String dialogTitle,
String dialogMessage)
{
super(
parentShell,
dialogTitle,
null,
dialogTitle,
WARNING,
new String[] { "Continue", IDialogConstants.CANCEL_LABEL },
0); // continue is the default
this.dialogMessage = dialogMessage;
}
/**
* @see org.eclipse.jface.dialogs.MessageDialog#createCustomArea(org.eclipse.swt.widgets.Composite)
*/
protected Control createCustomArea(Composite parent) {
Text textarea = new Text(parent, SWT.MULTI | SWT.READ_ONLY | SWT.WRAP);
textarea.setText(dialogMessage);
return textarea;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -