Commit 4d96fa7a authored by hjk's avatar hjk Committed by Eike Ziller

Core: Merge Find and Locator into Core plugin

Change-Id: I7053310272235d854c9f409670ff52a10a7add8b
Reviewed-by: default avatarChristian Kandeler <christian.kandeler@digia.com>
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent 8b854270
...@@ -209,13 +209,13 @@ ...@@ -209,13 +209,13 @@
\row \row
\li Add a find filter to the \gui Find dialog. \li Add a find filter to the \gui Find dialog.
\li Implement any kind of search term based search. \li Implement any kind of search term based search.
\li \l{Find::IFindFilter}, \l{Find::SearchResultWindow} \li \l{Find::IFindFilter}, \l{Core::SearchResultWindow}
\row \row
\li Add support for the find tool bar to a widget. \li Add support for the find tool bar to a widget.
\li The widget that has focus is asked whether it supports text search. You can \li The widget that has focus is asked whether it supports text search. You can
add support for widgets under your control. add support for widgets under your control.
\li \l{Find::IFindSupport}, \l{Find::BaseTextFind} \li \l{Core::IFindSupport}, \l{Find::BaseTextFind}
\row \row
\li Add a completely new project type. \li Add a completely new project type.
...@@ -231,7 +231,7 @@ ...@@ -231,7 +231,7 @@
\li Add a new filter to the locator. \li Add a new filter to the locator.
\li For a text typed in by the user you provide a list of things to show in the popup. \li For a text typed in by the user you provide a list of things to show in the popup.
When the user selects an entry you are requested to do whatever you want. When the user selects an entry you are requested to do whatever you want.
\li \l{Locator::ILocatorFilter}, \l{Locator::FilterEntry}, \l{Locator::BaseFileFilter} \li \l{Core::ILocatorFilter}, \l{Core::LocatorFilterEntry}, \l{Locator::BaseFileFilter}
\row \row
\li Show a progress indicator for a concurrently running task. \li Show a progress indicator for a concurrently running task.
......
...@@ -8,10 +8,7 @@ QtcPlugin { ...@@ -8,10 +8,7 @@ QtcPlugin {
Depends { name: "Qt.widgets" } Depends { name: "Qt.widgets" }
Depends { name: "Core" } Depends { name: "Core" }
Depends { name: "TextEditor" } Depends { name: "TextEditor" }
Depends { name: "Find" }
Depends { name: "VcsBase" } Depends { name: "VcsBase" }
Depends { name: "Locator" }
files: [ files: [
"annotationhighlighter.cpp", "annotationhighlighter.cpp",
......
...@@ -2,7 +2,6 @@ QTC_PLUGIN_NAME = Bazaar ...@@ -2,7 +2,6 @@ QTC_PLUGIN_NAME = Bazaar
QTC_LIB_DEPENDS += \ QTC_LIB_DEPENDS += \
utils utils
QTC_PLUGIN_DEPENDS += \ QTC_PLUGIN_DEPENDS += \
locator \
texteditor \ texteditor \
coreplugin \ coreplugin \
vcsbase vcsbase
...@@ -48,8 +48,7 @@ ...@@ -48,8 +48,7 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/documentmanager.h> #include <coreplugin/documentmanager.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/locator/commandlocator.h>
#include <locator/commandlocator.h>
#include <utils/parameteraction.h> #include <utils/parameteraction.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
...@@ -149,7 +148,7 @@ bool BazaarPlugin::initialize(const QStringList &arguments, QString *errorMessag ...@@ -149,7 +148,7 @@ bool BazaarPlugin::initialize(const QStringList &arguments, QString *errorMessag
addAutoReleasedObject(new CloneWizard); addAutoReleasedObject(new CloneWizard);
const QString prefix = QLatin1String("bzr"); const QString prefix = QLatin1String("bzr");
m_commandLocator = new Locator::CommandLocator("Bazaar", prefix, prefix); m_commandLocator = new Core::CommandLocator("Bazaar", prefix, prefix);
addAutoReleasedObject(m_commandLocator); addAutoReleasedObject(m_commandLocator);
createMenu(); createMenu();
......
...@@ -42,6 +42,7 @@ QT_END_NAMESPACE ...@@ -42,6 +42,7 @@ QT_END_NAMESPACE
namespace Core { namespace Core {
class ActionManager; class ActionManager;
class ActionContainer; class ActionContainer;
class CommandLocator;
class Id; class Id;
class IVersionControl; class IVersionControl;
class IEditorFactory; class IEditorFactory;
...@@ -56,10 +57,6 @@ namespace VcsBase { ...@@ -56,10 +57,6 @@ namespace VcsBase {
class VcsBaseSubmitEditor; class VcsBaseSubmitEditor;
} }
namespace Locator {
class CommandLocator;
}
namespace Bazaar { namespace Bazaar {
namespace Internal { namespace Internal {
...@@ -132,7 +129,7 @@ private: ...@@ -132,7 +129,7 @@ private:
OptionsPage *m_optionsPage; OptionsPage *m_optionsPage;
BazaarClient *m_client; BazaarClient *m_client;
Locator::CommandLocator *m_commandLocator; Core::CommandLocator *m_commandLocator;
Core::ActionContainer *m_bazaarContainer; Core::ActionContainer *m_bazaarContainer;
QList<QAction *> m_repositoryActionList; QList<QAction *> m_repositoryActionList;
......
...@@ -8,7 +8,6 @@ QtcPlugin { ...@@ -8,7 +8,6 @@ QtcPlugin {
Depends { name: "Qt.widgets" } Depends { name: "Qt.widgets" }
Depends { name: "Core" } Depends { name: "Core" }
Depends { name: "TextEditor" } Depends { name: "TextEditor" }
Depends { name: "Find" }
files: [ files: [
"bineditor.cpp", "bineditor.cpp",
......
...@@ -2,6 +2,5 @@ QTC_PLUGIN_NAME = BinEditor ...@@ -2,6 +2,5 @@ QTC_PLUGIN_NAME = BinEditor
QTC_LIB_DEPENDS += \ QTC_LIB_DEPENDS += \
utils utils
QTC_PLUGIN_DEPENDS += \ QTC_PLUGIN_DEPENDS += \
find \
texteditor \ texteditor \
coreplugin coreplugin
...@@ -53,18 +53,19 @@ ...@@ -53,18 +53,19 @@
#include <coreplugin/id.h> #include <coreplugin/id.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/editormanager/ieditor.h> #include <coreplugin/editormanager/ieditor.h>
#include <coreplugin/find/ifindsupport.h>
#include <coreplugin/idocument.h> #include <coreplugin/idocument.h>
#include <coreplugin/mimedatabase.h> #include <coreplugin/mimedatabase.h>
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <find/ifindsupport.h>
#include <utils/reloadpromptutils.h> #include <utils/reloadpromptutils.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
using namespace Core;
using namespace BINEditor; using namespace BINEditor;
using namespace BINEditor::Internal; using namespace BINEditor::Internal;
class BinEditorFind : public Find::IFindSupport class BinEditorFind : public Core::IFindSupport
{ {
Q_OBJECT Q_OBJECT
...@@ -80,9 +81,9 @@ public: ...@@ -80,9 +81,9 @@ public:
QString currentFindString() const { return QString(); } QString currentFindString() const { return QString(); }
QString completedFindString() const { return QString(); } QString completedFindString() const { return QString(); }
Find::FindFlags supportedFindFlags() const Core::FindFlags supportedFindFlags() const
{ {
return Find::FindBackward | Find::FindCaseSensitively; return FindBackward | FindCaseSensitively;
} }
void resetIncrementalSearch() void resetIncrementalSearch()
...@@ -91,9 +92,9 @@ public: ...@@ -91,9 +92,9 @@ public:
m_incrementalWrappedState = false; m_incrementalWrappedState = false;
} }
virtual void highlightAll(const QString &txt, Find::FindFlags findFlags) virtual void highlightAll(const QString &txt, Core::FindFlags findFlags)
{ {
m_widget->highlightSearchResults(txt.toLatin1(), Find::textDocumentFlagsForFindFlags(findFlags)); m_widget->highlightSearchResults(txt.toLatin1(), textDocumentFlagsForFindFlags(findFlags));
} }
void clearResults() void clearResults()
...@@ -101,7 +102,7 @@ public: ...@@ -101,7 +102,7 @@ public:
m_widget->highlightSearchResults(QByteArray()); m_widget->highlightSearchResults(QByteArray());
} }
int find(const QByteArray &pattern, int pos, Find::FindFlags findFlags, bool *wrapped) int find(const QByteArray &pattern, int pos, Core::FindFlags findFlags, bool *wrapped)
{ {
if (wrapped) if (wrapped)
*wrapped = false; *wrapped = false;
...@@ -110,10 +111,10 @@ public: ...@@ -110,10 +111,10 @@ public:
return pos; return pos;
} }
int res = m_widget->find(pattern, pos, Find::textDocumentFlagsForFindFlags(findFlags)); int res = m_widget->find(pattern, pos, textDocumentFlagsForFindFlags(findFlags));
if (res < 0) { if (res < 0) {
pos = (findFlags & Find::FindBackward) ? -1 : 0; pos = (findFlags & FindBackward) ? -1 : 0;
res = m_widget->find(pattern, pos, Find::textDocumentFlagsForFindFlags(findFlags)); res = m_widget->find(pattern, pos, textDocumentFlagsForFindFlags(findFlags));
if (res < 0) if (res < 0)
return res; return res;
if (wrapped) if (wrapped)
...@@ -122,7 +123,7 @@ public: ...@@ -122,7 +123,7 @@ public:
return res; return res;
} }
Result findIncremental(const QString &txt, Find::FindFlags findFlags) { Result findIncremental(const QString &txt, Core::FindFlags findFlags) {
QByteArray pattern = txt.toLatin1(); QByteArray pattern = txt.toLatin1();
if (pattern != m_lastPattern) if (pattern != m_lastPattern)
resetIncrementalSearch(); // Because we don't search for nibbles. resetIncrementalSearch(); // Because we don't search for nibbles.
...@@ -140,13 +141,13 @@ public: ...@@ -140,13 +141,13 @@ public:
Result result; Result result;
if (found >= 0) { if (found >= 0) {
result = Found; result = Found;
m_widget->highlightSearchResults(pattern, Find::textDocumentFlagsForFindFlags(findFlags)); m_widget->highlightSearchResults(pattern, textDocumentFlagsForFindFlags(findFlags));
m_contPos = -1; m_contPos = -1;
} else { } else {
if (found == -2) { if (found == -2) {
result = NotYetFound; result = NotYetFound;
m_contPos += m_contPos +=
findFlags & Find::FindBackward findFlags & FindBackward
? -BinEditorWidget::SearchStride : BinEditorWidget::SearchStride; ? -BinEditorWidget::SearchStride : BinEditorWidget::SearchStride;
} else { } else {
result = NotFound; result = NotFound;
...@@ -157,12 +158,12 @@ public: ...@@ -157,12 +158,12 @@ public:
return result; return result;
} }
Result findStep(const QString &txt, Find::FindFlags findFlags) { Result findStep(const QString &txt, Core::FindFlags findFlags) {
QByteArray pattern = txt.toLatin1(); QByteArray pattern = txt.toLatin1();
bool wasReset = (m_incrementalStartPos < 0); bool wasReset = (m_incrementalStartPos < 0);
if (m_contPos == -1) { if (m_contPos == -1) {
m_contPos = m_widget->cursorPosition(); m_contPos = m_widget->cursorPosition();
if (findFlags & Find::FindBackward) if (findFlags & FindBackward)
m_contPos = m_widget->selectionStart()-1; m_contPos = m_widget->selectionStart()-1;
} }
bool wrapped; bool wrapped;
...@@ -175,10 +176,10 @@ public: ...@@ -175,10 +176,10 @@ public:
m_incrementalStartPos = found; m_incrementalStartPos = found;
m_contPos = -1; m_contPos = -1;
if (wasReset) if (wasReset)
m_widget->highlightSearchResults(pattern, Find::textDocumentFlagsForFindFlags(findFlags)); m_widget->highlightSearchResults(pattern, textDocumentFlagsForFindFlags(findFlags));
} else if (found == -2) { } else if (found == -2) {
result = NotYetFound; result = NotYetFound;
m_contPos += findFlags & Find::FindBackward m_contPos += findFlags & FindBackward
? -BinEditorWidget::SearchStride : BinEditorWidget::SearchStride; ? -BinEditorWidget::SearchStride : BinEditorWidget::SearchStride;
} else { } else {
result = NotFound; result = NotFound;
...@@ -213,7 +214,7 @@ public: ...@@ -213,7 +214,7 @@ public:
~BinEditorDocument() {} ~BinEditorDocument() {}
QString mimeType() const { QString mimeType() const {
return QLatin1String(Constants::C_BINEDITOR_MIMETYPE); return QLatin1String(BINEditor::Constants::C_BINEDITOR_MIMETYPE);
} }
bool setContents(const QByteArray &contents) bool setContents(const QByteArray &contents)
...@@ -340,7 +341,7 @@ public: ...@@ -340,7 +341,7 @@ public:
m_widget = widget; m_widget = widget;
m_file = new BinEditorDocument(m_widget); m_file = new BinEditorDocument(m_widget);
m_context.add(Core::Constants::K_DEFAULT_BINARY_EDITOR_ID); m_context.add(Core::Constants::K_DEFAULT_BINARY_EDITOR_ID);
m_context.add(Constants::C_BINEDITOR); m_context.add(BINEditor::Constants::C_BINEDITOR);
m_addressEdit = new QLineEdit; m_addressEdit = new QLineEdit;
QRegExpValidator * const addressValidator QRegExpValidator * const addressValidator
= new QRegExpValidator(QRegExp(QLatin1String("[0-9a-fA-F]{1,16}")), = new QRegExpValidator(QRegExp(QLatin1String("[0-9a-fA-F]{1,16}")),
......
...@@ -9,8 +9,6 @@ QtcPlugin { ...@@ -9,8 +9,6 @@ QtcPlugin {
Depends { name: "Core" } Depends { name: "Core" }
Depends { name: "ProjectExplorer" } Depends { name: "ProjectExplorer" }
Depends { name: "TextEditor" } Depends { name: "TextEditor" }
Depends { name: "Find" }
Depends { name: "Locator" }
files: [ files: [
"bookmark.cpp", "bookmark.cpp",
......
...@@ -68,7 +68,7 @@ void ClangSymbolSearcher::search(const QLinkedList<Symbol> &allSymbols) ...@@ -68,7 +68,7 @@ void ClangSymbolSearcher::search(const QLinkedList<Symbol> &allSymbols)
? Qt::CaseSensitive : Qt::CaseInsensitive)); ? Qt::CaseSensitive : Qt::CaseInsensitive));
const int chunkSize = 10; const int chunkSize = 10;
QVector<Find::SearchResultItem> resultItems; QVector<Core::SearchResultItem> resultItems;
resultItems.reserve(100); resultItems.reserve(100);
m_future->setProgressRange(0, allSymbols.size() % chunkSize); m_future->setProgressRange(0, allSymbols.size() % chunkSize);
...@@ -138,7 +138,7 @@ void ClangSymbolSearcher::search(const QLinkedList<Symbol> &allSymbols) ...@@ -138,7 +138,7 @@ void ClangSymbolSearcher::search(const QLinkedList<Symbol> &allSymbols)
info.line = s.m_location.line(); info.line = s.m_location.line();
info.column = s.m_location.column() - 1; info.column = s.m_location.column() - 1;
Find::SearchResultItem item; Core::SearchResultItem item;
item.path << s.m_qualification; item.path << s.m_qualification;
item.text = s.m_name; item.text = s.m_name;
item.icon = info.icon; item.icon = info.icon;
......
...@@ -47,7 +47,7 @@ class ClangSymbolSearcher: public CppTools::SymbolSearcher ...@@ -47,7 +47,7 @@ class ClangSymbolSearcher: public CppTools::SymbolSearcher
Q_OBJECT Q_OBJECT
typedef CppTools::SymbolSearcher::Parameters Parameters; typedef CppTools::SymbolSearcher::Parameters Parameters;
typedef Find::SearchResultItem SearchResultItem; typedef Core::SearchResultItem SearchResultItem;
public: public:
ClangSymbolSearcher(ClangIndexer *indexer, const Parameters &parameters, QSet<QString> fileNames, QObject *parent = 0); ClangSymbolSearcher(ClangIndexer *indexer, const Parameters &parameters, QSet<QString> fileNames, QObject *parent = 0);
......
...@@ -12,9 +12,7 @@ QtcPlugin { ...@@ -12,9 +12,7 @@ QtcPlugin {
Depends { name: "Core" } Depends { name: "Core" }
Depends { name: "TextEditor" } Depends { name: "TextEditor" }
Depends { name: "ProjectExplorer" } Depends { name: "ProjectExplorer" }
Depends { name: "Find" }
Depends { name: "VcsBase" } Depends { name: "VcsBase" }
Depends { name: "Locator" }
files: [ files: [
"activityselector.cpp", "activityselector.cpp",
......
...@@ -2,7 +2,6 @@ QTC_PLUGIN_NAME = ClearCase ...@@ -2,7 +2,6 @@ QTC_PLUGIN_NAME = ClearCase
QTC_LIB_DEPENDS += \ QTC_LIB_DEPENDS += \
utils utils
QTC_PLUGIN_DEPENDS += \ QTC_PLUGIN_DEPENDS += \
locator \
projectexplorer \ projectexplorer \
texteditor \ texteditor \
coreplugin \ coreplugin \
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
#include <coreplugin/messagemanager.h> #include <coreplugin/messagemanager.h>
#include <coreplugin/mimedatabase.h> #include <coreplugin/mimedatabase.h>
#include <coreplugin/progressmanager/progressmanager.h> #include <coreplugin/progressmanager/progressmanager.h>
#include <locator/commandlocator.h> #include <coreplugin/locator/commandlocator.h>
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <projectexplorer/iprojectmanager.h> #include <projectexplorer/iprojectmanager.h>
...@@ -471,7 +471,7 @@ bool ClearCasePlugin::initialize(const QStringList & /*arguments */, QString *er ...@@ -471,7 +471,7 @@ bool ClearCasePlugin::initialize(const QStringList & /*arguments */, QString *er
const QString description = QLatin1String("ClearCase"); const QString description = QLatin1String("ClearCase");
const QString prefix = QLatin1String("cc"); const QString prefix = QLatin1String("cc");
// register cc prefix in Locator // register cc prefix in Locator
m_commandLocator = new Locator::CommandLocator("cc", description, prefix); m_commandLocator = new Core::CommandLocator("cc", description, prefix);
addAutoReleasedObject(m_commandLocator); addAutoReleasedObject(m_commandLocator);
//register actions //register actions
......
...@@ -54,13 +54,13 @@ class QTextCodec; ...@@ -54,13 +54,13 @@ class QTextCodec;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace Core { namespace Core {
class CommandLocator;
class IVersionControl; class IVersionControl;
class IEditor; class IEditor;
} // namespace Core } // namespace Core
namespace Utils { class ParameterAction; } namespace Utils { class ParameterAction; }
namespace VcsBase { class VcsBaseSubmitEditor; } namespace VcsBase { class VcsBaseSubmitEditor; }
namespace Locator { class CommandLocator; }
namespace ProjectExplorer { class Project; } namespace ProjectExplorer { class Project; }
namespace ClearCase { namespace ClearCase {
...@@ -277,7 +277,7 @@ private: ...@@ -277,7 +277,7 @@ private:
QString m_activity; QString m_activity;
QString m_diffPrefix; QString m_diffPrefix;
Locator::CommandLocator *m_commandLocator; Core::CommandLocator *m_commandLocator;
Utils::ParameterAction *m_checkOutAction; Utils::ParameterAction *m_checkOutAction;
Utils::ParameterAction *m_checkInCurrentAction; Utils::ParameterAction *m_checkInCurrentAction;
Utils::ParameterAction *m_undoCheckOutAction; Utils::ParameterAction *m_undoCheckOutAction;
......
...@@ -64,17 +64,17 @@ CMakeLocatorFilter::~CMakeLocatorFilter() ...@@ -64,17 +64,17 @@ CMakeLocatorFilter::~CMakeLocatorFilter()
} }
QList<Locator::FilterEntry> CMakeLocatorFilter::matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry) QList<Core::LocatorFilterEntry> CMakeLocatorFilter::matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future, const QString &entry)
{ {
Q_UNUSED(future) Q_UNUSED(future)