Search in sources :

Example 1 with NonProjectFilesScope

use of com.intellij.psi.search.scope.NonProjectFilesScope in project intellij-community by JetBrains.

the class ScopesOrderDialog method fillList.

private void fillList() {
    DefaultListModel model = new DefaultListModel();
    model.removeAllElements();
    final List<String> scopes = new ArrayList<>();
    for (final NamedScopesHolder holder : NamedScopesHolder.getAllNamedScopeHolders(myProject)) {
        for (final NamedScope scope : holder.getScopes()) {
            if (!(scope instanceof NonProjectFilesScope)) {
                scopes.add(scope.getName());
            }
        }
    }
    scopes.remove(CustomScopesProviderEx.getAllScope().getName());
    Collections.sort(scopes, new ScopeOrderComparator(myInspectionProfile));
    for (String scopeName : scopes) {
        model.addElement(scopeName);
    }
    myOptionsList.setModel(model);
    myOptionsList.setSelectedIndex(0);
}
Also used : NamedScope(com.intellij.psi.search.scope.packageSet.NamedScope) NonProjectFilesScope(com.intellij.psi.search.scope.NonProjectFilesScope) NamedScopesHolder(com.intellij.psi.search.scope.packageSet.NamedScopesHolder) ArrayList(java.util.ArrayList)

Example 2 with NonProjectFilesScope

use of com.intellij.psi.search.scope.NonProjectFilesScope in project intellij-community by JetBrains.

the class ScopesChooser method createPopupActionGroup.

@NotNull
@Override
public DefaultActionGroup createPopupActionGroup(final JComponent component) {
    final DefaultActionGroup group = new DefaultActionGroup();
    final List<NamedScope> predefinedScopes = new ArrayList<>();
    final List<NamedScope> customScopes = new ArrayList<>();
    for (final NamedScopesHolder holder : NamedScopesHolder.getAllNamedScopeHolders(myProject)) {
        Collections.addAll(customScopes, holder.getEditableScopes());
        predefinedScopes.addAll(holder.getPredefinedScopes());
    }
    predefinedScopes.remove(CustomScopesProviderEx.getAllScope());
    for (NamedScope predefinedScope : predefinedScopes) {
        if (predefinedScope instanceof NonProjectFilesScope) {
            predefinedScopes.remove(predefinedScope);
            break;
        }
    }
    fillActionGroup(group, predefinedScopes, myDefaultDescriptors, myInspectionProfile, myExcludedScopeNames);
    group.addSeparator();
    fillActionGroup(group, customScopes, myDefaultDescriptors, myInspectionProfile, myExcludedScopeNames);
    group.addSeparator();
    group.add(new DumbAwareAction("Edit Scopes Order...") {

        @Override
        public void actionPerformed(final AnActionEvent e) {
            final ScopesOrderDialog dlg = new ScopesOrderDialog(component, myInspectionProfile, myProject);
            if (dlg.showAndGet()) {
                onScopesOrderChanged();
            }
        }
    });
    return group;
}
Also used : NamedScope(com.intellij.psi.search.scope.packageSet.NamedScope) NonProjectFilesScope(com.intellij.psi.search.scope.NonProjectFilesScope) NamedScopesHolder(com.intellij.psi.search.scope.packageSet.NamedScopesHolder) ArrayList(java.util.ArrayList) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) DumbAwareAction(com.intellij.openapi.project.DumbAwareAction) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

NonProjectFilesScope (com.intellij.psi.search.scope.NonProjectFilesScope)2 NamedScope (com.intellij.psi.search.scope.packageSet.NamedScope)2 NamedScopesHolder (com.intellij.psi.search.scope.packageSet.NamedScopesHolder)2 ArrayList (java.util.ArrayList)2 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)1 DefaultActionGroup (com.intellij.openapi.actionSystem.DefaultActionGroup)1 DumbAwareAction (com.intellij.openapi.project.DumbAwareAction)1 NotNull (org.jetbrains.annotations.NotNull)1