本文整理匯總了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;
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}