|
自分用のパースペクティブを作成したいときはorg.eclipse.ui.IPerspectiveFactory? を使用します。このクラスのpublic void createInitialLayout?(IPageLayout? layout)メソッド内で、IPageLayout?のインスタンスに対して
などを行います。 拡張ポイント †org.eclipse.ui.perspectives plugin.xmlのサンプル † <extension point="org.eclipse.ui.perspectives">
<perspective name="パースペクティブ名"
icon="icons/sample.gif" <-アイコン
class="nu.mine.kino.example.MyPerspectiveFactory" <-実装クラス
id="nu.mine.kino.example.MyPerspectiveFactory"> <-ID
</perspective>
</extension>
ポイント †ビューの配置 †基本的に、エディタエリアの取得を行い、その場所から相対的な位置を指定してビューを配置していくようです。例えば、 //エディタの場所を取得。
String editorArea = layout.getEditorArea();
IFolderLayout topLeft =
layout.createFolder("topLeft", IPageLayout.LEFT, 0.26F, editorArea);
//"topLeft"という文字列の参照部分を作った <-第一引数。変数名でなく
//この参照は、editorAreaのLEFTを指している。
topLeft.addView("org.eclipse.ui.views.ResourceNavigator");
IFolderLayout bottomLeft =
layout.createFolder("bottomLeft", IPageLayout.BOTTOM, 0.5F, "topLeft");
//"bottomLeft"という文字列の参照部分を作った
//この参照は、"topLeft"のBOTTOMを指している。
// よってこれはエディタから見て、左の下、つまり左下になる。
bottomLeft.addView("org.eclipse.ui.views.ContentOutline");
の様に行います。ちなみに、IPageLayout?の定数ですが、 public static final int LEFT = 1; public static final int RIGHT = 2; public static final int TOP = 3; public static final int BOTTOM = 4; となっていました。 createInitialLayout?(IPageLayout? layout) のlayoutのメソッドたち †
この記事は 現在のアクセス:12250 |