本文整理匯總了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));
}
}
}
}