當前位置: 首頁>>代碼示例>>Java>>正文


Java MessageBox.open方法代碼示例

本文整理匯總了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;
}
 
開發者ID:juanerasmoe,項目名稱:pmTrans,代碼行數:22,代碼來源:PmTrans.java

示例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;
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:27,代碼來源:ConverterUiHelper.java

示例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;
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:20,代碼來源:OverWriteWidgetSelectionListener.java

示例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;
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:20,代碼來源:VerifyTeraDataFastLoadOption.java

示例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;
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:11,代碼來源:MultiParameterFileDialog.java

示例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();
	}
}
 
開發者ID:juanerasmoe,項目名稱:pmTrans,代碼行數:29,代碼來源:PmTrans.java

示例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();
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:14,代碼來源:WidgetUtility.java

示例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;
	}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:39,代碼來源:MultiParameterFileDialog.java

示例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();
}
 
開發者ID:AppleCommander,項目名稱:AppleCommander,代碼行數:10,代碼來源:SwtUtil.java

示例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();
	}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:33,代碼來源:ELTGraphicalEditor.java

示例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();
}
 
開發者ID:AppleCommander,項目名稱:AppleCommander,代碼行數:10,代碼來源:SwtUtil.java

示例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;
}
 
開發者ID:pgcodekeeper,項目名稱:pgcodekeeper,代碼行數:14,代碼來源:ProjectEditorDiffer.java

示例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;
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:37,代碼來源:OperationClassComboChangeListener.java

示例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();
}
 
開發者ID:majinju,項目名稱:KettleEasyExpand,代碼行數:14,代碼來源:JobEntryEasyExpandDialog.java

示例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;
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:10,代碼來源:ConnectorEditor.java


注:本文中的org.eclipse.swt.widgets.MessageBox.open方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。