forked from qt-creator/qt-creator
TextEditor: Hide LineNumberFilter implementation
One of the two non-standard items exposed in the TextEditorPlugin class interface. Change-Id: I89755c6a2b168f31b69d3904d6d043273b462ea6 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -1,19 +1,21 @@
|
|||||||
// 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 "linenumberfilter.h"
|
|
||||||
|
|
||||||
#include "texteditortr.h"
|
#include "texteditortr.h"
|
||||||
|
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
|
#include <coreplugin/locator/ilocatorfilter.h>
|
||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
namespace TextEditor::Internal {
|
namespace TextEditor::Internal {
|
||||||
|
|
||||||
LineNumberFilter::LineNumberFilter()
|
class LineNumberFilter : public 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"));
|
||||||
setDescription(Tr::tr("Jumps to the given line in the current document."));
|
setDescription(Tr::tr("Jumps to the given line in the current document."));
|
||||||
@@ -21,10 +23,11 @@ LineNumberFilter::LineNumberFilter()
|
|||||||
setPriority(High);
|
setPriority(High);
|
||||||
setDefaultShortcutString("l");
|
setDefaultShortcutString("l");
|
||||||
setDefaultIncludedByDefault(true);
|
setDefaultIncludedByDefault(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
LocatorMatcherTasks LineNumberFilter::matchers()
|
private:
|
||||||
{
|
LocatorMatcherTasks matchers() final
|
||||||
|
{
|
||||||
using namespace Tasking;
|
using namespace Tasking;
|
||||||
|
|
||||||
TreeStorage<LocatorStorage> storage;
|
TreeStorage<LocatorStorage> storage;
|
||||||
@@ -64,6 +67,13 @@ LocatorMatcherTasks LineNumberFilter::matchers()
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
return {{Sync(onSetup), storage}};
|
return {{Sync(onSetup), storage}};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
ILocatorFilter *lineNumberFilter()
|
||||||
|
{
|
||||||
|
static LineNumberFilter theLineNumberFilter;
|
||||||
|
return &theLineNumberFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace TextEditor::Internal
|
} // namespace TextEditor::Internal
|
||||||
|
@@ -3,17 +3,10 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <coreplugin/locator/ilocatorfilter.h>
|
namespace Core { class ILocatorFilter; }
|
||||||
|
|
||||||
namespace TextEditor::Internal {
|
namespace TextEditor::Internal {
|
||||||
|
|
||||||
class LineNumberFilter : public Core::ILocatorFilter
|
Core::ILocatorFilter *lineNumberFilter();
|
||||||
{
|
|
||||||
public:
|
|
||||||
LineNumberFilter();
|
|
||||||
|
|
||||||
private:
|
} // TextEditor::Internal
|
||||||
Core::LocatorMatcherTasks matchers() final;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace TextEditor::Internal
|
|
||||||
|
@@ -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"
|
||||||
|
|
||||||
@@ -180,7 +179,7 @@ void TextEditorActionHandlerPrivate::createActions()
|
|||||||
registerAction(SELECTALL,
|
registerAction(SELECTALL,
|
||||||
[] (TextEditorWidget *w) { w->selectAll(); }, true);
|
[] (TextEditorWidget *w) { w->selectAll(); }, true);
|
||||||
registerAction(GOTO, [] (TextEditorWidget *) {
|
registerAction(GOTO, [] (TextEditorWidget *) {
|
||||||
Core::LocatorManager::showFilter(TextEditorPlugin::lineNumberFilter());
|
Core::LocatorManager::showFilter(lineNumberFilter());
|
||||||
});
|
});
|
||||||
m_modifyingActions << registerAction(PRINT,
|
m_modifyingActions << registerAction(PRINT,
|
||||||
[] (TextEditorWidget *widget) { widget->print(Core::ICore::printer()); });
|
[] (TextEditorWidget *widget) { widget->print(Core::ICore::printer()); });
|
||||||
|
@@ -99,7 +99,6 @@ public:
|
|||||||
FilePath m_marginActionFileName;
|
FilePath m_marginActionFileName;
|
||||||
|
|
||||||
TextEditorSettings settings;
|
TextEditorSettings settings;
|
||||||
LineNumberFilter lineNumberFilter; // Goto line functionality for quick open
|
|
||||||
OutlineFactory outlineFactory;
|
OutlineFactory outlineFactory;
|
||||||
|
|
||||||
FindInFiles findInFilesFilter;
|
FindInFiles findInFilesFilter;
|
||||||
@@ -426,11 +425,6 @@ void TextEditorPlugin::extensionsInitialized()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
LineNumberFilter *TextEditorPlugin::lineNumberFilter()
|
|
||||||
{
|
|
||||||
return &m_instance->d->lineNumberFilter;
|
|
||||||
}
|
|
||||||
|
|
||||||
ExtensionSystem::IPlugin::ShutdownFlag TextEditorPlugin::aboutToShutdown()
|
ExtensionSystem::IPlugin::ShutdownFlag TextEditorPlugin::aboutToShutdown()
|
||||||
{
|
{
|
||||||
Highlighter::handleShutdown();
|
Highlighter::handleShutdown();
|
||||||
|
@@ -8,8 +8,6 @@
|
|||||||
namespace TextEditor {
|
namespace TextEditor {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class LineNumberFilter;
|
|
||||||
|
|
||||||
class TextEditorPlugin final : public ExtensionSystem::IPlugin
|
class TextEditorPlugin final : public ExtensionSystem::IPlugin
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -20,7 +18,6 @@ public:
|
|||||||
~TextEditorPlugin() final;
|
~TextEditorPlugin() final;
|
||||||
|
|
||||||
static TextEditorPlugin *instance();
|
static TextEditorPlugin *instance();
|
||||||
static LineNumberFilter *lineNumberFilter();
|
|
||||||
|
|
||||||
ShutdownFlag aboutToShutdown() override;
|
ShutdownFlag aboutToShutdown() override;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user