2013-08-02 29 views
0

我想添加一些高級功能來幫助基於Eclipse 3.7的Eclipse RCP應用程序中的瀏覽器。我創建了一個單獨的插件幫助功能和擴展org.eclipse.help.webapp.AbstractView:定製幫助選項卡中的Eclipse RCP錯誤

import java.util.Locale; 

import org.eclipse.help.webapp.AbstractView; 

public class CustomView extends AbstractView { 

    @Override 
    public String getImageURL() { 
     return ""; 
    } 

    @Override 
    public char getKey() { 
     return 0; 
    } 

    @Override 
    public String getName() { 
     return "Custom"; 
    } 

    @Override 
    public String getTitle(Locale arg0) { 
     return "Test Title"; 
    } 

    @Override 
    public String getURL() { 
     return "/"; 
    } 

    @Override 
    public String getBasicURL() { 
     return getURL(); 
    } 
} 

我已經添加指向這個類擴展org.eclipse.help.webapp.view

在同一個插件我有文件CustomView.jsp夾插件/幫助:

<html> 
<head> 
<title>View Test</title> 
</head> 

<body> 
<h1>Hellp JSP!</h1> 
</body> 
</html> 

此文件夾添加到build.properties文件。

另一個選項卡出現預期中的幫助內容的瀏覽畫面,但我得到的唯一的事情就是這個標籤的框架內404錯誤:

HTTP錯誤404 問題訪問/help/CustomView.jsp。原因:

/CustomView.jsp 

技術碼頭://

我在做什麼錯誤,以及如何獲得此選項卡的內容能正確顯示?

回答

0

我找到了失敗的原因。在解析幫助插件後,我發現了額外的擴展定義,允許Equinox使用插件項目中提供的幫助文件作爲可訪問的資源。這是我在plugin.xml中的擴展名部分:

<extension point="org.eclipse.help.webapp.view"> 
     <view class="plugin.CustomView"></view> 
</extension> 

<extension point="org.eclipse.equinox.http.registry.httpcontexts"> 
     <httpcontext id="help"> 
     <resource-mapping path="/"> </resource-mapping> 
     </httpcontext> 
</extension> 

<extension point="org.eclipse.equinox.http.registry.resources"> 
     <resource alias="/help" base-name="/help" httpcontextId="help"> </resource> 
</extension> 

第一個是實際的視圖定義類。接下來是指向插件根目錄的幫助上下文,最後一個是包含JSP文件的實際文件夾,它相對於插件的根和瀏覽器可用的別名的位置。在我的應用程序中添加這些信息中心後,在新選項卡中顯示我的測試HTML代碼。在幫助插件中的其他擴展點也是如此,以便在信息中心中添加新的基於JSP的視圖。

相關問題