[Eclipse plug
1.Perspective扩展点的作用
该扩展点在rcp中主要起到界面布局的作用,此处界面主要指主窗口(不包含菜单栏,工具栏,状态栏)。
2.Perspective扩展点的定义
<extension
point="org.eclipse.ui.perspectives">
<perspective
name="Sunrise Perspective"
class="com.tongdatech.sunrise.Perspective"
id="com.tongdatech.sunrise.perspective"
icon="icons/sample.gif"
fixed="false">
</perspective>
</extension>
3.Perspective扩展点的属性
id: 透视图的唯一标识
name: 透视图的名称(显示在菜单栏中)
class:实现了org.eclipse.ui.IPerspectiveFactory接口的java类,此处类名必须包含全路径
icon: 与该视图项关联的图标
fixed:指出该透视图是否是固定的,如果该属性设为True,那么在该透视图中创建的视图是不可以关闭,且不可以 移动的.默认情况是false
4.Perspective扩展点的实现
package com.tongdatech.sunrise;
import org.eclipse.ui.IFolderLayout;
import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.IPerspectiveFactory;
public class Perspective implements IPerspectiveFactory {
public void createInitialLayout(IPageLayout layout) {
layout.addNewWizardShortcut("com.tongdatech.sunrise.wizards.TranNewWizard");
layout.addPerspectiveShortcut("com.tongdatech.sunrise.perspective");
//layout.addShowViewShortcut("");
String editorArea =layout.getEditorArea();
layout.setEditorAreaVisible(true);
IFolderLayout leftFolder = layout.createFolder("leftFolderLayout", IPageLayout.LEFT, 0.5f, editorArea);
leftFolder.addPlaceholder("org.eclipse.ui.navigator.ProjectExplorer"+":*");
leftFolder.addView("org.eclipse.ui.navigator.ProjectExplorer");
}
}
layout.getEditorArea(): 返回Editor区域所对应的ID。一般View被安排在Editor的周围,因此通常需要得到此ID值,在定义View的位置时予以引用。
Editor区域可以通过IPageLayout的setEditorAreaVisible()方法予以显示或者关闭。
layout.createFolder(): 创建一个IFolderLayout。IFolderLayout定义了一个组合框的位置,在此组合框内,可以按照TabFolder的形式显示多个View。
IFolderLayout的addView()方法可以向此组合框内添加View
IFolderLayout的addPlaceholder()方法,可以将一个View添加到这个组合框内但不予显示。当这个View需要被显示时,将自动被插到其定义为Placeholder的IFolderLayout内。
leftFolder.addPlaceholder("org.eclipse.ui.navigator.ProjectExplorer"+":*");其中":*"表示还可以有更多的内容,即可以同更多的视图共享这个位置。
通常,我们都需要先定义IFolderLayout,然后再将View添加到IFolderLayout内,而不是直接将View添加到IPageLayout内,故尽量少用layout.addStandaloneView()方法。
对于Perspective的额外的一些属性的设置,可以在org.eclipse.ui.perspectiveExtensions中定义,具体可以设置的内容包括:
ActionSet: 要添加到这个Perspective 中的ActionSet。
ViewShortcut: 要添加到Window菜单下的Show View子菜单中的View。如果不添加这个扩展点的话,则在这个Perspective活动的情况下,Show View子菜单中找不到对应的View,必须点Others之后才能够看到。
PerspectiveShortcut: 要添加到Window菜单下Show Perspective子菜单中的Perspective。
NewWizardShortcut: 要添加到File菜单下的New子菜单下的新建向导。
相关知识
eclipse 增加内存的方法、修改配置文件 内存优化
Eclipse自动补全(取消“=”,空格,“.”和“;”的自动补全,加入TAB的自动补全)
这位电池公司CEO深信,绿氢会成为未来的主流燃料
600W植物生长灯
北京汽车环保标准查询
球根鲜花专用基质) 60(kg) 60(kg)
今天玩玩Android
求英语不规则动词表和现在进行时中需要双写的动词~
Java项目源码javaweb花店销售管理系统
少数民族与花相关节日(Minority and flower related festivals).doc
原文链接: [Eclipse plug https://www.huajiangbk.com/newsview1076412.html
| 上一篇: 影响种子寿命的环境条件 | 下一篇: 解释“meta name=”vi... |
推荐分享

- 1明日花キララ:明日花绮罗年度... 24851
- 2明日花キララ(明日花绮罗)经... 14608
- 3家庭养花知识大全 家庭养花有... 9955
- 4家庭养花风水知识 家庭养花“... 9666
- 5兰花叶子扭的是什么兰 8887
- 6五月天婷婷开心六月丁香:音乐... 8735
- 7君子兰什么品种最名贵 十大名... 8347
- 8秋天养花,掌握这5点养花知识... 8173
- 9十大致癌花卉排行榜,哪些花卉... 7936
- 10【花卉知识 】养花须知:新手... 7777




