eclipse default handler IHandler interface “the chosen operation is not enabled”
NOTE: These two methods:
Tip: Subclass AbstractHandler rather than implementing IHandler. but you can use it to the below section you need to set:
IHandler the chosen operation is not enabled
NOT USE popupMenus instead of Menus
isEnabled: should be set to true
isHandled:should be set to true
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.IHandler;
import org.eclipse.core.commands.IHandlerListener;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.handlers.HandlerUtil; public class MyHandler implements IHandler { private FontChanger font=FontChanger.getInstance();
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
// TODO Auto-generated method stub IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
MessageDialog.openInformation(
window.getShell(),
"Demo",
"Hello, Eclipse world");
font.decreaseSize();
return null;
}
@Override
public void addHandlerListener(IHandlerListener handlerListener) {
// TODO Auto-generated method stub }
@Override
public void dispose() {
// TODO Auto-generated method stub }
@Override
public boolean isEnabled() {
// TODO Auto-generated method stub
return true;
}
@Override
public boolean isHandled() {
// TODO Auto-generated method stub
return true;
}
@Override
public void removeHandlerListener(IHandlerListener handlerListener) {
// TODO Auto-generated method stub } }
menu :
http://stackoverflow.com/questions/1342532/how-to-add-items-in-popup-menu
add it as a menu or menu item
Eclipse base location uri for menus
Since they are impossible to find on the net here is the list of all base location uri's in eclipse that are used in the org.eclipse.ui.menus extension point:
menu:org.eclipse.ui.main.menu // the top-level menu
popup:org.eclipse.ui.popup.any // all pop-up menus
toolbar:org.eclipse.ui.main.toolbar // the top-level tool bar
toolbar:org.eclipse.ui.trim.command1 // the top left trim (main toolbar area)
toolbar:org.eclipse.ui.trim.command2 // the top right trim (perspective switcher area)
toolbar:org.eclipse.ui.trim.vertical1 // the left vertical trim
toolbar:org.eclipse.ui.trim.vertical2 // the right vertical trim
toolbar:org.eclipse.ui.trim.status // the status line trim
to access the menu/toolbar/popup of a part (view or editor):
menu:partid //the part's chevron menu
toolbar:partid //the part's toolbar (cannot contain other toolbars)
popup:partid //the part's popup menu (register the context menu in createPartControl first)
eclipse plugin menu gray out
check the handler class is correct set ,or not implement
eclipse default handler IHandler interface “the chosen operation is not enabled”的更多相关文章
- rcp(插件开发)点击按钮出现 The chosen operation is not enabled 解决办法
别的项目组,遇到以下错误信息: 首先看一下log日志里的异常信息,估计就知道是什么问题了. 项目组遇到的这个错误是source 指向错误 找不到相关的class.
- Eclipse进度条出现“Remote System Explorer Operation”解决方法
Eclipse进度条出现“Remote System Explorer Operation”解决方法
- eclipse 离线安装插件报cannot perform operation.Computing alternate solutions...解决办法
当不能连接外网,离线安装SVN插件时,可能会发现以下问题:eclipse长时间停留在下图所示状态,提示“cannot perform operation.Computing alternate sol ...
- Difference Between static and default methods in interface
I was learning through interfaces when I noticed that you can now define static and default methods ...
- eclipse plugin development -menu
org.eclipse.ui.menus locationURI MenuContribution locationURI = "[Scheme]:[id]?[argument-list]& ...
- Interface default method介绍
一.introduce interface default method Introduce default methodWrite the default method at interfaceTh ...
- [原][Java]eclipse 修改自动提示
下载 jar 链接:http://files.cnblogs.com/files/z5337/org.eclipse.jface.text_3.7.2.v20111213-1208.zip 或者这个: ...
- eclipse中hibernate和mybatis中xml配置文件的没有标签提醒解决方法
当我们使用eclipse编写Mybatis或hibernate的xml文件时,面对众多标签的配置文件,却没有自动提醒,对于工作和学习都十分不方便. 之所以没有自动提醒,是因为dtd文件没有加载成功. ...
- Android中Handler的消息处理机制以及源码分析
在实际项目当中,一个很常见的需求场景就是在根据子线程当中的数据去更新ui.我们知道,android中ui是单线程模型的,就是只能在UI线程(也称为主线程)中更新ui.而一些耗时操作,比如数据库,网络请 ...
随机推荐
- ***使用Fiddler抓取Android安卓手机的APP请求
安装Fiddler,百度搜索Fiddler,就会有下载链接. 启动Fiddler,开始设置.点击“tools-->fiddler options”. 设置HTTPS选项.在设置过程中会有 ...
- poj 1511 正向 反向 构两个图
有向图 源点为1 求源点到其他各点的最短距离之和 再在其他点到源点的最短距离之和 再加起来 多源点一终点 只要反向构图就行了 Sample Input 2 //T2 2 //结点数 边数1 2 13 ...
- django 如何动态使用Q查询函数
这个Q和F用得少, 需要时,总是独立的存在于那时,显得有些突兀, 这次想将filter,order,Q集合在一起, 查询了很多资料,还是有一些困难, 但即可以将Q查询比较优雅的动态生成. 比如: # ...
- (第8篇)实时可靠的开源分布式实时计算系统——Storm
摘要: 在Hadoop生态圈中,针对大数据进行批量计算时,通常需要一个或者多个MapReduce作业来完成,但这种批量计算方式是满足不了对实时性要求高的场景.那Storm是怎么做到的呢? 博主福利 给 ...
- 关于final中的几个忽略的点的再次阐述
final : 最终.作为一个修饰符,可以感性的认识,但是总是在背后会忽略特殊的角落. 1,可以修饰类,函数,变量. 2,被final修饰的类不可以被继承.为了避免被继承,被子类复写功能. 这一个点容 ...
- 030 分布式集群中,设定时间同步服务器,以及ntpd与ntpdate的区别
什么时候配置时间同步? 当分布式集群配置好了以后,马上配置的是SSH无密钥配置,然后就是配置时间同步. 时间同步在集群中特别重要. 一:时间同步 1.时间同步 集群中必须有一个统一的时间 如果是内网, ...
- Python5 - 字符编码
Python 字符编码 参考详细文章: py编码终极版 http://www.diveintopython3.net/strings.html 1.在python2默认编码是ASCII, pyth ...
- FastAdmin 的 CRUD 不支持层级模型
FastAdmin 的 CRUD 可以快速生成控制器,模型和前端文件. 群里有人试了这个命令: php think crud -t departmant -c auth/departmant -m ...
- CentOS 7.1系统自动重启的Bug定位过程
[问题] 有同事反应最近有多台MongoDB的服务器CentOS 7.1系统会自动重启,分析了下问题原因. [排查过程] 1. 检查系统日志/var/log/message,并没有记录异常信息,jou ...
- JavaFx 中常见的包和类(javafx笔记 )
JavaFx 中常见的包和类(javafx笔记 ) 更多详细内容请参考<Pro JavaFX 8>. javafx.stage 包包含以下类: Stage 类 Stage 类是任何 J ...