• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java CreateClassDialog类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中com.intellij.codeInsight.intention.impl.CreateClassDialog的典型用法代码示例。如果您正苦于以下问题:Java CreateClassDialog类的具体用法?Java CreateClassDialog怎么用?Java CreateClassDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

CreateClassDialog类属于com.intellij.codeInsight.intention.impl包,在下文中一共展示了CreateClassDialog类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getTargetDirectory

点赞 3

import com.intellij.codeInsight.intention.impl.CreateClassDialog; //导入依赖的package包/类
@Nullable
protected PsiDirectory getTargetDirectory(@NotNull Project project,
                                          @NotNull String qualifier,
                                          @NotNull String name,
                                          @Nullable Module module,
                                          @NotNull String title) {
  CreateClassDialog dialog = new CreateClassDialog(project, title, name, qualifier, getType(), false, module) {
    @Override
    protected boolean reportBaseInSourceSelectionInTest() {
      return true;
    }
  };
  dialog.show();
  if (dialog.getExitCode() != DialogWrapper.OK_EXIT_CODE) return null;

  return dialog.getTargetDirectory();
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:18,
代码来源:CreateClassActionBase.java

示例2: processIntention

点赞 2

import com.intellij.codeInsight.intention.impl.CreateClassDialog; //导入依赖的package包/类
@Override
protected void processIntention(@NotNull PsiElement element, final Project project, Editor editor) throws IncorrectOperationException {
  final GrListOrMap map = (GrListOrMap)element;
  final GrNamedArgument[] namedArguments = map.getNamedArguments();
  LOG.assertTrue(map.getInitializers().length == 0);
  final PsiFile file = map.getContainingFile();
  final String packageName = file instanceof GroovyFileBase ? ((GroovyFileBase)file).getPackageName() : "";

  final CreateClassDialog dialog =
    new CreateClassDialog(project, GroovyBundle.message("create.class.family.name"), "", packageName, GrCreateClassKind.CLASS, true,
                          ModuleUtilCore.findModuleForPsiElement(element));
  dialog.show();
  if (dialog.getExitCode() != DialogWrapper.OK_EXIT_CODE) return;

  boolean replaceReturnType = checkForReturnFromMethod(map);
  boolean variableDeclaration = checkForVariableDeclaration(map);
  final GrParameter methodParameter = checkForMethodParameter(map);

  final String qualifiedClassName = dialog.getClassName();
  final String selectedPackageName = StringUtil.getPackageName(qualifiedClassName);
  final String shortName = StringUtil.getShortName(qualifiedClassName);

  final GrTypeDefinition typeDefinition = createClass(project, namedArguments, selectedPackageName, shortName);
  final PsiClass generatedClass = CreateClassActionBase.createClassByType(
    dialog.getTargetDirectory(), typeDefinition.getName(), PsiManager.getInstance(project), map, GroovyTemplates.GROOVY_CLASS, true);
  final PsiClass replaced = (PsiClass)generatedClass.replace(typeDefinition);
  replaceMapWithClass(project, map, replaced, replaceReturnType, variableDeclaration, methodParameter);
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:29,
代码来源:ConvertMapToClassIntention.java

示例3: createTopLevelClass

点赞 2

import com.intellij.codeInsight.intention.impl.CreateClassDialog; //导入依赖的package包/类
@Override
protected void createTopLevelClass(PsiClass psiClass) {
  final CreateClassDialog dlg = chooseSubclassToCreate(psiClass);
  if (dlg != null) {
    createSubclassGroovy((GrTypeDefinition)psiClass, dlg.getTargetDirectory(), dlg.getClassName());
  }
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:8,
代码来源:GrCreateSubclassAction.java

示例4: processIntention

点赞 2

import com.intellij.codeInsight.intention.impl.CreateClassDialog; //导入依赖的package包/类
@Override
protected void processIntention(@NotNull PsiElement element, final Project project, Editor editor) throws IncorrectOperationException {
  final GrListOrMap map = (GrListOrMap)element;
  final GrNamedArgument[] namedArguments = map.getNamedArguments();
  LOG.assertTrue(map.getInitializers().length == 0);
  final PsiFile file = map.getContainingFile();
  final String packageName = file instanceof GroovyFileBase ? ((GroovyFileBase)file).getPackageName() : "";

  final CreateClassDialog dialog =
    new CreateClassDialog(project, GroovyBundle.message("create.class.family.name"), "", packageName, CreateClassKind.CLASS, true,
                          ModuleUtil.findModuleForPsiElement(element));
  dialog.show();
  if (dialog.getExitCode() != DialogWrapper.OK_EXIT_CODE) return;

  boolean replaceReturnType = checkForReturnFromMethod(map);
  boolean variableDeclaration = checkForVariableDeclaration(map);
  final GrParameter methodParameter = checkForMethodParameter(map);

  final String qualifiedClassName = dialog.getClassName();
  final String selectedPackageName = StringUtil.getPackageName(qualifiedClassName);
  final String shortName = StringUtil.getShortName(qualifiedClassName);

  final GrTypeDefinition typeDefinition = createClass(project, namedArguments, selectedPackageName, shortName);
  final PsiClass generatedClass = CreateClassActionBase.createClassByType(
    dialog.getTargetDirectory(), typeDefinition.getName(), PsiManager.getInstance(project), map, GroovyTemplates.GROOVY_CLASS);
  final PsiClass replaced = (PsiClass)generatedClass.replace(typeDefinition);
  replaceMapWithClass(project, map, replaced, replaceReturnType, variableDeclaration, methodParameter);
}
 

开发者ID:lshain-android-source,
项目名称:tools-idea,
代码行数:29,
代码来源:ConvertMapToClassIntention.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)