本文整理匯總了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);
}