本文整理匯總了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));
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
}
};
}
示例7: SpellCheckerIntentionAction
import com.intellij.codeInsight.intention.IntentionAction; //導入方法依賴的package包/類
public SpellCheckerIntentionAction(IntentionAction intention) {
super(intention.getText());
this.intention = intention;
}
示例8: fun
import com.intellij.codeInsight.intention.IntentionAction; //導入方法依賴的package包/類
@Override
public String fun(final IntentionAction intentionAction) {
return "\"" + intentionAction.getText() + "\"";
}