Commit 82f55736 authored by hjk's avatar hjk Committed by hjk

more Id type fixes

Change-Id: I3720946ba5485696822976567d83b4d6cb1fb283

x

Change-Id: Iab58bc34bc56371405d132315573b484a533b77c
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent cfc9b71e
......@@ -436,7 +436,7 @@ void AnalyzerManagerPrivate::activateDock(Qt::DockWidgetArea area, QDockWidget *
QAction *toggleViewAction = dockWidget->toggleViewAction();
toggleViewAction->setText(dockWidget->windowTitle());
Command *cmd = am->registerAction(toggleViewAction,
QString("Analyzer." + dockWidget->objectName()), globalContext);
Core::Id("Analyzer." + dockWidget->objectName()), globalContext);
cmd->setAttribute(Command::CA_Hide);
ActionContainer *viewsMenu =
......@@ -448,7 +448,7 @@ void AnalyzerManagerPrivate::deactivateDock(QDockWidget *dockWidget)
{
ActionManager *am = ICore::instance()->actionManager();
QAction *toggleViewAction = dockWidget->toggleViewAction();
am->unregisterAction(toggleViewAction, QString("Analyzer." + dockWidget->objectName()));
am->unregisterAction(toggleViewAction, Core::Id("Analyzer." + dockWidget->objectName()));
m_mainWindow->removeDockWidget(dockWidget);
dockWidget->hide();
// Prevent saveState storing the data of the wrong children.
......@@ -701,7 +701,7 @@ void AnalyzerManagerPrivate::addTool(IAnalyzerTool *tool, const StartModes &mode
foreach (StartMode mode, modes) {
QString actionName = tool->actionName(mode);
QString menuGroup = tool->menuGroup(mode);
QString actionId = tool->actionId(mode);
Core::Id actionId(QString::fromLatin1(tool->actionId(mode)));
QAction *action = new QAction(actionName, 0);
Core::Command *command = am->registerAction(action, actionId,
Core::Context(Core::Constants::C_GLOBAL));
......
......@@ -374,7 +374,7 @@ public:
return m_file->open(errorString, fileName);
}
Core::IFile *file() { return m_file; }
QString id() const { return QLatin1String(Core::Constants::K_DEFAULT_BINARY_EDITOR_ID); }
Core::Id id() const { return Core::Constants::K_DEFAULT_BINARY_EDITOR_ID; }
QString displayName() const { return m_displayName; }
void setDisplayName(const QString &title) { m_displayName = title; emit changed(); }
......@@ -477,7 +477,7 @@ BinEditorPlugin::~BinEditorPlugin()
QAction *BinEditorPlugin::registerNewAction(const QString &id, const QString &title)
{
QAction *result = new QAction(title, this);
Core::ICore::instance()->actionManager()->registerAction(result, id, m_context);
Core::ICore::instance()->actionManager()->registerAction(result, Core::Id(id), m_context);
return result;
}
......
......@@ -293,7 +293,7 @@ void Manager::onDocumentUpdated(CPlusPlus::Document::Ptr doc)
void Manager::gotoLocation(const QString &fileName, int line, int column)
{
bool newEditor = false;
TextEditor::BaseTextEditorWidget::openEditorAt(fileName, line, column, QString(),
TextEditor::BaseTextEditorWidget::openEditorAt(fileName, line, column, Core::Id(),
Core::EditorManager::IgnoreNavigationHistory,
&newEditor);
}
......
......@@ -72,9 +72,9 @@ Core::IEditor *CMakeEditor::duplicate(QWidget *parent)
return ret->editor();
}
QString CMakeEditor::id() const
Core::Id CMakeEditor::id() const
{
return QLatin1String(CMakeProjectManager::Constants::CMAKE_EDITOR_ID);
return CMakeProjectManager::Constants::CMAKE_EDITOR_ID;
}
void CMakeEditor::markAsChanged()
......
......@@ -59,7 +59,7 @@ public:
bool duplicateSupported() const { return true; }
Core::IEditor *duplicate(QWidget *parent);
QString id() const;
Core::Id id() const;
bool isTemporary() const { return false; }
private slots:
......
......@@ -278,12 +278,11 @@ static EditorManager *m_instance = 0;
EditorManager *EditorManager::instance() { return m_instance; }
static Command *createSeparator(ActionManager *am, QObject *parent,
const QString &name,
const Context &context)
const Id &id, const Context &context)
{
QAction *tmpaction = new QAction(parent);
tmpaction->setSeparator(true);
Command *cmd = am->registerAction(tmpaction, name, context);
Command *cmd = am->registerAction(tmpaction, id, context);
return cmd;
}
......@@ -458,13 +457,13 @@ EditorManager::EditorManager(ICore *core, QWidget *parent) :
advancedMenu->appendGroup(Constants::G_EDIT_EDITOR);
// Advanced menu separators
cmd = createSeparator(am, this, QLatin1String("QtCreator.Edit.Sep.Collapsing"), editManagerContext);
cmd = createSeparator(am, this, Id("QtCreator.Edit.Sep.Collapsing"), editManagerContext);
advancedMenu->addAction(cmd, Constants::G_EDIT_COLLAPSING);
cmd = createSeparator(am, this, QLatin1String("QtCreator.Edit.Sep.Blocks"), editManagerContext);
cmd = createSeparator(am, this, Id("QtCreator.Edit.Sep.Blocks"), editManagerContext);
advancedMenu->addAction(cmd, Constants::G_EDIT_BLOCKS);
cmd = createSeparator(am, this, QLatin1String("QtCreator.Edit.Sep.Font"), editManagerContext);
cmd = createSeparator(am, this, Id("QtCreator.Edit.Sep.Font"), editManagerContext);
advancedMenu->addAction(cmd, Constants::G_EDIT_FONT);
cmd = createSeparator(am, this, QLatin1String("QtCreator.Edit.Sep.Editor"), editManagerContext);
cmd = createSeparator(am, this, Id("QtCreator.Edit.Sep.Editor"), editManagerContext);
advancedMenu->addAction(cmd, Constants::G_EDIT_EDITOR);
// other setup
......@@ -1221,9 +1220,9 @@ Core::Id EditorManager::getOpenWithEditorId(const QString &fileName,
// Collect editors that can open the file
const MimeType mt = d->m_core->mimeDatabase()->findByFile(fileName);
if (!mt)
return QString();
return Id();
QStringList allEditorIds;
QStringList externalEditorIds;
QList<Id> externalEditorIds;
// Built-in
const EditorFactoryList editors = editorFactories(mt, false);
const int size = editors.size();
......@@ -1234,18 +1233,18 @@ Core::Id EditorManager::getOpenWithEditorId(const QString &fileName,
const ExternalEditorList exEditors = externalEditors(mt, false);
const int esize = exEditors.size();
for (int i = 0; i < esize; i++) {
externalEditorIds.push_back(exEditors.at(i)->id().toString());
externalEditorIds.push_back(exEditors.at(i)->id());
allEditorIds.push_back(exEditors.at(i)->id().toString());
}
if (allEditorIds.empty())
return QString();
return Id();
// Run dialog.
OpenWithDialog dialog(fileName, d->m_core->mainWindow());
dialog.setEditors(allEditorIds);
dialog.setCurrentEditor(0);
if (dialog.exec() != QDialog::Accepted)
return QString();
const QString selectedId = dialog.editor();
return Id();
const Id selectedId = Id(dialog.editor());
if (isExternalEditor)
*isExternalEditor = externalEditorIds.contains(selectedId);
return selectedId;
......@@ -1318,7 +1317,7 @@ IEditor *EditorManager::openEditor(Core::Internal::EditorView *view, const QStri
// If we could not open the file in the requested editor, fall
// back to the default editor:
if (!editor)
editor = createEditor(QString(), fn);
editor = createEditor(Id(), fn);
if (!editor) // Internal error
return 0;
......@@ -1604,7 +1603,7 @@ bool EditorManager::saveFileAs(IFile *fileParam)
void EditorManager::addFileToRecentFiles(IFile *file)
{
bool isTemporary = true;
QString editorId;
Id editorId;
QList<IEditor *> editors = editorsForFile(file);
foreach (IEditor *editor, editors) {
if (!editor->isTemporary()) {
......@@ -1943,9 +1942,9 @@ bool EditorManager::restoreState(const QByteArray &state)
continue;
QFileInfo rfi(autoSaveName(fileName));
if (rfi.exists() && fi.lastModified() < rfi.lastModified()) {
openEditor(fileName, QString::fromUtf8(id));
openEditor(fileName, Id(QString::fromUtf8(id)));
} else {
d->m_editorModel->addRestoredEditor(fileName, displayName, QString::fromUtf8(id));
d->m_editorModel->addRestoredEditor(fileName, displayName, Id(QString::fromUtf8(id)));
}
}
}
......
......@@ -756,10 +756,10 @@ QByteArray SplitterOrView::saveState() const
stream << QByteArray("empty");
} else if (e == em->currentEditor()) {
stream << QByteArray("currenteditor")
<< e->file()->fileName() << e->id() << e->saveState();
<< e->file()->fileName() << e->id().toString() << e->saveState();
} else {
stream << QByteArray("editor")
<< e->file()->fileName() << e->id() << e->saveState();
<< e->file()->fileName() << e->id().toString() << e->saveState();
}
}
return bytes;
......
......@@ -33,6 +33,8 @@
#ifndef EDITORVIEW_H
#define EDITORVIEW_H
#include "coreplugin/id.h"
#include <QtCore/QMap>
#include <QtCore/QList>
#include <QtCore/QString>
......@@ -64,7 +66,7 @@ namespace Internal {
struct EditLocation {
QPointer<IFile> file;
QString fileName;
QString id;
Id id;
QVariant state;
};
......
......@@ -35,6 +35,8 @@
#include <coreplugin/core_global.h>
#include <coreplugin/icontext.h>
#include <coreplugin/id.h>
#include <QtCore/QMetaType>
namespace Core {
......@@ -52,7 +54,7 @@ public:
virtual bool createNew(const QString &contents = QString()) = 0;
virtual bool open(QString *errorString, const QString &fileName, const QString &realFileName) = 0;
virtual IFile *file() = 0;
virtual QString id() const = 0;
virtual Core::Id id() const = 0;
virtual QString displayName() const = 0;
virtual void setDisplayName(const QString &title) = 0;
......
......@@ -131,7 +131,7 @@ void OpenEditorsModel::addEditor(IEditor *editor, bool isDuplicate)
addEntry(entry);
}
void OpenEditorsModel::addRestoredEditor(const QString &fileName, const QString &displayName, const QString &id)
void OpenEditorsModel::addRestoredEditor(const QString &fileName, const QString &displayName, const Id &id)
{
Entry entry;
entry.m_fileName = fileName;
......
......@@ -64,7 +64,7 @@ public:
QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const;
void addEditor(IEditor *editor, bool isDuplicate = false);
void addRestoredEditor(const QString &fileName, const QString &displayName, const QString &id);
void addRestoredEditor(const QString &fileName, const QString &displayName, const Id &id);
QModelIndex firstRestoredEditor() const;
struct CORE_EXPORT Entry {
......
......@@ -1059,7 +1059,7 @@ void FileManager::syncWithEditor(Core::IContext *context)
\a editorId defaults to the empty id, which means to let the system figure out
the best editor itself.
*/
void FileManager::addToRecentFiles(const QString &fileName, const QString &editorId)
void FileManager::addToRecentFiles(const QString &fileName, const Id &editorId)
{
if (fileName.isEmpty())
return;
......@@ -1103,7 +1103,7 @@ void FileManager::saveSettings()
QStringList recentEditorIds;
foreach (const RecentFile &file, d->m_recentFiles) {
recentFiles.append(file.first);
recentEditorIds.append(file.second);
recentEditorIds.append(file.second.toString());
}
QSettings *s = Core::ICore::instance()->settings();
......@@ -1133,7 +1133,7 @@ void FileManager::readSettings()
editorId = ids.next();
if (QFileInfo(fileName).isFile())
d->m_recentFiles.append(RecentFile(QDir::fromNativeSeparators(fileName), // from native to guard against old settings
editorId));
Id(editorId)));
}
s->beginGroup(QLatin1String(directoryGroupC));
......
......@@ -33,7 +33,7 @@
#ifndef FILEMANAGER_H
#define FILEMANAGER_H
#include <coreplugin/core_global.h>
#include <coreplugin/id.h>
#include <QtCore/QObject>
#include <QtCore/QStringList>
......@@ -64,7 +64,7 @@ public:
KeepLinks
};
typedef QPair<QString, QString> RecentFile;
typedef QPair<QString, Id> RecentFile;
explicit FileManager(QMainWindow *ew);
virtual ~FileManager();
......@@ -83,7 +83,7 @@ public:
void unexpectFileChange(const QString &fileName);
// recent files
void addToRecentFiles(const QString &fileName, const QString &editorId = QString());
void addToRecentFiles(const QString &fileName, const Id &editorId = Id());
Q_SLOT void clearRecentFiles();
QList<RecentFile> recentFiles() const;
......
......@@ -61,7 +61,7 @@ public:
explicit GeneratedFilePrivate(const QString &p);
QString path;
QByteArray contents;
QString editorId;
Id editorId;
bool binary;
GeneratedFile::Attributes attributes;
};
......@@ -139,14 +139,14 @@ void GeneratedFile::setBinary(bool b)
m_d->binary = b;
}
QString GeneratedFile::editorId() const
Id GeneratedFile::editorId() const
{
return m_d->editorId;
}
void GeneratedFile::setEditorId(const QString &k)
void GeneratedFile::setEditorId(const Id &id)
{
m_d->editorId = k;
m_d->editorId = id;
}
bool GeneratedFile::write(QString *errorMessage) const
......
......@@ -34,7 +34,7 @@
#ifndef CORE_GENERATEDFILE_H
#define CORE_GENERATEDFILE_H
#include "core_global.h"
#include "coreplugin/id.h"
#include <QtCore/QSharedDataPointer>
#include <QtCore/QList>
......@@ -79,8 +79,8 @@ public:
void setBinary(bool b);
// Id of editor to open the file with
QString editorId() const;
void setEditorId(const QString &k);
Id editorId() const;
void setEditorId(const Id &id);
bool write(QString *errorMessage) const;
......
......@@ -37,7 +37,6 @@
#include <utils/qtcassert.h>
#include <QtCore/QHash>
#include <QtCore/QDebug>
namespace Core {
......
......@@ -47,7 +47,7 @@ public:
Id() : m_id(0) {}
Id(const char *name);
// FIXME: Replace with QByteArray
Id(const QString &name);
explicit Id(const QString &name);
QByteArray name() const;
QString toString() const;
bool isValid() const { return m_id; }
......@@ -67,6 +67,6 @@ CORE_EXPORT inline uint qHash(const Id &id) { return id.uniqueIdentifier(); }
} // namespace Core
Q_DECLARE_METATYPE(Core::Id);
Q_DECLARE_METATYPE(Core::Id)
#endif // CORE_ID_H
......@@ -537,12 +537,11 @@ void MainWindow::registerDefaultContainers()
}
static Command *createSeparator(ActionManager *am, QObject *parent,
const QString &name,
const Context &context)
const Id &id, const Context &context)
{
QAction *tmpaction = new QAction(parent);
tmpaction->setSeparator(true);
Command *cmd = am->registerAction(tmpaction, name, context);
Command *cmd = am->registerAction(tmpaction, id, context);
return cmd;
}
......@@ -558,30 +557,30 @@ void MainWindow::registerDefaultActions()
Context globalContext(Constants::C_GLOBAL);
// File menu separators
Command *cmd = createSeparator(am, this, QLatin1String("QtCreator.File.Sep.Save"), globalContext);
Command *cmd = createSeparator(am, this, Id("QtCreator.File.Sep.Save"), globalContext);
mfile->addAction(cmd, Constants::G_FILE_SAVE);
cmd = createSeparator(am, this, QLatin1String("QtCreator.File.Sep.Print"), globalContext);
cmd = createSeparator(am, this, Id("QtCreator.File.Sep.Print"), globalContext);
QIcon icon = QIcon::fromTheme(QLatin1String("edit-cut"), QIcon(Constants::ICON_CUT));
mfile->addAction(cmd, Constants::G_FILE_PRINT);
cmd = createSeparator(am, this, QLatin1String("QtCreator.File.Sep.Close"), globalContext);
cmd = createSeparator(am, this, Id("QtCreator.File.Sep.Close"), globalContext);
mfile->addAction(cmd, Constants::G_FILE_CLOSE);
cmd = createSeparator(am, this, QLatin1String("QtCreator.File.Sep.Other"), globalContext);
cmd = createSeparator(am, this, Id("QtCreator.File.Sep.Other"), globalContext);
mfile->addAction(cmd, Constants::G_FILE_OTHER);
// Edit menu separators
cmd = createSeparator(am, this, QLatin1String("QtCreator.Edit.Sep.CopyPaste"), globalContext);
cmd = createSeparator(am, this, Id("QtCreator.Edit.Sep.CopyPaste"), globalContext);
medit->addAction(cmd, Constants::G_EDIT_COPYPASTE);
cmd = createSeparator(am, this, QLatin1String("QtCreator.Edit.Sep.SelectAll"), globalContext);
cmd = createSeparator(am, this, Id("QtCreator.Edit.Sep.SelectAll"), globalContext);
medit->addAction(cmd, Constants::G_EDIT_SELECTALL);
cmd = createSeparator(am, this, QLatin1String("QtCreator.Edit.Sep.Find"), globalContext);
cmd = createSeparator(am, this, Id("QtCreator.Edit.Sep.Find"), globalContext);
medit->addAction(cmd, Constants::G_EDIT_FIND);
cmd = createSeparator(am, this, QLatin1String("QtCreator.Edit.Sep.Advanced"), globalContext);
cmd = createSeparator(am, this, Id("QtCreator.Edit.Sep.Advanced"), globalContext);
medit->addAction(cmd, Constants::G_EDIT_ADVANCED);
// Return to editor shortcut: Note this requires Qt to fix up
......@@ -728,7 +727,7 @@ void MainWindow::registerDefaultActions()
// Options Action
mtools->appendGroup(Constants::G_TOOLS_OPTIONS);
cmd = createSeparator(am, this, QLatin1String("QtCreator.Tools.Sep.Options"), globalContext);
cmd = createSeparator(am, this, Id("QtCreator.Tools.Sep.Options"), globalContext);
mtools->addAction(cmd, Constants::G_TOOLS_OPTIONS);
m_optionsAction = new QAction(tr("&Options..."), this);
cmd = am->registerAction(m_optionsAction, Constants::OPTIONS, globalContext);
......@@ -754,7 +753,7 @@ void MainWindow::registerDefaultActions()
connect(m_zoomAction, SIGNAL(triggered()), this, SLOT(showMaximized()));
// Window separator
cmd = createSeparator(am, this, QLatin1String("QtCreator.Window.Sep.Size"), globalContext);
cmd = createSeparator(am, this, Id("QtCreator.Window.Sep.Size"), globalContext);
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
#endif
......@@ -884,7 +883,7 @@ void MainWindow::openFiles(const QStringList &fileNames, ICore::OpenFilesFlags f
emFlags = EditorManager::ModeSwitch;
if (flags & ICore::CanContainLineNumbers)
emFlags |= EditorManager::CanContainLineNumber;
Core::IEditor *editor = editorManager()->openEditor(absoluteFilePath, QString(), emFlags);
Core::IEditor *editor = editorManager()->openEditor(absoluteFilePath, Id(), emFlags);
if (!editor && (flags & ICore::StopOnLoadFail))
return;
}
......
......@@ -203,7 +203,7 @@ void ModeManager::objectAdded(QObject *obj)
// Register mode shortcut
ActionManager *am = d->m_mainWindow->actionManager();
const QString shortcutId = QLatin1String("QtCreator.Mode.") + mode->id();
const Id shortcutId(QLatin1String("QtCreator.Mode.") + mode->id());
QShortcut *shortcut = new QShortcut(d->m_mainWindow);
shortcut->setWhatsThis(tr("Switch to <b>%1</b> mode").arg(mode->displayName()));
Command *cmd = am->registerShortcut(shortcut, shortcutId, Context(Constants::C_GLOBAL));
......
......@@ -274,7 +274,7 @@ void OutputPaneManager::init()
actionId.remove(QLatin1Char(' '));
QAction *action = new QAction(outPane->displayName(), this);
Command *cmd = am->registerAction(action, actionId, Context(Constants::C_GLOBAL));
Command *cmd = am->registerAction(action, Id(actionId), Context(Constants::C_GLOBAL));
mpanes->addAction(cmd, "Coreplugin.OutputPane.PanesGroup");
m_actions.insert(cmd->action(), idx);
......
......@@ -366,7 +366,7 @@ void CodepasterPlugin::finishFetch(const QString &titleDescription,
const QString fileName = saver.fileName();
m_fetchedSnippets.push_back(fileName);
// Open editor with title.
Core::IEditor* editor = EditorManager::instance()->openEditor(fileName, QString(), EditorManager::ModeSwitch);
Core::IEditor* editor = EditorManager::instance()->openEditor(fileName, Core::Id(), EditorManager::ModeSwitch);
QTC_ASSERT(editor, return)
editor->setDisplayName(titleDescription);
}
......
......@@ -1639,9 +1639,9 @@ Core::IEditor *CPPEditor::duplicate(QWidget *parent)
return newEditor->editor();
}
QString CPPEditor::id() const
Core::Id CPPEditor::id() const
{
return QLatin1String(CppEditor::Constants::CPPEDITOR_ID);
return CppEditor::Constants::CPPEDITOR_ID;
}
bool CPPEditor::open(QString *errorString, const QString &fileName, const QString &realFileName)
......
......@@ -152,10 +152,10 @@ public:
bool duplicateSupported() const { return true; }
Core::IEditor *duplicate(QWidget *parent);
QString id() const;
Core::Id id() const;
bool isTemporary() const { return false; }
virtual bool open(QString *errorString, const QString &fileName, const QString &realFileName);
bool open(QString *errorString, const QString &fileName, const QString &realFileName);
};
class CPPEditorWidget : public TextEditor::BaseTextEditorWidget
......
......@@ -65,9 +65,9 @@ using namespace CPlusPlus;
// -------------------------
// CppQuickFixAssistProvider
// -------------------------
bool CppQuickFixAssistProvider::supportsEditor(const QString &editorId) const
bool CppQuickFixAssistProvider::supportsEditor(const Core::Id &editorId) const
{
return editorId == QLatin1String(CppEditor::Constants::CPPEDITOR_ID);
return editorId == CppEditor::Constants::CPPEDITOR_ID;
}
IAssistProcessor *CppQuickFixAssistProvider::createProcessor() const
......
......@@ -91,7 +91,7 @@ private:
class CppQuickFixAssistProvider : public TextEditor::QuickFixAssistProvider
{
public:
virtual bool supportsEditor(const QString &editorId) const;
virtual bool supportsEditor(const Core::Id &editorId) const;
virtual TextEditor::IAssistProcessor *createProcessor() const;
virtual QList<TextEditor::QuickFixFactory *> quickFixFactories() const;
......
......@@ -495,9 +495,9 @@ int CppFunctionHintModel::activeArgument(const QString &prefix) const
// ---------------------------
// CppCompletionAssistProvider
// ---------------------------
bool CppCompletionAssistProvider::supportsEditor(const QString &editorId) const
bool CppCompletionAssistProvider::supportsEditor(const Core::Id &editorId) const
{
return editorId == QLatin1String(CppEditor::Constants::CPPEDITOR_ID);
return editorId == Core::Id(CppEditor::Constants::CPPEDITOR_ID);
}
int CppCompletionAssistProvider::activationCharSequenceLength() const
......
......@@ -66,7 +66,7 @@ class CppAssistProposalModel;
class CppCompletionAssistProvider : public TextEditor::CompletionAssistProvider
{
public:
virtual bool supportsEditor(const QString &editorId) const;
virtual bool supportsEditor(const Core::Id &editorId) const;
virtual int activationCharSequenceLength() const;
virtual bool isActivationCharSequence(const QString &sequence) const;
virtual TextEditor::IAssistProcessor *createProcessor() const;
......
......@@ -113,7 +113,7 @@ void CppCurrentDocumentFilter::accept(Locator::FilterEntry selection) const
{
ModelItemInfo info = qvariant_cast<CppTools::Internal::ModelItemInfo>(selection.internalData);
TextEditor::BaseTextEditorWidget::openEditorAt(info.fileName, info.line, info.column,
QString(), Core::EditorManager::ModeSwitch);
Core::Id(), Core::EditorManager::ModeSwitch);
}
void CppCurrentDocumentFilter::refresh(QFutureInterface<void> &future)
......
......@@ -327,10 +327,10 @@ void CppFindReferences::openEditor(const Find::SearchResultItem &item)
{
if (item.path.size() > 0) {
TextEditor::BaseTextEditorWidget::openEditorAt(item.path.first(), item.lineNumber, item.textMarkPos,
QString(),
Core::Id(),
Core::EditorManager::ModeSwitch);
} else {
Core::EditorManager::instance()->openEditor(item.text, QString(), Core::EditorManager::ModeSwitch);
Core::EditorManager::instance()->openEditor(item.text, Core::Id(), Core::EditorManager::ModeSwitch);
}