diff --git a/platform/platform-impl/src/com/intellij/ide/actions/TabsAddedToTheEndSwitcher.java b/platform/platform-impl/src/com/intellij/ide/actions/TabsAddedToTheEndSwitcher.java
new file mode 100644
index 000000000000..e56e99657531
--- /dev/null
+++ b/platform/platform-impl/src/com/intellij/ide/actions/TabsAddedToTheEndSwitcher.java
@@ -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");
+ }
+}
diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorWindow.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorWindow.java
index 1bf86ea5d62c..047684ace72a 100644
--- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorWindow.java
+++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorWindow.java
@@ -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();
diff --git a/platform/platform-resources/src/idea/PlatformActions.xml b/platform/platform-resources/src/idea/PlatformActions.xml
index 0c970d8e802f..63ad14b09c66 100644
--- a/platform/platform-resources/src/idea/PlatformActions.xml
+++ b/platform/platform-resources/src/idea/PlatformActions.xml
@@ -397,7 +397,8 @@
-
+
+
@@ -497,6 +498,7 @@
+
diff --git a/platform/util/resources/misc/registry.properties b/platform/util/resources/misc/registry.properties
index 18ad671085b9..ba960cdca25e 100644
--- a/platform/util/resources/misc/registry.properties
+++ b/platform/util/resources/misc/registry.properties
@@ -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