本文整理汇总了Java中com.intellij.lang.findUsages.DescriptiveNameUtil.getDescriptiveName方法的典型用法代码示例。如果您正苦于以下问题:Java DescriptiveNameUtil.getDescriptiveName方法的具体用法?Java DescriptiveNameUtil.getDescriptiveName怎么用?Java DescriptiveNameUtil.getDescriptiveName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.lang.findUsages.DescriptiveNameUtil
的用法示例。
在下文中一共展示了DescriptiveNameUtil.getDescriptiveName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkSuperMethod
import com.intellij.lang.findUsages.DescriptiveNameUtil; //导入方法依赖的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: setup
import com.intellij.lang.findUsages.DescriptiveNameUtil; //导入方法依赖的package包/类
public void setup(final PsiClass innerClass,
final String className,
final boolean passOuterClass,
final String parameterName,
boolean searchInComments,
boolean searchInNonJava,
@NotNull final PsiElement targetContainer) {
myNewClassName = className;
myInnerClass = innerClass;
myDescriptiveName = DescriptiveNameUtil.getDescriptiveName(myInnerClass);
myOuterClass = myInnerClass.getContainingClass();
myTargetContainer = targetContainer;
JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance(myProject);
myParameterNameOuterClass = passOuterClass ? parameterName : null;
if (myParameterNameOuterClass != null) {
myFieldNameOuterClass =
codeStyleManager.variableNameToPropertyName(myParameterNameOuterClass, VariableKind.PARAMETER);
myFieldNameOuterClass = codeStyleManager.propertyNameToVariableName(myFieldNameOuterClass, VariableKind.FIELD);
}
mySearchInComments = searchInComments;
mySearchInNonJavaFiles = searchInNonJava;
}
示例3: InlineMethodProcessor
import com.intellij.lang.findUsages.DescriptiveNameUtil; //导入方法依赖的package包/类
public InlineMethodProcessor(@NotNull Project project,
@NotNull PsiMethod method,
@Nullable PsiJavaCodeReferenceElement reference,
Editor editor,
boolean isInlineThisOnly,
boolean searchInComments,
boolean searchForTextOccurrences) {
super(project);
myMethod = method;
myReference = reference;
myEditor = editor;
myInlineThisOnly = isInlineThisOnly;
mySearchInComments = searchInComments;
mySearchForTextOccurrences = searchForTextOccurrences;
myManager = PsiManager.getInstance(myProject);
myFactory = JavaPsiFacade.getInstance(myManager.getProject()).getElementFactory();
myCodeStyleManager = CodeStyleManager.getInstance(myProject);
myJavaCodeStyle = JavaCodeStyleManager.getInstance(myProject);
myDescriptiveName = DescriptiveNameUtil.getDescriptiveName(myMethod);
}
示例4: checkSuperMethod
import com.intellij.lang.findUsages.DescriptiveNameUtil; //导入方法依赖的package包/类
public static PsiMethod checkSuperMethod(final PsiMethod method, 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;
}
示例5: checkSuperMethod
import com.intellij.lang.findUsages.DescriptiveNameUtil; //导入方法依赖的package包/类
public static PsiMethod checkSuperMethod(final PsiMethod method, 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;
}
示例6: setup
import com.intellij.lang.findUsages.DescriptiveNameUtil; //导入方法依赖的package包/类
public void setup(final PsiClass innerClass,
final String className,
final boolean passOuterClass,
final String parameterName,
boolean searchInComments,
boolean searchInNonJava,
@NotNull final PsiElement targetContainer) {
myNewClassName = className;
myInnerClass = innerClass;
myDescriptiveName = DescriptiveNameUtil.getDescriptiveName(myInnerClass);
myOuterClass = myInnerClass.getContainingClass();
myTargetContainer = targetContainer;
JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance(myProject);
myParameterNameOuterClass = passOuterClass ? parameterName : null;
if (myParameterNameOuterClass != null) {
myFieldNameOuterClass =
codeStyleManager.variableNameToPropertyName(myParameterNameOuterClass, VariableKind.PARAMETER);
myFieldNameOuterClass = codeStyleManager.propertyNameToVariableName(myFieldNameOuterClass, VariableKind.FIELD);
}
mySearchInComments = searchInComments;
mySearchInNonJavaFiles = searchInNonJava;
}
示例7: buildPropertyName
import com.intellij.lang.findUsages.DescriptiveNameUtil; //导入方法依赖的package包/类
private static String buildPropertyName(PsiElement e, boolean property) {
if (property) return DescriptiveNameUtil.getDescriptiveName(e);
List<String> path = new ArrayList<String>();
do {
path.add(DescriptiveNameUtil.getDescriptiveName(e));
}
while ((e = PsiTreeUtil.getParentOfType(e, XmlTag.class)) != null);
Collections.reverse(path);
return StringUtil.join(path, ".");
}
示例8: checkSuperMethods
import com.intellij.lang.findUsages.DescriptiveNameUtil; //导入方法依赖的package包/类
@NotNull
public static PsiMethod[] checkSuperMethods(final PsiMethod method, String actionString, Collection<PsiElement> ignore) {
PsiClass aClass = method.getContainingClass();
if (aClass == null) return new PsiMethod[]{method};
final Collection<PsiMethod> superMethods = DeepestSuperMethodsSearch.search(method).findAll();
if (ignore != null) {
superMethods.removeAll(ignore);
}
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;
}
示例9: InplaceChangeSignature
import com.intellij.lang.findUsages.DescriptiveNameUtil; //导入方法依赖的package包/类
public InplaceChangeSignature(Project project, Editor editor, @Nonnull PsiElement element) {
myDocumentManager = PsiDocumentManager.getInstance(project);
myProject = project;
try {
myMarkAction = StartMarkAction.start(editor, project, ChangeSignatureHandler.REFACTORING_NAME);
}
catch (StartMarkAction.AlreadyStartedException e) {
final int exitCode = Messages.showYesNoDialog(myProject, e.getMessage(), ChangeSignatureHandler.REFACTORING_NAME, "Navigate to Started", "Cancel", Messages.getErrorIcon());
if (exitCode == Messages.CANCEL) return;
PsiElement method = myStableChange.getMethod();
VirtualFile virtualFile = PsiUtilCore.getVirtualFile(method);
new OpenFileDescriptor(project, virtualFile, method.getTextOffset()).navigate(true);
return;
}
myEditor = editor;
myDetector = LanguageChangeSignatureDetectors.INSTANCE.forLanguage(element.getLanguage());
myStableChange = myDetector.createInitialChangeInfo(element);
myInitialSignature = myDetector.extractSignature(myStableChange);
myInitialName = DescriptiveNameUtil.getDescriptiveName(myStableChange.getMethod());
TextRange highlightingRange = myDetector.getHighlightingRange(myStableChange);
HighlightManager highlightManager = HighlightManager.getInstance(myProject);
TextAttributes attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(EditorColors.LIVE_TEMPLATE_ATTRIBUTES);
highlightManager.addRangeHighlight(editor, highlightingRange.getStartOffset(), highlightingRange.getEndOffset(), attributes, false, myHighlighters);
for (RangeHighlighter highlighter : myHighlighters) {
highlighter.setGreedyToRight(true);
highlighter.setGreedyToLeft(true);
}
myEditor.getDocument().addDocumentListener(this);
myEditor.putUserData(INPLACE_CHANGE_SIGNATURE, this);
myPreview = InplaceRefactoring.createPreviewComponent(project, myDetector.getFileType());
showBalloon();
}
示例10: checkSuperMethods
import com.intellij.lang.findUsages.DescriptiveNameUtil; //导入方法依赖的package包/类
@NotNull
public static PsiMethod[] checkSuperMethods(final PsiMethod method, String actionString, Collection<PsiElement> ignore) {
PsiClass aClass = method.getContainingClass();
if (aClass == null) return new PsiMethod[]{method};
final Collection<PsiMethod> superMethods = DeepestSuperMethodsSearch.search(method).findAll();
if (ignore != null) {
superMethods.removeAll(ignore);
}
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;
}
示例11: getFullName
import com.intellij.lang.findUsages.DescriptiveNameUtil; //导入方法依赖的package包/类
private static String getFullName(@NotNull XmlTag tag) {
String name = DescriptiveNameUtil.getDescriptiveName(tag.getAttribute("name"));
return (UsageViewUtil.getType(tag) + " " + name).trim();
}
示例12: checkSuperMethods
import com.intellij.lang.findUsages.DescriptiveNameUtil; //导入方法依赖的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;
}
示例13: getFullName
import com.intellij.lang.findUsages.DescriptiveNameUtil; //导入方法依赖的package包/类
protected String getFullName() {
final String name = DescriptiveNameUtil.getDescriptiveName(myPsiElement);
return (UsageViewUtil.getType(myPsiElement) + " " + name).trim();
}
示例14: getElementDescription
import com.intellij.lang.findUsages.DescriptiveNameUtil; //导入方法依赖的package包/类
@Override
public String getElementDescription(@NotNull final PsiElement element, @NotNull final ElementDescriptionLocation location) {
final String typeString = UsageViewUtil.getType(element);
final String name = DescriptiveNameUtil.getDescriptiveName(element);
return typeString + " " + CommonRefactoringUtil.htmlEmphasize(name);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:DefaultRefactoringElementDescriptionProvider.java
示例15: getFullName
import com.intellij.lang.findUsages.DescriptiveNameUtil; //导入方法依赖的package包/类
private static String getFullName(@NotNull final XmlTag tag) {
final String name = DescriptiveNameUtil.getDescriptiveName(tag);
return (UsageViewUtil.getType(tag) + " " + name).trim();
}