How to set static width to view in SWT

北城余情 提交于 2019-12-11 10:09:14

问题


how can be configured static width of view in perspective?

I'd like have on left side TreeViewer with static width and second view (ViewPart) want to expand horizontaly. I have this, witch used ratio, that i don't want:

public class PerspectivaEkomaj implements IPerspectiveFactory {

    @Override
    public void createInitialLayout( IPageLayout layout ) {

        String editorArea = layout.getEditorArea();
        layout.setEditorAreaVisible( false );
        layout.addView( EkomajTreeView.RCP_ID, IPageLayout.LEFT, 0.25f, editorArea );
        layout.getViewLayout( EkomajTreeView.RCP_ID ).setCloseable( false );

        layout.addStandaloneView( MajetekView.RCP_ID, false, IPageLayout.TOP, 0.75f, editorArea );
        layout.addStandaloneViewPlaceholder( MajetekDMView.RCP_ID, IPageLayout.TOP, 0.75f, editorArea, false );
...

Pls let me know if exist some work around or similar class (compatible with SWT) that allow it.


回答1:


If you want to control the size of a specific workbench part (view or editor), have a look at the org.eclipse.ui.ISizeProvider interface. If a workbench part can be adapted to ISizeProvider, then this is used to calculate the resulting size. See org.eclipse.ui.internal.WorkbenchPartReference.computePreferredSize(...) for the relevant adapter code...



来源:https://stackoverflow.com/questions/6860762/how-to-set-static-width-to-view-in-swt

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!