Skip to content

Commit

Permalink
Fix loading the non-existing classes.
Browse files Browse the repository at this point in the history
  • Loading branch information
adeas31 committed Oct 26, 2015
1 parent 8a95887 commit 9f25f50
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion OMEdit/OMEditGUI/Modeling/LibraryTreeWidget.cpp
Expand Up @@ -593,6 +593,12 @@ bool LibraryTreeItem::isSimulationAllowed()
void LibraryTreeItem::handleLoaded(LibraryTreeItem *pLibraryTreeItem)
{
if (mpModelWidget) {
// if the base class need to be loaded then load it first.
if (pLibraryTreeItem->getModelWidget() && pLibraryTreeItem->getModelWidget()->isReloadNeeded()) {
pLibraryTreeItem->getModelWidget()->setReloadNeeded(false);
pLibraryTreeItem->getModelWidget()->loadModelWidget();
pLibraryTreeItem->handleIconUpdated();
}
ModelWidget::InheritedClass *pInheritedClass = mpModelWidget->findInheritedClass(pLibraryTreeItem);
if (pInheritedClass) {
mpModelWidget->modelInheritedClassLoaded(pInheritedClass);
Expand Down Expand Up @@ -1494,7 +1500,11 @@ void LibraryTreeModel::showModelWidget(LibraryTreeItem *pLibraryTreeItem, QStrin
}
if (pLibraryTreeItem->getModelWidget()) {
pLibraryTreeItem->getModelWidget()->setWindowTitle(pLibraryTreeItem->getNameStructure() + (pLibraryTreeItem->isSaved() ? "" : "*"));
if (pLibraryTreeItem->getModelWidget()->isReloadNeeded()) {
/* we only load here if user explicitly want to see the Model.
* If we remove show from the following condition then the we have problem when we open a model and unload it
* and then change its contents externally in some other tool and reopen the model. Now the model doesn't pick the new contents.
*/
if (pLibraryTreeItem->getModelWidget()->isReloadNeeded() && show) {
pLibraryTreeItem->getModelWidget()->setReloadNeeded(false);
pLibraryTreeItem->getModelWidget()->loadModelWidget();
pLibraryTreeItem->handleIconUpdated();
Expand Down
2 changes: 1 addition & 1 deletion OMEdit/OMEditGUI/Modeling/ModelWidgetContainer.cpp
Expand Up @@ -2280,7 +2280,7 @@ ModelWidget::ModelWidget(LibraryTreeItem* pLibraryTreeItem, ModelWidgetContainer
mpEditor = 0;
}
// store the text of LibraryTreeItem::Text
if (mpLibraryTreeItem->getLibraryType() == LibraryTreeItem::Text && mpLibraryTreeItem->getFileName().isEmpty()) {
if (mpLibraryTreeItem->getLibraryType() == LibraryTreeItem::Text && !mpLibraryTreeItem->isFilePathValid()) {
mpLibraryTreeItem->setClassText(text);
}
}
Expand Down

0 comments on commit 9f25f50

Please sign in to comment.