mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-57472 Floating tool windows should be more like native windows, with maximize/minimize/close buttons
This commit is contained in:
@@ -16,5 +16,5 @@
|
||||
package com.intellij.openapi.wm;
|
||||
|
||||
public enum ToolWindowType {
|
||||
DOCKED, FLOATING, SLIDING
|
||||
DOCKED, FLOATING, SLIDING, WINDOWED
|
||||
}
|
||||
|
||||
@@ -38,6 +38,8 @@ public interface WindowInfo {
|
||||
|
||||
boolean isFloating();
|
||||
|
||||
boolean isWindowed();
|
||||
|
||||
boolean isSliding();
|
||||
|
||||
ToolWindowContentUiType getContentUiType();
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.designer;
|
||||
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.ide.actions.ToggleWindowedModeAction;
|
||||
import com.intellij.ide.util.PropertiesComponent;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.actionSystem.impl.ActionManagerImpl;
|
||||
@@ -69,6 +70,7 @@ public class LightToolWindow extends JPanel {
|
||||
private final TogglePinnedModeAction myToggleAutoHideModeAction = new TogglePinnedModeAction();
|
||||
private final ToggleDockModeAction myToggleDockModeAction = new ToggleDockModeAction();
|
||||
private final ToggleFloatingModeAction myToggleFloatingModeAction = new ToggleFloatingModeAction();
|
||||
private final ToggleWindowedModeAction myToggleWindowedModeAction = new ToggleWindowedModeAction();
|
||||
private final ToggleSideModeAction myToggleSideModeAction = new ToggleSideModeAction();
|
||||
|
||||
private final ComponentListener myWidthListener = new ComponentAdapter() {
|
||||
@@ -331,15 +333,18 @@ public class LightToolWindow extends JPanel {
|
||||
group.add(myToggleAutoHideModeAction);
|
||||
group.add(myToggleDockModeAction);
|
||||
group.add(myToggleFloatingModeAction);
|
||||
group.add(myToggleWindowedModeAction);
|
||||
group.add(myToggleSideModeAction);
|
||||
}
|
||||
else if (type == ToolWindowType.FLOATING) {
|
||||
else if (type == ToolWindowType.FLOATING || type == ToolWindowType.WINDOWED) {
|
||||
group.add(myToggleAutoHideModeAction);
|
||||
group.add(myToggleFloatingModeAction);
|
||||
group.add(myToggleWindowedModeAction);
|
||||
}
|
||||
else if (type == ToolWindowType.SLIDING) {
|
||||
group.add(myToggleDockModeAction);
|
||||
group.add(myToggleFloatingModeAction);
|
||||
group.add(myToggleWindowedModeAction);
|
||||
}
|
||||
|
||||
return group;
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.wm.ToolWindow;
|
||||
import com.intellij.openapi.wm.ToolWindowType;
|
||||
import com.intellij.openapi.wm.ex.ToolWindowManagerEx;
|
||||
import com.intellij.openapi.wm.impl.DesktopLayout;
|
||||
|
||||
@@ -51,7 +52,7 @@ public class HideAllToolWindowsAction extends AnAction implements DumbAware {
|
||||
boolean hasVisible = false;
|
||||
for (String id : ids) {
|
||||
ToolWindow toolWindow = toolWindowManager.getToolWindow(id);
|
||||
if (toolWindow.isVisible()) {
|
||||
if (toolWindow.isVisible() && toolWindow.getType() != ToolWindowType.WINDOWED) {
|
||||
toolWindow.hide(null);
|
||||
hasVisible = true;
|
||||
}
|
||||
@@ -81,7 +82,8 @@ public class HideAllToolWindowsAction extends AnAction implements DumbAware {
|
||||
ToolWindowManagerEx toolWindowManager = ToolWindowManagerEx.getInstanceEx(project);
|
||||
String[] ids = toolWindowManager.getToolWindowIds();
|
||||
for (String id : ids) {
|
||||
if (toolWindowManager.getToolWindow(id).isVisible()) {
|
||||
ToolWindow toolWindow = toolWindowManager.getToolWindow(id);
|
||||
if (toolWindow.isVisible() && toolWindow.getType() != ToolWindowType.WINDOWED) {
|
||||
presentation.setEnabled(true);
|
||||
presentation.setText(IdeBundle.message("action.hide.all.windows"), true);
|
||||
return;
|
||||
|
||||
@@ -99,7 +99,7 @@ public abstract class ResizeToolWindowAction extends AnAction implements DumbAwa
|
||||
window = mgr.getToolWindow(mgr.getActiveToolWindowId());
|
||||
}
|
||||
|
||||
if (window == null || !window.isAvailable() || !window.isVisible() || window.getType() == ToolWindowType.FLOATING || !window.isActive()) {
|
||||
if (window == null || !window.isAvailable() || !window.isVisible() || window.getType() == ToolWindowType.FLOATING || window.getType() == ToolWindowType.WINDOWED || !window.isActive()) {
|
||||
setDisabled(e);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -74,6 +74,8 @@ public class ToggleDockModeAction extends ToggleAction implements DumbAware {
|
||||
return;
|
||||
}
|
||||
ToolWindow toolWindow=mgr.getToolWindow(id);
|
||||
presentation.setEnabled(toolWindow.isAvailable()&&ToolWindowType.FLOATING!=toolWindow.getType());
|
||||
presentation.setEnabled(toolWindow.isAvailable()
|
||||
&& toolWindow.getType() != ToolWindowType.FLOATING
|
||||
&& toolWindow.getType() != ToolWindowType.WINDOWED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.ide.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.actionSystem.ToggleAction;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.wm.ToolWindowManager;
|
||||
import com.intellij.openapi.wm.ToolWindowType;
|
||||
import com.intellij.openapi.wm.ex.ToolWindowEx;
|
||||
import com.intellij.openapi.wm.ex.ToolWindowManagerEx;
|
||||
|
||||
public class ToggleWindowedModeAction extends ToggleAction implements DumbAware {
|
||||
|
||||
public boolean isSelected(AnActionEvent event) {
|
||||
Project project = CommonDataKeys.PROJECT.getData(event.getDataContext());
|
||||
if (project == null) {
|
||||
return false;
|
||||
}
|
||||
ToolWindowManager windowManager = ToolWindowManager.getInstance(project);
|
||||
String id = windowManager.getActiveToolWindowId();
|
||||
if (id == null) {
|
||||
return false;
|
||||
}
|
||||
return ToolWindowType.WINDOWED == windowManager.getToolWindow(id).getType();
|
||||
}
|
||||
|
||||
public void setSelected(AnActionEvent event, boolean flag) {
|
||||
Project project = CommonDataKeys.PROJECT.getData(event.getDataContext());
|
||||
if (project == null) {
|
||||
return;
|
||||
}
|
||||
String id = ToolWindowManager.getInstance(project).getActiveToolWindowId();
|
||||
if (id == null) {
|
||||
return;
|
||||
}
|
||||
ToolWindowManagerEx mgr = ToolWindowManagerEx.getInstanceEx(project);
|
||||
ToolWindowEx toolWindow = (ToolWindowEx)mgr.getToolWindow(id);
|
||||
ToolWindowType type = toolWindow.getType();
|
||||
if (ToolWindowType.WINDOWED == type) {
|
||||
toolWindow.setType(toolWindow.getInternalType(), null);
|
||||
}
|
||||
else {
|
||||
toolWindow.setType(ToolWindowType.WINDOWED, null);
|
||||
}
|
||||
}
|
||||
|
||||
public void update(AnActionEvent event) {
|
||||
super.update(event);
|
||||
Presentation presentation = event.getPresentation();
|
||||
Project project = CommonDataKeys.PROJECT.getData(event.getDataContext());
|
||||
if (project == null) {
|
||||
presentation.setEnabled(false);
|
||||
return;
|
||||
}
|
||||
ToolWindowManager mgr = ToolWindowManager.getInstance(project);
|
||||
String id = mgr.getActiveToolWindowId();
|
||||
presentation.setEnabled(id != null && mgr.getToolWindow(id).isAvailable());
|
||||
}
|
||||
}
|
||||
@@ -43,6 +43,8 @@ import java.awt.event.WindowEvent;
|
||||
public final class FloatingDecorator extends JDialog {
|
||||
private static final Logger LOG=Logger.getInstance("#com.intellij.openapi.wm.impl.FloatingDecorator");
|
||||
|
||||
static final int DIVIDER_WIDTH = 3;
|
||||
|
||||
private static final int ANCHOR_TOP=1;
|
||||
private static final int ANCHOR_LEFT=2;
|
||||
private static final int ANCHOR_BOTTOM=4;
|
||||
@@ -201,7 +203,6 @@ public final class FloatingDecorator extends JDialog {
|
||||
}
|
||||
|
||||
private final class BorderItem extends JPanel{
|
||||
private static final int DIVIDER_WIDTH=3;
|
||||
private static final int RESIZER_WIDTH=10;
|
||||
|
||||
private final int myAnchor;
|
||||
|
||||
@@ -65,6 +65,7 @@ public final class InternalDecorator extends JPanel implements Queryable, DataPr
|
||||
private final TogglePinnedModeAction myToggleAutoHideModeAction;
|
||||
private final ToggleDockModeAction myToggleDockModeAction;
|
||||
private final ToggleFloatingModeAction myToggleFloatingModeAction;
|
||||
private final ToggleWindowedModeAction myToggleWindowedModeAction;
|
||||
private final ToggleSideModeAction myToggleSideModeAction;
|
||||
private final ToggleContentUiTypeAction myToggleContentUiTypeAction;
|
||||
|
||||
@@ -76,6 +77,7 @@ public final class InternalDecorator extends JPanel implements Queryable, DataPr
|
||||
@NonNls public static final String TOGGLE_PINNED_MODE_ACTION_ID = "TogglePinnedMode";
|
||||
@NonNls public static final String TOGGLE_DOCK_MODE_ACTION_ID = "ToggleDockMode";
|
||||
@NonNls public static final String TOGGLE_FLOATING_MODE_ACTION_ID = "ToggleFloatingMode";
|
||||
@NonNls public static final String TOGGLE_WINDOWED_MODE_ACTION_ID = "ToggleWindowedMode";
|
||||
@NonNls public static final String TOGGLE_SIDE_MODE_ACTION_ID = "ToggleSideMode";
|
||||
@NonNls private static final String TOGGLE_CONTENT_UI_TYPE_ACTION_ID = "ToggleContentUiTypeMode";
|
||||
|
||||
@@ -90,6 +92,7 @@ public final class InternalDecorator extends JPanel implements Queryable, DataPr
|
||||
myDivider = new MyDivider();
|
||||
|
||||
myToggleFloatingModeAction = new ToggleFloatingModeAction();
|
||||
myToggleWindowedModeAction = new ToggleWindowedModeAction();
|
||||
myToggleSideModeAction = new ToggleSideModeAction();
|
||||
myToggleDockModeAction = new ToggleDockModeAction();
|
||||
myToggleAutoHideModeAction = new TogglePinnedModeAction();
|
||||
@@ -428,17 +431,24 @@ public final class InternalDecorator extends JPanel implements Queryable, DataPr
|
||||
group.add(myToggleAutoHideModeAction);
|
||||
group.add(myToggleDockModeAction);
|
||||
group.add(myToggleFloatingModeAction);
|
||||
group.add(myToggleWindowedModeAction);
|
||||
group.add(myToggleSideModeAction);
|
||||
}
|
||||
else if (myInfo.isFloating()) {
|
||||
group.add(myToggleAutoHideModeAction);
|
||||
group.add(myToggleFloatingModeAction);
|
||||
group.add(myToggleWindowedModeAction);
|
||||
}
|
||||
else if (myInfo.isWindowed()) {
|
||||
group.add(myToggleFloatingModeAction);
|
||||
group.add(myToggleWindowedModeAction);
|
||||
}
|
||||
else if (myInfo.isSliding()) {
|
||||
if (!ToolWindowId.PREVIEW.equals(myInfo.getId())) {
|
||||
group.add(myToggleDockModeAction);
|
||||
}
|
||||
group.add(myToggleFloatingModeAction);
|
||||
group.add(myToggleWindowedModeAction);
|
||||
group.add(myToggleSideModeAction);
|
||||
}
|
||||
return group;
|
||||
@@ -567,6 +577,27 @@ public final class InternalDecorator extends JPanel implements Queryable, DataPr
|
||||
}
|
||||
}
|
||||
|
||||
private final class ToggleWindowedModeAction extends ToggleAction implements DumbAware {
|
||||
public ToggleWindowedModeAction() {
|
||||
copyFrom(ActionManager.getInstance().getAction(TOGGLE_WINDOWED_MODE_ACTION_ID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isSelected(final AnActionEvent event) {
|
||||
return myInfo.isWindowed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setSelected(final AnActionEvent event, final boolean flag) {
|
||||
if (myInfo.isWindowed()) {
|
||||
fireTypeChanged(myInfo.getInternalType());
|
||||
}
|
||||
else {
|
||||
fireTypeChanged(ToolWindowType.WINDOWED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final class ToggleSideModeAction extends ToggleAction implements DumbAware {
|
||||
public ToggleSideModeAction() {
|
||||
copyFrom(ActionManager.getInstance().getAction(TOGGLE_SIDE_MODE_ACTION_ID));
|
||||
|
||||
+126
-2
@@ -77,6 +77,8 @@ import java.beans.PropertyChangeListener;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
import static com.intellij.openapi.wm.impl.FloatingDecorator.DIVIDER_WIDTH;
|
||||
|
||||
/**
|
||||
* @author Anton Katilin
|
||||
* @author Vladimir Kondratyev
|
||||
@@ -90,6 +92,7 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
|
||||
private final DesktopLayout myLayout;
|
||||
private final Map<String, InternalDecorator> myId2InternalDecorator;
|
||||
private final Map<String, FloatingDecorator> myId2FloatingDecorator;
|
||||
private final Map<String, WindowedDecorator> myId2WindowedDecorator;
|
||||
private final Map<String, StripeButton> myId2StripeButton;
|
||||
private final Map<String, FocusWatcher> myId2FocusWatcher;
|
||||
private final Set<String> myDumbAwareIds = Collections.synchronizedSet(ContainerUtil.<String>newTroveSet());
|
||||
@@ -186,6 +189,7 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
|
||||
|
||||
myId2InternalDecorator = new HashMap<String, InternalDecorator>();
|
||||
myId2FloatingDecorator = new HashMap<String, FloatingDecorator>();
|
||||
myId2WindowedDecorator = new HashMap<String, WindowedDecorator>();
|
||||
myId2StripeButton = new HashMap<String, StripeButton>();
|
||||
myId2FocusWatcher = new HashMap<String, FocusWatcher>();
|
||||
|
||||
@@ -702,7 +706,7 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
|
||||
}
|
||||
|
||||
private boolean isToHide(final WindowInfoImpl info) {
|
||||
return (info.isAutoHide() || info.isSliding()) && !(info.isFloating() && hasModalChild(info));
|
||||
return (info.isAutoHide() || info.isSliding()) && !(info.isFloating() && hasModalChild(info)) && !info.isWindowed();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -808,6 +812,9 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
|
||||
if (info.isFloating()) {
|
||||
appendRemoveFloatingDecoratorCmd(info, commandsList);
|
||||
}
|
||||
else if (info.isWindowed()) {
|
||||
appendRemoveWindowedDecoratorCmd(info, commandsList);
|
||||
}
|
||||
else { // docked and sliding windows
|
||||
appendRemoveDecoratorCmd(id, false, commandsList);
|
||||
}
|
||||
@@ -863,7 +870,12 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
|
||||
private FloatingDecorator getFloatingDecorator(final String id) {
|
||||
return myId2FloatingDecorator.get(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return windowed decorator for the tool window with specified <code>ID</code>.
|
||||
*/
|
||||
private WindowedDecorator getWindowedDecorator(String id) {
|
||||
return myId2WindowedDecorator.get(id);
|
||||
}
|
||||
/**
|
||||
* @return internal decorator for the tool window with specified <code>ID</code>.
|
||||
*/
|
||||
@@ -1037,6 +1049,9 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
|
||||
if (toBeShownInfo.isFloating()) {
|
||||
commandsList.add(new AddFloatingDecoratorCmd(decorator, toBeShownInfo));
|
||||
}
|
||||
else if (toBeShownInfo.isWindowed()) {
|
||||
commandsList.add(new AddWindowedDecoratorCmd(decorator, toBeShownInfo));
|
||||
}
|
||||
else { // docked and sliding windows
|
||||
|
||||
// If there is tool window on the same side then we have to hide it, i.e.
|
||||
@@ -1260,6 +1275,9 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
|
||||
if (info.isFloating()) {
|
||||
appendRemoveFloatingDecoratorCmd(info, commandsList);
|
||||
}
|
||||
else if (info.isWindowed()) {
|
||||
appendRemoveWindowedDecoratorCmd(info, commandsList);
|
||||
}
|
||||
else { // floating and sliding windows
|
||||
appendRemoveDecoratorCmd(id, false, commandsList);
|
||||
}
|
||||
@@ -1744,6 +1762,9 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
|
||||
if (info.isFloating()) {
|
||||
appendRemoveFloatingDecoratorCmd(info, commandsList);
|
||||
}
|
||||
else if (info.isWindowed()) {
|
||||
appendRemoveWindowedDecoratorCmd(info, commandsList);
|
||||
}
|
||||
else { // docked and sliding windows
|
||||
appendRemoveDecoratorCmd(id, dirtyMode, commandsList);
|
||||
}
|
||||
@@ -1790,6 +1811,11 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
|
||||
commandsList.add(command);
|
||||
}
|
||||
|
||||
private void appendRemoveWindowedDecoratorCmd(final WindowInfoImpl info, final List<FinalizableCommand> commandsList) {
|
||||
final RemoveWindowedDecoratorCmd command = new RemoveWindowedDecoratorCmd(info);
|
||||
commandsList.add(command);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.intellij.openapi.wm.impl.ToolWindowsPane#createAddButtonCmd
|
||||
*/
|
||||
@@ -2108,6 +2134,104 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
|
||||
return ApplicationManager.getApplication().getDisposed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This command creates and shows <code>WindowedDecorator</code>.
|
||||
*/
|
||||
private final class AddWindowedDecoratorCmd extends FinalizableCommand {
|
||||
private final WindowedDecorator myWindowedDecorator;
|
||||
|
||||
/**
|
||||
* Creates floating decorator for specified floating decorator.
|
||||
*/
|
||||
private AddWindowedDecoratorCmd(final InternalDecorator decorator, final WindowInfoImpl info) {
|
||||
super(myWindowManager.getCommandProcessor());
|
||||
myWindowedDecorator = new WindowedDecorator(myProject, info.copy(), decorator);
|
||||
Window window = myWindowedDecorator.getFrame();
|
||||
final Rectangle bounds = info.getFloatingBounds();
|
||||
if (bounds != null) {
|
||||
bounds.setBounds(bounds.x + DIVIDER_WIDTH, bounds.y + DIVIDER_WIDTH, bounds.width - 2 * DIVIDER_WIDTH, bounds.height - 2 * DIVIDER_WIDTH);
|
||||
}
|
||||
if (bounds != null &&
|
||||
bounds.width > 0 &&
|
||||
bounds.height > 0 &&
|
||||
myWindowManager.isInsideScreenBounds(bounds.x, bounds.y, bounds.width)) {
|
||||
window.setBounds(bounds);
|
||||
}
|
||||
else { // place new frame at the center of main frame if there are no floating bounds
|
||||
Dimension size = decorator.getSize();
|
||||
if (size.width == 0 || size.height == 0) {
|
||||
size = decorator.getPreferredSize();
|
||||
}
|
||||
window.setSize(size);
|
||||
window.setLocationRelativeTo(myFrame);
|
||||
}
|
||||
myId2WindowedDecorator.put(info.getId(), myWindowedDecorator);
|
||||
myWindowedDecorator.addDisposable(new Disposable() {
|
||||
@Override
|
||||
public void dispose() {
|
||||
if (myId2WindowedDecorator.get(info.getId()) != null) {
|
||||
hideToolWindow(info.getId(), false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
myWindowedDecorator.show(false);
|
||||
Window window = myWindowedDecorator.getFrame();
|
||||
JRootPane rootPane = ((RootPaneContainer)window).getRootPane();
|
||||
Rectangle rootPaneBounds = rootPane.getBounds();
|
||||
Point point = rootPane.getLocationOnScreen();
|
||||
Rectangle windowBounds = window.getBounds();
|
||||
//Point windowLocation = windowBounds.getLocation();
|
||||
//windowLocation.translate(windowLocation.x - point.x, windowLocation.y - point.y);
|
||||
window.setLocation(2 * windowBounds.x - point.x, 2 * windowBounds.y - point.y);
|
||||
window.setSize(2 * windowBounds.width - rootPaneBounds.width, 2 * windowBounds.height - rootPaneBounds.height);
|
||||
}
|
||||
finally {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This command hides and destroys floating decorator for tool window
|
||||
* with specified <code>ID</code>.
|
||||
*/
|
||||
private final class RemoveWindowedDecoratorCmd extends FinalizableCommand {
|
||||
private final WindowedDecorator myWindowedDecorator;
|
||||
|
||||
private RemoveWindowedDecoratorCmd(final WindowInfoImpl info) {
|
||||
super(myWindowManager.getCommandProcessor());
|
||||
myWindowedDecorator = getWindowedDecorator(info.getId());
|
||||
myId2WindowedDecorator.remove(info.getId());
|
||||
|
||||
JRootPane rootPane = ((RootPaneContainer)myWindowedDecorator.getFrame()).getRootPane();
|
||||
Rectangle bounds = rootPane.getBounds();
|
||||
Point location = rootPane.getLocationOnScreen();
|
||||
bounds.setBounds(location.x - DIVIDER_WIDTH, location.y - DIVIDER_WIDTH, bounds.width + 2 * DIVIDER_WIDTH, bounds.height + 2 * DIVIDER_WIDTH);
|
||||
info.setFloatingBounds(bounds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Disposer.dispose(myWindowedDecorator);
|
||||
}
|
||||
finally {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Condition getExpireCondition() {
|
||||
return ApplicationManager.getApplication().getDisposed();
|
||||
}
|
||||
}
|
||||
|
||||
private final class EditorComponentFocusWatcher extends FocusWatcher {
|
||||
@Override
|
||||
|
||||
@@ -157,7 +157,7 @@ public final class WindowInfoImpl implements Cloneable,JDOMExternalizable, Windo
|
||||
*/
|
||||
@Override
|
||||
public Rectangle getFloatingBounds(){
|
||||
return myFloatingBounds;
|
||||
return new Rectangle(myFloatingBounds);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -229,6 +229,11 @@ public final class WindowInfoImpl implements Cloneable,JDOMExternalizable, Windo
|
||||
return ToolWindowType.FLOATING==myType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWindowed(){
|
||||
return ToolWindowType.WINDOWED==myType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSliding(){
|
||||
return ToolWindowType.SLIDING==myType;
|
||||
@@ -251,6 +256,9 @@ public final class WindowInfoImpl implements Cloneable,JDOMExternalizable, Windo
|
||||
if (ToolWindowType.DOCKED.toString().equalsIgnoreCase(text)) {
|
||||
return ToolWindowType.DOCKED;
|
||||
}
|
||||
if (ToolWindowType.WINDOWED.toString().equalsIgnoreCase(text)) {
|
||||
return ToolWindowType.WINDOWED;
|
||||
}
|
||||
if (ToolWindowType.FLOATING.toString().equalsIgnoreCase(text)) {
|
||||
return ToolWindowType.FLOATING;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.openapi.wm.impl;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.FrameWrapper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public final class WindowedDecorator extends FrameWrapper {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.wm.impl.WindowedDecorator");
|
||||
|
||||
private final Project myProject;
|
||||
|
||||
WindowedDecorator(@NotNull Project project, @NotNull WindowInfoImpl info, @NotNull InternalDecorator internalDecorator) {
|
||||
super(project);
|
||||
myProject = project;
|
||||
setTitle(info.getId() + " - " + myProject.getName());
|
||||
setProject(project);
|
||||
setComponent(internalDecorator);
|
||||
}
|
||||
|
||||
public Project getProject() {
|
||||
return myProject;
|
||||
}
|
||||
}
|
||||
@@ -843,6 +843,8 @@ action.ToggleDockMode.text=Dock_ed Mode
|
||||
action.ToggleDockMode.description=Dock/undock active tool window
|
||||
action.ToggleFloatingMode.text=Floating _Mode
|
||||
action.ToggleFloatingMode.description=Float/unfloat active tool window
|
||||
action.ToggleWindowedMode.text=_Windowed Mode
|
||||
action.ToggleWindowedMode.description=Window/unwindow active tool window
|
||||
action.ToggleSideMode.text=Split Mode
|
||||
action.ToggleSideMode.description=Tool windows split mode on/off
|
||||
action.ToggleContentUiTypeMode.text=Show Views as Tabs
|
||||
|
||||
@@ -374,6 +374,7 @@
|
||||
<action id="TogglePinnedMode" class="com.intellij.ide.actions.TogglePinnedModeAction"/>
|
||||
<action id="ToggleDockMode" class="com.intellij.ide.actions.ToggleDockModeAction"/>
|
||||
<action id="ToggleFloatingMode" class="com.intellij.ide.actions.ToggleFloatingModeAction"/>
|
||||
<action id="ToggleWindowedMode" class="com.intellij.ide.actions.ToggleWindowedModeAction"/>
|
||||
<action id="ToggleSideMode" class="com.intellij.ide.actions.ToggleSideModeAction"/>
|
||||
<action id="ToggleContentUiTypeMode" class="com.intellij.ide.actions.ToggleContentUiTypeAction"/>
|
||||
<action id="ShowContent" class="com.intellij.ide.actions.ShowContentAction"/>
|
||||
|
||||
@@ -5045,6 +5045,8 @@ action.ToggleDockMode.text=Dock_ed Mode
|
||||
action.ToggleDockMode.description=Dock/undock active tool window
|
||||
action.ToggleFloatingMode.text=Floating _Mode
|
||||
action.ToggleFloatingMode.description=Float/unfloat active tool window
|
||||
action.ToggleWindowedMode.text=_Windowed Mode
|
||||
action.ToggleWindowedMode.description=Window/unwindow active tool window
|
||||
action.ToggleSideMode.text=Split Mode
|
||||
action.ToggleSideMode.description=Tool windows split mode on/off
|
||||
action.ToggleContentUiTypeMode.text=Show Views as Tabs
|
||||
@@ -20533,6 +20535,8 @@ action.ToggleDockMode.text=Dock_ed Mode
|
||||
action.ToggleDockMode.description=Dock/undock active tool window
|
||||
action.ToggleFloatingMode.text=Floating _Mode
|
||||
action.ToggleFloatingMode.description=Float/unfloat active tool window
|
||||
action.ToggleWindowedMode.text=_Windowed Mode
|
||||
action.ToggleWindowedMode.description=Window/unwindow active tool window
|
||||
action.ToggleSideMode.text=Split Mode
|
||||
action.ToggleSideMode.description=Tool windows split mode on/off
|
||||
action.ToggleContentUiTypeMode.text=Show Views as Tabs
|
||||
|
||||
@@ -591,6 +591,7 @@
|
||||
<action id="TogglePinnedMode" class="xcom.intellij.ide.actions.TogglePinnedModeAction" text="_Pinned Mode" description="Pin/unpin active tool window"/>
|
||||
<action id="ToggleDockMode" class="xcom.intellij.ide.actions.ToggleDockModeAction" text="Dock_ed Mode" description="Dock/undock active tool window"/>
|
||||
<action id="ToggleFloatingMode" class="xcom.intellij.ide.actions.ToggleFloatingModeAction" text="_Floating Mode" description="Float/unfloat active tool window"/>
|
||||
<action id="ToggleWindowedMode" class="xcom.intellij.ide.actions.ToggleWindowedModeAction" text="_Windowed Mode" description="Window/unwindow active tool window"/>
|
||||
<separator/>
|
||||
<action id="NextTab" class="xcom.intellij.ide.actions.NextTabAction" text="Select _Next Tab" description="Activate next tab"/>
|
||||
<action id="PreviousTab" class="xcom.intellij.ide.actions.PreviousTabAction" text="Select Previ_ous Tab" description="Activate previous tab"/>
|
||||
|
||||
Reference in New Issue
Block a user