当前位置: 首页>>代码示例>>Java>>正文


Java IdeView类代码示例

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


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

示例1: invokeDialog

import com.intellij.ide.IdeView; //导入依赖的package包/类
@NotNull
@Override
protected void invokeDialog(AnActionEvent e,Project project, PsiDirectory dir) {
    BaseDialog dialog = new BaseDialog("请输入基类前缀:",project);
    dialog.show();
    if (dialog.getExitCode() == DialogWrapper.OK_EXIT_CODE) {
        String prefix = dialog.getClassNamePrefix();
        if(prefix != null && !prefix.isEmpty()){
            Application application = ApplicationManager.getApplication();
            application.runWriteAction(() -> {
                PsiElement createdElement = createProjectDir(dir,prefix);
                final IdeView view = e.getData(LangDataKeys.IDE_VIEW);
                if(view != null&&createdElement != null){
                    view.selectElement(createdElement);
                }
            });
        }
    }
}
 
开发者ID:wangtotang,项目名称:DaggerHelper,代码行数:20,代码来源:NewModuleDirAction.java

示例2: getExtensionDirectory

import com.intellij.ide.IdeView; //导入依赖的package包/类
public static PsiDirectory getExtensionDirectory(@NotNull AnActionEvent event) {
    Project project = event.getData(PlatformDataKeys.PROJECT);
    if (project == null) {
        return null;
    }

    DataContext dataContext = event.getDataContext();
    IdeView view = LangDataKeys.IDE_VIEW.getData(dataContext);
    if (view == null) {
        return null;
    }

    PsiDirectory[] directories = view.getDirectories();
    if (directories.length == 0) {
        return null;
    }

    return FilesystemUtil.findParentExtensionDirectory(directories[0]);
}
 
开发者ID:cedricziel,项目名称:idea-php-typo3-plugin,代码行数:20,代码来源:ExtensionUtility.java

示例3: isAvailable

import com.intellij.ide.IdeView; //导入依赖的package包/类
@CheckReturnValue
@VisibleForTesting
@SuppressWarnings("WeakerAccess")
static boolean isAvailable(@Nonnull AnActionEvent event) {
    final Project project = event.getProject();
    if (project == null) {
        return false;
    }

    final IdeView view = event.getData(LangDataKeys.IDE_VIEW);
    if (view == null) {
        return false;
    }

    final ProjectRootManager rootManager = ProjectRootManager.getInstance(project);
    final ProjectFileIndex fileIndex = rootManager.getFileIndex();
    final Optional<PsiDirectory> sourceDirectory = Stream.of(view.getDirectories())
            .filter(directory -> {
                final VirtualFile virtualFile = directory.getVirtualFile();
                return fileIndex.isUnderSourceRootOfType(virtualFile, JavaModuleSourceRootTypes.SOURCES);
            })
            .findFirst();
    return sourceDirectory.isPresent();
}
 
开发者ID:t28hub,项目名称:json2java4idea,代码行数:25,代码来源:NewClassAction.java

示例4: createTaskContent

import com.intellij.ide.IdeView; //导入依赖的package包/类
@Override
public PsiDirectory createTaskContent(@NotNull Project project,
                                      @NotNull Task task,
                                      @Nullable IdeView view,
                                      @NotNull PsiDirectory parentDirectory,
                                      @NotNull Course course) {
  final Ref<PsiDirectory> taskDirectory = new Ref<>();
  ApplicationManager.getApplication().runWriteAction(() -> {
    String taskDirName = EduNames.TASK + task.getIndex();
    taskDirectory.set(DirectoryUtil.createSubdirectories(taskDirName, parentDirectory, "\\/"));
    if (taskDirectory.isNull()) return;

    if (course.isAdaptive() && !task.getTaskFiles().isEmpty()) {
      createTaskFilesFromText(task, taskDirectory.get());
    }
    else {
      createFilesFromTemplates(project, view, taskDirectory.get());
    }
  });
  return taskDirectory.get();
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:22,代码来源:PyEduPluginConfigurator.java

示例5: createFromTemplate

import com.intellij.ide.IdeView; //导入依赖的package包/类
public static void createFromTemplate(@NotNull Project project,
                                      @NotNull PsiDirectory taskDirectory,
                                      @NotNull String name,
                                      @Nullable IdeView view,
                                      boolean open) {
  FileTemplate template = FileTemplateManager.getInstance(project).getInternalTemplate(name);
  if (template == null) {
    LOG.info("Template " + name + " wasn't found");
    return;
  }
  try {
    final PsiElement file = FileTemplateUtil.createFromTemplate(template, name, null, taskDirectory);
    if (view != null && open) {
      EditorHelper.openInEditor(file, false);
      view.selectElement(file);
    }
  }
  catch (Exception e) {
    LOG.error(e);
  }
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:22,代码来源:StudyUtils.java

示例6: createLessonContent

import com.intellij.ide.IdeView; //导入依赖的package包/类
@Override
public PsiDirectory createLessonContent(@NotNull Project project, @NotNull Lesson lesson, @Nullable IdeView view, @NotNull PsiDirectory parentDirectory) {
  NewModuleAction newModuleAction = new NewModuleAction();
  String courseDirPath = parentDirectory.getVirtualFile().getPath();
  Module utilModule = ModuleManager.getInstance(project).findModuleByName(EduIntelliJNames.UTIL);
  if (utilModule == null) {
    return null;
  }
  newModuleAction.createModuleFromWizard(project, null, new AbstractProjectWizard("", project, "") {
    @Override
    public StepSequence getSequence() {
      return null;
    }

    @Override
    public ProjectBuilder getProjectBuilder() {
      return new EduLessonModuleBuilder(courseDirPath, lesson, utilModule);
    }
  });
  return parentDirectory.findSubdirectory(EduNames.LESSON + lesson.getIndex());
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:22,代码来源:EduPluginConfiguratorBase.java

示例7: createLessonContent

import com.intellij.ide.IdeView; //导入依赖的package包/类
/**
 * Creates content (including its directory or module) of new lesson in project
 *
 * @param project Parameter is used in Java and Kotlin plugins
 * @param lesson  Lesson to create content for. It's already properly initialized and added to course.
 * @return PsiDirectory of created lesson
 */
default PsiDirectory createLessonContent(@NotNull Project project,
                                         @NotNull Lesson lesson,
                                         @Nullable IdeView view,
                                         @NotNull PsiDirectory parentDirectory) {
  final PsiDirectory[] lessonDirectory = new PsiDirectory[1];
  ApplicationManager.getApplication().runWriteAction(() -> {
    String lessonDirName = EduNames.LESSON + lesson.getIndex();
    lessonDirectory[0] = DirectoryUtil.createSubdirectories(lessonDirName, parentDirectory, "\\/");
  });
  if (lessonDirectory[0] != null) {
    if (view != null) {
      view.selectElement(lessonDirectory[0]);
    }
  }
  return lessonDirectory[0];
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:24,代码来源:EduPluginConfigurator.java

示例8: actionPerformed

import com.intellij.ide.IdeView; //导入依赖的package包/类
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
  final IdeView view = e.getData(LangDataKeys.IDE_VIEW);
  final Project project = e.getData(CommonDataKeys.PROJECT);
  if (view == null || project == null) {
    return;
  }
  final String courseId = Messages.showInputDialog("Please, enter course id", "Get Course From Stepik", null);
  if (StringUtil.isNotEmpty(courseId)) {
    ProgressManager.getInstance().run(new Task.Modal(project, "Creating Course", true) {
      @Override
      public void run(@NotNull final ProgressIndicator indicator) {
        createCourse(project, courseId);
      }
    });
  }
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:18,代码来源:CCGetCourseFromStepic.java

示例9: actionPerformed

import com.intellij.ide.IdeView; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
  final IdeView view = e.getData(LangDataKeys.IDE_VIEW);
  final Project project = e.getProject();
  if (view == null || project == null) {
    return;
  }
  final PsiDirectory[] directories = view.getDirectories();
  if (directories.length == 0 || directories.length > 1) {
    return;
  }

  final PsiDirectory directory = directories[0];
  if (directory == null) return;
  final Course course = StudyTaskManager.getInstance(project).getCourse();
  if (course == null) {
    return;
  }
  createItem(view, project, directory, course);
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:21,代码来源:CCCreateStudyItemActionBase.java

示例10: createItem

import com.intellij.ide.IdeView; //导入依赖的package包/类
@Nullable
public PsiDirectory createItem(@Nullable final IdeView view, @NotNull final Project project,
                               @NotNull final PsiDirectory sourceDirectory, @NotNull final Course course) {
  StudyItem parentItem = getParentItem(course, sourceDirectory);
  final StudyItem item = getItem(sourceDirectory, project, course, view, parentItem);
  if (item == null) {
    return null;
  }
  final PsiDirectory parentDir = getParentDir(project, course, sourceDirectory);
  if (parentDir == null) {
    return null;
  }
  CCUtils.updateHigherElements(parentDir.getVirtualFile().getChildren(), getStudyOrderable(item),
                               item.getIndex() - 1, getItemName(), 1);
  addItem(course, item);
  sortSiblings(course, parentItem);
  return createItemDir(project, item, view, parentDir, course);
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:19,代码来源:CCCreateStudyItemActionBase.java

示例11: update

import com.intellij.ide.IdeView; //导入依赖的package包/类
@Override
public void update(@NotNull AnActionEvent event) {
  final Project project = event.getProject();
  final Presentation presentation = event.getPresentation();
  if (project == null) {
    return;
  }
  presentation.setEnabledAndVisible(false);
  if (!CCUtils.isCourseCreator(project)) {
    return;
  }
  final IdeView view = event.getData(LangDataKeys.IDE_VIEW);
  if (view == null) {
    return;
  }
  final PsiDirectory[] directories = view.getDirectories();
  if (directories.length == 0) {
    return;
  }
  presentation.setEnabledAndVisible(true);
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:22,代码来源:CCChangeCourseInfo.java

示例12: canMove

import com.intellij.ide.IdeView; //导入依赖的package包/类
@Override
public boolean canMove(DataContext dataContext) {
  if (CommonDataKeys.PSI_FILE.getData(dataContext) != null) {
    return false;
  }
  IdeView view = LangDataKeys.IDE_VIEW.getData(dataContext);
  if (view == null) {
    return false;
  }

  final PsiDirectory[] directories = view.getDirectories();
  if (directories.length == 0 || directories.length > 1) {
    return false;
  }

  final PsiDirectory sourceDirectory = directories[0];
  return CCUtils.isLessonDir(sourceDirectory);
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:19,代码来源:CCLessonMoveHandlerDelegate.java

示例13: canMove

import com.intellij.ide.IdeView; //导入依赖的package包/类
@Override
public boolean canMove(DataContext dataContext) {
  if (CommonDataKeys.PSI_FILE.getData(dataContext) != null) {
    return false;
  }
  IdeView view = LangDataKeys.IDE_VIEW.getData(dataContext);
  if (view == null) {
    return false;
  }
  final PsiDirectory[] directories = view.getDirectories();
  if (directories.length == 0 || directories.length > 1) {
    return false;
  }

  final PsiDirectory sourceDirectory = directories[0];
  return isTaskDir(sourceDirectory);
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:18,代码来源:CCTaskMoveHandlerDelegate.java

示例14: isAvailable

import com.intellij.ide.IdeView; //导入依赖的package包/类
/**
 * Checked whether or not this action can be enabled.
 *
 * <p>Requirements to be enabled: * User must be in a Java source folder.
 *
 * @param dataContext to figure out where the user is.
 * @return {@code true} when the action is available, {@code false} when the action is not
 *     available.
 */
private boolean isAvailable(DataContext dataContext) {
  final Project project = CommonDataKeys.PROJECT.getData(dataContext);
  if (project == null) {
    return false;
  }

  final IdeView view = LangDataKeys.IDE_VIEW.getData(dataContext);
  if (view == null || view.getDirectories().length == 0) {
    return false;
  }

  ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
  for (PsiDirectory dir : view.getDirectories()) {
    if (projectFileIndex.isUnderSourceRootOfType(
            dir.getVirtualFile(), JavaModuleSourceRootTypes.SOURCES)
        && checkPackageExists(dir)) {
      return true;
    }
  }

  return false;
}
 
开发者ID:uber,项目名称:RIBs,代码行数:32,代码来源:GenerateAction.java

示例15: actionPerformed

import com.intellij.ide.IdeView; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
    final DataContext dataContext = e.getDataContext();
    final Project project = CommonDataKeys.PROJECT.getData(dataContext);
    final Module module = LangDataKeys.MODULE.getData(dataContext);
    final IdeView view = LangDataKeys.IDE_VIEW.getData(dataContext);
    if (view == null) {
        return;
    }

    CreateNewThemeDialog dialog = new CreateNewThemeDialog(project);
    dialog.show();

    if (dialog.getExitCode() == 0) {
        themeData = dialog.getThemeData();
        createTheme(project, module);
    }
}
 
开发者ID:PioBeat,项目名称:GravSupport,代码行数:19,代码来源:CreateNewThemeAction.java


注:本文中的com.intellij.ide.IdeView类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。