use of com.kyj.fx.voeditor.visual.component.popup.TextSearchAndReplaceView in project Gargoyle by callakrsos.
the class CodeAreaFindAndReplaceHelper method findReplaceEvent.
/**
* 찾기 바꾸기 이벤트
*
* @작성자 : KYJ
* @작성일 : 2016. 10. 13.
* @param e
*/
protected void findReplaceEvent(Event e) {
if (e.isConsumed())
return;
ObservableValue<String> textProperty = codeArea.textProperty();
TextSearchAndReplaceView textSearchView = new TextSearchAndReplaceView(codeArea, textProperty);
textSearchView.setOnSearchResultListener((vo) -> {
switch(vo.getSearchType()) {
case SEARCH_SIMPLE:
{
int startIndex = vo.getStartIndex();
int endIndex = vo.getEndIndex();
codeArea.selectRange(startIndex, endIndex);
LOGGER.debug(String.format("find text : %s startIdx :%d endIdx :%d", vo.getSearchText(), startIndex, endIndex));
break;
}
case SEARCH_ALL:
{
int startIndex = vo.getStartIndex();
String searchText = vo.getSearchText();
String replaceText = vo.getReplaceText();
// codeArea.getUndoManager().mark();
// codeArea.replaceText(startIndex, (startIndex +
// searchText.length()), replaceText);
setContent(startIndex, startIndex + searchText.length(), replaceText);
break;
}
}
});
textSearchView.setOnReplaceResultListener(vo -> {
switch(vo.getReaplceType()) {
case SIMPLE:
{
String reaplceResult = vo.getReaplceResult();
setContent(reaplceResult);
break;
}
case ALL:
{
String reaplceResult = vo.getReaplceResult();
setContent(reaplceResult);
break;
}
}
});
textSearchView.setOnSelectionMoveListener(vo -> {
codeArea.selectRange(vo.getStartIndex(), vo.getEndIndex());
});
textSearchView.isSelectScopePropertyProperty().addListener((oba, oldval, newval) -> {
if (newval)
LOGGER.debug("User Select Locale Scope..");
else
LOGGER.debug("User Select Gloval Scope..");
});
codeArea.setOnMouseClicked(event -> {
IndexRange selection = codeArea.getSelection();
int start = selection.getStart();
textSearchView.setSlidingStartIndexProperty(start);
});
textSearchView.show();
// codeArea.setOnMouseClicked(defaultSelectionHandler);
e.consume();
}
use of com.kyj.fx.voeditor.visual.component.popup.TextSearchAndReplaceView in project Gargoyle by callakrsos.
the class PagedCodeAreaFindAndReplaceHelper method findReplaceEvent.
/**
* 찾기 바꾸기 이벤트
*
* @작성자 : KYJ
* @작성일 : 2016. 10. 13.
* @param e
*/
protected void findReplaceEvent(Event e) {
if (e.isConsumed())
return;
SimpleTextView currentPageView = view.getCurrentPageView();
CodeArea codeArea = currentPageView.getCodeArea();
ObservableValue<String> textProperty = codeArea.textProperty();
TextSearchAndReplaceView textSearchView = new TextSearchAndReplaceView(codeArea, textProperty);
textSearchView.setOnSearchResultListener((vo) -> {
switch(vo.getSearchType()) {
case SEARCH_SIMPLE:
{
int startIndex = vo.getStartIndex();
int endIndex = vo.getEndIndex();
codeArea.selectRange(startIndex, endIndex);
LOGGER.debug(String.format("find text : %s startIdx :%d endIdx :%d", vo.getSearchText(), startIndex, endIndex));
break;
}
case SEARCH_ALL:
{
int startIndex = vo.getStartIndex();
String searchText = vo.getSearchText();
String replaceText = vo.getReplaceText();
// codeArea.getUndoManager().mark();
// codeArea.replaceText(startIndex, (startIndex +
// searchText.length()), replaceText);
setContent(startIndex, startIndex + searchText.length(), replaceText);
break;
}
}
});
textSearchView.setOnReplaceResultListener(vo -> {
switch(vo.getReaplceType()) {
case SIMPLE:
{
String reaplceResult = vo.getReaplceResult();
setContent(reaplceResult);
break;
}
case ALL:
{
String reaplceResult = vo.getReaplceResult();
setContent(reaplceResult);
break;
}
}
});
textSearchView.setOnSelectionMoveListener(vo -> {
codeArea.selectRange(vo.getStartIndex(), vo.getEndIndex());
});
textSearchView.isSelectScopePropertyProperty().addListener((oba, oldval, newval) -> {
if (newval)
LOGGER.debug("User Select Locale Scope..");
else
LOGGER.debug("User Select Gloval Scope..");
});
codeArea.setOnMouseClicked(event -> {
IndexRange selection = codeArea.getSelection();
int start = selection.getStart();
textSearchView.setSlidingStartIndexProperty(start);
});
textSearchView.show();
// codeArea.setOnMouseClicked(defaultSelectionHandler);
e.consume();
}
Aggregations