View Javadoc

1   /*
2    * Copyright 2004-2008 the Seasar Foundation and the Others.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 
13   * either express or implied. See the License for the specific language
14   * governing permissions and limitations under the License.
15   */
16  package org.seasar.uruma.annotation;
17  
18  import java.lang.annotation.ElementType;
19  import java.lang.annotation.Retention;
20  import java.lang.annotation.RetentionPolicy;
21  import java.lang.annotation.Target;
22  
23  import org.eclipse.jface.viewers.ISelection;
24  import org.eclipse.jface.viewers.ISelectionProvider;
25  import org.eclipse.ui.INullSelectionListener;
26  import org.eclipse.ui.ISelectionListener;
27  import org.eclipse.ui.ISelectionService;
28  import org.eclipse.ui.IWorkbenchPart;
29  
30  /**
31   * 選択状態の変化を受信するメソッドを指定するためのアノテーションです。<br />
32   * <p>
33   * {@link IWorkbenchPart} 上のメソッドに対して本アノテーションを付加すると、 {@link ISelectionProvider}
34   * が発行する選択状態の変化を受け取ることができるようになります。<br />
35   * メソッドの引数は0または1個でなくてはなりません。 {@link ISelection}
36   * が内包するオブジェクトの型が引数の型に一致するか、内包オブジェクトが引数の示す型のサブクラスである場合のみ、メソッドが呼び出されます。
37   * </p>
38   * 
39   * @see ISelectionListener
40   * @author y-komori
41   */
42  @Retention(RetentionPolicy.RUNTIME)
43  @Target( { ElementType.METHOD })
44  public @interface SelectionListener {
45      /**
46       * メソッドが呼び出される際の {@link ISelection} の発行元を限定したい場合、発行元の <code>partId</code>
47       * を指定します。<br />
48       * 
49       * @see ISelectionService#addSelectionListener(String, ISelectionListener)
50       */
51      String partId() default "";
52  
53      /**
54       * <code>true</code> に指定すると、選択結果が <code>null</code>
55       * にもメソッドが呼び出されるようになります。<br />
56       * その場合の引数は <code>null</code> が渡されます。<br />
57       * 
58       * @see INullSelectionListener
59       */
60      boolean nullSelection() default false;
61  
62  }