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


Java PsiClass.getName方法代码示例

本文整理汇总了Java中com.intellij.psi.PsiClass.getName方法的典型用法代码示例。如果您正苦于以下问题:Java PsiClass.getName方法的具体用法?Java PsiClass.getName怎么用?Java PsiClass.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.psi.PsiClass的用法示例。


在下文中一共展示了PsiClass.getName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: generateConvertMethod

import com.intellij.psi.PsiClass; //导入方法依赖的package包/类
protected void generateConvertMethod(PsiElementFactory factory, PsiClass cls, ClassEntity classEntity) {
    if (cls == null || cls.getName() == null) {
        return;
    }
    if (Config.getInstant().isObjectFromData()) {
        createMethod(factory, Config.getInstant().getObjectFromDataStr().replace("$ClassName$", cls.getName()).trim(), cls);
    }
    if (Config.getInstant().isObjectFromData1()) {
        createMethod(factory, Config.getInstant().getObjectFromDataStr1().replace("$ClassName$", cls.getName()).trim(), cls);
    }
    if (Config.getInstant().isArrayFromData()) {
        createMethod(factory, Config.getInstant().getArrayFromDataStr().replace("$ClassName$", cls.getName()).trim(), cls);
    }
    if (Config.getInstant().isArrayFromData1()) {
        createMethod(factory, Config.getInstant().getArrayFromData1Str().replace("$ClassName$", cls.getName()).trim(), cls);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:Processor.java

示例2: checkClass

import com.intellij.psi.PsiClass; //导入方法依赖的package包/类
@Override
public void checkClass(JavaContext context, PsiClass node) {
    super.checkClass(context, node);

    String name = node.getName();
    mSet.add(name);

}
 
开发者ID:jessie345,项目名称:CustomLintRules,代码行数:9,代码来源:AutoPointRegisteredCustomViewDetector.java

示例3: buildClassLookup

import com.intellij.psi.PsiClass; //导入方法依赖的package包/类
private Optional<LookupElementBuilder> buildClassLookup(PsiClass psiClass) {
    String qualifiedName = psiClass.getQualifiedName();
    String name = psiClass.getName();
    if (qualifiedName != null && name != null) {
        return Optional.of(JavaLookupElementBuilder.forClass(psiClass, qualifiedName, true).withPresentableText(name));
    } else {
        return Optional.empty();
    }
}
 
开发者ID:seedstack,项目名称:intellij-plugin,代码行数:10,代码来源:ClassCompletionResolver.java

示例4: buildName

import com.intellij.psi.PsiClass; //导入方法依赖的package包/类
private String buildName(PsiClass psiClass) {
    String simpleName = psiClass.getName();
    if (simpleName != null) {
        return humanizeString(simpleName, "Tool");
    } else {
        throw new IllegalStateException("Tool PsiClass has no name");
    }
}
 
开发者ID:seedstack,项目名称:intellij-plugin,代码行数:9,代码来源:ToolNode.java

示例5: doExecute

import com.intellij.psi.PsiClass; //导入方法依赖的package包/类
@Override
protected void doExecute(Editor editor, @Nullable Caret caret, DataContext dataContext) {
    System.out.println("doExecute called: editor = [" + editor + "], caret = [" + caret + "], " +
            "dataContext = [" + dataContext + "]");
    super.doExecute(editor, caret, dataContext);

    Project project = (Project) dataContext.getData(DataKeys.PROJECT.getName());
    if (project == null) return;

    PsiFile rootPsiFile = PsiUtilBase.getPsiFileInEditor(editor, project);
    if (rootPsiFile == null) return;

    PsiClass sourceClassName = Stream.of(rootPsiFile.getChildren())
            .peek(psiElement -> System.out.println(psiElement.getClass()))
            .filter(psiElement -> psiElement instanceof PsiClass)
            .peek(System.out::println)
            .map(psiElement -> (PsiClass) psiElement)
            .collect(Collectors.toList()).get(0);
    SourceClass sourceClass = new SourceClass(sourceClassName.getName());

    List<Variable> extractedVariables = Stream.of(rootPsiFile.getChildren())
            .filter(psiElement -> psiElement instanceof PsiClassImpl)
            .map(PsiElement::getChildren)
            .flatMap(Arrays::stream)
            .filter(psiElement -> psiElement instanceof PsiVariable)
            .map(psiElement -> (PsiVariable) psiElement)
            .map(psiVariable -> new Variable(
                    new Type(psiVariable.getType().getCanonicalText()),
                    new Variable.Name(psiVariable.getName())))
            .peek(System.out::println)
            .collect(Collectors.toList());
    if (extractedVariables.isEmpty()) return;

    PsiClassImpl sourceJavaPsiClass = getRootClassUnderOperation(rootPsiFile);
    if (sourceJavaPsiClass == null) return;

    GeneratedValueWriter writeActionRunner = new GeneratedValueWriter(
            sourceJavaPsiClass, project, extractedVariables, sourceClass, rootPsiFile
    );
    WriteCommandAction.runWriteCommandAction(project, writeActionRunner);
}
 
开发者ID:Ingwersaft,项目名称:ValueClassGenerator,代码行数:42,代码来源:GenerateValueClassHandler.java


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