http://eclipsesource.com/blogs/2009/01/15/toggling-a-command-contribution/
帖子中描述了在使用到toggle状态切换时候的用法,发现帖子中描述的不够全面,有一些遗漏的地方。
1、如果要初始按下去,注意初始默认值org.eclipse.ui.handlers.RegistryToggleState:true 确保为true
<command id="cn.com.ywave.fibermon.ui.handlers.CmdVpFilter"
name="Filter">
<state class="org.eclipse.ui.handlers.RegistryToggleState:true"
id="fibermon.vpwarning.filter.state">
</state>
</command>
2,handler要实现IElementUpdater
直接使用在plugin中定义好的stateid(fibermon.vpwarning.filter.state) 不要使用comments中的IMenuStateIds.STYLE
IStateListener 是状态改变时候的监听,提供了handleStateChange方法,可以在此方法中实现状态切换时候的处理。
public class HandlerVpFilter extends AbstractHandler implements IHandler, IStateListener, IElementUpdater {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
Command allShowCommand = event.getCommand();
State allState = allShowCommand.getState("fibermon.vpwarning.filter.state");
allState.setValue(!Boolean.parseBoolean(String.valueOf(allState.getValue())));
ICommandService service = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
service.refreshElements(event.getCommand().getId(), null);
return null;
}
@Override
public void handleStateChange(State state, Object oldValue) {
GlobalDataContainer.inst().getFilterDisableWarningDM().setValue((Boolean) state.getValue());
}
@Override
public void updateElement(UIElement element, Map parameters) {
ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
Command command = commandService.getCommand("cn.com.ywave.fibermon.ui.handlers.CmdVpFilter");
element.setChecked((Boolean) command.getState("fibermon.vpwarning.filter.state").getValue());
}
分享到:
相关推荐
org.geotools.xml.handlers.xsi org.geotools.xml.impl org.geotools.xml.impl.jxpath org.geotools.xml.schema org.geotools.xml.schema.impl org.geotools.xml.styling org.geotools.xml.test org.geotools...
org.apache.http.client.protocol Client specific HTTP protocol handlers. org.apache.http.client.utils Client utility classes. org.apache.http.conn Client connection management APIs. org.apache....
<resource>META-INF/spring.handlers implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"> implementation="org.apache.maven.plugins.shade.resource....
flexpaper_handlers.jsflexpaper_handlers.jsflexpaper_handlers.js
at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:454) at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281) at org.apache.axis.transport.http.AxisServlet.doPost...
Microsoft.AspNet.WebApi.MessageHandlers.Compression, 在支持GZip和Deflate支持的ASP.NET WebAPI模块中, 针对 ASP.NET WebAPI和HttpClient的压缩支持 用于 ASP.NET WebAPI的MODULE,支持 GZip 和 Deflate 支持。...
handlers.js
该压缩包中包含了flexpaper.js+flexpaper_handlers.js+FlexPaperViewer.swf+viewFile.jsp 其中flexpaper.js+flexpaper_handlers.js+FlexPaperViewer.swf为控件 viewFile.jsp为在线展示swf代码示例
Contents About the Author...............................................................................................xix About the Technical Reviewer and Contributing Author.................xxi ...
1.2.5 Action Event Handlers.................................................................................. 12 1.3 Component Controller .................................................................
官方离线安装包,亲测可用。使用rpm -ivh [rpm完整包名] 进行安装
对应Maven信息:groupId:org.springframework,artifactId:spring-webmvc,version:4.3.20.RELEASE 使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可纵览文档内容。 人性化翻译,文档中的...
本代码是FlexPaper 的一个js版本,用于web开发中展示pdf转化的swf文件。
WKWebView JS调用OC Demo,包含html文件。 window.webkit.messageHandlers.方法名.postMessage(参数);
window.postMessage的功能是允许程序员跨域在两个窗口/frames间发送数据信息。基本上,它就像是跨域的AJAX,但不是浏览器跟服务器之间交互,而是在两个客户端之间通信。让我们来看一下window.postMessage是如何工作...
// custom error/warning handlers. By default, errors will throw, and // warnings will be printed to the console. Where applicable, the // error/warning object will have `pos`, `loc` and `frame` ...
官方离线安装包,亲测可用
nvim lsp处理程序la ,但使用作为UI 例子 vim. lsp . handlers [ ' textDocument/codeAction ' ] = require ' clap-lsp.codeAction ' . code_action_handler vim. lsp . handlers [ ' textDocument/definition ' ] ...
WindowBuilder是一款基于Eclipse平台的双向Java的GUI设计插件式的软件。具备SWT/JFACE开发、Swing开发及GWT 开发三大功能,是一款不可多得的Java体系中的WYSIWYG工具。 WindowBuilder的主要用户界面构建为: Design...