本文整理汇总了Java中org.eclipse.swt.events.MouseEvent.getSource方法的典型用法代码示例。如果您正苦于以下问题:Java MouseEvent.getSource方法的具体用法?Java MouseEvent.getSource怎么用?Java MouseEvent.getSource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.events.MouseEvent
的用法示例。
在下文中一共展示了MouseEvent.getSource方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildContextMenu
import org.eclipse.swt.events.MouseEvent; //导入方法依赖的package包/类
private void buildContextMenu(MouseEvent e) {
Point point = new Point(e.x, e.y);
TreeItem treeItem = getTree().getItem(point);
Menu menu = new Menu((Control)e.getSource());
Iterator<MenuMaker> i = menuMakers.iterator();
int cpt = 0;
while(i.hasNext()) {
i.next().makeMenu(this, treeItem, e, menu);
if (i.hasNext() && menu.getItemCount() != cpt) {
new MenuItem(menu, SWT.SEPARATOR);
cpt = menu.getItemCount();
}
}
if (menu.getItemCount() > 0) {
menu.setVisible(true);
} else {
menu.dispose();
}
}
示例2: mouseUp
import org.eclipse.swt.events.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseUp(MouseEvent e) {
if (e.getSource() instanceof Button) {
Button sel = (Button) e.getSource();
if (sel.getText().equalsIgnoreCase("Save")) {
try {
String tempText = util.processAdd(isEdit, editName, comp, type, editor.getDocumentProvider().getDocument(getEditorInput()).get());
editor.getDocumentProvider().getDocument(getEditorInput()).set(tempText);
createPage1();
setActivePage(1);
} catch (JAXBException ex) {
ErrorDialog.openError(getSite().getShell(), "Error removing item", null, new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, 0, "Error removing item", null));
}
}
}
}
示例3: mouseUp
import org.eclipse.swt.events.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseUp(MouseEvent e) {
if (e.getSource() instanceof Button) {
Button sel = (Button) e.getSource();
if (sel.getText().equalsIgnoreCase("Save")) {
try {
String tempText = sUtil.processAdd(isEdit, editName, comp, type, editor.getDocumentProvider().getDocument(getEditorInput()).get());
editor.getDocumentProvider().getDocument(getEditorInput()).set(tempText);
createPage1();
setActivePage(1);
} catch (JAXBException ex) {
ErrorDialog.openError(getSite().getShell(), "Error removing item", null, new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, 0, "Error removing item", null));
}
}
}
}