.NET C# Java Javascript Exception



Sometimes a user should not be allowed to maximize/minimize a view or editor. This article is about how achieve this.

Defining custom PresentationFactory

The main entry point to change the presentation of RCP editors and views is to define a custom PresentationFactory, which extends the the default presenetation factory. This presenetation factory then needs to be registered in the plugin.xml.

Registering custom presentation factory in plugin.xml

<extension point="org.eclipse.ui.presentationFactories">
  <factory class="org.acme.ExampleWorkbenchPresentationFactory"/>

Changing editor presentation

In order to chage the editor presentation - here to hide the minmize / maximize buttons - we need to override the createEditorPresentation method in the presentation factory

public StackPresentation createEditorPresentation(final Composite parent,
        final IStackPresentationSite site) {
    final TabbedStackPresentation presentation = (TabbedStackPresentation)super.createViewPresentation(parent, site);
    return presentation;

The interesting code here is presentation.showMinMax(false).

Changing view presentation

It is the same code as for the editors - we need to override the method createViewPresentation in the presentation factory.

Using fixed layout

The above steps show, how to hide the minimize and maximize buttons of editors and views, but a double click on an editor/view will still cause the editor/view to be maximized. In order to avoid that, an implemenation of the interface IPerspectiveFactory should be provided as follows

public class MyPerspectiveFactory implements IPerspectiveFactory {
    public void createInitialLayout(final IPageLayout layout) {

eclipse button maximize minimize rcp
Schreibe einen Kommentar:
rcp minimize maximize button eclipse
Entweder einloggen... ...oder ohne Wartezeit registrieren
Passwort wiederholen