本文整理汇总了Java中com.intellij.lang.findUsages.DescriptiveNameUtil类的典型用法代码示例。如果您正苦于以下问题:Java DescriptiveNameUtil类的具体用法?Java DescriptiveNameUtil怎么用?Java DescriptiveNameUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DescriptiveNameUtil类属于com.intellij.lang.findUsages包,在下文中一共展示了DescriptiveNameUtil类的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: TypeCookDialog
import com.intellij.lang.findUsages.DescriptiveNameUtil; //导入依赖的package包/类
@SuppressWarnings({"HardCodedStringLiteral"})
public TypeCookDialog(Project project, PsiElement[] elements) {
super(project, true);
setTitle(REFACTORING_NAME);
init();
StringBuffer name = new StringBuffer();
myElements = elements;
for (int i = 0; i < elements.length; i++) {
PsiElement element = elements[i];
name.append(StringUtil.capitalize(UsageViewUtil.getType(element)));
name.append(" ");
name.append(DescriptiveNameUtil.getDescriptiveName(element));
if (i < elements.length - 1) {
name.append("<br>");
}
}
myClassNameLabel.setText(XmlStringUtil.wrapInHtml(name));
}
示例4: 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);
}
示例5: getNodeText
import com.intellij.lang.findUsages.DescriptiveNameUtil; //导入依赖的package包/类
@Override
@NotNull
public String getNodeText(@NotNull PsiElement element, boolean useFullName) {
if (element instanceof XmlTag) {
final XmlTag xmlTag = (XmlTag)element;
final PsiMetaData metaData = xmlTag.getMetaData();
final String name = metaData != null ? DescriptiveNameUtil.getMetaDataName(metaData) : xmlTag.getName();
String presentableName = metaData == null ? "<" + name + ">" : name;
return presentableName+" of file "+xmlTag.getContainingFile().getName();
}
if (element instanceof XmlAttributeValue) {
return ((XmlAttributeValue)element).getValue();
}
if (element instanceof PsiNamedElement) {
return ((PsiNamedElement)element).getName();
}
return element.getText();
}
示例6: GroovyFieldValidator
import com.intellij.lang.findUsages.DescriptiveNameUtil; //导入依赖的package包/类
public GroovyFieldValidator(GrIntroduceContext context) {
super(context, new ConflictReporter() {
@Override
public void check(PsiElement toCheck, MultiMap<PsiElement, String> conflicts, String varName) {
if (toCheck instanceof GrField && varName.equals(((GrField)toCheck).getName())) {
conflicts.putValue(toCheck, GroovyRefactoringBundle.message("field.0.is.already.defined", CommonRefactoringUtil.htmlEmphasize(varName)));
}
if (toCheck instanceof GrMethod) {
if (GroovyPropertyUtils.isSimplePropertyAccessor((PsiMethod)toCheck) &&
varName.equals(GroovyPropertyUtils.getPropertyNameByAccessorName(((PsiMethod)toCheck).getName()))) {
conflicts.putValue(toCheck, GroovyRefactoringBundle
.message("access.to.created.field.0.will.be.overriden.by.method.1", CommonRefactoringUtil.htmlEmphasize(varName),
CommonRefactoringUtil.htmlEmphasize(DescriptiveNameUtil.getDescriptiveName(toCheck))));
}
}
}
});
}
示例7: GroovyInplaceFieldValidator
import com.intellij.lang.findUsages.DescriptiveNameUtil; //导入依赖的package包/类
public GroovyInplaceFieldValidator(GrIntroduceContext context) {
super(context, new ConflictReporter() {
@Override
public void check(PsiElement toCheck, MultiMap<PsiElement, String> conflicts, String varName) {
if (toCheck instanceof GrVariable && varName.equals(((GrVariable)toCheck).getName())) {
conflicts.putValue(toCheck, GroovyRefactoringBundle.message("field.0.is.already.defined", CommonRefactoringUtil.htmlEmphasize(varName)));
}
if (toCheck instanceof GrMethod) {
if (GroovyPropertyUtils.isSimplePropertyAccessor((PsiMethod)toCheck) &&
varName.equals(GroovyPropertyUtils.getPropertyNameByAccessorName(((PsiMethod)toCheck).getName()))) {
conflicts.putValue(toCheck, GroovyRefactoringBundle
.message("access.to.created.field.0.will.be.overriden.by.method.1", CommonRefactoringUtil.htmlEmphasize(varName),
CommonRefactoringUtil.htmlEmphasize(DescriptiveNameUtil.getDescriptiveName(toCheck))));
}
}
}
});
}
示例8: 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;
}
示例9: getNodeText
import com.intellij.lang.findUsages.DescriptiveNameUtil; //导入依赖的package包/类
@NotNull
public String getNodeText(@NotNull PsiElement element, boolean useFullName) {
if (element instanceof XmlTag) {
final XmlTag xmlTag = (XmlTag)element;
final PsiMetaData metaData = xmlTag.getMetaData();
final String name = metaData != null ? DescriptiveNameUtil.getMetaDataName(metaData) : xmlTag.getName();
return UsageViewBundle.message("usage.target.xml.tag.of.file", metaData == null ? "<" + name + ">" : name, xmlTag.getContainingFile().getName());
}
else if (element instanceof XmlAttributeValue) {
return ((XmlAttributeValue)element).getValue();
}
if (element instanceof PsiNamedElement) {
return ((PsiNamedElement)element).getName();
} else {
return element.getText();
}
}
示例10: GroovyFieldValidator
import com.intellij.lang.findUsages.DescriptiveNameUtil; //导入依赖的package包/类
public GroovyFieldValidator(GrIntroduceContext context) {
super(context, new ConflictReporter() {
@Override
public void check(PsiElement toCheck, MultiMap<PsiElement, String> conflicts, String varName) {
if (toCheck instanceof GrField && varName.equals(((GrField)toCheck).getName())) {
conflicts.putValue(toCheck, message("field.0.is.already.defined", htmlEmphasize(varName)));
}
if (toCheck instanceof GrMethod) {
if (GroovyPropertyUtils.isSimplePropertyAccessor((PsiMethod)toCheck) &&
varName.equals(GroovyPropertyUtils.getPropertyNameByAccessorName(((PsiMethod)toCheck).getName()))) {
conflicts.putValue(toCheck, message("access.to.created.field.0.will.be.overriden.by.method.1", htmlEmphasize(varName),
htmlEmphasize(DescriptiveNameUtil.getDescriptiveName(toCheck))));
}
}
}
});
}
示例11: GroovyInplaceFieldValidator
import com.intellij.lang.findUsages.DescriptiveNameUtil; //导入依赖的package包/类
public GroovyInplaceFieldValidator(GrIntroduceContext context) {
super(context, new ConflictReporter() {
@Override
public void check(PsiElement toCheck, MultiMap<PsiElement, String> conflicts, String varName) {
if (toCheck instanceof GrVariable && varName.equals(((GrVariable)toCheck).getName())) {
conflicts.putValue(toCheck, message("field.0.is.already.defined", htmlEmphasize(varName)));
}
if (toCheck instanceof GrMethod) {
if (GroovyPropertyUtils.isSimplePropertyAccessor((PsiMethod)toCheck) &&
varName.equals(GroovyPropertyUtils.getPropertyNameByAccessorName(((PsiMethod)toCheck).getName()))) {
conflicts.putValue(toCheck, message("access.to.created.field.0.will.be.overriden.by.method.1", htmlEmphasize(varName),
htmlEmphasize(DescriptiveNameUtil.getDescriptiveName(toCheck))));
}
}
}
});
}
示例12: getNodeText
import com.intellij.lang.findUsages.DescriptiveNameUtil; //导入依赖的package包/类
@Override
@NotNull
public String getNodeText(@NotNull PsiElement element, boolean useFullName)
{
if(element instanceof XmlTag)
{
final XmlTag xmlTag = (XmlTag) element;
final PsiMetaData metaData = xmlTag.getMetaData();
final String name = metaData != null ? DescriptiveNameUtil.getMetaDataName(metaData) : xmlTag.getName();
String presentableName = metaData == null ? "<" + name + ">" : name;
return presentableName + " of file " + xmlTag.getContainingFile().getName();
}
if(element instanceof XmlAttributeValue)
{
return ((XmlAttributeValue) element).getValue();
}
if(element instanceof PsiNamedElement)
{
return ((PsiNamedElement) element).getName();
}
return element.getText();
}
示例13: 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;
}
示例14: 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;
}
示例15: getCommandName
import com.intellij.lang.findUsages.DescriptiveNameUtil; //导入依赖的package包/类
protected String getCommandName() {
if (myConstructor != null) {
return RefactoringBundle.message("replace.constructor.0.with.a.factory.method",
DescriptiveNameUtil.getDescriptiveName(myConstructor));
}
else {
return RefactoringBundle.message("replace.default.constructor.of.0.with.a.factory.method",
DescriptiveNameUtil.getDescriptiveName(myOriginalClass));
}
}