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   * @author Tomas Studva
24   */
25  public class DOMSelectionChangedEvent extends EventObject {
26  
27      /***
28       * Autogenerated uid.
29       */
30      private static final long serialVersionUID = 6448236361981041006L;
31      
32      /***
33       * The selection.
34       */
35      protected DOMIntervalSet selection;
36  
37      /***
38       * Creates a new event for the given source and selection.
39       * 
40       * @param source
41       *            the selection provider
42       * @param selection
43       *            the selection
44       */
45      public DOMSelectionChangedEvent(IDOMSelectionProvider source,
46              DOMIntervalSet selection) {
47          super(source);
48          Assert.isNotNull(selection);
49          this.selection = selection;
50      }
51  
52      /***
53       * Returns the selection.
54       * 
55       * @return the selection
56       */
57      public DOMIntervalSet getDOMSelection() {
58          return selection;
59      }
60  
61      /***
62       * Returns the selection provider that is the source of this event.
63       * 
64       * @return the originating selection provider
65       */
66      public IDOMSelectionProvider getSelectionProvider() {
67          return getSource();
68      }
69  
70      @Override
71      public IDOMSelectionProvider getSource() {
72          return (IDOMSelectionProvider)super.getSource();
73      }
74  
75  }