當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。