@@ -38,19 +38,22 @@ public EditorTabbedPane(Gui gui) {
38
38
39
39
public EditorPanel openClass (ClassEntry entry ) {
40
40
EditorPanel activeEditor = this .getActiveEditor ();
41
- EditorPanel editorPanel = this .editors .computeIfAbsent (entry , e -> {
42
- ClassHandle ch = this .gui .getController ().getClassHandleProvider ().openClass (entry );
43
- if (ch == null ) return null ;
41
+ EditorPanel entryEditor = this .editors .computeIfAbsent (entry , editing -> {
42
+ ClassHandle classHandle = this .gui .getController ().getClassHandleProvider ().openClass (editing );
43
+ if (classHandle == null ) {
44
+ return null ;
45
+ }
46
+
44
47
this .navigator = new NavigatorPanel (this .gui );
45
- EditorPanel ed = new EditorPanel (this .gui , this .navigator );
46
- ed .setClassHandle (ch );
47
- this .openFiles .addTab (ed . getFileName (), ed .getUi ());
48
+ EditorPanel newEditor = new EditorPanel (this .gui , this .navigator );
49
+ newEditor .setClassHandle (classHandle );
50
+ this .openFiles .addTab (newEditor . getSimpleClassName (), newEditor .getUi ());
48
51
49
- ClosableTabTitlePane titlePane = new ClosableTabTitlePane (ed . getFileName (), () -> this .closeEditor (ed ));
50
- this .openFiles .setTabComponentAt (this .openFiles .indexOfComponent (ed .getUi ()), titlePane .getUi ());
52
+ ClosableTabTitlePane titlePane = new ClosableTabTitlePane (newEditor . getSimpleClassName (), newEditor . getFullClassName (), () -> this .closeEditor (newEditor ));
53
+ this .openFiles .setTabComponentAt (this .openFiles .indexOfComponent (newEditor .getUi ()), titlePane .getUi ());
51
54
titlePane .setTabbedPane (this .openFiles );
52
55
53
- ed .addListener (new EditorActionListener () {
56
+ newEditor .addListener (new EditorActionListener () {
54
57
@ Override
55
58
public void onCursorReferenceChanged (EditorPanel editor , EntryReference <Entry <?>, Entry <?>> ref ) {
56
59
if (editor == EditorTabbedPane .this .getActiveEditor ()) {
@@ -66,38 +69,39 @@ public void onClassHandleChanged(EditorPanel editor, ClassEntry old, ClassHandle
66
69
67
70
@ Override
68
71
public void onTitleChanged (EditorPanel editor , String title ) {
69
- titlePane .setText (editor .getFileName ());
72
+ titlePane .setText (editor .getSimpleClassName (), editor . getFullClassName ());
70
73
}
71
74
});
72
75
73
- ed .getEditor ().addKeyListener (GuiUtil .onKeyPress (keyEvent -> {
76
+ newEditor .getEditor ().addKeyListener (GuiUtil .onKeyPress (keyEvent -> {
74
77
if (KeyBinds .EDITOR_CLOSE_TAB .matches (keyEvent )) {
75
- this .closeEditor (ed );
78
+ this .closeEditor (newEditor );
76
79
} else if (KeyBinds .ENTRY_NAVIGATOR_NEXT .matches (keyEvent )) {
77
- ed .getNavigatorPanel ().navigateDown ();
80
+ newEditor .getNavigatorPanel ().navigateDown ();
78
81
keyEvent .consume ();
79
82
} else if (KeyBinds .ENTRY_NAVIGATOR_LAST .matches (keyEvent )) {
80
- ed .getNavigatorPanel ().navigateUp ();
83
+ newEditor .getNavigatorPanel ().navigateUp ();
81
84
keyEvent .consume ();
82
85
}
83
86
}));
84
87
85
- return ed ;
88
+ return newEditor ;
86
89
});
87
90
88
- if (editorPanel != null && activeEditor != editorPanel ) {
91
+ if (entryEditor != null && activeEditor != entryEditor ) {
89
92
this .openFiles .setSelectedComponent (this .editors .get (entry ).getUi ());
90
- this .gui .updateStructure (editorPanel );
91
- this .gui .showCursorReference (editorPanel .getCursorReference ());
93
+ this .gui .updateStructure (entryEditor );
94
+ this .gui .showCursorReference (entryEditor .getCursorReference ());
92
95
}
93
96
94
- return editorPanel ;
97
+ return entryEditor ;
95
98
}
96
99
97
100
public void closeEditor (EditorPanel ed ) {
98
101
this .openFiles .remove (ed .getUi ());
99
102
this .editors .inverse ().remove (ed );
100
103
EditorPanel activeEditor = this .getActiveEditor ();
104
+ activeEditor .getEditor ().requestFocus ();
101
105
this .gui .updateStructure (activeEditor );
102
106
this .gui .showCursorReference (activeEditor != null ? activeEditor .getCursorReference () : null );
103
107
ed .destroy ();
@@ -151,6 +155,7 @@ private void onTabPressed(MouseEvent e) {
151
155
}
152
156
153
157
EditorPanel activeEditor = this .getActiveEditor ();
158
+ activeEditor .getEditor ().requestFocus ();
154
159
this .gui .updateStructure (activeEditor );
155
160
this .gui .showCursorReference (activeEditor != null ? activeEditor .getCursorReference () : null );
156
161
}
0 commit comments