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.textEditor.requests.selectionRequest;
13  
14  import java.util.Collection;
15  import java.util.HashSet;
16  import java.util.Set;
17  
18  import org.eclipse.gef.Request;
19  
20  import sk.uniba.euromath.editor.textEditor.Interval;
21  import sk.uniba.euromath.editor.textEditor.requests.RequestConstants;
22  
23  /***
24   * @author Tomáš Studva 7.2.2006
25   */
26  public class TextSelectRequest extends Request{
27  
28      /***
29       * Selection to select.
30       */
31      private final Set<Interval> selection;
32  
33      /***
34       * Determines how to select. Can be: {@link #NEW_SELECTION } or
35       * {@link #XOR_SELECTION }.
36       */
37      private String selectType;
38  
39      /***
40       * Type to new selection.
41       */
42      public static final String NEW_SELECTION = "NEW_SELECTION"; //$NON-NLS-1$
43  
44      /***
45       * Type to XOR selection.
46       */
47      public static final String XOR_SELECTION = "XOR_SELECTION"; //$NON-NLS-1$
48  
49      /***
50       * Constructor.
51       * 
52       * @param selection
53       * @param selectType
54       */
55      public TextSelectRequest(Collection<Interval> selection, String selectType) {
56          super(RequestConstants.TEXT_SELECT);
57          this.selection = new HashSet<Interval>(selection);
58          this.selectType = selectType;
59      }
60  
61      /***
62       * @return the selection
63       */
64      public Set<Interval> getSelection() {
65          return this.selection;
66      }
67  
68      /***
69       * @return the selectType
70       */
71      public String getSelectType() {
72          return this.selectType;
73      }
74  
75  }