一、ApplicationWorkbenchWindowAdvisor.java
1、运行程序自动最大化:
// 运行程序后自动最大化
public void postWindowOpen() {
this.getWindowConfigurer().getWindow().getShell().setMaximized(true);
}
二、ApplicationActionBarAdvisor.java
1、设计Menu bar:
private WebserviceClientAction webserviceClientAction;// 设置菜单对象
public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) {
super(configurer);
}
protected void makeActions(IWorkbenchWindow window) {
super.makeActions(window);
webserviceClientAction = new WebserviceClientAction(window);
}
protected void fillMenuBar(IMenuManager menuBar) {
super.fillMenuBar(menuBar);
// 设置菜单显示名
MenuManager webserviceClientMenu = new MenuManager("&WebserviceClient", "");
// 添加该菜单的成员变量
webserviceClientMenu.add(webserviceClientAction);
// 将菜单加入到Menu bar中
menuBar.add(webserviceClientMenu);
}
三、Perspective.java
1、设置透视图的布局:
public void createInitialLayout(IPageLayout layout) {
// 设置不显示编辑区,false可以将编辑区隐藏
layout.setEditorAreaVisible(false);
// 参数为:视图ID、是否显示菜单标题、设置整体布局(上下左右)、布局比例(0.25-0.95)、相对的标识
layout.addStandaloneView(ClientView.ID, true, IPageLayout.LEFT, 0.95f,layout.getEditorArea());
// 是否可以关闭该视图
layout.getViewLayout(ClientView.ID).setCloseable(false);
}