update copyright
[fedora-idea.git] / java / java-impl / src / com / intellij / ide / util / TreeClassChooserFactoryImpl.java
blobd9552ac1377d535f29436992c48a85ff6e879b85
1 /*
2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package com.intellij.ide.util;
18 import com.intellij.openapi.fileTypes.FileType;
19 import com.intellij.openapi.project.Project;
20 import com.intellij.openapi.util.Condition;
21 import com.intellij.psi.PsiClass;
22 import com.intellij.psi.PsiFile;
23 import com.intellij.psi.search.GlobalSearchScope;
24 import org.jetbrains.annotations.NotNull;
25 import org.jetbrains.annotations.Nullable;
27 /**
28 * User: anna
29 * Date: Jan 25, 2005
31 public class TreeClassChooserFactoryImpl extends TreeClassChooserFactory {
32 private final Project myProject;
34 public TreeClassChooserFactoryImpl(final Project project) {
35 myProject = project;
38 @NotNull
39 public TreeClassChooser createWithInnerClassesScopeChooser(String title,
40 GlobalSearchScope scope,
41 final TreeClassChooser.ClassFilter classFilter,
42 PsiClass initialClass) {
43 return TreeClassChooserDialog.withInnerClasses(title, myProject, scope, classFilter, initialClass);
46 @NotNull
47 public TreeClassChooser createNoInnerClassesScopeChooser(String title,
48 GlobalSearchScope scope,
49 TreeClassChooser.ClassFilter classFilter,
50 PsiClass initialClass) {
51 return new TreeClassChooserDialog(title, myProject, scope, classFilter, initialClass);
54 @NotNull
55 public TreeClassChooser createProjectScopeChooser(String title, PsiClass initialClass) {
56 return new TreeClassChooserDialog(title, myProject, initialClass);
59 @NotNull
60 public TreeClassChooser createProjectScopeChooser(String title) {
61 return new TreeClassChooserDialog(title, myProject);
64 @NotNull
65 public TreeClassChooser createAllProjectScopeChooser(String title) {
66 return new TreeClassChooserDialog(title, myProject, GlobalSearchScope.allScope(myProject), null, null);
69 @NotNull
70 public TreeClassChooser createInheritanceClassChooser(String title,
71 GlobalSearchScope scope,
72 PsiClass base,
73 boolean acceptsSelf,
74 boolean acceptInner,
75 Condition<? super PsiClass> additionalCondition) {
76 TreeClassChooser.ClassFilter classFilter = new TreeClassChooserDialog.InheritanceClassFilterImpl(base, acceptsSelf, acceptInner, additionalCondition);
77 return new TreeClassChooserDialog(title, myProject, scope, classFilter, base, null, null);
80 @NotNull
81 public TreeClassChooser createInheritanceClassChooser(String title, GlobalSearchScope scope, PsiClass base, PsiClass initialClass) {
82 return createInheritanceClassChooser(title, scope, base, initialClass, null);
85 @NotNull
86 public TreeClassChooser createInheritanceClassChooser(String title, GlobalSearchScope scope, PsiClass base, PsiClass initialClass,
87 TreeClassChooser.ClassFilter classFilter) {
88 return new TreeClassChooserDialog(title, myProject, scope, classFilter, base, initialClass, null);
91 @NotNull
92 public TreeFileChooser createFileChooser(@NotNull String title,
93 final PsiFile initialFile,
94 FileType fileType,
95 TreeFileChooser.PsiFileFilter filter) {
96 return new TreeFileChooserDialog(myProject, title, initialFile, fileType, filter, false, false);
99 @NotNull
100 public
101 TreeFileChooser createFileChooser(@NotNull String title,
102 @Nullable PsiFile initialFile,
103 @Nullable FileType fileType,
104 @Nullable TreeFileChooser.PsiFileFilter filter,
105 boolean disableStructureProviders) {
106 return new TreeFileChooserDialog(myProject, title, initialFile, fileType, filter, disableStructureProviders, false);
110 @NotNull
111 public TreeFileChooser createFileChooser(@NotNull String title, @Nullable PsiFile initialFile, @Nullable FileType fileType,
112 @Nullable TreeFileChooser.PsiFileFilter filter,
113 boolean disableStructureProviders,
114 boolean showLibraryContents) {
115 return new TreeFileChooserDialog(myProject, title, initialFile, fileType, filter, disableStructureProviders, showLibraryContents);