【发布时间】:2015-11-18 14:52:32
【问题描述】:
我目前正在将一组 Eclipse RCP 应用程序从 3.6 迁移到 4.2。 我正在努力解决 RCP 透视图的问题,即视图高度不能降低到一定尺寸以下(看起来像窗口高度的 10%)。 该代码在 eclipse 3.x 中运行良好,用户可以通过拖动边框来降低视图高度。
但是,在 4.x 中,最顶部视图(按钮视图)的高度只能减小到某个值。 请问有人可以帮忙吗?
public class Perspective implements IPerspectiveFactory {
public static final String ID = "im.rcpTest2.fixedperspective";
public void createInitialLayout(IPageLayout layout) {
String editorArea = layout.getEditorArea();
layout.setEditorAreaVisible(false);
layout.addStandaloneView(ButtonView.ID, false, IPageLayout.TOP,
0.1f, editorArea);
layout.addStandaloneView(View.ID, false, IPageLayout.LEFT,
0.25f, editorArea);
IFolderLayout folder = layout.createFolder("messages", IPageLayout.TOP,
0.5f, editorArea);
folder.addPlaceholder(View2.ID + ":*");
folder.addView(View2.ID+":2");
folder.addView(View2.ID+":3");
layout.getViewLayout(ButtonView.ID).setCloseable(false);
layout.getViewLayout(View.ID).setCloseable(false);
}
}
public class ButtonView extends ViewPart {
public ButtonView() {
}
public static final String ID = "im.rcptest2.ButtonView"; //$NON-NLS-1$
private Text text;
/**
* Create contents of the view part.
* @param parent
*/
@Override
public void createPartControl(Composite parent) {
Composite container = new Composite(parent, SWT.NONE);
container.setBackground(SWTResourceManager.getColor(SWT.COLOR_GRAY));
container.setLayout(new GridLayout(2, false));
text = new Text(container, SWT.BORDER);
text.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
{
Button btnMybutton = new Button(container, SWT.NONE);
btnMybutton.setText("MyButton");
}
}
@Override
public void setFocus() {
// TODO Auto-generated method stub
}
}
【问题讨论】:
标签: eclipse migration rcp perspective e4