??xml version="1.0" encoding="utf-8" standalone="yes"?>欧美激情一区二区在线,污视频在线观看免费,久久久人人人http://www.aygfsteel.com/mlzry0612/articles/342780.htmlDanielDanielTue, 11 Jan 2011 09:06:00 GMThttp://www.aygfsteel.com/mlzry0612/articles/342780.htmlhttp://www.aygfsteel.com/mlzry0612/comments/342780.htmlhttp://www.aygfsteel.com/mlzry0612/articles/342780.html#Feedback0http://www.aygfsteel.com/mlzry0612/comments/commentRss/342780.htmlhttp://www.aygfsteel.com/mlzry0612/services/trackbacks/342780.html阅读全文

Daniel 2011-01-11 17:06 发表评论
]]>
For extension point definition's variable attribute extension point.http://www.aygfsteel.com/mlzry0612/articles/335091.htmlDanielDanielThu, 14 Oct 2010 02:11:00 GMThttp://www.aygfsteel.com/mlzry0612/articles/335091.htmlhttp://www.aygfsteel.com/mlzry0612/comments/335091.htmlhttp://www.aygfsteel.com/mlzry0612/articles/335091.html#Feedback0http://www.aygfsteel.com/mlzry0612/comments/commentRss/335091.htmlhttp://www.aygfsteel.com/mlzry0612/services/trackbacks/335091.html   <extension

         point="org.eclipse.core.expressions.propertyTesters">

      <propertyTester

            class="com.ebay.tools.vjet2.internal.debug.property.LaunchPropertyTester"

            id="com.ebay.tools.vjet2.debug.property.launch"

            namespace="com.ebay.tools.vjet2.debug"

            properties="launchJS,launchHTML"

            type="org.eclipse.core.runtime.IAdaptable">

      </propertyTester>

   </extension>



Specified class should be extends PropertyTester and implement related methods.


LaunchPropertyTester extends PropertyTester {





Others services register.

IFocusService focusService =
(IFocusService) PlatformUI.getWorkbench()
.getService(IFocusService.class);
focusService.addFocusTracker(text, "textControlId");


All variables collected in ISources class, User can find related variables in this class.

 



Daniel 2010-10-14 10:11 发表评论
]]>
RCP 文g路径问题 http://www.aygfsteel.com/mlzry0612/articles/332747.htmlDanielDanielFri, 24 Sep 2010 02:59:00 GMThttp://www.aygfsteel.com/mlzry0612/articles/332747.htmlhttp://www.aygfsteel.com/mlzry0612/comments/332747.htmlhttp://www.aygfsteel.com/mlzry0612/articles/332747.html#Feedback0http://www.aygfsteel.com/mlzry0612/comments/commentRss/332747.htmlhttp://www.aygfsteel.com/mlzry0612/services/trackbacks/332747.htmll于扑ֈ直接可以用的?/span> 
Java代码 
  1. path = FileLocator.toFileURL(  
  2.         Platform.getBundle(IAppConstants.APPLICATION_ID)  
  3.                 .getEntry("")).getPath().toString();  



RCP 文g路径问题 
String path =FileLocator.toFileURL(Platform.getBundle("工程?).getEntry("")).getPath 

得到eclipse rcp plugin 内目录文件绝对\径的Ҏ(gu) 
import java.io.IOException; 
import java.net.URL; 

import org.eclipse.core.runtime.FileLocator; 
import org.eclipse.core.runtime.Platform; 
import org.osgi.framework.Bundle; 

import com.work.base.exception.DataException; 
import com.work.view.Activator; 

public class BundlePathUtil { 

    public static String getRealPath(String bundleID, String entry) 
            throws DataException { 
        URL urlentry; 
        String strEntry; 
        try { 
            Bundle bundle = Platform.getBundle(bundleID); 
            if (bundle==null) 
                throw new DataException("h查文件的路径",new NullPointerException()); 
            // get path URL 
            urlentry = bundle.getEntry(entry); 
            if (urlentry==null) 
                throw new DataException("h查文件的路径",new NullPointerException()); 
            strEntry = FileLocator.toFileURL(urlentry).getPath(); 
        } catch (IOException e1) { 
            throw new DataException("h查文件的路径", e1); 
        } 
        return strEntry; 
    } 
    
    public static String getPluginPath(){        
        return Activator.getDefault().getStateLocation().makeAbsolute().toFile().getAbsolutePath(); 
        
    }   
    
} 

另外Q获取插?rcp 的workspace的\径:(x) 


Platform.getInstanceLocation().getURL().getPath() 




从插?RCP中取得文件\径的Ҏ(gu) 

最q社区里问这个问题的人特别多Q所以在q里自q到的几个Ҏ(gu)写出来。假如以后还有其他的Ҏ(gu)Q会(x)q行更新?/span> 

从插件中获得l对路径Q?/span> 
    AaaaPlugin.getDefault().getStateLocation().makeAbsolute().toFile().getAbsolutePath()); 


通过文g得到ProjectQ?/span> 

IProject project = ((IFile)o).getProject(); 


通过文g得到全\径:(x) 

String path = ((IFile)o).getLocation().makeAbsolute().toFile().getAbsolutePath(); 



得到整个Workspace的根Q?/span> 

IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); 


从根来查找资源:(x) 

IResource resource = root.findMember(new Path(containerName)); 

从Bundle来查找资源:(x) 

Bundle bundle = Platform.getBundle(pluginId); 
URL fullPathString = BundleUtility.find(bundle, filePath); 


得到Appliaction workspaceQ?/span> 

Platform.asLocalURL(PRODUCT_BUNDLE.getEntry("")).getPath()).getAbsolutePath(); 

得到runtimeworkspaceQ?/span> 
Platform.getInstanceLocation().getURL().getPath(); 

从编辑器来获得编辑文Ӟ(x) 

IEditorPart editor = ((DefaultEditDomain)(parent.getViewer().getEditDomain())).getEditorPart(); 
IEditorInput input = editor.getEditorInput(); 
if(input instanceof IFileEditorInput){ 
IFile file = ((IFileEditorInput)input).getFile(); 
}

Daniel 2010-09-24 10:59 发表评论
]]>
Simplify Eclipse classpaths using classpath containershttp://www.aygfsteel.com/mlzry0612/articles/331330.htmlDanielDanielTue, 07 Sep 2010 09:37:00 GMThttp://www.aygfsteel.com/mlzry0612/articles/331330.htmlhttp://www.aygfsteel.com/mlzry0612/comments/331330.htmlhttp://www.aygfsteel.com/mlzry0612/articles/331330.html#Feedback0http://www.aygfsteel.com/mlzry0612/comments/commentRss/331330.htmlhttp://www.aygfsteel.com/mlzry0612/services/trackbacks/331330.html阅读全文

Daniel 2010-09-07 17:37 发表评论
]]>
Extending WTP Using Project Facetshttp://www.aygfsteel.com/mlzry0612/articles/327766.htmlDanielDanielMon, 02 Aug 2010 09:14:00 GMThttp://www.aygfsteel.com/mlzry0612/articles/327766.htmlhttp://www.aygfsteel.com/mlzry0612/comments/327766.htmlhttp://www.aygfsteel.com/mlzry0612/articles/327766.html#Feedback0http://www.aygfsteel.com/mlzry0612/comments/commentRss/327766.htmlhttp://www.aygfsteel.com/mlzry0612/services/trackbacks/327766.html阅读全文

Daniel 2010-08-02 17:14 发表评论
]]>
Eclipse code templatehttp://www.aygfsteel.com/mlzry0612/articles/305240.htmlDanielDanielWed, 09 Dec 2009 02:12:00 GMThttp://www.aygfsteel.com/mlzry0612/articles/305240.htmlhttp://www.aygfsteel.com/mlzry0612/comments/305240.htmlhttp://www.aygfsteel.com/mlzry0612/articles/305240.html#Feedback0http://www.aygfsteel.com/mlzry0612/comments/commentRss/305240.htmlhttp://www.aygfsteel.com/mlzry0612/services/trackbacks/305240.htmlpublic class ScriptTemplateContext extends DocumentTemplateContext {

Daniel 2009-12-09 10:12 发表评论
]]>
org.eclipse.core.expressions.definitions point at Eclipse 3.3http://www.aygfsteel.com/mlzry0612/articles/301712.htmlDanielDanielMon, 09 Nov 2009 07:42:00 GMThttp://www.aygfsteel.com/mlzry0612/articles/301712.htmlhttp://www.aygfsteel.com/mlzry0612/comments/301712.htmlhttp://www.aygfsteel.com/mlzry0612/articles/301712.html#Feedback0http://www.aygfsteel.com/mlzry0612/comments/commentRss/301712.htmlhttp://www.aygfsteel.com/mlzry0612/services/trackbacks/301712.html<extension
         point="org.eclipse.core.expressions.definitions">
      <definition
            id="com.ebay.tools.vjet2.ui.inDltk">
         <with
               variable="activePartId">
               <or>
    <equals value="org.eclipse.jdt.ui.PackageExplorer"/>
    <equals value="org.eclipse.jdt.ui.ClassFileEditor"/>

   <extension
         point="org.eclipse.ui.handlers">
      <handler
            class="com.ebay.tools.vjet2.internal.ui.actions.VjoOpenTypeHandler"
            commandId="org.eclipse.jdt.ui.navigate.open.type">
         <activeWhen>
            <reference
                  definitionId="com.ebay.tools.vjet2.ui.inDltk">
            </reference>
         </activeWhen>
      </handler>
   </extension>


   <extension point="org.eclipse.ui.actionSets">
               <actionSet label="%VjetActionSet.label" description="%VjetActionSet.description" visible="false" id="com.ebay.tools.vjet2.ui.VjetActionSet">
         <action class="com.ebay.tools.vjet2.ui.actions.VjoOpenTypeAction" definitionId="org.eclipse.jdt.ui.navigate.open.type" icon="platform:/plugin/org.eclipse.dltk.ui/icons/full/etool16/opentype.gif" id="com.ebay.tools.vjet2.ui.openType" label="%OpenTypeAction.label" menubarPath="navigate/open.ext2" tooltip="%OpenTypeAction.tooltip">
         </action>
         </actionSet>


Execute sequence: Action will be actived -->Find definediionID:org.eclipse.jdt.ui.navigate.open.type at a handler, -->handler will be actived when definited satisfied

It's very useful when cut event when override old version codes or 3rd plugin.


Daniel 2009-11-09 15:42 发表评论
]]>
模式对话?/title><link>http://www.aygfsteel.com/mlzry0612/articles/290209.html</link><dc:creator>Daniel</dc:creator><author>Daniel</author><pubDate>Fri, 07 Aug 2009 04:25:00 GMT</pubDate><guid>http://www.aygfsteel.com/mlzry0612/articles/290209.html</guid><wfw:comment>http://www.aygfsteel.com/mlzry0612/comments/290209.html</wfw:comment><comments>http://www.aygfsteel.com/mlzry0612/articles/290209.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/mlzry0612/comments/commentRss/290209.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/mlzry0612/services/trackbacks/290209.html</trackback:ping><description><![CDATA[ <span id="wmqeeuq" class="keyword">public</span><span> </span><span id="wmqeeuq" class="keyword">void</span><span> childShellTest(Shell shell){   </span></span> <li><span>        </span><span id="wmqeeuq" class="comment">//非模态对话框 </span><span>  </span></span></li> <li><span>        ChildShell child1 = </span><span id="wmqeeuq" class="keyword">new</span><span> ChildShell(shell);   </span></span></li> <li><span>        </span><span id="wmqeeuq" class="comment">//模式对话?nbsp;-- 只禁用父H体 </span><span>  </span></span></li> <li><span>        ChildShell child2 = </span><span id="wmqeeuq" class="keyword">new</span><span> ChildShell(shell,SWT.DIALOG_TRIM|SWT.APPLICATION_MODAL);           </span></span></li> <li><span>        </span><span id="wmqeeuq" class="comment">//模式对话?nbsp;-- 用pȝH体 </span><span>  </span></span></li> <li><span>        ChildShell child3 = </span><span id="wmqeeuq" class="keyword">new</span><span> ChildShell(shell,SWT.DIALOG_TRIM|SWT.SYSTEM_MODAL);    </span></span></li> <li><span>    }   </span></li> <img src ="http://www.aygfsteel.com/mlzry0612/aggbug/290209.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/mlzry0612/" target="_blank">Daniel</a> 2009-08-07 12:25 <a href="http://www.aygfsteel.com/mlzry0612/articles/290209.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Quick Fix implementhttp://www.aygfsteel.com/mlzry0612/articles/281010.htmlDanielDanielTue, 09 Jun 2009 12:46:00 GMThttp://www.aygfsteel.com/mlzry0612/articles/281010.htmlhttp://www.aygfsteel.com/mlzry0612/comments/281010.htmlhttp://www.aygfsteel.com/mlzry0612/articles/281010.html#Feedback0http://www.aygfsteel.com/mlzry0612/comments/commentRss/281010.htmlhttp://www.aygfsteel.com/mlzry0612/services/trackbacks/281010.htmlFor eclipse quick fix. There are lots of articles introduce how to add a marker but no reference to how to implement the Proposal .
Now i will give the solution:
First. Add the marker. It's the sample one:
1. Declare the marker extension point : org.eclipse.core.resources.markers, //Here should be clear: there are some args should be declared in pulg.in. xml file. which will be used in your code.
     and implement the IMarkerResolutionGenerator2 interface. //Generate the generator.
2. User IResource.createMarker(....) API to create the marker. // Here will give your delcared marker type.
3. Your editor must have a configure file which extends from SourceViewerConfiguration. There is a important API for our quick fix function is: getQuickAssistAssistant();
4. So you should implement the IQuickAssistAssistant, ( I extends from JavaCorrectionAssistant the in my code) and regesit it at step 4.
5. The class implement the IQuickAssistAssistant which will set a IQuickAssistProcessor instance for execute qiuck fix. API is setQuickAssistProcessor();
6. in IQuickAssistAssistant  interface the most important API is computeQuickAssistProposals(IQuickAssistInvocationContext). which will be return ICompletionProposal[]  this API is used to finish your business.
7. So some body will ask that when we will use the eclipse extension point : org.eclipse.ui.ide.markerResolution
   Now. see the  ICompletionProposal[]  return type at step 6? There have a implement class called MarkerResolutionProposal(), Let 's say it's constructor
 public MarkerResolutionProposal(IMarkerResolution resolution, IMarker marker)
 See here the org.eclipse.ui.ide.markerResolution extension point is used here. but the MarkerResolutionProposal seems only used in java syntax.
So if your have another grammer. please new a interface to extends from ICompletionProposal.
8. The details implement will be finished in class which implement IMarkerResolution. at run() API

If i have some time i will update some class diagram for this function.



Daniel 2009-06-09 20:46 发表评论
]]>
Eclipse3.3新特性之RCPhttp://www.aygfsteel.com/mlzry0612/articles/231984.htmlDanielDanielWed, 01 Oct 2008 05:30:00 GMThttp://www.aygfsteel.com/mlzry0612/articles/231984.htmlhttp://www.aygfsteel.com/mlzry0612/comments/231984.htmlhttp://www.aygfsteel.com/mlzry0612/articles/231984.html#Feedback1http://www.aygfsteel.com/mlzry0612/comments/commentRss/231984.htmlhttp://www.aygfsteel.com/mlzry0612/services/trackbacks/231984.html     新特性之一QViewer和Editor的最大化最化效果变的很CoolQ?br />     q个新特性,可能对开发h员来说ƈ没有什么稀奇的Q有q个和没有这个的区别不大。但是对于RCP的开发,q个是一个非常吸引客L(fng)球的地方Q他们会(x)瞪大眼睛看,然后自己把玩Q最后要求ؓ(f)自己开发Y件的其他软g都加入此功能。o(∩_∩)o...哈哈~~够他们忙zȝ?jin)?br />     新特性之二:(x)当Editor最大化以后Q其他的Viewer以新的列表方式l箋出现在界面上Q?br />     q个功能Q不好解释,看看抓图Q?br />
      很Cool吧,客户一定喜Ƣ死?jin)~
      新特性之三:(x)对Forms加入?jin)错误信息验证?br />       以前的版本中QForm使没有错误验证的Q现在则加入?jin)Forms的验证,看来Form的用可以更快的深入人心(j)?jin)~

      新特性之四:(x)增强Porperties View的现实效果;

     虽然我不喜欢在项目中使用PorpertiesViewQ配|v来太ȝ(ch)Q不适合普通开发h员用)(j)Q但是还是感谢Eclipse的开发团队此ơ对PorpertiesView的增强?br />      新特性之五:(x)可控制的启动画面Q?br />      在Eclipse3.3中提供了(jin)新的扩展?font face="Courier New">org.eclipse.osgi.service.runnable.StartupMonitorQ用于在启动时用SWT的代码?br />   新特性之六:(x)高的TooltipsQ?br />   提供?jin)新的扩展点Qorg.eclipse.jface.window.Tooltip用于创徏更ؓ(f)高的TooltipsQ?br />
  新特性之七:(x)SWT增加旉日期选择器;
  :-)Q这个可能是大家早都知道的秘密了(jin)~真想不通,旉和日期选择器早都应该提供了(jin)Qؓ(f)什么到现在才拿出来Q?br />


    新特性之八:(x)新增?U启动界面;
Interactive: A simulated log-in session  使用一个程序登陆界面启?br /> Browser: An embedded HTML browser  使用一个Html作ؓ(f)登陆界面
Extensible: A dynamic set of image contributions 使用一张图片作为启动界?br />     在新的PDE中可以对一个product选择使用那一U启动界面启动,q个新功能的增加是非常有意义的,它得RCP应用更加的h性化Q不用再在系l启动中弹出对话框了(jin)Q让客户更加攑ֿ(j)的选择ZRCP的品了(jin)~



Daniel 2008-10-01 13:30 发表评论
]]>
Eclipse3.3新特性体验之最大化最化改进 http://www.aygfsteel.com/mlzry0612/articles/231983.htmlDanielDanielWed, 01 Oct 2008 05:27:00 GMThttp://www.aygfsteel.com/mlzry0612/articles/231983.htmlhttp://www.aygfsteel.com/mlzry0612/comments/231983.htmlhttp://www.aygfsteel.com/mlzry0612/articles/231983.html#Feedback0http://www.aygfsteel.com/mlzry0612/comments/commentRss/231983.htmlhttp://www.aygfsteel.com/mlzry0612/services/trackbacks/231983.html 
    昨天晚上写了(jin)Eclipse3.3的新Ҏ(gu),?j)中异常兴奋Q想快点用到现有的品开发框架中Q于是开始把玩最大化最化的新Ҏ(gu)?br />    研究?jin)整整一下午也没有发现有什么方法可以设|一个Viewer让它在透视囑֐动的时候自己做最化Q其实刚开始思\是不对的Q不应该考虑让Viewer自己有什么变化;Viewer的大,位置都是在透视图中讄的,它自己是没有M能力q涉的?br />    在Eclipse的新ȝ中咨询了(jin)一下PW告诉我org.eclipse.ui.perspectiveExtensions扩展点,提供?jin)定义Viewer最化的属性,而且q个属性是Eclipse3.3新增的,只要有就好办~有样学样Q?br />    拉出来PerspectiveExtension理注册代码读读明白了(jin)~原来Q?br />
1    public void createInitialLayout(IPageLayout layout) {
2            }
  透视囄中的IPageLayout的实现类是PageLayoutQ晕死,在Eclipse的API中竟然没有h告诉我~
  于是只需要这样就可以让一个Viewer在透视囑֐动时做最化?jin),如果你用的是Eclipse3.3开发RCPE序Q那么就可以非常方便的给客户在一个透视图中展现多个Viewer?jin)~
   代码如下Q?br />
    public void createInitialLayout(IPageLayout layout) {
        PageLayout pageLayout 
=
 (PageLayout)layout;
        
//layout.addView(ViewPart1.class.getName(), IPageLayout.LEFT, 0.35f, layout.getEditorArea());

        pageLayout.addView(ViewPart1.class.getName(), IPageLayout.LEFT, 0.35f, layout.getEditorArea(), true);
    }
   Eclipse开发团队其实就是在IPageLayout实现cMq加?jin)一个方法~哎~什么遵循接口编E~他们竟然不修Ҏ(gu)口~希望正式版发布的时候这个问题有修改~

 


Daniel 2008-10-01 13:27 发表评论
]]>
Eclipse3.4的一些好用的功能http://www.aygfsteel.com/mlzry0612/articles/231980.htmlDanielDanielWed, 01 Oct 2008 05:24:00 GMThttp://www.aygfsteel.com/mlzry0612/articles/231980.htmlhttp://www.aygfsteel.com/mlzry0612/comments/231980.htmlhttp://www.aygfsteel.com/mlzry0612/articles/231980.html#Feedback0http://www.aygfsteel.com/mlzry0612/comments/commentRss/231980.htmlhttp://www.aygfsteel.com/mlzry0612/services/trackbacks/231980.html      1.快速访问功能:(x)如果你想使用哪个命o(h)Q只需要点Ctrl+3启动快速访问,在里面输入命令的前n个字母或者首字母~写Q就可以选择你要q行的命令了(jin)?br style="font-family: " />      2.对资源,dQ书{操作都可以被撤销?jin)?br style="font-family: " />      3.支持内容的拖拽,如把W一行的内容直接拖拽到第三行
    4.
按住Ctrl键不松手Q用鼠标滚轮可q速到辑ֆ容的开头或l尾
    5.
双击鼠标可以选中一个单词,三击鼠标可以选中一?br style="font-family: " />     6.如果某一行的开头或者结有若干I白字符Q当使用HOME/END键时Q第一ơ点d略空白字W,光标只到辑ֆ容的开头或l尾Q第二次点击光标才到辄正的开头或l尾?br style="font-family: " />     7. 在properties里的Editor里加?jin)一个save action的属性,可以在save的时候触发你惌发的东西Q例如:(x)格式化等{?br style="font-family: " />     8.Ctrl+Alt+J 把下一行连接到q一行的后面
   10.参数打包重构Q对于这L(fng)函数int add(int a, int b, int c),׃参数比较多,可以考虑其合ƈZ个类Q这个类包含3个属性,q个cȝ功能是专门个函数做参数。在新版本的Eclipse中,选中一个函敎ͼ右键菜单r(sh)efactor-> Introduce Parameter Object可以实现q一功能。(当然Q用新版本的快速访问功能,输入首字母ipo也可以实现这一功能Q方便啊~Q?br style="font-family: " />    11.强大的clean up功能Q可以把普通@环变成foreach循环Q可以删除从未用的变量、函敎ͼ可以在适当的地Ҏ(gu)加添加@OverrideQ可以给所有的forQif代码块添加大括号……M功能很强大了(jin)。在source->clean up菜单下访问?br style="font-family: " />      来点?br />
Eclipse3.4发布 新特性展C?
介绍
eclipse 3.4 代号为ganymede QG anymede (p发音"GAN uh meed")为最大的木星已知卫星Q也是第七颗发现的木星卫星,在伽利略发现的卫星中L星第三近,在希腊神话中 Ganymede是一个特z伊h的男?一个美男)Q被宙斯带去l众斟酒)(j)?

1.面包?/strong>
其实是当前cd目(project)的\径,其中包括包和文g夏V?
另外Q用者还可以自由地在同一路径下的某个节点处,U向切换到其他元素?

Eclipse3.4发布 新特性展C?

在节Ҏ(gu)在位|做一些操?比如在同U新增一个类

Eclipse3.4发布 新特性展C?

U向切换元素

Eclipse3.4发布 新特性展C?

2.针对有问题的代码Q只要鼠标移动上去,p提示解决Ҏ(gu)信息

Eclipse3.4发布 新特性展C?


3.万能的快速协?quick assist)
只要在Q何代码处Q按 ctrl + 1Q就有可能出现相关的提示Q预你的下一步动作?

创徏getter ?setter
Eclipse3.4发布 新特性展C?


抽取Ҏ(gu)
Eclipse3.4发布 新特性展C?

低性能的字W串拼接Q改用StringBuilder
Eclipse3.4发布 新特性展C?

字W串拼接改用MessageFormat
Eclipse3.4发布 新特性展C?


4.按保存时Q自动格式化代码Q分格式化全文和格式化修改的代码Q?
省去?jin),保存前,按ctrl + shift + f 的时间?

Eclipse3.4发布 新特性展C?

5.当前元素的高亮功能,Ҏ(gu)元素是被引用q是赋|L写)(j)Q来 区分 不同的颜?/strong>
Eclipse3.4发布 新特性展C?


6.annotation 格式?/strong>

Annotations on members: Eclipse3.4发布 新特性展C?

Annotations on parameters: Eclipse3.4发布 新特性展C?

Annotations on local variables: Eclipse3.4发布 新特性展C?

7.Junit 支持对线E内每个帧(Ҏ(gu)Q的调用旉输出

Eclipse3.4发布 新特性展C?

8.在outline里,支持对同一个类中,Ҏ(gu)的重排序

Eclipse3.4发布 新特性展C?

9.查找某个元素的调用层ơ,支持更多Q更l的内容Q包括成员变量访问等Qcall hierarchy

Eclipse3.4发布 新特性展C?

10.更多的搜索选项

Eclipse3.4发布 新特性展C?

11.加强?jin)debug 变量查看功能Q不需要再?ctrl + shift + i 来查看变量的?

Eclipse3.4发布 新特性展C?

12.新增模拟服务端监听的debug功能

Eclipse3.4发布 新特性展C?



Daniel 2008-10-01 13:24 发表评论
]]>
Eclipse Action Enable stauts <Test>http://www.aygfsteel.com/mlzry0612/articles/221505.htmlDanielDanielTue, 12 Aug 2008 07:26:00 GMThttp://www.aygfsteel.com/mlzry0612/articles/221505.htmlhttp://www.aygfsteel.com/mlzry0612/comments/221505.htmlhttp://www.aygfsteel.com/mlzry0612/articles/221505.html#Feedback0http://www.aygfsteel.com/mlzry0612/comments/commentRss/221505.htmlhttp://www.aygfsteel.com/mlzry0612/services/trackbacks/221505.html

上一文?/font>我们知道?jin)Eclipse弹出菜单的基本用法。其实Eclipse的弹单可以用来做很多文章Q简单一点的Ҏ(gu)文gcdQ我们可以进行不同的文g操作Q比如Ant的build.xml我们可以用来buildQJava文g我们可以用Java Editor打开Q这些基于文件类型的操作我们都可以很Ҏ(gu)的实现。但是还有一U情况,如果文gcd一P我们惌行不同的操作Q该怎么实现呢?实际上这L(fng)应用很多Q比如同hJava文gQ含有mainҎ(gu)的Java文g有Run和Debug的选项Q其它的都没有。还有现在的框架都是ZXML文gq行配置的,如果一个项目用了(jin)多个框架Q我们怎么Ҏ(gu)不同的XML文gq行框架的区分呢Q答案就是enablement的test?/font>

<!ELEMENT test EMPTY>
<!ATTLIST test
property CDATA #REQUIRED
args     CDATA #IMPLIED
value    CDATA #IMPLIED>

This element is used to evaluate the property state of the object in focus. The set of testable properties can be extended using the propery tester extension point. The test expression returns EvaluationResult.NOT_LOADED if teh property tester doing the actual testing isn't loaded yet.

  • property - the name of an object's property to test.
  • args - additional arguments passed to the property tester. Multiple arguments are seperated by commas. Each individual argument is converted into a Java base type using the same rules as defined for the value attribute of the test expression.
  • value - the expected value of the property. Can be omitted if the property is a boolean property. The test expression is supposed to return EvaluationResult.TRUE if the property matches the value and EvaluationResult.FALSE otherwise. The value attribute is converted into a Java base type using the following rules:
    • the string "true" is converted into Boolean.TRUE
    • the string "false" is converted into Boolean.FALSE
    • if the string contains a dot then the interpreter tries to convert the value into a Float object. If this fails the string is treated as a java.lang.String
    • if the string only consists of numbers then the interpreter converts the value in an Integer object.
    • in all other cases the string is treated as a java.lang.String
    • the conversion of the string into a Boolean, Float, or Integer can be suppressed by surrounding the string with single quotes. For example, the attribute value="'true'" is converted into the string "true"


比如我们要让含有mainҎ(gu)的Java文g它的右键弹出菜单包含一个额外的选项“This is main class”Q需要编写如下的Plugin.xmlQ?/font>

< plugin >
   
< extension
         
point ="org.eclipse.ui.popupMenus" >

      
< objectContribution
        
id ="Advanced.PopupMenus"

        objectClass
="java.lang.Object" >
     
< action  id ="Advanced.PopupMenus.Action"
        label
="AdvancedPopupMenus"
        style
="pulldown"
        menubarPath
="additions"
        class
="advancedpopupmenus.popup.actions.AdvancedPopupMenusAction"  
        enablesFor
="+" >

     
</ action >
     
< enablement >
          
< test  property ="advancedpopupmenus.popup.visable" />
     
</ enablement >   
     
</ objectContribution >

   
</ extension >
   
< extension  point ="org.eclipse.core.expressions.propertyTesters" >
   
< propertyTester
   
namespace ="advancedpopupmenus.popup"

   properties
="visable"
   type
="java.lang.Object"
   class
="advancedpopupmenus.popup.actions.VisablePropertyTester"
   id
="advancedpopupmenus.popup.propertyTesters.visable" >   
   
</ propertyTester >
      
   
</ extension >

</ plugin >

我们需要检在当前情况下是否需要显C个菜单项Q用扩展点 org.eclipse.core.expressions.propertyTesters Q?br /> <!ELEMENT propertyTester EMPTY>
<!ATTLIST propertyTester
id         CDATA #REQUIRED
type       CDATA #REQUIRED
namespace  CDATA #REQUIRED
properties CDATA #REQUIRED
class      CDATA #REQUIRED>

id - unique identifier for the property tester
type - the type to be extended by this property tester
namespace - a unique id determining the name space the properties are added to
properties - a comma separated list of properties provided by this property tester
class - the name of the class that implements the testing methods. The class must be public and extend org.eclipse.core.expressions.PropertyTester with a public 0-argument constructor. 

q里只须注意
propertyTester的namespace和properties正好对应test的property?br />
至于(g)的逻辑我们在advancedpopupmenus.popup.actions.VisablePropertyTester中实玎ͼq个cdȝ承自org.eclipse.core.expressions.PropertyTester?/font>

package  advancedpopupmenus.popup.actions;

import
 org.eclipse.core.expressions.PropertyTester;
import
 org.eclipse.jdt.core.IMethod;
import
 org.eclipse.jdt.core.IType;
import
 org.eclipse.jdt.core.JavaModelException;
import
 org.eclipse.jdt.internal.core.CompilationUnit;

public   class  VisablePropertyTester  extends
 PropertyTester
{
    
public   boolean
 test( Object receiver, String property, Object[] args,
            Object expectedValue )
    {
        
if  (  ! ( receiver  instanceof
 CompilationUnit ) )
            
return   false
;
        CompilationUnit unit 
=
 (CompilationUnit) receiver;
        
try

        {
            IType[] types 
=  unit.getTypes( );
            
if  ( types  ==   null
 )
                
return   false
;
            
for  (  int  i  =   0 ; i  <  types.length; i ++
 )
            {
                IMethod[] methods 
=
 types[i].getMethods( );
                
if  ( methods  ==   null
 )
                    
return   false
;
                
for  (  int  j  =   0 ; j  <  methods.length; j ++
 )
                {
                    
if
 ( methods[j].isMainMethod( ) )
                        
return   true
;
                }
            }
        }
        
catch
 ( JavaModelException e )
        {
            e.printStackTrace( );
        }
        
return   false
;
    }
}

我们只要判断接受的Java文g中是否含有mainҎ(gu)Q如果有Q则q回TrueQ没有则q回False?br />
如果我们是要接受一个Web开发的配置文gQ我们可以这样写Q?/font>

< plugin >
   
< extension
         
point ="org.eclipse.ui.popupMenus" >

      
< objectContribution
        
id ="Advanced.PopupMenus"

        objectClass
="org.eclipse.core.resources.IFile"
        nameFilter
="*.xml" >    
        
< action  id ="Advanced.PopupMenus.Action"

           label
="This is web xml"
           style
="pulldown"
           menubarPath
="additions"
           class
="advancedpopupmenus.popup.actions.AdvancedPopupMenusAction"     
           enablesFor
="+" >

        
</ action >
        
< enablement >
             
< test  property ="advancedpopupmenus.popup.visable" />
        
</ enablement >   
     
</ objectContribution >

   
</ extension >
   
< extension  point ="org.eclipse.core.expressions.propertyTesters" >
      
< propertyTester
            
namespace ="advancedpopupmenus.popup"

            properties
="visable"
            type
="org.eclipse.core.resources.IFile"
            class
="advancedpopupmenus.popup.actions.VisablePropertyTester"
            id
="advancedpopupmenus.popup.propertyTesters.visable" >         
      
</ propertyTester >
      
   
</ extension >

</ plugin >

注意和上一个例子不同的地方QobjectClassQnameFileter和type(在上一个例子中Q我们也可以使用objectClass="org.eclipse.core.resources.IFile" nameFilter ="*.java" )Q相应的我们的VisablePropertyTestercM要做一些改动:(x)

package  advancedpopupmenus.popup.actions;

import
 javax.xml.parsers.DocumentBuilder;
import
 javax.xml.parsers.DocumentBuilderFactory;
import
 org.eclipse.core.expressions.PropertyTester;
import
 org.eclipse.core.resources.IFile;
import
 org.w3c.dom.Document;
import
 org.w3c.dom.DocumentType;

public   class  VisablePropertyTester  extends
 PropertyTester
{
    
public   boolean
 test( Object receiver, String property, Object[] args,
            Object expectedValue )
    {
        
if  (  ! ( receiver  instanceof
 IFile ) )
            
return   false
;
        IFile xml 
=
 (IFile) receiver;
        
try

        {
            DocumentBuilderFactory dbf 
=  DocumentBuilderFactory.newInstance( );
            DocumentBuilder db 
=
 dbf.newDocumentBuilder( );
            Document doc 
=
 db.parse( xml.getContents( ) );
            DocumentType type 
=
 doc.getDoctype( );
            
if (type.getSystemId( ).equalsIgnoreCase(  " http://java.sun.com/j2ee/dtds/web-app_2_2.dtd "  )) return   true
;
        }
        
catch
 ( Exception e )
        {
            e.printStackTrace( );
        }        
        
return   false
;
    }
}

q样Ҏ(gu)不同的xml SystemIDQ我们就能够知道到底q是哪一U框架的配置文g?jin)?/font>



Daniel 2008-08-12 15:26 发表评论
]]>
解决Myeclipes完整版的问?/title><link>http://www.aygfsteel.com/mlzry0612/articles/221216.html</link><dc:creator>Daniel</dc:creator><author>Daniel</author><pubDate>Mon, 11 Aug 2008 01:58:00 GMT</pubDate><guid>http://www.aygfsteel.com/mlzry0612/articles/221216.html</guid><wfw:comment>http://www.aygfsteel.com/mlzry0612/comments/221216.html</wfw:comment><comments>http://www.aygfsteel.com/mlzry0612/articles/221216.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.aygfsteel.com/mlzry0612/comments/commentRss/221216.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/mlzry0612/services/trackbacks/221216.html</trackback:ping><description><![CDATA[Q? 无法看到jdk 源代码。Solution: 1. 替换JDK. Q。 用有源码的eclipse.  <br /> <span style="color: #000000"><br /> <br /> 现在在Java开发中Q用的开发工具大部分都是EclipseQƈ且和Eclipse关系紧密的要数MyEclipse?jin),但是MyEclipse是一个EXE可执行程序,对于没有安装Eclipse与MyEclilpse的电(sh)脑来_(d)首先得先解压EclipseQ然后再安装MyEclipseQ这不光很麻?ch),而且q很Ҏ(gu)Q对于已l安装好的电(sh)脑来_(d)如果哪天?sh)脑Z(jin)问题或是Eclipse崩溃?jin),D工具不能用,q时又不得不重新安装Ӟ那可真够郁闷_(d)~~Q因此,大象本着我ؓ(f)ZhQhZؓ(f)我的奉献_Q在此,Eclipse+MyEclipse的完全绿色版制作Ҏ(gu)写出来,和大家一起分享,让大安能n受到q种方便?br />         在这里,大象采用Eclipse3.3.1与MyEclipse_6.0.1GA_E3.3.1_Installer版来举例说明Q其它的版本做法与此相同?/span><br />         <span style="color: #0000ff"><span style="color: #0000ff"><strong>W?步:(x)下蝲Eclipse3.3.1和MyEclipse_6.0.1GA<br /> </strong><span style="font-size: 10pt; color: black; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">           q里我要提醒大家注意一下:(x)下蝲</span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体">Eclipse</span><span style="font-size: 10pt; color: black; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">时不要选择</span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体">3.2</span><span style="font-size: 10pt; color: black; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">的版本,因ؓ(f)</span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体">MyEclipse6.0</span><span style="font-size: 10pt; color: black; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">需?/span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体">3.3</span><span style="font-size: 10pt; color: black; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">版本以上的支持,另外是下蝲</span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体">MyEclipse</span><span style="font-size: 10pt; color: black; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">时不要下完全版,而应该只下插件版Q我的这?/span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体">MyEclipse6.0.1</span><span style="font-size: 10pt; color: black; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">的插件版?/span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体">176M?br /> <img height="34" alt="" hspace="2" src="http://www.aygfsteel.com/images/blogjava_net/bolo/eclipse/1.JPG" width="495" vspace="5" border="0" /><br />         <strong><span style="font-size: 10pt; color: blue; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">W?/span><span lang="EN-US" style="font-size: 10pt; color: blue; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体">2</span></strong><strong><span style="font-size: 10pt; color: blue; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">步:(x)解压</span><span lang="EN-US" style="font-size: 10pt; color: blue; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体">Eclipse3.3.1</span></strong> <br /> <span style="font-size: 10pt; color: black; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">          ?/span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体">Eclipse3.3.1</span><span style="font-size: 10pt; color: black; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">的压~包解压?/span><span lang="EN-US" style="font-size: 10pt; color: black; font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体">D</span><span style="font-size: 10pt; color: black; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">盘根目录下?br /> <img height="256" alt="" src="http://www.aygfsteel.com/images/blogjava_net/bolo/eclipse/2.JPG" width="505" border="0" /><br /> <br />           做这个绿色版Q把它放在根目录下是因ؓ(f)q样做很方便Q?span style="color: #ff0000">在这里,大象以D盘ؓ(f)例,来说明制作方法?/span><br />     <span style="color: #0000ff"><strong>W?步:(x)安装MyEclipse6.0.1GA<br /> </strong><span style="color: #000000">           双击"<font style="color: #ff0000" face="宋体" color="#0000ff" size="2">MyEclipse_6.0.1GA_E3.3.1_Installer.exe</font>"开始安装MyEclipseQ在W??"Choose Eclipse Folder"Ӟ注意 "Please Choose Existing Eclipse Installation Folder"Q点?Choose...",请选择你解压的Eclipse文g夹,选择好之后如下图Q?br /> <img height="465" alt="" src="http://www.aygfsteel.com/images/blogjava_net/bolo/eclipse/4.JPG" width="622" border="0" /><br />           点击"Next"Q出?Where Would You Like to Install MyEclipse 6.0.1?",点击"Choose...",选择上面的eclipse文g夹,q时记得在eclipse后面加一个目录名Q否则,MyEclipse的安装文件就?x)全部放在eclipse的根目录下,q可不是我们希望看到_(d)讄好之后如下图:<br /> <img height="467" alt="" hspace="2" src="http://www.aygfsteel.com/images/blogjava_net/bolo/eclipse/5.JPG" width="622" vspace="5" border="0" /><br />            下面的安装没什么好说的Q就是一路Next?jin)。安装结束后Q可以在eclipse目录下看到有一?MyEclipse 6.0.1GA"q个文g?q去看看Q是不是有两个文件夹Q两个文Ӟ<br /> <img height="71" alt="" hspace="2" src="http://www.aygfsteel.com/images/blogjava_net/bolo/eclipse/10.JPG" width="438" vspace="5" border="0" /><br />            OK,到此MyEclipse插g已经安装完成?jin),下面来进行我们的l色插g制作?br />     <span style="color: #0000ff"><strong>W?步:(x)插g制作<br /> </strong><span style="color: #000000">           在eclipse目录下,新徏一个文件夹Q命名ؓ(f)"<font style="background-color: #ffffff" face="宋体" size="2">ThirdPlugins</font>"Q你要取别的名字也可以,不过一定要和links目录里面的配|文件中的\径一_(d)后面?x)有说?,?MyEclipse 6.0.1GA"q个文g夹复制到"ThirdPlugins"目录下,别用剪切喔,q可是刚才安装MyEclipse的目录,{会(x)q要~MyEclipseQ如果这个目录没有了(jin)Q到时D载不?jin),Z(jin)什么问题可不要怪大象喔Q?br />            MyEclipse安装好之后,?x)在eclipse目录下生成一个links文g夹,里面有一?com.genuitec.eclipse.MyEclipse.link"文gQ我们删除它Q另外新Z?MyEclipse 6.0.1GA.ini"文gQ内容ؓ(f)Q?span style="color: #ff0000">path=ThirdPlugins/MyEclipse 6.0.1GA<br />            <span style="color: #000000">保存完之后,我们的插件制作也l束?jin),然后是~MyEclipseQ千万不要直接把那个文g夹删掉,而应该D载它?br /> <img height="74" alt="" hspace="2" src="http://www.aygfsteel.com/images/blogjava_net/bolo/eclipse/9.JPG" width="381" vspace="5" border="0" /><br /> <img height="79" alt="" hspace="2" src="http://www.aygfsteel.com/images/blogjava_net/bolo/eclipse/8.JPG" width="347" vspace="5" border="0" /><br />            其实所有的插g都可以按q个方式来做Q这样做的好处就是,想用放q去Q不想用删掉,如果攑ֈeclipse的features和plugins里面Q会(x)很不好管理?br />     <span style="color: #0000ff"><strong>W?步:(x)配置参数</strong></span><br />            虽然插g已经安装好了(jin)Q但是,此时我们q不能启动它Q应该对eclipse的启动参数设|一下,提高它的启动速度和运行时的稳定性。在eclipse.exe上点右键Q选择"创徏快捷方式"Q在快捷方式上点右键Q选择"属?Q在"D:\eclipse\eclipse.exe后面加上I格Q将q些参数加在后面Q?br />            <span style="color: #ff0000">-vmargs -Xverify:none -XX:+UseParallelGC -XX:PermSize=20M -XX:MaxPermSize=128M -Xms256M -Xmx512M<br />            <span style="color: #000000">-Xms256M -Xmx512MQ这是堆Q根据内存大来讄Q比如大象的内存?G,我就设成256?12Q这样一般都够用?jin)?br />            当然?jin),你也可以什么都不设|,不过大象q是讄q些参数Q可以很大程度上提升eclipse的启动速度。在安装完MyEclipseӞq会(x)生成一个eclipse.ini的备份文Ӟq个不需要,删掉。我们可以修改下eclipse.ini文gQ原始的如下Q? <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: #000000">-</span><span style="color: #000000">showsplash<br /> com.genuitec.myeclipse.product<br /> </span><span style="color: #000000">--</span><span style="color: #000000">launcher.XXMaxPermSize<br /> 256m<br /> </span><span style="color: #000000">-</span><span style="color: #000000">vmargs<br /> </span><span style="color: #000000">-</span><span style="color: #000000">Xms128m<br /> </span><span style="color: #000000">-</span><span style="color: #000000">Xmx512m<br /> </span><span style="color: #000000">-</span><span style="color: #000000">Dosgi.splashLocation</span><span style="color: #000000">=</span><span style="color: #000000">D:\eclipse\MyEclipse </span><span style="color: #000000">6.0</span><span style="color: #000000">.1GA\eclipse\MyEclipseSplash.bmp<br /> </span><span style="color: #000000">-</span><span style="color: #000000">Duser.language</span><span style="color: #000000">=</span><span style="color: #000000">en <br /> </span><span style="color: #000000">-</span><span style="color: #000000">XX:PermSize</span><span style="color: #000000">=</span><span style="color: #000000">128M <br /> </span><span style="color: #000000">-</span><span style="color: #000000">XX:MaxPermSize</span><span style="color: #000000">=</span><span style="color: #000000">256M</span></div>            其实q个文g为空都没关系Q大象试q,全部删除Q没有错误,不过我还是徏议大安面至保留这些东?br /> <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: #000000">-</span><span style="color: #000000">vmargs<br /> </span><span style="color: #000000">-</span><span style="color: #000000">Xms256m<br /> </span><span style="color: #000000">-</span><span style="color: #000000">Xmx512m</span></div>            我将128Ҏ(gu)?56Q如果你惛_MyEclipse插g中用"MyEclipse 6.0.1"快捷方式来启动的话,可以写成q样<br /> <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: #000000">-</span><span style="color: #000000">vmargs<br /> </span><span style="color: #000000">-</span><span style="color: #000000">Xms256m<br /> </span><span style="color: #000000">-</span><span style="color: #000000">Xmx512m<br /> </span><span style="color: #000000">-</span><span style="color: #000000">Dosgi.splashLocation</span><span style="color: #000000">=</span><span style="color: #000000">D:\Eclipse</span><span style="color: #000000">-</span><span style="color: #000000">3.3</span><span style="color: #000000">.</span><span style="color: #000000">1</span><span style="color: #000000">\ThirdPlugins\MyEclipse </span><span style="color: #000000">6.0</span><span style="color: #000000">.1GA\eclipse\MyEclipseSplash.bmp</span></div> <p>           最下面一行是启动Ӟ昄MyEclipse的图片,如果没有q句话运?MyEclipse 6.0.1"快捷方式Q则?x)显Ceclipse的启动画面,其实"MyEclipse 6.0.1"快捷方式q是q接着eclipse.exeq个执行E序Q在"MyEclipse 6.0.1"上点右键Q选择属性,在目标里可以看到?br />     <span style="color: #0000ff"><strong>W?步:(x)注册MyEclipse<br /> </strong><span style="color: #000000">           MyEclipse6.0的注册一定要断开|络Q否则肯定不成功Q?br />            <span style="color: #ff0000">6.0.1GA注册?br />            Subscriber: administrator<br />            Subscription Code: nLR7ZL-655342-54657656405281154<br />            <span style="color: #000000">q里有一点大象要提醒大家注意Q如果你?sh)脑上现在正有用的MyEclipseQ就是说已经注册?jin),那么在C:\Documents and Settings\"自己的用户名" 目录下,?x)有一?.myeclipse.properties"文gQ这时请先备份此文gQ然后删除它Q断开|络Q再来注册MyEclipse6.0.1Q成功后如下Q?br /> <img height="410" alt="" hspace="2" src="http://www.aygfsteel.com/images/blogjava_net/bolo/eclipse/7.JPG" width="523" vspace="5" border="0" /><br /> <img height="277" alt="" hspace="2" src="http://www.aygfsteel.com/images/blogjava_net/bolo/eclipse/6.JPG" width="720" vspace="5" border="0" /></span></span></span></span></p>     <span style="color: #0000ff"><strong>W?步:(x)打包eclipse<br /> </strong><span style="color: #000000">           到现在所有的工作都已l完成,启动eclipse的速度快不快?好了(jin)Q该做最后一步操作了(jin)Q将"<font face="宋体" size="2">configuration"文g夹下的内定w"<font face="宋体" size="2">config.ini</font>"文g外全部删除,另外再把workspace文g夹删除,大象一般会(x)把workspace攑֜eclipse根目录下Q方法是在第一ơ启动选择路径时把前面的目录都删除Q只保留workspaceQ前面什么都不要保留Q。这h便管理,你要攑֜其它的地斚w便,q个看各人喜好。做完这两步之后Q最好还是在eclipse目录下徏一个txt文本文gQ把上面的注册码攑ֈ里面Q另外加上一句话:"<font face="宋体" size="2">注册时一定要断开|络,否则肯定注册不成?</font>"q样以后用时Q可以提醒自׃下。里面有注册码,要用时很方便?br />            在eclipse文g夹上点右键,选择"d到eclipse.rar"Q等到压~完成,xQ终于大功告成!<br />     大家管攑ֿ(j)按着我的Ҏ(gu)试,大象前前后后做了(jin)不下十遍Q今天又在公司的?sh)脑上做了(jin)一遍,囄都是刚刚截取的,嘿嘿Q今天老板不在Q大象小的放松一下,写写博客。有?jin)这个压~包Q以后大家在使用时就?x)方便很多,特别是保存到Ud盘里,惛_哪用在哪用。哇哈哈哈哈~~~~~~~~大家好q,都成功做出来Q?br /> </font></span></span></span></span></span></span></span></span></span></span></span></span></span></span> <img src ="http://www.aygfsteel.com/mlzry0612/aggbug/221216.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/mlzry0612/" target="_blank">Daniel</a> 2008-08-11 09:58 <a href="http://www.aygfsteel.com/mlzry0612/articles/221216.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JDT http://www.aygfsteel.com/mlzry0612/articles/214701.htmlDanielDanielMon, 14 Jul 2008 05:21:00 GMThttp://www.aygfsteel.com/mlzry0612/articles/214701.htmlhttp://www.aygfsteel.com/mlzry0612/comments/214701.htmlhttp://www.aygfsteel.com/mlzry0612/articles/214701.html#Feedback0http://www.aygfsteel.com/mlzry0612/comments/commentRss/214701.htmlhttp://www.aygfsteel.com/mlzry0612/services/trackbacks/214701.htmlJDT实际上是Java代码构徏成一个基于DOMl构的抽象语法树(wi)ASTQAbstract Syntax Tree Q。代码中的每个部分都对应一个ASTNodeQ许多的ASTNode构成了(jin)q个抽象的语法树(wi)。Java Class一般对应Compilation Unit nodeQ该节点也是AST?wi)上的顶炏V创Z个AST如下Q?

java 代码
  1. ASTParser parser = ASTParser.newParser(AST.JLS3);   
  2. parser.setSource("".toCharArray());   
  3. CompilationUnit unit = (CompilationUnit) parser.createAST(null);    
  4. unit.recordModifications();   
  5. AST ast = unit.getAST();   

其中createASTQ当parse需要较长时间时Q可以采用createAST(new NullProgressMonitor())Q否则直接传null卛_?/font>

recordModifications()用于记录节点的变动,比如修改、删除等Q当需要对AST?wi)进行变动操作时Q必要预先调用q个Ҏ(gu)?/font>


比较重要的是Q一个AST?wi)上的所有节点必都属于该AST。不允许直接其他AST?wi)上的节?gu)加该AST?wi)上。否则会(x)抛出java.lang.IllegalArgumentException异常。须使用ASTNode.copySubtree(AST target, ASTNode node)q回一个目标树(wi)的深度拷贝,才能q行d操作。例?

java 代码
  1. ASTParser parser = ASTParser.newParser(AST.JLS3);   
  2. parser.setSource("".toCharArray());   
  3. CompilationUnit targetRoot= (CompilationUnit) parser.createAST(null);    
  4. targetRoot.recordModifications();   
  5. parser.setSource("class T{}”".toCharArray());   
  6. CompilationUnit srcRoot= (CompilationUnit) parser.createAST(null);    
  7.   
  8. //q是非法操作Q两者的AST源不一?  
  9. targetRoot.types().add(srcRoot.types().get(0));   
  10.   
  11. //q是合法操作   
  12. targetRoot.types().add(ASTNode.copySubtree(   
  13. targetRoot.getAST(), (ASTNode) srcRoot.types().get(0)));   
  14.   
  15. //q是合法操作   
  16. targetRoot.types().add(targetRoot.getAST().newTypeDeclaration());  


 

现把一?Java代码生成对应的ASTNode方式列出来,供参考:(x)

List 1 生成Package
// package astexplorer;
java 代码
 
  1. PackageDeclaration packageDeclaration = ast.newPackageDeclaration();  
  2. unit.setPackage(packageDeclaration);  
  3. packageDeclaration.setName(ast.newSimpleName("astexplorer")); 
List 2 生成Import
// import org.eclipse.swt.SWT;
// import org.eclipse.swt.events.*;
// import org.eclipse.swt.graphics.*;
// import org.eclipse.swt.layout.*;
// import org.eclipse.swt.widgets.*;
java 代码
 
  1. for (int i = 0; i < IMPORTS.length; ++i) {  
  2. ImportDeclaration importDeclaration = ast.newImportDeclaration();  
  3. importDeclaration.setName(ast.newName(getSimpleNames(IMPORTS[i])));  
  4. if (IMPORTS[i].indexOf("*") > 0)  
  5. importDeclaration.setOnDemand(true);  
  6. else  
  7. importDeclaration.setOnDemand(false);  
  8.   
  9. unit.imports().add(importDeclaration);  
  10. }  
List 3 生成Class Declaration
// public class SampleComposite extends Composite 
java 代码
 
  1. TypeDeclaration classType = ast.newTypeDeclaration();  
  2. classType.setInterface(false);  
  3. classType.setModifiers(Modifier.PUBLIC);  
  4. classType.setName(ast.newSimpleName("SampleComposite"));  
  5. classType.setSuperclass(ast.newSimpleName("Composite"));  
  6. unit.types().add(classType);  


List 4 生成Constructor Declaration

// public SampleComposite(Composite parent,int style){}
java 代码
 
  1. MethodDeclaration methodConstructor = ast.newMethodDeclaration();  
  2. methodConstructor.setConstructor(true);  
  3. methodConstructor.setModifiers(Modifier.PUBLIC);  
  4. methodConstructor.setName(ast.newSimpleName("SampleComposite"));  
  5. classType.bodyDeclarations().add(methodConstructor);  
  6.   
  7. // constructor parameters  
  8.   
  9. SingleVariableDeclaration variableDeclaration = ast.newSingleVariableDeclaration();  
  10. variableDeclaration.setModifiers(Modifier.NONE);  
  11. variableDeclaration.setType(ast.newSimpleType(ast.newSimpleName("Composite")));  
  12. variableDeclaration.setName(ast.newSimpleName("parent"));  
  13. methodConstructor.parameters().add(variableDeclaration);  
  14.   
  15. variableDeclaration = ast.newSingleVariableDeclaration();  
  16. variableDeclaration.setModifiers(Modifier.NONE);  
  17. variableDeclaration.setType(ast.newPrimitiveType(PrimitiveType.INT));  
  18. variableDeclaration.setName(ast.newSimpleName("style"));  
  19. methodConstructor.parameters().add(variableDeclaration);  
  20. Block constructorBlock = ast.newBlock();  
  21. methodConstructor.setBody(constructorBlock);
 List 5 生成Spuer Invocation

// super(parent,style)
java 代码
 
  1. SuperConstructorInvocation superConstructorInvocation = ast.newSuperConstructorInvocation();  
  2. constructorBlock.statements().add(superConstructorInvocation);  
  3. Expression exp = ast.newSimpleName("parent");  
  4. superConstructorInvocation.arguments().add(exp);  
  5. superConstructorInvocation.arguments().add(ast.newSimpleName("style"));  

List 6 生成ClassInstanceCreation

// GridLayout gridLayout = new GridLayout();
java 代码
 
  1. VariableDeclarationFragment vdf = ast.newVariableDeclarationFragment();  
  2. vdf.setName(ast.newSimpleName("gridLayout"));  
  3. ClassInstanceCreation cc = ast.newClassInstanceCreation();  
  4. cc.setName(ast.newSimpleName("GridLayout"));  
  5. vdf.setInitializer(cc);  
  6. VariableDeclarationStatement vds = ast.newVariableDeclarationStatement(vdf);  
  7. vds.setType(ast.newSimpleType(ast.newSimpleName("GridLayout"))); 
  8. constructBlock.statements().add(vds);

// Label label = new Label(this,SWT.NONE);
java 代码
 
  1. VariableDeclarationFragment vdf = ast.newVariableDeclarationFragment();  
  2. vdf.setName(ast.newSimpleName("label"));  
  3. cc = ast.newClassInstanceCreation();  
  4. cc.setName(ast.newSimpleName("Label"));  
  5. cc.arguments().add(ast.newThisExpression());  
  6. cc.arguments().add(ast.newName(getSimpleNames("SWT.NONE")));  
  7. vdf.setInitializer(cc); 
  8. VariableDeclarationStatement vds = ast.newVariableDeclarationStatement(vdf);  
  9. vds.setType(ast.newSimpleType(ast.newSimpleName("Label")));
  10. constructBlock.statements().add(vds);

List 7生成MethodInvocation

// setLayout(gridLayout);
java 代码
 
  1. MethodInvocation mi = ast.newMethodInvocation();  
  2. mi.setName(ast.newSimpleName("setLayout"));  
  3. mi.arguments().add(ast.newSimpleName("gridLayout")); 
  4. constructorBlock.statements().add(ast.newExpressionStatement(mi));
// label.setText("Press the button to close:");
         java 代码
  1. mi = ast.newMethodInvocation();   
  2. mi.setExpression(ast.newSimpleName("label"));   
  3. mi.setName(ast.newSimpleName("setText"));   
  4. StringLiteral sl = ast.newStringLiteral();   
  5. sl.setLiteralValue("Press the button to close:");   
  6. mi.arguments().add(sl);   
  7. constructorBlock.statements().add(ast.newExpressionStatement(mi));  
// label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
           java 代码
  1. mi = ast.newMethodInvocation();   
  2. mi.setExpression(ast.newSimpleName("label"));   
  3. mi.setName(ast.newSimpleName("setLayoutData"));   
  4.   
  5. cc = ast.newClassInstanceCreation();   
  6. cc.setName(ast.newSimpleName("GridData"));   
  7. cc.arguments().add(ast.newName(getSimpleNames("GridData.HORIZONTAL_ALIGN_CENTER")));   
  8. mi.arguments().add(cc);   
  9. constructorBlock.statements().add(ast.newExpressionStatement(mi));  

 // Button button = new Button(this,SWT.PUSH);

java 代码
  1. vdf = ast.newVariableDeclarationFragment();   
  2. vdf.setName(ast.newSimpleName("button"));   
  3. vds = ast.newVariableDeclarationStatement(vdf);   
  4. vds.setType(ast.newSimpleType(ast.newSimpleName("Button")));   
  5. constructorBlock.statements().add(vds);   
  6.   
  7. cc = ast.newClassInstanceCreation();   
  8. cc.setName(ast.newSimpleName("Button"));   
  9. vdf.setInitializer(cc);   
  10. cc.arguments().add(ast.newThisExpression());   
  11. cc.arguments().add(ast.newName(getSimpleNames("SWT.PUSH")));  

// button.addSelectionListener(new SelectionAdapter() {});

    java 代码

  1. mi = ast.newMethodInvocation();   
  2. constructorBlock.statements().add(ast.newExpressionStatement(mi));   
  3. mi.setExpression(ast.newSimpleName("button"));   
  4. mi.setName(ast.newSimpleName("addSelectionListener"));   
  5.   
  6. ClassInstanceCreation ci = ast.newClassInstanceCreation();   
  7. ci.setName(ast.newSimpleName("SelectionAdapter"));   
  8. mi.arguments().add(ci);   
  9. AnonymousClassDeclaration cd = ast.newAnonymousClassDeclaration();   
  10. ci.setAnonymousClassDeclaration(cd); 






















// public void setup(){super.setUp()}
      1. MethodDeclaration methodConstructor = ast.newMethodDeclaration();
                methodConstructor.modifiers().add(
                        ast.newModifier(ModifierKeyword.PUBLIC_KEYWORD));
                methodConstructor.setName(ast.newSimpleName("setUp"));
  1.         Block constructorBlock = ast.newBlock();
            methodConstructor.setBody(constructorBlock);
  2.         SuperMethodInvocation smi = ast.newSuperMethodInvocation();
            smi.setName(ast.newSimpleName("setUp"));
            ExpressionStatement es = ast.newExpressionStatement(smi);
            constructorBlock.statements().add(es);
  3.         // set exception
            List targetExNames = methodConstructor.thrownExceptions();
            Name targetExName = ast.newName(Exception.class.getName());
            targetExNames.add(targetExName);
  4.         methodConstructor.setJavadoc(JavaDocHelper.getJavaDoc(ast,
                    JavaDocHelper.setUpDoc, null, null));
            classType.bodyDeclarations().add(methodConstructor);


Daniel 2008-07-14 13:21 发表评论
]]>
Eclipse Plugin Develop , Open preference viewhttp://www.aygfsteel.com/mlzry0612/articles/202339.htmlDanielDanielFri, 23 May 2008 02:52:00 GMThttp://www.aygfsteel.com/mlzry0612/articles/202339.htmlhttp://www.aygfsteel.com/mlzry0612/comments/202339.htmlhttp://www.aygfsteel.com/mlzry0612/articles/202339.html#Feedback0http://www.aygfsteel.com/mlzry0612/comments/commentRss/202339.htmlhttp://www.aygfsteel.com/mlzry0612/services/trackbacks/202339.html曄很蠢的自己去写了(jin)一个Dialogd装preference View.
代码如下 在TS1Ҏ(gu)?

package com.wipro.testtools.ui.internal.action;

import java.util.Iterator;

import org.eclipse.ui.IPerspectiveDescriptor;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
import org.eclipse.ui.WorkbenchException;
import org.eclipse.ui.internal.OpenPreferencesAction;
import org.eclipse.ui.internal.Workbench;
import org.eclipse.ui.internal.WorkbenchPlugin;
import org.eclipse.ui.internal.actions.OpenPerspectiveDialogAction;
import org.eclipse.ui.internal.dialogs.SelectPerspectiveDialog;
import org.eclipse.ui.dialogs.PreferencesUtil;
import org.eclipse.ui.help.WorkbenchHelp;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.window.Window;
import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.jface.preference.IPreferenceNode;
import org.eclipse.jface.preference.PreferenceManager;
import org.eclipse.jface.preference.IPreferencePage;
import org.eclipse.jface.preference.PreferenceDialog;
import org.eclipse.swt.widgets.Shell;

public class OpenPreferencePages implements IWorkbenchWindowActionDelegate {
    public OpenPreferencePages() {
        super();
    }

    private IWorkbenchWindow workbenchWindow;

    public void dispose() {
    }

    public void init(IWorkbenchWindow window) {
        workbenchWindow = window;
    }

    public void run(IAction action) {

        ts2();
    }

    private void ts2() {
        // OpenPreferencesAction action = new OpenPreferencesAction();
        // OpenPerspectiveDialogAction action = new
        // OpenPerspectiveDialogAction(null);
        // action.run();
        String ourPreferenceDialog = "com.wipro.testtools.ui.preferences.SamplePreferencePage";
        PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(null, ourPreferenceDialog, new String[]{ourPreferenceDialog}, null);
       
        dialog.open();

    }

    /**
     *
     */
    private void ts1() {
        String PreferenceNodeId = "org.eclipse.ui.preferencePages.Workbench";
        PreferenceDialogWrapper dialog = null;
        PreferenceManager manager = WorkbenchPlugin.getDefault()
                .getPreferenceManager();
        if (manager != null) {
            dialog = new PreferenceDialogWrapper(getShell(), manager);
            dialog.create();
            // WorkbenchHelp.setHelp(dialog.getShell(),
            // IHelpContextIds.PREFERENCE_DIALOG);

            for (Iterator iterator = manager.getElements(
                    PreferenceManager.PRE_ORDER).iterator(); iterator.hasNext();) {
                IPreferenceNode node = (IPreferenceNode) iterator.next();
                System.out.println(node.getId());
                if (node.getId().equals(PreferenceNodeId)) {
                    dialog.showPage(node);
                }
            }
            dialog.open();
        }
    }

    public void selectionChanged(IAction action, ISelection selection) {
    }

    private Shell getShell() {
        return DialogCheck.getShell();
    }

}

class PreferenceDialogWrapper extends PreferenceDialog {
    public PreferenceDialogWrapper(Shell parentShell, PreferenceManager manager) {
        super(parentShell, manager);
        super.setSelectedNodePreference("PreferenceNodeId");// this is added
    }

    public boolean showPage(IPreferenceNode node) {
        return super.showPage(node);
    }

    public IPreferencePage getPage(IPreferenceNode node) {
        if (node == null)
            return null;

        if (node.getPage() == null)
            node.createPage();

        if (node.getPage() == null)
            return null;

        return node.getPage();
    }
}

class DialogCheck {
    private DialogCheck() {
    }

    private static VerifyDialog _verifyDialog;

    public static Shell getShell() {
        Shell shell = WorkbenchPlugin.getDefault().getWorkbench()
                .getActiveWorkbenchWindow().getShell();
        _verifyDialog = new VerifyDialog(shell);
        _verifyDialog.create();
        return _verifyDialog.getShell();
    }

}

class VerifyDialog extends TitleAreaDialog {
    public VerifyDialog(Shell parent) {
        super(parent);
    }
}


其实eclipse提供?jin)这L(fng)API: See the TS2 Method:
Just two line codes. :(



Daniel 2008-05-23 10:52 发表评论
]]>
推荐几个Eclipse常用l典插g http://www.aygfsteel.com/mlzry0612/articles/45286.htmlDanielDanielTue, 09 May 2006 13:47:00 GMThttp://www.aygfsteel.com/mlzry0612/articles/45286.htmlhttp://www.aygfsteel.com/mlzry0612/comments/45286.htmlhttp://www.aygfsteel.com/mlzry0612/articles/45286.html#Feedback0http://www.aygfsteel.com/mlzry0612/comments/commentRss/45286.htmlhttp://www.aygfsteel.com/mlzry0612/services/trackbacks/45286.html

CSS插gQ?a >http://csseditor.sourceforge.net

JS和AS插gQ?a >http://sourceforge.net/projects/jseditor

XML插gQ?a >http://xmlbuddy.com

正则表达式测试插Ӟ(x)http://brosinski.com/stephan/archives/000028.php

XPath试插gQ?a >http://www.purpletech.com/xpe/index.jsp

更多Eclipse插gQ?a >http://eclipse-plugins.2y.net/eclipse/index.jsp



Daniel 2006-05-09 21:47 发表评论
]]>
Eclipse的FindBugs插g http://www.aygfsteel.com/mlzry0612/articles/44930.htmlDanielDanielSun, 07 May 2006 15:53:00 GMThttp://www.aygfsteel.com/mlzry0612/articles/44930.htmlhttp://www.aygfsteel.com/mlzry0612/comments/44930.htmlhttp://www.aygfsteel.com/mlzry0612/articles/44930.html#Feedback0http://www.aygfsteel.com/mlzry0612/comments/commentRss/44930.htmlhttp://www.aygfsteel.com/mlzry0612/services/trackbacks/44930.html Eclipse的FindBugs插g

问题提出Q?

当我们编写完代码Q做完单元测试等各种试后就提交正式q行Q只能由q行的系l来(g)我们代码是否有问题?jin),代码中隐藏的错误在系l运行的q程中被发现后,然后再来q行相应的修改,那么后期修改的代价就相当高了(jin)?/p>

解决Ҏ(gu)Q?/b>

现在有很多Java代码分析工具QFindBugs中开源项目当中的一个,它可以帮你找C码中隐藏的一些错误,提升你的代码能力与系l安全可靠性?/p>

安装

JDKQ?.5.0 从http://java.sun.com上去下蝲安装

EclipseQ?.1.1 从http://www.eclipse.org 上去下蝲解压

FindBugsQ?.9.4 从http://findbugs.sourceforge.net/

官方的文?http://findbugs.sourceforge.net/manual/

Eclipse plugin for FindBugs version 0.0.17 ?http://findbugs.sourceforge.net/downloads.html 下蝲

插g理技?/b>

提示Q新下蝲的插件PlugIn一定不要都攑֜原始的Eclipse目录下去?/p>

  1. 前提是你已经安装好了(jin)Eclipse工具?jin),比如安装在E:\OpenSource\Eclipse\目录下,以下q个目录?ECLIPSE_HOME%来进行表C;
  2. 此时默认的插件是?ECLIPSE_HOME%\plugins目录中的Q?
  3. ?ECLIPSE_HOME%下徏立一个PlugInsNew的目录;

    比如QE:\OpenSource\Eclipse\PlugInsNew\

  4. 你下载了(jin)个新的插Ӟ比如叫做QXYZ

    那么在%ECLIPSE_HOME%\PlugInsNew\目录下徏立XYZ目录Q目录里面是eclipse目录Qeclipse目录包含有features与plugins两个子目录;l构如下图所C:(x)

  5. 把下载的新插件的文g攑֜以下相应目录?

    %ECLIPSE_HOME%\PlugInsNew\XYZ\eclipse\features

    %ECLIPSE_HOME%\PlugInsNew\ XYZ\eclipse\plugins

  6. 建立相关?link的文?

    然后?ECLIPSE_HOME%\links目录里徏立一个XYZ.link的文?

    内容如是Qpath=E:/OpenSource/Eclipse/PlugInsNew/XYZ׃行这L(fng)路径指示而已?

    当然Q采用相对\径来表示可能更直观一些,方便q行文g整体Ud和小l全部成员的׃n命名用,省得Ud后要改动Link文g里的l对路径而费?j)费力。直接拷贝过d可以使用?

    即XYZ.link文g的内容如是:(x)path=../PlugInsNew/XYZ

    q样Q如果你下蝲?jin)多个插件就可以如法炮制建立多个Link文gQ想加蝲哪个插g把哪个插g的Link文g攑ֈ%ECLIPSE_HOME%\links的目录中卛_Q用与理都很方便Q徏议千万不要放在默认的安装目录中;

    如果你的%ECLIPSE_HOME%与此不同Q请修改XYZ.link文g里的路径

  7. 删除Q关闭Eclipse

    删除%ECLIPSE_HOME%\links\XYZ.link文g卛_

    删除%ECLIPSE_HOME%\PlugInsNew\XYZ整个目录?qing)文?/p>

  8. 重新启动Eclipse卛_

使用

重新启动Eclipse后,在Help => About Eclipse SDK => Plug-in Details你可以看到由“FindBugs Project”提供的“FindBugs Plug-in”版?.0.17插gQ如下图所C:(x)

FindBugs的用方?/b>

FindBugs是一个可以在JavaE序中发现Bugs的程序?

它是专门用来L处于“Bug Patterns”列表中的代码的?

Bug Patterns指很有可能是错误的代码的实例?/p>

目前FindBugs最高版?.9.4Q不q更新速度很快的,你应当经怸ȝ看是否有新版本发布。Eclipse plugin for FindBugs最高版?.0.17?/p>

pȝ要求

使用FindBugs臛_需要JDK1.4.0以上版本QFindBugs是^台独立的Q可以运行于GNU/Linux、Windows、MacOS X{^C?/p>

q行FindBugs臛_需要有256 MB内存Q如果你要分析一个很大的目Q那需要更加多的内存了(jin)?/p>

FindBugs独立q行和与Antl合的详l操作就不介l了(jin)Q可以看官方的文档http://findbugs.sourceforge.net/manual/

独立q行的效果图如下Q?/p>

打开Bug Details视图

Windows => Show View => Other?=> FindBugs => BugDetails

在Package Explorer或Navigator视图中,选中你的Java目Q右键,可以看到“Find Bugs”菜单项Q子菜单w有“Find Bugs”和“Clear Bug Markers”两内容,如下图所C:(x)

我们建立一个简单的试文gTest.java 内容如下Q?

public class Test { private String[] name; public String[] getName() { return name; } public void setName(String[] name) { this.name = name; } }

我们点中“Find Bugs”,q行时会(x)出现如下q度框:(x)

q行l束后可以在Problems中看到增加了(jin)如下的警告信息内?/p>

FindBugsq行后的警告信息内容不仅在Problems视图中显C,而且标记在源代码标记框中,在源代码~辑器中我们可以看到警告标识Q如下图Q?

当光标指向你的警告信息的代码上面Ӟ׃(x)有相应的错误提示信息Q与Eclipse本n的错误或警告信息提示cM?

选中Problems视图里出现的相应问题Q就?x)在代码~辑器里切换到相应的代码上去Q方便根据相应的提示信息q行代码的修攏V?

在Problems视图里,选中相应的问题条目,右键Q在弹出的菜单中Q可以看到“Show Bug Details”,如下图所C:(x)

点中它,?x)切换到Bug Details视图上去Q显C更加详l的提示信息?/p>

当然Q在代码~辑H口中,点击带有警告提示信息的图标时Q也?x)自动切换到Bud DetailsH口去,查看详细的警告信息,如下图所C?/p>

Ҏ(gu)q里详细的信息,你可以得到FindBugsZ么会(x)对你的代码报警告信息Q及(qing)相应的处理办法,Ҏ(gu)它的提示Q你可以快速方便地q行代码修改?/p>

Ҏ(gu)提示Q我们将代码修改成如下,再运行就不会(x)报有警告信息?jin)?/p>

public class Test { private String[] name; public String[] getName() { String[] temp = name; return temp; } public void setName(String[] name) { String[] temp = name; this.name = temp; } } 配置FindBugs

选择你的目Q右?=> Properties => FindBugs =>

可以配置的信息包括如上图所C的四个选项的相兌|:(x)

  1. Run FindBugs Automatically开?/strong>

    当此w中后,FindBugs会(x)在你修改JavacL自动q行Q如你设|了(jin)Eclipse自动~译开兛_Q当你修改完Java文g保存QFindBugs׃(x)q行Qƈ相应的信息昄出来?

    当此Ҏ(gu)有选中Q你只能每次在需要的时候自己去q行FindBugs来检查你的代码?

  2. Minimum priority to report选择?/strong>

    q个选择Ҏ(gu)让你选择哪个U别的信息进行显C,有Low、Medium、High三个选择可以选择Q很cM于Log4J的别设|啦?比如Q?

    你选择?jin)High选择,那么只有是HighU别的提CZ息才?x)被昄?

    你选择?jin)Medium选择,那么只有是Medium和HighU别的提CZ息才?x)被昄?

    你选择?jin)Low选择,那么所有别的提示信息都会(x)被显C?/p>

  3. Enable bug categories选择?/strong>

    在这里是一些显CBug分类的选择Q?

    Correctness关于代码正确性相x面的

    Performance关于代码性能相关斚w?

    Internationalization关于代码国际化相x面的

    Multithreaded correctness关于代码多线E正性相x面的

    Style关于代码样式相关斚w?/p>

    Malicious code vulnerability关于恶意破坏代码相关斚w?

    比如Q如果你把Style的检查框L不选择中它Q那么与Style分类相关的警告信息就不会(x)昄?jin)。其它的cM?/p>

  4. Select bug patterns to check for选择?/strong>

    在这里你可以选择所要进行检查的相关的Bug Pattern条目

    可以从Bug codes、Detector name、Detector description中看到相应的是要(g)查哪些方面的内容Q你可以Ҏ(gu)需要选择或去掉相应的 (g)查条件?

ȝ

此插件的功能很不错,可以帮助我们提升Java代码的编写能力,写出更加安全可靠的代码。徏议用或加在Ant里进行持l构建。现在,你可以马上拿Z已经开发的一个项目,(g)查一下你的代码有没有问题?jin)?/p>

Daniel 2006-05-07 23:53 发表评论
]]>
վ֩ģ壺 տ| ̨| | | ػʵ| ֶ| ̳| ˻| | | | | | Ĵʡ| | ѽ| | | | ۷| ƽ| | | | | | | | ԭ| | | | | | ˮ| | Զ| | | | |