本文整理汇总了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]);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
}
示例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());
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}