增加Table的Column右键菜单

	table.addListener(SWT.MenuDetect, new Listener() {
		public void handleEvent(Event event) {
			Point pt = display.map(null, table, new Point(event.x, event.y));
			Rectangle clientArea = table.getClientArea();
			boolean header = clientArea.y <= pt.y && pt.y < (clientArea.y + table.getHeaderHeight());
			table.setMenu(header ? headerMenu : tableMenu);
		}
	});
	
	/* IMPORTANT: Dispose the menus (only the current menu, set with setMenu(), will be automatically disposed) */
	table.addListener(SWT.Dispose, new Listener() {
		public void handleEvent(Event event) {
			headerMenu.dispose();
			tableMenu.dispose();
		}
	});

 

你可能感兴趣的:(column)