2016-02-17 37 views
1

當前我正在將Eclipse RCP 3.7應用程序遷移到Eclipse 4.5應用程序。在第一步中,我已將目標平臺更新到Eclipse 4.5並檢查與舊版本應用程序的差異。Eclipse 4.x中的Eclipse 3.x trimbar

在新版本中的狀態欄的高度似乎收縮: enter image description here

在舊版本中,它看起來是這樣的: enter image description here

我試圖從menuContributions改變(locationURI:toolbar:org.eclipse.ui.trim.status)在plugin.xml中ModelFragment-> TrimContribution->工具欄 - >工具控制fragment.e4xmi

我是否需要更改主CSS以調整工具欄的高度?我需要使用哪個選擇器?

+1

我有同樣的問題,並打開這個錯誤[狀態欄貢獻被切斷](https://bugs.eclipse.org/bugs/show_bug.cgi?id=466609)。請參閱最後的評論以瞭解可能的解決方法。 –

+0

對不起,我最初的回答是錯誤的。 TrimContribution是可以的。 –

回答

0

感謝Rüdigers提示我已經想通了,如何添加ContributionItems而不顯示截斷。

首先我創建了一個處理程序:

public class TrimWidget extends AbstractHandler 
{ 
    @Override 
    public Object execute(ExecutionEvent event) throws ExecutionException 
    { 
     return null; 
    } 
} 

,並在plugin.xml把它註冊爲命令:

<command 
    defaultHandler="com.example.TrimWidget" 
    id="com.example.trimWidget" 
    name="-"> 
</command> 

最後,我添加了命令到每個ToolbarItem:

<toolbar id="com.example.statusBarItem"> 
    <control 
     class="com.example.MyStatusBarContribution" 
     id="MyStatusBarContribution"> 
    </control> 
    <command 
     commandId="com.example.trimWidget" 
     icon="icons/toolbar-command.png"> 
    </command> 
</toolbar> 

結果看起來不像Eclipse 3的版本,但它是可以接受的。項目在狀態欄中左對齊,不能通過拖放進行移動。