本文整理汇总了Java中com.intellij.codeInsight.generation.GenerationInfo类的典型用法代码示例。如果您正苦于以下问题:Java GenerationInfo类的具体用法?Java GenerationInfo怎么用?Java GenerationInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GenerationInfo类属于com.intellij.codeInsight.generation包,在下文中一共展示了GenerationInfo类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: generateMemberPrototypes
import com.intellij.codeInsight.generation.GenerationInfo; //导入依赖的package包/类
@NotNull
@Override
protected List<? extends GenerationInfo> generateMemberPrototypes(PsiClass aClass, ClassMember[] members)
throws IncorrectOperationException {
final String templName = JavaTemplateUtil.TEMPLATE_FROM_USAGE_METHOD_BODY;
final FileTemplate template = FileTemplateManager.getInstance(aClass.getProject()).getCodeTemplate(templName);
final GrMethod getter = genGetter(aClass, template);
final GrMethod setter = genSetter(aClass, template);
final ArrayList<GroovyGenerationInfo<GrMethod>> result = new ArrayList<GroovyGenerationInfo<GrMethod>>();
if (getter != null) result.add(new GroovyGenerationInfo<GrMethod>(getter, true));
if (setter != null) result.add(new GroovyGenerationInfo<GrMethod>(setter, true));
return result;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:GroovyGeneratePropertyMissingHandler.java
示例2: generateMemberPrototypes
import com.intellij.codeInsight.generation.GenerationInfo; //导入依赖的package包/类
@NotNull
@Override
protected List<? extends GenerationInfo> generateMemberPrototypes(PsiClass aClass, ClassMember[] members)
throws IncorrectOperationException {
final String templName = JavaTemplateUtil.TEMPLATE_FROM_USAGE_METHOD_BODY;
final FileTemplate template = FileTemplateManager.getInstance().getCodeTemplate(templName);
final GrMethod getter = genGetter(aClass, template);
final GrMethod setter = genSetter(aClass, template);
final ArrayList<GroovyGenerationInfo<GrMethod>> result = new ArrayList<GroovyGenerationInfo<GrMethod>>();
if (getter != null) result.add(new GroovyGenerationInfo<GrMethod>(getter, true));
if (setter != null) result.add(new GroovyGenerationInfo<GrMethod>(setter, true));
return result;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:GroovyGeneratePropertyMissingHandler.java
示例3: insertGenerationInfos
import com.intellij.codeInsight.generation.GenerationInfo; //导入依赖的package包/类
private static void insertGenerationInfos(InsertionContext context, List<PsiGenerationInfo<PsiMethod>> infos)
{
List<PsiGenerationInfo<PsiMethod>> newInfos = GenerateMembersUtil.insertMembersAtOffset(context.getFile(), context.getStartOffset(), infos);
if(!newInfos.isEmpty())
{
final List<PsiElement> elements = new ArrayList<PsiElement>();
for(GenerationInfo member : newInfos)
{
if(!(member instanceof TemplateGenerationInfo))
{
final PsiMember psiMember = member.getPsiMember();
if(psiMember != null)
{
elements.add(psiMember);
}
}
}
GlobalInspectionContextBase.cleanupElements(context.getProject(), null, elements.toArray(new PsiElement[elements.size()]));
newInfos.get(0).positionCaret(context.getEditor(), true);
}
}
开发者ID:consulo,项目名称:consulo-java,代码行数:23,代码来源:JavaGenerateMemberCompletionContributor.java
示例4: addOrReplaceMethod
import com.intellij.codeInsight.generation.GenerationInfo; //导入依赖的package包/类
private static void addOrReplaceMethod(final PsiMethod method, final PsiClass implementor) throws IncorrectOperationException {
final PsiMethod accept = implementor.findMethodBySignature(method, false);
if (accept != null) {
accept.replace(method);
}
else {
GenerateMembersUtil.insertMembersAtOffset(implementor.getContainingFile(), implementor.getLastChild().getTextOffset(), Collections.<GenerationInfo>singletonList(new PsiGenerationInfo<PsiMethod>(method)));
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:GenerateVisitorByHierarchyAction.java
示例5: doTest
import com.intellij.codeInsight.generation.GenerationInfo; //导入依赖的package包/类
private void doTest() throws Exception {
configureByFile(BASE_PATH + getTestName(false) + ".java");
PsiElementFactory factory = JavaPsiFacade.getInstance(getProject()).getElementFactory();
PsiMethod method = factory.createMethod("foo", PsiType.VOID);
int offset = getEditor().getCaretModel().getOffset();
List<GenerationInfo> list = Collections.<GenerationInfo>singletonList(new PsiGenerationInfo<PsiMethod>(method));
List<GenerationInfo> members = GenerateMembersUtil.insertMembersAtOffset(getFile(), offset, list);
members.get(0).positionCaret(myEditor, true);
checkResultByFile(null, BASE_PATH + getTestName(false) + "_after.java", true);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:GenerateMembersUtilTest.java
示例6: generateMemberPrototypes
import com.intellij.codeInsight.generation.GenerationInfo; //导入依赖的package包/类
@NotNull
@Override
protected List<? extends GenerationInfo> generateMemberPrototypes(PsiClass aClass, ClassMember[] members)
throws IncorrectOperationException {
final String templName = JavaTemplateUtil.TEMPLATE_FROM_USAGE_METHOD_BODY;
final FileTemplate template = FileTemplateManager.getInstance(aClass.getProject()).getCodeTemplate(templName);
final GrMethod method = genMethod(aClass, template);
return method != null
? Collections.singletonList(new GroovyGenerationInfo<GrMethod>(method, true))
: Collections.<GenerationInfo>emptyList();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:GroovyGenerateMethodMissingHandler.java
示例7: createGenerationInfo
import com.intellij.codeInsight.generation.GenerationInfo; //导入依赖的package包/类
@Override
public GenerationInfo createGenerationInfo(PsiMethod method, boolean mergeIfExists) {
if (method instanceof GrMethod) {
return new GroovyGenerationInfo<GrMethod>((GrMethod)method, mergeIfExists);
}
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:GroovyMethodImplementor.java
示例8: generateMemberPrototypes
import com.intellij.codeInsight.generation.GenerationInfo; //导入依赖的package包/类
@NotNull
@Override
protected List<? extends GenerationInfo> generateMemberPrototypes(PsiClass aClass, ClassMember[] members) throws IncorrectOperationException {
List<? extends GenerationInfo> memberPrototypes = super.generateMemberPrototypes(aClass, members);
for (GenerationInfo memberPrototype : memberPrototypes) {
PsiModifierList modifierList = memberPrototype.getPsiMember().getModifierList();
if (modifierList != null) {
modifierList.addAnnotation("javax.inject.Inject");
}
}
return memberPrototypes;
}
开发者ID:phajduk,项目名称:dagger2-intellij-plugin,代码行数:13,代码来源:GenerateInjectedConstructorHandler.java
示例9: generateMemberPrototypes
import com.intellij.codeInsight.generation.GenerationInfo; //导入依赖的package包/类
@NotNull
@Override
protected List<? extends GenerationInfo> generateMemberPrototypes(PsiClass aClass, ClassMember[] members)
throws IncorrectOperationException {
final String templName = JavaTemplateUtil.TEMPLATE_FROM_USAGE_METHOD_BODY;
final FileTemplate template = FileTemplateManager.getInstance().getCodeTemplate(templName);
final GrMethod method = genMethod(aClass, template);
return method != null
? Collections.singletonList(new GroovyGenerationInfo<GrMethod>(method, true))
: Collections.<GenerationInfo>emptyList();
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:14,代码来源:GroovyGenerateMethodMissingHandler.java
示例10: generateMemberPrototypes
import com.intellij.codeInsight.generation.GenerationInfo; //导入依赖的package包/类
@Override
@NotNull
protected List<? extends GenerationInfo> generateMemberPrototypes(PsiClass aClass, ClassMember[] members) throws IncorrectOperationException {
final PsiClass proxyClass = proxying(aClass, PsiClass.class);
final List<? extends GenerationInfo> memberPrototypes = super.generateMemberPrototypes(proxyClass, members);
final List<GenerationInfo> result = new ArrayList<GenerationInfo>();
for (GenerationInfo memberPrototype : memberPrototypes) {
result.add(new PsiGenerationInfo<PsiMember>(memberPrototype.getPsiMember(), false));
}
return result;
}
开发者ID:mplushnikov,项目名称:lombok-intellij-plugin,代码行数:14,代码来源:LombokGenerateConstructorHandler.java
示例11: createGenerationInfo
import com.intellij.codeInsight.generation.GenerationInfo; //导入依赖的package包/类
@Nullable
GenerationInfo createGenerationInfo(PsiMethod method, boolean mergeIfExists);
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:3,代码来源:MethodImplementor.java
示例12: createGenerationInfo
import com.intellij.codeInsight.generation.GenerationInfo; //导入依赖的package包/类
@Override
public GenerationInfo createGenerationInfo(PsiMethod method, boolean mergeIfExists) {
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:TraitMethodImplementor.java
示例13: generateMemberPrototypes
import com.intellij.codeInsight.generation.GenerationInfo; //导入依赖的package包/类
@NotNull
@Override
protected List<? extends GenerationInfo> generateMemberPrototypes(PsiClass aClass, ClassMember[] members) throws IncorrectOperationException {
PsiMethod copyConstructor = generateCopyConstructor(aClass, members);
return Collections.singletonList(new PsiGenerationInfo<PsiMethod>(copyConstructor));
}
开发者ID:jkovacs,项目名称:CopyConstructorPlugin,代码行数:7,代码来源:GenerateCopyConstructorHandler.java
注:本文中的com.intellij.codeInsight.generation.GenerationInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论