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


Java DescriptiveNameUtil类代码示例

本文整理汇总了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;
}
 
开发者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


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