コード例 #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 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;
    }