forked from qt-creator/qt-creator
TextEditor: Simplify setup of line number filter
Change-Id: Ida977fc959f3fe6052151ba8e2461a64699d0a41 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -108,7 +108,7 @@ add_qtc_plugin(TextEditor
|
|||||||
texteditoractionhandler.cpp texteditoractionhandler.h
|
texteditoractionhandler.cpp texteditoractionhandler.h
|
||||||
texteditorconstants.cpp texteditorconstants.h
|
texteditorconstants.cpp texteditorconstants.h
|
||||||
texteditoroverlay.cpp texteditoroverlay.h
|
texteditoroverlay.cpp texteditoroverlay.h
|
||||||
texteditorplugin.cpp texteditorplugin.h
|
texteditorplugin.cpp
|
||||||
texteditorsettings.cpp texteditorsettings.h
|
texteditorsettings.cpp texteditorsettings.h
|
||||||
textindenter.cpp textindenter.h
|
textindenter.cpp textindenter.h
|
||||||
textmark.cpp textmark.h
|
textmark.cpp textmark.h
|
||||||
|
@@ -12,7 +12,10 @@ using namespace Utils;
|
|||||||
|
|
||||||
namespace TextEditor::Internal {
|
namespace TextEditor::Internal {
|
||||||
|
|
||||||
LineNumberFilter::LineNumberFilter()
|
class LineNumberFilter final : public Core::ILocatorFilter
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LineNumberFilter()
|
||||||
{
|
{
|
||||||
setId("Line in current document");
|
setId("Line in current document");
|
||||||
setDisplayName(Tr::tr("Line in Current Document"));
|
setDisplayName(Tr::tr("Line in Current Document"));
|
||||||
@@ -23,7 +26,8 @@ LineNumberFilter::LineNumberFilter()
|
|||||||
setDefaultIncludedByDefault(true);
|
setDefaultIncludedByDefault(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
LocatorMatcherTasks LineNumberFilter::matchers()
|
private:
|
||||||
|
LocatorMatcherTasks matchers() final
|
||||||
{
|
{
|
||||||
using namespace Tasking;
|
using namespace Tasking;
|
||||||
|
|
||||||
@@ -65,5 +69,17 @@ LocatorMatcherTasks LineNumberFilter::matchers()
|
|||||||
};
|
};
|
||||||
return {{Sync(onSetup), storage}};
|
return {{Sync(onSetup), storage}};
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
ILocatorFilter *lineNumberFilter()
|
||||||
|
{
|
||||||
|
static LineNumberFilter theLineNumberFilter;
|
||||||
|
return &theLineNumberFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setupLineNumberFilter()
|
||||||
|
{
|
||||||
|
(void) lineNumberFilter(); // Instantiate it.
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace TextEditor::Internal
|
} // namespace TextEditor::Internal
|
||||||
|
@@ -7,13 +7,8 @@
|
|||||||
|
|
||||||
namespace TextEditor::Internal {
|
namespace TextEditor::Internal {
|
||||||
|
|
||||||
class LineNumberFilter : public Core::ILocatorFilter
|
Core::ILocatorFilter *lineNumberFilter();
|
||||||
{
|
|
||||||
public:
|
|
||||||
LineNumberFilter();
|
|
||||||
|
|
||||||
private:
|
void setupLineNumberFilter();
|
||||||
Core::LocatorMatcherTasks matchers() final;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace TextEditor::Internal
|
} // namespace TextEditor::Internal
|
||||||
|
@@ -7,7 +7,6 @@
|
|||||||
#include "texteditor.h"
|
#include "texteditor.h"
|
||||||
#include "texteditoractionhandler.h"
|
#include "texteditoractionhandler.h"
|
||||||
#include "texteditorconstants.h"
|
#include "texteditorconstants.h"
|
||||||
#include "texteditorplugin.h"
|
|
||||||
#include "texteditorsettings.h"
|
#include "texteditorsettings.h"
|
||||||
#include "textindenter.h"
|
#include "textindenter.h"
|
||||||
|
|
||||||
|
@@ -3,8 +3,6 @@
|
|||||||
|
|
||||||
#include "snippetprovider.h"
|
#include "snippetprovider.h"
|
||||||
|
|
||||||
#include <texteditor/texteditorplugin.h>
|
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
|
|
||||||
using namespace TextEditor;
|
using namespace TextEditor;
|
||||||
|
@@ -145,7 +145,6 @@ QtcPlugin {
|
|||||||
"texteditoroverlay.cpp",
|
"texteditoroverlay.cpp",
|
||||||
"texteditoroverlay.h",
|
"texteditoroverlay.h",
|
||||||
"texteditorplugin.cpp",
|
"texteditorplugin.cpp",
|
||||||
"texteditorplugin.h",
|
|
||||||
"texteditorsettings.cpp",
|
"texteditorsettings.cpp",
|
||||||
"texteditorsettings.h",
|
"texteditorsettings.h",
|
||||||
"textindenter.cpp",
|
"textindenter.cpp",
|
||||||
|
@@ -7,7 +7,6 @@
|
|||||||
#include "displaysettings.h"
|
#include "displaysettings.h"
|
||||||
#include "fontsettings.h"
|
#include "fontsettings.h"
|
||||||
#include "linenumberfilter.h"
|
#include "linenumberfilter.h"
|
||||||
#include "texteditorplugin.h"
|
|
||||||
#include "texteditortr.h"
|
#include "texteditortr.h"
|
||||||
#include "texteditorsettings.h"
|
#include "texteditorsettings.h"
|
||||||
|
|
||||||
|
@@ -1,8 +1,6 @@
|
|||||||
// Copyright (C) 2016 The Qt Company Ltd.
|
// Copyright (C) 2016 The Qt Company Ltd.
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||||
|
|
||||||
#include "texteditorplugin.h"
|
|
||||||
|
|
||||||
#include "bookmarkfilter.h"
|
#include "bookmarkfilter.h"
|
||||||
#include "bookmarkmanager.h"
|
#include "bookmarkmanager.h"
|
||||||
#include "findincurrentfile.h"
|
#include "findincurrentfile.h"
|
||||||
@@ -103,7 +101,6 @@ public:
|
|||||||
FilePath m_marginActionFileName;
|
FilePath m_marginActionFileName;
|
||||||
|
|
||||||
TextEditorSettings settings;
|
TextEditorSettings settings;
|
||||||
LineNumberFilter lineNumberFilter; // Goto line functionality for quick open
|
|
||||||
|
|
||||||
FindInFiles findInFilesFilter;
|
FindInFiles findInFilesFilter;
|
||||||
FindInCurrentFile findInCurrentFileFilter;
|
FindInCurrentFile findInCurrentFileFilter;
|
||||||
@@ -303,6 +300,7 @@ void TextEditorPlugin::initialize()
|
|||||||
|
|
||||||
setupTextMarkRegistry(this);
|
setupTextMarkRegistry(this);
|
||||||
setupOutlineFactory();
|
setupOutlineFactory();
|
||||||
|
setupLineNumberFilter(); // Goto line functionality for quick open
|
||||||
|
|
||||||
d = new TextEditorPluginPrivate;
|
d = new TextEditorPluginPrivate;
|
||||||
|
|
||||||
@@ -449,11 +447,6 @@ void TextEditorPlugin::extensionsInitialized()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
LineNumberFilter *lineNumberFilter()
|
|
||||||
{
|
|
||||||
return &m_instance->d->lineNumberFilter;
|
|
||||||
}
|
|
||||||
|
|
||||||
ExtensionSystem::IPlugin::ShutdownFlag TextEditorPlugin::aboutToShutdown()
|
ExtensionSystem::IPlugin::ShutdownFlag TextEditorPlugin::aboutToShutdown()
|
||||||
{
|
{
|
||||||
HighlighterHelper::handleShutdown();
|
HighlighterHelper::handleShutdown();
|
||||||
|
@@ -1,13 +0,0 @@
|
|||||||
// Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
|
|
||||||
namespace TextEditor::Internal {
|
|
||||||
|
|
||||||
class LineNumberFilter;
|
|
||||||
LineNumberFilter *lineNumberFilter();
|
|
||||||
|
|
||||||
} // TextEditor::Internal
|
|
@@ -6,7 +6,6 @@
|
|||||||
#include "fontsettings.h"
|
#include "fontsettings.h"
|
||||||
#include "textdocument.h"
|
#include "textdocument.h"
|
||||||
#include "texteditor.h"
|
#include "texteditor.h"
|
||||||
#include "texteditorplugin.h"
|
|
||||||
#include "texteditortr.h"
|
#include "texteditortr.h"
|
||||||
|
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
|
Reference in New Issue
Block a user