summaryrefslogtreecommitdiff
path: root/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorTabbedContainer.java
diff options
context:
space:
mode:
authorJean-Baptiste Queru <jbq@google.com>2013-04-01 14:41:51 -0700
committerJean-Baptiste Queru <jbq@google.com>2013-04-01 14:41:51 -0700
commit2bd2b7c2623d4266384e890271869efc044aabff (patch)
tree0b31f50e55975b6354ed458314e17b4441bb4e17 /platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorTabbedContainer.java
parent1d526b16d476792ca7ce47616d55833115e8d6ab (diff)
downloadidea-2bd2b7c2623d4266384e890271869efc044aabff.tar.gz
Snapshot ee98b298267d0e09d2cd2f0731b6480a56dd48e7 from master branch of git://git.jetbrains.org/idea/community.git
Change-Id: I4515f72af131fdea9fc6905a4dc0fe9532409a81
Diffstat (limited to 'platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorTabbedContainer.java')
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorTabbedContainer.java106
1 files changed, 56 insertions, 50 deletions
diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorTabbedContainer.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorTabbedContainer.java
index 419f3063361c..cb260c8fa1cb 100644
--- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorTabbedContainer.java
+++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorTabbedContainer.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2013 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.
@@ -71,7 +71,7 @@ import java.util.Map;
* @author Anton Katilin
* @author Vladimir Kondratyev
*/
-final class EditorTabbedContainer implements Disposable, CloseAction.CloseTarget {
+public final class EditorTabbedContainer implements Disposable, CloseAction.CloseTarget {
private final EditorWindow myWindow;
private final Project myProject;
private final JBEditorTabs myTabs;
@@ -162,6 +162,11 @@ final class EditorTabbedContainer implements Disposable, CloseAction.CloseTarget
return myTabs.select(myTabs.getTabAt(indexToSelect), focusEditor);
}
+
+ public static DockableEditor createDockableEditor(Project project, Image image, VirtualFile file, Presentation presentation, EditorWindow window) {
+ return new DockableEditor(project, image, file, presentation, window);
+ }
+
private void updateTabBorder() {
if (!myProject.isOpen()) return;
@@ -582,7 +587,7 @@ final class EditorTabbedContainer implements Disposable, CloseAction.CloseTarget
myFile = (VirtualFile)info.getObject();
Presentation presentation = new Presentation(info.getText());
presentation.setIcon(info.getIcon());
- mySession = getDockManager().createDragSession(mouseEvent, new DockableEditor(img, myFile, presentation, myWindow));
+ mySession = getDockManager().createDragSession(mouseEvent, createDockableEditor(myProject, img, myFile, presentation, myWindow));
}
private DockManager getDockManager() {
@@ -625,63 +630,64 @@ final class EditorTabbedContainer implements Disposable, CloseAction.CloseTarget
mySession = null;
}
- class DockableEditor implements DockableContent<VirtualFile> {
- final Image myImg;
- private DockableEditorTabbedContainer myContainer;
- private Presentation myPresentation;
- private EditorWindow myEditorWindow;
- private Dimension myPreferredSize;
- private boolean myPinned;
+ }
+ public static class DockableEditor implements DockableContent<VirtualFile> {
+ final Image myImg;
+ private DockableEditorTabbedContainer myContainer;
+ private Presentation myPresentation;
+ private EditorWindow myEditorWindow;
+ private Dimension myPreferredSize;
+ private boolean myPinned;
+ private VirtualFile myFile;
- public DockableEditor(Image img, VirtualFile file, Presentation presentation, EditorWindow window) {
- myImg = img;
- myFile = file;
- myPresentation = presentation;
- myContainer = new DockableEditorTabbedContainer(myProject);
- myEditorWindow = window;
- myPreferredSize = myEditorWindow.getSize();
- myPinned = window.isFilePinned(file);
- }
+ public DockableEditor(Project project, Image img, VirtualFile file, Presentation presentation, EditorWindow window) {
+ myImg = img;
+ myFile = file;
+ myPresentation = presentation;
+ myContainer = new DockableEditorTabbedContainer(project);
+ myEditorWindow = window;
+ myPreferredSize = myEditorWindow.getSize();
+ myPinned = window.isFilePinned(file);
+ }
- @NotNull
- @Override
- public VirtualFile getKey() {
- return myFile;
- }
+ @NotNull
+ @Override
+ public VirtualFile getKey() {
+ return myFile;
+ }
- @Override
- public Image getPreviewImage() {
- return myImg;
- }
+ @Override
+ public Image getPreviewImage() {
+ return myImg;
+ }
- @Override
- public Dimension getPreferredSize() {
- return myPreferredSize;
- }
+ @Override
+ public Dimension getPreferredSize() {
+ return myPreferredSize;
+ }
- @Override
- public String getDockContainerType() {
- return DockableEditorContainerFactory.TYPE;
- }
+ @Override
+ public String getDockContainerType() {
+ return DockableEditorContainerFactory.TYPE;
+ }
- @Override
- public Presentation getPresentation() {
- return myPresentation;
- }
+ @Override
+ public Presentation getPresentation() {
+ return myPresentation;
+ }
- @Override
- public void close() {
- myContainer.close(myFile);
- }
+ @Override
+ public void close() {
+ myContainer.close(myFile);
+ }
- public VirtualFile getFile() {
- return myFile;
- }
+ public VirtualFile getFile() {
+ return myFile;
+ }
- public boolean isPinned() {
- return myPinned;
- }
+ public boolean isPinned() {
+ return myPinned;
}
}