org.netbeans.modules.editor.lib2/1 1.43.1 10

org.netbeans.spi.editor.typinghooks
Class DeletedTextInterceptor.Context

java.lang.Object
  extended by org.netbeans.spi.editor.typinghooks.DeletedTextInterceptor.Context
Enclosing interface:
DeletedTextInterceptor

public static final class DeletedTextInterceptor.Context
extends Object

The context class providing information about the edited document, its editor pane and the offset where the delete key event occurred.


Method Summary
 JTextComponent getComponent()
          Gets the editor component where the currently processed key typed event occurred.
 Document getDocument()
          Gets the edited document.
 int getOffset()
          Gets the removal offset.
 String getText()
          Gets the text being removed.
 boolean isBackwardDelete()
          Determines the type of the character removal action performed by a user.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getComponent

public JTextComponent getComponent()
Gets the editor component where the currently processed key typed event occurred.

Returns:
The editor pane that contains the edited Document.

getDocument

public Document getDocument()
Gets the edited document. It's the document, where the text will be removed.

Returns:
The edited document.

getOffset

public int getOffset()
Gets the removal offset. This is the offset in the document where a user performed the delete action (ie. where the currently processed KeyEvent happened). This is also the offset with text, which will be removed.

Returns:
The offset in the edited document.

isBackwardDelete

public boolean isBackwardDelete()
Determines the type of the character removal action performed by a user. The two possible actions are called differently on different platforms, but they are always defined by the position of a character, which they are applied to. The backspace action deletes a character on the left hand side of a caret, while the delete action deletes a character on the right hand side of the caret.

In other words one delete action removes characters backwards moving the caret towards the beginning if a document and the other action leaves the caret at the same position and removes characters towards the end of the document.

Returns:
true if the interceptor is called to handle the backspace action. false if the handled action is the delete action.

getText

public String getText()
Gets the text being removed. In beforeRemove method this text is still present in the document, while in the other methods this text has already been removed from the document. Nevertheless this method always returns a copy of the text.

Returns:
The text being removed by the currently processed key typed event.

org.netbeans.modules.editor.lib2/1 1.43.1 10

Built on December 5 2011.  |  Portions Copyright 1997-2011 Sun Microsystems, Inc. All rights reserved.