• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DescriptiveNameUtil类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



DescriptiveNameUtil类属于com.intellij.lang.findUsages包,在下文中一共展示了DescriptiveNameUtil类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:SuperMethodWarningUtil.java


示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:MoveInnerProcessor.java


示例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));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:TypeCookDialog.java


示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:InlineMethodProcessor.java


示例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();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:XmlFindUsagesProvider.java


示例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))));
        }
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:GroovyFieldValidator.java


示例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))));
        }
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:GroovyInplaceFieldValidator.java


示例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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:SuperMethodWarningUtil.java


示例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();
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:XmlFindUsagesProvider.java


示例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))));
        }
      }
    }
  });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:GroovyFieldValidator.java


示例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))));
        }
      }
    }
  });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:GroovyInplaceFieldValidator.java


示例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();
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:24,代码来源:XmlFindUsagesProvider.java


示例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;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:25,代码来源:SuperMethodWarningUtil.java


示例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;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:23,代码来源:MoveInnerProcessor.java


示例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));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ReplaceConstructorWithFactoryProcessor.java


示例16: getElementDescription

import com.intellij.lang.findUsages.DescriptiveNameUtil; //导入依赖的package包/类
@Override
public String getElementDescription(@NotNull final PsiElement element, @NotNull final ElementDescriptionLocation location) {
  if (!(location instanceof UsageViewShortNameLocation)) return null;

  if (element instanceof PsiMetaOwner) {
    PsiMetaData metaData = ((PsiMetaOwner)element).getMetaData();
    if (metaData!=null) return DescriptiveNameUtil.getMetaDataName(metaData);
  }

  if (element instanceof PsiNamedElement) {
    return ((PsiNamedElement)element).getName();
  }
  return "";
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:UsageViewShortNameLocation.java


示例17: getLongDescriptiveName

import com.intellij.lang.findUsages.DescriptiveNameUtil; //导入依赖的package包/类
@NotNull
@Override
public String getLongDescriptiveName() {
  SearchScope searchScope = myOptions.searchScope;
  String scopeString = searchScope.getDisplayName();
  PsiElement psiElement = getElement();

  return psiElement == null ? UsageViewBundle.message("node.invalid") :
         FindBundle.message("recent.find.usages.action.popup", StringUtil.capitalize(UsageViewUtil.getType(psiElement)),
                            DescriptiveNameUtil.getDescriptiveName(psiElement),
                            scopeString
  );
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:PsiElement2UsageTargetAdapter.java


示例18: performRefactoringRename

import com.intellij.lang.findUsages.DescriptiveNameUtil; //导入依赖的package包/类
@Override
protected void performRefactoringRename(final String newName,
                                        final StartMarkAction markAction) {
  try {
    final PsiNamedElement variable = getVariable();
    if (variable != null && !newName.equals(myOldName)) {
      if (isIdentifier(newName, variable.getLanguage())) {
        final PsiElement substituted = getSubstituted();
        if (substituted == null) {
          return;
        }

        final String commandName = RefactoringBundle
          .message("renaming.0.1.to.2", UsageViewUtil.getType(variable), DescriptiveNameUtil.getDescriptiveName(variable), newName);
        CommandProcessor.getInstance().executeCommand(myProject, new Runnable() {
          @Override
          public void run() {
            performRenameInner(substituted, newName);
            PsiDocumentManager.getInstance(myProject).commitAllDocuments();
          }
        }, commandName, null);
      }
    }
  }
  finally {
    try {
      ((EditorImpl)InjectedLanguageUtil.getTopLevelEditor(myEditor)).stopDumbLater();
    }
    finally {
      FinishMarkAction.finish(myProject, myEditor, markAction);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:MemberInplaceRenamer.java


示例19: setNewName

import com.intellij.lang.findUsages.DescriptiveNameUtil; //导入依赖的package包/类
private void setNewName(@NotNull String newName) {
  if (myPrimaryElement == null) {
    myCommandName = RefactoringBundle.message("renaming.something");
    return;
  }

  myNewName = newName;
  myAllRenames.put(myPrimaryElement, newName);
  myCommandName = RefactoringBundle
    .message("renaming.0.1.to.2", UsageViewUtil.getType(myPrimaryElement), DescriptiveNameUtil.getDescriptiveName(myPrimaryElement), newName);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:RenameProcessor.java


示例20: InvertBooleanDialog

import com.intellij.lang.findUsages.DescriptiveNameUtil; //导入依赖的package包/类
public InvertBooleanDialog(final PsiElement element) {
  super(element.getProject(), false);
  myElement = element;
  final String name = myElement instanceof PsiNamedElement ? ((PsiNamedElement)myElement).getName() : myElement.getText();
  myNameField.setText(name);
  myLabel.setLabelFor(myNameField);
  final String typeString = UsageViewUtil.getType(myElement);
  myLabel.setText(RefactoringBundle.message("invert.boolean.name.of.inverted.element", typeString));
  myCaptionLabel.setText(RefactoringBundle.message("invert.0.1",
                                                   typeString,
                                                   DescriptiveNameUtil.getDescriptiveName(myElement)));

  setTitle(InvertBooleanHandler.REFACTORING_NAME);
  init();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:InvertBooleanDialog.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BufferUtils类代码示例发布时间:2022-05-22
下一篇:
Java ApplicationDefaults类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap