本文整理了Java中org.eclipse.swt.widgets.Menu.setData()
方法的一些代码示例,展示了Menu.setData()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Menu.setData()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Menu
类名称:Menu
方法名:setData
暂无
代码示例来源:origin: BiglySoftware/BiglyBT
@Override
public void menuWillBeShown(MdiEntry entry, Menu menuTree) {
menuTree.setData("downloads", new DownloadManager[] {
manager
});
menuTree.setData("is_detailed_view", true);
MenuFactory.buildTorrentMenu(menuTree);
}
});
代码示例来源:origin: BiglySoftware/BiglyBT
@Override
public void handleEvent(Event event) {
menu.setData("inBlankArea", false);
menu.setData("isHeader", true);
Point pt = cHeaderArea.toControl(event.x, event.y);
menu.setData("column", getTableColumnByOffset(pt.x));
}
});
代码示例来源:origin: BiglySoftware/BiglyBT
@Override
public void
handleEvent(
Event event)
{
Point pt = pieceInfoCanvas.toControl(event.x, event.y);
int piece_number = getPieceNumber( pt.x, pt.y );
menu.setData( "pieceNumber", piece_number );
}
});
代码示例来源:origin: BiglySoftware/BiglyBT
@Override
public void
handleEvent(
Event event)
{
Point pt = fileInfoCanvas.toControl(event.x, event.y);
int piece_number = getPieceNumber( pt.x, pt.y );
menu.setData( "pieceNumber", piece_number );
}
});
代码示例来源:origin: BiglySoftware/BiglyBT
@Override
public void handleEvent(Event event) {
if (event.widget == cHeaderArea) {
menu.setData("inBlankArea", false);
menu.setData("isHeader", true);
} else {
TableRowCore row = getTableRowWithCursor();
boolean noRow = row == null;
// If shell is not active, right clicking on a row will
// result in a MenuDetect, but not a MouseDown or MouseUp
if (!isSelected(row)) {
setSelectedRows(new TableRowCore[] { row });
}
menu.setData("inBlankArea", noRow);
menu.setData("isHeader", false);
}
Point pt = cHeaderArea.toControl(event.x, event.y);
menu.setData("column", getTableColumnByOffset(pt.x));
}
});
代码示例来源:origin: BiglySoftware/BiglyBT
@Override
public void menuWillBeShown(MdiEntry entry, Menu menuTree) {
// todo: This even work?
TableView<?> tv = SelectedContentManager.getCurrentlySelectedTableView();
menuTree.setData("TableView", tv);
DownloadManager manager = DataSourceUtils.getDM(((BaseMdiEntry) entry).getDatasourceCore());
if (manager != null) {
menuTree.setData("downloads", new DownloadManager[] {
manager
});
}
menuTree.setData("is_detailed_view", Boolean.TRUE);
MenuFactory.buildTorrentMenu(menuTree);
}
代码示例来源:origin: com.eclipsesource.tabris/tabris
private void createProposalsMenu() {
if( proposalsMenu == null ) {
proposalsMenu = new Menu( getControl().getShell(), SWT.POP_UP );
proposalsMenu.setData( RWT.CUSTOM_VARIANT, CUSTOM_VARIANT_TABRIS_UI );
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.workbench.renderers.swt
private void openMenuFor(MPart part, CTabFolder folder, Point point) {
Menu tabMenu = createTabMenu(folder, part);
tabMenu.setData(STACK_SELECTED_PART, part);
tabMenu.setLocation(point.x, point.y);
tabMenu.setVisible(true);
}
代码示例来源:origin: org.eclipse.e4.ui.workbench.renderers/swt
private void openMenuFor(MPart part, CTabFolder folder, Point point) {
Menu tabMenu = createTabMenu(folder, part);
tabMenu.setData(STACK_SELECTED_PART, part);
tabMenu.setLocation(point.x, point.y);
tabMenu.setVisible(true);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface
/**
* Creates and returns an SWT menu bar control for this menu,
* for use in the given <code>Decorations</code>, and installs all registered
* contributions. Does not create a new control if one already exists.
*
* @param parent the parent decorations
* @return the menu control
* @since 2.1
*/
public Menu createMenuBar(Decorations parent) {
if (!menuExist()) {
menu = new Menu(parent, SWT.BAR);
menu.setData(MANAGER_KEY, this);
update(false);
}
return menu;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface
/**
* Creates and returns an SWT menu bar control for this menu,
* for use in the given <code>Decorations</code>, and installs all registered
* contributions. Does not create a new control if one already exists.
*
* @param parent the parent decorations
* @return the menu control
* @since 2.1
*/
public Menu createMenuBar(Decorations parent) {
if (!menuExist()) {
menu = new Menu(parent, SWT.BAR);
menu.setData(MANAGER_KEY, this);
update(false);
}
return menu;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface
/**
* Creates and returns an SWT context menu control for this menu,
* and installs all registered contributions.
* Does not create a new control if one already exists.
* <p>
* Note that the menu is not expected to be dynamic.
* </p>
*
* @param parent the parent control
* @return the menu control
*/
public Menu createContextMenu(Control parent) {
if (!menuExist()) {
menu = new Menu(parent);
menu.setData(MANAGER_KEY, this);
initializeMenu();
}
return menu;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface
/**
* Creates and returns an SWT context menu control for this menu,
* and installs all registered contributions.
* Does not create a new control if one already exists.
* <p>
* Note that the menu is not expected to be dynamic.
* </p>
*
* @param parent the parent control
* @return the menu control
*/
public Menu createContextMenu(Control parent) {
if (!menuExist()) {
menu = new Menu(parent);
menu.setData(MANAGER_KEY, this);
initializeMenu();
}
return menu;
}
代码示例来源:origin: org.xworker/xworker_swt
public Menu getPopMenu(Shell shell, Control c, String thingPath, boolean isAttribute, ActionContext actionContext){
DesignPopMenuListener popSelectionListener = new DesignPopMenuListener(thingPath, actionContext, c, isAttribute);
final Menu popMenu = new Menu(c.getShell(), SWT.POP_UP);
//popMenu.addDisposeListener(popSelectionListener);
popMenu.setData(popSelectionListener);
createPopMenuItem(popMenu, popSelectionListener, actionContext);
return popMenu;
}
代码示例来源:origin: BiglySoftware/BiglyBT
@Override
public void runSupport() {
final MenuItem torrentItem = MenuFactory.findMenuItem(
mainWindow.getMainMenu().getMenu(IMenuConstants.MENU_ID_MENU_BAR),
MenuFactory.MENU_ID_TORRENT, false);
if (null != torrentItem) {
DownloadManager[] dms = SelectedContentManager.getDMSFromSelectedContent();
final DownloadManager[] dm_final = dms;
final boolean detailed_view_final = false;
if (null == dm_final) {
torrentItem.setEnabled(false);
} else {
TableView<?> tv = SelectedContentManager.getCurrentlySelectedTableView();
torrentItem.getMenu().setData("TableView", tv);
torrentItem.getMenu().setData("downloads", dm_final);
torrentItem.getMenu().setData("is_detailed_view",
Boolean.valueOf(detailed_view_final));
torrentItem.setEnabled(true);
}
}
}
});
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench
@Override
public void setHelp(Menu menu, String contextId) {
if (WorkbenchPlugin.DEBUG)
setHelpTrace(contextId);
menu.setData(HELP_KEY, contextId);
// ensure that the listener is only registered once
menu.removeHelpListener(getHelpListener());
menu.addHelpListener(getHelpListener());
}
代码示例来源:origin: BiglySoftware/BiglyBT
public static MenuItem createTopLevelMenuItem(Menu menuParent,
String localizationKey) {
Menu menu = new Menu(Utils.findAnyShell(), SWT.DROP_DOWN);
MenuItem menuItem = new MenuItem(menuParent, SWT.CASCADE);
Messages.setLanguageText(menuItem, localizationKey);
menuItem.setMenu(menu);
/*
* A top level menu and its menu item has the same ID; this is used to locate them at runtime
*/
menu.setData(KEY_MENU_ID, localizationKey);
menuItem.setData(KEY_MENU_ID, localizationKey);
return menuItem;
}
代码示例来源:origin: com.eclipsesource.tabris/tabris
private void createPageSwitcher() {
pageSwitcher = new ToolBar( uiParent, SWT.NONE );
pageSwitcher.setData( RWT.CUSTOM_VARIANT, CUSTOM_VARIANT_TABRIS_UI );
pageSwitcher.setLayoutData( new GridData( GridData.FILL, GridData.CENTER, false, false ) );
ToolItem pageSwitcherDropDown = new ToolItem( pageSwitcher, SWT.DROP_DOWN );
pageSwitcherDropDown.setData( RWT.CUSTOM_VARIANT, CUSTOM_VARIANT_TABRIS_UI );
pageSwitcherDropDown.addListener( SWT.Selection, new PageSwitcherSelectionListener() );
pageSwitcherMenu = new Menu( uiParent.getShell(), SWT.POP_UP );
pageSwitcherMenu.setData( RWT.CUSTOM_VARIANT, CUSTOM_VARIANT_TABRIS_UI );
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.forms
private void createMenu() {
Menu menu = new Menu(this);
final MenuItem copyItem = new MenuItem(menu, SWT.PUSH);
copyItem.setText(Messages.FormText_copy);
SelectionListener listener = new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (e.widget == copyItem) {
copy();
}
}
};
copyItem.addSelectionListener(listener);
menu.addMenuListener(new MenuListener() {
@Override
public void menuShown(MenuEvent e) {
copyItem.setEnabled(canCopy());
}
@Override
public void menuHidden(MenuEvent e) {
}
});
menu.setData(INTERNAL_MENU);
super.setMenu(menu);
}
代码示例来源:origin: org.xworker/xworker_swt
public static Menu createQuickMenu(ActionContext actionContext){
Thing self = (Thing) actionContext.get("self");
Menu menu = null;
Object parent = actionContext.get("parent");
if(parent instanceof Shell){
Shell shell = (Shell) parent;
menu = new Menu(shell, SWT.BAR);
menu.setData(Designer.DATA_THING, self.getMetadata().getPath());
shell.setMenuBar(menu);
actionContext.peek().put("menu", menu);
}else{
menu = new Menu((Control) parent);
menu.setData(Designer.DATA_THING, self.getMetadata().getPath());
((Control) parent).setMenu(menu);
actionContext.peek().put("menu", menu);
}
for(Thing child : self.getChilds("Menu")){
child.doAction("create", actionContext);
}
return menu;
}
内容来源于网络,如有侵权,请联系作者删除!