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插件扩展点的问题。