2012-04-16 60 views
0

我想實現一個像使用eclipse rcp tech的eclipse控制檯這樣的應用程序。 我可以運行我的Java程序並在控制檯中顯示輸出的單一應用程序。在eclipse rcp開發中的控制檯視圖?

問題是我想實現像eclipse控制檯那樣的「終止」按鈕,在那裏我可以推送它並終止程序。我發現eclipse控制檯插件似乎不提供此功能。

回答

1

我想,你可以嘗試在plugin.xml來定義自己的命令,這將有助於一個按鈕,進入控制檯視圖:

<menuContribution allPopups="false"  locationURI="toolbar:ConsoleViewID"> 
<command commandId="your.plugin.id.terminatecommand" 
      icon="platform:/plugin/your.plugin.id/images/red_rectangle.png" 
      label="%Terminate" 
      style="push"> 
     </command> 
    </menuContribution> 

    <extension point="org.eclipse.ui.commands"> 
<command 
      defaultHandler="your.plugin.id.TerminateCommandHanler" 
      id="your.plugin.id.terminatecommand" 
      name="RefreshSelectedCommand"> 
     </command> 
</extension> 

,並在命令處理程序中,你可以做這樣的:

PlatformUI.getWorkbench().close(); 

或者

IWorkbenchConfigurer#emergencyClose(); 

希望它可以幫助

+1

+1 - 很好的答案! – msteiger 2012-06-27 08:55:47