本文整理汇总了Java中org.eclipse.swt.widgets.MessageBox.setText方法的典型用法代码示例。如果您正苦于以下问题:Java MessageBox.setText方法的具体用法?Java MessageBox.setText怎么用?Java MessageBox.setText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.MessageBox
的用法示例。
在下文中一共展示了MessageBox.setText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: runWithObject
import org.eclipse.swt.widgets.MessageBox; //导入方法依赖的package包/类
@Override
public void runWithObject(Object object) throws Exception {
String typeName = getObjectTypeName(object);
if (typeName == null) {
return;
}
String name = getObjectName(object);
if (name == null) {
return;
}
MessageBox messageBox = new MessageBox(getActiveShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO);
messageBox.setMessage("Are you sure you want to delete the " + typeName + " '" + name + "'?");
messageBox.setText("Confirm Delete");
int response = messageBox.open();
if (response == SWT.YES) {
try {
delete(object);
}
catch (Exception e) {
throw new Exception("Failed to delete the " + typeName + " '" + name + "'.", e);
}
}
}
示例2: populateViewParameterFileBox
import org.eclipse.swt.widgets.MessageBox; //导入方法依赖的package包/类
private void populateViewParameterFileBox(ParameterFile parameterFile) {
//parameterFileTextBox.setText(file.getPath());
try {
Map<String, String> parameterMap = new LinkedHashMap<>();
parameterMap = ParameterFileManager.getInstance().getParameterMap(getParamterFileLocation(parameterFile));
setGridData(parameters, parameterMap);
parameterTableViewer.setData("CURRENT_PARAM_FILE", getParamterFileLocation(parameterFile));
} 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);
}
parameterTableViewer.refresh();
}
示例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: 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;
}
示例5: cancelPressed
import org.eclipse.swt.widgets.MessageBox; //导入方法依赖的package包/类
@Override
protected void cancelPressed() {
if (isAnyUpdatePerformed) {
int style = SWT.APPLICATION_MODAL | SWT.YES | SWT.NO |SWT.ICON_INFORMATION;
MessageBox messageBox = new MessageBox(new Shell(), style);
messageBox.setText(INFORMATION);
messageBox.setMessage(Messages.MessageBeforeClosingWindow);
if (messageBox.open() == SWT.YES) {
closeDialog = super.close();
}
} else {
closeDialog = super.close();
}
}
示例6: createMessageBox
import org.eclipse.swt.widgets.MessageBox; //导入方法依赖的package包/类
/**
* create SWT MessageBox
*
* @param message to be shown
* @param title of widow
* @param style to be set on window
*/
public static int createMessageBox(String message,String windowTitle,int style) {
Shell shell = new Shell();
MessageBox messageBox = new MessageBox(shell,style);
messageBox.setText(windowTitle);
messageBox.setMessage(message);
return messageBox.open();
}
示例7: errorMessage
import org.eclipse.swt.widgets.MessageBox; //导入方法依赖的package包/类
/**
* 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();
}
示例8: showMessage
import org.eclipse.swt.widgets.MessageBox; //导入方法依赖的package包/类
/**
*
* Show message box with ok button
*
* @param messageBoxTitle - Message box title
* @param message - Message to be displayed
*/
public void showMessage(String messageBoxTitle, String message) {
int shellStyle= SWT.APPLICATION_MODAL | SWT.OK | getMessageBoxIcon(messageBoxTitle);
MessageBox messageBox = new MessageBox(new Shell(),shellStyle);
messageBox.setText(messageBoxTitle);
messageBox.setMessage(message);
messageBox.open();
}
示例9: isDummyComponentAvailable
import org.eclipse.swt.widgets.MessageBox; //导入方法依赖的package包/类
private boolean isDummyComponentAvailable() {
ELTGraphicalEditor editor = SubJobUtility.getCurrentEditor();
Container container=editor.getContainer();
for(Component component:container.getUIComponentList()){
if(StringUtils.equals(component.getComponentName(), "UnknownComponent")){
MessageBox messageBox=new MessageBox(Display.getCurrent().getActiveShell(),SWT.ICON_WARNING);
messageBox.setMessage("Cannot run job with Dummy Component");
messageBox.setText("Warning");
messageBox.open();
return true;
}
}
return false;
}
示例10: 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;
}
示例11: getListener
import org.eclipse.swt.widgets.MessageBox; //导入方法依赖的package包/类
@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;
}
示例12: 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("");
}
示例13: 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();
}
示例14: ok
import org.eclipse.swt.widgets.MessageBox; //导入方法依赖的package包/类
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();
}
示例15: 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;
}