eclipse core expression usage
http://codeandme.blogspot.com/2012/04/expression-examples.html
We need to set checkEnabled on the visibleWhen element to false, otherwise the expression will not be active. The withsection uses activePartId as source. It is a string containing the ID of the active view/editor (see description).
http://wiki.eclipse.org/Command_Core_Expressions#Variables_and_the_Command_Framework
Core expressions are declarative or programmatic expressions based on the org.eclipse.core.expressions plugin. 通过org.eclipse.core.expression 去实现
The Platform Command Framework uses core expressions for enabledWhen and activeWhen for handlers, programmatic activation of contexts, and for visibleWhen for menu contributions. The command framework provides the IEvaluationContext that command core expressions are evaluate against.
The IEvaluationContext provides a default variable for evaluations, and a number of named variables. In the command framework, we provide the global selection as ajava.util.Collection as the default variable. It can either be empty, have one entry (if the ISelection was something like an ITextSelection), or have the contents of an IStructuredSelection.
The <with/> element can be used to change which variable the child expression elements are evaluating against.
eclipse plugin中的command引入了core expressions 去激活对应的command
enabledWhen,activeWhen是用于handler;
visibleWhen适用于menu菜单
Re-Usable expressions
Sometimes you will end up with having the same expression in many different places. When one of them changes, you have to change them all. Obviously, this is inefficient and not very handy - let alone error prone. You can get around this problem by using definitions and re-use expressions that are declared elsewhere.
The expression from the example above can be declared using the org.eclipse.core.expressions.definitions extension point, and then re-used using the<reference> element:
重用表达式
http://wiki.eclipse.org/Platform_Expression_Framework
- Should an context menu be enabled and/or visible in a context menu menu应该不应该显示或者是可用
- Which implementation for a command handler to use depending on the current context 在当前上下文哪个handler应该被用
- Which label provider to use for an object 哪个provider应该被用
- Which content provider can provide children for an object in a tree
<or>element 包含一个表达式块
表达式块:
instanceof:
adapt:
<reference
definitionId="org.acme.navigator.enablement">
</reference>
Usually, expressions check the default variable in the evaluation context. However, it is possible for an expression to select a specific variable from the context using the <with> element (examples below).
通常是检查默认的变量,但是可以通过with来检查变量。
当处理一个collection的时候我们通常想要知道这个collection中的内容
这里用到了<iterate> <count>
They require an iterable object to work (otherwise they fail with an error message on the console)他们必须是一个可迭代的对象。
默认的变量时当前的选中的,但是可能是整个结构。
ITextSelection), or contain the elements of an IStructuredSelection.
adapt,and,or,not 可以包含内部元素。
count不能包含元素,他是计算collection中的元素数目。
它最好可以与<iterate>使用遍历里面的所有元素个数。
<count value=”2” />
<iterate ifempty=’’false”>
<instance of value=”” />
</iterate>
resolve将要不会再用。
As of eclipse 3.5, there is no implementation in either the command framework or the common navigator framework for IVariableResolver, so the <resolve> operator is of no use for them.
systemTest
测试系统中的属性值
java.lang.System.getProperties
With
将要定义一个变量进行校验。必须要用子元素。可以使系统的变量。
例如当前激活的窗口等等。
eclipse core expression usage的更多相关文章
- myeclipse 无法启动 java.lang.IllegalStateException: Unable to acquire application service. Ensure that the org.eclipse.core.runtime bundle is resolved and started (see config.ini).
把myeclipse10 按照目录完整拷贝到了另外一台电脑, 另外的目录 原安装目录 D\:\soft\i\myeclipse10 新安装目录 E\:\soft\myeclipse10 双击启动失败, ...
- Eclipse无法启动错误之Ensure that the org.eclipse.core.runtime bundle is resolved and started (see config.ini)
悲剧,在安装Android Build Tools时,提醒需要关闭Eclipse进行安装,于是我在Tools安装完成后重启了Eclipse.但是Eclipse却无法启动,在log中有如下提示: Una ...
- 【转】RCP中org.eclipse.core.runtime.CoreException
org.eclipse.core.runtime.CoreException: Plug-in TRAIN was unable to load class train.Application. 利用 ...
- java.lang.NoClassDefFoundError: org/eclipse/core/resources/IContainer
启动eclipse报错:java.lang.NoClassDefFoundError: org/eclipse/core/resources/IContainer 解决办法: 删除以下文件.metad ...
- Eclipse Groovy插件使用时出现的错误 org.eclipse.core.runtime.InvalidRegistryObjectException: Invalid registry object
在eclipse marketplace中下载了groovy插件,发现使用的groovy版本跟项目中使用的groovy版本不一致. 于是在Preferences -> Groovy -> ...
- eclipse启动错误:java.lang.NoClassDefFoundError: org/eclipse/core/resources/IContainer
转自:http://blog.csdn.net/niu_hao/article/details/9332521 eclipse启动时报错如下:java.lang.NoClassDefFoundErro ...
- SWT/JFace开发遇到org.eclipse.core.runtime.IProgressMonitor问题的解决办法(转载)
今日正在使用SWT和JFace开发一个系统,在搭建JFace平台时遇到了一个问题,运行HelloWorld程序抛出org.eclipse.core.runtime.IProgressMonitor的n ...
- org.eclipse.core.resources.bak文件导致MyEclipse每次关闭时无法保存文件
MyEclipse关闭时提示如下信息 Problems occurred while trying to save the state of the workbench. Internal Error ...
- org.osgi.framework.BundleException: Exception in org.eclipse.core.resources.ResourcesPlugin.start()
http://freestyle21.cn 不知什么时候,启动eclipse的时候就一直不行,说是an error ..我查了下log 报错:org.osgi.framework.BundleExce ...
随机推荐
- python 全栈开发,Day14(列表推导式,生成器表达式,内置函数)
一.列表生成式 生成1-100的列表 li = [] for i in range(1,101): li.append(i) print(li) 执行输出: [1,2,3...] 生成python1期 ...
- python 全栈开发,Day1(python介绍,变量,if,while)
python基础一 一,Python介绍 python的出生与应用 python的创始人为吉多·范罗苏姆(Guido van Rossum).1989年的圣诞节期间,吉多·范罗苏姆(中文名字:龟叔)为 ...
- CenOS常用命令
reset 作用:清屏 cd Change the shell working dirctory 切换工作目录 用法 输入cd+“空格”+“/”+“目录” 示例:cd /home 切换到home目录 ...
- Spring的核心之IoC容器创建对象
Spring的Ioc容器,是Spring的核心内容: 作用:对象的创建和处理对象的依赖关系. Spring容器创建对象有以下几种方式: 1:调用无参数的构造器 <!-- 默认无参的构造器 --& ...
- HDU1711 Number Sequence KMP
欢迎访问~原文出处——博客园-zhouzhendong 去博客园看该题解 题目传送门 - HDU1711 题意概括 给T组数据,每组有长度为n和m的母串和模式串.判断模式串是否是母串的子串,如果是输出 ...
- Srorm并发机制
一:介绍 1.运行组件 2.并发度 就是executor数量 executor线程是物理线程 task是执行线程 二:增加并发度 三:Worker层次 1.worker工作进程上 各个Spout组件. ...
- 【jvm】来自于线上的fullGC分析
系统最近老年代的内存上升的比较快,三到四天会发生一波fullGC.于是开始对GC的情况做一波分析. 线上老年代2.7G,年轻带1.3G老年代上升较快,3天一波fullGC,并且fullGC会把内存回收 ...
- vue 解决双向绑定中 父组件传值给子组件后 父组件值也跟着变化的问题
说明: 近日开发中碰见一个很诡异的问题, 父组件动态的修改对象 data 中的值, 然后将这个对象 data 传给子组件, 子组件拿到后将 data 中的值 乘以 100 ,发现父组件中的值也跟着变 ...
- WinForm中DataGridView导出为Excel(快速版)
public static void ExportExcel(DataGridView myDGV, string fileName) { string saveFileName = fileName ...
- [清橙A1210]光棱坦克
[清橙A1210]光棱坦克 题目大意: 平面上放置了\(n(n\le7000)\)个反射装置,光纤将从某个装置出发,在经过一处装置时发生反射,若经过的装置坐标依次为\((x_1,y_1),(x_2,y ...