Posted on 2012-03-12 14:25
沙漠中的鱼 阅读(538)
评论(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);