toolwindow resize for docked windows
[fedora-idea.git] / platform / platform-impl / src / com / intellij / ide / actions / NextSplitAction.java
blob03973a31b63b1a713e2634c1e217b7ff6eb1725e
2 /*
3 * Copyright 2000-2009 JetBrains s.r.o.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 package com.intellij.ide.actions;
19 import com.intellij.ide.IdeBundle;
20 import com.intellij.openapi.actionSystem.AnAction;
21 import com.intellij.openapi.actionSystem.AnActionEvent;
22 import com.intellij.openapi.actionSystem.PlatformDataKeys;
23 import com.intellij.openapi.actionSystem.Presentation;
24 import com.intellij.openapi.command.CommandProcessor;
25 import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx;
26 import com.intellij.openapi.project.Project;
27 import com.intellij.openapi.project.DumbAware;
28 import com.intellij.openapi.wm.ToolWindowManager;
30 public class NextSplitAction extends AnAction implements DumbAware {
31 public void actionPerformed(AnActionEvent e) {
32 final Project project = PlatformDataKeys.PROJECT.getData(e.getDataContext());
33 final CommandProcessor commandProcessor = CommandProcessor.getInstance();
34 commandProcessor.executeCommand(
35 project, new Runnable(){
36 public void run() {
37 final FileEditorManagerEx manager = FileEditorManagerEx.getInstanceEx(project);
38 manager.setCurrentWindow(manager.getNextWindow(manager.getCurrentWindow()));
40 }, IdeBundle.message("command.go.to.next.split"), null
44 public void update(final AnActionEvent event){
45 final Project project = PlatformDataKeys.PROJECT.getData(event.getDataContext());
46 final Presentation presentation = event.getPresentation();
47 if (project == null) {
48 presentation.setEnabled(false);
49 return;
51 final FileEditorManagerEx manager = FileEditorManagerEx.getInstanceEx(project);
52 final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
53 presentation.setEnabled (toolWindowManager.isEditorComponentActive() && manager.isInSplitter() && manager.getCurrentWindow() != null);