forked from qt-creator/qt-creator
Raise existing submit window if there is one when Submit is invoked.
Introduce convenience to VCSBaseSubmitEditor. Task-number: 254644
This commit is contained in:
@@ -588,6 +588,8 @@ void GitPlugin::revertFile()
|
||||
|
||||
void GitPlugin::startCommit()
|
||||
{
|
||||
if (VCSBase::VCSBaseSubmitEditor::raiseSubmitEditor())
|
||||
return;
|
||||
if (m_changeTmpFile) {
|
||||
m_outputWindow->append(tr("Another submit is currently beeing executed."));
|
||||
m_outputWindow->popup(false);
|
||||
|
@@ -485,6 +485,9 @@ void PerforcePlugin::printOpenedFileList()
|
||||
|
||||
void PerforcePlugin::submit()
|
||||
{
|
||||
if (VCSBase::VCSBaseSubmitEditor::raiseSubmitEditor())
|
||||
return;
|
||||
|
||||
if (!checkP4Command()) {
|
||||
showOutput(tr("No p4 executable specified!"), true);
|
||||
return;
|
||||
|
@@ -712,7 +712,8 @@ void SubversionPlugin::startCommit(const QStringList &files)
|
||||
{
|
||||
if (files.empty())
|
||||
return;
|
||||
|
||||
if (VCSBase::VCSBaseSubmitEditor::raiseSubmitEditor())
|
||||
return;
|
||||
if (m_changeTmpFile) {
|
||||
showOutput(tr("Another commit is currently being executed."));
|
||||
return;
|
||||
|
@@ -36,6 +36,7 @@
|
||||
#include <aggregation/aggregate.h>
|
||||
#include <coreplugin/ifile.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/uniqueidmanager.h>
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
#include <utils/submiteditorwidget.h>
|
||||
@@ -592,4 +593,23 @@ QStringList VCSBaseSubmitEditor::currentProjectFiles(bool nativeSeparators, QStr
|
||||
}
|
||||
return files;
|
||||
}
|
||||
|
||||
// Helper to raise an already open submit editor to prevent opening twice.
|
||||
bool VCSBaseSubmitEditor::raiseSubmitEditor()
|
||||
{
|
||||
Core::EditorManager *em = Core::EditorManager::instance();
|
||||
// Nothing to do?
|
||||
if (Core::IEditor *ce = em->currentEditor())
|
||||
if (qobject_cast<VCSBaseSubmitEditor*>(ce))
|
||||
return true;
|
||||
// Try to activate a hidden one
|
||||
foreach (Core::IEditor *e, em->openedEditors()) {
|
||||
if (qobject_cast<VCSBaseSubmitEditor*>(e)) {
|
||||
em->activateEditor(e, Core::EditorManager::IgnoreNavigationHistory);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace VCSBase
|
||||
|
@@ -159,7 +159,10 @@ public:
|
||||
// be restricted to them
|
||||
static QStringList currentProjectFiles(bool nativeSeparators, QString *name = 0);
|
||||
|
||||
bool temporaryEditor() const { return true; }
|
||||
virtual bool temporaryEditor() const { return true; }
|
||||
|
||||
// Helper to raise an already open submit editor to prevent opening twice.
|
||||
static bool raiseSubmitEditor();
|
||||
|
||||
signals:
|
||||
void diffSelectedFiles(const QStringList &files);
|
||||
|
Reference in New Issue
Block a user