Commit 494f71c7 authored by Leandro Melo's avatar Leandro Melo
Browse files

Generic highlighter: Making highlighting available for desinger XML editor.

parent f0af0122
......@@ -39,6 +39,7 @@
#include <coreplugin/icore.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/uniqueidmanager.h>
#include <coreplugin/mimedatabase.h>
#include <texteditor/basetextdocument.h>
#include <texteditor/plaintexteditor.h>
......@@ -82,6 +83,7 @@ FormWindowEditor::FormWindowEditor(Internal::DesignerXmlEditor *editor,
// Force update of open editors model.
connect(&(d->m_file), SIGNAL(saved()), this, SIGNAL(changed()));
connect(&(d->m_file), SIGNAL(changed()), this, SIGNAL(changed()));
connect(this, SIGNAL(changed()), this, SLOT(configureXmlEditor()));
}
FormWindowEditor::~FormWindowEditor()
......@@ -164,6 +166,15 @@ void FormWindowEditor::syncXmlEditor()
syncXmlEditor(contents());
}
void FormWindowEditor::configureXmlEditor() const
{
TextEditor::PlainTextEditor *editor =
qobject_cast<TextEditor::PlainTextEditor *>(d->m_textEditable.editor());
if (editor)
editor->configure(Core::ICore::instance()->mimeDatabase()->findByFile(
d->m_file.fileName()));
}
void FormWindowEditor::syncXmlEditor(const QString &contents)
{
d->m_textEditable.editor()->setPlainText(contents);
......
......@@ -102,6 +102,7 @@ public:
public slots:
void syncXmlEditor();
void configureXmlEditor() const;
private slots:
void slotOpen(const QString &fileName);
......
......@@ -6,6 +6,7 @@
<glob pattern="*.txt"/>
</mime-type>
<mime-type type="application/xml">
<alias type="text/xml"/>
<sub-class-of type="text/plain"/>
<comment>XML document</comment>
<glob pattern="*.xml"/>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment