﻿<?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-双桅渔船</title><link>http://www.blogjava.net/USTCEric/</link><description>漂泊，没有终点</description><language>zh-cn</language><lastBuildDate>Sun, 12 Apr 2026 06:01:00 GMT</lastBuildDate><pubDate>Sun, 12 Apr 2026 06:01:00 GMT</pubDate><ttl>60</ttl><item><title>rcp中如何去掉不需要的menu</title><link>http://www.blogjava.net/USTCEric/archive/2006/01/08/27144.html</link><dc:creator>USTCEric</dc:creator><author>USTCEric</author><pubDate>Sun, 08 Jan 2006 07:12:00 GMT</pubDate><guid>http://www.blogjava.net/USTCEric/archive/2006/01/08/27144.html</guid><wfw:comment>http://www.blogjava.net/USTCEric/comments/27144.html</wfw:comment><comments>http://www.blogjava.net/USTCEric/archive/2006/01/08/27144.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/USTCEric/comments/commentRss/27144.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/USTCEric/services/trackbacks/27144.html</trackback:ping><description><![CDATA[<P>这个好像有几种情形，想到三个就先写三个：<BR>第一个是rcp中有默认的主菜单，如果你什么菜都不加它不会显示，但当你加的菜单和默认菜单有同名情况时，rcp会向这个名称的菜单里加入一些默认的选项。比如你要写自己的file菜单，那命名最好换成ifile或者其它，不然，命名成file，rcp不管你是否需要，都会往里面加入通常的file功能条（都是灰色的）。<BR>第二个是通过代码里去除不用的菜单。<BR></P>
<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">WorkbenchWindow&nbsp;window&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;(WorkbenchWindow)Workbench.getInstance().getActiveWorkbenchWindow();<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>MenuManager&nbsp;menuManager&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;window.getMenuManager();<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>IContributionItem[]&nbsp;items&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;menuManager.getItems();<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>ActionSetContributionItem&nbsp;element&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;(ActionSetContributionItem)items[</SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000">];<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>MenuManager&nbsp;fileMenuManager&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;(MenuManager)element.getInnerItem();<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>fileMenuManager.remove(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">action1</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);</SPAN></DIV>第三个是用jdt的一些现成组件的时候，当focus转移到这些组件上会产生相应的菜单，而这些是你不想要的，可以这样处理，将那个组件类继承一下，使用你新生成的类，就可以去除不需要的菜单。<BR><!--StartFragment -->&nbsp;<SPAN class=tpc_content>在jdt的blugin里面给组件定义了viewAction的扩展，所以直接使用这些组件的时候会自动显示定义的菜单，通过继承就可以消除那些扩展点的影响。</SPAN> <img src ="http://www.blogjava.net/USTCEric/aggbug/27144.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/USTCEric/" target="_blank">USTCEric</a> 2006-01-08 15:12 <a href="http://www.blogjava.net/USTCEric/archive/2006/01/08/27144.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>对使用jdt的 package explorer一个总结</title><link>http://www.blogjava.net/USTCEric/archive/2006/01/08/27141.html</link><dc:creator>USTCEric</dc:creator><author>USTCEric</author><pubDate>Sun, 08 Jan 2006 06:47:00 GMT</pubDate><guid>http://www.blogjava.net/USTCEric/archive/2006/01/08/27141.html</guid><wfw:comment>http://www.blogjava.net/USTCEric/comments/27141.html</wfw:comment><comments>http://www.blogjava.net/USTCEric/archive/2006/01/08/27141.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/USTCEric/comments/commentRss/27141.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/USTCEric/services/trackbacks/27141.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: &nbsp;自己遇到了这方面问题，在瀚海星云上咨询了一下，解决后总结了一下。现在收录到自己的空间里：）前段时间为了使用jdt中的package&nbsp;explorer进行一个rcp程序的开发。在版面上进行了提问，得到了simon&nbsp;lei,pandawang&nbsp;的热情帮助，在此表示感谢。经过一番学习，在几个论坛上问了一下，当时仍没有找到解决方法（主要是使用package...&nbsp;&nbsp;<a href='http://www.blogjava.net/USTCEric/archive/2006/01/08/27141.html'>阅读全文</a><img src ="http://www.blogjava.net/USTCEric/aggbug/27141.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/USTCEric/" target="_blank">USTCEric</a> 2006-01-08 14:47 <a href="http://www.blogjava.net/USTCEric/archive/2006/01/08/27141.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>GEF中组件删除功能的实现</title><link>http://www.blogjava.net/USTCEric/archive/2006/01/08/27128.html</link><dc:creator>USTCEric</dc:creator><author>USTCEric</author><pubDate>Sun, 08 Jan 2006 04:33:00 GMT</pubDate><guid>http://www.blogjava.net/USTCEric/archive/2006/01/08/27128.html</guid><wfw:comment>http://www.blogjava.net/USTCEric/comments/27128.html</wfw:comment><comments>http://www.blogjava.net/USTCEric/archive/2006/01/08/27128.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/USTCEric/comments/commentRss/27128.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/USTCEric/services/trackbacks/27128.html</trackback:ping><description><![CDATA[<P>跟着入门教程一步一步走下来，好歹有个可视化编辑器的样子，看起来还像那么回事。<BR>回过头，发现添加的组件还没有删除功能。现在介绍一下如何实现组件删除的功能。<BR><BR>step 1：要能删除组件必须要有菜单、按钮或者用del键，于是需要在你编辑器的ActionBarContributor中添加相关的代码来获得主工具条上的删除按钮，同时也将激活edit菜单中的delete选项。<BR>public void contributeToToolBar(IToolBarManager toolBarManager) {<BR>&nbsp;&nbsp;// TODO Auto-generated method stub<BR>&nbsp;&nbsp;……&nbsp;&nbsp;<BR>&nbsp;&nbsp;toolBarManager.add(getAction(ActionFactory.DELETE.getId()));<BR>……<BR>}<BR>关于工具条菜单部分功能实现的详细介绍，八进制的blog上有详细介绍。<BR><BR>step 2：动作触发后要有editPart接收相应的request，然后转交给某个editPolicy进行处理。在删除过程中，是被删除组件的editPart接收删除request。在这个editPart中注册一个继承于ComponentEditPolicy的policy，editpart将把request转交给这个policy处理。在policy中需要重写createDeleteCommand(GroupRequest deleteRequest)方法来生成对删除动作进行处理的command对象，并对该对象的属性进行一些设置，然后返回。<BR>代码如下：<BR>NodeEditPart类中<BR>protected void createEditPolicies() {<BR>&nbsp;&nbsp;// TODO Auto-generated method stub<BR>……<BR>&nbsp;&nbsp;installEditPolicy(EditPolicy.COMPONENT_ROLE, new NodeEditPolicy());<BR></P>
<P>……<BR>&nbsp;}<BR><BR>NodeEditPolicy类<BR></P>
<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 id=Codehighlighter1_56_476_Open_Image onclick="this.style.display='none'; Codehighlighter1_56_476_Open_Text.style.display='none'; Codehighlighter1_56_476_Closed_Image.style.display='inline'; Codehighlighter1_56_476_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_56_476_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_56_476_Closed_Text.style.display='none'; Codehighlighter1_56_476_Open_Image.style.display='inline'; Codehighlighter1_56_476_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align=top><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">class</SPAN><SPAN style="COLOR: #000000">&nbsp;NodeEditPolicy&nbsp;</SPAN><SPAN style="COLOR: #0000ff">extends</SPAN><SPAN style="COLOR: #000000">&nbsp;ComponentEditPolicy&nbsp;</SPAN><SPAN id=Codehighlighter1_56_476_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_56_476_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG id=Codehighlighter1_84_140_Open_Image onclick="this.style.display='none'; Codehighlighter1_84_140_Open_Text.style.display='none'; Codehighlighter1_84_140_Closed_Image.style.display='inline'; Codehighlighter1_84_140_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_84_140_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_84_140_Closed_Text.style.display='none'; Codehighlighter1_84_140_Open_Image.style.display='inline'; Codehighlighter1_84_140_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;NodeEditPolicy()&nbsp;</SPAN><SPAN id=Codehighlighter1_84_140_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_84_140_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">super</SPAN><SPAN style="COLOR: #000000">();<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;TODO&nbsp;Auto-generated&nbsp;constructor&nbsp;stub</SPAN><SPAN style="COLOR: #008000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG id=Codehighlighter1_209_473_Open_Image onclick="this.style.display='none'; Codehighlighter1_209_473_Open_Text.style.display='none'; Codehighlighter1_209_473_Closed_Image.style.display='inline'; Codehighlighter1_209_473_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_209_473_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_209_473_Closed_Text.style.display='none'; Codehighlighter1_209_473_Open_Image.style.display='inline'; Codehighlighter1_209_473_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;</SPAN><SPAN style="COLOR: #0000ff">protected</SPAN><SPAN style="COLOR: #000000">&nbsp;Command&nbsp;createDeleteCommand(GroupRequest&nbsp;deleteRequest)&nbsp;</SPAN><SPAN id=Codehighlighter1_209_473_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_209_473_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;TODO&nbsp;Auto-generated&nbsp;method&nbsp;stub</SPAN><SPAN style="COLOR: #008000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;Object&nbsp;parent&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;getHost().getParent().getModel();&nbsp;&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;RemoveNodeCommand&nbsp;command&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;RemoveNodeCommand();<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;command.setParent((BaseModel)parent);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;command.setChild((BaseModel)getHost().getModel());&nbsp;&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000">&nbsp;command;&nbsp;&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN></DIV>
<P><BR><BR>step3：实现command类<BR></P>
<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 id=Codehighlighter1_47_720_Open_Image onclick="this.style.display='none'; Codehighlighter1_47_720_Open_Text.style.display='none'; Codehighlighter1_47_720_Closed_Image.style.display='inline'; Codehighlighter1_47_720_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_47_720_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_47_720_Closed_Text.style.display='none'; Codehighlighter1_47_720_Open_Image.style.display='inline'; Codehighlighter1_47_720_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align=top><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">class</SPAN><SPAN style="COLOR: #000000">&nbsp;RemoveNodeCommand&nbsp;</SPAN><SPAN style="COLOR: #0000ff">extends</SPAN><SPAN style="COLOR: #000000">&nbsp;Command&nbsp;</SPAN><SPAN id=Codehighlighter1_47_720_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_47_720_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">private&nbsp;List&nbsp;parent;</SPAN><SPAN style="COLOR: #008000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">private</SPAN><SPAN style="COLOR: #000000">&nbsp;NodeModel&nbsp;parent;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;</SPAN><SPAN style="COLOR: #0000ff">private</SPAN><SPAN style="COLOR: #000000">&nbsp;NodeModel&nbsp;child;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG id=Codehighlighter1_159_178_Open_Image onclick="this.style.display='none'; Codehighlighter1_159_178_Open_Text.style.display='none'; Codehighlighter1_159_178_Closed_Image.style.display='inline'; Codehighlighter1_159_178_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_159_178_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_159_178_Closed_Text.style.display='none'; Codehighlighter1_159_178_Open_Image.style.display='inline'; Codehighlighter1_159_178_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;NodeModel&nbsp;&nbsp;getChild()&nbsp;</SPAN><SPAN id=Codehighlighter1_159_178_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_159_178_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000">&nbsp;child;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG id=Codehighlighter1_220_245_Open_Image onclick="this.style.display='none'; Codehighlighter1_220_245_Open_Text.style.display='none'; Codehighlighter1_220_245_Closed_Image.style.display='inline'; Codehighlighter1_220_245_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_220_245_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_220_245_Closed_Text.style.display='none'; Codehighlighter1_220_245_Open_Image.style.display='inline'; Codehighlighter1_220_245_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000">&nbsp;setChild(NodeModel&nbsp;child)&nbsp;</SPAN><SPAN id=Codehighlighter1_220_245_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_220_245_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">this</SPAN><SPAN style="COLOR: #000000">.child&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;child;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG id=Codehighlighter1_278_298_Open_Image onclick="this.style.display='none'; Codehighlighter1_278_298_Open_Text.style.display='none'; Codehighlighter1_278_298_Closed_Image.style.display='inline'; Codehighlighter1_278_298_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_278_298_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_278_298_Closed_Text.style.display='none'; Codehighlighter1_278_298_Open_Image.style.display='inline'; Codehighlighter1_278_298_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;NodeModel&nbsp;getParent()&nbsp;</SPAN><SPAN id=Codehighlighter1_278_298_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_278_298_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000">&nbsp;parent;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG id=Codehighlighter1_342_369_Open_Image onclick="this.style.display='none'; Codehighlighter1_342_369_Open_Text.style.display='none'; Codehighlighter1_342_369_Closed_Image.style.display='inline'; Codehighlighter1_342_369_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_342_369_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_342_369_Closed_Text.style.display='none'; Codehighlighter1_342_369_Open_Image.style.display='inline'; Codehighlighter1_342_369_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000">&nbsp;setParent(NodeModel&nbsp;parent)&nbsp;</SPAN><SPAN id=Codehighlighter1_342_369_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_342_369_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">this</SPAN><SPAN style="COLOR: #000000">.parent&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;parent;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG id=Codehighlighter1_400_456_Open_Image onclick="this.style.display='none'; Codehighlighter1_400_456_Open_Text.style.display='none'; Codehighlighter1_400_456_Closed_Image.style.display='inline'; Codehighlighter1_400_456_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_400_456_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_400_456_Closed_Text.style.display='none'; Codehighlighter1_400_456_Open_Image.style.display='inline'; Codehighlighter1_400_456_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;RemoveNodeCommand()&nbsp;</SPAN><SPAN id=Codehighlighter1_400_456_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_400_456_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">super</SPAN><SPAN style="COLOR: #000000">();<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;TODO&nbsp;Auto-generated&nbsp;constructor&nbsp;stub</SPAN><SPAN style="COLOR: #008000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG id=Codehighlighter1_499_560_Open_Image onclick="this.style.display='none'; Codehighlighter1_499_560_Open_Text.style.display='none'; Codehighlighter1_499_560_Closed_Image.style.display='inline'; Codehighlighter1_499_560_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_499_560_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_499_560_Closed_Text.style.display='none'; Codehighlighter1_499_560_Open_Image.style.display='inline'; Codehighlighter1_499_560_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;RemoveNodeCommand(String&nbsp;label)&nbsp;</SPAN><SPAN id=Codehighlighter1_499_560_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_499_560_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">super</SPAN><SPAN style="COLOR: #000000">(label);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;TODO&nbsp;Auto-generated&nbsp;constructor&nbsp;stub</SPAN><SPAN style="COLOR: #008000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;<BR><IMG id=Codehighlighter1_587_717_Open_Image onclick="this.style.display='none'; Codehighlighter1_587_717_Open_Text.style.display='none'; Codehighlighter1_587_717_Closed_Image.style.display='inline'; Codehighlighter1_587_717_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_587_717_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_587_717_Closed_Text.style.display='none'; Codehighlighter1_587_717_Open_Image.style.display='inline'; Codehighlighter1_587_717_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000">&nbsp;execute()&nbsp;</SPAN><SPAN id=Codehighlighter1_587_717_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_587_717_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;TODO&nbsp;Auto-generated&nbsp;method&nbsp;stub</SPAN><SPAN style="COLOR: #008000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;Assert.isNotNull(parent);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;Assert.isNotNull(child);&nbsp;&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;parent.removeChild(child);&nbsp;&nbsp;&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>}</SPAN></DIV>
<P></SPAN><BR>当然容器类的模型要实现removeChild方法才行<BR>&nbsp;public void removeChild(nodeModelchild){<BR>&nbsp;&nbsp;&nbsp; &nbsp;child.setParent(null);<BR>&nbsp;&nbsp;&nbsp; &nbsp;getChildren().remove(child);<BR>&nbsp;&nbsp;&nbsp; &nbsp;this.fireChildrenChange(child);<BR>&nbsp;&nbsp;&nbsp; }<BR><BR>以上介绍的这些是我进行实现的一个过程，实际实现的时候应该抽象出一个基类模型和对应的editpart，这样就不用重复在每个组件中编写了。实现完成后工具条上的按钮，主菜单中的删除选项，键盘的del键都可以用来进行删除操作。<BR>注意这里没有写command里的redo和undo操作。<BR></P><img src ="http://www.blogjava.net/USTCEric/aggbug/27128.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/USTCEric/" target="_blank">USTCEric</a> 2006-01-08 12:33 <a href="http://www.blogjava.net/USTCEric/archive/2006/01/08/27128.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>用gef实现编辑器里组件的对齐功能要注意的一个问题</title><link>http://www.blogjava.net/USTCEric/archive/2006/01/07/26988.html</link><dc:creator>USTCEric</dc:creator><author>USTCEric</author><pubDate>Sat, 07 Jan 2006 08:58:00 GMT</pubDate><guid>http://www.blogjava.net/USTCEric/archive/2006/01/07/26988.html</guid><wfw:comment>http://www.blogjava.net/USTCEric/comments/26988.html</wfw:comment><comments>http://www.blogjava.net/USTCEric/archive/2006/01/07/26988.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/USTCEric/comments/commentRss/26988.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/USTCEric/services/trackbacks/26988.html</trackback:ping><description><![CDATA[<!--StartFragment -->&nbsp;ResizableEditPolicy中的getAlignCommand方法是到组件的父（也就是承载组件的容器）editpolicy中调用 getCommand（）方法，而这时容器的editpolicy必须是ConstrainedLayoutEditPolicy <BR>或者是继承于它的editpolicy（如XYLayoutEditPolicy）才能支持align动作返回alignCommand。 <BR>因此容器类继承于ConstrainedLayoutEditPolicy或者XYLayoutEditPolicy才能实现align功能。<BR>&nbsp;<BR>这个在八进制的blog曾作为回复发过，为了以后自己看方便，就在这里再记录一下。<img src ="http://www.blogjava.net/USTCEric/aggbug/26988.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/USTCEric/" target="_blank">USTCEric</a> 2006-01-07 16:58 <a href="http://www.blogjava.net/USTCEric/archive/2006/01/07/26988.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>这里就是我的技术区了</title><link>http://www.blogjava.net/USTCEric/archive/2006/01/07/26987.html</link><dc:creator>USTCEric</dc:creator><author>USTCEric</author><pubDate>Sat, 07 Jan 2006 08:51:00 GMT</pubDate><guid>http://www.blogjava.net/USTCEric/archive/2006/01/07/26987.html</guid><wfw:comment>http://www.blogjava.net/USTCEric/comments/26987.html</wfw:comment><comments>http://www.blogjava.net/USTCEric/archive/2006/01/07/26987.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.blogjava.net/USTCEric/comments/commentRss/26987.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/USTCEric/services/trackbacks/26987.html</trackback:ping><description><![CDATA[学习gef和rcp有一小段时间了，参照例子，写了个简易rcp平台，写了个简单演示的gef界面。花了不少时间，学到不少东西。回头看看自己的收获，又都变得模糊，技术的东西是需要总结的。前面的记起来就写写，后面的，学到什么新东西要赶紧记下来了，自己这残疾的记忆太让人失望。<img src ="http://www.blogjava.net/USTCEric/aggbug/26987.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/USTCEric/" target="_blank">USTCEric</a> 2006-01-07 16:51 <a href="http://www.blogjava.net/USTCEric/archive/2006/01/07/26987.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>