本文整理汇总了Java中org.eclipse.swt.widgets.MenuItem.getData方法的典型用法代码示例。如果您正苦于以下问题:Java MenuItem.getData方法的具体用法?Java MenuItem.getData怎么用?Java MenuItem.getData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.MenuItem
的用法示例。
在下文中一共展示了MenuItem.getData方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dialogBuild
import org.eclipse.swt.widgets.MenuItem; //导入方法依赖的package包/类
private void dialogBuild(ToolItem buildModeItem, MenuItem menuItem) {
MobileBuilderBuildMode newBuildMode = (MobileBuilderBuildMode) menuItem.getData();
if (dialogBuild(newBuildMode)) {
buildModeItem.setImage(menuItem.getImage());
buildModeItem.setToolTipText("Rebuild in: " + buildMode.label() + "\n" + buildMode.description());
try {
JSONObject device = new JSONObject(FileUtils.readFileToString(devicePref, "UTF-8"));
device.put("buildMode", buildMode.name());
FileUtils.write(devicePref, device.toString(4), "UTF-8");
} catch (Exception ex) {
Engine.logStudio.debug("Cannot save build mode", ex);
}
}
}
示例2: setDefaultToolItem
import org.eclipse.swt.widgets.MenuItem; //导入方法依赖的package包/类
public void setDefaultToolItem(final MenuItem menuItem) {
Check.notNull(menuItem, "menuItem"); //$NON-NLS-1$
toolItem.setImage(menuItem.getImage());
if (menuItem.getData(TOOLTIP_TEXT_WIDGET_DATA_KEY) != null) {
toolItem.setToolTipText((String) menuItem.getData(TOOLTIP_TEXT_WIDGET_DATA_KEY));
} else {
toolItem.setToolTipText(""); //$NON-NLS-1$
}
// Remember this menu item for future invocations
lastSelectedMenuItem = menuItem;
}
示例3: getSelectedImageFileType
import org.eclipse.swt.widgets.MenuItem; //导入方法依赖的package包/类
public String getSelectedImageFileType() {
String fileType = "view";
MenuItem mi = getCanvasWidget().getToolbar().getImageVersionDropdown().getSelected();
if (mi != null) {
fileType = (String) mi.getData();
}
return fileType;
}
示例4: updateDockingStateButtons
import org.eclipse.swt.widgets.MenuItem; //导入方法依赖的package包/类
private void updateDockingStateButtons() {
logger.debug("updateDockingStateButtons");
for (MenuItem mi : dockingMenuItems.values()) {
PositionDocking pd = (PositionDocking) mi.getData();
Docking currentDocking = portalWidget.getDocking(pd.pos);
mi.setSelection(pd.docking.equals(currentDocking)); // set selection depending on docking state!
}
}
示例5: selectItem
import org.eclipse.swt.widgets.MenuItem; //导入方法依赖的package包/类
public void selectItem(MenuItem item, boolean fireSelectionEvent) {
Assert.assertNotNull(item);
selected = item;
if (renderTextInMainItem) {
Object altText = item.getData(ALT_TXT_KEY);
if (altText != null) {
dropdown.setText((String) altText);
} else {
dropdown.setText(item.getText());
}
}
if ( (itemStyle & SWT.RADIO) == SWT.RADIO) {
for (MenuItem mi : menu.getItems()) {
mi.setSelection(mi==selected);
}
}
// selected.setSelection(true);
if (renderImageInMainItem)
dropdown.setImage(item.getImage());
dropdown.getParent().pack();
if (item.getData("tooltip") != null && item.getData("tooltip") instanceof String) {
dropdown.setToolTipText((String)item.getData("tooltip"));
}
// fire selection event on dropdown:
if (fireSelectionEvent) {
Event e = new Event();
e.index = findItemIndex(item);
logger.debug("firing selection event, data = "+item.getData());
e.data = item.getData();
e.detail = IS_DROP_DOWN_ITEM_DETAIL;
// dropdown.notifyListeners(SWT.Selection, new Event());
dropdown.notifyListeners(SWT.Selection, e);
}
}