Eclipse插件开发Perspectives篇

  • 介绍
Perspectives即透视图的意思。通过透视图可以将你喜欢的Eclipse工作空间布局保存起来。
  • 插件定义
[codesyntax lang="xml"]
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>

   <extension point="org.eclipse.ui.perspectives">
         <perspective class="org.suren.perspectives.perspective.SuRenPerspectiveFactory"
          		id="org.suren.perspectives.SuRenPerspectiveFactory"
          		icon="icons/bird.gif"
          		name="LittleBird"/>
   </extension>

</plugin>
[/codesyntax]
  • 透视图实现类
[codesyntax lang="java"]
/**
 *
 */
package org.suren.perspectives.perspective;

import org.eclipse.ui.IFolderLayout;
import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.IPerspectiveFactory;
import org.eclipse.ui.navigator.resources.ProjectExplorer;
import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard;

/**
 * “素人”模式
 * 
 * @author suren
 * @since 2015-2-4
 * http://surenpi.com
 */
public class SuRenPerspectiveFactory implements IPerspectiveFactory
{

	@Override
	public void createInitialLayout(IPageLayout layout)
	{
		String editorArea = layout.getEditorArea();

//		layout.addView(IPageLayout.ID_PROJECT_EXPLORER, IPageLayout.LEFT, 0.20f, editorArea);
		layout.addView("org.eclipse.jdt.ui.PackageExplorer", IPageLayout.LEFT, 0.15f, editorArea);

//		layout.addView("org.eclipse.ui.views.ContentOutline", IPageLayout.RIGHT, 0.80f, editorArea);

		IFolderLayout folder = layout.createFolder("bottom", IPageLayout.BOTTOM, 0.65f, editorArea);
		folder.addView("org.suren.littlebird.views.SuRenLoggerView");

		IFolderLayout leftFolder = layout.createFolder("bird_left", IPageLayout.LEFT, 0.5f, "bottom");
		leftFolder.addView("org.suren.littlebird.views.SuRenBundleView");
		leftFolder.addView("org.eclipse.ui.console.ConsoleView");

		layout.addNewWizardShortcut(BasicNewProjectResourceWizard.WIZARD_ID);
		layout.addShowViewShortcut(ProjectExplorer.VIEW_ID);
	}

}
[/codesyntax]
  • 参考
这里有介绍如何之定义Eclipse插件扩展点的问题。

转载于:https://my.oschina.net/surenpi/blog/605214

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值