Work with documents instead of editors where possible in debugger

And where using editors is necessary, take *all* editors into account,
not a random set of what previously was called "original" editors (when
using splits).

Change-Id: Id6bbad08f3083b6744fc2edcf0b87ba504d3257b
Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
Eike Ziller
2013-07-09 12:14:33 +02:00
parent 354cd410b0
commit 871a8cd031
9 changed files with 58 additions and 77 deletions

View File

@@ -2119,29 +2119,26 @@ void DebuggerPluginPrivate::cleanupViews()
if (!boolSetting(CloseBuffersOnExit))
return;
EditorManager *editorManager = EditorManager::instance();
QTC_ASSERT(editorManager, return);
QList<IEditor *> toClose;
foreach (IEditor *editor, editorManager->openedEditors()) {
if (editor->property(Constants::OPENED_BY_DEBUGGER).toBool()) {
IDocument *doc = editor->document();
QList<IDocument *> toClose;
foreach (IDocument *document, EditorManager::documentModel()->openedDocuments()) {
if (document->property(Constants::OPENED_BY_DEBUGGER).toBool()) {
bool keepIt = true;
if (editor->property(Constants::OPENED_WITH_DISASSEMBLY).toBool())
if (document->property(Constants::OPENED_WITH_DISASSEMBLY).toBool())
keepIt = false;
else if (doc->isModified())
else if (document->isModified())
keepIt = true;
else if (doc->filePath().contains(_("qeventdispatcher")))
else if (document->filePath().contains(_("qeventdispatcher")))
keepIt = false;
else
keepIt = (editor == EditorManager::currentEditor());
keepIt = (document == EditorManager::currentDocument());
if (keepIt)
editor->setProperty(Constants::OPENED_BY_DEBUGGER, false);
document->setProperty(Constants::OPENED_BY_DEBUGGER, false);
else
toClose.append(editor);
toClose.append(document);
}
}
editorManager->closeEditors(toClose);
EditorManager::closeDocuments(toClose);
}
void DebuggerPluginPrivate::setBusyCursor(bool busy)