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