Allow adding custom global search scopes

reference:
OC-9143 Add 'File added to Xcode project' scope
OC-3934 Add 'Files not added to Xcode project' scope to help find and add such files to the project.
CPP-505 Better CMake files overview in the project pane
This commit is contained in:
Anton Makeev
2017-11-18 18:12:34 +01:00
parent 6399455d20
commit c5f79ef3b2
4 changed files with 24 additions and 30 deletions
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.psi.search;
import com.intellij.openapi.actionSystem.DataContext;
@@ -0,0 +1,16 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.psi.search;
import com.intellij.openapi.extensions.ExtensionPointName;
import java.util.List;
public interface SearchScopeProvider {
ExtensionPointName<SearchScopeProvider> EP = ExtensionPointName.create("com.intellij.searchScopesProvider");
/**
* General project scopes are added after 'Project', 'Everything' but before 'Production', 'Tests', etc.
* @see PredefinedSearchScopeProvider
*/
List<SearchScope> getGeneralProjectScopes();
}
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.psi.search;
import com.intellij.ide.IdeBundle;
@@ -27,6 +13,7 @@ import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ReadAction;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.SelectionModel;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.module.*;
import com.intellij.openapi.project.Project;
@@ -76,6 +63,10 @@ public class PredefinedSearchScopeProviderImpl extends PredefinedSearchScopeProv
result.add(GlobalSearchScope.allScope(project));
}
for (SearchScopeProvider each : Extensions.getExtensions(SearchScopeProvider.EP, project)) {
result.addAll(each.getGeneralProjectScopes());
}
if (ModuleUtil.isSupportedRootType(project, JavaSourceRootType.TEST_SOURCE)) {
result.add(GlobalSearchScopesCore.projectProductionScope(project));
result.add(GlobalSearchScopesCore.projectTestScope(project));
@@ -258,6 +258,7 @@
<extensionPoint name="definitionsSearch" interface="com.intellij.util.QueryExecutor"/>
<extensionPoint name="definitionsScopedSearch" interface="com.intellij.util.QueryExecutor"/>
<extensionPoint name="searchScopesProvider" interface="com.intellij.psi.search.SearchScopeProvider" area="IDEA_PROJECT"/>
<extensionPoint name="searchScopeEnlarger" interface="com.intellij.psi.search.SearchScopeEnlarger"/>
<extensionPoint name="useScopeEnlarger" interface="com.intellij.psi.search.UseScopeEnlarger"/>
<extensionPoint name="resolveScopeEnlarger" interface="com.intellij.psi.ResolveScopeEnlarger"/>