View Javadoc

1   /*
2    * Copyright 1999-2006 Faculty of Mathematics, Physics and Informatics, Comenius
3    * University, Bratislava. This file is protected by the Mozilla Public License
4    * version 1.1 (the License); you may not use this file except in compliance
5    * with the License. You may obtain a copy of the License at
6    * http://euromath2.sourceforge.net/license.html Unless required by applicable
7    * law or agreed to in writing, software distributed under the License is
8    * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
9    * KIND, either express or implied. See the License for the specific language
10   * governing permissions and limitations under the License.
11   */
12  package sk.uniba.euromath.editor.selections;
13  
14  import java.util.EventObject;
15  
16  import org.eclipse.jface.util.Assert;
17  
18  import sk.baka.ikslibs.interval.DOMIntervalSet;
19  
20  /***
21   * XML selection changed event object.
22   * 
23   * TODO GUI : this could contains only some update of previous selection
24   *  e.g. some DOMInterval is add to selection, than the result of
25   *  @see DOMIntervalSet#union(sk.baka.ikslibs.interval.DOMInterval) can be this update
26   *  
27   * @author Tomas Studva
28   */
29  public class DOMSelectionChangedEvent extends EventObject {
30  
31      /***
32       * Autogenerated uid.
33       */
34      private static final long serialVersionUID = 6448236361981041006L;
35      
36      /***
37       * The selection.
38       */
39      protected DOMIntervalSet selection;
40  
41      /***
42       * Creates a new event for the given source and selection.
43       * 
44       * @param source
45       *            the selection provider
46       * @param selection
47       *            the selection
48       */
49      public DOMSelectionChangedEvent(IDOMSelectionProvider source,
50              DOMIntervalSet selection) {
51          super(source);
52          Assert.isNotNull(selection);
53          this.selection = selection;
54      }
55  
56      /***
57       * Returns the selection.
58       * 
59       * @return the selection
60       */
61      public DOMIntervalSet getDOMSelection() {
62          return selection;
63      }
64  
65      /***
66       * Returns the selection provider that is the source of this event.
67       * 
68       * @return the originating selection provider
69       */
70      public IDOMSelectionProvider getSelectionProvider() {
71          return getSource();
72      }
73  
74      @Override
75      public IDOMSelectionProvider getSource() {
76          return (IDOMSelectionProvider)super.getSource();
77      }
78  
79  }