|
17 | 17 | import com.intellij.openapi.fileEditor.FileDocumentManager; |
18 | 18 | import com.intellij.openapi.project.Project; |
19 | 19 | import com.intellij.openapi.ui.ComponentWithBrowseButton; |
| 20 | +import com.intellij.openapi.ui.Splitter; |
20 | 21 | import com.intellij.openapi.ui.TextComponentAccessor; |
21 | 22 | import com.intellij.openapi.ui.TextFieldWithBrowseButton; |
22 | 23 | import com.intellij.openapi.util.Key; |
@@ -70,13 +71,7 @@ public class InputPanel { |
70 | 71 | private JPanel startRuleAndInputPanel; |
71 | 72 | private TextFieldWithBrowseButton fileChooser; |
72 | 73 | private JPanel outerMostPanel; |
73 | | - |
74 | | - /** |
75 | | - * switchToGrammar() was seeing an empty slot instead of a previous |
76 | | - * editor or placeHolder. Figured it was an order of operations thing |
77 | | - * and synchronized add/remove ops. Works now w/o error. |
78 | | - */ |
79 | | - private final Object swapEditorComponentLock = new Object(); |
| 74 | + private Splitter editorSplitter; |
80 | 75 |
|
81 | 76 | private final PreviewPanel previewPanel; |
82 | 77 |
|
@@ -266,17 +261,7 @@ public void switchToGrammar(PreviewState previewState, VirtualFile grammarFile) |
266 | 261 | } |
267 | 262 |
|
268 | 263 | public void setEditorComponent(JComponent editor) { |
269 | | - BorderLayout layout = (BorderLayout) outerMostPanel.getLayout(); |
270 | | - String EDITOR_SPOT_COMPONENT = BorderLayout.CENTER; |
271 | | - // atomically remove old |
272 | | - synchronized (swapEditorComponentLock) { |
273 | | - Component editorSpotComp = layout.getLayoutComponent(EDITOR_SPOT_COMPONENT); |
274 | | - if ( editorSpotComp!=null ) { |
275 | | - editorSpotComp.setVisible(false); |
276 | | - outerMostPanel.remove(editorSpotComp); // remove old editor if it's there |
277 | | - } |
278 | | - outerMostPanel.add(editor, EDITOR_SPOT_COMPONENT); |
279 | | - } |
| 264 | + editorSplitter.setFirstComponent(editor); |
280 | 265 | } |
281 | 266 |
|
282 | 267 | public Editor getInputEditor() { |
|
0 commit comments