|
JIDE 3.5.15 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.jidesoft.editor.CodeEditorFindAndReplaceTarget
public class CodeEditorFindAndReplaceTarget
A FindAndReplaceTarget implementation for CodeEditor.
| Constructor Summary | |
|---|---|
CodeEditorFindAndReplaceTarget(CodeEditor codeEditor)
|
|
| Method Summary | |
|---|---|
void |
adjustCurrentPosition(String searchingText,
boolean forward)
Adjusts current position according to searching text in the first attempt to search. |
void |
changedUpdate(DocumentEvent e)
|
CodeEditor |
getCodeEditor()
|
JComponent |
getConfigurationPanel()
FindAndReplaceTarget can be added to FindAndReplacePanel so that user can configure it. |
String |
getCurrentName()
Gets the name of the target. |
int |
getCurrentPosition(boolean forward)
Gets the current position where the next search will start. |
CharSequence |
getCurrentText()
Gets the current text. |
FindResultIntepreter |
getIntepreter()
Gets the interpreter that can understand the start offset and end offset in a FindResult. |
Locale |
getLocale()
Gets the target's locale. |
Point |
getPromptDialogLocation()
Gets the default prompt dialog location without concerning the caret position. |
Point |
getPromptDialogLocation(Rectangle dialogBounds)
Gets the prompt dialog location. |
Window |
getPromptDialogParent()
Gets the window that can be used as the parent of the prompt dialog. |
String |
getResourceString(String key)
Gets resource string from target. |
boolean |
hasNext()
Checks if there is more chunk of text after the current text when FindAndReplace reaches the end of the current text when searching forward. |
boolean |
hasPrevious()
Checks if there is more chunk of text before the current text when FindAndReplace reaches the start of the current text when searching backward. |
void |
highlight(int start,
int end)
Highlights the text to indicate the text matches the searching criteria. |
void |
insertUpdate(DocumentEvent e)
|
boolean |
isTargetChanged()
Checks if the text in the target changes. |
void |
next()
Changes the current text to the next one. |
void |
previous()
Changes the current text to the previous one. |
void |
removeUpdate(DocumentEvent e)
|
void |
replace(int offset,
int len,
String str)
Replaces some text with the new text. |
void |
replaceAllEnds()
Replace all ends. |
void |
replaceAllStarts()
Replace all starts. |
void |
scrollToShowCaret(Rectangle promptDialogBounds)
Scrolls to show caret. |
protected void |
setTargetChanged(boolean targetChanged)
|
void |
showMessage(String message)
Shows a message. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CodeEditorFindAndReplaceTarget(CodeEditor codeEditor)
| Method Detail |
|---|
public FindResultIntepreter getIntepreter()
FindAndReplaceTargetFindResult.
CodeEditor implements FindResultIntepreter.
getIntepreter in interface FindAndReplaceTargetpublic CodeEditor getCodeEditor()
public JComponent getConfigurationPanel()
FindAndReplaceTargetFindAndReplaceTarget can be added to FindAndReplacePanel so that user can configure it.
The panel returned from this method is the panel. FindAndReplacePanel will add a radio button before
the configuration panel, so there is no need to have a radio button inside the panel. If there is nothing to
configure for this target, you just return a JLabel with the descriptive name. For example, something like new
JLabel("Selection") if the target is for the selected text in a CodeEditor.
FindAndReplacePanel will arrange all configuration panels vertically, so you should make sure the
configuration panel are arranged horizontally (very wide instead very tall) so that the overall appearance looks
good. If for whatever reason you have to make the configuration very tall, you may need to override FindAndReplacePanel.createTargetPanel() method so that you can do the layout of the configuration panels
yourself.
getConfigurationPanel in interface FindAndReplaceTargetpublic boolean hasNext()
FindAndReplaceTarget
hasNext in interface FindAndReplaceTargetpublic void next()
FindAndReplaceTarget
next in interface FindAndReplaceTargetpublic boolean hasPrevious()
FindAndReplaceTarget
hasPrevious in interface FindAndReplaceTargetpublic void previous()
FindAndReplaceTarget
previous in interface FindAndReplaceTargetpublic int getCurrentPosition(boolean forward)
FindAndReplaceTarget
getCurrentPosition in interface FindAndReplaceTargetforward - true or false.
public void adjustCurrentPosition(String searchingText,
boolean forward)
FindAndReplaceTarget
adjustCurrentPosition in interface FindAndReplaceTargetsearchingText - current searching textforward - true or false.
public void highlight(int start,
int end)
FindAndReplaceTarget
highlight in interface FindAndReplaceTargetstart - the start offset of the text that is found.end - the end offset of the text that is found.
public void replace(int offset,
int len,
String str)
throws BadLocationException
FindAndReplaceTarget
replace in interface FindAndReplaceTargetoffset - the offset from the beginning.len - the number of characters to be replaced.str - the new text to replace the old text.
BadLocationException - if the given offset is not a valid position within the documentpublic Window getPromptDialogParent()
FindAndReplaceTarget
getPromptDialogParent in interface FindAndReplaceTargetpublic Point getPromptDialogLocation(Rectangle dialogBounds)
FindAndReplaceTarget
getPromptDialogLocation in interface FindAndReplaceTargetdialogBounds - the bounds of the dialog before determining its location
public Point getPromptDialogLocation()
FindAndReplaceTarget
getPromptDialogLocation in interface FindAndReplaceTargetpublic void scrollToShowCaret(Rectangle promptDialogBounds)
FindAndReplaceTarget
scrollToShowCaret in interface FindAndReplaceTargetpromptDialogBounds - the prompt dialog boundspublic String getCurrentName()
FindAndReplaceTarget
getCurrentName in interface FindAndReplaceTargetpublic CharSequence getCurrentText()
FindAndReplaceTarget
getCurrentText in interface FindAndReplaceTargetpublic void showMessage(String message)
FindAndReplaceTargetFindAndReplace needs to provide some feedback to user. It will call this method to
show user a message. It's up to you how to implement it. In CodeEditor, we use a JidePopup to display a
tooltip-like popup near the caret. You can display a message in your status bar if you want.
showMessage in interface FindAndReplaceTargetmessage - the messagepublic void replaceAllStarts()
FindAndReplaceTarget
replaceAllStarts in interface FindAndReplaceTargetpublic void replaceAllEnds()
FindAndReplaceTarget
replaceAllEnds in interface FindAndReplaceTargetprotected void setTargetChanged(boolean targetChanged)
public boolean isTargetChanged()
FindAndReplaceTarget
isTargetChanged in interface FindAndReplaceTargetpublic void insertUpdate(DocumentEvent e)
insertUpdate in interface DocumentListenerpublic void removeUpdate(DocumentEvent e)
removeUpdate in interface DocumentListenerpublic void changedUpdate(DocumentEvent e)
changedUpdate in interface DocumentListenerpublic String getResourceString(String key)
FindAndReplaceTarget
getResourceString in interface FindAndReplaceTargetkey - the resource key
public Locale getLocale()
FindAndReplaceTarget
getLocale in interface FindAndReplaceTarget
|
JIDE 3.5.15 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||