当前位置: 首页>>代码示例>>Java>>正文


Java IdeActions类代码示例

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


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

示例1: calculateOverridingSiblingMethodTooltip

import com.intellij.openapi.actionSystem.IdeActions; //导入依赖的package包/类
@Nullable
private static String calculateOverridingSiblingMethodTooltip(@NotNull PsiMethod method) {
  Pair<PsiMethod, PsiClass> pair =
    FindSuperElementsHelper.getSiblingInheritedViaSubClass(method, FindSuperElementsHelper.createSubClassCache());
  if (pair == null) return null;
  PsiMethod superMethod = pair.getFirst();
  PsiClass subClass = pair.getSecond();
  boolean isAbstract = method.hasModifierProperty(PsiModifier.ABSTRACT);
  boolean isSuperAbstract = superMethod.hasModifierProperty(PsiModifier.ABSTRACT);

  String postfix = MessageFormat.format(" via sub-class <a href=\"#javaClass/{0}\">{0}</a>", ClassPresentationUtil.getNameForClass(subClass, true));
  @NonNls String pattern = DaemonBundle.message(isSuperAbstract && !isAbstract ?
                                                "method.implements" :
                                                "method.overrides") + postfix;
  return composeText(new PsiElement[]{superMethod}, "", pattern, IdeActions.ACTION_GOTO_SUPER);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:MarkerType.java

示例2: getOverriddenMethodTooltip

import com.intellij.openapi.actionSystem.IdeActions; //导入依赖的package包/类
private static String getOverriddenMethodTooltip(@NotNull PsiMethod method) {
  PsiElementProcessor.CollectElementsWithLimit<PsiMethod> processor = new PsiElementProcessor.CollectElementsWithLimit<PsiMethod>(5);
  OverridingMethodsSearch.search(method, true).forEach(new PsiElementProcessorAdapter<PsiMethod>(processor));

  boolean isAbstract = method.hasModifierProperty(PsiModifier.ABSTRACT);

  if (processor.isOverflow()){
    return isAbstract ? DaemonBundle.message("method.is.implemented.too.many") : DaemonBundle.message("method.is.overridden.too.many");
  }

  PsiMethod[] overridings = processor.toArray(PsiMethod.EMPTY_ARRAY);
  if (overridings.length == 0) {
    final PsiClass aClass = method.getContainingClass();
    if (aClass != null && FunctionalExpressionSearch.search(aClass).findFirst() != null) {
      return "Has functional implementations";
    }
    return null;
  }

  Comparator<PsiMethod> comparator = new MethodCellRenderer(false).getComparator();
  Arrays.sort(overridings, comparator);

  String start = isAbstract ? DaemonBundle.message("method.is.implemented.header") : DaemonBundle.message("method.is.overriden.header");
  @NonNls String pattern = "&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"#javaClass/{1}\">{1}</a>";
  return composeText(overridings, start, pattern, IdeActions.ACTION_GOTO_IMPLEMENTATION);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:MarkerType.java

示例3: testResolvedDtdElementReferences

import com.intellij.openapi.actionSystem.IdeActions; //导入依赖的package包/类
public void testResolvedDtdElementReferences() throws Exception {
  configureByFile(BASE_PATH + getTestName(false)+".dtd");
  doDoTest(true, false);

  final String text = myEditor.getDocument().getText();
  WriteCommandAction.runWriteCommandAction(null, new Runnable() {
    @Override
    public void run() {
      myEditor.getSelectionModel().setSelection(0, myEditor.getDocument().getTextLength());
    }
  });

  AnAction action = ActionManager.getInstance().getAction(IdeActions.ACTION_COMMENT_BLOCK);
  action.actionPerformed(AnActionEvent.createFromAnAction(action, null, "", DataManager.getInstance().getDataContext()));
  assertNotSame(text,myEditor.getDocument().getText());
  PsiDocumentManager.getInstance(myProject).commitDocument(myEditor.getDocument());
  Collection<HighlightInfo> infos = doHighlighting();
  assertEquals(0, infos.size());

  action.actionPerformed(AnActionEvent.createFromAnAction(action, null, "", DataManager.getInstance().getDataContext()));
  assertEquals(text,myEditor.getDocument().getText().trim());
  PsiDocumentManager.getInstance(myProject).commitDocument(myEditor.getDocument());
  infos = doHighlighting();
  assertEquals(0, infos.size());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:XmlHighlightingTest.java

示例4: createTrees

import com.intellij.openapi.actionSystem.IdeActions; //导入依赖的package包/类
@Override
protected void createTrees(@NotNull final Map<String, JTree> type2TreeMap) {
  ActionGroup group = (ActionGroup)ActionManager.getInstance().getAction(IdeActions.GROUP_CALL_HIERARCHY_POPUP);
  final JTree tree1 = createTree(false);
  PopupHandler.installPopupHandler(tree1, group, ActionPlaces.CALL_HIERARCHY_VIEW_POPUP, ActionManager.getInstance());
  final BaseOnThisMethodAction baseOnThisMethodAction = new BaseOnThisMethodAction();
  baseOnThisMethodAction
    .registerCustomShortcutSet(ActionManager.getInstance().getAction(IdeActions.ACTION_CALL_HIERARCHY).getShortcutSet(), tree1);
  type2TreeMap.put(CALLEE_TYPE, tree1);

  final JTree tree2 = createTree(false);
  PopupHandler.installPopupHandler(tree2, group, ActionPlaces.CALL_HIERARCHY_VIEW_POPUP, ActionManager.getInstance());
  baseOnThisMethodAction
    .registerCustomShortcutSet(ActionManager.getInstance().getAction(IdeActions.ACTION_CALL_HIERARCHY).getShortcutSet(), tree2);
  type2TreeMap.put(CALLER_TYPE, tree2);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:CallHierarchyBrowser.java

示例5: testNoCompletion

import com.intellij.openapi.actionSystem.IdeActions; //导入依赖的package包/类
public void testNoCompletion() throws Exception {
  String text = "abc abd a<caret> abx";
  myFixture.configureByText("x.txt", text);
  int offset = myFixture.getEditor().getCaretModel().getOffset();
  createGuard(offset - 1, myFixture.getFile().getTextLength()).setGreedyToRight(true);

  assertNull(myFixture.completeBasic());
  myFixture.checkResult(text);

  //no hippie completion
  myFixture.performEditorAction(IdeActions.ACTION_HIPPIE_BACKWARD_COMPLETION);
  assertNull(LookupManager.getInstance(getProject()).getActiveLookup());
  myFixture.checkResult(text);
  
  //no completion at the file end
  myFixture.getEditor().getCaretModel().moveToOffset(myFixture.getFile().getTextLength());
  assertNull(myFixture.completeBasic());
  myFixture.checkResult("abc abd a abx<caret>");

  //completion at the beginning of the guard fragment
  myFixture.getEditor().getCaretModel().moveToOffset(offset - 1);
  assertNotNull(myFixture.completeBasic());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:GuardBlockTest.java

示例6: createTabbedPaneWrapper

import com.intellij.openapi.actionSystem.IdeActions; //导入依赖的package包/类
@NotNull
private TabbedPaneWrapper.AsJBTabs createTabbedPaneWrapper(FileEditor[] editors) {
  PrevNextActionsDescriptor descriptor = new PrevNextActionsDescriptor(IdeActions.ACTION_NEXT_EDITOR_TAB, IdeActions.ACTION_PREVIOUS_EDITOR_TAB);
  final TabbedPaneWrapper.AsJBTabs wrapper = new TabbedPaneWrapper.AsJBTabs(myFileEditorManager.getProject(), SwingConstants.BOTTOM, descriptor, this);
  wrapper.getTabs().getPresentation().setPaintBorder(0, 0, 0, 0).setTabSidePaintBorder(1).setGhostsAlwaysVisible(true).setUiDecorator(new UiDecorator() {
    @Override
    @NotNull
    public UiDecoration getDecoration() {
      return new UiDecoration(null, new Insets(0, 8, 0, 8));
    }
  });
  wrapper.getTabs().getComponent().setBorder(new EmptyBorder(0, 0, 1, 0));

  boolean firstEditor = true;
  for (FileEditor editor : editors) {
    JComponent component = firstEditor && myComponent != null ? (JComponent)myComponent.getComponent(0) : createEditorComponent(editor);
    wrapper.addTab(getDisplayName(editor), component);
    firstEditor = false;
  }
  wrapper.addChangeListener(new MyChangeListener());

  return wrapper;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:EditorComposite.java

示例7: doTest

import com.intellij.openapi.actionSystem.IdeActions; //导入依赖的package包/类
private void doTest(String prefix) {
  int oldReformat = CodeInsightSettings.getInstance().REFORMAT_ON_PASTE;
  try {
    CodeInsightSettings.getInstance().REFORMAT_ON_PASTE = CodeInsightSettings.NO_REFORMAT;
    String name = getTestName(false);

    myFixture.configureByFile("copyPaste/" + prefix + name + ".src.py");
    myFixture.performEditorAction(IdeActions.ACTION_EDITOR_COPY);
    myFixture.configureByFile("copyPaste/" + prefix + name + ".dst.py");
    myFixture.performEditorAction(IdeActions.ACTION_EDITOR_PASTE);
    myFixture.checkResultByFile("copyPaste/" + prefix + name + ".after.py", true);
  }
  finally {
    CodeInsightSettings.getInstance().REFORMAT_ON_PASTE = oldReformat;
  }

}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:PyCopyPasteTest.java

示例8: createDefaultFileSystemActions

import com.intellij.openapi.actionSystem.IdeActions; //导入依赖的package包/类
public DefaultActionGroup createDefaultFileSystemActions(FileSystemTree fileSystemTree) {
  DefaultActionGroup group = new DefaultActionGroup();
  final ActionManager actionManager = ActionManager.getInstance();
  group.add(actionManager.getAction("FileChooser.GotoHome"));
  group.add(actionManager.getAction("FileChooser.GotoProject"));
  group.addSeparator();
  group.add(actionManager.getAction("FileChooser.NewFolder"));
  group.add(actionManager.getAction("FileChooser.Delete"));
  group.addSeparator();
  SynchronizeAction action1 = new SynchronizeAction();
  AnAction original = actionManager.getAction(IdeActions.ACTION_SYNCHRONIZE);
  action1.copyFrom(original);
  action1.registerCustomShortcutSet(original.getShortcutSet(), fileSystemTree.getTree());
  group.add(action1);
  group.addSeparator();
  group.add(actionManager.getAction("FileChooser.ShowHiddens"));

  return group;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:FileSystemTreeFactoryImpl.java

示例9: executeWriteAction

import com.intellij.openapi.actionSystem.IdeActions; //导入依赖的package包/类
@Override
public void executeWriteAction(@NotNull Editor editor, Caret caret, DataContext dataContext) {
  final Document document = editor.getDocument();
  final int caretOffset = editor.getCaretModel().getOffset();
  if (caretOffset < 1) {
    return;
  }

  final SelectionModel selectionModel = editor.getSelectionModel();
  final CharSequence text = document.getCharsSequence();
  final char c = text.charAt(caretOffset - 1);
  if (!selectionModel.hasSelection() && StringUtil.isWhiteSpace(c)) {
    int startOffset = CharArrayUtil.shiftBackward(text, caretOffset - 2, "\t \n") + 1;
    document.deleteString(startOffset, caretOffset);
  }
  else {
    final EditorActionHandler handler = EditorActionManager.getInstance().getActionHandler(IdeActions.ACTION_EDITOR_BACKSPACE);
    handler.execute(editor, caret, dataContext);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:HungryBackspaceAction.java

示例10: getPasteAction

import com.intellij.openapi.actionSystem.IdeActions; //导入依赖的package包/类
@NotNull
@Override
protected AnAction getPasteAction(@NotNull final Editor editor, boolean recreateCaretsAction) {
    if (recreateCaretsAction) {
        return new DuplicateForClipboardCaretsAction(true,true);
    } else {
        return ActionManager.getInstance().getAction(IdeActions.ACTION_PASTE);
    }
}
 
开发者ID:vsch,项目名称:MissingInActions,代码行数:10,代码来源:MiaMultiplePasteAction.java

示例11: initActions

import com.intellij.openapi.actionSystem.IdeActions; //导入依赖的package包/类
@Override
public void initActions(RunContentDescriptor content, DefaultActionGroup actionGroup) {
  Executor executor = myExecutionEnvironment.getExecutor();
  actionGroup.add(ActionManager.getInstance().getAction(IdeActions.ACTION_RERUN), Constraints.FIRST);

  actionGroup.add(new CloseAction(executor, content, myExecutionEnvironment.getProject()));
  actionGroup.add(new ContextHelpAction(executor.getHelpId()));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:DefaultDebugUIEnvironment.java

示例12: handleEmptyLookup

import com.intellij.openapi.actionSystem.IdeActions; //导入依赖的package包/类
@Override
public String handleEmptyLookup(@NotNull final CompletionParameters parameters, final Editor editor) {
  if (!(parameters.getOriginalFile() instanceof PsiJavaFile)) return null;

  if (shouldShowSecondSmartCompletionHint(parameters)) {
    return LangBundle.message("completion.no.suggestions") +
           "; " +
           StringUtil.decapitalize(
               CompletionBundle.message("completion.class.name.hint.2", getActionShortcut(IdeActions.ACTION_CODE_COMPLETION)));
  }

  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:JavaClassNameCompletionContributor.java

示例13: fillCompletionVariants

import com.intellij.openapi.actionSystem.IdeActions; //导入依赖的package包/类
@Override
public void fillCompletionVariants(@NotNull CompletionParameters parameters, @NotNull CompletionResultSet result) {
  PsiElement position = parameters.getPosition();
  JavaClassReference reference = findJavaClassReference(position.getContainingFile(), parameters.getOffset());
  if (reference == null) {
    return;
  }

  String[] extendClassNames = reference.getExtendClassNames();
  PsiElement context = reference.getCompletionContext();
  if (extendClassNames != null && context instanceof PsiPackage) {
    if (parameters.getCompletionType() == CompletionType.SMART) {
      JavaClassReferenceSet set = reference.getJavaClassReferenceSet();
      int setStart = set.getRangeInElement().getStartOffset() + set.getElement().getTextRange().getStartOffset();
      String fullPrefix = parameters.getPosition().getContainingFile().getText().substring(setStart, parameters.getOffset());
      reference.processSubclassVariants((PsiPackage)context, extendClassNames, result.withPrefixMatcher(fullPrefix));
      return;
    }
    result.addLookupAdvertisement("Press " + getActionShortcut(IdeActions.ACTION_SMART_TYPE_COMPLETION) + " to see inheritors of " +
                                  StringUtil.join(extendClassNames, ", "));
  }

  if (parameters.getCompletionType() == CompletionType.SMART) {
    return;
  }

  if (parameters.isExtendedCompletion() || parameters.getCompletionType() == CompletionType.CLASS_NAME) {
    JavaClassNameCompletionContributor.addAllClasses(parameters, result);
  }
  else {
    LegacyCompletionContributor.completeReference(parameters, result);
  }
  result.stopHere();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:35,代码来源:JavaClassReferenceCompletionContributor.java

示例14: renderElement

import com.intellij.openapi.actionSystem.IdeActions; //导入依赖的package包/类
@Override
public void renderElement(LookupElementPresentation presentation) {
  super.renderElement(presentation);
  char shortcut = getTemplateShortcut();
  presentation.setItemText(getItemText());
  if (sudden) {
    presentation.setItemTextBold(true);
    if (!presentation.isReal() || !((RealLookupElementPresentation)presentation).isLookupSelectionTouched()) {
      if (shortcut == TemplateSettings.DEFAULT_CHAR) {
        shortcut = TemplateSettings.getInstance().getDefaultShortcutChar();
      }
      if (shortcut != TemplateSettings.CUSTOM_CHAR) {
        presentation.setTypeText("  [" + KeyEvent.getKeyText(shortcut) + "] ");
      } else {
        String shortcutText =
          KeymapUtil.getFirstKeyboardShortcutText(ActionManager.getInstance().getAction(IdeActions.ACTION_EXPAND_LIVE_TEMPLATE_CUSTOM));
        if (StringUtil.isNotEmpty(shortcutText)) {
          presentation.setTypeText("  [" + shortcutText + "] ");
        }
      }
    }
    if (StringUtil.isNotEmpty(myDescription)) {
      presentation.setTailText(" (" + myDescription + ")", true);
    }
  }
  else {
    presentation.setTypeText(myDescription);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:LiveTemplateLookupElement.java

示例15: showHint

import com.intellij.openapi.actionSystem.IdeActions; //导入依赖的package包/类
private void showHint(boolean shouldImport) {
  if (!myHintShown && !shouldImport) {
    final String shortcut = CompletionContributor.getActionShortcut(IdeActions.ACTION_SHOW_INTENTION_ACTIONS);
    if (shortcut != null) {
      CompletionService.getCompletionService().setAdvertisementText("To import a method statically, press " + shortcut);
    }
    myHintShown = true;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:StaticMemberProcessor.java


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