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


Java QuickFixBundle类代码示例

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


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

示例1: ExtendsListFix

import com.intellij.codeInsight.daemon.QuickFixBundle; //导入依赖的package包/类
private ExtendsListFix(@NotNull PsiClass aClass,
                       PsiClass classToExtendFrom,
                       @NotNull PsiClassType typeToExtendFrom,
                       boolean toAdd) {
  super(aClass);
  myClassToExtendFrom = classToExtendFrom;
  myToAdd = toAdd;
  myTypeToExtendFrom = (PsiClassType)GenericsUtil.eliminateWildcards(typeToExtendFrom);

  @NonNls final String messageKey;
  if (classToExtendFrom != null && aClass.isInterface() == classToExtendFrom.isInterface()) {
    messageKey = toAdd ? "add.class.to.extends.list" : "remove.class.from.extends.list";
  }
  else {
    messageKey = toAdd ? "add.interface.to.implements.list" : "remove.interface.from.implements.list";
  }

  myName = QuickFixBundle.message(messageKey, aClass.getName(), classToExtendFrom == null ? "" : classToExtendFrom instanceof PsiTypeParameter ? classToExtendFrom.getName()
                                                                                                                                               : classToExtendFrom.getQualifiedName());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ExtendsListFix.java

示例2: VariableArrayTypeFix

import com.intellij.codeInsight.daemon.QuickFixBundle; //导入依赖的package包/类
public VariableArrayTypeFix(@NotNull PsiArrayInitializerExpression initializer, @NotNull PsiType componentType) {
  super(getInitializer(initializer));
  PsiArrayType arrayType = new PsiArrayType(componentType);
  PsiArrayInitializerExpression arrayInitializer = initializer;
  while (arrayInitializer.getParent() instanceof PsiArrayInitializerExpression) {
    arrayInitializer = (PsiArrayInitializerExpression)arrayInitializer.getParent();
    arrayType = new PsiArrayType(arrayType);
  }
  myTargetType = arrayType;

  PsiExpression myNewExpression = getNewExpressionLocal(arrayInitializer);
  PsiVariable myVariable = getVariableLocal(arrayInitializer);
  myName = myVariable == null ? null : myTargetType.equals(myVariable.getType()) && myNewExpression != null ?
           QuickFixBundle.message("change.new.operator.type.text", getNewText(myNewExpression,arrayInitializer), myTargetType.getCanonicalText(), "") :
           QuickFixBundle.message("fix.variable.type.text", formatType(myVariable), myVariable.getName(), myTargetType.getCanonicalText());
  myFamilyName = myVariable == null ? null : myTargetType.equals(myVariable.getType()) && myNewExpression != null ?
                 QuickFixBundle.message("change.new.operator.type.family") :
                 QuickFixBundle.message("fix.variable.type.family");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:VariableArrayTypeFix.java

示例3: isAvailableImpl

import com.intellij.codeInsight.daemon.QuickFixBundle; //导入依赖的package包/类
@Override
protected boolean isAvailableImpl(int offset) {
  final PsiMethodReferenceExpression call = getMethodReference();
  if (call == null || !call.isValid()) return false;
  final PsiType functionalInterfaceType = call.getFunctionalInterfaceType();
  if (functionalInterfaceType == null || 
      LambdaUtil.getFunctionalInterfaceMethod(functionalInterfaceType) == null){
    return false;
  }

  final String name = call.getReferenceName();

  if (name == null) return false;
  if (call.isConstructor() && name.equals("new") || PsiNameHelper.getInstance(call.getProject()).isIdentifier(name)) {
    setText(call.isConstructor() ? QuickFixBundle.message("create.constructor.from.new.text") : QuickFixBundle.message("create.method.from.usage.text", name));
    return true;
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:CreateMethodFromMethodReferenceFix.java

示例4: runSingle

import com.intellij.codeInsight.daemon.QuickFixBundle; //导入依赖的package包/类
@Test
public void runSingle() throws Throwable {
  Runnable runnable = new Runnable() {
    public void run() {
      IntentionAction resultAction = null;
      final String createAction = QuickFixBundle.message(myCreateClass ? "create.class.text" : "create.interface.text", myTestName);
      final List<IntentionAction> actions = myFixture.getAvailableIntentions(getSourceRoot() + "/plugin" + myTestName + ".xml");
      for (IntentionAction action : actions) {
        if (Comparing.strEqual(action.getText(), createAction)) {
          resultAction = action;
          break;
        }
      }
      Assert.assertNotNull(resultAction);
      myFixture.launchAction(resultAction);
      final Project project = myFixture.getProject();
      Assert.assertNotNull(JavaPsiFacade.getInstance(project).findClass(myTestName, GlobalSearchScope.allScope(project)));
    }
  };
  invokeTestRunnable(runnable);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:CreateClassFixTest.java

示例5: getText

import com.intellij.codeInsight.daemon.QuickFixBundle; //导入依赖的package包/类
@Override
@NotNull
public String getText() {
  PsiExpression operand = myPrefixExpression.getOperand();
  String text = operand == null ? "" : operand.getText() + " ";
  PsiElement parent = myPrefixExpression.getParent();

  String rop;
  if (parent instanceof PsiInstanceOfExpression) {
    text += PsiKeyword.INSTANCEOF + " ";
    final PsiTypeElement type = ((PsiInstanceOfExpression)parent).getCheckType();
    rop = type == null ? "" : type.getText();
  }
  else if (parent instanceof PsiBinaryExpression) {
    text += ((PsiBinaryExpression)parent).getOperationSign().getText() + " ";
    final PsiExpression rOperand = ((PsiBinaryExpression)parent).getROperand();
    rop = rOperand == null ? "" : rOperand.getText();
  }
  else {
    rop = "<expr>";
  }

  text += rop;
  return QuickFixBundle.message("negation.broader.scope.text", text);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:NegationBroadScopeFix.java

示例6: showCircularWarningAndContinue

import com.intellij.codeInsight.daemon.QuickFixBundle; //导入依赖的package包/类
private static void showCircularWarningAndContinue(final Project project, final Pair<Module, Module> circularModules,
                                                   final Module classModule,
                                                   final Runnable doit) {
  final String message = QuickFixBundle.message("orderEntry.fix.circular.dependency.warning", classModule.getName(),
                                                circularModules.getFirst().getName(), circularModules.getSecond().getName());
  if (ApplicationManager.getApplication().isUnitTestMode()) throw new RuntimeException(message);
  ApplicationManager.getApplication().invokeLater(new Runnable() {
    @Override
    public void run() {
      if (!project.isOpen()) return;
      int ret = Messages.showOkCancelDialog(project, message,
                                            QuickFixBundle.message("orderEntry.fix.title.circular.dependency.warning"),
                                            Messages.getWarningIcon());
      if (ret == Messages.OK) {
        ApplicationManager.getApplication().runWriteAction(doit);
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:AddModuleDependencyFix.java

示例7: getText

import com.intellij.codeInsight.daemon.QuickFixBundle; //导入依赖的package包/类
@Override
@NotNull
public String getText() {
  @NonNls String message;
  switch (myFixType) {
    case MAKE_FINAL:
      message = "make.final.text";
      break;
    case MAKE_ARRAY:
      message = "make.final.transform.to.one.element.array";
      break;
    case COPY_TO_FINAL:
      return QuickFixBundle.message("make.final.copy.to.temp", myVariable.getName());
    default:
      return "";
  }
  Collection<PsiVariable> vars = getVariablesToFix();
  String varNames = vars.size() == 1 ? "'"+myVariable.getName()+"'" : "variables";
  return QuickFixBundle.message(message, varNames);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:VariableAccessFromInnerClassFix.java

示例8: createAddToDependencyInjectionAnnotationsFix

import com.intellij.codeInsight.daemon.QuickFixBundle; //导入依赖的package包/类
@NotNull
@Override
public IntentionAction createAddToDependencyInjectionAnnotationsFix(@NotNull Project project,
                                                                    @NotNull String qualifiedName,
                                                                    @NotNull String element) {
  final EntryPointsManagerBase entryPointsManager = EntryPointsManagerBase.getInstance(project);
  return SpecialAnnotationsUtil.createAddToSpecialAnnotationsListIntentionAction(
    QuickFixBundle.message("fix.unused.symbol.injection.text", element, qualifiedName),
    QuickFixBundle.message("fix.unused.symbol.injection.family"),
    entryPointsManager.ADDITIONAL_ANNOTATIONS, qualifiedName);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:QuickFixFactoryImpl.java

示例9: getText

import com.intellij.codeInsight.daemon.QuickFixBundle; //导入依赖的package包/类
@Override
@NotNull
public String getText() {
  final PsiMethod wrapper = myExpression.isValid() && myExpectedType != null ? findWrapper(myExpression.getType(), myExpectedType, myPrimitiveExpected) : null;
  final String methodPresentation = wrapper != null ? wrapper.getContainingClass().getName() + "." + wrapper.getName() : "";
  return QuickFixBundle.message("wrap.expression.using.static.accessor.text", methodPresentation);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:WrapExpressionFix.java

示例10: getText

import com.intellij.codeInsight.daemon.QuickFixBundle; //导入依赖的package包/类
@NotNull
@Override
public String getText() {
  if (myArgList.getExpressions().length == 1) {
    return QuickFixBundle.message("wrap.array.to.arrays.as.list.single.parameter.text");
  } else {
    return QuickFixBundle.message("wrap.array.to.arrays.as.list.parameter.text", myIndex + 1);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:WrapArrayToArraysAsListFix.java

示例11: isAvailable

import com.intellij.codeInsight.daemon.QuickFixBundle; //导入依赖的package包/类
@Override
public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
  if (!(file instanceof PsiJavaFile)) return false;

  int offset = editor.getCaretModel().getOffset();
  PsiElement element = findElement(file, offset);

  if (element == null) return false;

  setText(QuickFixBundle.message("add.catch.clause.text"));
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:AddExceptionToCatchFix.java

示例12: getText

import com.intellij.codeInsight.daemon.QuickFixBundle; //导入依赖的package包/类
@Override
@NotNull
public String getText() {
  final String convertedValue = convertedValue();
  final boolean isString = isString(myLiteral.getType());
  return QuickFixBundle.message("fix.single.character.string.to.char.literal.text", myLiteral.getText(),
                                quote(convertedValue, ! isString), isString ? PsiType.CHAR.getCanonicalText() : "String");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ChangeStringLiteralToCharInMethodCallFix.java

示例13: getText

import com.intellij.codeInsight.daemon.QuickFixBundle; //导入依赖的package包/类
@Override
@NotNull
public String getText() {
  String text = QuickFixBundle.message("static.import.method.text");
  if (candidates != null && candidates.size() == 1) {
    text += " '" + PsiFormatUtil.formatMethod(candidates.get(0), PsiSubstitutor.EMPTY, PsiFormatUtilBase.SHOW_NAME |
                                                                                       PsiFormatUtilBase.SHOW_CONTAINING_CLASS |
                                                                                       PsiFormatUtilBase.SHOW_FQ_NAME, 0)+"'";
  }
  else {
    text += "...";
  }
  return text;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:StaticImportMethodFix.java

示例14: getText

import com.intellij.codeInsight.daemon.QuickFixBundle; //导入依赖的package包/类
@NotNull
@Override
public String getText() {
  return QuickFixBundle.message("fix.variable.type.text",
                                UsageViewUtil.getType(getStartElement()),
                                myName,
                                getReturnType().getCanonicalText());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:VariableTypeFix.java

示例15: scheduleFileOrPackageCreationFailedMessageBox

import com.intellij.codeInsight.daemon.QuickFixBundle; //导入依赖的package包/类
public static void scheduleFileOrPackageCreationFailedMessageBox(final IncorrectOperationException e, final String name, final PsiDirectory directory,
                                                    final boolean isPackage) {
  ApplicationManager.getApplication().invokeLater(new Runnable() {
    @Override
    public void run() {
      Messages.showErrorDialog(QuickFixBundle.message(
        isPackage ? "cannot.create.java.package.error.text" : "cannot.create.java.file.error.text", name, directory.getVirtualFile().getName(), e.getLocalizedMessage()),
                               QuickFixBundle.message(
                                 isPackage ? "cannot.create.java.package.error.title" : "cannot.create.java.file.error.title"));
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:CreateFromUsageUtils.java


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