Java 类com.intellij.psi.search.scope.packageSet.PackageSetBase 实例源码

项目:intellij-ce-playground    文件:GroupTreeNode.java   
private void rebuildFiles(boolean groupByPackages,
                          @Nullable Pair<PackageSetBase, NamedScopesHolder> filter,
                          boolean showOnlyFilteredItems) {
  for (int i = getChildCount() - 1; i >= 0; i--) {
    final TreeNode node = getChildAt(i);
    if (node instanceof Disposable) {
      Disposer.dispose((Disposable)node);
    }
  }
  removeAllChildren();

  if (groupByPackages) {
    buildPackages();
    acceptFilter(filter, showOnlyFilteredItems);
  }
  else {
    buildFiles(filter, showOnlyFilteredItems);
  }

  setTreeModel(myTreeModel);

  if (myTreeModel != null) {
    myTreeModel.nodeStructureChanged(this);
  }
}
项目:intellij-ce-playground    文件:FileTreeNode.java   
@Override
protected boolean acceptFilter(Pair<PackageSetBase, NamedScopesHolder> filter, boolean showOnlyFilteredItems) {
  try {
    VirtualFilePointer filePointer = getFilePointer();
    if (!filePointer.isValid()) {
      return false;
    }
    VirtualFile file = filePointer.getFile();
    if (file != null && file.isValid() && filter.first.contains(file, getProject(), filter.second)) {
      applyFilter(true);
      return true;
    }
  }
  catch (Throwable e) {
    // TODO: catch and ignore exceptions: see to FilePatternPackageSet
    // sometimes for new file DirectoryFileIndex.getContentRootForFile() return random path
  }
  return false;
}
项目:intellij-ce-playground    文件:AbstractTreeNode.java   
protected boolean acceptFilter(@Nullable Pair<PackageSetBase, NamedScopesHolder> filter, boolean showOnlyFilteredItems) {
  boolean apply = false;
  if (children != null && filter != null) {
    for (Iterator it = children.iterator(); it.hasNext(); ) {
      AbstractTreeNode node = (AbstractTreeNode)it.next();
      if (node.acceptFilter(filter, showOnlyFilteredItems)) {
        apply = true;
      }
      else if (showOnlyFilteredItems) {
        if (node instanceof Disposable) {
          Disposer.dispose((Disposable)node);
        }
        it.remove();
      }
    }
    applyFilter(apply);
  }
  return apply;
}
项目:intellij-ce-playground    文件:UpdateInfoTree.java   
@Nullable
private Pair<PackageSetBase, NamedScopesHolder> getScopeFilter() {
  String scopeName = VcsConfiguration.getInstance(myProject).UPDATE_FILTER_SCOPE_NAME;
  if (scopeName != null) {
    for (NamedScopesHolder holder : NamedScopesHolder.getAllNamedScopeHolders(myProject)) {
      NamedScope scope = holder.getScope(scopeName);
      if (scope != null) {
        PackageSet packageSet = scope.getValue();
        if (packageSet instanceof PackageSetBase) {
          return Pair.create((PackageSetBase)packageSet, holder);
        }
      }
    }
  }
  return null;
}
项目:tools-idea    文件:GroupTreeNode.java   
private void rebuildFiles(boolean groupByPackages,
                          @Nullable Pair<PackageSetBase, NamedScopesHolder> filter,
                          boolean showOnlyFilteredItems) {
  for (int i = getChildCount() - 1; i >= 0; i--) {
    final TreeNode node = getChildAt(i);
    if (node instanceof Disposable) {
      Disposer.dispose((Disposable)node);
    }
  }
  removeAllChildren();

  if (groupByPackages) {
    buildPackages();
    acceptFilter(filter, showOnlyFilteredItems);
  }
  else {
    buildFiles(filter, showOnlyFilteredItems);
  }

  setTreeModel(myTreeModel);

  if (myTreeModel != null) {
    myTreeModel.nodeStructureChanged(this);
  }
}
项目:tools-idea    文件:FileTreeNode.java   
@Override
protected boolean acceptFilter(Pair<PackageSetBase, NamedScopesHolder> filter, boolean showOnlyFilteredItems) {
  try {
    VirtualFilePointer filePointer = getFilePointer();
    if (!filePointer.isValid()) {
      return false;
    }
    VirtualFile file = filePointer.getFile();
    if (file != null && file.isValid() && filter.first.contains(file, getProject(), filter.second)) {
      applyFilter(true);
      return true;
    }
  }
  catch (Throwable e) {
    // TODO: catch and ignore exceptions: see to FilePatternPackageSet
    // sometimes for new file DirectoryFileIndex.getContentRootForFile() return random path
  }
  return false;
}
项目:tools-idea    文件:AbstractTreeNode.java   
protected boolean acceptFilter(@Nullable Pair<PackageSetBase, NamedScopesHolder> filter, boolean showOnlyFilteredItems) {
  boolean apply = false;
  if (children != null && filter != null) {
    for (Iterator it = children.iterator(); it.hasNext(); ) {
      AbstractTreeNode node = (AbstractTreeNode)it.next();
      if (node.acceptFilter(filter, showOnlyFilteredItems)) {
        apply = true;
      }
      else if (showOnlyFilteredItems) {
        if (node instanceof Disposable) {
          Disposer.dispose((Disposable)node);
        }
        it.remove();
      }
    }
    applyFilter(apply);
  }
  return apply;
}
项目:tools-idea    文件:UpdateInfoTree.java   
@Nullable
private Pair<PackageSetBase, NamedScopesHolder> getScopeFilter() {
  String scopeName = VcsConfiguration.getInstance(myProject).UPDATE_FILTER_SCOPE_NAME;
  if (scopeName != null) {
    for (NamedScopesHolder holder : NamedScopesHolder.getAllNamedScopeHolders(myProject)) {
      NamedScope scope = holder.getScope(scopeName);
      if (scope != null) {
        PackageSet packageSet = scope.getValue();
        if (packageSet instanceof PackageSetBase) {
          return new Pair<PackageSetBase, NamedScopesHolder>((PackageSetBase)packageSet, holder);
        }
      }
    }
  }
  return null;
}
项目:consulo    文件:GroupTreeNode.java   
private void rebuildFiles(boolean groupByPackages,
                          @Nullable Pair<PackageSetBase, NamedScopesHolder> filter,
                          boolean showOnlyFilteredItems) {
  for (int i = getChildCount() - 1; i >= 0; i--) {
    final TreeNode node = getChildAt(i);
    if (node instanceof Disposable) {
      Disposer.dispose((Disposable)node);
    }
  }
  removeAllChildren();

  if (groupByPackages) {
    buildPackages();
    acceptFilter(filter, showOnlyFilteredItems);
  }
  else {
    buildFiles(filter, showOnlyFilteredItems);
  }

  setTreeModel(myTreeModel);

  if (myTreeModel != null) {
    myTreeModel.nodeStructureChanged(this);
  }
}
项目:consulo    文件:FileTreeNode.java   
@Override
protected boolean acceptFilter(Pair<PackageSetBase, NamedScopesHolder> filter, boolean showOnlyFilteredItems) {
  try {
    VirtualFilePointer filePointer = getFilePointer();
    if (!filePointer.isValid()) {
      return false;
    }
    VirtualFile file = filePointer.getFile();
    if (file != null && file.isValid() && filter.first.contains(file, filter.second)) {
      applyFilter(true);
      return true;
    }
  }
  catch (Throwable e) {
    // TODO: catch and ignore exceptions: see to FilePatternPackageSet
    // sometimes for new file DirectoryFileIndex.getContentRootForFile() return random path
  }
  return false;
}
项目:consulo    文件:AbstractTreeNode.java   
protected boolean acceptFilter(@Nullable Pair<PackageSetBase, NamedScopesHolder> filter, boolean showOnlyFilteredItems) {
  boolean apply = false;
  if (children != null && filter != null) {
    for (Iterator it = children.iterator(); it.hasNext(); ) {
      AbstractTreeNode node = (AbstractTreeNode)it.next();
      if (node.acceptFilter(filter, showOnlyFilteredItems)) {
        apply = true;
      }
      else if (showOnlyFilteredItems) {
        if (node instanceof Disposable) {
          Disposer.dispose((Disposable)node);
        }
        it.remove();
      }
    }
    applyFilter(apply);
  }
  return apply;
}
项目:consulo    文件:UpdateInfoTree.java   
@Nullable
private Pair<PackageSetBase, NamedScopesHolder> getScopeFilter() {
  String scopeName = getFilterScopeName();
  if (scopeName != null) {
    for (NamedScopesHolder holder : NamedScopesHolder.getAllNamedScopeHolders(myProject)) {
      NamedScope scope = holder.getScope(scopeName);
      if (scope != null) {
        PackageSet packageSet = scope.getValue();
        if (packageSet instanceof PackageSetBase) {
          return Pair.create((PackageSetBase)packageSet, holder);
        }
      }
    }
  }
  return null;
}
项目:intellij-ce-playground    文件:GroupTreeNode.java   
public void rebuild(boolean groupByPackages, @Nullable Pair<PackageSetBase, NamedScopesHolder> filter, boolean showOnlyFilteredItems) {
  myFilterAttributes = null;
  if (containsGroups()) {
    rebuildGroups(groupByPackages, filter, showOnlyFilteredItems);
  }
  else {
    rebuildFiles(groupByPackages, filter, showOnlyFilteredItems);
  }
}
项目:intellij-ce-playground    文件:GroupTreeNode.java   
private void rebuildGroups(boolean groupByPackages,
                           @Nullable Pair<PackageSetBase, NamedScopesHolder> filter,
                           boolean showOnlyFilteredItems) {
  boolean apply = false;
  for (int i = 0; i < getChildCount(); i++) {
    GroupTreeNode childGroup = (GroupTreeNode)getChildAt(i);
    childGroup.rebuild(groupByPackages, filter, showOnlyFilteredItems);
    apply |= childGroup.myFilterAttributes != null;
  }
  applyFilter(apply);
}
项目:intellij-ce-playground    文件:GroupTreeNode.java   
private void buildFiles(@Nullable Pair<PackageSetBase, NamedScopesHolder> filter, boolean showOnlyFilteredItems) {
  Collections.sort(myFilePaths, new Comparator<String>() {
    @Override
    public int compare(String path1, String path2) {
      return path1.compareToIgnoreCase(path2);
    }
  });

  boolean apply = false;

  for (final String filePath : myFilePaths) {
    final FileTreeNode child = new FileTreeNode(filePath, myInvalidAttributes, myProject, null);
    if (filter != null) {
      if (child.acceptFilter(filter, showOnlyFilteredItems)) {
        apply = true;
      }
      else if (showOnlyFilteredItems) {
        Disposer.dispose(child);
        continue;
      }
    }
    final String error = myErrorsMap.get(filePath);
    if (error != null) {
      child.setErrorText(error);
    }
    add(child);
    Disposer.register(this, child);
  }

  applyFilter(apply);
}
项目:intellij-ce-playground    文件:FileColorsModel.java   
@Nullable
private FileColorConfiguration findConfiguration(@NotNull final VirtualFile colored) {
  for (FileColorConfiguration configuration : ContainerUtil.concat(myApplicationLevelConfigurations, myProjectLevelConfigurations)) {
    NamedScope scope = NamedScopesHolder.getScope(myProject, configuration.getScopeName());
    if (scope != null) {
      NamedScopesHolder namedScopesHolder = NamedScopesHolder.getHolder(myProject, configuration.getScopeName(), null);
      PackageSet packageSet = scope.getValue();
      if (packageSet instanceof PackageSetBase && namedScopesHolder != null && ((PackageSetBase)packageSet).contains(colored, myProject, namedScopesHolder)) {
        return configuration;
      }
    }
  }
  return null;
}
项目:tools-idea    文件:GroupTreeNode.java   
public void rebuild(boolean groupByPackages, @Nullable Pair<PackageSetBase, NamedScopesHolder> filter, boolean showOnlyFilteredItems) {
  myFilterAttributes = null;
  if (containsGroups()) {
    rebuildGroups(groupByPackages, filter, showOnlyFilteredItems);
  }
  else {
    rebuildFiles(groupByPackages, filter, showOnlyFilteredItems);
  }
}
项目:tools-idea    文件:GroupTreeNode.java   
private void rebuildGroups(boolean groupByPackages,
                           @Nullable Pair<PackageSetBase, NamedScopesHolder> filter,
                           boolean showOnlyFilteredItems) {
  boolean apply = false;
  for (int i = 0; i < getChildCount(); i++) {
    GroupTreeNode childGroup = (GroupTreeNode)getChildAt(i);
    childGroup.rebuild(groupByPackages, filter, showOnlyFilteredItems);
    apply |= childGroup.myFilterAttributes != null;
  }
  applyFilter(apply);
}
项目:tools-idea    文件:GroupTreeNode.java   
private void buildFiles(@Nullable Pair<PackageSetBase, NamedScopesHolder> filter, boolean showOnlyFilteredItems) {
  Collections.sort(myFilePaths, new Comparator<String>() {
    @Override
    public int compare(String path1, String path2) {
      return path1.compareToIgnoreCase(path2);
    }
  });

  boolean apply = false;

  for (final String filePath : myFilePaths) {
    final FileTreeNode child = new FileTreeNode(filePath, myInvalidAttributes, myProject, null);
    if (filter != null) {
      if (child.acceptFilter(filter, showOnlyFilteredItems)) {
        apply = true;
      }
      else if (showOnlyFilteredItems) {
        continue;
      }
    }
    final String error = myErrorsMap.get(filePath);
    if (error != null) {
      child.setErrorText(error);
    }
    add(child);
    Disposer.register(this, child);
  }

  applyFilter(apply);
}
项目:consulo    文件:GroupTreeNode.java   
public void rebuild(boolean groupByPackages, @Nullable Pair<PackageSetBase, NamedScopesHolder> filter, boolean showOnlyFilteredItems) {
  myFilterAttributes = null;
  if (containsGroups()) {
    rebuildGroups(groupByPackages, filter, showOnlyFilteredItems);
  }
  else {
    rebuildFiles(groupByPackages, filter, showOnlyFilteredItems);
  }
}
项目:consulo    文件:GroupTreeNode.java   
private void rebuildGroups(boolean groupByPackages,
                           @Nullable Pair<PackageSetBase, NamedScopesHolder> filter,
                           boolean showOnlyFilteredItems) {
  boolean apply = false;
  for (int i = 0; i < getChildCount(); i++) {
    GroupTreeNode childGroup = (GroupTreeNode)getChildAt(i);
    childGroup.rebuild(groupByPackages, filter, showOnlyFilteredItems);
    apply |= childGroup.myFilterAttributes != null;
  }
  applyFilter(apply);
}
项目:consulo    文件:GroupTreeNode.java   
private void buildFiles(@Nullable Pair<PackageSetBase, NamedScopesHolder> filter, boolean showOnlyFilteredItems) {
  Collections.sort(myFilePaths, new Comparator<String>() {
    @Override
    public int compare(String path1, String path2) {
      return path1.compareToIgnoreCase(path2);
    }
  });

  boolean apply = false;

  for (final String filePath : myFilePaths) {
    final FileTreeNode child = new FileTreeNode(filePath, myInvalidAttributes, myProject, null);
    if (filter != null) {
      if (child.acceptFilter(filter, showOnlyFilteredItems)) {
        apply = true;
      }
      else if (showOnlyFilteredItems) {
        continue;
      }
    }
    final String error = myErrorsMap.get(filePath);
    if (error != null) {
      child.setErrorText(error);
    }
    add(child);
    Disposer.register(this, child);
  }

  applyFilter(apply);
}
项目:consulo    文件:UpdateInfoTree.java   
int getFilteredFilesCount() {
  Pair<PackageSetBase, NamedScopesHolder> scopeFilter = getScopeFilter();
  int[] result = new int[1];
  TreeUtil.traverse(myRoot, node -> {
    if (node instanceof FileTreeNode) {
      if (((FileTreeNode)node).acceptFilter(scopeFilter, true)) {
        result[0]++;
      }
    }
    return true;
  });
  return result[0];
}
项目:consulo    文件:UpdateInfoTree.java   
@Nullable
NamedScope getFilterScope() {
  Pair<PackageSetBase, NamedScopesHolder> filter = getScopeFilter();
  return filter == null ? null : filter.second.getScope(getFilterScopeName());
}