Posted on 2012-03-12 14:25
沙漠中的魚 閱讀(547)
評論(0) 編輯 收藏 所屬分類:
RCP開發
在RCP有時候需要將視圖放在一邊,分上下顯示,但是在RCP沒有RIGHT_TOP和RIGHT_BOTTOM這樣的方位設置,我們可以通過添加視圖的關聯ID設置相對位置。如下代碼addView方法,createFolder也相同
/**
* Adds a view with the given compound id to this page layout.
* See the {@link IPageLayout} type documentation for more details about compound ids.
* The primary id must name a view contributed to the workbench's view extension point
* (named <code>"org.eclipse.ui.views"</code>).
*
* @param viewId the compound view id
* @param relationship the position relative to the reference part;
* one of <code>TOP</code>, <code>BOTTOM</code>, <code>LEFT</code>,
* or <code>RIGHT</code>
* @param ratio a ratio specifying how to divide the space currently occupied by the reference part,
* in the range <code>0.05f</code> to <code>0.95f</code>.
* Values outside this range will be clipped to facilitate direct manipulation.
* For a vertical split, the part on top gets the specified ratio of the current space
* and the part on bottom gets the rest.
* Likewise, for a horizontal split, the part at left gets the specified ratio of the current space
* and the part at right gets the rest.
* @param refId the id of the reference part; either a view id, a folder id,
* or the special editor area id returned by <code>getEditorArea</code>
*/
public void addView(String viewId, int relationship, float ratio,
String refId);