本文整理汇总了Java中org.eclipse.swt.SWT.ICON_ERROR属性的典型用法代码示例。如果您正苦于以下问题:Java SWT.ICON_ERROR属性的具体用法?Java SWT.ICON_ERROR怎么用?Java SWT.ICON_ERROR使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.swt.SWT
的用法示例。
在下文中一共展示了SWT.ICON_ERROR属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validateLengthOfJobName
/**
*
* Validates length of job name
*
* @param {@link SaveAsDialog}
*/
public void validateLengthOfJobName(SaveAsDialog saveAsDialog) {
String jobName=saveAsDialog.getResult().removeFileExtension().lastSegment();
while(jobName.length()>50)
{
jobName=saveAsDialog.getResult().removeFileExtension().lastSegment();
if(jobName.length()>50)
{
MessageBox messageBox = new MessageBox(new Shell(), SWT.ICON_ERROR | SWT.OK);
messageBox.setText("Error");
messageBox.setMessage("File Name Too Long");
if(messageBox.open()==SWT.OK)
{
saveAsDialog.setOriginalName(jobName+".job");
IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(saveAsDialog.getResult());
saveAsDialog.setOriginalFile(file);
saveAsDialog.open();
if(saveAsDialog.getReturnCode()==1)
break;
}
}
}
}
示例2: okPressed
@Override
protected void okPressed() {
int dbport;
String port = txtDbPort.getText();
if(txtDbPort.getText().isEmpty()) {
dbport = 0;
} else {
try {
dbport = Integer.parseInt(port);
} catch (NumberFormatException ex) {
MessageBox mb = new MessageBox(getShell(), SWT.ICON_ERROR);
mb.setText(Messages.dbStoreEditorDialog_cannot_save_entry);
mb.setMessage(MessageFormat.format(
Messages.dbStoreEditorDialog_not_valid_port_number,
port));
mb.open();
return;
}
}
dbInfo = new DbInfo(txtName.getText(), txtDbName.getText(),
txtDbUser.getText(), txtDbPass.getText(),
txtDbHost.getText(), dbport);
super.okPressed();
}
示例3: publish
/**
* Publish a DownloadManager on our Tracker.
* <P>
* Doesn't require SWT Thread
*/
public static void
publish(
Core core,
DownloadManager dm)
{
if (dm == null) {
return;
}
TOTorrent torrent = dm.getTorrent();
if (torrent == null) {
return;
}
try {
core.getTrackerHost().publishTorrent(torrent);
} catch (TRHostException e) {
MessageBoxShell mb = new MessageBoxShell(
SWT.ICON_ERROR | SWT.OK,
MessageText.getString("MyTorrentsView.menu.host.error.title"),
MessageText.getString("MyTorrentsView.menu.host.error.message").concat(
"\n").concat(e.toString()));
mb.open(null);
}
}
示例4: host
/**
* Host a DownloadManager on our Tracker.
* <P>
* Doesn't require SWT Thread
*/
public static void
host(
Core core,
DownloadManager dm)
{
if (dm == null) {
return;
}
TOTorrent torrent = dm.getTorrent();
if (torrent == null) {
return;
}
try {
core.getTrackerHost().hostTorrent(torrent, true, false);
} catch (TRHostException e) {
MessageBoxShell mb = new MessageBoxShell(
SWT.ICON_ERROR | SWT.OK,
MessageText.getString("MyTorrentsView.menu.host.error.title"),
MessageText.getString("MyTorrentsView.menu.host.error.message").concat(
"\n").concat(e.toString()));
mb.open(null);
}
}
示例5: validateXML
private boolean validateXML(InputStream xml, InputStream xsd){
try
{
SchemaFactory factory =
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
javax.xml.validation.Schema schema = factory.newSchema(new StreamSource(xsd));
Validator validator = schema.newValidator();
validator.validate(new StreamSource(xml));
return true;
}
catch( SAXException| IOException ex)
{
//MessageDialog.openError(Display.getCurrent().getActiveShell(), "Error", Messages.IMPORT_XML_FORMAT_ERROR + "-\n" + ex.getMessage());
MessageBox dialog = new MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_ERROR | SWT.OK);
dialog.setText(Messages.ERROR);
dialog.setMessage(Messages.IMPORT_XML_FORMAT_ERROR + "-\n" + ex.getMessage());
logger.error(Messages.IMPORT_XML_FORMAT_ERROR);
return false;
}
}
示例6: preferences
public void preferences() {
try {
Config.getInstance().showConfigurationDialog(shell);
} catch (PmTransException e) {
MessageBox diag = new MessageBox(Display.getCurrent().getActiveShell(),
SWT.APPLICATION_MODAL | SWT.ICON_ERROR | SWT.OK);
diag.setMessage("Unable to save preferences");
diag.open();
}
}
示例7: showSaveError
/**
* Display the Save error dialog box.
* @see #save
* @see #saveAs
*/
protected void showSaveError(IOException ex) {
Shell finalShell = shell;
String errorMessage = ex.getMessage();
if (errorMessage == null) {
errorMessage = ex.getClass().getName();
}
MessageBox box = new MessageBox(finalShell,
SWT.ICON_ERROR | SWT.CLOSE);
box.setText(textBundle.get("SaveDiskImageErrorTitle")); //$NON-NLS-1$
box.setMessage(textBundle.format("SaveDiskImageErrorMessage", //$NON-NLS-1$
new Object[] { getDisk(0).getFilename(), errorMessage }));
box.open();
}
示例8: showUnrecognizedDiskFormatMessage
/**
* Displays the unrecognized disk format message.
* @param fullpath
*/
protected void showUnrecognizedDiskFormatMessage(String fullpath) {
Shell finalShell = shell;
MessageBox box = new MessageBox(finalShell, SWT.ICON_ERROR | SWT.OK);
box.setText(textBundle.get("SwtAppleCommander.UnrecognizedFormatTitle")); //$NON-NLS-1$
box.setMessage(
textBundle.format("SwtAppleCommander.UnrecognizedFormatMessage", //$NON-NLS-1$
fullpath));
box.open();
}
示例9: showOkCancelErrorDialog
/**
* Display a dialog box with the error icon and a ok/cancel button selection.
*/
public static int showOkCancelErrorDialog(Shell shell, String title, String message) {
MessageBox messageBox = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK | SWT.CANCEL);
messageBox.setText(title);
messageBox.setMessage(message);
return messageBox.open();
}
示例10: showErrorDialog
/**
* Display a dialog box with the error icon and only the ok button.
*/
public static void showErrorDialog(Shell shell, String title, String message) {
MessageBox messageBox = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
messageBox.setText(title);
messageBox.setMessage(message);
messageBox.open();
}
示例11: showMessageBox
private void showMessageBox(String exceptionMessage, String message) {
MessageBox messageBox = new MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_ERROR);
if(StringUtils.isNotBlank(exceptionMessage)){
messageBox.setMessage(message + "\n" + exceptionMessage);
} else{
messageBox.setMessage(message);
}
messageBox.open();
}
示例12: ok
private void ok() {
if ( Const.isEmpty( wName.getText() ) ) {
MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
mb.setText( BaseMessages.getString( PKG, "System.StepJobEntryNameMissing.Title" ) );
mb.setMessage( BaseMessages.getString( PKG, "System.JobEntryNameMissing.Msg" ) );
mb.open();
return;
}
jobEntry.setName( wName.getText() );
jobEntry.setConfigInfo( wConfigInfo.getText() );
jobEntry.setClassName( wClassName.getText() );
dispose();
}
示例13: getListener
@Override
public Listener getListener(final PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helpers,
Widget... widgets) {
final Widget[] widgetList = widgets;
Listener listener = new Listener() {
@Override
public void handleEvent(Event event) {
String comboValue = ((Combo) widgetList[0]).getText();
propertyDialogButtonBar.enableApplyButton(true);
if (Messages.CUSTOM.equalsIgnoreCase(comboValue) && !FilterOperationClassUtility.INSTANCE.isCheckBoxSelected()) {
((Text) widgetList[1]).setText("");
((Text) widgetList[1]).setEnabled(true);
FilterOperationClassUtility.INSTANCE.enableAndDisableButtons(true, false);
} else {
if(FilterOperationClassUtility.INSTANCE.isCheckBoxSelected())
{
MessageBox messageBox = new MessageBox(new Shell(), SWT.ICON_ERROR | SWT.OK);
messageBox.setText(Messages.ERROR);
messageBox.setMessage(Messages.CHECKBOX_DISABLE_MESSAGE);
if (messageBox.open() == SWT.OK) {
((Combo) widgetList[0]).setText(Messages.CUSTOM);
}
}
else
{
FilterOperationClassUtility.INSTANCE.setOperationClassNameInTextBox(comboValue, (Text)widgetList[1]);
((Text) widgetList[1]).setEnabled(false);
FilterOperationClassUtility.INSTANCE.enableAndDisableButtons(false, false);
((Button) widgetList[2]).setEnabled(false);
}
}
}
};
return listener;
}
示例14: getMessageBoxIcon
private int getMessageBoxIcon(String messageBoxType){
if(StringUtils.equals(MessageBoxText.ERROR, messageBoxType)){
return SWT.ICON_ERROR;
}else if(StringUtils.equals(MessageBoxText.WARNING, messageBoxType)){
return SWT.ICON_WARNING;
}else{
return SWT.ICON_INFORMATION;
}
}
示例15: errorMessage
/**
* Error message.
*
* @param message
* the message
*/
public static void errorMessage(String message) {
Shell shell = new Shell();
MessageBox messageBox = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
messageBox.setText(ERROR);
messageBox.setMessage(message);
messageBox.open();
}