本文整理汇总了Java中org.eclipse.jface.action.IAction.setImageDescriptor方法的典型用法代码示例。如果您正苦于以下问题:Java IAction.setImageDescriptor方法的具体用法?Java IAction.setImageDescriptor怎么用?Java IAction.setImageDescriptor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.action.IAction
的用法示例。
在下文中一共展示了IAction.setImageDescriptor方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPreferenceAction
import org.eclipse.jface.action.IAction; //导入方法依赖的package包/类
private IAction createPreferenceAction(String label, String preference, String icon) {
IAction ret = new Action(label, IAction.AS_CHECK_BOX) {
@Override
public void run() {
Activator.getDefault().getPreferenceStore().setValue(preference, isChecked());
try {
viewer.reset();
} catch (Exception e) {
logger.error("Cannot refresh scannable viewer!", e);
}
}
};
ret.setImageDescriptor(Activator.getImageDescriptor(icon));
ret.setChecked(Activator.getDefault().getPreferenceStore().getBoolean(preference));
return ret;
}
示例2: buildContextMenu
import org.eclipse.jface.action.IAction; //导入方法依赖的package包/类
public void buildContextMenu(IMenuManager menu) {
GEFActionConstants.addStandardActionGroups(menu);
menu.appendToGroup(GEFActionConstants.GROUP_UNDO, getAction(ActionFactory.UNDO.getId()));
menu.appendToGroup(GEFActionConstants.GROUP_UNDO, getAction(ActionFactory.REDO.getId()));
menu.appendToGroup(GEFActionConstants.GROUP_EDIT, getAction(ActionFactory.DELETE.getId()));
menu.appendToGroup(GEFActionConstants.GROUP_EDIT, getAction(ActionIdConstants.MODIFY_ACTION_ID));
IAction saveAction = getAction(ActionFactory.SAVE.getId());
saveAction.setImageDescriptor(Activator.getImageDescriptor(Activator.IMAGE_SAVE));
menu.appendToGroup(GEFActionConstants.GROUP_SAVE, saveAction);
menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, createExportMenuManager());
menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, getAction(ActionIdConstants.IMPORT_DATABASE_ACTION_ID));
menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, getAction(ActionIdConstants.CHANGE_DATABASE_ACTION_ID));
}
示例3: createPreferenceAction
import org.eclipse.jface.action.IAction; //导入方法依赖的package包/类
private IAction createPreferenceAction(String label, String preference, String icon) {
IAction ret = new Action(label, IAction.AS_CHECK_BOX) {
@Override
public void run() {
Activator.getDefault().getPreferenceStore().setValue(preference, isChecked());
viewer.refresh();
}
};
ret.setImageDescriptor(Activator.getImageDescriptor(icon));
ret.setChecked(Activator.getDefault().getPreferenceStore().getBoolean(preference));
return ret;
}
示例4: createRegionActions
import org.eclipse.jface.action.IAction; //导入方法依赖的package包/类
private IAction createRegionActions() {
final String regionViewName = PlotUtil.getRegionViewName();
final ToolTip tip = new ToolTip(viewer.getTable().getShell(), SWT.BALLOON);
MenuAction rois = new MenuAction("Add Region");
ActionContributionItem menu = (ActionContributionItem)system.getActionBars().getMenuManager().find(BasePlottingConstants.ADD_REGION);
IAction menuAction = (IAction)menu.getAction();
for (RegionType regionType : regionTypes) {
IAction action = new Action("Press to click and drag a "+regionType.getName()+" on '"+PlotUtil.getRegionViewName()+"'") {
@Override
public void run() {
try {
ScanRegions.createRegion(system, regionType, null);
ViewUtil.showTip(tip, "Click and drag in the '"+regionViewName+"' to create a scan region.");
} catch (Exception e) {
logger.error("Unable to create region!", e);
}
rois.setSelectedAction(this);
}
};
final ImageDescriptor des = findImageDescriptor(menuAction, regionType.getId());
action.setImageDescriptor(des);
rois.add(action);
}
rois.setSelectedAction(rois.getAction(0));
return rois;
}
示例5: createButtonAction
import org.eclipse.jface.action.IAction; //导入方法依赖的package包/类
private IAction createButtonAction(String propName, String label, String iconPath, DelegatingSelectionProvider prov) {
IAction ret = new Action(label, IAction.AS_CHECK_BOX) {
@Override
public void run() {
updatePositionSelection(propName, isChecked(), prov);
}
};
ret.setChecked(store.getBoolean(propName));
ret.setImageDescriptor(Activator.getImageDescriptor(iconPath));
return ret;
}
示例6: createPreferenceAction
import org.eclipse.jface.action.IAction; //导入方法依赖的package包/类
private IAction createPreferenceAction(String label, String preference, String icon) {
IAction ret = new Action(label, IAction.AS_CHECK_BOX) {
@Override
public void run() {
Activator.getDefault().getPreferenceStore().setValue(preference, isChecked());
updateJob.schedule();
}
};
ret.setImageDescriptor(Activator.getImageDescriptor(icon));
ret.setChecked(Activator.getDefault().getPreferenceStore().getBoolean(preference));
return ret;
}
示例7: fillContextMenu
import org.eclipse.jface.action.IAction; //导入方法依赖的package包/类
@SuppressWarnings("restriction")
@Override
public void fillContextMenu(IMenuManager menu) {
super.fillContextMenu(menu);
ActionContributionItem pasteContribution = getPasteContribution(menu.getItems());
menu.remove(pasteContribution);
IAction pasteAction = new Action(PASTE_ACTION_TEXT) {
@Override
public void run() {
IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench()
.getService(IHandlerService.class);
try {
JobCopyParticipant.setCopiedFileList(new ArrayList<>());
handlerService.executeCommand(PASTE_COMMAND_ID, null);
} catch (Exception exception) {
logger.warn("Error while pasting job files :: {}",exception.getMessage());
}
}
};
pasteAction.setAccelerator(SWT.MOD1 | 'v');
Bundle bundle = Platform.getBundle(MENU_PLUGIN_NAME);
URL imagePath = BundleUtility.find(bundle,ImagePathConstant.PASTE_IMAGE_PATH.getValue());
ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(imagePath);
pasteAction.setImageDescriptor(imageDescriptor);
menu.insertAfter(COPY_ACTION_ID, pasteAction);
}
示例8: createConnectionActions
import org.eclipse.jface.action.IAction; //导入方法依赖的package包/类
private void createConnectionActions() {
connectors.clear();
String lastId = Activator.getDefault().getPreferenceStore().getString(DevicePreferenceConstants.STREAM_ID);
final IConfigurationElement[] eles = Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.scanning.api.stream");
for (IConfigurationElement e : eles) {
CheckableActionGroup group = new CheckableActionGroup();
try {
final IStreamConnection<ILazyDataset> connection = (IStreamConnection<ILazyDataset>)e.createExecutableExtension("stream");
connectors.add(connection);
connection.setId(e.getAttribute("id"));
connection.setLabel(e.getAttribute("label"));
final String iconPath = e.getAttribute("icon");
ImageDescriptor icon=null;
if (iconPath!=null) {
final String id = e.getContributor().getName();
final Bundle bundle= Platform.getBundle(id);
final URL entry = bundle.getEntry(iconPath);
icon = ImageDescriptor.createFromURL(entry);
}
final MenuAction menu = new MenuAction(connection.getLabel());
final IAction connect = new Action(connection.getLabel(), IAction.AS_CHECK_BOX) {
@Override
public void run() {
connect(connection);
}
};
connect.setImageDescriptor(icon);
connect.setChecked(lastId!=null && lastId.equals(connection.getId()));
group.add(connect);
menu.add(connect);
menu.setSelectedAction(connect);
final IAction configure = new Action("Configure...") {
@Override
public void run() {
configure(connection);
}
};
menu.add(configure);
getViewSite().getActionBars().getToolBarManager().add(menu);
} catch (Exception ne) {
logger.error("Problem creating stream connection for "+e, ne);
}
getViewSite().getActionBars().getToolBarManager().add(new Separator());
}
}