• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TypedAction类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.openapi.editor.actionSystem.TypedAction的典型用法代码示例。如果您正苦于以下问题:Java TypedAction类的具体用法?Java TypedAction怎么用?Java TypedAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TypedAction类属于com.intellij.openapi.editor.actionSystem包,在下文中一共展示了TypedAction类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: performTypingAction

import com.intellij.openapi.editor.actionSystem.TypedAction; //导入依赖的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()));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:EditorTestUtil.java


示例2: testRuby7852ErrantEditor

import com.intellij.openapi.editor.actionSystem.TypedAction; //导入依赖的package包/类
public void testRuby7852ErrantEditor() {
  myFixture.configureByText(FileTypes.PLAIN_TEXT, "\"aaa\"\nbbb\n\n");
  myFixture.getEditor().getCaretModel().moveToOffset(0);
  myFixture.getEditor().getSelectionModel().setSelection(0, 5);
  final TypedAction typedAction = EditorActionManager.getInstance().getTypedAction();
  performAction(myFixture.getProject(), new Runnable() {
    @Override
    public void run() {
      typedAction.actionPerformed(myFixture.getEditor(), '\'', ((EditorEx)myFixture.getEditor()).getDataContext());
    }
  });
  myFixture.getEditor().getSelectionModel().removeSelection();
  myFixture.checkResult("'aaa'\nbbb\n\n");

  myFixture.getEditor().getCaretModel().moveToOffset(myFixture.getEditor().getDocument().getLineStartOffset(3));
  performAction(myFixture.getProject(), new Runnable() {
    @Override
    public void run() {
      typedAction.actionPerformed(myFixture.getEditor(), 'A', ((EditorEx)myFixture.getEditor()).getDataContext());
      typedAction.actionPerformed(myFixture.getEditor(), 'B', ((EditorEx)myFixture.getEditor()).getDataContext());
    }
  });
  myFixture.checkResult("'aaa'\nbbb\n\nAB");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:SelectionQuotingTypedHandlerTest.java


示例3: testTypeInEmptyConsole

import com.intellij.openapi.editor.actionSystem.TypedAction; //导入依赖的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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ConsoleViewImplTest.java


示例4: testTypingAfterMultipleCR

import com.intellij.openapi.editor.actionSystem.TypedAction; //导入依赖的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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ConsoleViewImplTest.java


示例5: initComponent

import com.intellij.openapi.editor.actionSystem.TypedAction; //导入依赖的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);
        }
    });
}
 
开发者ID:baptistemesta,项目名称:power-mode-intellij-plugin,代码行数:23,代码来源:PowerMode.java


示例6: doTest

import com.intellij.openapi.editor.actionSystem.TypedAction; //导入依赖的package包/类
private void doTest(@NotNull final String cs, @NotNull String before, @NotNull String expected) {
  final boolean smarterSelection = Registry.is("editor.smarterSelectionQuoting");
  Registry.get("editor.smarterSelectionQuoting").setValue(true);
  try {
    myFixture.configureByText(FileTypes.PLAIN_TEXT, before);
    final TypedAction typedAction = EditorActionManager.getInstance().getTypedAction();

    performAction(myFixture.getProject(), new Runnable() {
      @Override
      public void run() {
        for (int i = 0, max = cs.length(); i < max; i++) {
          final char c = cs.charAt(i);
          typedAction.actionPerformed(myFixture.getEditor(), c, ((EditorEx)myFixture.getEditor()).getDataContext());
        }
      }
    });
    myFixture.checkResult(expected);
  } finally {
    Registry.get("editor.smarterSelectionQuoting").setValue(smarterSelection);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:SelectionQuotingTypedHandlerTest.java


示例7: doTest

import com.intellij.openapi.editor.actionSystem.TypedAction; //导入依赖的package包/类
private void doTest(@Nonnull final String cs, @Nonnull String before, @Nonnull String expected) {
  final boolean smarterSelection = Registry.is("editor.smarterSelectionQuoting");
  Registry.get("editor.smarterSelectionQuoting").setValue(true);
  try {
    myFixture.configureByText(PlainTextFileType.INSTANCE, before);
    final TypedAction typedAction = EditorActionManager.getInstance().getTypedAction();

    performAction(myFixture.getProject(), new Runnable() {
      @Override
      public void run() {
        for (int i = 0, max = cs.length(); i < max; i++) {
          final char c = cs.charAt(i);
          typedAction.actionPerformed(myFixture.getEditor(), c, ((EditorEx)myFixture.getEditor()).getDataContext());
        }
      }
    });
    myFixture.checkResult(expected);
  } finally {
    Registry.get("editor.smarterSelectionQuoting").setValue(smarterSelection);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:SelectionQuotingTypedHandlerTest.java


示例8: testRuby7852ErrantEditor

import com.intellij.openapi.editor.actionSystem.TypedAction; //导入依赖的package包/类
public void testRuby7852ErrantEditor() {
  myFixture.configureByText(PlainTextFileType.INSTANCE, "\"aaa\"\nbbb\n\n");
  myFixture.getEditor().getCaretModel().moveToOffset(0);
  myFixture.getEditor().getSelectionModel().setSelection(0, 5);
  final TypedAction typedAction = EditorActionManager.getInstance().getTypedAction();
  performAction(myFixture.getProject(), new Runnable() {
    @Override
    public void run() {
      typedAction.actionPerformed(myFixture.getEditor(), '\'', ((EditorEx)myFixture.getEditor()).getDataContext());
    }
  });
  myFixture.getEditor().getSelectionModel().removeSelection();
  myFixture.checkResult("'aaa'\nbbb\n\n");

  myFixture.getEditor().getCaretModel().moveToOffset(myFixture.getEditor().getDocument().getLineStartOffset(3));
  performAction(myFixture.getProject(), new Runnable() {
    @Override
    public void run() {
      typedAction.actionPerformed(myFixture.getEditor(), 'A', ((EditorEx)myFixture.getEditor()).getDataContext());
      typedAction.actionPerformed(myFixture.getEditor(), 'B', ((EditorEx)myFixture.getEditor()).getDataContext());
    }
  });
  myFixture.checkResult("'aaa'\nbbb\n\nAB");
}
 
开发者ID:consulo,项目名称:consulo,代码行数:25,代码来源:SelectionQuotingTypedHandlerTest.java


示例9: setupHandlersForSpyware

import com.intellij.openapi.editor.actionSystem.TypedAction; //导入依赖的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));
}
 
开发者ID:testmycode,项目名称:tmc-intellij,代码行数:8,代码来源:StartupEvent.java


示例10: type

import com.intellij.openapi.editor.actionSystem.TypedAction; //导入依赖的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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:LightPlatformCodeInsightTestCase.java


示例11: playBack

import com.intellij.openapi.editor.actionSystem.TypedAction; //导入依赖的package包/类
public void playBack(DataContext context) {
  Editor editor = CommonDataKeys.EDITOR.getData(context);
  final TypedAction typedAction = EditorActionManager.getInstance().getTypedAction();
  for (final char aChar : myText.toCharArray()) {
    typedAction.actionPerformed(editor, aChar, context);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:ActionMacro.java


示例12: doTest

import com.intellij.openapi.editor.actionSystem.TypedAction; //导入依赖的package包/类
private void doTest(@NotNull final String cs, @NotNull String before, @NotNull String expected) {
  myFixture.configureByText(FileTypes.PLAIN_TEXT, before);
  final TypedAction typedAction = EditorActionManager.getInstance().getTypedAction();

  performAction(myFixture.getProject(), new Runnable() {
    @Override
    public void run() {
      for (int i = 0, max = cs.length(); i < max; i++) {
        final char c = cs.charAt(i);
        typedAction.actionPerformed(myFixture.getEditor(), c, ((EditorEx)myFixture.getEditor()).getDataContext());
      }
    }
  });
  myFixture.checkResult(expected);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:SelectionQuotingTypedHandlerTest.java


示例13: initComponent

import com.intellij.openapi.editor.actionSystem.TypedAction; //导入依赖的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);
}
 
开发者ID:mollie,项目名称:PhpStorm,代码行数:12,代码来源:SmartyTypedActionHandlerComponent.java


示例14: disposeComponent

import com.intellij.openapi.editor.actionSystem.TypedAction; //导入依赖的package包/类
/**
 * Restore the default key handling.
 */
public void disposeComponent ()
{
	EditorActionManager manager = EditorActionManager.getInstance();
	TypedAction action          = manager.getTypedAction();

	action.setupHandler(typed_handler.getOriginalTypedHandler());
}
 
开发者ID:mollie,项目名称:PhpStorm,代码行数:11,代码来源:SmartyTypedActionHandlerComponent.java


示例15: type

import com.intellij.openapi.editor.actionSystem.TypedAction; //导入依赖的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);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:11,代码来源:CodeInsightTestCase.java


示例16: playBack

import com.intellij.openapi.editor.actionSystem.TypedAction; //导入依赖的package包/类
public void playBack(DataContext context) {
  Editor editor = PlatformDataKeys.EDITOR.getData(context);
  final TypedAction typedAction = EditorActionManager.getInstance().getTypedAction();
  for (final char aChar : myText.toCharArray()) {
    typedAction.actionPerformed(editor, aChar, context);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:8,代码来源:ActionMacro.java


示例17: playBack

import com.intellij.openapi.editor.actionSystem.TypedAction; //导入依赖的package包/类
public void playBack(DataContext context) {
  Editor editor = context.getData(PlatformDataKeys.EDITOR);
  final TypedAction typedAction = EditorActionManager.getInstance().getTypedAction();
  for (final char aChar : myText.toCharArray()) {
    typedAction.actionPerformed(editor, aChar, context);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:8,代码来源:ActionMacro.java


示例18: type

import com.intellij.openapi.editor.actionSystem.TypedAction; //导入依赖的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);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:13,代码来源:CodeInsightTestCase.java


示例19: EmptyAutoPopup

import com.intellij.openapi.editor.actionSystem.TypedAction; //导入依赖的package包/类
public EmptyAutoPopup(CompletionProgressIndicator indicator) {
  super(indicator);
  editor = indicator.getEditor();
  project = indicator.getProject();
  MessageBusConnection connection = project.getMessageBus().connect(this);
  connection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerAdapter() {
    @Override
    public void selectionChanged(@NotNull FileEditorManagerEvent event) {
      stopAutoPopup();
    }
  });

  mouseListener = new EditorMouseAdapter() {
    @Override
    public void mouseClicked(EditorMouseEvent e) {
      stopAutoPopup();
    }
  };

  caretListener = new CaretListener() {
    @Override
    public void caretPositionChanged(CaretEvent e) {
      if (!TypedAction.isTypedActionInProgress()) {
        stopAutoPopup();
      }
    }
  };
  selectionListener = new SelectionListener() {
    @Override
    public void selectionChanged(SelectionEvent e) {
      stopAutoPopup();
    }
  };

  editor.addEditorMouseListener(mouseListener);
  editor.getCaretModel().addCaretListener(caretListener);
  editor.getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    public void documentChanged(DocumentEvent e) {
      if (!TypedAction.isTypedActionInProgress()) {
        stopAutoPopup();
      }
    }
  }, this);
  editor.getSelectionModel().addSelectionListener(selectionListener);
  LookupManager.getInstance(project).addPropertyChangeListener(new PropertyChangeListener() {
    @Override
    public void propertyChange(PropertyChangeEvent evt) {
      stopAutoPopup();
    }
  }, this);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:53,代码来源:CompletionPhase.java


示例20: moduleAdded

import com.intellij.openapi.editor.actionSystem.TypedAction; //导入依赖的package包/类
public void moduleAdded() {
    EditorActionManager manager = EditorActionManager.getInstance();
    TypedAction typedAction = manager.getTypedAction();
    typedAction.setupHandler(new EncloseTypedAction(typedAction.getHandler()));
}
 
开发者ID:lexand,项目名称:enclosing-jidea-plugin,代码行数:6,代码来源:EnclosingMod.java



注:本文中的com.intellij.openapi.editor.actionSystem.TypedAction类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java StreamWriterBufferProcessor类代码示例发布时间:2022-05-23
下一篇:
Java AxisRenderer类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap