forked from qt-creator/qt-creator
C++ function link: Disable link if target editor changes.
Change-Id: I7041f3c520e88b4376c5cbac08ed79aa44641f0f Reviewed-on: http://codereview.qt.nokia.com/3088 Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
This commit is contained in:
@@ -2302,6 +2302,14 @@ void CPPEditorWidget::onFunctionDeclDefLinkFound(QSharedPointer<FunctionDeclDefL
|
|||||||
{
|
{
|
||||||
abortDeclDefLink();
|
abortDeclDefLink();
|
||||||
m_declDefLink = link;
|
m_declDefLink = link;
|
||||||
|
|
||||||
|
// disable the link if content of the target editor changes
|
||||||
|
TextEditor::BaseTextEditorWidget *targetEditor =
|
||||||
|
TextEditor::RefactoringChanges::editorForFile(link->targetFile->fileName());
|
||||||
|
if (targetEditor) {
|
||||||
|
connect(targetEditor, SIGNAL(textChanged()),
|
||||||
|
this, SLOT(abortDeclDefLink()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPPEditorWidget::applyDeclDefLinkChanges(bool jumpToMatch)
|
void CPPEditorWidget::applyDeclDefLinkChanges(bool jumpToMatch)
|
||||||
@@ -2317,6 +2325,15 @@ void CPPEditorWidget::abortDeclDefLink()
|
|||||||
{
|
{
|
||||||
if (!m_declDefLink)
|
if (!m_declDefLink)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// undo connect from onFunctionDeclDefLinkFound
|
||||||
|
TextEditor::BaseTextEditorWidget *targetEditor =
|
||||||
|
TextEditor::RefactoringChanges::editorForFile(m_declDefLink->targetFile->fileName());
|
||||||
|
if (targetEditor) {
|
||||||
|
disconnect(targetEditor, SIGNAL(textChanged()),
|
||||||
|
this, SLOT(abortDeclDefLink()));
|
||||||
|
}
|
||||||
|
|
||||||
m_declDefLink->hideMarker(this);
|
m_declDefLink->hideMarker(this);
|
||||||
m_declDefLink.clear();
|
m_declDefLink.clear();
|
||||||
}
|
}
|
||||||
|
@@ -269,7 +269,7 @@ private:
|
|||||||
void abortRename();
|
void abortRename();
|
||||||
|
|
||||||
void applyDeclDefLinkChanges(bool jumpToMatch);
|
void applyDeclDefLinkChanges(bool jumpToMatch);
|
||||||
void abortDeclDefLink();
|
Q_SLOT void abortDeclDefLink();
|
||||||
|
|
||||||
Link attemptFuncDeclDef(const QTextCursor &cursor,
|
Link attemptFuncDeclDef(const QTextCursor &cursor,
|
||||||
const CPlusPlus::Document::Ptr &doc,
|
const CPlusPlus::Document::Ptr &doc,
|
||||||
|
@@ -120,11 +120,10 @@ public:
|
|||||||
*/
|
*/
|
||||||
void activateEditor(const QString &fileName, int line, int column);
|
void activateEditor(const QString &fileName, int line, int column);
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
static BaseTextEditorWidget *editorForFile(const QString &fileName,
|
static BaseTextEditorWidget *editorForFile(const QString &fileName,
|
||||||
bool openIfClosed = false);
|
bool openIfClosed = false);
|
||||||
|
|
||||||
|
private:
|
||||||
static QList<QTextCursor> rangesToSelections(QTextDocument *document, const QList<Range> &ranges);
|
static QList<QTextCursor> rangesToSelections(QTextDocument *document, const QList<Range> &ranges);
|
||||||
virtual void indentSelection(const QTextCursor &selection,
|
virtual void indentSelection(const QTextCursor &selection,
|
||||||
const QString &fileName,
|
const QString &fileName,
|
||||||
|
Reference in New Issue
Block a user