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:
@@ -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
|
||||
Reference in New Issue
Block a user