---
title: "RCP中的对话框和消息框"
author: "hlbng"
date: "2009-06-12T14:50:08Z"
tags: []
slug: "rcp"
draft: false
lastmod: "2009-06-12T14:50:08Z"
id: 407313
url: "https://hlbng.iteye.com/blog/407313"
---

```
//对话框
MessageBox mb = new MessageBox(PlatformUI.getWorkbench()
				.getActiveWorkbenchWindow().getShell(), SWT.ICON_QUESTION
				| SWT.YES | SWT.NO);
		mb.setText("Confirm Delete");
		mb.setMessage("你确认删除吗?");
		int buttonID = mb.open();
		switch (buttonID) {
		case SWT.NO:
			break;
		case SWT.YES:
			break;
		default:
			break;
		}
//消息框
MessageDialog.openWarning(null, "Warning", "Warning!");
```