Existing perspectives can be extended
by adding new views, placeholders,
short cuts and action sets. Most elements are straight forward; a
name and
an ID to identify the item to be added. Views have additional attributes
to
describe the relative positioning and visual characteristics of the
new view
being added.
Procedure
- Create
an implementation class for the perspective to be extended.
The following sample adds a new view to the orders perspective:
package extensions;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.part.ViewPart;
public class ExtendedView extends ViewPart {
public void createPartControl(Composite arg0) {
setPartName("Extended View");
}
public void setFocus() {
}
}
- Use the base Eclipse org.eclipse.ui.perspectiveExtension
extension
point. A complete description of the extension point and the syntax
are available
in the developer documentation for org.eclipse.ui. In the example,
the extension
is defined in a new plug-in called extensions:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<plugin>
<extension point="org.eclipse.ui.views">
<view name="Extended View"
id="extensions.ExtendedView">
</view>
</extension>
<extension point="org.eclipse.ui.perspectiveExtensions">
<perspectiveExtension
targetID="com.ibm.commerce.telesales.ordersPerspective">
<view id="extensions.ExtendedView"
relative="com.ibm.commerce.telesales.storesView"
relationship="bottom"
ratio="0.8"/>
</perspectiveExtension>
</extension>
</plugin>