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


Java ProjectRootsUtil.isLibraryRoot方法代码示例

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


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

示例1: navigate

import com.intellij.ide.projectView.impl.ProjectRootsUtil; //导入方法依赖的package包/类
@Override
public void navigate(final boolean requestFocus) {
  Module module = ModuleUtil.findModuleForPsiElement(getValue());
  if (module != null) {
    final VirtualFile file = getVirtualFile();
    final Project project = getProject();
    ProjectSettingsService service = ProjectSettingsService.getInstance(myProject);
    if (ProjectRootsUtil.isModuleContentRoot(file, project)) {
      service.openModuleSettings(module);
    }
    else if (ProjectRootsUtil.isLibraryRoot(file, project)) {
      final OrderEntry orderEntry = LibraryUtil.findLibraryEntry(file, module.getProject());
      if (orderEntry != null) {
        service.openLibraryOrSdkSettings(orderEntry);
      }
    }
    else {
      service.openContentEntriesSettings(module);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:PsiDirectoryNode.java

示例2: getNavigateActionText

import com.intellij.ide.projectView.impl.ProjectRootsUtil; //导入方法依赖的package包/类
@Override
public String getNavigateActionText(boolean focusEditor) {
  VirtualFile file = getVirtualFile();
  Project project = getProject();

  if (file != null && project != null) {
    if (ProjectRootsUtil.isModuleContentRoot(file, project) || ProjectRootsUtil.isModuleSourceRoot(file, project)) {
      return "Open Module Settings";
    }
    if (ProjectRootsUtil.isLibraryRoot(file, project)) {
      return "Open Library Settings";
    }
  }

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

示例3: getNavigateActionText

import com.intellij.ide.projectView.impl.ProjectRootsUtil; //导入方法依赖的package包/类
@Override
public String getNavigateActionText(boolean focusEditor) {
  VirtualFile file = getVirtualFile();
  Project project = getProject();

  if (file != null) {
    if (ProjectRootsUtil.isModuleContentRoot(file, project) ||
        ProjectRootsUtil.isSourceOrTestRoot(file, project)) {
      return "Open Module Settings";
    }
    if (ProjectRootsUtil.isLibraryRoot(file, project)) {
      return "Open Library Settings";
    }
  }

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

示例4: canNavigate

import com.intellij.ide.projectView.impl.ProjectRootsUtil; //导入方法依赖的package包/类
@Override
public boolean canNavigate() {
  VirtualFile file = getVirtualFile();
  Project project = getProject();

  ProjectSettingsService service = ProjectSettingsService.getInstance(myProject);
  return file != null && ((ProjectRootsUtil.isModuleContentRoot(file, project) && service.canOpenModuleSettings()) ||
                          (ProjectRootsUtil.isModuleSourceRoot(file, project)  && service.canOpenContentEntriesSettings()) ||
                          (ProjectRootsUtil.isLibraryRoot(file, project) && service.canOpenModuleLibrarySettings()));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:PsiDirectoryNode.java

示例5: getLocationString

import com.intellij.ide.projectView.impl.ProjectRootsUtil; //导入方法依赖的package包/类
@Nullable
public String getLocationString(@NotNull PsiDirectory psiDirectory) {
  final VirtualFile directory = psiDirectory.getVirtualFile();
  
  if (ProjectRootsUtil.isLibraryRoot(directory, psiDirectory.getProject())) {
    return "library home";
  }
  
  final VirtualFile contentRootForFile = ProjectRootManager.getInstance(myProject).getFileIndex().getContentRootForFile(directory);
  if (Comparing.equal(contentRootForFile, psiDirectory)) {
    return directory.getPresentableUrl();
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:ProjectViewDirectoryHelper.java

示例6: isNavigatableLibraryRoot

import com.intellij.ide.projectView.impl.ProjectRootsUtil; //导入方法依赖的package包/类
private boolean isNavigatableLibraryRoot() {
  VirtualFile jarRoot = getJarRoot();
  final Project project = getProject();
  if (jarRoot != null && ProjectRootsUtil.isLibraryRoot(jarRoot, project)) {
    final OrderEntry orderEntry = LibraryUtil.findLibraryEntry(jarRoot, project);
    return orderEntry != null && ProjectSettingsService.getInstance(project).canOpenLibraryOrSdkSettings(orderEntry);
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:PsiFileNode.java

示例7: navigate

import com.intellij.ide.projectView.impl.ProjectRootsUtil; //导入方法依赖的package包/类
@Override
public void navigate(boolean requestFocus) {
  final VirtualFile jarRoot = getJarRoot();
  final Project project = getProject();
  if (requestFocus && jarRoot != null && ProjectRootsUtil.isLibraryRoot(jarRoot, project)) {
    final OrderEntry orderEntry = LibraryUtil.findLibraryEntry(jarRoot, project);
    if (orderEntry != null) {
      ProjectSettingsService.getInstance(project).openLibraryOrSdkSettings(orderEntry);
      return;
    }
  }

  super.navigate(requestFocus);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:PsiFileNode.java

示例8: canNavigate

import com.intellij.ide.projectView.impl.ProjectRootsUtil; //导入方法依赖的package包/类
@Override
public boolean canNavigate() {
  VirtualFile file = getVirtualFile();
  Project project = getProject();

  ProjectSettingsService service = ProjectSettingsService.getInstance(myProject);
  return file != null && ((ProjectRootsUtil.isModuleContentRoot(file, project) && service.canOpenModuleSettings()) ||
                          (ProjectRootsUtil.isSourceOrTestRoot(file, project)  && service.canOpenContentEntriesSettings()) ||
                          (ProjectRootsUtil.isLibraryRoot(file, project) && service.canOpenModuleLibrarySettings()));
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:11,代码来源:PsiDirectoryNode.java

示例9: isNavigatableLibraryRoot

import com.intellij.ide.projectView.impl.ProjectRootsUtil; //导入方法依赖的package包/类
private boolean isNavigatableLibraryRoot() {
  VirtualFile jarRoot = getArchiveRoot();
  final Project project = getProject();
  if (jarRoot != null && ProjectRootsUtil.isLibraryRoot(jarRoot, project)) {
    final OrderEntry orderEntry = LibraryUtil.findLibraryEntry(jarRoot, project);
    return orderEntry != null ;
  }
  return false;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:10,代码来源:PsiFileNode.java

示例10: navigate

import com.intellij.ide.projectView.impl.ProjectRootsUtil; //导入方法依赖的package包/类
@Override
public void navigate(boolean requestFocus) {
  final VirtualFile jarRoot = getArchiveRoot();
  final Project project = getProject();
  if (requestFocus && jarRoot != null && ProjectRootsUtil.isLibraryRoot(jarRoot, project)) {
    final OrderEntry orderEntry = LibraryUtil.findLibraryEntry(jarRoot, project);
    if (orderEntry != null) {
      ProjectSettingsService.getInstance(project).openLibraryOrSdkSettings(orderEntry);
      return;
    }
  }

  super.navigate(requestFocus);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:15,代码来源:PsiFileNode.java

示例11: updateImpl

import com.intellij.ide.projectView.impl.ProjectRootsUtil; //导入方法依赖的package包/类
@Override
protected void updateImpl(PresentationData data) {
  final Project project = getProject();
  final PsiDirectory psiDirectory = getValue();
  final VirtualFile directoryFile = psiDirectory.getVirtualFile();

  final Object parentValue = getParentValue();
  if (ProjectRootsUtil.isModuleContentRoot(directoryFile, project)) {
    ProjectFileIndex fi = ProjectRootManager.getInstance(project).getFileIndex();
    Module module = fi.getModuleForFile(directoryFile);

    data.setPresentableText(directoryFile.getName());
    if (module != null) {
      if (!(parentValue instanceof Module )) {
        if (!shouldShowModuleName()) {
          data.addText(directoryFile.getName() + " ", SimpleTextAttributes.REGULAR_ATTRIBUTES);
        }
        else if (Comparing.equal(module.getName(), directoryFile.getName())) {
          data.addText(directoryFile.getName(), SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
        }
        else {
          data.addText(directoryFile.getName() + " ", SimpleTextAttributes.REGULAR_ATTRIBUTES);
          data.addText("[" + module.getName() + "]", SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
        }
      }
      else {
        data.addText(directoryFile.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
      }

      if (parentValue instanceof Module || parentValue instanceof Project) {
        final String location = FileUtil.getLocationRelativeToUserHome(directoryFile.getPresentableUrl());
        data.addText(" (" + location + ")", SimpleTextAttributes.GRAYED_ATTRIBUTES);
      }
      else if (ProjectRootsUtil.isSourceOrTestRoot(directoryFile, project)) {
        if (ProjectRootsUtil.isInTestSource(directoryFile, project)) {
          data.addText(" (test source root)", SimpleTextAttributes.GRAY_ATTRIBUTES);
        }
        else {
          data.addText(" (source root)",  SimpleTextAttributes.GRAY_ATTRIBUTES);
        }
      }

      setupIcon(data, psiDirectory);

      return;
    }
  }

  final String name = parentValue instanceof Project
                      ? psiDirectory.getVirtualFile().getPresentableUrl()
                      : ProjectViewDirectoryHelper.getInstance(psiDirectory.getProject()).getNodeName(getSettings(), parentValue, psiDirectory);
  if (name == null) {
    setValue(null);
    return;
  }

  data.setPresentableText(name);
  if (ProjectRootsUtil.isLibraryRoot(directoryFile, project)) {
    data.setLocationString("library home");
  }
  else {
    data.setLocationString(ProjectViewDirectoryHelper.getInstance(project).getLocationString(psiDirectory));
  }

  setupIcon(data, psiDirectory);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:67,代码来源:PsiDirectoryNode.java

示例12: updateImpl

import com.intellij.ide.projectView.impl.ProjectRootsUtil; //导入方法依赖的package包/类
@Override
protected void updateImpl(PresentationData data) {
  final Project project = getProject();
  final PsiDirectory psiDirectory = getValue();
  final VirtualFile directoryFile = psiDirectory.getVirtualFile();

  final Object parentValue = getParentValue();
  if (ProjectRootsUtil.isModuleContentRoot(directoryFile, project)) {
    ProjectFileIndex fi = ProjectRootManager.getInstance(project).getFileIndex();
    Module module = fi.getModuleForFile(directoryFile);

    data.setPresentableText(directoryFile.getName());
    if (module != null) {
      if (!(parentValue instanceof Module)) {
        if (Comparing.equal(module.getName(), directoryFile.getName())) {
          data.addText(directoryFile.getName(), SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
        }
        else {
          data.addText(directoryFile.getName() + " ", SimpleTextAttributes.REGULAR_ATTRIBUTES);
          data.addText("[" + module.getName() + "]", SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
        }
      }
      else {
        data.addText(directoryFile.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
      }

      if (parentValue instanceof Module || parentValue instanceof Project) {
        final String location = FileUtil.getLocationRelativeToUserHome(directoryFile.getPresentableUrl());
        data.addText(" (" + location + ")", SimpleTextAttributes.GRAYED_ATTRIBUTES);
      }
      else if (ProjectRootsUtil.isSourceOrTestRoot(directoryFile, project)) {
        if (ProjectRootsUtil.isInTestSource(directoryFile, project)) {
          data.addText(" (test source root)", SimpleTextAttributes.GRAY_ATTRIBUTES);
        }
        else {
          data.addText(" (source root)",  SimpleTextAttributes.GRAY_ATTRIBUTES);
        }
      }

      setupIcon(data, psiDirectory);

      return;
    }
  }

  final String name = parentValue instanceof Project
                      ? psiDirectory.getVirtualFile().getPresentableUrl()
                      : BaseProjectViewDirectoryHelper.getNodeName(getSettings(), parentValue, psiDirectory);
  if (name == null) {
    setValue(null);
    return;
  }

  data.setPresentableText(name);
  if (ProjectRootsUtil.isLibraryRoot(directoryFile, project)) {
    data.setLocationString("library home");
  }
  else {
    data.setLocationString(BaseProjectViewDirectoryHelper.getLocationString(psiDirectory));
  }

  setupIcon(data, psiDirectory);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:64,代码来源:PsiDirectoryNode.java


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