<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    terrine

    改造easyexplore插件

    easyexplore是一個eclipse的小插件,它能直接打開選中文件所在的目錄,雖然只有幾K的體積,卻給我們帶來了很大的方便。不過為了追求更高的易用性,我在dev2dev的一篇文章的基礎(chǔ)上(這篇文章似乎漏掉了一些改動,而且易用性還是不夠高:),對它進行了一點小小的改進,改進后的功能(僅適用于windows)是:

    1.如果選中的是目錄,則在資源管理器中打開這個目錄(而不是在它的上級選中該目錄);2.如果選中的是文件,則資源管理器中打開所在的文件夾并選中這個文件;另外,順便把新的xp風格圖標給拿了過來。

    easyexplore的cvs地址是anonymous@easystruts.cvs.sourceforge.net:/cvsroot/easystruts,下載源碼之后發(fā)現(xiàn)easyexplore已經(jīng)悄悄的更新了,多了“執(zhí)行外部命令”等功能,圖標也改成xp風格,不過多了一層子菜單,感覺不如原來方便,而且我只對explore這個功能感興趣,所以只取回org/sf/easyexplore/EasyExplorePlugin.java,org/sf/easyexplore/actions/EasyExploreAction.java和org/sf/easyexplore/preferences/EasyExplorePreferencePage.java三個文件的1.1版本進行修改。代碼是相當?shù)暮唵危?br>
    在EasyExplorePlugin.java中改變defaultTagert的值:
    protected void initializeDefaultPreferences(IPreferenceStore store) {
            String defaultTarget 
    = "shell_open_command {0}";
            String osName 
    = System.getProperty("os.name");
            
    if ( osName.indexOf("Windows"!= -1 ) {
                defaultTarget 
    = "explorer.exe /e,";
            }
            
    else if ( osName.indexOf("Mac"!= -1 ) {
                defaultTarget 
    = "open";            
            }
            
            store.setDefault(EasyExplorePreferencePage.P_TARGET, defaultTarget);
        }
    在EasyExploreAction.java中增加一個判斷條件,如果選中的文件那么在資源管理器中也選中之:
    public void run(IAction action) {
            
    try {
                
    if ( "unknown".equals(selected) ) {
                    MessageDialog.openInformation(
    new Shell(),"Easy Explore","Unable to explore " + selectedClass.getName());
                    EasyExplorePlugin.log(
    "Unable to explore " + selectedClass);
                    
    return;
                }
                File directory 
    = null;
                
    if ( selected instanceof IResource ) {
                    directory
    = new File(((IResource)selected).getLocation().toOSString());
                } 
    else if ( selected instanceof File ) {
                    directory
    = (File) selected;
                } 

                String target 
    = EasyExplorePlugin.getDefault().getTarget();
                
                
    if (!EasyExplorePlugin.getDefault().isSupported()) {
                    MessageDialog.openInformation(
    new Shell(),"Easy Explore",
                        
    "This platform (" + 
                        System.getProperty(
    "os.name"+ 
                        
    ") is currently unsupported.\n" + 
                        
    "You can try to provide the correct command to execute in the Preference dialog.\n" +
                        
    "If you succeed, please be kind to post your discovery on EasyExplore website http://sourceforge.net/projects/easystruts,\n" +
                        
    "or by email farialima@users.sourceforge.net. Thanks !");
                    
    return;
                }

                
    if(directory.isFile() 
                    
    && System.getProperty("os.name").indexOf("Windows"!= -1 ) {
                    target 
    = target.trim() + "/select,";
                }
                
    if ( target.indexOf("{0}"== -1 ) {
                    target 
    = target.trim() + " {0}";
                }    
                
                target 
    = MessageFormat.format(target, new String[]{directory.toString()});
                
                
    try { 
                    EasyExplorePlugin.log(
    "running: "+target);
                    Runtime.getRuntime().exec(target);
                } 
    catch ( Throwable t ) {
                    MessageDialog.openInformation(
    new Shell(),"Easy Explore","Unable to execute " +target);
                    EasyExplorePlugin.log(t);
                }
            } 
    catch (Throwable e) {
                EasyExplorePlugin.log(e);
            }
        }
    重新編譯打包之后,替換掉org.sf.easyexplore_1.0.4.jar中的easyexplore.jar和圖標,搞定收工。
    放了一個自己修改過的jar上來,歡迎大家從這里下載。

    另外推薦一個好用的bookmark插件quickmarks,可以通過Ctrl,Alt和數(shù)字鍵非常快捷的創(chuàng)建和跳回書簽,類似于JBuilder和IDEA的功能,比eclipse自帶的bookmark強太多了。項目地址是http://eclipse-tools.sourceforge.net/quickmarks

    posted on 2007-06-02 22:54 Jay 閱讀(3205) 評論(5)  編輯  收藏

    評論

    # re: 改造easyexplore插件 2007-06-03 09:58 CowNew開源團隊

    把這個修改提交給他們呀,這樣所有的人都能使用這個增強的功能了。:)。  回復(fù)  更多評論   

    # re: 改造easyexplore插件 2007-06-04 09:29 Welkin Hu

    我用的是從sf下載的jar包。是只有一個Easy Explorer菜單的版本。樓主所說的增強特性,在這個版本中已經(jīng)是這樣了。  回復(fù)  更多評論   

    # re: 改造easyexplore插件 2007-06-04 16:20 hcqenjoy

    Welkin Hu 我下載的怎么不是你說的版本?? 能提供下你的版本嗎  回復(fù)  更多評論   

    # re: 改造easyexplore插件 2007-06-04 21:07 Jay

    @Welkin Hu
    可以提供一個下載的鏈接嗎,我下載的是1.0.4版本的 都沒有這個功能  回復(fù)  更多評論   

    # re: 改造easyexplore插件[未登錄] 2008-12-29 11:43 Dennis

    不錯的enhancement,本來我也想改,給你搶先了,hoho  回復(fù)  更多評論   


    只有注冊用戶登錄后才能發(fā)表評論。


    網(wǎng)站導(dǎo)航:
     
    主站蜘蛛池模板: 亚洲AV成人片无码网站| 日本高清色本免费现在观看| 色屁屁www影院免费观看视频| 久久久亚洲欧洲日产国码二区| 一级毛片直播亚洲| 成年女人看片免费视频播放器| 亚洲欧洲免费视频| 中文在线观看永久免费| 青青久久精品国产免费看| 亚洲精品理论电影在线观看| 亚洲激情黄色小说| 亚洲国产成人久久综合一| 成人午夜亚洲精品无码网站| 亚洲精品人成无码中文毛片| 国产乱弄免费视频| 成年女人免费视频播放体验区| 99re免费在线视频| 午夜精品免费在线观看| 久久九九全国免费| 你是我的城池营垒免费看| 一区二区在线视频免费观看| 粉色视频成年免费人15次| 99亚洲乱人伦aⅴ精品| 亚洲av无码专区在线观看亚| 亚洲日韩一区二区三区| 国产亚洲玖玖玖在线观看| 亚洲一区免费视频| 亚洲精品国产精品国自产网站 | 亚洲精品无码不卡在线播放| 国产成人精品日本亚洲专一区| 亚洲日韩乱码久久久久久| 78成人精品电影在线播放日韩精品电影一区亚洲 | 亚洲一区免费在线观看| 99在线免费观看视频| 8x成人永久免费视频| 久久久久久国产精品免费无码 | 亚洲乱亚洲乱淫久久| 久久精品国产亚洲AV无码娇色| 久久亚洲精品无码VA大香大香| 久久久久亚洲AV片无码下载蜜桃| 亚洲精品永久www忘忧草|