📄 configurationerrordialog.java
字号:
/**
* Copyright (c) 2003-2006 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.actions;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IconAndMessageDialog;
import org.eclipse.jface.preference.PreferenceDialog;
import org.eclipse.jface.preference.PreferenceManager;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
/**
* A simple error dialog that display the fact that there
* is an error with the current configuration. In
* addition, the dialog provides the user with a button to
* launch into the preferences to set the configuration.
* <p />
* Copyright (c) 2003-2006 Craig Setera<br>
* All Rights Reserved.<br>
* Licensed under the Eclipse Public License - v 1.0<p/>
* <br>
* $Revision: 1.1 $
* <br>
* $Date: 2006/02/16 23:55:43 $
* <br>
* @author Craig Setera
*/
public class ConfigurationErrorDialog extends IconAndMessageDialog {
private String preferenceNodeId;
private String title;
private String buttonText;
/**
* @param parentShell
*/
public ConfigurationErrorDialog(
Shell parentShell,
String preferenceNodeId,
String title,
String message,
String buttonText)
{
super(parentShell);
this.title = title;
this.message = message;
this.preferenceNodeId = preferenceNodeId;
this.buttonText = buttonText;
}
/**
* @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
*/
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText(title);
}
/**
* @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
*/
protected void createButtonsForButtonBar(Composite parent) {
createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
}
/**
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
protected Control createDialogArea(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new GridLayout(2, false));
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
createMessageArea(composite);
new Label(composite, SWT.NONE);
new Label(composite, SWT.NONE);
new Label(composite, SWT.NONE);
Button configureProguardButton = new Button(composite, SWT.PUSH);
configureProguardButton.setText(buttonText);
configureProguardButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
Shell shell = e.widget.getDisplay().getActiveShell();
PreferenceManager manager = PlatformUI.getWorkbench().getPreferenceManager();
PreferenceDialog dialog = new PreferenceDialog(shell, manager);
dialog.setSelectedNode(preferenceNodeId);
dialog.open();
}
});
return composite;
}
/**
* @see org.eclipse.jface.dialogs.IconAndMessageDialog#getImage()
*/
protected Image getImage() {
return getErrorImage();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -