本文整理汇总了Java中org.eclipse.swt.widgets.MessageBox.setMessage方法的典型用法代码示例。如果您正苦于以下问题:Java MessageBox.setMessage方法的具体用法?Java MessageBox.setMessage怎么用?Java MessageBox.setMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.MessageBox
的用法示例。
在下文中一共展示了MessageBox.setMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: okPressed
import org.eclipse.swt.widgets.MessageBox; //导入方法依赖的package包/类
@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();
}
示例2: loadSchemaFromExternalFile
import org.eclipse.swt.widgets.MessageBox; //导入方法依赖的package包/类
/**
**
* This methods loads schema from external schema file
*
* @param externalSchemaFilePath
* @param schemaType
* @return
*/
public List<GridRow> loadSchemaFromExternalFile(String externalSchemaFilePath,String schemaType) {
IPath filePath=new Path(externalSchemaFilePath);
IPath copyOfFilePath=filePath;
if (!filePath.isAbsolute()) {
filePath = ResourcesPlugin.getWorkspace().getRoot().getFile(filePath).getRawLocation();
}
if(filePath!=null && filePath.toFile().exists()){
GridRowLoader gridRowLoader=new GridRowLoader(schemaType, filePath.toFile());
return gridRowLoader.importGridRowsFromXML();
}else{
MessageBox messageBox=new MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_ERROR);
messageBox.setMessage(Messages.FAILED_TO_IMPORT_SCHEMA_FILE+"\n"+copyOfFilePath.toString());
messageBox.setText(Messages.ERROR);
messageBox.open();
}
return null;
}
示例3: validateXML
import org.eclipse.swt.widgets.MessageBox; //导入方法依赖的package包/类
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;
}
}
示例4: toolSelected
import org.eclipse.swt.widgets.MessageBox; //导入方法依赖的package包/类
@Override
public void toolSelected() {
Sketch sketch = AvoGlobal.project.getActiveSketch();
if(sketch == null || sketch.isConsumed){
MessageBox m = new MessageBox(AvoGlobal.menuet.getShell(), SWT.ICON_QUESTION | SWT.OK);
m.setMessage( "You must select an unconsumed sketch before\n" +
"any 2Dto3D operations can be performed.\n\n" +
"Please create a new sketch or select one\n" +
"by double-clicking on it in the project's\n" +
"list of elements.");
m.setText("Please select a sketch");
m.open();
}else{
// there is a sketch active!
changeMenuetToolMode(Menuet.MENUET_MODE_BUILD);
// TODO: Building should not be done in the view!!
sketch.buildRegions();
int i = AvoGlobal.project.getActivePart().addNewFeat2D3D(sketch.getUniqueID());
AvoGlobal.project.getActivePart().setActiveSubPart(i);
}
}
示例5: updateParameterGridWindow
import org.eclipse.swt.widgets.MessageBox; //导入方法依赖的package包/类
private void updateParameterGridWindow(String[] listOfFilesToBeImported, String importLocation,ParamterFileTypes paramterFileTypes) {
for (String fileName : listOfFilesToBeImported) {
if (fileName != null) {
String absoluteFileName = importLocation + fileName;
parameterFileTextBox.setText(absoluteFileName);
parameterFiles.add(new ParameterFile(fileName, paramterFileTypes));
if(paramterFileTypes.equals(ParamterFileTypes.JOB_LEVEL)){
jobLevelParamterFiles.add(new ParameterFile(fileName, paramterFileTypes));
}
try {
parameterTableViewer.setData(MultiParameterFileDialogConstants.CURRENT_PARAM_FILE,
absoluteFileName);
Map<String, String> parameterMap = new LinkedHashMap<>();
parameterMap = ParameterFileManager.getInstance().getParameterMap(absoluteFileName);
setGridData(parameters, parameterMap);
} catch (IOException ioException) {
MessageBox messageBox = new MessageBox(new Shell(), SWT.ICON_ERROR | SWT.OK);
messageBox.setText(MessageType.ERROR.messageType());
messageBox.setMessage(ErrorMessages.UNABLE_TO_POPULATE_PARAM_FILE
+ ioException.getMessage());
messageBox.open();
logger.debug("Unable to populate parameter file", ioException.getMessage());
}
filePathTableViewer.refresh();
parameterTableViewer.refresh();
populateParameterSearchBox();
}
}
if(paramterFileTypes.equals(ParamterFileTypes.JOB_LEVEL)){
getComponentCanvas().addJobLevelParamterFiles(jobLevelParamterFiles);
}
parameterFileTextBox.setText("");
}
示例6: isFileExistsOnLocalFileSystem
import org.eclipse.swt.widgets.MessageBox; //导入方法依赖的package包/类
/**
* Check if file exist on local file system.
* @param jobFilePath
* @param textBox
* @return
*/
private boolean isFileExistsOnLocalFileSystem(IPath jobFilePath, Text textBox) {
jobFilePath=jobFilePath.removeFileExtension().addFileExtension(Constants.XML_EXTENSION_FOR_IPATH);
try {
if (ResourcesPlugin.getWorkspace().getRoot().getFile(jobFilePath).exists()){
return true;
}
else if (jobFilePath.toFile().exists()){
return true;
}
} catch (Exception exception) {
logger.error("Error occured while cheking file on local file system", exception);
}
MessageBox messageBox = new MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_WARNING | SWT.YES
| SWT.NO);
messageBox.setMessage(jobFilePath.lastSegment()+Messages.FILE_DOES_NOT_EXISTS);
messageBox.setText(jobFilePath.toString() +Messages.NOT_EXISTS);
int response = messageBox.open();
if (response == SWT.YES) {
jobFilePath=jobFilePath.removeFileExtension().addFileExtension(Constants.JOB_EXTENSION_FOR_IPATH);
textBox.setText(jobFilePath.toString().substring(1));
}
else{
textBox.setText("");
}
return false;
}
示例7: showErrorDialog
import org.eclipse.swt.widgets.MessageBox; //导入方法依赖的package包/类
/**
* 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();
}
示例8: showErrorMessage
import org.eclipse.swt.widgets.MessageBox; //导入方法依赖的package包/类
private int showErrorMessage(IFile xmlFile,String message) {
MessageBox messageBox = new MessageBox(Display.getCurrent().getActiveShell(),
SWT.ERROR | SWT.YES | SWT.NO);
messageBox.setText(ERROR);
messageBox.setMessage(message);
int returnCode = messageBox.open();
return returnCode;
}
示例9: notConfirmedByUser
import org.eclipse.swt.widgets.MessageBox; //导入方法依赖的package包/类
private boolean notConfirmedByUser() {
MessageBox messageBox = new MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_QUESTION | SWT.YES
| SWT.NO);
messageBox.setMessage(Messages.CONFIRM_TO_CREATE_SUBJOB_MESSAGE);
messageBox.setText(Messages.CONFIRM_TO_CREATE_SUBJOB_WINDOW_TITLE);
int response = messageBox.open();
if (response == SWT.YES) {
return false;
} else
return true;
}
示例10: showUnrecognizedDiskFormatMessage
import org.eclipse.swt.widgets.MessageBox; //导入方法依赖的package包/类
/**
* 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();
}
示例11: cancelPressed
import org.eclipse.swt.widgets.MessageBox; //导入方法依赖的package包/类
@Override
protected void cancelPressed() {
if (isAnyUpdatePerformed) {
int style = SWT.APPLICATION_MODAL | SWT.OK | SWT.CANCEL |SWT.ICON_INFORMATION;
MessageBox messageBox = new MessageBox(getShell(), style);
messageBox.setText(Messages.INFORMATION); //$NON-NLS-1$
messageBox.setMessage(Messages.MessageBeforeClosingWindow);
if (messageBox.open() == SWT.OK) {
closeDialog = super.close();
}
} else {
closeDialog = super.close();
}
}
示例12: alert
import org.eclipse.swt.widgets.MessageBox; //导入方法依赖的package包/类
private void alert(String info) {
MessageBox messageBox = new MessageBox(
JavaPlugin.getActiveWorkbenchShell());
messageBox.setText("提示");
messageBox.setMessage(info);
messageBox.open();
}
示例13: refreshDifference
import org.eclipse.swt.widgets.MessageBox; //导入方法依赖的package包/类
void refreshDifference () {
DeviceData info = display.getDeviceData ();
if (!info.tracking) {
MessageBox dialog = new MessageBox (shell, SWT.ICON_WARNING | SWT.OK);
dialog.setText (shell.getText ());
dialog.setMessage ("Warning: Device is not tracking resource allocation"); //$NON-NLS-1$
dialog.open ();
}
Object [] newObjects = info.objects;
Error [] newErrors = info.errors;
Object [] diffObjects = new Object [newObjects.length];
Error [] diffErrors = new Error [newErrors.length];
int count = 0;
for (int i=0; i<newObjects.length; i++) {
int index = 0;
while (index < oldObjects.length) {
if (newObjects [i] == oldObjects [index]) break;
index++;
}
if (index == oldObjects.length) {
diffObjects [count] = newObjects [i];
diffErrors [count] = newErrors [i];
count++;
}
}
objects = new Object [count];
errors = new Error [count];
System.arraycopy (diffObjects, 0, objects, 0, count);
System.arraycopy (diffErrors, 0, errors, 0, count);
list.removeAll ();
text.setText (""); //$NON-NLS-1$
canvas.redraw ();
for (int i=0; i<objects.length; i++) {
list.add (objectName (objects [i]));
}
refreshLabel ();
layout ();
}
示例14: execute
import org.eclipse.swt.widgets.MessageBox; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
File jobSpecificParamFile = new File(getComponentCanvas().getParameterFile());
if(!jobSpecificParamFile.exists()){
try {
jobSpecificParamFile.createNewFile();
} catch (IOException e) {
logger.debug("Unable to create job specific file ", e);
MessageBox messageBox = new MessageBox(new Shell(), SWT.ICON_ERROR | SWT.OK);
messageBox.setText(MessageType.ERROR.messageType());
messageBox.setMessage(ErrorMessages.UNABLE_TO_POPULATE_PARAM_FILE + e.getMessage());
messageBox.open();
}
}
String activeProjectLocation = MultiParameterFileUIUtils.getActiveProjectLocation();
List<ParameterFile> parameterFileList = getParameterFileList(activeProjectLocation);
parameterFileList.addAll(getComponentCanvas().getJobLevelParamterFiles());
MultiParameterFileDialog parameterFileDialog = new MultiParameterFileDialog(new Shell(), activeProjectLocation);
parameterFileDialog.setParameterFiles(parameterFileList);
parameterFileDialog.setJobLevelParamterFiles(getComponentCanvas().getJobLevelParamterFiles());
parameterFileDialog.open();
return null;
}
示例15: promptToSaveOnClose
import org.eclipse.swt.widgets.MessageBox; //导入方法依赖的package包/类
@Override
public int promptToSaveOnClose() {
MessageBox messageBox = new MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_WARNING);
messageBox.setText("Convertigo");
messageBox.setMessage("A transaction is currently running.\nThe connector editor can't be closed.");
messageBox.open();
return CANCEL;
}