コード例 #1
0
  private DefaultComboBoxModel createModel() {
    final DefaultComboBoxModel model = new DefaultComboBoxModel();

    createPredefinedScopeDescriptors(model);

    model.addElement(new ScopeSeparator("VCS Scopes"));
    final List<NamedScope> changeLists =
        ChangeListsScopesProvider.getInstance(myProject).getCustomScopes();
    for (NamedScope changeListScope : changeLists) {
      final GlobalSearchScope scope = GlobalSearchScopes.filterScope(myProject, changeListScope);
      model.addElement(new ScopeDescriptor(scope));
    }

    final List<ScopeDescriptor> customScopes = new ArrayList<ScopeDescriptor>();
    final NamedScopesHolder[] holders = NamedScopesHolder.getAllNamedScopeHolders(myProject);
    for (NamedScopesHolder holder : holders) {
      final NamedScope[] scopes = holder.getEditableScopes(); // predefined scopes already included
      for (NamedScope scope : scopes) {
        final GlobalSearchScope searchScope = GlobalSearchScopes.filterScope(myProject, scope);
        customScopes.add(new ScopeDescriptor(searchScope));
      }
    }
    if (!customScopes.isEmpty()) {
      model.addElement(new ScopeSeparator("Custom Scopes"));
      for (ScopeDescriptor scope : customScopes) {
        model.addElement(scope);
      }
    }

    return model;
  }
コード例 #2
0
  private List<String> getAvailableScopes(Project project, List<Descriptor> descriptors) {
    final ArrayList<NamedScope> scopes = new ArrayList<NamedScope>();
    for (NamedScopesHolder holder : NamedScopesHolder.getAllNamedScopeHolders(project)) {
      Collections.addAll(scopes, holder.getScopes());
    }
    scopes.remove(DefaultScopesProvider.getAllScope());

    CustomScopesProviderEx.filterNoSettingsScopes(project, scopes);

    final Set<NamedScope> used = new HashSet<NamedScope>();
    for (Descriptor descriptor : descriptors) {
      final List<ScopeToolState> nonDefaultTools =
          getSelectedProfile().getNonDefaultTools(descriptor.getKey().toString());
      if (nonDefaultTools != null) {
        for (ScopeToolState state : nonDefaultTools) {
          used.add(state.getScope(project));
        }
      }
    }
    scopes.removeAll(used);

    final List<String> availableScopes = new ArrayList<String>();
    for (NamedScope scope : scopes) {
      availableScopes.add(scope.getName());
    }
    return availableScopes;
  }
コード例 #3
0
    private Collection<String> getValidScopeNames() {
      List<String> result = new ArrayList<String>();
      result.add(SCOPE_PROJECT);
      result.add(SCOPE_TEST);
      result.add(SCOPE_ALL);
      result.add(SCOPE_CLASS);

      final NamedScopesHolder[] holders = NamedScopesHolder.getAllNamedScopeHolders(myProject);
      for (NamedScopesHolder holder : holders) {
        NamedScope[] scopes = holder.getEditableScopes(); // predefined scopes already included
        for (NamedScope scope : scopes) {
          result.add(scope.getName());
        }
      }
      return result;
    }