update copyright
[fedora-idea.git] / java / java-impl / src / com / intellij / codeInsight / navigation / JavaGotoTargetRendererProvider.java
blob58a0b1b17fe0299410d56b4bd03877b32554758f
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.codeInsight.navigation;
18 import com.intellij.ide.util.PsiElementListCellRenderer;
19 import com.intellij.ide.util.MethodCellRenderer;
20 import com.intellij.ide.util.PsiClassListCellRenderer;
21 import com.intellij.psi.PsiElement;
22 import com.intellij.psi.PsiMethod;
23 import com.intellij.psi.PsiClass;
24 import com.intellij.psi.util.PsiUtil;
26 import java.util.Arrays;
28 /**
29 * @author yole
31 public class JavaGotoTargetRendererProvider implements GotoTargetRendererProvider {
32 public PsiElementListCellRenderer getRenderer(final PsiElement[] elements) {
33 boolean onlyMethods = true;
34 boolean onlyClasses = true;
35 for (PsiElement element : elements) {
36 if (!(element instanceof PsiMethod)) onlyMethods = false;
37 if (!(element instanceof PsiClass)) onlyClasses = false;
39 if (onlyMethods) {
40 return new MethodCellRenderer(!PsiUtil.allMethodsHaveSameSignature(Arrays.asList(elements).toArray(PsiMethod.EMPTY_ARRAY)));
42 else if (onlyClasses) {
43 return new PsiClassListCellRenderer();
45 return null;