2 * Copyright 2000-2014 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;
18 import com.intellij.openapi.Disposable;
19 import com.intellij.openapi.project.Project;
20 import com.intellij.openapi.ui.MessageType;
21 import com.intellij.openapi.ui.popup.Balloon;
22 import org.jetbrains.annotations.NotNull;
23 import org.jetbrains.annotations.Nullable;
26 import javax.swing.event.HyperlinkListener;
29 * If you want to register a toolwindow, which will be enabled during the dumb mode, please use {@link ToolWindowManager}'s
30 * registration methods which have 'canWorkInDumMode' parameter.
32 public abstract class ToolWindowManager {
34 public abstract boolean canShowNotification(@NotNull String toolWindowId);
36 public static ToolWindowManager getInstance(@NotNull Project project){
37 return project.getComponent(ToolWindowManager.class);
41 * Register specified tool window into IDE window system.
42 * @param id <code>id</code> of tool window to be registered.
43 * @param component <code>component</code> which represents tool window content.
44 * May be null. Content can be further added via content manager for this tool window (See {@link ToolWindow#getContentManager()})
45 * @param anchor the default anchor for first registration. It uses only first time the
46 * tool window with the specified <code>id</code> is being registered into the window system.
47 * After the first registration window's anchor is stored in project file
48 * and <code>anchor</code> is ignored.
49 * @exception IllegalArgumentException if the same window is already installed or one
50 * of the parameters is <code>null</code>.
52 * @deprecated {@link ToolWindowManager#registerToolWindow(String, boolean, ToolWindowAnchor)}
56 public abstract ToolWindow registerToolWindow(@NotNull String id, @NotNull JComponent component, @NotNull ToolWindowAnchor anchor);
59 * @deprecated {@link ToolWindowManager#registerToolWindow(String, boolean, ToolWindowAnchor)}
63 public abstract ToolWindow registerToolWindow(@NotNull String id,
64 @NotNull JComponent component,
65 @NotNull ToolWindowAnchor anchor,
66 @NotNull Disposable parentDisposable);
69 * @deprecated {@link ToolWindowManager#registerToolWindow(String, boolean, ToolWindowAnchor)}
73 public abstract ToolWindow registerToolWindow(@NotNull String id,
74 @NotNull JComponent component,
75 @NotNull ToolWindowAnchor anchor,
76 Disposable parentDisposable,
77 boolean canWorkInDumbMode);
79 * @deprecated {@link ToolWindowManager#registerToolWindow(String, boolean, ToolWindowAnchor)}
83 public abstract ToolWindow registerToolWindow(@NotNull String id,
84 @NotNull JComponent component,
85 @NotNull ToolWindowAnchor anchor,
86 Disposable parentDisposable,
87 boolean canWorkInDumbMode,
88 boolean canCloseContents);
91 public abstract ToolWindow registerToolWindow(@NotNull String id, boolean canCloseContent, @NotNull ToolWindowAnchor anchor);
94 public abstract ToolWindow registerToolWindow(@NotNull String id, boolean canCloseContent, @NotNull ToolWindowAnchor anchor, boolean secondary);
97 public abstract ToolWindow registerToolWindow(@NotNull String id, boolean canCloseContent, @NotNull ToolWindowAnchor anchor, Disposable parentDisposable, boolean canWorkInDumbMode);
100 public ToolWindow registerToolWindow(@NotNull final String id,
101 final boolean canCloseContent,
102 @NotNull final ToolWindowAnchor anchor,
103 final Disposable parentDisposable) {
104 return registerToolWindow(id, canCloseContent, anchor, parentDisposable, false);
108 * does nothing if tool window with specified isn't registered.
110 public abstract void unregisterToolWindow(@NotNull String id);
114 public abstract void activateEditorComponent();
117 * @return <code>true</code> if and only if editor component is active.
119 public abstract boolean isEditorComponentActive();
122 * @return array of <code>id</code>s of all registered tool windows.
125 public abstract String[] getToolWindowIds();
128 * @return <code>ID</code> of currently active tool window or <code>null</code> if there is no active
132 public abstract String getActiveToolWindowId();
135 * @return registered tool window with specified <code>id</code>. If there is no registered
136 * tool window with specified <code>id</code> then the method returns <code>null</code>.
138 public abstract ToolWindow getToolWindow(String id);
141 * Puts specified runnable to the tail of current command queue.
143 public abstract void invokeLater(@NotNull Runnable runnable);
146 * Utility method for quick access to the focus manager
149 public abstract IdeFocusManager getFocusManager();
151 public abstract void notifyByBalloon(@NotNull final String toolWindowId, @NotNull final MessageType type, @NotNull final String htmlBody);
153 public abstract void notifyByBalloon(@NotNull final String toolWindowId,
154 @NotNull final MessageType type,
155 @NotNull final String htmlBody,
156 @Nullable final Icon icon,
157 @Nullable HyperlinkListener listener);
160 public abstract Balloon getToolWindowBalloon(String id);
162 public abstract boolean isMaximized(@NotNull ToolWindow wnd);
164 public abstract void setMaximized(@NotNull ToolWindow wnd, boolean maximized);