Perspective

 

org.eclipse.ui
Interface IPerspectiveFactory


public interface IPerspectiveFactory

A perspective factory generates the initial page layout and visible action set for a page.

When a new page is created in the workbench a perspective is used to define the initial page layout. If this is a predefined perspective (based on an extension to the workbench's perspective extension point) an IPerspectiveFactory is used to define the initial page layout.

The factory for the perspective is created and passed an IPageLayout where views can be added. The default layout consists of the editor area with no additional views. Additional views are added to the layout using the editor area as the initial point of reference. The factory is used only briefly while a new page is created; then discarded.

To define a perspective clients should implement this interface and include the name of their class in an extension to the workbench's perspective extension point (named "org.eclipse.ui.perspectives"). For example, the plug-in's XML markup might contain:

 <extension point="org.eclipse.ui.perspectives">
   <perspective
       id="com.example.javaplugin.perspective"
       name="Java"
       class="com.example.javaplugin.JavaPerspective"
   </perspective>
 </extension>
 

Example of populating a page with standard workbench views:

 public void createInitialLayout(IPageLayout layout) {
		// Get the editor area.
		String editorArea = layout.getEditorArea();

		// Top left: Resource Navigator view and Bookmarks view placeholder
		IFolderLayout topLeft = layout.createFolder("topLeft", IPageLayout.LEFT, 0.25f,
			editorArea);
		topLeft.addView(IPageLayout.ID_RES_NAV);
		topLeft.addPlaceholder(IPageLayout.ID_BOOKMARKS);

		// Bottom left: Outline view and Property Sheet view
		IFolderLayout bottomLeft = layout.createFolder("bottomLeft", IPageLayout.BOTTOM, 0.50f,
			"topLeft");
		bottomLeft.addView(IPageLayout.ID_OUTLINE);
		bottomLeft.addView(IPageLayout.ID_PROP_SHEET);

		// Bottom right: Task List view
		layout.addView(IPageLayout.ID_TASK_LIST, IPageLayout.BOTTOM, 0.66f, editorArea);
	}
 

Within the workbench a user may override the visible views, layout and action sets of a predefined perspective to create a custom perspective. In such cases the layout is persisted by the workbench and the factory is not used.


Method Summary
 voidcreateInitialLayout(IPageLayout layout)
          Creates the initial layout for a page.
 

Method Detail

createInitialLayout

public void createInitialLayout(IPageLayout layout)
Creates the initial layout for a page.

Implementors of this method may add additional views to a perspective. The perspective already contains an editor folder identified by the result of IPageLayout.getEditorArea(). Additional views should be added to the layout using this value as the initial point of reference.

Parameters:
layout - the page layout

Eclipse Platform
Release 3.0

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值