From f6eeed0372c706483809caed181c5d9e879fad91 Mon Sep 17 00:00:00 2001
From: Roberto Raggi <roberto.raggi@nokia.com>
Date: Wed, 10 Nov 2010 14:01:09 +0100
Subject: [PATCH] Initial import of the GLSL editor plug-in.

---
 src/libs/glsl/glsl.pri                        |   6 +
 .../glsleditor/GLSLEditor.mimetypes.xml       |   9 +
 .../glsleditor/GLSLEditor.pluginspec.in       |  21 ++
 src/plugins/glsleditor/glsleditor.cpp         | 248 ++++++++++++++++++
 src/plugins/glsleditor/glsleditor.h           |  89 +++++++
 src/plugins/glsleditor/glsleditor.pri         |   3 +
 src/plugins/glsleditor/glsleditor.pro         |  26 ++
 src/plugins/glsleditor/glsleditor.qrc         |   6 +
 .../glsleditor/glsleditor_dependencies.pri    |   5 +
 src/plugins/glsleditor/glsleditor_global.h    |  41 +++
 .../glsleditor/glsleditoractionhandler.cpp    |  57 ++++
 .../glsleditor/glsleditoractionhandler.h      |  51 ++++
 src/plugins/glsleditor/glsleditorconstants.h  |  58 ++++
 src/plugins/glsleditor/glsleditoreditable.cpp |  59 +++++
 src/plugins/glsleditor/glsleditoreditable.h   |  62 +++++
 src/plugins/glsleditor/glsleditorfactory.cpp  | 100 +++++++
 src/plugins/glsleditor/glsleditorfactory.h    |  71 +++++
 src/plugins/glsleditor/glsleditorplugin.cpp   | 193 ++++++++++++++
 src/plugins/glsleditor/glsleditorplugin.h     | 101 +++++++
 src/plugins/glsleditor/images/glslfile.png    | Bin 0 -> 385 bytes
 src/plugins/plugins.pro                       |   6 +
 21 files changed, 1212 insertions(+)
 create mode 100644 src/libs/glsl/glsl.pri
 create mode 100644 src/plugins/glsleditor/GLSLEditor.mimetypes.xml
 create mode 100644 src/plugins/glsleditor/GLSLEditor.pluginspec.in
 create mode 100644 src/plugins/glsleditor/glsleditor.cpp
 create mode 100644 src/plugins/glsleditor/glsleditor.h
 create mode 100644 src/plugins/glsleditor/glsleditor.pri
 create mode 100644 src/plugins/glsleditor/glsleditor.pro
 create mode 100644 src/plugins/glsleditor/glsleditor.qrc
 create mode 100644 src/plugins/glsleditor/glsleditor_dependencies.pri
 create mode 100644 src/plugins/glsleditor/glsleditor_global.h
 create mode 100644 src/plugins/glsleditor/glsleditoractionhandler.cpp
 create mode 100644 src/plugins/glsleditor/glsleditoractionhandler.h
 create mode 100644 src/plugins/glsleditor/glsleditorconstants.h
 create mode 100644 src/plugins/glsleditor/glsleditoreditable.cpp
 create mode 100644 src/plugins/glsleditor/glsleditoreditable.h
 create mode 100644 src/plugins/glsleditor/glsleditorfactory.cpp
 create mode 100644 src/plugins/glsleditor/glsleditorfactory.h
 create mode 100644 src/plugins/glsleditor/glsleditorplugin.cpp
 create mode 100644 src/plugins/glsleditor/glsleditorplugin.h
 create mode 100644 src/plugins/glsleditor/images/glslfile.png

diff --git a/src/libs/glsl/glsl.pri b/src/libs/glsl/glsl.pri
new file mode 100644
index 00000000000..112d313ae68
--- /dev/null
+++ b/src/libs/glsl/glsl.pri
@@ -0,0 +1,6 @@
+INCLUDEPATH += $$PWD/../../shared
+INCLUDEPATH += $$PWD/../../shared/glsl $$PWD/../../shared/glsl/parser
+
+DEPENDPATH += $$PWD/../../shared/glsl $$PWD/../../shared/glsl/parser
+LIBS *= -l$$qtLibraryName(GLSL)
+DEFINES += QT_CREATOR
diff --git a/src/plugins/glsleditor/GLSLEditor.mimetypes.xml b/src/plugins/glsleditor/GLSLEditor.mimetypes.xml
new file mode 100644
index 00000000000..377ffa5af07
--- /dev/null
+++ b/src/plugins/glsleditor/GLSLEditor.mimetypes.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
+    <mime-type type="application/x-glsl">
+        <alias type="text/x-glsl"/>
+        <sub-class-of type="text/plain"/>
+        <comment>GLSL file</comment>
+        <glob pattern="*.glsl"/>
+    </mime-type>
+</mime-info>
diff --git a/src/plugins/glsleditor/GLSLEditor.pluginspec.in b/src/plugins/glsleditor/GLSLEditor.pluginspec.in
new file mode 100644
index 00000000000..f6435dd4833
--- /dev/null
+++ b/src/plugins/glsleditor/GLSLEditor.pluginspec.in
@@ -0,0 +1,21 @@
+<plugin name=\"GLSLditor\" version=\"$$QTCREATOR_VERSION\" compatVersion=\"$$QTCREATOR_VERSION\">
+    <vendor>Nokia Corporation</vendor>
+    <copyright>(C) 2010 Nokia Corporation</copyright>
+    <license>
+Commercial Usage
+
+Licensees holding valid Qt Commercial licenses may use this plugin in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia.
+
+GNU Lesser General Public License Usage
+
+Alternatively, this plugin may be used under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation.  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.
+    </license>
+    <category>GLSL</category>
+    <description>Editor for GLSL.</description>
+    <url>http://qt.nokia.com</url>
+    <dependencyList>
+        <dependency name=\"Core\" version=\"$$QTCREATOR_VERSION\"/>
+        <dependency name=\"TextEditor\" version=\"$$QTCREATOR_VERSION\"/>
+        <dependency name=\"ProjectExplorer\" version=\"$$QTCREATOR_VERSION\"/>
+    </dependencyList>
+</plugin>
diff --git a/src/plugins/glsleditor/glsleditor.cpp b/src/plugins/glsleditor/glsleditor.cpp
new file mode 100644
index 00000000000..4cee79db69f
--- /dev/null
+++ b/src/plugins/glsleditor/glsleditor.cpp
@@ -0,0 +1,248 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#include "glsleditor.h"
+#include "glsleditoreditable.h"
+#include "glsleditorconstants.h"
+#include "glsleditorplugin.h"
+
+#include <coreplugin/actionmanager/actionmanager.h>
+#include <coreplugin/actionmanager/actioncontainer.h>
+#include <coreplugin/uniqueidmanager.h>
+#include <coreplugin/actionmanager/command.h>
+#include <coreplugin/editormanager/editormanager.h>
+#include <coreplugin/icore.h>
+#include <coreplugin/mimedatabase.h>
+#include <extensionsystem/pluginmanager.h>
+#include <texteditor/basetextdocument.h>
+#include <texteditor/fontsettings.h>
+#include <texteditor/tabsettings.h>
+#include <texteditor/texteditorconstants.h>
+#include <texteditor/texteditorsettings.h>
+#include <texteditor/syntaxhighlighter.h>
+#include <texteditor/refactoroverlay.h>
+#include <texteditor/tooltip/tooltip.h>
+#include <qmldesigner/qmldesignerconstants.h>
+#include <utils/changeset.h>
+#include <utils/uncommentselection.h>
+
+#include <QtCore/QFileInfo>
+#include <QtCore/QSignalMapper>
+#include <QtCore/QTimer>
+
+#include <QtGui/QMenu>
+#include <QtGui/QComboBox>
+#include <QtGui/QHeaderView>
+#include <QtGui/QInputDialog>
+#include <QtGui/QMainWindow>
+#include <QtGui/QToolBar>
+#include <QtGui/QTreeView>
+
+using namespace GLSL;
+using namespace GLSLEditor;
+using namespace GLSLEditor::Internal;
+
+enum {
+    UPDATE_DOCUMENT_DEFAULT_INTERVAL = 150
+};
+
+GLSLTextEditor::GLSLTextEditor(QWidget *parent) :
+    TextEditor::BaseTextEditor(parent),
+    m_outlineCombo(0)
+{
+    setParenthesesMatchingEnabled(true);
+    setMarksVisible(true);
+    setCodeFoldingSupported(true);
+    setCodeFoldingVisible(true);
+    //setIndenter(new Indenter);
+
+    m_updateDocumentTimer = new QTimer(this);
+    m_updateDocumentTimer->setInterval(UPDATE_DOCUMENT_DEFAULT_INTERVAL);
+    m_updateDocumentTimer->setSingleShot(true);
+    connect(m_updateDocumentTimer, SIGNAL(timeout()), this, SLOT(updateDocumentNow()));
+
+    connect(this, SIGNAL(textChanged()), this, SLOT(updateDocument()));
+
+//    baseTextDocument()->setSyntaxHighlighter(new Highlighter(document()));
+
+//    if (m_modelManager) {
+//        m_semanticHighlighter->setModelManager(m_modelManager);
+//        connect(m_modelManager, SIGNAL(documentUpdated(GLSL::Document::Ptr)),
+//                this, SLOT(onDocumentUpdated(GLSL::Document::Ptr)));
+//        connect(m_modelManager, SIGNAL(libraryInfoUpdated(QString,GLSL::LibraryInfo)),
+//                this, SLOT(forceSemanticRehighlight()));
+//        connect(this->document(), SIGNAL(modificationChanged(bool)), this, SLOT(modificationChanged(bool)));
+//    }
+}
+
+GLSLTextEditor::~GLSLTextEditor()
+{
+}
+
+int GLSLTextEditor::editorRevision() const
+{
+    //return document()->revision();
+    return 0;
+}
+
+bool GLSLTextEditor::isOutdated() const
+{
+//    if (m_semanticInfo.revision() != editorRevision())
+//        return true;
+
+    return false;
+}
+
+Core::IEditor *GLSLEditorEditable::duplicate(QWidget *parent)
+{
+    GLSLTextEditor *newEditor = new GLSLTextEditor(parent);
+    newEditor->duplicateFrom(editor());
+    GLSLEditorPlugin::instance()->initializeEditor(newEditor);
+    return newEditor->editableInterface();
+}
+
+QString GLSLEditorEditable::id() const
+{
+    return QLatin1String(GLSLEditor::Constants::C_GLSLEDITOR_ID);
+}
+
+bool GLSLEditorEditable::open(const QString &fileName)
+{
+    bool b = TextEditor::BaseTextEditorEditable::open(fileName);
+    editor()->setMimeType(Core::ICore::instance()->mimeDatabase()->findByFile(QFileInfo(fileName)).type());
+    return b;
+}
+
+Core::Context GLSLEditorEditable::context() const
+{
+    return m_context;
+}
+
+void GLSLTextEditor::setFontSettings(const TextEditor::FontSettings &fs)
+{
+    TextEditor::BaseTextEditor::setFontSettings(fs);
+#warning set up the GLSL highlighter
+#if 0
+    Highlighter *highlighter = qobject_cast<Highlighter*>(baseTextDocument()->syntaxHighlighter());
+    if (!highlighter)
+        return;
+
+    /*
+        NumberFormat,
+        StringFormat,
+        TypeFormat,
+        KeywordFormat,
+        LabelFormat,
+        CommentFormat,
+        VisualWhitespace,
+     */
+    static QVector<QString> categories;
+    if (categories.isEmpty()) {
+        categories << QLatin1String(TextEditor::Constants::C_NUMBER)
+                   << QLatin1String(TextEditor::Constants::C_STRING)
+                   << QLatin1String(TextEditor::Constants::C_TYPE)
+                   << QLatin1String(TextEditor::Constants::C_KEYWORD)
+                   << QLatin1String(TextEditor::Constants::C_FIELD)
+                   << QLatin1String(TextEditor::Constants::C_COMMENT)
+                   << QLatin1String(TextEditor::Constants::C_VISUAL_WHITESPACE);
+    }
+
+    highlighter->setFormats(fs.toTextCharFormats(categories));
+    highlighter->rehighlight();
+#endif
+}
+
+QString GLSLTextEditor::wordUnderCursor() const
+{
+    QTextCursor tc = textCursor();
+    const QChar ch = characterAt(tc.position() - 1);
+    // make sure that we're not at the start of the next word.
+    if (ch.isLetterOrNumber() || ch == QLatin1Char('_'))
+        tc.movePosition(QTextCursor::Left);
+    tc.movePosition(QTextCursor::StartOfWord);
+    tc.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor);
+    const QString word = tc.selectedText();
+    return word;
+}
+
+TextEditor::BaseTextEditorEditable *GLSLTextEditor::createEditableInterface()
+{
+    GLSLEditorEditable *editable = new GLSLEditorEditable(this);
+    createToolBar(editable);
+    return editable;
+}
+
+void GLSLTextEditor::createToolBar(GLSLEditorEditable *editable)
+{
+    m_outlineCombo = new QComboBox;
+    m_outlineCombo->setMinimumContentsLength(22);
+#warning set up the outline model
+    // m_outlineCombo->setModel(m_outlineModel);
+
+    QTreeView *treeView = new QTreeView;
+    treeView->header()->hide();
+    treeView->setItemsExpandable(false);
+    treeView->setRootIsDecorated(false);
+    m_outlineCombo->setView(treeView);
+    treeView->expandAll();
+
+    //m_outlineCombo->setSizeAdjustPolicy(QComboBox::AdjustToContents);
+
+    // Make the combo box prefer to expand
+    QSizePolicy policy = m_outlineCombo->sizePolicy();
+    policy.setHorizontalPolicy(QSizePolicy::Expanding);
+    m_outlineCombo->setSizePolicy(policy);
+
+    connect(m_outlineCombo, SIGNAL(activated(int)), this, SLOT(jumpToOutlineElement(int)));
+
+    connect(file(), SIGNAL(changed()), this, SLOT(updateFileName()));
+
+    QToolBar *toolBar = static_cast<QToolBar*>(editable->toolBar());
+
+    QList<QAction*> actions = toolBar->actions();
+    toolBar->insertWidget(actions.first(), m_outlineCombo);
+}
+
+bool GLSLTextEditor::event(QEvent *e)
+{
+    return BaseTextEditor::event(e);
+}
+
+void GLSLTextEditor::unCommentSelection()
+{
+    Utils::unCommentSelection(this);
+}
+
+void GLSLTextEditor::updateDocument()
+{
+}
+
+void GLSLTextEditor::updateDocumentNow()
+{
+}
diff --git a/src/plugins/glsleditor/glsleditor.h b/src/plugins/glsleditor/glsleditor.h
new file mode 100644
index 00000000000..67da79a168e
--- /dev/null
+++ b/src/plugins/glsleditor/glsleditor.h
@@ -0,0 +1,89 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#ifndef GLSLEDITOR_H
+#define GLSLEDITOR_H
+
+#include "glsleditor_global.h"
+#include "glsleditoreditable.h"
+
+#include <texteditor/basetexteditor.h>
+#include <texteditor/quickfix.h>
+
+#include <QtCore/QSharedPointer>
+
+QT_BEGIN_NAMESPACE
+class QComboBox;
+class QTimer;
+QT_END_NAMESPACE
+
+namespace Core {
+class ICore;
+}
+
+namespace GLSLEditor {
+
+class GLSLEDITOR_EXPORT GLSLTextEditor : public TextEditor::BaseTextEditor
+{
+    Q_OBJECT
+
+public:
+    GLSLTextEditor(QWidget *parent = 0);
+    ~GLSLTextEditor();
+
+    virtual void unCommentSelection();
+
+    int editorRevision() const;
+    bool isOutdated() const;
+
+public slots:
+    virtual void setFontSettings(const TextEditor::FontSettings &);
+
+private slots:
+    void updateDocument();
+    void updateDocumentNow();
+
+protected:
+    bool event(QEvent *e);
+    TextEditor::BaseTextEditorEditable *createEditableInterface();
+    void createToolBar(Internal::GLSLEditorEditable *editable);
+
+private:
+    void setSelectedElements();
+    QString wordUnderCursor() const;
+
+    const Core::Context m_context;
+
+    QTimer *m_updateDocumentTimer;
+    QComboBox *m_outlineCombo;
+};
+
+} // namespace GLSLEditor
+
+#endif // GLSLEDITOR_H
diff --git a/src/plugins/glsleditor/glsleditor.pri b/src/plugins/glsleditor/glsleditor.pri
new file mode 100644
index 00000000000..aac9022e3e5
--- /dev/null
+++ b/src/plugins/glsleditor/glsleditor.pri
@@ -0,0 +1,3 @@
+include(qmljseditor_dependencies.pri)
+
+LIBS *= -l$$qtLibraryName(QmlJSEditor)
diff --git a/src/plugins/glsleditor/glsleditor.pro b/src/plugins/glsleditor/glsleditor.pro
new file mode 100644
index 00000000000..ccb1786d969
--- /dev/null
+++ b/src/plugins/glsleditor/glsleditor.pro
@@ -0,0 +1,26 @@
+TEMPLATE = lib
+TARGET = GLSLEditor
+include(../../qtcreatorplugin.pri)
+include(glsleditor_dependencies.pri)
+
+DEFINES += \
+    GLSLEDITOR_LIBRARY \
+    QT_CREATOR
+
+HEADERS += \
+glsleditor.h \
+glsleditor_global.h \
+glsleditoractionhandler.h \
+glsleditorconstants.h \
+glsleditoreditable.h \
+glsleditorfactory.h \
+glsleditorplugin.h
+
+SOURCES += \
+glsleditor.cpp \
+glsleditoractionhandler.cpp \
+glsleditoreditable.cpp \
+glsleditorfactory.cpp \
+glsleditorplugin.cpp
+
+OTHER_FILES += GLSLEditor.mimetypes.xml
diff --git a/src/plugins/glsleditor/glsleditor.qrc b/src/plugins/glsleditor/glsleditor.qrc
new file mode 100644
index 00000000000..cb1c737c9a1
--- /dev/null
+++ b/src/plugins/glsleditor/glsleditor.qrc
@@ -0,0 +1,6 @@
+<RCC>
+    <qresource prefix="/glsleditor">
+        <file>GLSLEditor.mimetypes.xml</file>
+        <file>images/glslfile.png</file>
+    </qresource>
+</RCC>
diff --git a/src/plugins/glsleditor/glsleditor_dependencies.pri b/src/plugins/glsleditor/glsleditor_dependencies.pri
new file mode 100644
index 00000000000..dd92bec33cf
--- /dev/null
+++ b/src/plugins/glsleditor/glsleditor_dependencies.pri
@@ -0,0 +1,5 @@
+include(../../plugins/coreplugin/coreplugin.pri)
+include(../../plugins/texteditor/texteditor.pri)
+include(../../plugins/projectexplorer/projectexplorer.pri)
+include(../../libs/glsl/glsl.pri)
+include(../../libs/utils/utils.pri)
diff --git a/src/plugins/glsleditor/glsleditor_global.h b/src/plugins/glsleditor/glsleditor_global.h
new file mode 100644
index 00000000000..bd3f06177ca
--- /dev/null
+++ b/src/plugins/glsleditor/glsleditor_global.h
@@ -0,0 +1,41 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#ifndef GLSLEDITOR_GLOBAL_H
+#define GLSLEDITOR_GLOBAL_H
+
+#include <QtGlobal>
+
+#if defined(GLSLEDITOR_LIBRARY)
+#  define GLSLEDITOR_EXPORT Q_DECL_EXPORT
+#else
+#  define GLSLEDITOR_EXPORT Q_DECL_IMPORT
+#endif
+
+#endif // GLSLEDITOR_GLOBAL_H
diff --git a/src/plugins/glsleditor/glsleditoractionhandler.cpp b/src/plugins/glsleditor/glsleditoractionhandler.cpp
new file mode 100644
index 00000000000..61d524eb1b7
--- /dev/null
+++ b/src/plugins/glsleditor/glsleditoractionhandler.cpp
@@ -0,0 +1,57 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#include "glsleditoractionhandler.h"
+#include "glsleditorconstants.h"
+#include "glsleditor.h"
+
+#include <coreplugin/icore.h>
+#include <coreplugin/actionmanager/actionmanager.h>
+
+#include <QtCore/QDebug>
+#include <QtGui/QAction>
+#include <QtGui/QMainWindow>
+#include <QtGui/QMessageBox>
+
+namespace GLSLEditor {
+namespace Internal {
+
+GLSLEditorActionHandler::GLSLEditorActionHandler()
+  : TextEditor::TextEditorActionHandler(GLSLEditor::Constants::C_GLSLEDITOR_ID, Format)
+{
+}
+
+void GLSLEditorActionHandler::createActions()
+{
+    TextEditor::TextEditorActionHandler::createActions();
+}
+
+
+} // namespace Internal
+} // namespace GLSLEditor
diff --git a/src/plugins/glsleditor/glsleditoractionhandler.h b/src/plugins/glsleditor/glsleditoractionhandler.h
new file mode 100644
index 00000000000..070564fda95
--- /dev/null
+++ b/src/plugins/glsleditor/glsleditoractionhandler.h
@@ -0,0 +1,51 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#ifndef GLSLDITORACTIONHANDLER_H
+#define GLSLDITORACTIONHANDLER_H
+
+#include <texteditor/texteditoractionhandler.h>
+
+namespace GLSLEditor {
+namespace Internal {
+
+class GLSLEditorActionHandler : public TextEditor::TextEditorActionHandler
+{
+    Q_OBJECT
+
+public:
+    GLSLEditorActionHandler();
+
+    void createActions();
+};
+
+} // namespace Internal
+} // namespace GLSLEditor
+
+#endif // GLSLDITORACTIONHANDLER_H
diff --git a/src/plugins/glsleditor/glsleditorconstants.h b/src/plugins/glsleditor/glsleditorconstants.h
new file mode 100644
index 00000000000..4c4d28b7019
--- /dev/null
+++ b/src/plugins/glsleditor/glsleditorconstants.h
@@ -0,0 +1,58 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#ifndef GLSLEDITOR_CONSTANTS_H
+#define GLSLEDITOR_CONSTANTS_H
+
+#include <QtCore/QtGlobal>
+
+namespace GLSLEditor {
+namespace Constants {
+
+// menus
+const char * const M_CONTEXT = "GLSL Editor.ContextMenu";
+const char * const M_TOOLS_GLSL = "GLSLEditor.Tools.Menu";
+
+const char * const SEPARATOR1 = "GLSLEditor.Separator1";
+const char * const SEPARATOR2 = "GLSLEditor.Separator2";
+const char * const M_REFACTORING_MENU_INSERTION_POINT = "GLSLEditor.RefactorGroup";
+
+const char * const RUN_SEP = "GLSLEditor.Run.Separator";
+const char * const C_GLSLEDITOR_ID = "GLSLEditor.GLSLEditor";
+const char * const C_GLSLEDITOR_DISPLAY_NAME = QT_TRANSLATE_NOOP("OpenWith::Editors", "GLSL Editor");
+const char * const TASK_INDEX = "GLSLEditor.TaskIndex";
+const char * const TASK_SEARCH = "GLSLEditor.TaskSearch";
+
+const char * const GLSL_MIMETYPE = "application/x-glsl";
+
+
+} // namespace Constants
+} // namespace GLSLEditor
+
+#endif // GLSLEDITOR_CONSTANTS_H
diff --git a/src/plugins/glsleditor/glsleditoreditable.cpp b/src/plugins/glsleditor/glsleditoreditable.cpp
new file mode 100644
index 00000000000..7c2f95c1697
--- /dev/null
+++ b/src/plugins/glsleditor/glsleditoreditable.cpp
@@ -0,0 +1,59 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#include "glsleditoreditable.h"
+#include "glsleditor.h"
+#include "glsleditorconstants.h"
+
+#include <texteditor/texteditorconstants.h>
+#include <qmldesigner/qmldesignerconstants.h>
+
+#include <coreplugin/mimedatabase.h>
+#include <coreplugin/icore.h>
+#include <coreplugin/designmode.h>
+#include <coreplugin/modemanager.h>
+#include <coreplugin/coreconstants.h>
+
+namespace GLSLEditor {
+namespace Internal {
+
+GLSLEditorEditable::GLSLEditorEditable(GLSLTextEditor *editor)
+    : BaseTextEditorEditable(editor)
+{
+    m_context.add(GLSLEditor::Constants::C_GLSLEDITOR_ID);
+    m_context.add(TextEditor::Constants::C_TEXTEDITOR);
+}
+
+QString GLSLEditorEditable::preferredModeType() const
+{
+    return QString();
+}
+
+} // namespace Internal
+} // namespace GLSLEditor
diff --git a/src/plugins/glsleditor/glsleditoreditable.h b/src/plugins/glsleditor/glsleditoreditable.h
new file mode 100644
index 00000000000..e286d5091b1
--- /dev/null
+++ b/src/plugins/glsleditor/glsleditoreditable.h
@@ -0,0 +1,62 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#ifndef GLSLEDITOREDITABLE_H
+#define GLSLEDITOREDITABLE_H
+
+#include <texteditor/basetexteditor.h>
+
+namespace GLSLEditor {
+class GLSLTextEditor;
+
+namespace Internal {
+
+class GLSLEditorEditable : public TextEditor::BaseTextEditorEditable
+{
+    Q_OBJECT
+
+public:
+    explicit GLSLEditorEditable(GLSLTextEditor *);
+    Core::Context context() const;
+
+    bool duplicateSupported() const { return true; }
+    Core::IEditor *duplicate(QWidget *parent);
+    QString id() const;
+    bool isTemporary() const { return false; }
+    virtual bool open(const QString & fileName);
+    virtual QString preferredModeType() const;
+
+private:
+    Core::Context m_context;
+};
+
+} // namespace Internal
+} // namespace GLSLEditor
+
+#endif // GLSLEDITOREDITABLE_H
diff --git a/src/plugins/glsleditor/glsleditorfactory.cpp b/src/plugins/glsleditor/glsleditorfactory.cpp
new file mode 100644
index 00000000000..216dbf5d6cd
--- /dev/null
+++ b/src/plugins/glsleditor/glsleditorfactory.cpp
@@ -0,0 +1,100 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#include "glsleditorfactory.h"
+#include "glsleditoreditable.h"
+#include "glsleditor.h"
+#include "glsleditoractionhandler.h"
+#include "glsleditorconstants.h"
+#include "glsleditorplugin.h"
+
+#include <extensionsystem/pluginmanager.h>
+#include <extensionsystem/pluginspec.h>
+
+#include <coreplugin/icore.h>
+#include <coreplugin/editormanager/editormanager.h>
+
+#include <QtCore/QFileInfo>
+#include <QtCore/QDebug>
+#include <QtCore/QSettings>
+#include <QtGui/QMessageBox>
+#include <QtGui/QPushButton>
+#include <QtGui/QMainWindow>
+
+using namespace GLSLEditor::Internal;
+using namespace GLSLEditor::Constants;
+
+GLSLEditorFactory::GLSLEditorFactory(QObject *parent)
+  : Core::IEditorFactory(parent)
+{
+    m_mimeTypes
+            << QLatin1String(GLSLEditor::Constants::GLSL_MIMETYPE)
+            ;
+}
+
+GLSLEditorFactory::~GLSLEditorFactory()
+{
+}
+
+QString GLSLEditorFactory::id() const
+{
+    return QLatin1String(C_GLSLEDITOR_ID);
+}
+
+QString GLSLEditorFactory::displayName() const
+{
+    return tr(C_GLSLEDITOR_DISPLAY_NAME);
+}
+
+
+Core::IFile *GLSLEditorFactory::open(const QString &fileName)
+{
+    Core::IEditor *iface = Core::EditorManager::instance()->openEditor(fileName, id());
+    if (!iface) {
+        qWarning() << "QmlEditorFactory::open: openEditor failed for " << fileName;
+        return 0;
+    }
+    return iface->file();
+}
+
+Core::IEditor *GLSLEditorFactory::createEditor(QWidget *parent)
+{
+    GLSLEditor::GLSLTextEditor *rc = new GLSLEditor::GLSLTextEditor(parent);
+    GLSLEditorPlugin::instance()->initializeEditor(rc);
+    return rc->editableInterface();
+}
+
+QStringList GLSLEditorFactory::mimeTypes() const
+{
+    return m_mimeTypes;
+}
+
+void GLSLEditorFactory::updateEditorInfoBar(Core::IEditor *)
+{
+}
diff --git a/src/plugins/glsleditor/glsleditorfactory.h b/src/plugins/glsleditor/glsleditorfactory.h
new file mode 100644
index 00000000000..12ad9decc8e
--- /dev/null
+++ b/src/plugins/glsleditor/glsleditorfactory.h
@@ -0,0 +1,71 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#ifndef GLSLEDITORFACTORY_H
+#define GLSLEDITORFACTORY_H
+
+#include <coreplugin/editormanager/ieditorfactory.h>
+
+#include <QtCore/QStringList>
+
+namespace TextEditor {
+class TextEditorActionHandler;
+}
+
+namespace GLSLEditor {
+namespace Internal {
+
+class GLSLEditorActionHandler;
+
+class GLSLEditorFactory : public Core::IEditorFactory
+{
+    Q_OBJECT
+
+public:
+    GLSLEditorFactory(QObject *parent);
+    ~GLSLEditorFactory();
+
+    virtual QStringList mimeTypes() const;
+    // IEditorFactory
+    QString id() const;
+    QString displayName() const;
+    Core::IFile *open(const QString &fileName);
+    Core::IEditor *createEditor(QWidget *parent);
+
+private slots:
+    void updateEditorInfoBar(Core::IEditor *editor);
+
+private:
+    QStringList m_mimeTypes;
+};
+
+} // namespace Internal
+} // namespace GLSLEditor
+
+#endif // GLSLEDITORFACTORY_H
diff --git a/src/plugins/glsleditor/glsleditorplugin.cpp b/src/plugins/glsleditor/glsleditorplugin.cpp
new file mode 100644
index 00000000000..47a43123a05
--- /dev/null
+++ b/src/plugins/glsleditor/glsleditorplugin.cpp
@@ -0,0 +1,193 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#include "glsleditorplugin.h"
+#include "glsleditor.h"
+#include "glsleditorconstants.h"
+#include "glsleditorfactory.h"
+
+#include <coreplugin/icore.h>
+#include <coreplugin/coreconstants.h>
+#include <coreplugin/mimedatabase.h>
+#include <coreplugin/uniqueidmanager.h>
+#include <coreplugin/fileiconprovider.h>
+#include <coreplugin/actionmanager/actionmanager.h>
+#include <coreplugin/actionmanager/actioncontainer.h>
+#include <coreplugin/actionmanager/command.h>
+#include <coreplugin/editormanager/editormanager.h>
+#include <projectexplorer/taskhub.h>
+#include <extensionsystem/pluginmanager.h>
+#include <texteditor/fontsettings.h>
+#include <texteditor/storagesettings.h>
+#include <texteditor/texteditorconstants.h>
+#include <texteditor/texteditorsettings.h>
+#include <texteditor/textfilewizard.h>
+#include <texteditor/texteditoractionhandler.h>
+#include <texteditor/completionsupport.h>
+#include <utils/qtcassert.h>
+
+#include <QtCore/QtPlugin>
+#include <QtCore/QDebug>
+#include <QtCore/QSettings>
+#include <QtCore/QDir>
+#include <QtCore/QCoreApplication>
+#include <QtCore/QTimer>
+#include <QtGui/QMenu>
+#include <QtGui/QAction>
+
+using namespace GLSLEditor;
+using namespace GLSLEditor::Internal;
+using namespace GLSLEditor::Constants;
+
+GLSLEditorPlugin *GLSLEditorPlugin::m_instance = 0;
+
+GLSLEditorPlugin::GLSLEditorPlugin() :
+    m_editor(0),
+    m_actionHandler(0)
+{
+    m_instance = this;
+}
+
+GLSLEditorPlugin::~GLSLEditorPlugin()
+{
+    removeObject(m_editor);
+    delete m_actionHandler;
+    m_instance = 0;
+}
+
+/*! Copied from cppplugin.cpp */
+static inline
+Core::Command *createSeparator(Core::ActionManager *am,
+                               QObject *parent,
+                               Core::Context &context,
+                               const char *id)
+{
+    QAction *separator = new QAction(parent);
+    separator->setSeparator(true);
+    return am->registerAction(separator, Core::Id(id), context);
+}
+
+bool GLSLEditorPlugin::initialize(const QStringList & /*arguments*/, QString *error_message)
+{
+    Core::ICore *core = Core::ICore::instance();
+    if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/glsleditor/GLSLEditor.mimetypes.xml"), error_message))
+        return false;
+
+//    m_modelManager = new ModelManager(this);
+//    addAutoReleasedObject(m_modelManager);
+
+    Core::Context context(GLSLEditor::Constants::C_GLSLEDITOR_ID);
+
+    m_editor = new GLSLEditorFactory(this);
+    addObject(m_editor);
+
+    m_actionHandler = new TextEditor::TextEditorActionHandler(GLSLEditor::Constants::C_GLSLEDITOR_ID,
+                                                              TextEditor::TextEditorActionHandler::Format
+                                                              | TextEditor::TextEditorActionHandler::UnCommentSelection
+                                                              | TextEditor::TextEditorActionHandler::UnCollapseAll);
+    m_actionHandler->initializeActions();
+
+    Core::ActionManager *am =  core->actionManager();
+    Core::ActionContainer *contextMenu = am->createMenu(GLSLEditor::Constants::M_CONTEXT);
+    Core::ActionContainer *glslToolsMenu = am->createMenu(Core::Id(Constants::M_TOOLS_GLSL));
+    QMenu *menu = glslToolsMenu->menu();
+    //: GLSL sub-menu in the Tools menu
+    menu->setTitle(tr("GLSL"));
+    menu->setEnabled(true);
+    am->actionContainer(Core::Constants::M_TOOLS)->addMenu(glslToolsMenu);
+
+    Core::Command *cmd;
+
+    // Insert marker for "Refactoring" menu:
+    Core::Context globalContext(Core::Constants::C_GLOBAL);
+    Core::Command *sep = createSeparator(am, this, globalContext,
+                                         Constants::SEPARATOR1);
+    sep->action()->setObjectName(Constants::M_REFACTORING_MENU_INSERTION_POINT);
+    contextMenu->addAction(sep);
+    contextMenu->addAction(createSeparator(am, this, globalContext,
+                                           Constants::SEPARATOR2));
+
+    cmd = am->command(TextEditor::Constants::UN_COMMENT_SELECTION);
+    contextMenu->addAction(cmd);
+
+    // Set completion settings and keep them up to date
+//    TextEditor::TextEditorSettings *textEditorSettings = TextEditor::TextEditorSettings::instance();
+//    completion->setCompletionSettings(textEditorSettings->completionSettings());
+//    connect(textEditorSettings, SIGNAL(completionSettingsChanged(TextEditor::CompletionSettings)),
+//            completion, SLOT(setCompletionSettings(TextEditor::CompletionSettings)));
+
+    error_message->clear();
+
+    Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance();
+    iconProvider->registerIconOverlayForSuffix(QIcon(QLatin1String(":/glsleditor/images/glslfile.png")), "glsl");
+
+    return true;
+}
+
+void GLSLEditorPlugin::extensionsInitialized()
+{
+}
+
+ExtensionSystem::IPlugin::ShutdownFlag GLSLEditorPlugin::aboutToShutdown()
+{
+    // delete GLSL::Icons::instance(); // delete object held by singleton
+
+    return IPlugin::aboutToShutdown();
+}
+
+void GLSLEditorPlugin::initializeEditor(GLSLEditor::GLSLTextEditor *editor)
+{
+    QTC_ASSERT(m_instance, /**/);
+
+    m_actionHandler->setupActions(editor);
+
+    TextEditor::TextEditorSettings::instance()->initializeEditor(editor);
+
+//    // auto completion
+//    connect(editor, SIGNAL(requestAutoCompletion(TextEditor::ITextEditable*, bool)),
+//            TextEditor::CompletionSupport::instance(), SLOT(autoComplete(TextEditor::ITextEditable*, bool)));
+
+//    // quick fix
+//    connect(editor, SIGNAL(requestQuickFix(TextEditor::ITextEditable*)),
+//            this, SLOT(quickFix(TextEditor::ITextEditable*)));
+}
+
+
+Core::Command *GLSLEditorPlugin::addToolAction(QAction *a, Core::ActionManager *am,
+                                               Core::Context &context, const QString &name,
+                                               Core::ActionContainer *c1, const QString &keySequence)
+{
+    Core::Command *command = am->registerAction(a, name, context);
+    if (!keySequence.isEmpty())
+        command->setDefaultKeySequence(QKeySequence(keySequence));
+    c1->addAction(command);
+    return command;
+}
+
+Q_EXPORT_PLUGIN(GLSLEditorPlugin)
diff --git a/src/plugins/glsleditor/glsleditorplugin.h b/src/plugins/glsleditor/glsleditorplugin.h
new file mode 100644
index 00000000000..a7d71637363
--- /dev/null
+++ b/src/plugins/glsleditor/glsleditorplugin.h
@@ -0,0 +1,101 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#ifndef GLSLEDITORPLUGIN_H
+#define GLSLEDITORPLUGIN_H
+
+#include <extensionsystem/iplugin.h>
+#include <coreplugin/icontext.h>
+#include <QtCore/QPointer>
+
+QT_FORWARD_DECLARE_CLASS(QAction)
+QT_FORWARD_DECLARE_CLASS(QTimer)
+
+namespace TextEditor {
+class TextEditorActionHandler;
+} // namespace TextEditor
+
+namespace Core {
+class Command;
+class ActionContainer;
+class ActionManager;
+}
+
+namespace TextEditor {
+class ITextEditable;
+}
+
+namespace GLSL {
+class ModelManagerInterface;
+}
+
+namespace GLSLEditor {
+
+class GLSLTextEditor;
+
+namespace Internal {
+
+class GLSLEditorFactory;
+class GLSLPreviewRunner;
+class GLSLQuickFixCollector;
+
+class GLSLEditorPlugin : public ExtensionSystem::IPlugin
+{
+    Q_OBJECT
+
+public:
+    GLSLEditorPlugin();
+    virtual ~GLSLEditorPlugin();
+
+    // IPlugin
+    bool initialize(const QStringList &arguments, QString *errorMessage = 0);
+    void extensionsInitialized();
+    ShutdownFlag aboutToShutdown();
+
+    static GLSLEditorPlugin *instance()
+    { return m_instance; }
+
+    void initializeEditor(GLSLEditor::GLSLTextEditor *editor);
+
+private:
+    Core::Command *addToolAction(QAction *a, Core::ActionManager *am, Core::Context &context, const QString &name,
+                                 Core::ActionContainer *c1, const QString &keySequence);
+
+    static GLSLEditorPlugin *m_instance;
+
+    GLSLEditorFactory *m_editor;
+    TextEditor::TextEditorActionHandler *m_actionHandler;
+
+    QPointer<TextEditor::ITextEditable> m_currentTextEditable;
+};
+
+} // namespace Internal
+} // namespace GLSLEditor
+
+#endif // GLSLEDITORPLUGIN_H
diff --git a/src/plugins/glsleditor/images/glslfile.png b/src/plugins/glsleditor/images/glslfile.png
new file mode 100644
index 0000000000000000000000000000000000000000..568a6dd8509cf0ccbd49b8487410883f70678b36
GIT binary patch
literal 385
zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6T^Rm@
z;DWu&Cj&(|3p^r=85p>QL70(Y)*K0-AbW|YuPgg47Dhf(mbv})K%I<?o-U3d7N_4%
z+V6G5LEu=u`7<6)wmzGNqE`NdWaW;f3+8ZGuG=<IIR5CVpbesm(JOmfe=v!OEsyxY
z;uth%V}w)LTA@u3rL=YbBqXFgKY#9w`G@}d?(fwPMowF*<Rs$yW1l_SguDyiQjWd4
zW-R?%|IVHL*83DVZtSh|xs@NcHe+qD;K3;F2E(>ht2DZpvU8PVD{_-7%BFUF;rK1*
ze_VNM-MUG6hi)Yt-8ffJE4$L-R`C2?M<kdJ+<v)`slwJWp!?e+kr(=$*3-*7Gq*;I
zM_t)>xapb|>ko~6H}>rCO}jjC)#PWpRHDAkcs<GSfpA;m;U?$gdCymNnCw4RX!Gy)
b^dG!;rY7B2*{h)q3?BwhS3j3^P6<r_LH?b`

literal 0
HcmV?d00001

diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro
index 67490abf3b8..4b5ece63c30 100644
--- a/src/plugins/plugins.pro
+++ b/src/plugins/plugins.pro
@@ -32,6 +32,7 @@ SUBDIRS   = plugin_coreplugin \
             plugin_resourceeditor \
             plugin_genericprojectmanager \
             plugin_qmljseditor \
+            plugin_glsleditor \
             plugin_mercurial \
             plugin_classview \
             plugin_tasklist \
@@ -192,6 +193,11 @@ plugin_qmljseditor.depends = plugin_texteditor
 plugin_qmljseditor.depends += plugin_coreplugin
 plugin_qmljseditor.depends += plugin_projectexplorer
 
+plugin_glsleditor.subdir = glsleditor
+plugin_glsleditor.depends = plugin_texteditor
+plugin_glsleditor.depends += plugin_coreplugin
+plugin_glsleditor.depends += plugin_projectexplorer
+
 plugin_qmlprojectmanager.subdir = qmlprojectmanager
 plugin_qmlprojectmanager.depends = plugin_texteditor
 plugin_qmlprojectmanager.depends += plugin_projectexplorer
-- 
GitLab