Hierarchy providers refactored
[fedora-idea.git] / lang-impl / src / com / intellij / ide / navigationToolbar / SelectInNavBarTarget.java
blob00243a1b874a79fd2fbab3bb5c417e724f7a8e1b
1 /*
2 * Copyright 2000-2005 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.navigationToolbar;
18 import com.intellij.ide.SelectInManager;
19 import com.intellij.ide.StandardTargetWeights;
20 import com.intellij.ide.impl.SelectInTargetPsiWrapper;
21 import com.intellij.ide.ui.UISettings;
22 import com.intellij.openapi.project.DumbAware;
23 import com.intellij.openapi.project.Project;
24 import com.intellij.openapi.vfs.VirtualFile;
25 import com.intellij.openapi.wm.ex.WindowManagerEx;
26 import com.intellij.openapi.wm.impl.IdeFrameImpl;
27 import com.intellij.openapi.wm.impl.IdeRootPane;
28 import com.intellij.psi.PsiElement;
29 import com.intellij.psi.PsiFileSystemItem;
30 import org.jetbrains.annotations.NonNls;
32 /**
33 * User: anna
34 * Date: 09-Nov-2005
36 public class SelectInNavBarTarget extends SelectInTargetPsiWrapper implements DumbAware {
37 public SelectInNavBarTarget(final Project project) {
38 super(project);
41 public String toString() {
42 return SelectInManager.NAV_BAR;
45 @NonNls
46 public String getToolWindowId() {
47 return "NavBar";
50 public String getMinorViewId() {
51 return null;
54 public float getWeight() {
55 return StandardTargetWeights.NAV_BAR;
58 protected boolean canSelect(PsiFileSystemItem file) {
59 return UISettings.getInstance().SHOW_NAVIGATION_BAR;
62 protected void select(final Object selector, VirtualFile virtualFile, final boolean requestFocus) {
63 final IdeFrameImpl frame = WindowManagerEx.getInstanceEx().getFrame(myProject);
64 ((NavBarPanel)((IdeRootPane)frame.getRootPane()).findByName(NavBarRootPaneExtension.NAV_BAR).getComponent()).select();
67 protected boolean canWorkWithCustomObjects() {
68 return false;
71 protected void select(PsiElement element, boolean requestFocus) {
72 final IdeFrameImpl frame = WindowManagerEx.getInstanceEx().getFrame(myProject);
73 ((NavBarPanel)((IdeRootPane)frame.getRootPane()).findByName(NavBarRootPaneExtension.NAV_BAR).getComponent()).select();