aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Ziller <git@eikeziller.de>2017-04-23 08:39:41 +0200
committerEike Ziller <git@eikeziller.de>2017-10-01 20:11:08 +0200
commit7f7a95d2352a0cf913f0f12fe188e03b256a7b51 (patch)
tree85b1dcd83909b3fd914e8d20053ef21a83bb90ac
parent3fbbbd1e83b44e1a49a66245cd451b32a591b463 (diff)
Register a haskell editor factory
-rw-r--r--plugins/haskell/haskell.pro9
-rw-r--r--plugins/haskell/haskelleditorfactory.cpp49
-rw-r--r--plugins/haskell/haskelleditorfactory.h40
-rw-r--r--plugins/haskell/haskellplugin.cpp3
4 files changed, 98 insertions, 3 deletions
diff --git a/plugins/haskell/haskell.pro b/plugins/haskell/haskell.pro
index 1201d4e..f6aabb2 100644
--- a/plugins/haskell/haskell.pro
+++ b/plugins/haskell/haskell.pro
@@ -2,11 +2,13 @@ DEFINES += HASKELL_LIBRARY
# Haskell files
-SOURCES += haskellplugin.cpp
+SOURCES += haskellplugin.cpp \
+ haskelleditorfactory.cpp
HEADERS += haskellplugin.h \
haskell_global.h \
- haskellconstants.h
+ haskellconstants.h \
+ haskelleditorfactory.h
## uncomment to build plugin into user config directory
## <localappdata>/plugins/<ideversion>
@@ -25,7 +27,8 @@ QTC_LIB_DEPENDS += \
# nothing here at this time
QTC_PLUGIN_DEPENDS += \
- coreplugin
+ coreplugin \
+ texteditor
QTC_PLUGIN_RECOMMENDS += \
# optional plugin dependencies. nothing here at this time
diff --git a/plugins/haskell/haskelleditorfactory.cpp b/plugins/haskell/haskelleditorfactory.cpp
new file mode 100644
index 0000000..7d44cf5
--- /dev/null
+++ b/plugins/haskell/haskelleditorfactory.cpp
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** 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 The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "haskelleditorfactory.h"
+
+#include <texteditor/textdocument.h>
+
+#include <QCoreApplication>
+
+const char C_HASKELLEDITOR_ID[] = "Haskell.HaskellEditor";
+
+namespace Haskell {
+namespace Internal {
+
+HaskellEditorFactory::HaskellEditorFactory()
+{
+ setId(C_HASKELLEDITOR_ID);
+ setDisplayName(QCoreApplication::translate("OpenWith::Editors", "Haskell Editor"));
+ addMimeType("text/x-haskell");
+
+ setDocumentCreator([] { return new TextEditor::TextDocument(C_HASKELLEDITOR_ID); });
+ setParenthesesMatchingEnabled(true);
+ setMarksVisible(true);
+}
+
+} // Internal
+} // Haskell
diff --git a/plugins/haskell/haskelleditorfactory.h b/plugins/haskell/haskelleditorfactory.h
new file mode 100644
index 0000000..a48632d
--- /dev/null
+++ b/plugins/haskell/haskelleditorfactory.h
@@ -0,0 +1,40 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** 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 The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include <texteditor/texteditor.h>
+
+namespace Haskell {
+namespace Internal {
+
+class HaskellEditorFactory : public TextEditor::TextEditorFactory
+{
+public:
+ HaskellEditorFactory();
+};
+
+} // Internal
+} // Haskell
diff --git a/plugins/haskell/haskellplugin.cpp b/plugins/haskell/haskellplugin.cpp
index 1e0c4ab..8df9961 100644
--- a/plugins/haskell/haskellplugin.cpp
+++ b/plugins/haskell/haskellplugin.cpp
@@ -25,6 +25,7 @@
#include "haskellplugin.h"
#include "haskellconstants.h"
+#include "haskelleditorfactory.h"
namespace Haskell {
namespace Internal {
@@ -52,6 +53,8 @@ bool HaskellPlugin::initialize(const QStringList &arguments, QString *errorStrin
Q_UNUSED(arguments)
Q_UNUSED(errorString)
+ addAutoReleasedObject(new HaskellEditorFactory);
+
return true;
}