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.editTextRequests;
13  
14  import org.eclipse.gef.EditDomain;
15  
16  import sk.uniba.euromath.editor.textEditor.ITextPieceKeeper;
17  import sk.uniba.euromath.editor.textEditor.requests.IRequestSpecialization;
18  import sk.uniba.euromath.editor.textEditor.requests.RequestConstants;
19  
20  /***
21   * Used when activating TextTool
22   * 
23   * @author Martin Kollar
24   */
25  public class ActivateTextEditingRequest extends EditTextRequest implements IRequestSpecialization {
26  
27  	  private EditDomain domain;
28  	
29  	  /*** ofsset in source editPart */
30  	  private int caretOffset;
31  	
32  	  /***
33  	   * @param source ITextPieceKeeper where the Caret is going to be activated
34  	   * @param caretOffset index from start of TextPiece before that Caret is
35  	   *        going to be activated
36  	   */
37  	public ActivateTextEditingRequest(ITextPieceKeeper source, int caretOffset, EditDomain domain){
38  		super(source);
39  		this.domain = domain;
40  		this.caretOffset = caretOffset;
41  	}
42  	
43  	  public EditDomain getDomain(){
44  		  return domain;
45  	  }
46  	  
47  	  /***
48  	   * 
49  	   * @return index from start of TextPiece before that Caret is going to be activated
50  	   */
51  	  public int getCaretOffset(){
52  		  return this.caretOffset;
53  	  }
54  	
55      public String getSpecialization() {
56          return RequestConstants.ACTIVATE_TEXT_EDITING_REQUEST;
57      }
58  }