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
.openapi
.wm
.impl
;
18 import com
.intellij
.openapi
.util
.ActionCallback
;
19 import com
.intellij
.openapi
.util
.Expirable
;
20 import com
.intellij
.openapi
.wm
.FocusCommand
;
21 import com
.intellij
.openapi
.wm
.IdeFocusManager
;
22 import org
.jetbrains
.annotations
.NotNull
;
23 import org
.jetbrains
.annotations
.Nullable
;
27 import java
.awt
.event
.KeyEvent
;
29 public class IdeFocusManagerImpl
extends IdeFocusManager
{
30 private ToolWindowManagerImpl myToolWindowManager
;
32 public IdeFocusManagerImpl(ToolWindowManagerImpl twManager
) {
33 myToolWindowManager
= twManager
;
37 public ActionCallback
requestFocus(@NotNull final Component c
, final boolean forced
) {
38 return getGlobalInstance().requestFocus(c
, forced
);
42 public ActionCallback
requestFocus(@NotNull final FocusCommand command
, final boolean forced
) {
43 return getGlobalInstance().requestFocus(command
, forced
);
46 public JComponent
getFocusTargetFor(@NotNull final JComponent comp
) {
47 return getGlobalInstance().getFocusTargetFor(comp
);
50 public void doWhenFocusSettlesDown(@NotNull final Runnable runnable
) {
51 getGlobalInstance().doWhenFocusSettlesDown(runnable
);
55 public Component
getFocusedDescendantFor(@NotNull final Component comp
) {
56 return getGlobalInstance().getFocusedDescendantFor(comp
);
59 public boolean dispatch(KeyEvent e
) {
60 return getGlobalInstance().dispatch(e
);
64 public void suspendKeyProcessingUntil(@NotNull ActionCallback done
) {
65 getGlobalInstance().suspendKeyProcessingUntil(done
);
69 public ActionCallback
requestDefaultFocus(boolean forced
) {
70 return myToolWindowManager
.requestDefaultFocus(forced
);
74 public Expirable
getTimestamp(boolean trackOnlyForcedCommands
) {
75 return getGlobalInstance().getTimestamp(trackOnlyForcedCommands
);
78 public boolean isFocusBeingTransferred() {
79 return getGlobalInstance().isFocusBeingTransferred();