2016-09-06 47 views
2

如何在eclipse幫助窗口中以編程方式在Linux(Ubuntu 14.04)上運行打開特定的幫助主題?例如:以編程方式在eclipse幫助窗口中打開特定幫助主題?

例如:我想打開「任務視圖」幫助,如下圖所示,以編程方式顯示。

enter image description here 我試圖與:

PlatformUI.getWorkbench()getHelpSystem().displayHelpResource( 「/ org.eclipse.platform.doc.user /概念/ ctskview.htm」);

但幫助主題是在外部瀏覽器(firefox)中打開而不是在eclipse幫助窗口中。

我如何在eclipse help widow中打開這個主題(在eclipse工作臺中點擊Help > Help contents菜單時打開的窗口)。

回答

1

根據您的打印屏幕,您正在使用Linux。內部窗口僅適用於Windows。

看一看代碼中DefaultHelpUI在非Windows平臺上,當顯示模式窗口使用外部):

private boolean useExternalBrowser(String url) { 
    // On non Windows platforms, use external when modal window is displayed 
    if (!Constants.OS_WIN32.equalsIgnoreCase(Platform.getOS())) { 
     Display display = Display.getCurrent(); 
     if (display != null) { 
      if (insideModalParent(display)) 
       return true; 
     } 
    } 

    // Use external when no help frames are to be displayed, otherwise no 
    // navigation buttons. 
    if (url != null) { 
     if (url.indexOf("?noframes=true") > 0 //$NON-NLS-1$ 
       || url.indexOf("&noframes=true") > 0) { //$NON-NLS-1$ 
      return true; 
     } 
    } 
    return false; 
} 
+0

是。我在Linux上(Ubuntu 14.04)。但在調用幫助主題時,幫助窗口未打開。代碼中的註釋*** //在非Windows平臺上,當顯示模式窗口時使用外部***說,在非Windows操作系統上的外部瀏覽器中打開幫助**如果顯示模式窗口**。有沒有什麼方法可以在Linux上的幫助窗口中打開幫助主題? –

+0

我猜'DefaultHelpUI.isDisplayModal()'大多會返回true,因爲活動shell可能是主應用程序窗口。 '(SWT.APPLICATION_MODAL | SWT.PRIMARY_MODAL | SWT.SYSTEM_MODAL)''。所以,不,你可能不能。 –

+0

至少如果你使用的是'DefaultHelpUI',也許你可以實現你自己的HelpUI,擴展'AbstractHelpUI'。 –