站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

Abbrev (Editor Library) - NetBeans API Javadoc (Current Development Version)

org.netbeans.modules.editor.lib/1 1.14.0 3

org.netbeans.editor
Class Abbrev

java.lang.Object
  extended by org.netbeans.editor.Abbrev
All Implemented Interfaces:
PropertyChangeListener, EventListener, SettingsChangeListener

public class Abbrev
extends Object
implements SettingsChangeListener, PropertyChangeListener

Abbreviation support allowing to expand defined character sequences into the expanded strings or call the arbitrary action.


Field Summary
protected  EditorUI editorUI
          Extended UI to which this abbreviation is associated to
 
Constructor Summary
Abbrev(EditorUI editorUI, boolean checkDocText, boolean checkTextDelimiter)
           
 
Method Summary
 void addChar(char ch)
          Add typed character to abbreviation accounting string.
 void checkAndExpand(ActionEvent evt)
           
 boolean checkAndExpand(char typedChar, ActionEvent evt)
           
 boolean checkReset(char typedChar)
           
protected  boolean doExpansion(int dotPos, String expandStr, ActionEvent evt)
           
 boolean expandString(char typedChar, String expandStr, ActionEvent evt)
           
 boolean expandString(String expandStr, ActionEvent evt)
          Expand abbreviation on current caret position.
 Map getAbbrevMap()
          Get mapping table [abbrev, expanded-abbrev]
 String getAbbrevString()
          Get current abbreviation string
 String getExpandString()
           
 String getExpandString(char typedChar)
          Checks whether there's valid string to expand and if so it returns it.
static boolean isAbbrevDisabled(JTextComponent component)
          Test whether the abbreviation expansion is disabled at the caret position in the given component's document.
 void propertyChange(PropertyChangeEvent evt)
           
 void reset()
          Reset abbreviation accounting.
 void settingsChange(SettingsChangeEvent evt)
          Called when settings were changed.
 Object translateAbbrev(String abbrev)
          Translate string using abbreviation table
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

editorUI

protected EditorUI editorUI
Extended UI to which this abbreviation is associated to

Constructor Detail

Abbrev

public Abbrev(EditorUI editorUI,
              boolean checkDocText,
              boolean checkTextDelimiter)
Method Detail

isAbbrevDisabled

public static boolean isAbbrevDisabled(JTextComponent component)
Test whether the abbreviation expansion is disabled at the caret position in the given component's document.

Parameters:
component - non-null text component.
Returns:
true if the abbreviation can be expanded or false if not.

settingsChange

public void settingsChange(SettingsChangeEvent evt)
Called when settings were changed. The method is called by editorUI when settings were changed and from constructor.

Specified by:
settingsChange in interface SettingsChangeListener

propertyChange

public void propertyChange(PropertyChangeEvent evt)
Specified by:
propertyChange in interface PropertyChangeListener

reset

public void reset()
Reset abbreviation accounting.


addChar

public void addChar(char ch)
Add typed character to abbreviation accounting string.


getAbbrevString

public String getAbbrevString()
Get current abbreviation string


getAbbrevMap

public Map getAbbrevMap()
Get mapping table [abbrev, expanded-abbrev]


translateAbbrev

public Object translateAbbrev(String abbrev)
Translate string using abbreviation table

Parameters:
abbrev - string to translate. Pass null to translate current abbreviation string
Returns:
expanded abbreviation

getExpandString

public String getExpandString(char typedChar)
Checks whether there's valid string to expand and if so it returns it.


getExpandString

public String getExpandString()

doExpansion

protected boolean doExpansion(int dotPos,
                              String expandStr,
                              ActionEvent evt)
                       throws BadLocationException
Throws:
BadLocationException

expandString

public boolean expandString(char typedChar,
                            String expandStr,
                            ActionEvent evt)
                     throws BadLocationException
Throws:
BadLocationException

expandString

public boolean expandString(String expandStr,
                            ActionEvent evt)
                     throws BadLocationException
Expand abbreviation on current caret position. Remove characters back to the word start and insert expanded abbreviation.

Returns:
whether the typed character should be added to the abbreviation or not
Throws:
BadLocationException

checkReset

public boolean checkReset(char typedChar)

checkAndExpand

public boolean checkAndExpand(char typedChar,
                              ActionEvent evt)
                       throws BadLocationException
Throws:
BadLocationException

checkAndExpand

public void checkAndExpand(ActionEvent evt)
                    throws BadLocationException
Throws:
BadLocationException

org.netbeans.modules.editor.lib/1 1.14.0 3

Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.