forked from qt-creator/qt-creator
TextEditor: Simplify HighlighterFactory hierarchy
Change-Id: I555639a9137dcb8ccb471e1615823870c8158b3c Reviewed-by: Daniel Teske <daniel.teske@digia.com> Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -1,45 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "cmakehighlighterfactory.h"
|
||||
#include "cmakeprojectconstants.h"
|
||||
#include "cmakehighlighter.h"
|
||||
|
||||
using namespace CMakeProjectManager::Internal;
|
||||
|
||||
CMakeHighlighterFactory::CMakeHighlighterFactory()
|
||||
{
|
||||
setId(CMakeProjectManager::Constants::CMAKE_EDITOR_ID);
|
||||
addMimeType(CMakeProjectManager::Constants::CMAKEMIMETYPE);
|
||||
}
|
||||
|
||||
TextEditor::SyntaxHighlighter *CMakeHighlighterFactory::createHighlighter() const
|
||||
{
|
||||
return new CMakeHighlighter;
|
||||
}
|
@@ -1,51 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CMAKEHIGHLIGHTERFACTORY_H
|
||||
#define CMAKEHIGHLIGHTERFACTORY_H
|
||||
|
||||
#include <texteditor/ihighlighterfactory.h>
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class CMakeHighlighterFactory : public TextEditor::IHighlighterFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CMakeHighlighterFactory();
|
||||
|
||||
virtual TextEditor::SyntaxHighlighter *createHighlighter() const;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
||||
|
||||
#endif // CMAKEHIGHLIGHTERFACTORY_H
|
@@ -13,7 +13,6 @@ HEADERS = cmakebuildinfo.h \
|
||||
cmakeeditorfactory.h \
|
||||
cmakeeditor.h \
|
||||
cmakehighlighter.h \
|
||||
cmakehighlighterfactory.h \
|
||||
cmakelocatorfilter.h \
|
||||
cmakefilecompletionassist.h \
|
||||
cmaketool.h \
|
||||
@@ -32,7 +31,6 @@ SOURCES = cmakeproject.cpp \
|
||||
cmakeeditorfactory.cpp \
|
||||
cmakeeditor.cpp \
|
||||
cmakehighlighter.cpp \
|
||||
cmakehighlighterfactory.cpp \
|
||||
cmakelocatorfilter.cpp \
|
||||
cmakefilecompletionassist.cpp \
|
||||
cmaketool.cpp \
|
||||
|
@@ -32,8 +32,6 @@ QtcPlugin {
|
||||
"cmakefilecompletionassist.h",
|
||||
"cmakehighlighter.cpp",
|
||||
"cmakehighlighter.h",
|
||||
"cmakehighlighterfactory.cpp",
|
||||
"cmakehighlighterfactory.h",
|
||||
"cmakelocatorfilter.cpp",
|
||||
"cmakelocatorfilter.h",
|
||||
"cmakeopenprojectwizard.cpp",
|
||||
|
@@ -36,11 +36,12 @@
|
||||
#include "cmakeprojectconstants.h"
|
||||
#include "cmakelocatorfilter.h"
|
||||
#include "cmakefilecompletionassist.h"
|
||||
#include "cmakehighlighterfactory.h"
|
||||
#include "cmakehighlighter.h"
|
||||
|
||||
#include <coreplugin/featureprovider.h>
|
||||
#include <coreplugin/mimedatabase.h>
|
||||
#include <texteditor/texteditoractionhandler.h>
|
||||
#include <texteditor/highlighterfactory.h>
|
||||
|
||||
#include <QtPlugin>
|
||||
#include <QDebug>
|
||||
@@ -82,7 +83,13 @@ bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString *
|
||||
addAutoReleasedObject(new CMakeLocatorFilter);
|
||||
addAutoReleasedObject(new CMakeFileCompletionAssistProvider(cmp));
|
||||
addAutoReleasedObject(new CMakeFeatureProvider);
|
||||
addAutoReleasedObject(new CMakeHighlighterFactory);
|
||||
|
||||
auto hf = new TextEditor::HighlighterFactory;
|
||||
hf->setProductType<CMakeHighlighter>();
|
||||
hf->setId(CMakeProjectManager::Constants::CMAKE_EDITOR_ID);
|
||||
hf->addMimeType(CMakeProjectManager::Constants::CMAKEMIMETYPE);
|
||||
addAutoReleasedObject(hf);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -19,7 +19,6 @@ HEADERS += \
|
||||
cppfollowsymbolundercursor.h \
|
||||
cppfunctiondecldeflink.h \
|
||||
cpphighlighter.h \
|
||||
cpphighlighterfactory.h \
|
||||
cpphoverhandler.h \
|
||||
cppincludehierarchy.h \
|
||||
cppincludehierarchyitem.h \
|
||||
@@ -52,7 +51,6 @@ SOURCES += \
|
||||
cppfollowsymbolundercursor.cpp \
|
||||
cppfunctiondecldeflink.cpp \
|
||||
cpphighlighter.cpp \
|
||||
cpphighlighterfactory.cpp \
|
||||
cpphoverhandler.cpp \
|
||||
cppincludehierarchy.cpp \
|
||||
cppincludehierarchyitem.cpp \
|
||||
|
@@ -37,7 +37,6 @@ QtcPlugin {
|
||||
"cppfollowsymbolundercursor.cpp", "cppfollowsymbolundercursor.h",
|
||||
"cppfunctiondecldeflink.cpp", "cppfunctiondecldeflink.h",
|
||||
"cpphighlighter.cpp", "cpphighlighter.h",
|
||||
"cpphighlighterfactory.cpp", "cpphighlighterfactory.h",
|
||||
"cpphoverhandler.cpp", "cpphoverhandler.h",
|
||||
"cppincludehierarchy.cpp", "cppincludehierarchy.h",
|
||||
"cppincludehierarchyitem.cpp", "cppincludehierarchyitem.h",
|
||||
|
@@ -35,7 +35,7 @@
|
||||
#include "cppeditor.h"
|
||||
#include "cppeditoroutline.h"
|
||||
#include "cppfilewizard.h"
|
||||
#include "cpphighlighterfactory.h"
|
||||
#include "cpphighlighter.h"
|
||||
#include "cpphoverhandler.h"
|
||||
#include "cppincludehierarchy.h"
|
||||
#include "cppoutline.h"
|
||||
@@ -55,6 +55,7 @@
|
||||
#include <texteditor/texteditoractionhandler.h>
|
||||
#include <texteditor/texteditorconstants.h>
|
||||
#include <texteditor/texteditorsettings.h>
|
||||
#include <texteditor/highlighterfactory.h>
|
||||
|
||||
#include <utils/hostosinfo.h>
|
||||
|
||||
@@ -165,7 +166,15 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
|
||||
addAutoReleasedObject(new CppTypeHierarchyFactory);
|
||||
addAutoReleasedObject(new CppIncludeHierarchyFactory);
|
||||
addAutoReleasedObject(new CppSnippetProvider);
|
||||
addAutoReleasedObject(new CppHighlighterFactory);
|
||||
|
||||
auto hf = new TextEditor::HighlighterFactory;
|
||||
hf->setProductType<CppHighlighter>();
|
||||
hf->setId(CppEditor::Constants::CPPEDITOR_ID);
|
||||
hf->addMimeType(CppEditor::Constants::C_SOURCE_MIMETYPE);
|
||||
hf->addMimeType(CppEditor::Constants::C_HEADER_MIMETYPE);
|
||||
hf->addMimeType(CppEditor::Constants::CPP_SOURCE_MIMETYPE);
|
||||
hf->addMimeType(CppEditor::Constants::CPP_HEADER_MIMETYPE);
|
||||
addAutoReleasedObject(hf);
|
||||
|
||||
m_quickFixProvider = new CppQuickFixAssistProvider;
|
||||
addAutoReleasedObject(m_quickFixProvider);
|
||||
|
@@ -1,48 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "cpphighlighterfactory.h"
|
||||
#include "cppeditorconstants.h"
|
||||
#include "cpphighlighter.h"
|
||||
|
||||
using namespace CppEditor::Internal;
|
||||
|
||||
CppHighlighterFactory::CppHighlighterFactory()
|
||||
{
|
||||
setId(CppEditor::Constants::CPPEDITOR_ID);
|
||||
addMimeType(CppEditor::Constants::C_SOURCE_MIMETYPE);
|
||||
addMimeType(CppEditor::Constants::C_HEADER_MIMETYPE);
|
||||
addMimeType(CppEditor::Constants::CPP_SOURCE_MIMETYPE);
|
||||
addMimeType(CppEditor::Constants::CPP_HEADER_MIMETYPE);
|
||||
}
|
||||
|
||||
TextEditor::SyntaxHighlighter *CppHighlighterFactory::createHighlighter() const
|
||||
{
|
||||
return new CppHighlighter;
|
||||
}
|
@@ -1,51 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CPPHIGHLIGHTERFACTORY_H
|
||||
#define CPPHIGHLIGHTERFACTORY_H
|
||||
|
||||
#include <texteditor/ihighlighterfactory.h>
|
||||
|
||||
namespace CppEditor {
|
||||
namespace Internal {
|
||||
|
||||
class CppHighlighterFactory : public TextEditor::IHighlighterFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CppHighlighterFactory();
|
||||
|
||||
virtual TextEditor::SyntaxHighlighter *createHighlighter() const;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CppEditor
|
||||
|
||||
#endif // CPPHIGHLIGHTERFACTORY_H
|
@@ -46,7 +46,7 @@
|
||||
|
||||
#include <texteditor/basetexteditor.h>
|
||||
#include <texteditor/basetextdocumentlayout.h>
|
||||
#include <texteditor/ihighlighterfactory.h>
|
||||
#include <texteditor/highlighterfactory.h>
|
||||
#include <texteditor/syntaxhighlighter.h>
|
||||
#include <texteditor/basetextdocument.h>
|
||||
#include <texteditor/texteditorsettings.h>
|
||||
@@ -110,7 +110,7 @@ protected:
|
||||
|
||||
private:
|
||||
SideDiffEditorWidget *m_editor;
|
||||
QMap<QString, IHighlighterFactory *> m_mimeTypeToHighlighterFactory;
|
||||
QMap<QString, HighlighterFactory *> m_mimeTypeToHighlighterFactory;
|
||||
QList<SyntaxHighlighter *> m_highlighters;
|
||||
QList<QTextDocument *> m_documents;
|
||||
};
|
||||
@@ -235,9 +235,9 @@ MultiHighlighter::MultiHighlighter(SideDiffEditorWidget *editor, QTextDocument *
|
||||
: SyntaxHighlighter(document),
|
||||
m_editor(editor)
|
||||
{
|
||||
const QList<IHighlighterFactory *> &factories =
|
||||
ExtensionSystem::PluginManager::getObjects<TextEditor::IHighlighterFactory>();
|
||||
foreach (IHighlighterFactory *factory, factories) {
|
||||
const QList<HighlighterFactory *> &factories =
|
||||
ExtensionSystem::PluginManager::getObjects<TextEditor::HighlighterFactory>();
|
||||
foreach (HighlighterFactory *factory, factories) {
|
||||
QStringList mimeTypes = factory->mimeTypes();
|
||||
foreach (const QString &mimeType, mimeTypes)
|
||||
m_mimeTypeToHighlighterFactory.insert(mimeType, factory);
|
||||
@@ -274,7 +274,7 @@ void MultiHighlighter::setDocuments(const QList<QPair<DiffFileInfo, QString> > &
|
||||
QTextDocument *document = new QTextDocument(contents);
|
||||
const MimeType mimeType = MimeDatabase::findByFile(QFileInfo(fileInfo.fileName));
|
||||
SyntaxHighlighter *highlighter = 0;
|
||||
if (const IHighlighterFactory *factory = m_mimeTypeToHighlighterFactory.value(mimeType.type())) {
|
||||
if (const HighlighterFactory *factory = m_mimeTypeToHighlighterFactory.value(mimeType.type())) {
|
||||
highlighter = factory->createHighlighter();
|
||||
if (highlighter)
|
||||
highlighter->setDocument(document);
|
||||
|
@@ -45,7 +45,7 @@
|
||||
|
||||
#include <texteditor/basetexteditor.h>
|
||||
#include <texteditor/basetextdocumentlayout.h>
|
||||
#include <texteditor/ihighlighterfactory.h>
|
||||
#include <texteditor/highlighterfactory.h>
|
||||
#include <texteditor/syntaxhighlighter.h>
|
||||
#include <texteditor/basetextdocument.h>
|
||||
#include <texteditor/texteditorsettings.h>
|
||||
|
@@ -11,7 +11,6 @@ glsleditorfactory.h \
|
||||
glsleditorplugin.h \
|
||||
glslfilewizard.h \
|
||||
glslhighlighter.h \
|
||||
glslhighlighterfactory.h \
|
||||
glslautocompleter.h \
|
||||
glslindenter.h \
|
||||
glslhoverhandler.h \
|
||||
@@ -25,7 +24,6 @@ glsleditorfactory.cpp \
|
||||
glsleditorplugin.cpp \
|
||||
glslfilewizard.cpp \
|
||||
glslhighlighter.cpp \
|
||||
glslhighlighterfactory.cpp \
|
||||
glslautocompleter.cpp \
|
||||
glslindenter.cpp \
|
||||
glslhoverhandler.cpp \
|
||||
|
@@ -34,8 +34,6 @@ QtcPlugin {
|
||||
"glslfilewizard.h",
|
||||
"glslhighlighter.cpp",
|
||||
"glslhighlighter.h",
|
||||
"glslhighlighterfactory.cpp",
|
||||
"glslhighlighterfactory.h",
|
||||
"glslhoverhandler.cpp",
|
||||
"glslhoverhandler.h",
|
||||
"glslindenter.cpp",
|
||||
|
@@ -34,7 +34,7 @@
|
||||
#include "glslfilewizard.h"
|
||||
#include "glslhoverhandler.h"
|
||||
#include "glslcompletionassist.h"
|
||||
#include "glslhighlighterfactory.h"
|
||||
#include "glslhighlighter.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/coreconstants.h>
|
||||
@@ -47,6 +47,7 @@
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <projectexplorer/taskhub.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <texteditor/highlighterfactory.h>
|
||||
#include <texteditor/texteditorconstants.h>
|
||||
#include <texteditor/textfilewizard.h>
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -219,7 +220,15 @@ bool GLSLEditorPlugin::initialize(const QStringList & /*arguments*/, QString *er
|
||||
wizard->setId(QLatin1String("K.GLSL"));
|
||||
addAutoReleasedObject(wizard);
|
||||
|
||||
addAutoReleasedObject(new GLSLHighlighterFactory);
|
||||
auto hf = new TextEditor::HighlighterFactory;
|
||||
hf->setProductType<Highlighter>();
|
||||
hf->setId(GLSLEditor::Constants::C_GLSLEDITOR_ID);
|
||||
hf->addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE);
|
||||
hf->addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE_VERT);
|
||||
hf->addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE_FRAG);
|
||||
hf->addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE_VERT_ES);
|
||||
hf->addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE_FRAG_ES);
|
||||
addAutoReleasedObject(hf);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -1,49 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "glslhighlighterfactory.h"
|
||||
#include "glsleditorconstants.h"
|
||||
#include "glslhighlighter.h"
|
||||
|
||||
using namespace GLSLEditor::Internal;
|
||||
|
||||
GLSLHighlighterFactory::GLSLHighlighterFactory()
|
||||
{
|
||||
setId(GLSLEditor::Constants::C_GLSLEDITOR_ID);
|
||||
addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE);
|
||||
addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE_VERT);
|
||||
addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE_FRAG);
|
||||
addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE_VERT_ES);
|
||||
addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE_FRAG_ES);
|
||||
}
|
||||
|
||||
TextEditor::SyntaxHighlighter *GLSLHighlighterFactory::createHighlighter() const
|
||||
{
|
||||
return new Highlighter;
|
||||
}
|
@@ -1,51 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef GLSLHIGHLIGHTERFACTORY_H
|
||||
#define GLSLHIGHLIGHTERFACTORY_H
|
||||
|
||||
#include <texteditor/ihighlighterfactory.h>
|
||||
|
||||
namespace GLSLEditor {
|
||||
namespace Internal {
|
||||
|
||||
class GLSLHighlighterFactory : public TextEditor::IHighlighterFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GLSLHighlighterFactory();
|
||||
|
||||
virtual TextEditor::SyntaxHighlighter *createHighlighter() const;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace GLSLEditor
|
||||
|
||||
#endif // GLSLHIGHLIGHTERFACTORY_H
|
@@ -18,7 +18,6 @@ HEADERS += \
|
||||
wizard/pythonclasswizarddialog.h \
|
||||
wizard/pythonsourcegenerator.h \
|
||||
tools/pythonhighlighter.h \
|
||||
tools/pythonhighlighterfactory.h \
|
||||
tools/pythonindenter.h \
|
||||
tools/lexical/pythonformattoken.h \
|
||||
tools/lexical/pythonscanner.h \
|
||||
@@ -35,6 +34,5 @@ SOURCES += \
|
||||
wizard/pythonclassnamepage.cpp \
|
||||
wizard/pythonsourcegenerator.cpp \
|
||||
tools/pythonhighlighter.cpp \
|
||||
tools/pythonhighlighterfactory.cpp \
|
||||
tools/pythonindenter.cpp \
|
||||
tools/lexical/pythonscanner.cpp
|
||||
|
@@ -33,7 +33,6 @@ QtcPlugin {
|
||||
"lexical/pythonscanner.h", "lexical/pythonscanner.cpp",
|
||||
"lexical/sourcecodestream.h",
|
||||
"pythonhighlighter.h", "pythonhighlighter.cpp",
|
||||
"pythonhighlighterfactory.h", "pythonhighlighterfactory.cpp",
|
||||
"pythonindenter.cpp", "pythonindenter.h"
|
||||
]
|
||||
}
|
||||
|
@@ -33,7 +33,7 @@
|
||||
#include "wizard/pythonclasswizard.h"
|
||||
#include "pythoneditorwidget.h"
|
||||
#include "pythoneditorfactory.h"
|
||||
#include "tools/pythonhighlighterfactory.h"
|
||||
#include "tools/pythonhighlighter.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/coreconstants.h>
|
||||
@@ -43,6 +43,7 @@
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <texteditor/texteditorconstants.h>
|
||||
#include <texteditor/highlighterfactory.h>
|
||||
|
||||
#include <QtPlugin>
|
||||
#include <QCoreApplication>
|
||||
@@ -229,7 +230,12 @@ bool PythonEditorPlugin::initialize(const QStringList &arguments, QString *error
|
||||
// Add Python files and classes creation dialogs
|
||||
addAutoReleasedObject(new FileWizard);
|
||||
addAutoReleasedObject(new ClassWizard);
|
||||
addAutoReleasedObject(new Internal::PythonHighlighterFactory);
|
||||
|
||||
auto hf = new TextEditor::HighlighterFactory;
|
||||
hf->setId(Constants::C_PYTHONEDITOR_ID);
|
||||
hf->setProductType<PythonHighlighter>();
|
||||
hf->addMimeType(QLatin1String(Constants::C_PY_MIMETYPE));
|
||||
addAutoReleasedObject(hf);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -1,45 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "pythonhighlighterfactory.h"
|
||||
#include "../pythoneditorconstants.h"
|
||||
#include "pythonhighlighter.h"
|
||||
|
||||
using namespace PythonEditor::Internal;
|
||||
|
||||
PythonHighlighterFactory::PythonHighlighterFactory()
|
||||
{
|
||||
setId(Constants::C_PYTHONEDITOR_ID);
|
||||
addMimeType(QLatin1String(Constants::C_PY_MIMETYPE));
|
||||
}
|
||||
|
||||
TextEditor::SyntaxHighlighter *PythonHighlighterFactory::createHighlighter() const
|
||||
{
|
||||
return new PythonHighlighter;
|
||||
}
|
@@ -1,51 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef PYTHONHIGHLIGHTERFACTORY_H
|
||||
#define PYTHONHIGHLIGHTERFACTORY_H
|
||||
|
||||
#include <texteditor/ihighlighterfactory.h>
|
||||
|
||||
namespace PythonEditor {
|
||||
namespace Internal {
|
||||
|
||||
class PythonHighlighterFactory : public TextEditor::IHighlighterFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PythonHighlighterFactory();
|
||||
|
||||
virtual TextEditor::SyntaxHighlighter *createHighlighter() const;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace PythonEditor
|
||||
|
||||
#endif // PYTHONHIGHLIGHTERFACTORY_H
|
@@ -1,47 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "profilehighlighterfactory.h"
|
||||
#include "qmakeprojectmanagerconstants.h"
|
||||
#include "profilehighlighter.h"
|
||||
|
||||
using namespace QmakeProjectManager::Internal;
|
||||
|
||||
ProFileHighlighterFactory::ProFileHighlighterFactory()
|
||||
{
|
||||
setId(QmakeProjectManager::Constants::PROFILE_EDITOR_ID);
|
||||
addMimeType(QmakeProjectManager::Constants::PROFILE_MIMETYPE);
|
||||
addMimeType(QmakeProjectManager::Constants::PROINCLUDEFILE_MIMETYPE);
|
||||
addMimeType(QmakeProjectManager::Constants::PROFEATUREFILE_MIMETYPE);
|
||||
}
|
||||
|
||||
TextEditor::SyntaxHighlighter *ProFileHighlighterFactory::createHighlighter() const
|
||||
{
|
||||
return new ProFileHighlighter;
|
||||
}
|
@@ -1,51 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef PROFILEHIGHLIGHTERFACTORY_H
|
||||
#define PROFILEHIGHLIGHTERFACTORY_H
|
||||
|
||||
#include <texteditor/ihighlighterfactory.h>
|
||||
|
||||
namespace QmakeProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class ProFileHighlighterFactory : public TextEditor::IHighlighterFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ProFileHighlighterFactory();
|
||||
|
||||
virtual TextEditor::SyntaxHighlighter *createHighlighter() const;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmakeProjectManager
|
||||
|
||||
#endif // PROFILEHIGHLIGHTERFACTORY_H
|
@@ -16,7 +16,6 @@ HEADERS += \
|
||||
qmakenodes.h \
|
||||
profileeditor.h \
|
||||
profilehighlighter.h \
|
||||
profilehighlighterfactory.h \
|
||||
profileeditorfactory.h \
|
||||
profilehoverhandler.h \
|
||||
wizards/qtprojectparameters.h \
|
||||
@@ -68,7 +67,6 @@ SOURCES += \
|
||||
qmakenodes.cpp \
|
||||
profileeditor.cpp \
|
||||
profilehighlighter.cpp \
|
||||
profilehighlighterfactory.cpp \
|
||||
profileeditorfactory.cpp \
|
||||
profilehoverhandler.cpp \
|
||||
wizards/qtprojectparameters.cpp \
|
||||
|
@@ -36,7 +36,6 @@ QtcPlugin {
|
||||
"profileeditor.cpp", "profileeditor.h",
|
||||
"profileeditorfactory.cpp", "profileeditorfactory.h",
|
||||
"profilehighlighter.cpp", "profilehighlighter.h",
|
||||
"profilehighlighterfactory.cpp", "profilehighlighterfactory.h",
|
||||
"profilehoverhandler.cpp", "profilehoverhandler.h",
|
||||
"qmakebuildinfo.h",
|
||||
"qmakeparser.cpp", "qmakeparser.h",
|
||||
|
@@ -50,7 +50,7 @@
|
||||
#include "externaleditors.h"
|
||||
#include "profilecompletionassist.h"
|
||||
#include "qmakekitinformation.h"
|
||||
#include "profilehighlighterfactory.h"
|
||||
#include "profilehighlighter.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <projectexplorer/buildmanager.h>
|
||||
@@ -65,6 +65,7 @@
|
||||
#include <coreplugin/editormanager/ieditor.h>
|
||||
#include <texteditor/texteditoractionhandler.h>
|
||||
#include <texteditor/texteditorconstants.h>
|
||||
#include <texteditor/highlighterfactory.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/parameteraction.h>
|
||||
|
||||
@@ -142,7 +143,14 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString
|
||||
|
||||
addAutoReleasedObject(new ProFileCompletionAssistProvider);
|
||||
addAutoReleasedObject(new ProFileHoverHandler(this));
|
||||
addAutoReleasedObject(new ProFileHighlighterFactory);
|
||||
|
||||
auto hf = new TextEditor::HighlighterFactory;
|
||||
hf->setProductType<ProFileHighlighter>();
|
||||
hf->setId(QmakeProjectManager::Constants::PROFILE_EDITOR_ID);
|
||||
hf->addMimeType(QmakeProjectManager::Constants::PROFILE_MIMETYPE);
|
||||
hf->addMimeType(QmakeProjectManager::Constants::PROINCLUDEFILE_MIMETYPE);
|
||||
hf->addMimeType(QmakeProjectManager::Constants::PROFEATUREFILE_MIMETYPE);
|
||||
addAutoReleasedObject(hf);
|
||||
|
||||
//menus
|
||||
Core::ActionContainer *mbuild =
|
||||
|
@@ -13,7 +13,6 @@ HEADERS += \
|
||||
qmlexpressionundercursor.h \
|
||||
qmlfilewizard.h \
|
||||
qmljshighlighter.h \
|
||||
qmljshighlighterfactory.h \
|
||||
qmljshoverhandler.h \
|
||||
qmljspreviewrunner.h \
|
||||
qmljscomponentfromobjectdef.h \
|
||||
@@ -46,7 +45,6 @@ SOURCES += \
|
||||
qmlexpressionundercursor.cpp \
|
||||
qmlfilewizard.cpp \
|
||||
qmljshighlighter.cpp \
|
||||
qmljshighlighterfactory.cpp \
|
||||
qmljshoverhandler.cpp \
|
||||
qmljspreviewrunner.cpp \
|
||||
qmljscomponentfromobjectdef.cpp \
|
||||
|
@@ -51,8 +51,6 @@ QtcPlugin {
|
||||
"qmljsfindreferences.h",
|
||||
"qmljshighlighter.cpp",
|
||||
"qmljshighlighter.h",
|
||||
"qmljshighlighterfactory.cpp",
|
||||
"qmljshighlighterfactory.h",
|
||||
"qmljshoverhandler.cpp",
|
||||
"qmljshoverhandler.h",
|
||||
"qmljsoutline.cpp",
|
||||
|
@@ -44,7 +44,6 @@
|
||||
#include "quicktoolbarsettingspage.h"
|
||||
#include "qmljscompletionassist.h"
|
||||
#include "qmljsquickfixassist.h"
|
||||
#include "qmljshighlighterfactory.h"
|
||||
|
||||
#include <qmljs/qmljsicons.h>
|
||||
#include <qmljs/qmljsmodelmanagerinterface.h>
|
||||
@@ -64,6 +63,7 @@
|
||||
#include <projectexplorer/taskhub.h>
|
||||
#include <texteditor/texteditorconstants.h>
|
||||
#include <texteditor/textfilewizard.h>
|
||||
#include <texteditor/highlighterfactory.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/json.h>
|
||||
|
||||
@@ -114,7 +114,17 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e
|
||||
{
|
||||
m_modelManager = QmlJS::ModelManagerInterface::instance();
|
||||
addAutoReleasedObject(new QmlJSSnippetProvider);
|
||||
addAutoReleasedObject(new QmlJSHighlighterFactory);
|
||||
|
||||
auto hf = new TextEditor::HighlighterFactory;
|
||||
hf->setProductType<Highlighter>();
|
||||
hf->setId(Constants::C_QMLJSEDITOR_ID);
|
||||
hf->addMimeType(QmlJSTools::Constants::QML_MIMETYPE);
|
||||
hf->addMimeType(QmlJSTools::Constants::QMLPROJECT_MIMETYPE);
|
||||
hf->addMimeType(QmlJSTools::Constants::QBS_MIMETYPE);
|
||||
hf->addMimeType(QmlJSTools::Constants::QMLTYPES_MIMETYPE);
|
||||
hf->addMimeType(QmlJSTools::Constants::JS_MIMETYPE);
|
||||
hf->addMimeType(QmlJSTools::Constants::JSON_MIMETYPE);
|
||||
addAutoReleasedObject(hf);
|
||||
|
||||
// QML task updating manager
|
||||
m_qmlTaskManager = new QmlTaskManager;
|
||||
|
@@ -1,51 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qmljshighlighterfactory.h"
|
||||
#include "qmljseditorconstants.h"
|
||||
#include "qmljshighlighter.h"
|
||||
#include <qmljstools/qmljstoolsconstants.h>
|
||||
|
||||
using namespace QmlJSEditor::Internal;
|
||||
|
||||
QmlJSHighlighterFactory::QmlJSHighlighterFactory()
|
||||
{
|
||||
setId(Constants::C_QMLJSEDITOR_ID);
|
||||
addMimeType(QmlJSTools::Constants::QML_MIMETYPE);
|
||||
addMimeType(QmlJSTools::Constants::QMLPROJECT_MIMETYPE);
|
||||
addMimeType(QmlJSTools::Constants::QBS_MIMETYPE);
|
||||
addMimeType(QmlJSTools::Constants::QMLTYPES_MIMETYPE);
|
||||
addMimeType(QmlJSTools::Constants::JS_MIMETYPE);
|
||||
addMimeType(QmlJSTools::Constants::JSON_MIMETYPE);
|
||||
}
|
||||
|
||||
TextEditor::SyntaxHighlighter *QmlJSHighlighterFactory::createHighlighter() const
|
||||
{
|
||||
return new Highlighter;
|
||||
}
|
@@ -1,51 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QMLJSHIGHLIGHTERFACTORY_H
|
||||
#define QMLJSHIGHLIGHTERFACTORY_H
|
||||
|
||||
#include <texteditor/ihighlighterfactory.h>
|
||||
|
||||
namespace QmlJSEditor {
|
||||
namespace Internal {
|
||||
|
||||
class QmlJSHighlighterFactory : public TextEditor::IHighlighterFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QmlJSHighlighterFactory();
|
||||
|
||||
virtual TextEditor::SyntaxHighlighter *createHighlighter() const;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmlJSEditor
|
||||
|
||||
#endif // QMLJSHIGHLIGHTERFACTORY_H
|
@@ -27,8 +27,8 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef IHIGHLIGHTERFACTORY_H
|
||||
#define IHIGHLIGHTERFACTORY_H
|
||||
#ifndef HIGHLIGHTERFACTORY_H
|
||||
#define HIGHLIGHTERFACTORY_H
|
||||
|
||||
#include <texteditor/texteditor_global.h>
|
||||
#include <coreplugin/id.h>
|
||||
@@ -36,20 +36,24 @@
|
||||
#include <QObject>
|
||||
#include <QStringList>
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace TextEditor {
|
||||
|
||||
class SyntaxHighlighter;
|
||||
|
||||
class TEXTEDITOR_EXPORT IHighlighterFactory : public QObject
|
||||
class TEXTEDITOR_EXPORT HighlighterFactory : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
virtual TextEditor::SyntaxHighlighter *createHighlighter() const = 0;
|
||||
|
||||
public:
|
||||
typedef std::function<SyntaxHighlighter *()> Creator;
|
||||
TextEditor::SyntaxHighlighter *createHighlighter() const { return m_creator(); }
|
||||
|
||||
template <class T> void setProductType() { m_creator = []() { return new T; }; }
|
||||
Core::Id id() const { return m_id; }
|
||||
QStringList mimeTypes() const { return m_mimeTypes; }
|
||||
|
||||
protected:
|
||||
void setId(Core::Id id) { m_id = id; }
|
||||
void setMimeTypes(const QStringList &mimeTypes) { m_mimeTypes = mimeTypes; }
|
||||
void addMimeType(const char *mimeType) { m_mimeTypes.append(QLatin1String(mimeType)); }
|
||||
@@ -58,9 +62,10 @@ protected:
|
||||
private:
|
||||
Core::Id m_id;
|
||||
QStringList m_mimeTypes;
|
||||
Creator m_creator;
|
||||
};
|
||||
|
||||
} // TextEditor
|
||||
|
||||
#endif // IHIGHLIGHTERFACTORY_H
|
||||
#endif // HIGHLIGHTERFACTORY_H
|
||||
|
@@ -146,7 +146,7 @@ HEADERS += texteditorplugin.h \
|
||||
normalindenter.h \
|
||||
indenter.h \
|
||||
quickfix.h \
|
||||
ihighlighterfactory.h \
|
||||
highlighterfactory.h \
|
||||
syntaxhighlighter.h \
|
||||
highlighterutils.h \
|
||||
generichighlighter/reuse.h \
|
||||
|
@@ -87,7 +87,7 @@ QtcPlugin {
|
||||
"icodestylepreferences.h",
|
||||
"icodestylepreferencesfactory.cpp",
|
||||
"icodestylepreferencesfactory.h",
|
||||
"ihighlighterfactory.h",
|
||||
"highlighterfactory.h",
|
||||
"indenter.cpp",
|
||||
"indenter.h",
|
||||
"ioutlinewidget.h",
|
||||
|
Reference in New Issue
Block a user