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

项目:intellij-ce-playground    文件:HighlightNamesUtil.java   
private static TextAttributes getScopeAttributes(@NotNull PsiElement element, @NotNull TextAttributesScheme colorsScheme) {
  PsiFile file = element.getContainingFile();
  if (file == null) return null;
  TextAttributes result = null;
  DependencyValidationManagerImpl validationManager = (DependencyValidationManagerImpl)DependencyValidationManager.getInstance(file.getProject());
  List<Pair<NamedScope,NamedScopesHolder>> scopes = validationManager.getScopeBasedHighlightingCachedScopes();
  for (Pair<NamedScope, NamedScopesHolder> scope : scopes) {
    final NamedScope namedScope = scope.getFirst();
    final TextAttributesKey scopeKey = ScopeAttributesUtil.getScopeTextAttributeKey(namedScope.getName());
    final TextAttributes attributes = colorsScheme.getAttributes(scopeKey);
    if (attributes == null || attributes.isEmpty()) {
      continue;
    }
    final PackageSet packageSet = namedScope.getValue();
    if (packageSet != null && packageSet.contains(file, scope.getSecond())) {
      result = TextAttributes.merge(attributes, result);
    }
  }
  return result;
}
项目:intellij-ce-playground    文件:ToolsImpl.java   
@NotNull
@Override
public InspectionToolWrapper getInspectionTool(PsiElement element) {
  if (myTools != null) {
    final PsiFile containingFile = element == null ? null : element.getContainingFile();
    final Project project = containingFile == null ? null : containingFile.getProject();
    for (ScopeToolState state : myTools) {
      if (element == null) {
        return state.getTool();
      }
      NamedScope scope = state.getScope(project);
      if (scope != null) {
        final PackageSet packageSet = scope.getValue();
        if (packageSet != null) {
          if (containingFile != null && packageSet.contains(containingFile, DependencyValidationManager.getInstance(project))) {
            return state.getTool();
          }
        }
      }
    }

  }
  return myDefaultState.getTool();
}
项目:intellij-ce-playground    文件:ToolsImpl.java   
@Override
public boolean isEnabled(PsiElement element) {
  if (!myEnabled) return false;
  if (myTools == null || element == null) return myDefaultState.isEnabled();
  final Project project = element.getProject();
  final DependencyValidationManager manager = DependencyValidationManager.getInstance(project);
  for (ScopeToolState state : myTools) {
    final NamedScope scope = state.getScope(project);
    if (scope != null) {
      final PackageSet set = scope.getValue();
      if (set != null && set.contains(element.getContainingFile(), manager)) {
        return state.isEnabled();
      }
    }
  }
  return myDefaultState.isEnabled();
}
项目:intellij-ce-playground    文件:ToolsImpl.java   
@Override
@Nullable
public InspectionToolWrapper getEnabledTool(PsiElement element) {
  if (!myEnabled) return null;
  if (myTools == null || element == null) {
    return myDefaultState.isEnabled() ? myDefaultState.getTool() : null;
  }
  final Project project = element.getProject();
  final DependencyValidationManager manager = DependencyValidationManager.getInstance(project);
  for (ScopeToolState state : myTools) {
    final NamedScope scope = state.getScope(project);
    if (scope != null) {
      final PackageSet set = scope.getValue();
      if (set != null && set.contains(element.getContainingFile(), manager)) {
        return state.isEnabled() ? state.getTool() : null;
      }
    }
  }
  return myDefaultState.isEnabled() ? myDefaultState.getTool() : null;
}
项目:intellij-ce-playground    文件:ToolsImpl.java   
public void disableTool(@NotNull PsiElement element) {
  final Project project = element.getProject();
  final DependencyValidationManager validationManager = DependencyValidationManager.getInstance(project);
  if (myTools != null) {
    for (ScopeToolState state : myTools) {
      final NamedScope scope = state.getScope(project);
      if (scope != null) {
        final PackageSet packageSet = scope.getValue();
        if (packageSet != null && packageSet.contains(element.getContainingFile(), validationManager)) {
          state.setEnabled(false);
          return;
        }
      }
    }
    myDefaultState.setEnabled(false);
  }
  else {
    myDefaultState.setEnabled(false);
    setEnabled(false);
  }
}
项目: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;
}
项目:intellij-ce-playground    文件:CopyrightManager.java   
@Nullable
public CopyrightProfile getCopyrightOptions(@NotNull PsiFile file) {
  final VirtualFile virtualFile = file.getVirtualFile();
  if (virtualFile == null || myOptions.getOptions(virtualFile.getFileType().getName()).getFileTypeOverride() == LanguageOptions.NO_COPYRIGHT) return null;
  final DependencyValidationManager validationManager = DependencyValidationManager.getInstance(myProject);
  for (String scopeName : myModuleToCopyrights.keySet()) {
    final NamedScope namedScope = validationManager.getScope(scopeName);
    if (namedScope != null) {
      final PackageSet packageSet = namedScope.getValue();
      if (packageSet != null) {
        if (packageSet.contains(file, validationManager)) {
          final CopyrightProfile profile = myCopyrights.get(myModuleToCopyrights.get(scopeName));
          if (profile != null) {
            return profile;
          }
        }
      }
    }
  }
  return myDefaultCopyright != null ? myDefaultCopyright : null;
}
项目:tools-idea    文件:HighlightNamesUtil.java   
private static TextAttributes getScopeAttributes(@NotNull PsiElement element, @NotNull TextAttributesScheme colorsScheme) {
  PsiFile file = element.getContainingFile();
  if (file == null) return null;
  TextAttributes result = null;
  final DaemonCodeAnalyzerImpl daemonCodeAnalyzer = (DaemonCodeAnalyzerImpl)DaemonCodeAnalyzer.getInstance(file.getProject());
  List<Pair<NamedScope,NamedScopesHolder>> scopes = daemonCodeAnalyzer.getScopeBasedHighlightingCachedScopes();
  for (Pair<NamedScope, NamedScopesHolder> scope : scopes) {
    NamedScope namedScope = scope.getFirst();
    NamedScopesHolder scopesHolder = scope.getSecond();
    PackageSet packageSet = namedScope.getValue();
    if (packageSet != null && packageSet.contains(file, scopesHolder)) {
      TextAttributesKey scopeKey = ColorAndFontOptions.getScopeTextAttributeKey(namedScope.getName());
      TextAttributes attributes = colorsScheme.getAttributes(scopeKey);
      if (attributes == null || attributes.isEmpty()) {
        continue;
      }
      result = TextAttributes.merge(attributes, result);
    }
  }
  return result;
}
项目:tools-idea    文件:ToolsImpl.java   
@Override
public boolean isEnabled(PsiElement element) {
  if (!myEnabled) return false;
  if (myTools == null || element == null) return myDefaultState.isEnabled();
  final Project project = element.getProject();
  final DependencyValidationManager manager = DependencyValidationManager.getInstance(project);
  for (ScopeToolState state : myTools) {
    final NamedScope scope = state.getScope(project);
    if (scope != null) {
      final PackageSet set = scope.getValue();
      if (set != null && set.contains(element.getContainingFile(), manager)) {
        return state.isEnabled();
      }
    }
  }
  return myDefaultState.isEnabled();
}
项目:tools-idea    文件:ToolsImpl.java   
@Override
@Nullable
public InspectionToolWrapper getEnabledTool(PsiElement element) {
  if (!myEnabled) return null;
  if (myTools == null || element == null) {
    return myDefaultState.isEnabled() ? myDefaultState.getTool() : null;
  }
  final Project project = element.getProject();
  final DependencyValidationManager manager = DependencyValidationManager.getInstance(project);
  for (ScopeToolState state : myTools) {
    final NamedScope scope = state.getScope(project);
    if (scope != null) {
      final PackageSet set = scope.getValue();
      if (set != null && set.contains(element.getContainingFile(), manager)) {
        return state.isEnabled() ? state.getTool() : null;
      }
    }
  }
  return myDefaultState.isEnabled() ? myDefaultState.getTool() : null;
}
项目:tools-idea    文件:ToolsImpl.java   
public void disableTool(@NotNull PsiElement element) {
  final Project project = element.getProject();
  final DependencyValidationManager validationManager = DependencyValidationManager.getInstance(project);
  if (myTools != null) {
    for (ScopeToolState state : myTools) {
      final NamedScope scope = state.getScope(project);
      if (scope != null) {
        final PackageSet packageSet = scope.getValue();
        if (packageSet != null && packageSet.contains(element.getContainingFile(), validationManager)) {
          state.setEnabled(false);
          return;
        }
      }
    }
    myDefaultState.setEnabled(false);
  }
  else {
    myDefaultState.setEnabled(false);
    setEnabled(false);
  }
}
项目: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;
}
项目:tools-idea    文件:CopyrightManager.java   
@Nullable
public CopyrightProfile getCopyrightOptions(@NotNull PsiFile file) {
  final VirtualFile virtualFile = file.getVirtualFile();
  if (virtualFile == null || myOptions.getOptions(virtualFile.getFileType().getName()).getFileTypeOverride() == LanguageOptions.NO_COPYRIGHT) return null;
  final DependencyValidationManager validationManager = DependencyValidationManager.getInstance(myProject);
  for (String scopeName : myModule2Copyrights.keySet()) {
    final NamedScope namedScope = validationManager.getScope(scopeName);
    if (namedScope != null) {
      final PackageSet packageSet = namedScope.getValue();
      if (packageSet != null) {
        if (packageSet.contains(file, validationManager)) {
          final CopyrightProfile profile = myCopyrights.get(myModule2Copyrights.get(scopeName));
          if (profile != null) {
            return profile;
          }
        }
      }
    }
  }
  return myDefaultCopyright != null ? myDefaultCopyright : null;
}
项目:consulo    文件:ToolsImpl.java   
@Nonnull
@Override
public InspectionToolWrapper getInspectionTool(PsiElement element) {
  if (myTools != null) {
    final PsiFile containingFile = element == null ? null : element.getContainingFile();
    final Project project = containingFile == null ? null : containingFile.getProject();
    for (ScopeToolState state : myTools) {
      if (element == null) {
        return state.getTool();
      }
      NamedScope scope = state.getScope(project);
      if (scope != null) {
        final PackageSet packageSet = scope.getValue();
        if (packageSet != null) {
          if (containingFile != null && packageSet.contains(containingFile, DependencyValidationManager.getInstance(project))) {
            return state.getTool();
          }
        }
      }
    }

  }
  return myDefaultState.getTool();
}
项目:consulo    文件:ToolsImpl.java   
@Override
public boolean isEnabled(PsiElement element) {
  if (!myEnabled) return false;
  if (myTools == null || element == null) return myDefaultState.isEnabled();
  final Project project = element.getProject();
  final DependencyValidationManager manager = DependencyValidationManager.getInstance(project);
  for (ScopeToolState state : myTools) {
    final NamedScope scope = state.getScope(project);
    if (scope != null) {
      final PackageSet set = scope.getValue();
      if (set != null && set.contains(element.getContainingFile(), manager)) {
        return state.isEnabled();
      }
    }
  }
  return myDefaultState.isEnabled();
}
项目:consulo    文件:ToolsImpl.java   
@Override
@Nullable
public InspectionToolWrapper getEnabledTool(PsiElement element) {
  if (!myEnabled) return null;
  if (myTools == null || element == null) {
    return myDefaultState.isEnabled() ? myDefaultState.getTool() : null;
  }
  final Project project = element.getProject();
  final DependencyValidationManager manager = DependencyValidationManager.getInstance(project);
  for (ScopeToolState state : myTools) {
    final NamedScope scope = state.getScope(project);
    if (scope != null) {
      final PackageSet set = scope.getValue();
      if (set != null && set.contains(element.getContainingFile(), manager)) {
        return state.isEnabled() ? state.getTool() : null;
      }
    }
  }
  return myDefaultState.isEnabled() ? myDefaultState.getTool() : null;
}
项目:consulo    文件:ToolsImpl.java   
public void disableTool(@Nonnull PsiElement element) {
  final Project project = element.getProject();
  final DependencyValidationManager validationManager = DependencyValidationManager.getInstance(project);
  if (myTools != null) {
    for (ScopeToolState state : myTools) {
      final NamedScope scope = state.getScope(project);
      if (scope != null) {
        final PackageSet packageSet = scope.getValue();
        if (packageSet != null && packageSet.contains(element.getContainingFile(), validationManager)) {
          state.setEnabled(false);
          return;
        }
      }
    }
    myDefaultState.setEnabled(false);
  }
  else {
    myDefaultState.setEnabled(false);
    setEnabled(false);
  }
}
项目: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;
}
项目:consulo    文件:CopyrightManager.java   
@Nullable
public CopyrightProfile getCopyrightOptions(@Nonnull PsiFile file) {
  final VirtualFile virtualFile = file.getVirtualFile();
  if (virtualFile == null || myCopyrightFileConfigManager.getOptions(virtualFile.getFileType()).getFileTypeOverride() == CopyrightFileConfig.NO_COPYRIGHT) {
    return null;
  }
  final DependencyValidationManager validationManager = DependencyValidationManager.getInstance(myProject);
  for (String scopeName : myModule2Copyrights.keySet()) {
    final NamedScope namedScope = validationManager.getScope(scopeName);
    if (namedScope != null) {
      final PackageSet packageSet = namedScope.getValue();
      if (packageSet != null) {
        if (packageSet.contains(file, validationManager)) {
          final CopyrightProfile profile = myCopyrights.get(myModule2Copyrights.get(scopeName));
          if (profile != null) {
            return profile;
          }
        }
      }
    }
  }
  return myDefaultCopyright != null ? myDefaultCopyright : null;
}
项目:intellij-ce-playground    文件:FindManagerTest.java   
public void testNoFilesFromAdditionalIndexedRootsWithCustomExclusionScope() throws ParsingException {
  FindModel findModel = FindManagerTestUtils.configureFindModel("Object.prototype.__defineGetter__");
  PackageSet compile = PackageSetFactory.getInstance().compile("!src[subdir]:*..*");
  findModel.setCustomScope(GlobalSearchScopesCore.filterScope(myProject, new NamedScope.UnnamedScope(compile)));
  findModel.setCustomScope(true);
  assertSize(0, findUsages(findModel));
}
项目:intellij-ce-playground    文件:DependencyRule.java   
public boolean isForbiddenToUse(@NotNull PsiFile from, @NotNull PsiFile to) {
  if (myFromScope == null || myToScope == null) return false;
  final PackageSet fromSet = myFromScope.getValue();
  final PackageSet toSet = myToScope.getValue();
  if (fromSet == null || toSet == null) return false;
  DependencyValidationManager holder = DependencyValidationManager.getInstance(from.getProject());
  return (myDenyRule
          ? fromSet.contains(from, holder)
          : new ComplementPackageSet(fromSet).contains(from, holder))
         && toSet.contains(to, holder);
}
项目:intellij-ce-playground    文件:DependencyRule.java   
public boolean isApplicable(@NotNull PsiFile file){
  if (myFromScope == null || myToScope == null) return false;
  final PackageSet fromSet = myFromScope.getValue();
  if (fromSet == null) return false;

  DependencyValidationManager holder = DependencyValidationManager.getInstance(file.getProject());
  return myDenyRule
          ? fromSet.contains(file, holder)
          : new ComplementPackageSet(fromSet).contains(file, holder);
}
项目:intellij-ce-playground    文件:DependencyRule.java   
@Nullable
private static String getPackageSetPresentation(NamedScope scope) {
  if (scope != null) {
    final PackageSet packageSet = scope.getValue();
    if (packageSet != null) {
      return packageSet.getText();
    }
  }
  return null;
}
项目:intellij-ce-playground    文件:ToolsImpl.java   
public HighlightDisplayLevel getLevel(PsiElement element) {
  if (myTools == null || element == null) return myDefaultState.getLevel();
  final Project project = element.getProject();
  final DependencyValidationManager manager = DependencyValidationManager.getInstance(project);
  for (ScopeToolState state : myTools) {
    final NamedScope scope = state.getScope(project);
    final PackageSet set = scope != null ? scope.getValue() : null;
    if (set != null && set.contains(element.getContainingFile(), manager)) {
      return state.getLevel();
    }
  }
  return myDefaultState.getLevel();
}
项目: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;
}
项目:intellij-ce-playground    文件:DependencyConfigurable.java   
@Override
public void apply() throws ConfigurationException {
  stopTableEditing();
  DependencyValidationManager validationManager = DependencyValidationManager.getInstance(myProject);
  validationManager.removeAllRules();
  final HashMap<String, PackageSet> unUsed = new HashMap<String, PackageSet>(validationManager.getUnnamedScopes());
  List<DependencyRule> modelItems = new ArrayList<DependencyRule>();
  modelItems.addAll(myDenyRulesModel.getItems());
  modelItems.addAll(myAllowRulesModel.getItems());
  for (DependencyRule rule : modelItems) {
    validationManager.addRule(rule);
    final NamedScope fromScope = rule.getFromScope();
    if (fromScope instanceof NamedScope.UnnamedScope) {
      final PackageSet fromPackageSet = fromScope.getValue();
      LOG.assertTrue(fromPackageSet != null);
      unUsed.remove(fromPackageSet.getText());
    }
    final NamedScope toScope = rule.getToScope();
    if (toScope instanceof NamedScope.UnnamedScope) {
      final PackageSet toPackageSet = toScope.getValue();
      LOG.assertTrue(toPackageSet != null);
      unUsed.remove(toPackageSet.getText());
    }
  }
  for (String text : unUsed.keySet()) {//cleanup
    validationManager.getUnnamedScopes().remove(text);
  }

  validationManager.setSkipImportStatements(mySkipImports.isSelected());

  DaemonCodeAnalyzer.getInstance(myProject).restart();
}
项目:intellij-ce-playground    文件:PackageSetChooserCombo.java   
protected NamedScope[] createModel() {
  final Collection<NamedScope> model = new ArrayList<NamedScope>();
  final DependencyValidationManager manager = DependencyValidationManager.getInstance(myProject);
  model.addAll(Arrays.asList(manager.getScopes()));
  for (PackageSet unnamedScope : manager.getUnnamedScopes().values()) {
    model.add(new NamedScope.UnnamedScope(unnamedScope));
  }
  model.remove(DefaultScopesProvider.getInstance(myProject).getProblemsScope());
  return model.toArray(new NamedScope[model.size()]);
}
项目:intellij-ce-playground    文件:ScopeConfigurable.java   
@Override
public void apply() throws ConfigurationException {
  try {
    myPanel.apply();
    final PackageSet packageSet = myPanel.getCurrentScope();
    myScope = new NamedScope(myScope.getName(), packageSet);
    myPackageSet = packageSet != null ? packageSet.getText() : null;
    myShareScope = mySharedCheckbox.isSelected();
  }
  catch (ConfigurationException e) {
    //was canceled - didn't change anything
  }
}
项目:intellij-ce-playground    文件:ScopeConfigurable.java   
@Override
public void reset() {
  mySharedCheckbox.setSelected(myShareScope);
  myPanel.reset(myScope.getValue(), null);
  final PackageSet packageSet = myScope.getValue();
  myPackageSet = packageSet != null ? packageSet.getText() : null;
}
项目:intellij-ce-playground    文件:ScopePaneSelectInTarget.java   
@Nullable
private NamedScope getContainingScope(PsiFile file) {
  NamedScopesHolder scopesHolder = DependencyValidationManager.getInstance(myProject);
  for (NamedScope scope : ScopeViewPane.getShownScopes(myProject)) {
    PackageSet packageSet = scope.getValue();
    if (packageSet != null && packageSet.contains(file, scopesHolder)) {
      return scope;
    }
  }
  return null;
}
项目:intellij-ce-playground    文件:ScopePaneSelectInTarget.java   
@Override
public boolean isSubIdSelectable(@NotNull String subId, @NotNull SelectInContext context) {
  PsiFileSystemItem file = getContextPsiFile(context);
  if (!(file instanceof PsiFile)) return false;
  final NamedScope scope = NamedScopesHolder.getScope(myProject, subId);
  PackageSet packageSet = scope != null ? scope.getValue() : null;
  if (packageSet == null) return false;
  NamedScopesHolder holder = NamedScopesHolder.getHolder(myProject, subId, DependencyValidationManager.getInstance(myProject));
  return packageSet.contains((PsiFile)file, holder);
}
项目:tools-idea    文件:DependencyRule.java   
public boolean isForbiddenToUse(PsiFile from, PsiFile to) {
  if (myFromScope == null || myToScope == null) return false;
  final PackageSet fromSet = myFromScope.getValue();
  final PackageSet toSet = myToScope.getValue();
  if (fromSet == null || toSet == null) return false;
  DependencyValidationManager holder = DependencyValidationManager.getInstance(from.getProject());
  return (myDenyRule
          ? fromSet.contains(from, holder)
          : new ComplementPackageSet(fromSet).contains(from, holder))
         && toSet.contains(to, holder);
}
项目:tools-idea    文件:DependencyRule.java   
public boolean isApplicable(PsiFile file){
  if (myFromScope == null || myToScope == null) return false;
  final PackageSet fromSet = myFromScope.getValue();
  if (fromSet == null) return false;

  DependencyValidationManager holder = DependencyValidationManager.getInstance(file.getProject());
  return myDenyRule
          ? fromSet.contains(file, holder)
          : new ComplementPackageSet(fromSet).contains(file, holder);
}
项目:tools-idea    文件:DependencyRule.java   
@Nullable
private static String getPackageSetPresentation(NamedScope scope) {
  if (scope != null) {
    final PackageSet packageSet = scope.getValue();
    if (packageSet != null) {
      return packageSet.getText();
    }
  }
  return null;
}
项目:tools-idea    文件:ToolsImpl.java   
public HighlightDisplayLevel getLevel(PsiElement element) {
  if (myTools == null || element == null) return myDefaultState.getLevel();
  final Project project = element.getProject();
  final DependencyValidationManager manager = DependencyValidationManager.getInstance(project);
  for (ScopeToolState state : myTools) {
    final NamedScope scope = state.getScope(project);
    final PackageSet set = scope != null ? scope.getValue() : null;
    if (set != null && set.contains(element.getContainingFile(), manager)) {
      return state.getLevel();
    }
  }
  return myDefaultState.getLevel();
}
项目:tools-idea    文件:DependencyConfigurable.java   
@Override
public void apply() throws ConfigurationException {
  stopTableEditing();
  DependencyValidationManager validationManager = DependencyValidationManager.getInstance(myProject);
  validationManager.removeAllRules();
  final HashMap<String, PackageSet> unUsed = new HashMap<String, PackageSet>(validationManager.getUnnamedScopes());
  List<DependencyRule> modelItems = new ArrayList<DependencyRule>();
  modelItems.addAll(myDenyRulesModel.getItems());
  modelItems.addAll(myAllowRulesModel.getItems());
  for (DependencyRule rule : modelItems) {
    validationManager.addRule(rule);
    final NamedScope fromScope = rule.getFromScope();
    if (fromScope instanceof NamedScope.UnnamedScope) {
      final PackageSet fromPackageSet = fromScope.getValue();
      LOG.assertTrue(fromPackageSet != null);
      unUsed.remove(fromPackageSet.getText());
    }
    final NamedScope toScope = rule.getToScope();
    if (toScope instanceof NamedScope.UnnamedScope) {
      final PackageSet toPackageSet = toScope.getValue();
      LOG.assertTrue(toPackageSet != null);
      unUsed.remove(toPackageSet.getText());
    }
  }
  for (String text : unUsed.keySet()) {//cleanup
    validationManager.getUnnamedScopes().remove(text);
  }

  validationManager.setSkipImportStatements(mySkipImports.isSelected());

  DaemonCodeAnalyzer.getInstance(myProject).restart();
}
项目:tools-idea    文件:ScopeBasedTodosTreeStructure.java   
@Override
public boolean accept(final PsiFile psiFile) {
  if (!psiFile.isValid()) return false;
  boolean isAffected = false;
  final ScopeBasedTodosPanel.ScopeWrapper scope = (ScopeBasedTodosPanel.ScopeWrapper)myScopes.getSelectedItem();
  if (scope != null) {
    final PackageSet value = scope.getNamedScope().getValue();
    if (value != null) {
      isAffected = value.contains(psiFile, NamedScopesHolder.getHolder(myProject, scope.getName(), DependencyValidationManager.getInstance(myProject)));
    }
  }
  return isAffected && (myTodoFilter != null && myTodoFilter.accept(mySearchHelper, psiFile) ||
                        (myTodoFilter == null && mySearchHelper.getTodoItemsCount(psiFile) > 0));
}
项目:tools-idea    文件:PackageSetChooserCombo.java   
protected NamedScope[] createModel() {
  final Collection<NamedScope> model = new ArrayList<NamedScope>();
  final DependencyValidationManager manager = DependencyValidationManager.getInstance(myProject);
  model.addAll(Arrays.asList(manager.getScopes()));
  for (PackageSet unnamedScope : manager.getUnnamedScopes().values()) {
    model.add(new NamedScope.UnnamedScope(unnamedScope));
  }
  model.remove(DefaultScopesProvider.getInstance(myProject).getProblemsScope());
  return model.toArray(new NamedScope[model.size()]);
}
项目:tools-idea    文件:ScopeConfigurable.java   
@Override
public void apply() throws ConfigurationException {
  try {
    myPanel.apply();
    final PackageSet packageSet = myPanel.getCurrentScope();
    myScope = new NamedScope(myScope.getName(), packageSet);
    myPackageSet = packageSet != null ? packageSet.getText() : null;
    myShareScope = mySharedCheckbox.isSelected();
  }
  catch (ConfigurationException e) {
    //was canceled - didn't change anything
  }
}
项目:tools-idea    文件:ScopeConfigurable.java   
@Override
public void reset() {
  mySharedCheckbox.setSelected(myShareScope);
  myPanel.reset(myScope.getValue(), null);
  final PackageSet packageSet = myScope.getValue();
  myPackageSet = packageSet != null ? packageSet.getText() : null;
}