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


Java IdeView.getDirectories方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: update

import com.intellij.ide.IdeView; //导入方法依赖的package包/类
public void update(final AnActionEvent e) {
  super.update(e);
  final Project project = e.getData(CommonDataKeys.PROJECT);
  final Presentation presentation = e.getPresentation();
  if (presentation.isEnabled()) {
    final IdeView view = e.getData(LangDataKeys.IDE_VIEW);
    if (view != null) {
      final ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
      final PsiDirectory[] dirs = view.getDirectories();
      for (final PsiDirectory dir : dirs) {
        if (projectFileIndex.isUnderSourceRootOfType(dir.getVirtualFile(), JavaModuleSourceRootTypes.SOURCES) && JavaDirectoryService.getInstance().getPackage(dir) != null) {
          return;
        }
      }
    }

    presentation.setEnabled(false);
    presentation.setVisible(false);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:AbstractCreateFormAction.java

示例8: isEnabled

import com.intellij.ide.IdeView; //导入方法依赖的package包/类
private static boolean isEnabled(AnActionEvent e) {
  Project project = e.getData(CommonDataKeys.PROJECT);

  final IdeView ideView = e.getData(LangDataKeys.IDE_VIEW);
  if (project == null || ideView == null)
    return false;

  CatberryProjectConfigurationManager configurationManager = CatberryProjectConfigurationManager.getInstance(project);
  if (!configurationManager.isCatberryEnabled())
    return false;

  final PsiDirectory[] directories = ideView.getDirectories();
  if (directories.length != 1)
    return false;

  final PsiDirectory storesDirectory = configurationManager.getStoresDirectory();
  if(storesDirectory == null)
    return false;

  return directories[0].getVirtualFile().getPath().startsWith(storesDirectory.getVirtualFile().getPath());
}
 
开发者ID:catberry,项目名称:catberry-idea-plugin,代码行数:22,代码来源:CreateCatberryStoreAction.java

示例9: update

import com.intellij.ide.IdeView; //导入方法依赖的package包/类
@Override
public void update(AnActionEvent e) {
    super.update(e);
    final Presentation presentation = e.getPresentation();
    if(presentation.isEnabled()) {
        final IdeView view = e.getData(LangDataKeys.IDE_VIEW);
        final Project project = e.getProject();
        if (view != null && project != null) {
            ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
            PsiDirectory[] dirs = view.getDirectories();
            for (PsiDirectory dir : dirs) {
                if (projectFileIndex.isUnderSourceRootOfType(dir.getVirtualFile(), JavaModuleSourceRootTypes.SOURCES) &&
                        JavaDirectoryService.getInstance().getPackage(dir) != null && isValidForClass(project,dir)) {
                    return;
                }
            }
        }
        presentation.setEnabled(false);
        presentation.setVisible(false);
    }
}
 
开发者ID:wangtotang,项目名称:DaggerHelper,代码行数:22,代码来源:BaseAction.java

示例10: isAvailable

import com.intellij.ide.IdeView; //导入方法依赖的package包/类
protected boolean isAvailable(final DataContext dataContext) {
  final Project project = CommonDataKeys.PROJECT.getData(dataContext);
  if (project == null) {
    return false;
  }

  if (DumbService.getInstance(project).isDumb() && !isDumbAware()) {
    return false;
  }

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

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

示例11: isAvailable

import com.intellij.ide.IdeView; //导入方法依赖的package包/类
@Override
protected boolean isAvailable(final DataContext dataContext) {
  final Project project = CommonDataKeys.PROJECT.getData(dataContext);
  final IdeView view = LangDataKeys.IDE_VIEW.getData(dataContext);
  if (project == null || view == null || view.getDirectories().length == 0) {
    return false;
  }

  if (mySourceRootTypes == null) {
    return true;
  }

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

  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:CreateTemplateInPackageAction.java

示例12: isAvailable

import com.intellij.ide.IdeView; //导入方法依赖的package包/类
protected static boolean isAvailable(DataContext dataContext) {
  final Module module = LangDataKeys.MODULE.getData(dataContext);
  final IdeView view = LangDataKeys.IDE_VIEW.getData(dataContext);

  if (module == null ||
      view == null ||
      view.getDirectories().length == 0 ||
      AndroidFacet.getInstance(module) == null) {
    return false;
  }
  final ProjectFileIndex projectIndex = ProjectRootManager.getInstance(module.getProject()).getFileIndex();
  final JavaDirectoryService dirService = JavaDirectoryService.getInstance();

  for (PsiDirectory dir : view.getDirectories()) {
    if (projectIndex.isUnderSourceRootOfType(dir.getVirtualFile(), JavaModuleSourceRootTypes.SOURCES) &&
        dirService.getPackage(dir) != null &&
        !dirService.getPackage(dir).getQualifiedName().isEmpty()) {
      return true;
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:JavaSourceAction.java

示例13: isAvailable

import com.intellij.ide.IdeView; //导入方法依赖的package包/类
private static boolean isAvailable(DataContext dataContext) {
  final Module module = LangDataKeys.MODULE.getData(dataContext);
  final IdeView view = LangDataKeys.IDE_VIEW.getData(dataContext);

  if (module == null ||
      view == null ||
      view.getDirectories().length == 0) {
    return false;
  }
  final AndroidFacet facet = AndroidFacet.getInstance(module);

  if (facet == null || facet.isGradleProject()) {
    return false;
  }
  final ProjectFileIndex projectIndex = ProjectRootManager.getInstance(module.getProject()).getFileIndex();
  final JavaDirectoryService dirService = JavaDirectoryService.getInstance();

  for (PsiDirectory dir : view.getDirectories()) {
    if (projectIndex.isUnderSourceRootOfType(dir.getVirtualFile(), JavaModuleSourceRootTypes.SOURCES) &&
        dirService.getPackage(dir) != null) {
      return true;
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:LegacyNewAndroidComponentAction.java

示例14: isAvailable

import com.intellij.ide.IdeView; //导入方法依赖的package包/类
protected boolean isAvailable(final DataContext dataContext) {
  final Project project = PlatformDataKeys.PROJECT.getData(dataContext);
  if (project == null) {
    return false;
  }

  if (DumbService.getInstance(project).isDumb() && !isDumbAware()) {
    return false;
  }

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

  return true;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:CreateElementActionBase.java

示例15: isAvailable

import com.intellij.ide.IdeView; //导入方法依赖的package包/类
@Override
protected boolean isAvailable(final DataContext dataContext) {
  final Project project = PlatformDataKeys.PROJECT.getData(dataContext);
  final IdeView view = LangDataKeys.IDE_VIEW.getData(dataContext);
  if (project == null || view == null || view.getDirectories().length == 0) {
    return false;
  }

  if (!myInSourceOnly) {
    return true;
  }

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

  return false;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:CreateTemplateInPackageAction.java


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