﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-不愿游泳的鱼-随笔分类-EclipseRCP/SWT/JFACE</title><link>http://www.blogjava.net/nemo-zhp/category/5439.html</link><description>只有甘愿做生活中的小丑，才不会被生活腐蚀</description><language>zh-cn</language><lastBuildDate>Thu, 28 Jun 2007 14:44:44 GMT</lastBuildDate><pubDate>Thu, 28 Jun 2007 14:44:44 GMT</pubDate><ttl>60</ttl><item><title>在Eclipse RCP中使用ResourceNavigator</title><link>http://www.blogjava.net/nemo-zhp/archive/2007/06/28/Eclipse-ResourceNavigator.html</link><dc:creator>nemo</dc:creator><author>nemo</author><pubDate>Wed, 27 Jun 2007 16:30:00 GMT</pubDate><guid>http://www.blogjava.net/nemo-zhp/archive/2007/06/28/Eclipse-ResourceNavigator.html</guid><wfw:comment>http://www.blogjava.net/nemo-zhp/comments/126688.html</wfw:comment><comments>http://www.blogjava.net/nemo-zhp/archive/2007/06/28/Eclipse-ResourceNavigator.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/nemo-zhp/comments/commentRss/126688.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/nemo-zhp/services/trackbacks/126688.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Eclipse 的资源浏览器很强大，可以很方便的查看工作空间中可供适配的资源，并且提供了对排序、过滤等功能的支持。Eclipse的RCP项目组不赞成我们在富客户端应用程序中使用ResourceNavigator，原因是ResourceNavigator的实现代码位于Eclipse IDE中，如果使用资源浏览器，生成的RCP产品将会增加二十多兆的空间，而且会增加许多我们的产品中并不使用的功能，很浪费磁盘和系统资源。他们赞成我们根据需要，为应用程序量身定做树形浏览器视图，但是，基于方便和对强大功能的追求，以及对Eclipse代码优良性的肯定，插件开发者们仍然希望将资源浏览器直接加入到我们的RCP程序中。为了满足广大Eclipse开发者强烈的要求，本文对在Eclipse RCP中使用ResourceNavigator的方法做较为全面的介绍。&nbsp;&nbsp;<a href='http://www.blogjava.net/nemo-zhp/archive/2007/06/28/Eclipse-ResourceNavigator.html'>阅读全文</a><img src ="http://www.blogjava.net/nemo-zhp/aggbug/126688.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/nemo-zhp/" target="_blank">nemo</a> 2007-06-28 00:30 <a href="http://www.blogjava.net/nemo-zhp/archive/2007/06/28/Eclipse-ResourceNavigator.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>XMLMemento对象的相关分析</title><link>http://www.blogjava.net/nemo-zhp/archive/2007/04/26/Eclipse_XMLMemento.html</link><dc:creator>nemo</dc:creator><author>nemo</author><pubDate>Thu, 26 Apr 2007 10:00:00 GMT</pubDate><guid>http://www.blogjava.net/nemo-zhp/archive/2007/04/26/Eclipse_XMLMemento.html</guid><wfw:comment>http://www.blogjava.net/nemo-zhp/comments/113871.html</wfw:comment><comments>http://www.blogjava.net/nemo-zhp/archive/2007/04/26/Eclipse_XMLMemento.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/nemo-zhp/comments/commentRss/113871.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/nemo-zhp/services/trackbacks/113871.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 1.分析Eclipse官方包中XMLMemento类，介绍XMLMemento的使用；<br>2.提出Eclispe官方发布的XMLMemento类的缺陷与限制；<br>3.提供解决这些缺陷与限制的方法，并指出XMLMemento类的使用场合：作为XML文件解析器；创建类似DOM的文件模型。&nbsp;&nbsp;<a href='http://www.blogjava.net/nemo-zhp/archive/2007/04/26/Eclipse_XMLMemento.html'>阅读全文</a><img src ="http://www.blogjava.net/nemo-zhp/aggbug/113871.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/nemo-zhp/" target="_blank">nemo</a> 2007-04-26 18:00 <a href="http://www.blogjava.net/nemo-zhp/archive/2007/04/26/Eclipse_XMLMemento.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>使用ResourceNavigator出现的问题解决</title><link>http://www.blogjava.net/nemo-zhp/archive/2007/03/29/107134.html</link><dc:creator>nemo</dc:creator><author>nemo</author><pubDate>Thu, 29 Mar 2007 02:09:00 GMT</pubDate><guid>http://www.blogjava.net/nemo-zhp/archive/2007/03/29/107134.html</guid><wfw:comment>http://www.blogjava.net/nemo-zhp/comments/107134.html</wfw:comment><comments>http://www.blogjava.net/nemo-zhp/archive/2007/03/29/107134.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/nemo-zhp/comments/commentRss/107134.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/nemo-zhp/services/trackbacks/107134.html</trackback:ping><description><![CDATA[
		<p>
				<font face="Arial" size="2">
						<span class="submitted">problem loading ResourceNavigator</span>
				</font>
		</p>
		<p>
				<font face="Arial" size="2">
						<span class="submitted">关键词：Eclipse RCP, ResourceNavigator</span>
				</font>
		</p>
		<p>
				<font face="Arial" size="2">
						<span class="submitted">解决者：Eingetragen von Volker Wegert. | So, 04/02/2007 - 13:17</span>
				</font>
		</p>
		<p>
				<font face="Arial" size="2">When starting an eclipse instance (using the current development
version) that uses the ResourceNavigator plugin, you might experience
an exception during startup.<br /></font>
		</p>
		<font face="Arial" size="2">
				<font face="Courier New">
						<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;">
								<!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>-->
								<span style="color: rgb(0, 0, 0);">!</span>
								<span style="color: rgb(0, 0, 0);">ENTRY org.eclipse.equinox.registry </span>
								<span style="color: rgb(0, 0, 0);">4</span>
								<span style="color: rgb(0, 0, 0);"> </span>
								<span style="color: rgb(0, 0, 0);">1</span>
								<span style="color: rgb(0, 0, 0);"> </span>
								<span style="color: rgb(0, 0, 0);">2007</span>
								<span style="color: rgb(0, 0, 0);">-</span>
								<span style="color: rgb(0, 0, 0);">02</span>
								<span style="color: rgb(0, 0, 0);">-</span>
								<span style="color: rgb(0, 0, 0);">04</span>
								<span style="color: rgb(0, 0, 0);"> </span>
								<span style="color: rgb(0, 0, 0);">13</span>
								<span style="color: rgb(0, 0, 0);">:</span>
								<span style="color: rgb(0, 0, 0);">12</span>
								<span style="color: rgb(0, 0, 0);">:</span>
								<span style="color: rgb(0, 0, 0);">21.150</span>
								<span style="color: rgb(0, 0, 0);">
										<br />
								</span>
								<span style="color: rgb(0, 0, 0);">!</span>
								<span style="color: rgb(0, 0, 0);">MESSAGE Unable to create view ID org.eclipse.ui.views.ResourceNavigator: Plug</span>
								<span style="color: rgb(0, 0, 0);">-</span>
								<span style="color: rgb(0, 0, 0);">in </span>
								<span style="color: rgb(0, 0, 0);">"</span>
								<span style="color: rgb(0, 0, 0);">org.eclipse.ui.ide</span>
								<span style="color: rgb(0, 0, 0);">"</span>
								<span style="color: rgb(0, 0, 0);"> was unable to instantiate </span>
								<span style="color: rgb(0, 0, 255);">class</span>
								<span style="color: rgb(0, 0, 0);"> </span>
								<span style="color: rgb(0, 0, 0);">"</span>
								<span style="color: rgb(0, 0, 0);">org.eclipse.ui.views.navigator.ResourceNavigator</span>
								<span style="color: rgb(0, 0, 0);">"</span>
								<span style="color: rgb(0, 0, 0);">.<br /></span>
								<span style="color: rgb(0, 0, 0);">!</span>
								<span style="color: rgb(0, 0, 0);">STACK </span>
								<span style="color: rgb(0, 0, 0);">0</span>
								<span style="color: rgb(0, 0, 0);">
										<br />java.lang.IllegalStateException<br />    at org.eclipse.core.runtime.Platform.getPluginRegistry(Platform.java:</span>
								<span style="color: rgb(0, 0, 0);">748</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at org.eclipse.core.runtime.Platform.getPlugin(Platform.java:</span>
								<span style="color: rgb(0, 0, 0);">723</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at org.eclipse.ui.views.navigator.ResourceNavigator.initLinkingEnabled(ResourceNavigator.java:</span>
								<span style="color: rgb(0, 0, 0);">413</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at org.eclipse.ui.views.navigator.ResourceNavigator.</span>
								<span style="color: rgb(0, 0, 0);">&lt;</span>
								<span style="color: rgb(0, 0, 0);">init</span>
								<span style="color: rgb(0, 0, 0);">&gt;</span>
								<span style="color: rgb(0, 0, 0);">(ResourceNavigator.java:</span>
								<span style="color: rgb(0, 0, 0);">241</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)<br />    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:</span>
								<span style="color: rgb(0, 0, 0);">39</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:</span>
								<span style="color: rgb(0, 0, 0);">27</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at java.lang.reflect.Constructor.newInstance(Constructor.java:</span>
								<span style="color: rgb(0, 0, 0);">494</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at java.lang.Class.newInstance0(Class.java:</span>
								<span style="color: rgb(0, 0, 0);">350</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at java.lang.Class.newInstance(Class.java:</span>
								<span style="color: rgb(0, 0, 0);">303</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:</span>
								<span style="color: rgb(0, 0, 0);">170</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:</span>
								<span style="color: rgb(0, 0, 0);">787</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:</span>
								<span style="color: rgb(0, 0, 0);">243</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:</span>
								<span style="color: rgb(0, 0, 0);">51</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:</span>
								<span style="color: rgb(0, 0, 0);">234</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at org.eclipse.ui.internal.registry.ViewDescriptor.createView(ViewDescriptor.java:</span>
								<span style="color: rgb(0, 0, 0);">69</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at org.eclipse.ui.internal.ViewReference.createPartHelper(ViewReference.java:</span>
								<span style="color: rgb(0, 0, 0);">305</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:</span>
								<span style="color: rgb(0, 0, 0);">210</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:</span>
								<span style="color: rgb(0, 0, 0);">566</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at org.eclipse.ui.internal.WorkbenchPage$ActivationList.setActive(WorkbenchPage.java:</span>
								<span style="color: rgb(0, 0, 0);">3881</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at org.eclipse.ui.internal.WorkbenchPage.restoreState(WorkbenchPage.java:</span>
								<span style="color: rgb(0, 0, 0);">2905</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at org.eclipse.ui.internal.WorkbenchWindow.restoreState(WorkbenchWindow.java:</span>
								<span style="color: rgb(0, 0, 0);">1948</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at org.eclipse.ui.internal.Workbench.doRestoreState(Workbench.java:</span>
								<span style="color: rgb(0, 0, 0);">2888</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at org.eclipse.ui.internal.Workbench.restoreState(Workbench.java:</span>
								<span style="color: rgb(0, 0, 0);">1696</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at org.eclipse.ui.internal.Workbench.access$</span>
								<span style="color: rgb(0, 0, 0);">11</span>
								<span style="color: rgb(0, 0, 0);">(Workbench.java:</span>
								<span style="color: rgb(0, 0, 0);">1681</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at org.eclipse.ui.internal.Workbench$</span>
								<span style="color: rgb(0, 0, 0);">18</span>
								<span style="color: rgb(0, 0, 0);">.run(Workbench.java:</span>
								<span style="color: rgb(0, 0, 0);">1560</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:</span>
								<span style="color: rgb(0, 0, 0);">37</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at org.eclipse.ui.internal.Workbench.restoreState(Workbench.java:</span>
								<span style="color: rgb(0, 0, 0);">1504</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at org.eclipse.ui.internal.WorkbenchConfigurer.restoreState(WorkbenchConfigurer.java:</span>
								<span style="color: rgb(0, 0, 0);">183</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:</span>
								<span style="color: rgb(0, 0, 0);">751</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at org.eclipse.ui.internal.Workbench.init(Workbench.java:</span>
								<span style="color: rgb(0, 0, 0);">1109</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:</span>
								<span style="color: rgb(0, 0, 0);">1878</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:</span>
								<span style="color: rgb(0, 0, 0);">425</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:</span>
								<span style="color: rgb(0, 0, 0);">149</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:</span>
								<span style="color: rgb(0, 0, 0);">95</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br />    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:</span>
								<span style="color: rgb(0, 0, 0);">39</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:</span>
								<span style="color: rgb(0, 0, 0);">25</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at java.lang.reflect.Method.invoke(Method.java:</span>
								<span style="color: rgb(0, 0, 0);">585</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethod(EclipseAppContainer.java:</span>
								<span style="color: rgb(0, 0, 0);">522</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:</span>
								<span style="color: rgb(0, 0, 0);">147</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:</span>
								<span style="color: rgb(0, 0, 0);">104</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:</span>
								<span style="color: rgb(0, 0, 0);">74</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:</span>
								<span style="color: rgb(0, 0, 0);">354</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:</span>
								<span style="color: rgb(0, 0, 0);">170</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br />    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:</span>
								<span style="color: rgb(0, 0, 0);">39</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:</span>
								<span style="color: rgb(0, 0, 0);">25</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at java.lang.reflect.Method.invoke(Method.java:</span>
								<span style="color: rgb(0, 0, 0);">585</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at org.eclipse.core.launcher.Main.invokeFramework(Main.java:</span>
								<span style="color: rgb(0, 0, 0);">339</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at org.eclipse.core.launcher.Main.basicRun(Main.java:</span>
								<span style="color: rgb(0, 0, 0);">283</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at org.eclipse.core.launcher.Main.run(Main.java:</span>
								<span style="color: rgb(0, 0, 0);">984</span>
								<span style="color: rgb(0, 0, 0);">)<br />    at org.eclipse.core.launcher.Main.main(Main.java:</span>
								<span style="color: rgb(0, 0, 0);">959</span>
								<span style="color: rgb(0, 0, 0);">)</span>
						</div>
						<br />
				</font>This causes the navigator view to display nothing but a grey box. It
took me some time to figure out what went wrong here, especially since
the validation of the plug-in set did not show any problems. You have
to enable</font>
		<br />
		<font face="Courier New" size="2">
				<br />
		</font>
		<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;">
				<!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>-->
				<span style="color: rgb(0, 0, 0);">org.eclipse.core.runtime.compatibility  <br /></span>
		</div>
		<font face="Arial" size="2">
				<br />in order to get the resource navigator working.<br />------------------------<font size="2"><br /><font size="2">即当ResourceNavigator在RCP程序中无法正常调用时，需要在依赖项中增加一个兼容性插件</font></font></font>
		<font size="2">
				<span style="color: rgb(0, 0, 0);">org.eclipse.core.runtime.compatibility。这个办法很好地解决了我遇到的问题。</span>
		</font>
<img src ="http://www.blogjava.net/nemo-zhp/aggbug/107134.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/nemo-zhp/" target="_blank">nemo</a> 2007-03-29 10:09 <a href="http://www.blogjava.net/nemo-zhp/archive/2007/03/29/107134.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Eclipse的插件第三种安装方法</title><link>http://www.blogjava.net/nemo-zhp/archive/2006/04/05/39366.html</link><dc:creator>nemo</dc:creator><author>nemo</author><pubDate>Wed, 05 Apr 2006 05:44:00 GMT</pubDate><guid>http://www.blogjava.net/nemo-zhp/archive/2006/04/05/39366.html</guid><wfw:comment>http://www.blogjava.net/nemo-zhp/comments/39366.html</wfw:comment><comments>http://www.blogjava.net/nemo-zhp/archive/2006/04/05/39366.html#Feedback</comments><slash:comments>10</slash:comments><wfw:commentRss>http://www.blogjava.net/nemo-zhp/comments/commentRss/39366.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/nemo-zhp/services/trackbacks/39366.html</trackback:ping><description><![CDATA[
		<font size="2">网上有不少关于link方式安装Eclipse插件的方法，但不知为什么，照着做了许多次，只能以此方式增加一个插件目录，再增加第二个目录时就无论如何找不到了。不知道是我的版本有问题还是其他问题，总也不知错在哪里，实在太麻烦。<br />迫不得已，为了管理我那巨量的eclipse插件，我采用了另外一种方法：使用配制管理选项卡来增加插件。<br />具体做法如下：<br />打开帮助-〉软件更新-〉管理配制，单击EclipseSDK弹出右键菜单栏后，选择添加-〉扩展位置：</font> <br /> <img title="snap1" height="322" alt="Snap1.bmp" src="http://www.blogjava.net/images/blogjava_net/nemo-zhp/5546/Snap1.bmp" width="326" border="0" /><br /><br /><font size="2">根据提示，我们现在创建如下文件结构（文件夹所处位置任意，但必须包含eclipse文件夹及features和plugins子文件夹）：</font> <br /><br /><img title="snap3" height="89" alt="Snap3.bmp" src="http://www.blogjava.net/images/blogjava_net/nemo-zhp/5546/Snap3.bmp" width="198" border="0" /><br /><br /><font size="2">接着在eclipse/目录下创建.eclipseextension文件，注意在windows下不能直接创建此类文件，需要打开记事本，在另存为中保存类型 选择all files才可以保存。<br />在.eclipseextension文件中加入如下代码：<br /></font><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #000000">id</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">org.eclipse.platform name</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">Eclipse Platform<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />version</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">3.1</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span></div><p><font size="2">其中version为所使用的Eclipse版本号。<br />然后将你希望安装的插件放入eclipse目录下，覆盖features和plugins文件夹。<br />在管理配置中添加这个新创建好的扩展位置，重启即可。<br />如果不想用此扩展位置，只需要将此位置禁用即可。<br />是不是比link方式要方便灵活一些?</font></p><img src ="http://www.blogjava.net/nemo-zhp/aggbug/39366.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/nemo-zhp/" target="_blank">nemo</a> 2006-04-05 13:44 <a href="http://www.blogjava.net/nemo-zhp/archive/2006/04/05/39366.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>导出Eclipse RCP项目心得</title><link>http://www.blogjava.net/nemo-zhp/archive/2006/03/31/38460.html</link><dc:creator>nemo</dc:creator><author>nemo</author><pubDate>Fri, 31 Mar 2006 05:18:00 GMT</pubDate><guid>http://www.blogjava.net/nemo-zhp/archive/2006/03/31/38460.html</guid><wfw:comment>http://www.blogjava.net/nemo-zhp/comments/38460.html</wfw:comment><comments>http://www.blogjava.net/nemo-zhp/archive/2006/03/31/38460.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.blogjava.net/nemo-zhp/comments/commentRss/38460.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/nemo-zhp/services/trackbacks/38460.html</trackback:ping><description><![CDATA[
		<font face="Courier New">
				<span lang="ZH-CN" style="FONT-FAMILY: 华文细黑">
						<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
								<font size="2">
										<span lang="EN-US">
												<font face="Times New Roman">        </font>
										</span>
										<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">搞了整整两天才终于将项目从</span>
										<span lang="EN-US">
												<font face="Times New Roman">Eclipse</font>
										</span>
										<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中导了出来，网上虽然有许多可供参考的标准导出步骤，但对于具体的项目来说可能会因为版本的不同或者是插件的不同产生各种各样的问题。下面是我在导出</span>
										<span lang="EN-US">
												<font face="Times New Roman">RCP</font>
										</span>
										<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">程序过程中的一些心得，希望对大家</span>
										<span lang="EN-US">
												<font face="Times New Roman">有些帮助。</font>
										</span>
								</font>
						</p>
						<ol style="MARGIN-TOP: 0cm" type="1">
								<li class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt">
										<font size="2">
												<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">有样学样法则真的是很重要，特别是当你无法马上理解</span>
												<span lang="EN-US">
														<font face="Times New Roman">Eclipse</font>
												</span>
												<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">内部机制的时候更是如此。自己一个人摸索很久还不如照着现成的去做更加有效率。可以在导出</span>
												<span lang="EN-US">
														<font face="Times New Roman">RCP</font>
												</span>
												<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">项目时察看示例源码</span>
												<span lang="EN-US">
														<font face="Times New Roman">Hyperbola</font>
												</span>
												<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，是一个聊天程序，</span>
												<span lang="EN-US">
														<font face="Times New Roman">Eclipse.Rich.Client.Platform.Designing.Coding.and.Packaging.Java.Applications</font>
												</span>
												<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">书中的示例。该书网上有</span>
												<span lang="EN-US">
														<font face="Times New Roman">chm</font>
												</span>
												<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">版本的下载。源码下载链接：</span>
												<span lang="EN-US">
														<a href="http://eclipsercp.org/book/cd.php">
																<font face="Times New Roman">http://eclipsercp.org/book/cd.php</font>
														</a>
												</span>
												<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。</span>
												<font face="Times New Roman">
												</font>
												<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">注意：当出现错误时一定要照着源码的配置一项一项的检查，重点是检查</span>
												<span lang="EN-US">
														<font face="Times New Roman">.product</font>
												</span>
												<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">文件和</span>
												<span lang="EN-US">
														<font face="Times New Roman">PDE</font>
												</span>
												<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中</span>
												<span lang="EN-US">
														<font face="Times New Roman">Build</font>
												</span>
												<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">项和</span>
												<span lang="EN-US">
														<font face="Times New Roman">MENIFEST.MF</font>
												</span>
												<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。许多时候一个非常细小的差别往往使程序导出失败。</span>
										</font>
								</li>
						</ol>
						<ol style="MARGIN-TOP: 0cm" type="1" start="2">
								<li class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; mso-list: l0 level1 lfo2; tab-stops: list 36.0pt">
										<font size="2">
												<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在发布</span>
												<span lang="EN-US">
														<font face="Times New Roman">RCP</font>
												</span>
												<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">以及导出插件包时，其他相关的插件（</span>
												<span lang="EN-US">
														<font face="Times New Roman">Required Plugins</font>
												</span>
												<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）必须打包后加载进</span>
												<span lang="EN-US">
														<font face="Times New Roman">Eclipse</font>
												</span>
												<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">插件中（可以采用</span>
												<span lang="EN-US">
														<font face="Times New Roman">Link</font>
												</span>
												<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方式），而不能作为</span>
												<span lang="EN-US">
														<font face="Times New Roman">WorkSpace</font>
												</span>
												<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中打开的项目加载在插件依赖项中，这样才能顺利将插件和</span>
												<span lang="EN-US">
														<font face="Times New Roman">RCP</font>
												</span>
												<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">项目导出。或者不加载进</span>
												<span lang="EN-US">
														<font face="Times New Roman">Eclipse</font>
												</span>
												<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">插件中，只要将其作为第三方插件，在</span>
												<span lang="EN-US">
														<font face="Times New Roman">PDE</font>
												</span>
												<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中</span>
												<span lang="EN-US">
														<font face="Times New Roman">runtime</font>
												</span>
												<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">选项组添加该插件再打包。或者在</span>
												<span lang="EN-US">
														<font face="Times New Roman">WorkSpace</font>
												</span>
												<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">该插件项目中新增加一个文件夹，在其中放入所依赖的插件项。然后在</span>
												<span lang="EN-US">
														<font face="Times New Roman">PDE</font>
												</span>
												<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中</span>
												<span lang="EN-US">
														<font face="Times New Roman">Build</font>
												</span>
												<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">选项组二进制构建子选项组中将其包含也可。</span>
										</font>
								</li>
						</ol>
						<ol style="MARGIN-TOP: 0cm" type="1" start="3">
								<li class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; mso-list: l0 level1 lfo3; tab-stops: list 36.0pt">
										<font size="2">
												<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在</span>
												<span lang="EN-US">
														<font face="Times New Roman">PDE</font>
												</span>
												<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中</span>
												<span lang="EN-US">
														<font face="Times New Roman">Build</font>
												</span>
												<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">选项组中的运行时信息，默认名是一个“</span>
												<span lang="EN-US">
														<font face="Times New Roman">.</font>
												</span>
												<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">”，意思是直接在</span>
												<span lang="EN-US">
														<font face="Times New Roman">plugins</font>
												</span>
												<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">目录下生成</span>
												<span lang="EN-US">
														<font face="Times New Roman">jar</font>
												</span>
												<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">文件，如果给它起自己的名称的话，将会根据那个名称在</span>
												<span lang="EN-US">
														<font face="Times New Roman">plugins</font>
												</span>
												<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">目录下生成一个文件夹，然后在该文件夹里才会有自己的</span>
												<span lang="EN-US">
														<font face="Times New Roman">jar</font>
												</span>
												<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">文件。在导出</span>
												<span lang="EN-US">
														<font face="Times New Roman">Eclipse RCP</font>
												</span>
												<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">项目时，主插件应该保持默认名，使其生成的</span>
												<span lang="EN-US">
														<font face="Times New Roman">jar</font>
												</span>
												<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">文件在</span>
												<span lang="EN-US">
														<font face="Times New Roman">plugins</font>
												</span>
												<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">目录下便存在，否则便会出现应用程序找不到的错误。</span>
										</font>
								</li>
						</ol>
						<ol style="MARGIN-TOP: 0cm" type="1" start="4">
								<li class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; mso-list: l0 level1 lfo4; tab-stops: list 36.0pt">
										<font size="2">
												<span lang="EN-US">
														<font face="Times New Roman">MENIFEST.MF</font>
												</span>
												<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">里面的代码跟最终的结果关系很大。下面把其中的格式复制出来，以便有一些参考性的东西。</span>
										</font>
								</li>
						</ol>
				</span>
		</font>
		<font face="Courier New">
				<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
						<span style="COLOR: #008080"> 1</span>
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
						<span style="COLOR: #000000">Manifest</span>
						<span style="COLOR: #000000">-</span>
						<span style="COLOR: #000000">Version: </span>
						<span style="COLOR: #000000">1.0</span>
						<span style="COLOR: #000000">
								<br />
						</span>
						<span style="COLOR: #008080"> 2</span>
						<span style="COLOR: #000000">
								<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />Bundle</span>
						<span style="COLOR: #000000">-</span>
						<span style="COLOR: #000000">ManifestVersion: </span>
						<span style="COLOR: #000000">2</span>
						<span style="COLOR: #000000">
								<br />
						</span>
						<span style="COLOR: #008080"> 3</span>
						<span style="COLOR: #000000">
								<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />Bundle</span>
						<span style="COLOR: #000000">-</span>
						<span style="COLOR: #000000">Name: MyProject Plug</span>
						<span style="COLOR: #000000">-</span>
						<span style="COLOR: #000000">in<br /></span>
						<span style="COLOR: #008080"> 4</span>
						<span style="COLOR: #000000">
								<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />Bundle</span>
						<span style="COLOR: #000000">-</span>
						<span style="COLOR: #000000">SymbolicName: MyProject; singleton:</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #0000ff">true</span>
						<span style="COLOR: #000000">
								<br />
						</span>
						<span style="COLOR: #008080"> 5</span>
						<span style="COLOR: #000000">
								<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />Bundle</span>
						<span style="COLOR: #000000">-</span>
						<span style="COLOR: #000000">Version: </span>
						<span style="COLOR: #000000">1.0</span>
						<span style="COLOR: #000000">.</span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">
								<br />
						</span>
						<span style="COLOR: #008080"> 6</span>
						<span style="COLOR: #000000">
								<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />Bundle</span>
						<span style="COLOR: #000000">-</span>
						<span style="COLOR: #000000">Localization: plugin<br /></span>
						<span style="COLOR: #008080"> 7</span>
						<span style="COLOR: #000000">
								<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />Require</span>
						<span style="COLOR: #000000">-</span>
						<span style="COLOR: #000000">Bundle: org.eclipse.ui,<br /></span>
						<span style="COLOR: #008080"> 8</span>
						<span style="COLOR: #000000">
								<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />org.eclipse.core.runtime,<br /></span>
						<span style="COLOR: #008080"> 9</span>
						<span style="COLOR: #000000">
								<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />org.eclipse.core.resources,<br /></span>
						<span style="COLOR: #008080">10</span>
						<span style="COLOR: #000000">
								<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />org.eclipse.ui.ide,<br /></span>
						<span style="COLOR: #008080">11</span>
						<span style="COLOR: #000000">
								<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />Eclipse</span>
						<span style="COLOR: #000000">-</span>
						<span style="COLOR: #000000">AutoStart: </span>
						<span style="COLOR: #0000ff">true</span>
						<span style="COLOR: #000000">
								<br />
						</span>
						<span style="COLOR: #008080">12</span>
						<span style="COLOR: #000000">
								<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />Export</span>
						<span style="COLOR: #000000">-</span>
						<span style="COLOR: #000000">Package: myProject,<br /><font style="BACKGROUND-COLOR: #deb887"><font color="#000080"><span style="COLOR: #008080"><span style="COLOR: #008080">13</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span></span><font face="Courier New">Bundle-Activator: myProject.MyProjectPlugin</font></font></font></span>
				</div>
				<p style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: 华文细黑; mso-outline-level: 1"> </p>
				<p style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: 华文细黑; mso-outline-level: 1">
				</p>
		</font> <font face="Courier New"><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="2"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">其中，</span><span lang="EN-US"><font face="Times New Roman">12</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">行</span><span lang="EN-US"><font face="Times New Roman">Export-Package</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">项是你希望外部可见的包，写不写对导出项目没有影响。</span></font><span lang="EN-US"><br /></span><font size="2"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">下面第</span><span lang="EN-US"><font face="Times New Roman">13</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">项在</span><span lang="EN-US"><font face="Times New Roman">MENIFEST.MF</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中可能会自动生成，在导出插件时要注意将其去掉，否则会产生错误。（具体原因还未知，希望高人指点迷津</span><span lang="EN-US"><?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" /?><v:shapetype id="_x0000_t75" stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600"><font face="Times New Roman"><img height="19" src="http://www.blogjava.net/Emoticons/red_smile.gif" width="19" border="0" /><v:stroke joinstyle="miter"></v:stroke><v:formulas><v:f eqn="if lineDrawn pixelLineWidth 0"></v:f><v:f eqn="sum @0 1 0"></v:f><v:f eqn="sum 0 0 @1"></v:f><v:f eqn="prod @2 1 2"></v:f><v:f eqn="prod @3 21600 pixelWidth"></v:f><v:f eqn="prod @3 21600 pixelHeight"></v:f><v:f eqn="sum @0 0 1"></v:f><v:f eqn="prod @6 1 2"></v:f><v:f eqn="prod @7 21600 pixelWidth"></v:f><v:f eqn="sum @8 21600 0"></v:f><v:f eqn="prod @7 21600 pixelHeight"></v:f><v:f eqn="sum @10 21600 0"></v:f></v:formulas><v:path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"></v:path><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /?><o:lock aspectratio="t" v:ext="edit"></o:lock></font></v:shapetype></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）</span><span lang="EN-US"><font face="Times New Roman">.  </font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">其他的应该不用说了吧？！</span></font></p></font><img src ="http://www.blogjava.net/nemo-zhp/aggbug/38460.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/nemo-zhp/" target="_blank">nemo</a> 2006-03-31 13:18 <a href="http://www.blogjava.net/nemo-zhp/archive/2006/03/31/38460.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>将Eclipse3.0开发的插件程序升级到Eclipse3.1经常遇到的一个问题</title><link>http://www.blogjava.net/nemo-zhp/archive/2005/12/03/22347.html</link><dc:creator>nemo</dc:creator><author>nemo</author><pubDate>Sat, 03 Dec 2005 09:10:00 GMT</pubDate><guid>http://www.blogjava.net/nemo-zhp/archive/2005/12/03/22347.html</guid><wfw:comment>http://www.blogjava.net/nemo-zhp/comments/22347.html</wfw:comment><comments>http://www.blogjava.net/nemo-zhp/archive/2005/12/03/22347.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/nemo-zhp/comments/commentRss/22347.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/nemo-zhp/services/trackbacks/22347.html</trackback:ping><description><![CDATA[<P><FONT face=宋体 size=2>最近学习<SPAN lang=EN-US>RCP</SPAN>，于是需要查看一些源码。有些源码在<SPAN lang=EN-US>Eclipse3.0</SPAN>下一点问题都没有，可是将<SPAN lang=EN-US>Eclipse SDK</SPAN>更新到<SPAN lang=EN-US>3.1</SPAN>后，好多源码都报错，无法运行。而且大多数是同一个错误。具体错误是在<SPAN lang=EN-US>META-INF</SPAN>目录下的<SPAN lang=EN-US>MENIFEST.MF</SPAN>中出现的。如下图所示：</FONT><SPAN lang=EN-US><BR><?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" /><v:shapetype id=_x0000_t75 coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"><v:stroke joinstyle="miter"></v:stroke><v:formulas><v:f eqn="if lineDrawn pixelLineWidth 0"></v:f><v:f eqn="sum @0 1 0"></v:f><v:f eqn="sum 0 0 @1"></v:f><v:f eqn="prod @2 1 2"></v:f><v:f eqn="prod @3 21600 pixelWidth"></v:f><v:f eqn="prod @3 21600 pixelHeight"></v:f><v:f eqn="sum @0 0 1"></v:f><v:f eqn="prod @6 1 2"></v:f><v:f eqn="prod @7 21600 pixelWidth"></v:f><v:f eqn="sum @8 21600 0"></v:f><v:f eqn="prod @7 21600 pixelHeight"></v:f><v:f eqn="sum @10 21600 0"></v:f></v:formulas><v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"></v:path><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:lock v:ext="edit" aspectratio="t"></o:lock></v:shapetype><IMG height=82 alt=o_Eclipse3.0-3.1-6.bmp src="http://www.blogjava.net/images/blogjava_net/nemo-zhp/5546/o_Eclipse3.0-3.1-6.bmp" width=479 border=0><BR></SPAN><FONT face=宋体 size=2>改了半天也不知道是什么方面的原因。把鼠标放在出错提示处，发现有如下图所示的提示：</FONT><SPAN lang=EN-US><BR><IMG height=71 alt=o_Eclipse3.0-3.1-11.bmp src="http://www.blogjava.net/images/blogjava_net/nemo-zhp/5546/o_Eclipse3.0-3.1-11.bmp" width=480 border=0><BR><BR></SPAN><FONT face=宋体 size=2>然后查找了大量资料，又用<SPAN lang=EN-US>3.1</SPAN>版的<SPAN lang=EN-US>Eclipse</SPAN>自动生成了<SPAN lang=EN-US>MENIFEST.MF</SPAN>文件，看了一下开头，比这个插件的开始处在<SPAN lang=EN-US>Bundle-SymbolicName</SPAN>中多了这么一项：</FONT><SPAN lang=EN-US><BR><FONT face=宋体 size=2>Bundle-SymbolicName:Test; singleton:=true<BR></FONT></SPAN><FONT face=宋体 size=2>那就将这句话加上吧！</FONT><SPAN lang=EN-US><BR><IMG height=82 alt=o_Eclipse3.0-3.1-33.bmp src="http://www.blogjava.net/images/blogjava_net/nemo-zhp/5546/o_Eclipse3.0-3.1-33.bmp" width=479 border=0><BR><BR></SPAN><FONT face=宋体 size=2>满以为这次应该没什么问题了，可谁知还是出错。具体报的错误是这样的：</FONT><SPAN lang=EN-US><BR><BR><IMG height=67 alt=Eclipse3.0-3.1-222.bmp src="http://www.blogjava.net/images/blogjava_net/nemo-zhp/Eclipse3.0-3.1-222.bmp" width=478 border=0><BR><BR></SPAN><FONT face=宋体 size=2>上面说声明扩展或扩展点的插件必须将<SPAN lang=EN-US>"singleton"</SPAN>属性设置为<SPAN lang=EN-US>"true"</SPAN>，查了所有的扩展和扩展点项，都没有发现提示中所说的<SPAN lang=EN-US>singleton</SPAN>属性，也就当然不知道如何设置为<SPAN lang=EN-US>"true"</SPAN>了。</FONT><SPAN lang=EN-US><BR></SPAN><FONT face=宋体 size=2>后来只好一步一步来，重新创建一个插件工程，把原来的源代码全部拷过去，手工添加所有的扩展和扩展点项（累呵！）最后终于找到了两个非常细小的差别。相比3.0版本的MENIFEST.MF，3.1版的增加了下面两项：<BR>Bundle-ManifestVersion: 2<BR>和<BR>Bundle-Localization:plugin。将这两项加入MENIFEST.MF文件之后，错误解决了！！！<BR><IMG height=107 alt=o_Eclipse3.0-3.1-55.bmp src="http://www.blogjava.net/images/blogjava_net/nemo-zhp/5546/o_Eclipse3.0-3.1-55.bmp" width=483 border=0><BR>究竟是哪一项导致上述错误呢？只去掉Bundle-ManifestVersion:2这一项后，发现错误重新出现，而只去掉Bundle-Localization:plugin后，错误没有出现。<BR>所以我们在遇到上述问题时，可以做如下操作：<BR>1.设置singleton:=true，如果仍然没有解决问题：<BR>2.添加Bundle-ManifestVersion:2<BR>我就是这样将错误修复的。但愿有类似经历的同胞不再受这个问题的困扰。<BR>但是，由于对OSGI以及Eclipse底层的机制不了解，所以不清楚为什么会出现上述问题，以及为什么增加此行后就不再报错。希望各位了解的能够指点迷津！<BR></FONT><SPAN lang=EN-US><BR><BR><BR><o:p></o:p></SPAN></P><img src ="http://www.blogjava.net/nemo-zhp/aggbug/22347.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/nemo-zhp/" target="_blank">nemo</a> 2005-12-03 17:10 <a href="http://www.blogjava.net/nemo-zhp/archive/2005/12/03/22347.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>在EclipseRCP中正确的加载图像文件</title><link>http://www.blogjava.net/nemo-zhp/archive/2005/11/29/21862.html</link><dc:creator>nemo</dc:creator><author>nemo</author><pubDate>Tue, 29 Nov 2005 11:21:00 GMT</pubDate><guid>http://www.blogjava.net/nemo-zhp/archive/2005/11/29/21862.html</guid><wfw:comment>http://www.blogjava.net/nemo-zhp/comments/21862.html</wfw:comment><comments>http://www.blogjava.net/nemo-zhp/archive/2005/11/29/21862.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/nemo-zhp/comments/commentRss/21862.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/nemo-zhp/services/trackbacks/21862.html</trackback:ping><description><![CDATA[<P style="FONT-SIZE: 10pt; MARGIN: 0in; mso-outline-level: 1"><SPAN lang=ZH-CN style="FONT-FAMILY: 华文细黑"><FONT face=Tahoma color=#000080>最近一位同事也在用RCP开发，对图像文件的加载头疼不已。<BR>想起几个月前我在开发时也有类似的事情发生，于是简单总结了一下，希望对大家有些用处。<BR>由于Eclipse RCP 需要面向不同的平台，所以不能用一般的方法来加载图元，我们可以使用ImageDescriptor类来对图元进行加载。而且我们在加载完图元之后，必须亲自将图元dispose掉，否则有可能会导致系统资源泄漏。<BR>实现方法一：</FONT></SPAN></P>
<OL style="MARGIN-TOP: 0in; MARGIN-BOTTOM: 0in; MARGIN-LEFT: 0.5in; DIRECTION: ltr; unicode-bidi: embed" type=1>
<LI style="MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle; FONT-FAMILY: Verdana; mso-outline-level: 1" value=1><FONT face=Tahoma><FONT color=#000080><SPAN lang=ZH-CN style="FONT-FAMILY: 华文细黑">在</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Verdana">Application</SPAN><SPAN lang=ZH-CN style="FONT-FAMILY: 华文细黑">文件中添加本工程的</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Verdana">ID（String类型，只要与plugin.xml中的工程ID相同即可）</SPAN><SPAN lang=ZH-CN style="FONT-FAMILY: 华文细黑">。</SPAN></FONT></FONT> 
<LI style="MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-BOTTOM: 0px; VERTICAL-ALIGN: middle; FONT-FAMILY: Verdana; mso-outline-level: 1" value=2><FONT face=Tahoma><FONT color=#000080><SPAN lang=ZH-CN style="FONT-FAMILY: 华文细黑">在想要获得图像文件的类中实现</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Verdana">createImageDescriptorFor(String id)</SPAN><SPAN lang=ZH-CN style="FONT-FAMILY: 华文细黑">方法。</SPAN></FONT></FONT></LI></OL>
<P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: 华文细黑; mso-outline-level: 1"><FONT face=Tahoma color=#000080>具体实现如下：</FONT></P>
<P style="FONT-SIZE: 10pt; MARGIN: 0in; mso-outline-level: 1"><FONT color=#000080><FONT face=Tahoma><SPAN lang=ZH-CN style="FONT-FAMILY: 华文细黑"><FONT face=Tahoma>public ImageDescriptor createImageDescriptorFor(String id)</FONT> </SPAN><SPAN lang=EN-US style="FONT-FAMILY: Verdana"><FONT face=Tahoma>//id</FONT></SPAN><SPAN lang=ZH-CN style="FONT-FAMILY: 华文细黑">表示图形文件相对于本工程的默认路径</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Verdana">.</SPAN></FONT></FONT></P>
<P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: 华文细黑; mso-outline-level: 1"><FONT face=Tahoma color=#000080>{</FONT></P>
<P style="FONT-SIZE: 10pt; MARGIN: 0in 0in 0in 0.5in; mso-outline-level: 2"><FONT face=Tahoma><FONT color=#000080><SPAN lang=ZH-CN style="FONT-FAMILY: 华文细黑"><FONT face=Tahoma>URL url =</FONT> <FONT face=Tahoma>Platform.getBundle(pluginId</FONT></SPAN><SPAN lang=ZH-CN style="FONT-FAMILY: 华文细黑"><FONT face=Tahoma>).</FONT></SPAN></FONT><FONT color=#000080>getEntry(id);<SPAN lang=EN-US style="FONT-FAMILY: Verdana">//pluginId</SPAN><SPAN lang=ZH-CN style="FONT-FAMILY: 华文细黑">表示本工程的</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Verdana">ID.</SPAN></FONT></FONT><FONT color=#000080><BR><FONT face=Tahoma>return ImageDescriptor.createFromURL(url);</FONT></FONT></P>
<P style="FONT-SIZE: 10pt; MARGIN: 0in; FONT-FAMILY: 华文细黑; mso-outline-level: 1"><FONT face=Tahoma color=#000080>}<BR>实现方法二：<BR>调用org.eclipse.ui.plugin.AbstractUIPlugin.imageDescriptorFromPlugin(String pluginId, String imageFilePath)方法。<BR>仍然需要定义pluginId。<BR>举例：假设我们的图像文件为本工程的/icons/image.gif。<BR>那么我们要加载图元可以使用一下语句：<BR>Image image1 = org.eclipse.ui.plugin.AbstractUIPlugin.imageDescriptorFromPlugin(pluginId, "/icons/image.gif");<BR></FONT></P><img src ="http://www.blogjava.net/nemo-zhp/aggbug/21862.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/nemo-zhp/" target="_blank">nemo</a> 2005-11-29 19:21 <a href="http://www.blogjava.net/nemo-zhp/archive/2005/11/29/21862.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>往Eclipse RCP视图中添加右键弹出菜单（一）</title><link>http://www.blogjava.net/nemo-zhp/archive/2005/11/29/21861.html</link><dc:creator>nemo</dc:creator><author>nemo</author><pubDate>Tue, 29 Nov 2005 11:14:00 GMT</pubDate><guid>http://www.blogjava.net/nemo-zhp/archive/2005/11/29/21861.html</guid><wfw:comment>http://www.blogjava.net/nemo-zhp/comments/21861.html</wfw:comment><comments>http://www.blogjava.net/nemo-zhp/archive/2005/11/29/21861.html#Feedback</comments><slash:comments>12</slash:comments><wfw:commentRss>http://www.blogjava.net/nemo-zhp/comments/commentRss/21861.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/nemo-zhp/services/trackbacks/21861.html</trackback:ping><description><![CDATA[<P><FONT size=2>往eclipse的默认NavigationView中，添加右键菜单项是非常容易的，甚至不需要自己写代码，只要在plugin.xml中添加扩展项便可以了。<BR>但是这远远达不到我们的要求。如果要我们在自己的rcp程序的View中添加右键弹出菜单就不是很容易了。现在我介绍一下如何在一个树视图中针对不同的TreeObject添加不同的右键弹出菜单的方法。<BR>如果不清楚如何构建一个树，请参考</FONT><A href="http://www.java2s.com/Code/Java/SWT-JFace-Eclipse/CatalogSWT-JFace-Eclipse.htm"><FONT size=2>http://www.java2s.com/Code/Java/SWT-JFace-Eclipse/CatalogSWT-JFace-Eclipse.htm</FONT></A><FONT size=2>,&nbsp;这里有很多关于eclipse Tree的实例。简单将来，Eclipse中创建树有两种，一种是使用SWT提供的树，依照一定的格式给其提供数据，我自己只用这种方法创建一些简单的、静态的树。另一种方法，针对于RCP程序，可以使用JFace提供的TreeViewer类，非常灵活并且易于扩展。使用TreeViewer需要实现ITreeContentProvider接口和ITreeLableProvider接口。由于我的时间有限，不能向大家提供具体的实现方法，请原谅。可以参考以下文章：</FONT><A href="http://eclipse.org/articles/treeviewer-cg/TreeViewerArticle.htm"><FONT size=2>http://eclipse.org/articles/treeviewer-cg/TreeViewerArticle.htm</FONT></A><BR><FONT size=2>在大体了解了如何构造一个树之后，我们下面就来介绍右键弹出菜单context menu的实现方法。<BR>一个TreeViewer 必须继承ViewPart方法，并且重写其中的createPartControl(Composite parent)类。</FONT><BR><BR><FONT style="BACKGROUND-COLOR: #ffffff" face=Tahoma color=#000080><FONT size=2><FONT style="BACKGROUND-COLOR: #9acd32" color=#000080>1&nbsp; </FONT>&nbsp;&nbsp; public void createPartControl(Composite parent) {<BR><FONT style="BACKGROUND-COLOR: #9acd32">2&nbsp; </FONT><BR><FONT style="BACKGROUND-COLOR: #9acd32">3&nbsp; </FONT>&nbsp;&nbsp; /* Set the imput data and image model of the tree viewer,<BR><FONT style="BACKGROUND-COLOR: #9acd32">4&nbsp; </FONT>&nbsp;&nbsp; &nbsp;* and layout the viewer on the left part of the composite.<BR><FONT style="BACKGROUND-COLOR: #9acd32">5&nbsp; </FONT>&nbsp;&nbsp; &nbsp;*/<BR><FONT style="BACKGROUND-COLOR: #9acd32">6&nbsp; </FONT>&nbsp;&nbsp;&nbsp; viewer = new TreeViewer(parent);<BR><FONT style="BACKGROUND-COLOR: #9acd32">7&nbsp; </FONT>&nbsp;&nbsp;&nbsp; viewer.setContentProvider(new ViewContentProvider());<BR><FONT style="BACKGROUND-COLOR: #9acd32">8&nbsp; </FONT>&nbsp;&nbsp;&nbsp; viewer.setLabelProvider(new ViewLabelProvider());<BR><FONT style="BACKGROUND-COLOR: #9acd32">9&nbsp; </FONT>&nbsp;&nbsp;&nbsp; viewer.setInput(createDummyModel());<BR><FONT style="BACKGROUND-COLOR: #9acd32">10</FONT><BR><FONT style="BACKGROUND-COLOR: #9acd32">11</FONT>&nbsp;&nbsp; createActions();<BR><FONT style="BACKGROUND-COLOR: #9acd32">12</FONT>&nbsp;&nbsp; createMenus();<BR><FONT style="BACKGROUND-COLOR: #9acd32">13</FONT>&nbsp;&nbsp; createContextMenu(parent);<BR></FONT></FONT><FONT style="BACKGROUND-COLOR: #ffffff" face=Tahoma color=#000080><FONT size=2><FONT style="BACKGROUND-COLOR: #9acd32">14</FONT><BR><FONT style="BACKGROUND-COLOR: #9acd32">15</FONT>&nbsp;&nbsp; //handles the actions related with treeviewer.<BR><FONT style="BACKGROUND-COLOR: #9acd32">16</FONT>&nbsp;&nbsp; makeActions(parent);<BR></FONT></FONT><FONT style="BACKGROUND-COLOR: #000080"><FONT face=Tahoma><FONT style="BACKGROUND-COLOR: #ffffff" color=#000080><FONT size=2><FONT style="BACKGROUND-COLOR: #9acd32">17</FONT>&nbsp;}<BR></FONT><FONT color=#000000><FONT size=2>其中，第7到9行为设置TreeViewer的内容提供器、图像提供器、以及初始化时的输入数据。第13行为创建右键弹出菜单。<BR><BR></FONT><FONT color=#000080><FONT size=2><FONT style="BACKGROUND-COLOR: #9acd32">1&nbsp;&nbsp;</FONT>&nbsp;&nbsp; private void createContextMenu(Composite parent) { <BR><FONT style="BACKGROUND-COLOR: #9acd32">2&nbsp; </FONT><BR><FONT style="BACKGROUND-COLOR: #9acd32">3&nbsp;&nbsp;</FONT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MenuManager mgr = new MenuManager(); <BR><FONT style="BACKGROUND-COLOR: #9acd32">4&nbsp;&nbsp;</FONT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mgr.setRemoveAllWhenShown(true); <BR><FONT style="BACKGROUND-COLOR: #9acd32">5&nbsp;&nbsp;</FONT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mgr.addMenuListener(new IMenuListener() { <BR><FONT style="BACKGROUND-COLOR: #9acd32">6&nbsp;&nbsp;</FONT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public void menuAboutToShow(IMenuManager manager) { <BR><FONT style="BACKGROUND-COLOR: #9acd32">7&nbsp;&nbsp;</FONT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fillContextMenu(manager); <BR><FONT style="BACKGROUND-COLOR: #9acd32">8&nbsp;&nbsp;</FONT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} <BR><FONT style="BACKGROUND-COLOR: #9acd32">9&nbsp;&nbsp;</FONT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}); <BR><FONT style="BACKGROUND-COLOR: #9acd32">10</FONT><FONT style="BACKGROUND-COLOR: #ffffff">&nbsp;&nbsp;&nbsp;&nbsp; Menu menu = mgr.createContextMenu(viewer.getControl()); </FONT><BR><FONT style="BACKGROUND-COLOR: #9acd32">11</FONT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;viewer.getControl().setMenu(menu); <BR><FONT style="BACKGROUND-COLOR: #9acd32">12</FONT>&nbsp;&nbsp;&nbsp;&nbsp; getSite().registerContextMenu(mgr, viewer); <BR><FONT style="BACKGROUND-COLOR: #9acd32">13</FONT>&nbsp;&nbsp; }<BR></FONT><FONT face="Times New Roman" color=#000000><FONT size=2>第4行代码中，setRemoveAllWhenShown(true)的作用是清空以前显示的菜单项，当触发了menu事件时，重新填充（fillContextMenu），所以如果不把removeAllWhenShow置为true的话，每点一下右键你就会看到菜单项多出一倍来。Menu是swt的控件，而Menumanager是Jface中的控件，不象SWT那样直接同底层打交道。用MenuManager可以创建出一个Menu对象。第十行</FONT><FONT face=Tahoma color=#000080><FONT size=2>mgr.createContextMenu(viewer.getControl());</FONT><FONT face="Times New Roman" color=#000000><FONT size=2>这里的viewer即为上面的viewer。第十一行，然后我们将树的setMenu方法将树控件与Menu控件联系在一起就好了。<BR>最重要的是第十二行，这是context menu能不能显示的关键。一个视图中可以有多个context menu, 而每一个context menu都必须注册给workbench。这需要通过调用</FONT><FONT face=Tahoma color=#000080><FONT size=2>org.eclipse.ui.IWorkbenchPartSite.registerContextMenu(MenuManager menuManager, ISelectionProvider selectionProvider)<FONT face="Times New Roman" color=#000000>或者（当有多个注册的context menu时）</FONT>org.eclipse.ui.IWorkbenchPartSite.registerContextMenu(String menuId, MenuManager menuManager, ISelectionProvider selectionProvider)&nbsp;</FONT><FONT face="Times New Roman" color=#000000><FONT size=2>增加的参数menuId用于区分不同的context menu。<BR>接下来，我们有两种方法来创建右键弹出菜单项。第一种，实现fillContextMenu()方法。典型的实现代码如下：<BR></FONT><FONT color=#000080><FONT face=Tahoma><FONT size=2><FONT style="BACKGROUND-COLOR: #9acd32">1&nbsp;&nbsp;</FONT>&nbsp;&nbsp; protected void fillContextMenu(IMenuManager manager) {<BR><FONT style="BACKGROUND-COLOR: #9acd32">2&nbsp;&nbsp;</FONT><BR><FONT style="BACKGROUND-COLOR: #9acd32">3&nbsp;&nbsp;</FONT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; manager.add(openAction);<BR><FONT style="BACKGROUND-COLOR: #9acd32">4&nbsp;&nbsp;</FONT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; manager.add(removeAction);<BR><FONT style="BACKGROUND-COLOR: #9acd32">5&nbsp;&nbsp;</FONT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;manager.add(addAction);<BR><FONT style="BACKGROUND-COLOR: #9acd32">6&nbsp;&nbsp;</FONT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp; <BR></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT><BR><FONT size=2>这些Action都可由自己定义创建。<BR>另外的方法，可以编辑plugin.xml文件。不需要自己写任何代码便可以显示出自己想要的弹出项。<BR>这次先讲到这里，下次介绍另外的一种实现方式。（主要是由于刚创建Blog，不知道如何插入图片，这么写太费劲也太枯燥了，相信大家一定不能忍了吧！咱们下次再见</FONT><IMG height=19 src="http://www.blogjava.net/Emoticons/regular_smile.gif" width=19 border=0>）</P><img src ="http://www.blogjava.net/nemo-zhp/aggbug/21861.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/nemo-zhp/" target="_blank">nemo</a> 2005-11-29 19:14 <a href="http://www.blogjava.net/nemo-zhp/archive/2005/11/29/21861.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>