void ProjectExplorerPlugin::unloadProject(){ if (debug) qDebug() << "ProjectExplorerPlugin::unloadProject"; if (buildManager()->isBuilding(d->m_currentProject)) { QMessageBox box; QPushButton *closeAnyway = box.addButton(tr("Cancel Build && Unload"), QMessageBox::AcceptRole); QPushButton *cancelClose = box.addButton(tr("Do Not Unload"), QMessageBox::RejectRole); box.setDefaultButton(cancelClose); box.setWindowTitle(tr("Unload Project %1?").arg(d->m_currentProject->displayName())); box.setText(tr("The project %1 is currently being built.").arg(d->m_currentProject->displayName())); box.setInformativeText(tr("Do you want to cancel the build process and unload the project anyway?")); box.exec(); if (box.clickedButton() != closeAnyway) return; buildManager()->cancel(); } Core::IDocument *document = d->m_currentProject->document(); if (!document || document->fileName().isEmpty()) //nothing to save? return; QList<Core::IDocument*> documentsToSave; documentsToSave << document; bool success = false; if (document->isFileReadOnly()) success = Core::DocumentManager::saveModifiedDocuments(documentsToSave).isEmpty(); else success = Core::DocumentManager::saveModifiedDocumentsSilently(documentsToSave).isEmpty(); if (!success) return; addToRecentProjects(document->fileName(), d->m_currentProject->displayName()); //========================= НАЧАЛО КОДА ================================ //почему-то при вызове Core::ICore::editorManager()->closeEditors(editors) //меняется текущий проект. //поэтому данный вызов приходится делать здесь, а не ниже QStringList filesList(currentProject()->files(Project::AllFiles)); //========================= КОНЕЦ КОДА ================================= d->m_session->removeProject(d->m_currentProject); updateActions(); //========================= НАЧАЛО КОДА ================================ QList<Core::IEditor*> editors; foreach(QString file, filesList) { editors << Core::ICore::editorManager()->editorsForFileName(file); } if(!Core::ICore::editorManager()->closeEditors(editors)) return; // Action has been cancelled //========================= КОНЕЦ КОДА =================================}