org.seasar.eclipse.rcp.ui
クラス GenericSelectionListener

java.lang.Object
  上位を拡張 org.seasar.eclipse.rcp.ui.GenericSelectionListener
すべての実装されたインタフェース:
ISelectionListener
直系の既知のサブクラス:
NullGenericSelectionListener

public class GenericSelectionListener
extends Object
implements ISelectionListener

任意のメソッドを呼び出すことができる、汎用的な ISelectionListener の実装クラスです。

本クラスは ISelectionListener として振る舞い、 selectionChanged メソッドが呼び出された際に、コンストラクタで渡される ObjectMethod の表すメソッドを呼び出します。
このとき、コンストラクタで渡される Method オブジェクトの表す引数によって、呼び出される際の引数の渡し方が変化します。

引数がなしのとき
引数には何も渡されません。
引数が配列型以外で 1 個のとき
selectionChanged メソッドで渡される ISelection オブジェクトの持つ要素が引数の型に代入可能かチェックし、代入可能ならば最初の 1 個を渡します。
引数が配列型で 1 個のとき
selectionChanged メソッドで渡される ISelection オブジェクトの持つ要素が引数の型に代入可能かチェックし、代入可能ならば全ての要素を渡します。
引数が 2 個以上のとき
コンストラクタ呼び出し時に IllegalArgumentException をスローします。

作成者:
y-komori

コンストラクタの概要
GenericSelectionListener(WindowContext context, SingleParamTypeMethodBinding methodBinding)
          GenericSelectionListener を構築します。
 
メソッドの概要
 void selectionChanged(IWorkbenchPart part, ISelection selection)
          イベント処理を行います。
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

GenericSelectionListener

public GenericSelectionListener(WindowContext context,
                                SingleParamTypeMethodBinding methodBinding)
GenericSelectionListener を構築します。

パラメータ:
context - WindowContext オブジェクト
methodBinding - 呼び出し対象の SingleParamTypeMethodBinding オブジェクト
メソッドの詳細

selectionChanged

public void selectionChanged(IWorkbenchPart part,
                             ISelection selection)
イベント処理を行います。

本メソッドでは、以下の処理を順に実行します。

  1. WindowContext へフォームオブジェクトとして、 SingleParamTypeMethodBinding の保持するターゲットオブジェクトを設定します。
  2. ターゲットオブジェクトへ、画面の選択状態をバインド(ImportSelection)します。
  3. ターゲットオブジェクトへ、画面の値をバインド(ImportValue)します。
  4. コンストラクタで指定された MethodBinding の呼び出しを行います。
  5. 画面へ、ターゲットオブジェクトの値をバインド(ExportValue)します。
  6. 画面の選択状態ををターゲットオブジェクトのフィールドに従ってバインド(ExportSelection)します。

定義:
インタフェース ISelectionListener 内の selectionChanged
関連項目:
ISelectionListener.selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)


Copyright © 2006-2007 The Seasar Foundation. All Rights Reserved.