subtle NPE in injected: for all isPhysical() calls wait for injected PSI being treeMerged
[fedora-idea.git] / platform / lang-impl / src / com / intellij / usageView / UsageViewLongNameLocation.java
bloba4999ea3e1a059fdb9fdb443518dc55142055b17
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.
17 package com.intellij.usageView;
19 import com.intellij.psi.ElementDescriptionLocation;
20 import com.intellij.psi.ElementDescriptionProvider;
21 import com.intellij.psi.PsiElement;
22 import com.intellij.psi.PsiDirectory;
23 import com.intellij.psi.impl.file.PsiDirectoryFactory;
24 import org.jetbrains.annotations.Nullable;
25 import org.jetbrains.annotations.NotNull;
27 /**
28 * @author yole
30 public class UsageViewLongNameLocation extends ElementDescriptionLocation {
31 private UsageViewLongNameLocation() {
34 public static final UsageViewLongNameLocation INSTANCE = new UsageViewLongNameLocation();
36 public ElementDescriptionProvider getDefaultProvider() {
37 return DEFAULT_PROVIDER;
40 private static final ElementDescriptionProvider DEFAULT_PROVIDER = new ElementDescriptionProvider() {
41 public String getElementDescription(@NotNull final PsiElement element, @NotNull final ElementDescriptionLocation location) {
42 if (location instanceof UsageViewLongNameLocation) {
43 if (element instanceof PsiDirectory) {
44 return PsiDirectoryFactory.getInstance(element.getProject()).getQualifiedName((PsiDirectory)element, true);
46 return "";
48 return null;