use of org.eclipse.jface.text.TextViewer in project cubrid-manager by CUBRID.
the class UndoAction method run.
/**
* @see org.eclipse.jface.action.Action#run()
*/
public void run() {
Control control = getFocusProvider();
if (!(control instanceof StyledText)) {
return;
}
StyledText stext = (StyledText) control;
Object obj = stext.getData(SQLEditorComposite.SQL_EDITOR_FLAG);
if (obj instanceof TextViewer) {
TextViewer viewer = (TextViewer) obj;
if (viewer.getUndoManager() != null) {
viewer.getUndoManager().undo();
}
IAction redoAction = ActionManager.getInstance().getAction(RedoAction.ID);
FocusAction.changeActionStatus(redoAction, stext);
FocusAction.changeActionStatus(this, stext);
}
}
use of org.eclipse.jface.text.TextViewer in project cubrid-manager by CUBRID.
the class RedoAction method run.
/**
* @see org.eclipse.jface.action.Action#run()
*/
public void run() {
Control control = getFocusProvider();
if (!(control instanceof StyledText)) {
return;
}
StyledText stext = (StyledText) control;
Object obj = stext.getData(SQLEditorComposite.SQL_EDITOR_FLAG);
if (obj instanceof TextViewer) {
TextViewer viewer = (TextViewer) obj;
if (viewer.getUndoManager() != null) {
viewer.getUndoManager().redo();
}
IAction undoAction = ActionManager.getInstance().getAction(UndoAction.ID);
FocusAction.changeActionStatus(undoAction, stext);
IAction copyAction = ActionManager.getInstance().getAction(CopyAction.ID);
FocusAction.changeActionStatus(copyAction, stext);
FocusAction.changeActionStatus(this, stext);
}
}
use of org.eclipse.jface.text.TextViewer in project cubrid-manager by CUBRID.
the class RedoAction method focusGained.
/**
* Notifies that the focus gained event
*
* @param event an event containing information about the focus change
*/
public void focusGained(FocusEvent event) {
setEnabled(false);
if (event.getSource() instanceof StyledText) {
StyledText stext = (StyledText) event.getSource();
Object obj = stext.getData(SQLEditorComposite.SQL_EDITOR_FLAG);
boolean isEnabled = obj instanceof TextViewer;
if (isEnabled) {
TextViewer viewer = (TextViewer) obj;
isEnabled = viewer.getUndoManager() != null && viewer.getUndoManager().redoable();
}
setEnabled(isEnabled);
}
}
use of org.eclipse.jface.text.TextViewer in project cubrid-manager by CUBRID.
the class FindReplaceAction method focusGained.
/**
* Notifies that the focus gained event
*
* @param event an event containing information about the focus change
*/
public void focusGained(FocusEvent event) {
setEnabled(false);
if (event.getSource() instanceof StyledText) {
StyledText stext = (StyledText) event.getSource();
Object obj = stext.getData(SQLEditorComposite.SQL_EDITOR_FLAG);
setEnabled(obj instanceof TextViewer);
}
}
use of org.eclipse.jface.text.TextViewer in project cubrid-manager by CUBRID.
the class TextEditorFindReplaceMediator method findPrevious.
/**
*
* Find previous searched string
*
* @return boolean
*/
public static boolean findPrevious() {
TextViewer st = getCurrentTextEditor();
if (st == null) {
return false;
}
String searchedStr = st.getTextWidget().getSelectionText();
if (searchedStr == null || searchedStr.trim().length() == 0) {
return false;
}
FindReplaceOption findReplaceOption = new FindReplaceOption();
findReplaceOption.setSearchedStr(searchedStr);
return findAndSelect(st.getTextWidget().getCaretOffset(), false, findReplaceOption) >= 0;
}
Aggregations