當前位置: 首頁>>代碼示例>>Java>>正文


Java IntentionAction.getText方法代碼示例

本文整理匯總了Java中com.intellij.codeInsight.intention.IntentionAction.getText方法的典型用法代碼示例。如果您正苦於以下問題:Java IntentionAction.getText方法的具體用法?Java IntentionAction.getText怎麽用?Java IntentionAction.getText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.codeInsight.intention.IntentionAction的用法示例。


在下文中一共展示了IntentionAction.getText方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: assertIntentionIsAvailable

import com.intellij.codeInsight.intention.IntentionAction; //導入方法依賴的package包/類
public void assertIntentionIsAvailable(LanguageFileType languageFileType, String configureByText, String intentionText) {
    myFixture.configureByText(languageFileType, configureByText);
    PsiElement psiElement = myFixture.getFile().findElementAt(myFixture.getCaretOffset());

    Set<String> items = new HashSet<>();

    for (IntentionAction intentionAction : IntentionManager.getInstance().getIntentionActions()) {
        if(!intentionAction.isAvailable(getProject(), getEditor(), psiElement.getContainingFile())) {
            continue;
        }

        String text = intentionAction.getText();
        items.add(text);

        if(!text.equals(intentionText)) {
            continue;
        }

        return;
    }

    fail(String.format("Fail intention action '%s' is available in element '%s' with '%s'", intentionText, psiElement.getText(), items));
}
 
開發者ID:Haehnchen,項目名稱:idea-php-behat-plugin,代碼行數:24,代碼來源:BehatLightCodeInsightFixtureTestCase.java

示例2: doTestHighlightingAndGetQuickfix

import com.intellij.codeInsight.intention.IntentionAction; //導入方法依賴的package包/類
@Nullable
private IntentionAction doTestHighlightingAndGetQuickfix(@NotNull AndroidLintInspectionBase inspection,
                                                         @NotNull String message,
                                                         @NotNull String copyTo,
                                                         @NotNull String extension) throws IOException {
  doTestHighlighting(inspection, copyTo, extension);

  IntentionAction action = null;
  for (IntentionAction a : myFixture.getAvailableIntentions()) {
    String text = a.getText();
    if (message.equals(text)) {
      action = a;
    }
  }
  return action;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,代碼來源:AndroidLintTest.java

示例3: findIntentionByText

import com.intellij.codeInsight.intention.IntentionAction; //導入方法依賴的package包/類
@Nullable
public static IntentionAction findIntentionByText(@NotNull List<IntentionAction> actions, @NonNls @NotNull String text) {
  for (IntentionAction action : actions) {
    final String s = action.getText();
    if (s.equals(text)) {
      return action;
    }
  }
  return null;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:11,代碼來源:CodeInsightTestUtil.java

示例4: addActions

import com.intellij.codeInsight.intention.IntentionAction; //導入方法依賴的package包/類
private static void addActions(@NotNull Project project,
                               @NotNull Editor editor,
                               @NotNull PsiFile psiFile,
                               @Nullable AnAction action,
                               @NotNull List<HighlightInfo.IntentionActionDescriptor> descriptors,
                               @NotNull GutterIconRenderer renderer,
                               int order) {
  if (action == null) {
    return;
  }
  if (action instanceof ActionGroup) {
    AnAction[] children = ((ActionGroup)action).getChildren(null);
    for (int i = 0; i < children.length; i++) {
      AnAction child = children[i];
      addActions(project, editor, psiFile, child, descriptors, renderer, i + order);
    }
  }
  Icon icon = action.getTemplatePresentation().getIcon();
  if (icon == null) icon = renderer.getIcon();
  if (icon.getIconWidth() < 16) icon = IconUtil.toSize(icon, 16, 16);
  final IntentionAction gutterAction = new GutterIntentionAction(action, order, icon);
  if (!gutterAction.isAvailable(project, editor, psiFile)) return;
  HighlightInfo.IntentionActionDescriptor descriptor =
    new HighlightInfo.IntentionActionDescriptor(gutterAction, Collections.<IntentionAction>emptyList(), null, icon) {
      @Nullable
      @Override
      public String getDisplayName() {
        return gutterAction.getText();
      }
    };
  descriptors.add(descriptor);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:33,代碼來源:GutterIntentionAction.java

示例5: IntentionActionWithTextCaching

import com.intellij.codeInsight.intention.IntentionAction; //導入方法依賴的package包/類
private IntentionActionWithTextCaching(@NotNull IntentionAction action, String displayName, @Nullable Icon icon) {
  myIcon = icon;
  myText = action.getText();
  // needed for checking errors in user written actions
  //noinspection ConstantConditions
  LOG.assertTrue(myText != null, "action "+action.getClass()+" text returned null");
  myAction = action;
  myDisplayName = displayName;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:IntentionActionWithTextCaching.java

示例6: convertToFix

import com.intellij.codeInsight.intention.IntentionAction; //導入方法依賴的package包/類
@Override
@NotNull
public LocalQuickFix convertToFix(@NotNull final IntentionAction action) {
  if (action instanceof LocalQuickFix) {
    return (LocalQuickFix)action;
  }
  return new LocalQuickFix() {
    @Override
    @NotNull
    public String getName() {
      return action.getText();
    }

    @Override
    @NotNull
    public String getFamilyName() {
      return action.getFamilyName();
    }

    @Override
    public void applyFix(@NotNull final Project project, @NotNull final ProblemDescriptor descriptor) {
      final PsiFile psiFile = descriptor.getPsiElement().getContainingFile();
      try {
        action.invoke(project, new LazyEditor(psiFile), psiFile);
      }
      catch (IncorrectOperationException e) {
        LOG.error(e);
      }
    }
  };
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:32,代碼來源:IntentionManagerImpl.java

示例7: SpellCheckerIntentionAction

import com.intellij.codeInsight.intention.IntentionAction; //導入方法依賴的package包/類
public SpellCheckerIntentionAction(IntentionAction intention) {
  super(intention.getText());
  this.intention = intention;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:5,代碼來源:SpellingPopupActionGroup.java

示例8: fun

import com.intellij.codeInsight.intention.IntentionAction; //導入方法依賴的package包/類
@Override
public String fun(final IntentionAction intentionAction) {
  return "\"" + intentionAction.getText() + "\"";
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:5,代碼來源:CodeInsightTestFixtureImpl.java


注:本文中的com.intellij.codeInsight.intention.IntentionAction.getText方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。