本文整理汇总了Java中com.intellij.openapi.editor.actionSystem.EditorActionManager.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java EditorActionManager.getInstance方法的具体用法?Java EditorActionManager.getInstance怎么用?Java EditorActionManager.getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.editor.actionSystem.EditorActionManager
的用法示例。
在下文中一共展示了EditorActionManager.getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: performTypingAction
import com.intellij.openapi.editor.actionSystem.EditorActionManager; //导入方法依赖的package包/类
public static void performTypingAction(Editor editor, char c) {
EditorActionManager actionManager = EditorActionManager.getInstance();
if (c == BACKSPACE_FAKE_CHAR) {
executeAction(editor, IdeActions.ACTION_EDITOR_BACKSPACE);
} else if (c == SMART_ENTER_FAKE_CHAR) {
executeAction(editor, IdeActions.ACTION_EDITOR_COMPLETE_STATEMENT);
} else if (c == SMART_LINE_SPLIT_CHAR) {
executeAction(editor, IdeActions.ACTION_EDITOR_SPLIT);
}
else if (c == '\n') {
executeAction(editor, IdeActions.ACTION_EDITOR_ENTER);
}
else {
TypedAction action = actionManager.getTypedAction();
action.actionPerformed(editor, c, DataManager.getInstance().getDataContext(editor.getContentComponent()));
}
}
示例2: testTypeInEmptyConsole
import com.intellij.openapi.editor.actionSystem.EditorActionManager; //导入方法依赖的package包/类
public void testTypeInEmptyConsole() throws Exception {
final ConsoleViewImpl console = createConsole();
try {
console.clear();
EditorActionManager actionManager = EditorActionManager.getInstance();
final DataContext dataContext = DataManager.getInstance().getDataContext();
TypedAction action = actionManager.getTypedAction();
action.actionPerformed(console.getEditor(), 'h', dataContext);
assertEquals(1, console.getContentSize());
}
catch (Exception e) {
e.printStackTrace();
}
finally {
Disposer.dispose(console);
}
}
示例3: testTypingAfterMultipleCR
import com.intellij.openapi.editor.actionSystem.EditorActionManager; //导入方法依赖的package包/类
public void testTypingAfterMultipleCR() throws Exception {
final EditorActionManager actionManager = EditorActionManager.getInstance();
final TypedAction typedAction = actionManager.getTypedAction();
final TestDataProvider dataContext = new TestDataProvider(getProject());
final ConsoleViewImpl console = createConsole();
final Editor editor = console.getEditor();
try {
console.print("System output\n", ConsoleViewContentType.SYSTEM_OUTPUT);
console.print("\r\r\r\r\r\r\r", ConsoleViewContentType.NORMAL_OUTPUT);
console.flushDeferredText();
typedAction.actionPerformed(editor, '1', dataContext);
typedAction.actionPerformed(editor, '2', dataContext);
assertEquals("System output\n12", editor.getDocument().getText());
}
finally {
Disposer.dispose(console);
}
}
示例4: runPasteAction
import com.intellij.openapi.editor.actionSystem.EditorActionManager; //导入方法依赖的package包/类
private void runPasteAction(final String toPaste) {
final Producer<Transferable> producer = new Producer<Transferable>() {
@Nullable
@Override
public Transferable produce() {
return new StringSelection(toPaste);
}
};
EditorActionManager actionManager = EditorActionManager.getInstance();
EditorActionHandler pasteActionHandler = actionManager.getActionHandler(ACTION_EDITOR_PASTE);
final PasteHandler pasteHandler = new PasteHandler(pasteActionHandler);
new WriteCommandAction.Simple(getProject(), new PsiFile[0]) {
protected void run() throws Throwable {
Component component = myFixture.getEditor().getComponent();
DataContext dataContext = DataManager.getInstance().getDataContext(component);
pasteHandler.execute(myFixture.getEditor(), dataContext, producer);
}
}.execute();
}
开发者ID:platan,项目名称:idea-gradle-dependencies-formatter,代码行数:20,代码来源:MavenToGradleDependenciesCopyPasteProcessorTest.java
示例5: initComponent
import com.intellij.openapi.editor.actionSystem.EditorActionManager; //导入方法依赖的package包/类
@Override
public void initComponent() {
final EditorActionManager editorActionManager = EditorActionManager.getInstance();
final EditorFactory editorFactory = EditorFactory.getInstance();
particleContainerManager = new ParticleContainerManager();
editorFactory.addEditorFactoryListener(particleContainerManager, new Disposable() {
@Override
public void dispose() {
}
});
final TypedAction typedAction = editorActionManager.getTypedAction();
final TypedActionHandler rawHandler = typedAction.getRawHandler();
typedAction.setupRawHandler(new TypedActionHandler() {
@Override
public void execute(@NotNull final Editor editor, final char c, @NotNull final DataContext dataContext) {
updateEditor(editor);
rawHandler.execute(editor, c, dataContext);
}
});
}
示例6: setupHandlersForSpyware
import com.intellij.openapi.editor.actionSystem.EditorActionManager; //导入方法依赖的package包/类
private void setupHandlersForSpyware(ProgressObserver observer) {
observer.progress(0, 0.70, "Setting handlers");
final EditorActionManager actionManager = EditorActionManager.getInstance();
final TypedAction typedAction = actionManager.getTypedAction();
TypedActionHandler originalHandler = actionManager.getTypedAction().getHandler();
typedAction.setupHandler(new ActivateSpywareAction(originalHandler));
}
示例7: doEnter
import com.intellij.openapi.editor.actionSystem.EditorActionManager; //导入方法依赖的package包/类
@Override
public boolean doEnter(Editor editor, PsiElement psiElement, boolean isModified) {
PsiElement parent = psiElement.getParent();
if (!(parent instanceof PsiCodeBlock)) {
return false;
}
final ASTNode node = psiElement.getNode();
if (node != null && CONTROL_FLOW_ELEMENT_TYPES.contains(node.getElementType())) {
return false;
}
boolean leaveCodeBlock = isControlFlowBreak(psiElement);
if (!leaveCodeBlock) {
return false;
}
final int offset = parent.getTextRange().getEndOffset();
// Check if there is empty line after the code block. Just move caret there in the case of the positive answer.
final CharSequence text = editor.getDocument().getCharsSequence();
if (offset < text.length() - 1) {
final int i = CharArrayUtil.shiftForward(text, offset + 1, " \t");
if (i < text.length() && text.charAt(i) == '\n') {
editor.getCaretModel().moveToOffset(offset + 1);
EditorActionManager actionManager = EditorActionManager.getInstance();
EditorActionHandler actionHandler = actionManager.getActionHandler(IdeActions.ACTION_EDITOR_MOVE_LINE_END);
final DataContext dataContext = DataManager.getInstance().getDataContext(editor.getComponent());
if (dataContext != null) {
actionHandler.execute(editor, dataContext);
return true;
}
}
}
editor.getCaretModel().moveToOffset(offset);
return false;
}
示例8: type
import com.intellij.openapi.editor.actionSystem.EditorActionManager; //导入方法依赖的package包/类
public static void type(char c, @NotNull Editor editor, Project project) {
if (c == '\n') {
executeAction(IdeActions.ACTION_EDITOR_ENTER, editor,project);
}
else {
EditorActionManager actionManager = EditorActionManager.getInstance();
final DataContext dataContext = DataManager.getInstance().getDataContext();
TypedAction action = actionManager.getTypedAction();
action.actionPerformed(editor, c, dataContext);
}
}
示例9: initComponent
import com.intellij.openapi.editor.actionSystem.EditorActionManager; //导入方法依赖的package包/类
/**
* Replace the default key handling.
*/
public void initComponent ()
{
EditorActionManager manager = EditorActionManager.getInstance();
TypedAction action = manager.getTypedAction();
typed_handler = new SmartyTypedActionHandler(action.getHandler());
action.setupHandler(typed_handler);
}
示例10: disposeComponent
import com.intellij.openapi.editor.actionSystem.EditorActionManager; //导入方法依赖的package包/类
/**
* Restore the default key handling.
*/
public void disposeComponent ()
{
EditorActionManager manager = EditorActionManager.getInstance();
TypedAction action = manager.getTypedAction();
action.setupHandler(typed_handler.getOriginalTypedHandler());
}
示例11: type
import com.intellij.openapi.editor.actionSystem.EditorActionManager; //导入方法依赖的package包/类
protected static void type(char c, Editor editor) {
EditorActionManager actionManager = EditorActionManager.getInstance();
DataContext dataContext = DataManager.getInstance().getDataContext();
if (c == '\n') {
actionManager.getActionHandler(IdeActions.ACTION_EDITOR_ENTER).execute(editor, dataContext);
return;
}
TypedAction action = actionManager.getTypedAction();
action.actionPerformed(editor, c, dataContext);
}
示例12: type
import com.intellij.openapi.editor.actionSystem.EditorActionManager; //导入方法依赖的package包/类
protected static void type(char c) {
EditorActionManager actionManager = EditorActionManager.getInstance();
final DataContext dataContext = DataManager.getInstance().getDataContext();
if (c == '\n') {
actionManager.getActionHandler(IdeActions.ACTION_EDITOR_ENTER).execute(getEditor(), dataContext);
}
else if (c == '\b') {
actionManager.getActionHandler(IdeActions.ACTION_EDITOR_BACKSPACE).execute(getEditor(), dataContext);
}
else {
actionManager.getTypedAction().actionPerformed(getEditor(), c, dataContext);
}
}
示例13: type
import com.intellij.openapi.editor.actionSystem.EditorActionManager; //导入方法依赖的package包/类
protected static void type(char c, Editor editor)
{
EditorActionManager actionManager = EditorActionManager.getInstance();
DataContext dataContext = DataManager.getInstance().getDataContext();
if(c == '\n')
{
actionManager.getActionHandler(IdeActions.ACTION_EDITOR_ENTER).execute(editor, dataContext);
return;
}
TypedAction action = actionManager.getTypedAction();
action.actionPerformed(editor, c, dataContext);
}
示例14: performAction
import com.intellij.openapi.editor.actionSystem.EditorActionManager; //导入方法依赖的package包/类
private void performAction() {
EditorActionManager actionManager = EditorActionManager.getInstance();
EditorActionHandler actionHandler = actionManager.getActionHandler(IdeActions.ACTION_EDITOR_ENTER);
actionHandler.execute(myEditor, DataManager.getInstance().getDataContext());
}
示例15: performAction
import com.intellij.openapi.editor.actionSystem.EditorActionManager; //导入方法依赖的package包/类
private void performAction() {
EditorActionManager actionManager = EditorActionManager.getInstance();
EditorActionHandler actionHandler = actionManager.getActionHandler(IdeActions.ACTION_EDITOR_JOIN_LINES);
actionHandler.execute(getEditor(), DataManager.getInstance().getDataContext());
}