📄 firstcharaction.java
字号:
package org.python.pydev.editor.actions;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.ui.texteditor.ITextEditor;
/**
* @author Fabio Zadrozny
*/
public class FirstCharAction extends PyAction {
/**
* Run to the first char (other than whitespaces) or to the real first char.
*/
public void run(IAction action) {
try{
ITextEditor textEditor = getTextEditor();
IDocument doc = textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput());
ITextSelection selection = (ITextSelection)textEditor.getSelectionProvider().getSelection();
boolean isAtFirstChar = isAtFirstVisibleChar(doc, selection.getOffset());
if (! isAtFirstChar){
gotoFirstVisibleChar(doc, selection.getOffset());
}else{
gotoFirstChar(doc, selection.getOffset());
}
}catch(Exception e){
beep(e);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -