Hi there,
I have written two new editor plugins to handle two types of xml files from our
department.
There are two different xml file formats and for each format I have a seperate
editor:
ModEditor and CcsDocEditor.
I register the mimetype for the editors like that:
--------snip--------
Core::MimeDatabase* mdb = m_core->mimeDatabase();
if(!mdb->findByType(CcsDocEditorConstants::getMimeType()).isNull()){
return;
}
QSharedPointer<Core::IMagicMatcher> matcher(new CcsDocXmlMagicMatcher);
Core::MimeType xmlMimeType = mdb->findByType("application/xml");
Core::MimeType guixmlMimeType(xmlMimeType);
guixmlMimeType.setType(CcsDocEditorConstants::getMimeType()); //
"application/ccsdocxml"
guixmlMimeType.addMagicMatcher(matcher);
guixmlMimeType.setSubClassesOf(QStringList() << "text/plain" <<
"application/xml");
mdb->addMimeType(guixmlMimeType);
--------snap--------
The same goes for ModEditor.
Now I was hoping that I can use CcsDocXmlMagicMatcher::match(...) and
ModXmlMagicMatcher::match(...) to let the plugin find out whether it is
responsible for the file that is beeing opened.
But the function is never called. In addition to that QtCreator always uses the
same editor for both formats (depending on the order in which they got loaded
by the pluginloader).
Btw.: If I use the "Open with" dialog, there is only one editor of the two in
the list - which is the one of the two new plugins that gets loaded last.
My questions are now:
1.) Where should the MagicMatcher::match() function normally be called?
2.) Is it correct to introduce two editors for the same filetype and
differentiate them by using the MagicMatcher::match() function?
--
Markus
_______________________________________________
Qt-creator mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-creator