- 浏览: 255556 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
aquarion:
非常感谢,解决了我的问题
Perspective 自定义设置扩展点 -
zheng_zhen:
好文章,进一步问您一下,请问自己实现的run/debug如何能 ...
【原创】Eclipse Launcher (Run/Debug As 菜单扩展)实现 -
salever:
mwdnjupt 写道http://www.xeclipse. ...
浅析OSGI的bundle依赖 -
mwdnjupt:
http://www.xeclipse.com/?p=1165 ...
浅析OSGI的bundle依赖 -
Tom.X:
插件化、模块化应遵循高内聚、低耦合的原则,尽量不要在各bund ...
浅析OSGI的bundle依赖
Eclipse Resource Plugin里面很多值得一看的东西,其中一个就是Property Testers ,它在某些条件过滤的时候非常有用,先看一段jdt里面的使用
<page objectClass="org.eclipse.core.resources.IProject" name="%javaCategoryPageName" class="org.eclipse.jdt.internal.ui.preferences.JavaCategoryPropertyPage" id="org.eclipse.jdt.ui.propertyPages.JavaCategoryPropertyPage"> <enabledWhen> <adapt type="org.eclipse.core.resources.IProject"> <test property="org.eclipse.core.resources.projectNature" value="org.eclipse.jdt.core.javanature"/> </adapt> </enabledWhen> </page>
这里的
org.eclipse.core.resources.projectNature
就是eclipse已经定义好的property。
简介
扩展点:org.eclipse.core.expressions.propertyTesters
作用:用来给一个已知的类型添加属性测试支持,新添加的属性可以用于各种表达式条件判断。
扩展语法:
<!ELEMENT propertyTester EMPTY> <!ATTLIST propertyTester id CDATA #REQUIRED type CDATA #REQUIRED namespace CDATA #REQUIRED properties CDATA #REQUIRED class CDATA #REQUIRED>
引用一下Eclipse自己的解释:
- id - unique identifier for the property tester
- type - the type to be extended by this property tester
- namespace - a unique id determining the name space the properties are added to
- properties - a comma separated list of properties provided by this property tester
- class - the name of the class that implements the testing methods. The class must be public and extend org.eclipse.core.expressions.PropertyTester with a public 0-argument constructor.
示例
<extension point="org.eclipse.core.expressions.propertyTesters"> <propertyTester id="org.eclipse.core.expressions.bundlePropertyTester" type="org.eclipse.core.runtime.Platform" namespace="org.eclipse.core.runtime" properties="product,isBundleInstalled,bundleState" class="org.eclipse.core.internal.expressions.propertytester.PlatformPropertyTester"> </propertyTester> </extension>
很简单的一个使用,这些都在eclipse的文档里面说的很清楚了。
至于org.eclipse.core.expressions.PropertyTester 如何扩展,也很简单,一般只需要实现test (Object receiver, String property, Object[] args, Object expectedValue)方法就行了。比如:
/******************************************************************************* * Copyright (c) 2006, 2008 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.core.internal.expressions.propertytester; import org.osgi.framework.Bundle; import org.eclipse.core.expressions.PropertyTester; import org.eclipse.core.runtime.IProduct; import org.eclipse.core.runtime.Platform; /** * A property tester for testing platform properties. Can test whether or * not a given bundle is installed in the running environment, as well as * the id of the currently active product. * <p> * For example:<br /> * <test property="org.eclipse.core.runtime.product" value="org.eclipse.sdk.ide"/> <br /> * <test property="org.eclipse.core.runtime.isBundleInstalled" args="org.eclipse.core.expressions"/> <br /> * <test property="org.eclipse.core.runtime.bundleState" args="org.eclipse.core.expressions" value="ACTIVE"/> * <p> */ public class PlatformPropertyTester extends PropertyTester { private static final String PROPERTY_PRODUCT = "product"; //$NON-NLS-1$ private static final String PROPERTY_IS_BUNDLE_INSTALLED = "isBundleInstalled"; //$NON-NLS-1$ private static final String PROPERTY_BUNDLE_STATE = "bundleState"; //$NON-NLS-1$ /* (non-Javadoc) * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object) */ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { if (Platform.class.equals(receiver)) { if (PROPERTY_PRODUCT.equals(property)) { IProduct product= Platform.getProduct(); if (product != null) { return product.getId().equals(expectedValue); } return false; } else if (PROPERTY_IS_BUNDLE_INSTALLED.equals(property) && args.length >= 1 && args[0] instanceof String) { return Platform.getBundle((String)args[0]) != null; } else if (PROPERTY_BUNDLE_STATE.equals(property) && args.length >= 1 && args[0] instanceof String) { Bundle b = Platform.getBundle((String) args[0]); if (b != null) { return bundleState(b.getState(), expectedValue); } return false; } } return false; } private boolean bundleState(int bundleState, Object expectedValue) { if ("UNINSTALLED".equals(expectedValue)) { //$NON-NLS-1$ return bundleState == Bundle.UNINSTALLED; } if ("INSTALLED".equals(expectedValue)) { //$NON-NLS-1$ return bundleState == Bundle.INSTALLED; } if ("RESOLVED".equals(expectedValue)) { //$NON-NLS-1$ return bundleState == Bundle.RESOLVED; } if ("STARTING".equals(expectedValue)) { //$NON-NLS-1$ return bundleState == Bundle.STARTING; } if ("STOPPING".equals(expectedValue)) { //$NON-NLS-1$ return bundleState == Bundle.STOPPING; } if ("ACTIVE".equals(expectedValue)) { //$NON-NLS-1$ return bundleState == Bundle.ACTIVE; } return false; } }
发表评论
-
基于Spring/Hibernate/Hessian的RCP客户端系统框架
2012-08-14 11:23 2707本文同步发表在 http://www.xeclips ... -
【资料整理】中国Eclipse社区开发资料整理
2012-05-13 21:53 4328前言 中国Eclipse社区(www.ceclipse ... -
【Eclipse plug-in】 org.eclipse.ui.activities 的使用
2011-11-30 15:20 2801整理一下org.eclipse.ui.activities的使 ... -
Eclipse plugin中获取工程的几种办法
2011-10-10 15:56 2814在Eclipse开发中,涉及到Resource的时候,经常会需 ... -
【SDK or Binary】Eclipse 开发版本选择
2011-08-19 14:11 5713前言:老手直接忽略。打开Eclipse的download页面, ... -
Eclipse Spring Application Context XML 小工具
2011-08-18 15:35 2219概述 Spring 开发经常需要配置bean clas ... -
OSGI MANIFEST.MF Header 小结
2011-07-26 10:43 28211 MANIFEST 文件 Bun ... -
【Eclipse所有示例】Eclipse CVS 平台源码
2011-04-21 10:06 1864总有TX上论坛要各种源码,首先并不提倡这种做法,这与间接的 ... -
中文版的Eclipse 帮助文档
2011-04-14 13:43 3545偶然在IBM的一个帮助网站上发现了部分Eclipse的部分的中 ... -
深入 Common Navigator Framework 完整版下载
2011-04-11 15:19 2591写完整个Common Navigator Framework之 ... -
深入 Common Navigator Framework 之 Link with Editor Support
2011-04-11 15:15 20038.1 概述 这个功能简单的说,就是将选中的节点与对应的编辑 ... -
深入 Common Navigator Framework 之 Drag and Drop Support
2011-04-11 15:11 22727.1 概述 顾名思义,Drag and Drop Supp ... -
深入 Common Navigator Framework 之 Action Providers
2011-04-11 15:05 22856.1 概述 有了工程的树形结构显示,自然就要考虑到菜单的配 ... -
深入 Common Navigator Framework 之 Common Wizards
2011-04-11 15:00 18065.1 概述 Common Wizard用于定制Naviga ... -
深入 Common Navigator Framework 之 Common Filters
2011-04-11 14:56 20294.1 概述 Common Filter负责进行节点过滤,类 ... -
深入 Common Navigator Framework 之 navigatorContent
2011-04-07 14:31 24873.1 概述 Eclipse为了方便 ... -
深入 Common Navigator Framework 之 Navigator
2011-04-07 14:18 31242.1 概述 Navigator 是CNF中用来显示资源结构 ... -
深入 Common Navigator Framework 之概述
2011-04-07 14:07 28691.1 概述 CNF,全称Common Navigato ... -
Common Navigator Framework初探
2011-03-30 17:14 5011这篇文章是继《Eclipse RCP/Plugin 入门自学教 ... -
利用Eclipse SDK 学习 Extension Point
2011-03-07 11:27 4193很多Eclipser在开发RCP时候,会遇到Extension ...
相关推荐
All of which makes this book a great resource for software developers and testers who want to get started with unit test automation in Python 3 and compare the differences with Python 2. This short ...
### Google Hacking for Penetration Testers #### 一、基础知识:Google 搜索技巧入门 - **Web界面操作**:本书首先介绍了如何有效地利用Google的Web界面进行搜索,包括如何构建有效的查询语句以及如何理解Google...
<br>一、概述 3 1)VSTT简介 3 2)测试类型 3 3)Team Test 命名空间 6 二、Web 测试 7 1)概述 7 2)测试引擎和测试记录器 7 3)录制WebTest 8 4)编辑WebTest 10 5)WebTest查看器...
soapUI is a desktop application for inspecting, invoking, mocking and testing (functional and load) of SOAP/WSDL and REST/EADL based Web Services over HTTP. It is mainly aimed at developers/testers ...
`fastlane-plugin-clean_testflight_testers` 插件是针对 `fastlane` 平台的一个扩展,专门用于解决TestFlight中的测试用户管理问题,特别是自动化删除用户这一任务,以配合“超级签”(Super Signature)的使用。...
To ensure software quality, organizations encourage software developers and testers to achieve objectives such as these: Locating the source of defects faster and more precisely Detecting bugs ...
TestComplete is an automated testing tool, designed for advanced and novice testers alike, to create, manage and run tests for any desktop, Web or rich client software. It does not depend on any ...
Agile Testing A Practical Guide for Testers and Agile Teams 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除
提供的资源包括PPT、视频和文档,这将帮助读者以多种方式学习和掌握Visual Studio 2005 Team Edition for Testers的使用方法和最佳实践。PPT可能包含了关键概念的概述和步骤说明,视频可能演示了具体的操作过程,而...
Python Unit Test Automation Practical Techniques for Python Developers and Testers 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开
Coding for Penetration Testers(2nd) 英文epub 第2版 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除
如果要在Microsoft Visual Studio 2005环境中执行TestComplete测试项目,需要有Visual Studio 2005 Team Suite或Software Testers Team Edition的相应版本。安装TestComplete的Microsoft Visual Studio 2005 Team ...
soapUI is a desktop application for inspecting, invoking, mocking and testing (functional and load) of SOAP/WSDL and REST/EADL based Web Services over HTTP. It is mainly aimed at developers/testers ...
soapUI is a desktop application for inspecting, invoking, mocking and testing (functional and load) of SOAP/WSDL and REST/EADL based Web Services over HTTP. It is mainly aimed at developers/testers ...
Metasploit - a Penetration Testers Guide.pdf 官方推荐,有爱的拿去. 官方介绍: http://www.backtrack-linux.org/backtrack/metasploit-a-penetration-testers-guide/