IDEA-56406 Option: Open new editor tabs at the end (bottom end for multiple tabs).

This commit is contained in:
Konstantin Bulenkov
2014-09-23 13:36:28 +02:00
parent 0227f40cc6
commit 85e07f0382
4 changed files with 44 additions and 7 deletions
@@ -0,0 +1,27 @@
/*
* 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.ide.actions;
import com.intellij.openapi.actionSystem.RegistryToggleAction;
/**
* @author Konstantin Bulenkov
*/
public class TabsAddedToTheEndSwitcher extends RegistryToggleAction {
public TabsAddedToTheEndSwitcher() {
super("ide.editor.tabs.open.at.the.end", "Open New Tabs At The End");
}
}
@@ -36,6 +36,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Splitter;
import com.intellij.openapi.ui.ThreeComponentsSplitter;
import com.intellij.openapi.util.*;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.openapi.wm.IdeFocusManager;
@@ -719,13 +720,17 @@ public class EditorWindow {
else {
Integer initialIndex = editor.getFile().getUserData(INITIAL_INDEX_KEY);
int indexToInsert = 0;
if (initialIndex == null) {
int selectedIndex = myTabbedPane.getSelectedIndex();
if (selectedIndex >= 0) {
indexToInsert = selectedIndex + 1;
}
if (Registry.is("ide.editor.tabs.open.at.the.end")) {
indexToInsert = myTabbedPane.getTabCount();
} else {
indexToInsert = initialIndex;
if (initialIndex == null) {
int selectedIndex = myTabbedPane.getSelectedIndex();
if (selectedIndex >= 0) {
indexToInsert = selectedIndex + 1;
}
} else {
indexToInsert = initialIndex;
}
}
final VirtualFile file = editor.getFile();
@@ -397,7 +397,8 @@
<action id="TabsPlacementRight" text="Right" class="com.intellij.ide.actions.TabsPlacementAction$Right" />
<action id="TabsPlacementNone" text="None" class="com.intellij.ide.actions.TabsPlacementAction$None" />
</group>
<action id="TabsAlphabeticalMode" class="com.intellij.ide.actions.TabsAlphabeticalModeSwitcher" text="Sort Tabs by Filename"/>
<action id="TabsAlphabeticalMode" class="com.intellij.ide.actions.TabsAlphabeticalModeSwitcher" text="Sort Tabs By Filename"/>
<action id="AddNewTabToTheEndMode" class="com.intellij.ide.actions.TabsAddedToTheEndSwitcher"/>
</group>
<group id="BackgroundTasks" popup="true">
@@ -497,6 +498,7 @@
<reference ref="PinActiveTab"/>
<reference ref="TabsPlacementGroup"/>
<reference ref="TabsAlphabeticalMode"/>
<reference ref="AddNewTabToTheEndMode"/>
<separator/>
<reference ref="NextTab"/>
<reference ref="PreviousTab"/>
@@ -66,6 +66,9 @@ ide.checkDuplicateMnemonics.description=Check for duplicate mnemonics.
ide.dnd.textHints=false
ide.max.recent.projects=25
ide.editor.tabs.open.at.the.end=false
ide.editor.tabs.open.at.the.end.description=If true all new tabs will be opened at the end
ide.hide.excluded.files=false
ide.hide.excluded.files.restartRequired=true
ide.hide.excluded.files.description=Do not show excluded files in Project View and exclude them from VCS