问题
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