I got the question how someone could remove the maximize and minimize buttons from a view in an Eclipse RCP application.
To archive this I know two ways.
Either set the layout to fixed in initialLayout() in Perspective.java
[sourcecode language=”java”]
package de.vogella.intro.rcp.fixedview;
import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.IPerspectiveFactory;
public class Perspective implements IPerspectiveFactory {
public void createInitialLayout(IPageLayout layout) {
String editorArea = layout.getEditorArea();
layout.setEditorAreaVisible(false);
layout.setFixed(true);
// layout.addStandaloneView(View.ID, false, IPageLayout.LEFT, 1.0f, editorArea);
}
}
[/sourcecode]
Or use the Perspective.java to add a standalone view.
[sourcecode language=”java”]
package de.vogella.intro.rcp.fixedview;
import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.IPerspectiveFactory;
public class Perspective implements IPerspectiveFactory {
public void createInitialLayout(IPageLayout layout) {
String editorArea = layout.getEditorArea();
layout.setEditorAreaVisible(false);
// layout.setFixed(true);
layout.addStandaloneView(View.ID, false, IPageLayout.LEFT, 1.0f, editorArea);
}
}
[/sourcecode]
If I add a standalone view via the extension “org.eclipse.ui.perspectiveExtensions” then the minimize and maximize buttons are still there.
[sourcecode language=”java”]
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
id="application"
point="org.eclipse.core.runtime.applications">
<application>
<run
class="de.vogella.intro.rcp.fixedview.Application">
</run>
</application>
</extension>
<extension
point="org.eclipse.ui.perspectives">
<perspective
name="Perspective"
class="de.vogella.intro.rcp.fixedview.Perspective"
id="de.vogella.intro.rcp.fixedview.perspective">
</perspective>
</extension>
<extension
point="org.eclipse.ui.views">
<view
name="View"
class="de.vogella.intro.rcp.fixedview.View"
id="de.vogella.intro.rcp.fixedview.view">
</view>
</extension>
<extension
point="org.eclipse.ui.perspectiveExtensions">
<perspectiveExtension
targetID="*">
<view
id="de.vogella.intro.rcp.fixedview.view"
minimized="false"
ratio="1.0f"
relationship="left"
relative="org.eclipse.ui.editorss"
standalone="true"
visible="true">
</view>
</perspectiveExtension>
</extension>
</plugin>
[/sourcecode]
The behavior seems inconsistent. If I use coding to add a standalone view the minimize / maximize buttons are not there, if I use extension points they are still there.
Does anymore know if I’m missing something? Or is this a bug? If you know please comment on this blog post or contact me via twitter.
Update: Projekt attached.
5 Responses to Eclipse RCP – Removing the minimize and maximize buttons from Views