[Eclipse plug-in] org.eclipse.ui.perspectives扩展点
来源:互联网 发布:知乎 马三娘你凭啥骑马 编辑:程序博客网 时间:2024/06/10 06:04
该扩展点在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 plug-in] org.eclipse.ui.perspectives扩展点
- requires plug-in org.eclipse.wst.sse.ui
- 扩展点:org.eclipse.ui.actionSets
- org.eclipse.ui.startup扩展点介绍
- org.eclipse.ui.startup扩展点介绍
- org.eclipse.ui.editors.templates扩展点
- 'org.eclipse.mylyn.tasks.ui.hyperlinks.detectors.url' extension from plug-in 'org.eclipse.mylyn.tas
- Eclipse扩展点总结之org.eclipse.ui.exportWizards
- Eclipse:Could not create the view: Plug-in org.eclipse.jdt.ui was unable to load class org.eclipse.
- Eclipse:Could not create the view: Plug-in org.eclipse.jdt.ui was unable to load class org.eclipse.j
- Eclipse:Could not create the view: Plug-in org.eclipse.jdt.ui was unable to load class org.eclipse.j
- Eclipse:Could not create the view: Plug-in org.eclipse.jdt.ui was unable to load class org.eclipse.j
- Eclipse:Could not create the view: Plug-in org.eclipse.jdt.ui was unable to load class org.eclipse.j
- the 'org.eclipse mylyn.java.ui.javaAllCompletionProposalComputer' proposal computer from the 'org.eclipse mylyn.java.ui' plug-in
- Plug-in org.eclipse.wst.jsdt.ui was unable to load class org.eclipse.wst.jsdt.internal.ui.javaeditor
- org.eclipse.core.runtime.CoreException: Plug-in org.eclipse.jdt.ui was unable to load class org.ecli
- 扩展点总结之org.eclipse.ui.newWizards
- 扩展点总结之org.eclipse.ui.perspectiveExtensions
- 探索IPhone的Cover Flow歌曲封面以3D界面的形式显示出来的效果
- linux framebuffer,内存共享与组播
- 把爱写在左手上
- fqueue(二)
- 使用RapidXML读写XML文件
- [Eclipse plug-in] org.eclipse.ui.perspectives扩展点
- jstl和jsp脚本变量相互访问
- Java事务处理总结
- 通过两个点的经纬度计算距离[转]
- Linux中TASK_RUNNING状态的进程链表
- MD /MDD /ML /MT /MTD的简单介绍
- JDK源码分析之Set类详解——适配器模式的应用
- WITH 查询
- WIFI手动命令行连接AP