| 729 | } |
| 730 | |
| 731 | UITabWidget* UICodeEditorSplitter::createEditorWithTabWidget( Node* parent, bool openCurEditor ) { |
| 732 | eeASSERT( curWidgetExists() ); |
| 733 | if ( nullptr == mBaseLayout ) |
| 734 | mBaseLayout = parent; |
| 735 | UICodeEditor* prevCurEditor = mCurEditor; |
| 736 | UITabWidget* tabWidget = createTabWidget( parent ); |
| 737 | auto editorData = createCodeEditorInTabWidget( tabWidget ); |
| 738 | if ( editorData.first == nullptr || editorData.second == nullptr ) { |
| 739 | if ( !mTabWidgets.empty() && mTabWidgets[0]->getTabCount() > 0 ) { |
| 740 | editorData = createCodeEditorInTabWidget( mTabWidgets[0] ); |
| 741 | } else { |
| 742 | Log::error( "Couldn't createCodeEditorInTabWidget in " |
| 743 | "UICodeEditorSplitter::createEditorWithTabWidget" ); |
| 744 | return nullptr; |
| 745 | } |
| 746 | } |
| 747 | mAboutToAddEditor = editorData.second; |
| 748 | // Open same document in the new split |
| 749 | if ( openCurEditor && prevCurEditor && prevCurEditor != editorData.second && |
| 750 | !prevCurEditor->getDocument().isEmpty() ) { |
| 751 | editorData.second->setDocument( prevCurEditor->getDocumentRef() ); |
| 752 | editorData.second->goToLine( prevCurEditor->getDocument().getSelection().start() ); |
| 753 | auto path( editorData.second->getDocument().getFilePath() ); |
| 754 | if ( !path.empty() ) |
| 755 | editorData.first->setTooltipText( path ); |
| 756 | } |
| 757 | mAboutToAddEditor = nullptr; |
| 758 | return tabWidget; |
| 759 | } |
| 760 | |
| 761 | UITab* UICodeEditorSplitter::isDocumentOpen( const std::string& path, |
| 762 | bool checkOnlyInCurrentTabWidget, |
no test coverage detected