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


Java PsiMethod.getProject方法代码示例

本文整理汇总了Java中com.intellij.psi.PsiMethod.getProject方法的典型用法代码示例。如果您正苦于以下问题:Java PsiMethod.getProject方法的具体用法?Java PsiMethod.getProject怎么用?Java PsiMethod.getProject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.psi.PsiMethod的用法示例。


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

示例1: checkSuperMethod

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
public static PsiMethod checkSuperMethod(@NotNull PsiMethod method, @NotNull String actionString) {
  PsiClass aClass = method.getContainingClass();
  if (aClass == null) return method;

  PsiMethod superMethod = method.findDeepestSuperMethod();
  if (superMethod == null) return method;

  if (ApplicationManager.getApplication().isUnitTestMode()) return superMethod;

  PsiClass containingClass = superMethod.getContainingClass();

  SuperMethodWarningDialog dialog =
      new SuperMethodWarningDialog(
          method.getProject(),
          DescriptiveNameUtil.getDescriptiveName(method), actionString, containingClass.isInterface() || superMethod.hasModifierProperty(PsiModifier.ABSTRACT),
          containingClass.isInterface(), aClass.isInterface(), containingClass.getQualifiedName()
      );
  dialog.show();

  if (dialog.getExitCode() == DialogWrapper.OK_EXIT_CODE) return superMethod;
  if (dialog.getExitCode() == SuperMethodWarningDialog.NO_EXIT_CODE) return method;

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

示例2: MoveInstanceMethodDialogBase

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
public MoveInstanceMethodDialogBase(PsiMethod method, PsiVariable[] variables, String refactoringName) {
  super(method.getProject(), true);
  myMethod = method;
  myVariables = variables;
  myRefactoringName = refactoringName;
  setTitle(myRefactoringName);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:MoveInstanceMethodDialogBase.java

示例3: InlineParameterDialog

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
public InlineParameterDialog(PsiCallExpression methodCall, PsiMethod method, PsiParameter psiParameter, PsiExpression initializer,
                             boolean createLocal) {
  super(method.getProject(), true);
  myMethodCall = methodCall;
  myMethod = method;
  myParameter = psiParameter;
  myInitializer = initializer;
  init();
  myCreateLocalCheckbox.setSelected(createLocal);
  setTitle(InlineParameterHandler.REFACTORING_NAME);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:InlineParameterDialog.java

示例4: createTreeNode

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Override
protected JavaMethodNode createTreeNode(PsiMethod nodeMethod,
                                        com.intellij.util.containers.HashSet<PsiMethod> called,
                                        Runnable cancelCallback) {
  final MakeStaticJavaMethodNode node =
    new MakeStaticJavaMethodNode(nodeMethod, called, cancelCallback, nodeMethod != null ? nodeMethod.getProject() : myProject);
  if (getTopMethod().equals(nodeMethod)) {
    node.setEnabled(false);
    node.setChecked(true);
  }
  return node;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:MakeStaticJavaCallerChooser.java

示例5: getUseScope

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
private static SearchScope getUseScope(final PsiMethod method) {
  final SearchScope scope = method.getUseScope();
  final PsiFile file = method.getContainingFile();
  if (file != null && scope instanceof GlobalSearchScope) {
    final VirtualFile vfile = file.getOriginalFile().getVirtualFile();
    final Project project = method.getProject();
    if (vfile != null && ProjectRootManager.getInstance(project).getFileIndex().isInSource(vfile)) {
      return new GrSourceFilterScope((GlobalSearchScope)scope);
    }
  }
  return scope;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:MethodLateBoundReferencesSearcher.java

示例6: checkSuperMethods

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@NotNull
public static PsiMethod[] checkSuperMethods(@NotNull PsiMethod method, @NotNull String actionString, @NotNull Collection<PsiElement> ignore) {
  PsiClass aClass = method.getContainingClass();
  if (aClass == null) return new PsiMethod[]{method};

  final Collection<PsiMethod> superMethods = DeepestSuperMethodsSearch.search(method).findAll();
  superMethods.removeAll(ignore);

  if (superMethods.isEmpty()) {
    PsiMethod siblingSuperMethod = FindSuperElementsHelper.getSiblingInheritedViaSubClass(method);
    if (siblingSuperMethod != null) {
      superMethods.add(siblingSuperMethod);
    }
  }
  if (superMethods.isEmpty()) return new PsiMethod[]{method};


  Set<String> superClasses = new HashSet<String>();
  boolean superAbstract = false;
  boolean parentInterface = false;
  for (final PsiMethod superMethod : superMethods) {
    final PsiClass containingClass = superMethod.getContainingClass();
    superClasses.add(containingClass.getQualifiedName());
    final boolean isInterface = containingClass.isInterface();
    superAbstract |= isInterface || superMethod.hasModifierProperty(PsiModifier.ABSTRACT);
    parentInterface |= isInterface;
  }

  SuperMethodWarningDialog dialog =
      new SuperMethodWarningDialog(method.getProject(), DescriptiveNameUtil.getDescriptiveName(method), actionString, superAbstract,
                                   parentInterface, aClass.isInterface(), ArrayUtil.toStringArray(superClasses));
  dialog.show();

  if (dialog.getExitCode() == DialogWrapper.OK_EXIT_CODE) {
    return superMethods.toArray(new PsiMethod[superMethods.size()]);
  }
  if (dialog.getExitCode() == SuperMethodWarningDialog.NO_EXIT_CODE) {
    return new PsiMethod[]{method};
  }

  return PsiMethod.EMPTY_ARRAY;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:43,代码来源:SuperMethodWarningUtil.java


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