TextEditor: Consolidate various currentTextEditor() implementations

Change-Id: Ie61c985e31a76dfd34ec1db207753007cee9aff3
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
hjk
2014-06-24 10:02:54 +02:00
parent a980ea98bb
commit 4572021a8d
6 changed files with 31 additions and 34 deletions

View File

@@ -695,14 +695,9 @@ bool fillParameters(DebuggerStartParameters *sp, const Kit *kit, QString *errorM
return true;
}
static TextEditor::ITextEditor *currentTextEditor()
{
return qobject_cast<TextEditor::ITextEditor *>(EditorManager::currentEditor());
}
static bool currentTextEditorPosition(ContextData *data)
{
TextEditor::ITextEditor *textEditor = currentTextEditor();
ITextEditor *textEditor = ITextEditor::currentTextEditor();
if (!textEditor)
return false;
const IDocument *document = textEditor->document();
@@ -1069,7 +1064,7 @@ public slots:
void handleExecRunToSelectedFunction()
{
ITextEditor *textEditor = currentTextEditor();
ITextEditor *textEditor = ITextEditor::currentTextEditor();
QTC_ASSERT(textEditor, return);
QPlainTextEdit *ed = qobject_cast<QPlainTextEdit*>(textEditor->widget());
if (!ed)
@@ -2047,7 +2042,7 @@ void DebuggerPluginPrivate::requestContextMenu(ITextEditor *editor,
void DebuggerPluginPrivate::toggleBreakpoint()
{
ITextEditor *textEditor = currentTextEditor();
ITextEditor *textEditor = ITextEditor::currentTextEditor();
QTC_ASSERT(textEditor, return);
const int lineNumber = textEditor->currentLine();
if (textEditor->property(Constants::OPENED_WITH_DISASSEMBLY).toBool()) {