#topicpath
----
//ここにコンテンツを記述します。
自分用のパースペクティブを作成したいときはorg.eclipse.ui.IPerspectiveFactory を使用します。このクラスのpublic void createInitialLayout(IPageLayout layout)メソッド内で、IPageLayoutのインスタンスに対して
-ビューの配置
-ツールバーやメニューバーへの設置

などを行います。

***拡張ポイント [#ee3d4bb9]
 org.eclipse.ui.perspectives

***plugin.xmlのサンプル [#re648bd8]
  <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>


**ポイント [#xa081de4]
***ビューの配置 [#v1460888]
基本的に、エディタエリアの取得を行い、その場所から相対的な位置を指定してビューを配置していくようです。例えば、
 //エディタの場所を取得。
 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のメソッドたち [#j1fa7e09]
:layout.addView("viewのID"); |パースペクティブに配置
:layout.addNewWizardShortcut("wizardのID"); |ファイル>新規の箇所にウィザードを追加
:layout.addShowViewShortcut("viewのID"); |ウィンドウ>ビューの表示にビューを追加
:layout.addPerspectiveShortcut("perspectiveのID"); |ウィンドウ>パースペクティブを開くにパースペクティブを追加








----
この記事は
#vote(おもしろかった[6],そうでもない[1])
#vote(おもしろかった[7],そうでもない[1])

#comment
#topicpath


SIZE(10){現在のアクセス:&counter;}

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS