forked from qt-creator/qt-creator
Generic highlighter: Making highlighting available for desinger XML editor.
This commit is contained in:
@@ -39,6 +39,7 @@
|
|||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <coreplugin/uniqueidmanager.h>
|
#include <coreplugin/uniqueidmanager.h>
|
||||||
|
#include <coreplugin/mimedatabase.h>
|
||||||
#include <texteditor/basetextdocument.h>
|
#include <texteditor/basetextdocument.h>
|
||||||
#include <texteditor/plaintexteditor.h>
|
#include <texteditor/plaintexteditor.h>
|
||||||
|
|
||||||
@@ -82,6 +83,7 @@ FormWindowEditor::FormWindowEditor(Internal::DesignerXmlEditor *editor,
|
|||||||
// Force update of open editors model.
|
// Force update of open editors model.
|
||||||
connect(&(d->m_file), SIGNAL(saved()), this, SIGNAL(changed()));
|
connect(&(d->m_file), SIGNAL(saved()), this, SIGNAL(changed()));
|
||||||
connect(&(d->m_file), SIGNAL(changed()), this, SIGNAL(changed()));
|
connect(&(d->m_file), SIGNAL(changed()), this, SIGNAL(changed()));
|
||||||
|
connect(this, SIGNAL(changed()), this, SLOT(configureXmlEditor()));
|
||||||
}
|
}
|
||||||
|
|
||||||
FormWindowEditor::~FormWindowEditor()
|
FormWindowEditor::~FormWindowEditor()
|
||||||
@@ -164,6 +166,15 @@ void FormWindowEditor::syncXmlEditor()
|
|||||||
syncXmlEditor(contents());
|
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)
|
void FormWindowEditor::syncXmlEditor(const QString &contents)
|
||||||
{
|
{
|
||||||
d->m_textEditable.editor()->setPlainText(contents);
|
d->m_textEditable.editor()->setPlainText(contents);
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void syncXmlEditor();
|
void syncXmlEditor();
|
||||||
|
void configureXmlEditor() const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void slotOpen(const QString &fileName);
|
void slotOpen(const QString &fileName);
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
<glob pattern="*.txt"/>
|
<glob pattern="*.txt"/>
|
||||||
</mime-type>
|
</mime-type>
|
||||||
<mime-type type="application/xml">
|
<mime-type type="application/xml">
|
||||||
|
<alias type="text/xml"/>
|
||||||
<sub-class-of type="text/plain"/>
|
<sub-class-of type="text/plain"/>
|
||||||
<comment>XML document</comment>
|
<comment>XML document</comment>
|
||||||
<glob pattern="*.xml"/>
|
<glob pattern="*.xml"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user