forked from qt-creator/qt-creator
		
	Editor: Allow to open links in a new split.
This changes current behavior while opening links. Link is now opened in next split by default. If you use CTRL+Click to open links, it will also open in next split. However, by using CTRL+ALT+click it will open in current split. There are two new checkboxes in Tools/Options/Text Editor/Display: - "Open Links in New Split" - if it is checked, links will not be opened in current split. However, if document with link is already opened, it will be used to open the split - "Force open links in next split" - Links will always open in next split, even if their document is already opened somewhere else. Task-number: QTCREATORBUG-8117 Change-Id: Ib99075b55d9e9683ed2c2386767227457de0a3fc Reviewed-by: David Schulz <david.schulz@digia.com>
This commit is contained in:
		
				
					committed by
					
						
						David Schulz
					
				
			
			
				
	
			
			
			
						parent
						
							c0e7b65db3
						
					
				
				
					commit
					39e9c5ef20
				
			@@ -55,6 +55,7 @@
 | 
			
		||||
#include <coreplugin/vcsmanager.h>
 | 
			
		||||
#include <coreplugin/documentmanager.h>
 | 
			
		||||
#include <cppeditor/cppeditorconstants.h>
 | 
			
		||||
#include <texteditor/basetexteditor.h>
 | 
			
		||||
 | 
			
		||||
#include <QtConcurrentRun>
 | 
			
		||||
#include <QFutureSynchronizer>
 | 
			
		||||
@@ -158,8 +159,31 @@ void CppToolsPlugin::switchHeaderSource()
 | 
			
		||||
{
 | 
			
		||||
    Core::IEditor *editor = Core::EditorManager::currentEditor();
 | 
			
		||||
    QString otherFile = correspondingHeaderOrSource(editor->document()->fileName());
 | 
			
		||||
    if (!otherFile.isEmpty())
 | 
			
		||||
        Core::EditorManager::openEditor(otherFile);
 | 
			
		||||
    if (otherFile.isEmpty())
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    Core::EditorManager* editorManager = Core::EditorManager::instance();
 | 
			
		||||
    editorManager->addCurrentPositionToNavigationHistory();
 | 
			
		||||
    TextEditor::BaseTextEditorWidget *ed = qobject_cast<TextEditor::BaseTextEditorWidget *>(editor->widget());
 | 
			
		||||
    if (editorManager->hasSplitter()) {
 | 
			
		||||
        if (ed->forceOpenLinksInNextSplit()) {
 | 
			
		||||
            editorManager->gotoOtherSplit();
 | 
			
		||||
        } else if (ed->openLinksInNextSplit()) {
 | 
			
		||||
            bool isVisible = false;
 | 
			
		||||
            foreach (Core::IEditor *visEditor, editorManager->visibleEditors()) {
 | 
			
		||||
                if (visEditor->document() &&
 | 
			
		||||
                        (otherFile == visEditor->document()->fileName())) {
 | 
			
		||||
                    isVisible = true;
 | 
			
		||||
                    editorManager->activateEditor(visEditor);
 | 
			
		||||
                    break;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (!isVisible)
 | 
			
		||||
                editorManager->gotoOtherSplit();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    Core::EditorManager::openEditor(otherFile);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static QStringList findFilesInProject(const QString &name,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user