Skip to content

Commit

Permalink
Make External model useful for meta modeling.
Browse files Browse the repository at this point in the history
Delete the OriginItem when the component is deleted.
  • Loading branch information
adeas31 committed Jun 4, 2015
1 parent fb6b73c commit 0fa0c95
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
20 changes: 13 additions & 7 deletions OMEdit/OMEditGUI/Component/Component.cpp
Expand Up @@ -52,15 +52,20 @@ Component::Component(QString annotation, QString name, QString className, Compon
mComponentType = Component::Root;
initialize();
setComponentFlags(true);
getClassInheritedComponents(true);
parseAnnotationString(annotation);
/* if component doesn't exists show it as red cross box. */
if (!mpOMCProxy->existClass(className)) {
parseAnnotationString(Helper::errorComponentAnnotationString);
} else if (canUseDefaultAnnotation(this)) { /* if component doesn't have any annotation then assign it a default one. */
if (mpGraphicsView->getModelWidget()->getLibraryTreeNode()->getLibraryType() == LibraryTreeNode::TLM) {
mType = StringHandler::Connector;
parseAnnotationString(Helper::defaultComponentAnnotationString);
} else {
getClassInheritedComponents(true);
parseAnnotationString(annotation);
/* if component doesn't exists show it as red cross box. */
if (!mpOMCProxy->existClass(className)) {
parseAnnotationString(Helper::errorComponentAnnotationString);
} else if (canUseDefaultAnnotation(this)) { /* if component doesn't have any annotation then assign it a default one. */
parseAnnotationString(Helper::defaultComponentAnnotationString);
}
getClassComponents();
}
getClassComponents();
// transformation
mpTransformation = new Transformation(mpGraphicsView->getViewType());
mpTransformation->parseTransformationString(transformation, boundingRect().width(), boundingRect().height());
Expand Down Expand Up @@ -1043,6 +1048,7 @@ void Component::deleteMe()
// delete the component from model
mpGraphicsView->deleteComponentObject(this);
deleteLater();
delete mpOriginItem;
// make the model modified
mpGraphicsView->getModelWidget()->setModelModified();
/* When something is deleted from the icon layer then update the LibraryTreeNode in the Library Browser */
Expand Down
6 changes: 0 additions & 6 deletions OMEdit/OMEditGUI/Modeling/ModelWidgetContainer.cpp
Expand Up @@ -449,12 +449,6 @@ bool GraphicsView::addComponent(QString className, QPointF position)
mpModelWidget->getIconGraphicsView()->addComponentToView(name, className, "", position, new ComponentInfo(""), type);
/* When something is added in the icon layer then update the LibraryTreeNode in the Library Browser */
pMainWindow->getLibraryTreeWidget()->loadLibraryComponent(mpModelWidget->getLibraryTreeNode());
} else if(mpModelWidget->getLibraryTreeNode()->getLibraryType()== LibraryTreeNode::TLM) {
type = StringHandler::Connector;
addComponentToView(name, className, "", position, 0, type, false);
mpModelWidget->getIconGraphicsView()->addComponentToView(name, className, "", position, new ComponentInfo(""), type);
/* When something is added in the icon layer then update the LibraryTreeNode in the Library Browser */
pMainWindow->getLibraryTreeWidget()->loadLibraryComponent(mpModelWidget->getLibraryTreeNode());
} else {
addComponentToView(name, className, "", position, new ComponentInfo(""), type);
}
Expand Down

0 comments on commit 0fa0c95

Please sign in to comment.