TWiki> Public Web>DpHipe>DpHipePerspectives (revision 1)EditAttach

Creating a Perspective

HIPE Perspective menu

If you think that a set of (new) views should be presented in convenient way, you can do so by creating a new perspective. Such a perspective defines how these views are layed out in tabs and split panes. This section briefly explains how to contribute a new perspective.

Basic Steps

  • Implement the interface.
  • Register your implementation to the herschel.ia.core.ExtensionRegistry in the

For you convenience an abstract implementation exists (; it allows you to concentrate on implementing one method only:

    public abstract class AbstractPerspective implements Perspective {
	public abstract SitePart doLayout(SitePartBuilder builder);

Construction items

SiteParts are the building blocks of a perspective. We distinct the following flavors:

  • ViewPart - normal views
  • EditorArea - the editor area
  • SplitPart - two windows with a movable split
  • TabPart - n windows organized into tabs

Access to the views, editor area or creation of the tab and split layout containers are all through the SitePartBuilder:

public interface SitePartBuilder {
    ViewPartManager getViewManager();    
    TabbedPart buildTabs(SitePart... parts);
    SplitPart buildSplit(float split, boolean horizontal, SitePart lhs, SitePart rhs);    

Example Implementation

The implementation below reflects a classic JIDE layout. My JIDE implementation

public final class MyJidePerspective extends AbstractPerspective {

    public SitePart doLayout(SitePartBuilder builder) {
        // get pointers to the views and editor area
	ViewPartManager vm = builder.getViewManager();

	SitePart editors = vm.getEditor();
	SitePart console = vm.getViewByTitle("Console");
	SitePart history = vm.getViewByTitle("History");

	// actual layout:
	boolean vert = false;
	boolean hori = true;

        SitePart bottom = builder.buildSplit(0.7f, hori, console, history);
	SitePart window = builder.buildSplit(0.7f, vert, editors, bottom);

	return window;


Example Registry

The following snippet, could then go into your

# import
from herschel.ia.core import ExtensionRegistry, Extension

# registry
REGISTRY.register(PERSPECTIVE, Extension(
         "site.perspective.myjide",                   # a unique ID
         "", # the above implementation
         "My JIDE",                                   # how it should be called in the menu
         None                                         # possible icon (none here)

# cleanup

Edit | Attach | Watch | Print version | History: r21 | r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r1 - 2008-01-14 - JorgoBakker
This site is powered by the TWiki collaboration platform Powered by Perl