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.而一些耗时操作,比如数据库,网络请 ...
随机推荐
- ahoi2009维护序列
链接:https://www.luogu.org/problemnew/show/P2023 裸的线段树维护+* 代码: #include <bits/stdc++.h> using na ...
- BZOJ1901 Zju2112 Dynamic Rankings 主席树
欢迎访问~原文出处——博客园-zhouzhendong 去博客园看该题解 题目传送门 - BZOJ1901 题意概括 给你一段序列(n个数),让你支持一些操作(共m次), 有两种操作,一种是询问区间第 ...
- JavaSE| 数据类型| 运算符| 进制与补码反码等
JavaSE JavaSE是学习JavaWeb.JavaEE以及Android开发的基础 边听边思考边做“笔记” 不要完全依赖书和视频: 捷径:敲.狂敲: 规范:加注释: 难点,不懂的记录下时间再回头 ...
- python模块——PrettyTable
python模块——PrettyTable 一. 简介 Python通过prettytable模块将输出内容如表格方式整齐输出,可用来生成美观的ASCII格式的表格,十分实用. python本身并不内 ...
- pandas学习(常用数学统计方法总结、读取或保存数据、缺省值和异常值处理)
pandas学习(常用数学统计方法总结.读取或保存数据.缺省值和异常值处理) 目录 常用数学统计方法总结 读取或保存数据 缺省值和异常值处理 常用数学统计方法总结 count 计算非NA值的数量 de ...
- 001.Keepalived简介
一 Keepalived 定义 Keepalived 是一个基于VRRP协议来实现的LVS服务高可用方案,可以解决静态路由出现的单点故障问题.一个LVS服务会有2台服务器运行Keepalived,一台 ...
- 面向对象&网络编程
1 接口与归一化设计 1.1 归一化概念: 归一化的好处: 1.归一化让使用者无需关心对象的类是什么,只需要知道这些对象都具备某些功能就可以了,这极大降低了使用者的使用难度. 2.归一化使得高层的外部 ...
- git 快照及分支
分支介绍 分支就是科幻电影里面的平行宇宙,当你正在电脑前努力学习Git的时候,另一个你正在另一个平行宇宙里努力学习SVN. 如果两个平行宇宙互不干扰,那对现在的你也没啥影响.不过,在某个时间点,两个平 ...
- redis 在 php 中的应用(事务 [ Transaction ] 篇)
本文为我阅读了 redis参考手册 之后编写,注意 php_redis 和 redis-cli 的区别(主要是返回值类型和参数用法) 目录: Transaction(事务) WATCH UNWATCH ...
- unity无限循环报错的定位
晚上遇到了,碰到了程序一运行就卡住的尴尬问题,然后百度下,看了看,Get到了一个新的skill. 1. 打开对应的VS程序,选择“调试/Attach Unity Debuger”菜单来调试代码. 2. ...