ModelEditor: Support model specific customization

If the model contains a configuration path to a configuration file
(or a directory of configuration files) the configuration is loaded
for that model only. The file path may be relative to the model file.

No UI support for this feature yet.

Change-Id: Ia3615da3e57fc4731926a5970ba1b2f741d64e21
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
Jochen Becher
2015-12-14 22:42:44 +01:00
parent e9cffc1b74
commit 9c6262124c
5 changed files with 45 additions and 3 deletions

View File

@@ -35,6 +35,7 @@
#include "modelsmanager.h"
#include "extdocumentcontroller.h"
#include "qmt/config/configcontroller.h"
#include "qmt/infrastructure/ioexceptions.h"
#include "qmt/model_controller/modelcontroller.h"
#include "qmt/model/mdiagram.h"
@@ -45,6 +46,7 @@
#include <utils/fileutils.h>
#include <QFileInfo>
#include <QDir>
namespace ModelEditor {
namespace Internal {
@@ -158,6 +160,17 @@ Core::IDocument::OpenResult ModelDocument::load(QString *errorString, const QStr
return OpenResult::CannotHandle;
}
QString configPath = d->documentController->projectController()->project()->configPath();
if (!configPath.isEmpty()) {
QString canonicalPath = QFileInfo(QDir(QFileInfo(fileName).path()).filePath(configPath)).canonicalFilePath();
if (!canonicalPath.isEmpty()) {
// TODO error output on reading definition files
d->documentController->configController()->readStereotypeDefinitions(canonicalPath);
} else {
// TODO error output
}
}
emit contentSet();
return OpenResult::Success;
}