本文整理汇总了Java中org.eclipse.swt.widgets.MessageBox.open方法的典型用法代码示例。如果您正苦于以下问题:Java MessageBox.open方法的具体用法?Java MessageBox.open怎么用?Java MessageBox.open使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.MessageBox
的用法示例。
在下文中一共展示了MessageBox.open方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: closeTranscription
import org.eclipse.swt.widgets.MessageBox; //导入方法依赖的package包/类
/**
* @return true if the transcription was closed, false if the operation was
* cancelled
*/
protected boolean closeTranscription() {
if (!textEditor.isDisposed()) {
if (textEditor.isChanged()) {
MessageBox diag = new MessageBox(shell,
SWT.APPLICATION_MODAL | SWT.ICON_QUESTION | SWT.YES | SWT.NO | SWT.CANCEL);
diag.setMessage("You have unsaved changes, would you like to save them?");
int opt = diag.open();
if (opt == SWT.YES)
saveTranscription();
if (opt == SWT.CANCEL)
return false;
}
textEditor.clear();
transcriptionFile = null;
}
return true;
}
示例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: getListener
import org.eclipse.swt.widgets.MessageBox; //导入方法依赖的package包/类
@Override
public Listener getListener(final PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helper,
Widget... widgets) {
final Widget[] widgetList = widgets;
Listener listener = new Listener() {
@Override
public void handleEvent(Event event) {
if (StringUtils.equalsIgnoreCase(((Combo) widgetList[0]).getText(), String.valueOf(Boolean.TRUE))) {
MessageBox messageBox = new MessageBox(Display.getCurrent().getActiveShell(),
SWT.ICON_INFORMATION | SWT.OK);
messageBox.setText(INFORMATION);
messageBox.setMessage("All files at given location will be overwritten.");
messageBox.open();
}
}
};
return listener;
}
示例4: getListener
import org.eclipse.swt.widgets.MessageBox; //导入方法依赖的package包/类
@Override
public Listener getListener(PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helpers,
Widget... widgets) {
final Widget[] widgetList = widgets;
Listener listener = new Listener() {
@Override
public void handleEvent(Event event) {
if (StringUtils.equalsIgnoreCase(((Button) widgetList[0]).getText(), String.valueOf(FAST_LOAD)) && ((Button) widgetList[0]).getSelection() ) {
MessageBox messageBox = new MessageBox(Display.getCurrent().getActiveShell(),
SWT.ICON_INFORMATION | SWT.OK);
messageBox.setText(INFORMATION);
messageBox.setMessage(Messages.FAST_LOAD_ERROR_MESSAGE);
messageBox.open();
}
}
};
return listener;
}
示例5: isParamterFileNameExistInFileGrid
import org.eclipse.swt.widgets.MessageBox; //导入方法依赖的package包/类
private boolean isParamterFileNameExistInFileGrid(String[] listOfFilesToBeImported, ParamterFileTypes paramterFileTypes) {
if (ifDuplicate(listOfFilesToBeImported, paramterFileTypes)) {
MessageBox messageBox = new MessageBox(new Shell(), SWT.ICON_INFORMATION | SWT.OK);
messageBox.setText(MessageType.INFO.messageType());
messageBox.setMessage(ErrorMessages.FILE_EXIST);
messageBox.open();
return true;
}
return false;
}
示例6: openAudioFile
import org.eclipse.swt.widgets.MessageBox; //导入方法依赖的package包/类
protected void openAudioFile(File file) {
// Add new file to cache and refresh the list
closePlayer();
// Create the player
try {
if (file != null && file.exists()) {
player = new AudioPlayerTarsosDSP(file);
GridData gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
gd.verticalAlignment = SWT.FILL;
player.initGUI(shell, gd);
audioFilesCache.add(file);
shell.layout();
} else {
createNewDummyPlayer();
audioFilesCache.remove(file);
MessageBox diag = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK);
diag.setMessage("Unable to open file " + file.getPath());
diag.open();
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例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: importParamterFileToProject
import org.eclipse.swt.widgets.MessageBox; //导入方法依赖的package包/类
private boolean importParamterFileToProject(String[] listOfFilesToBeImported, String source,String destination, ParamterFileTypes paramterFileTypes) {
for (String fileName : listOfFilesToBeImported) {
String absoluteFileName = source + fileName;
IPath destinationIPath=new Path(destination);
destinationIPath=destinationIPath.append(fileName);
File destinationFile=destinationIPath.toFile();
try {
if (!ifDuplicate(listOfFilesToBeImported, paramterFileTypes)) {
if (StringUtils.equalsIgnoreCase(absoluteFileName, destinationFile.toString())) {
return true;
} else if (destinationFile.exists()) {
int returnCode = doUserConfirmsToOverRide();
if (returnCode == SWT.YES) {
FileUtils.copyFileToDirectory(new File(absoluteFileName), new File(destination));
} else if (returnCode == SWT.NO) {
return true;
} else {
return false;
}
} else {
FileUtils.copyFileToDirectory(new File(absoluteFileName), new File(destination));
}
}
} catch (IOException e1) {
if(StringUtils.endsWithIgnoreCase(e1.getMessage(), ErrorMessages.IO_EXCEPTION_MESSAGE_FOR_SAME_FILE)){
return true;
}
MessageBox messageBox = new MessageBox(new Shell(), SWT.ICON_ERROR | SWT.OK);
messageBox.setText(MessageType.ERROR.messageType());
messageBox.setMessage(ErrorMessages.UNABLE_TO_POPULATE_PARAM_FILE + " " + e1.getMessage());
messageBox.open();
logger.error("Unable to copy prameter file in current project work space");
return false;
}
}
return true;
}
示例9: 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();
}
示例10: saveParameters
import org.eclipse.swt.widgets.MessageBox; //导入方法依赖的package包/类
public void saveParameters() {
//get map from file
Map<String,String> currentParameterMap = getCurrentParameterMap();
if(currentParameterMap == null){
return;
}
List<String> letestParameterList = getLatestParameterList();
Map<String,String> newParameterMap = new LinkedHashMap<>();
for(int i=0;i<letestParameterList.size();i++){
newParameterMap.put(letestParameterList.get(i), "");
}
for(String parameterName : currentParameterMap.keySet()){
newParameterMap.put(parameterName, currentParameterMap.get(parameterName));
}
try {
ParameterFileManager.getInstance().storeParameters(newParameterMap,null, getParameterFile());
} catch (IOException e) {
logger.error("Unable to store parameters to the file", e);
MessageBox messageBox = new MessageBox(new Shell(), SWT.ICON_ERROR | SWT.OK );
messageBox.setText("Error");
messageBox.setMessage("Unable to store parameters to the file - \n" + e.getMessage());
messageBox.open();
}
refreshParameterFileInProjectExplorer();
}
示例11: showYesNoDialog
import org.eclipse.swt.widgets.MessageBox; //导入方法依赖的package包/类
/**
* Display a dialog box with the question icon and a yes/no button selection.
*/
public static int showYesNoDialog(Shell shell, String title, String message) {
MessageBox messageBox = new MessageBox(shell, SWT.ICON_QUESTION | SWT.YES | SWT.NO);
messageBox.setText(title);
messageBox.setMessage(message);
return messageBox.open();
}
示例12: warnCheckedElements
import org.eclipse.swt.widgets.MessageBox; //导入方法依赖的package包/类
/**
* @return number of checked elements
*/
private int warnCheckedElements() {
int checked = diffTable.getCheckedElementsCount();
if (checked < 1) {
MessageBox mb = new MessageBox(parent.getShell(), SWT.ICON_INFORMATION);
mb.setMessage(Messages.please_check_at_least_one_row);
mb.setText(Messages.empty_selection);
mb.open();
}
return checked;
}
示例13: 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;
}
示例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: 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;
}