本文整理汇总了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);
}
}
示例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);
}
示例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();
}
}
示例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");
}
}
示例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);
}