|
|
|
@ -573,7 +573,7 @@ void UMLListView::slotDiagramCreated( Uml::IDType id ) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UMLListViewItem* UMLListView::determineParentItem(UMLObject* object) const {
|
|
|
|
|
UMLListViewItem* tqparentItem = NULL;
|
|
|
|
|
UMLListViewItem* parentItem = NULL;
|
|
|
|
|
UMLListViewItem* current = (UMLListViewItem*) currentItem();
|
|
|
|
|
Uml::ListView_Type lvt = Uml::lvt_Unknown;
|
|
|
|
|
if (current)
|
|
|
|
@ -603,23 +603,23 @@ UMLListViewItem* UMLListView::determineParentItem(UMLObject* object) const {
|
|
|
|
|
kError() << "UMLListView::determineParentItem: could not tqfind "
|
|
|
|
|
<< "tqparent package " << pkg->getName() << endl;
|
|
|
|
|
else
|
|
|
|
|
tqparentItem = pkgItem;
|
|
|
|
|
parentItem = pkgItem;
|
|
|
|
|
} else if ((lvt == Uml::lvt_UseCase_Folder &&
|
|
|
|
|
(t == Uml::ot_Actor || t == Uml::ot_UseCase))
|
|
|
|
|
|| (lvt == Uml::lvt_Component_Folder && t == Uml::ot_Component)
|
|
|
|
|
|| (lvt == Uml::lvt_Deployment_Folder && t == Uml::ot_Node)
|
|
|
|
|
|| (lvt == Uml::lvt_EntityRelationship_Folder && t == Uml::ot_Entity)) {
|
|
|
|
|
tqparentItem = current;
|
|
|
|
|
parentItem = current;
|
|
|
|
|
} else if (t == Uml::ot_Datatype) {
|
|
|
|
|
tqparentItem = m_datatypeFolder;
|
|
|
|
|
parentItem = m_datatypeFolder;
|
|
|
|
|
} else {
|
|
|
|
|
Uml::Model_Type guess = Model_Utils::guessContainer(object);
|
|
|
|
|
tqparentItem = m_lv[guess];
|
|
|
|
|
parentItem = m_lv[guess];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return tqparentItem;
|
|
|
|
|
return parentItem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UMLListView::mayHaveChildItems(Uml::Object_Type type) {
|
|
|
|
@ -653,8 +653,8 @@ void UMLListView::slotObjectCreated(UMLObject* object) {
|
|
|
|
|
newItem->setIcon(icon);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
UMLListViewItem* tqparentItem = determineParentItem(object);
|
|
|
|
|
if (tqparentItem == NULL)
|
|
|
|
|
UMLListViewItem* parentItem = determineParentItem(object);
|
|
|
|
|
if (parentItem == NULL)
|
|
|
|
|
return;
|
|
|
|
|
Uml::Object_Type type = object->getBaseType();
|
|
|
|
|
|
|
|
|
@ -667,7 +667,7 @@ void UMLListView::slotObjectCreated(UMLObject* object) {
|
|
|
|
|
if (!folderFile.isEmpty())
|
|
|
|
|
name.append(" (" + folderFile + ')');
|
|
|
|
|
}
|
|
|
|
|
newItem = new UMLListViewItem(tqparentItem, name, lvt, object);
|
|
|
|
|
newItem = new UMLListViewItem(parentItem, name, lvt, object);
|
|
|
|
|
if (mayHaveChildItems(type)) {
|
|
|
|
|
UMLClassifier *c = static_cast<UMLClassifier*>(object);
|
|
|
|
|
UMLClassifierListItemList cListItems = c->getFilteredList(Uml::ot_UMLObject);
|
|
|
|
@ -773,21 +773,21 @@ void UMLListView::childObjectAdded(UMLClassifierListItem* child, UMLClassifier*
|
|
|
|
|
return;
|
|
|
|
|
const TQString text = child->toString(Uml::st_SigNoVis);
|
|
|
|
|
UMLListViewItem *childItem = NULL;
|
|
|
|
|
UMLListViewItem *tqparentItem = findUMLObject(tqparent);
|
|
|
|
|
if (tqparentItem == NULL) {
|
|
|
|
|
UMLListViewItem *parentItem = findUMLObject(tqparent);
|
|
|
|
|
if (parentItem == NULL) {
|
|
|
|
|
kDebug() << "UMLListView::childObjectAdded(" << child->getName()
|
|
|
|
|
<< "): tqparent " << tqparent->getName()
|
|
|
|
|
<< " does not yet exist, creating it now." << endl;
|
|
|
|
|
const Uml::ListView_Type lvt = Model_Utils::convert_OT_LVT(tqparent);
|
|
|
|
|
tqparentItem = new UMLListViewItem(m_lv[Uml::mt_Logical], tqparent->getName(), lvt, tqparent);
|
|
|
|
|
parentItem = new UMLListViewItem(m_lv[Uml::mt_Logical], tqparent->getName(), lvt, tqparent);
|
|
|
|
|
} else {
|
|
|
|
|
childItem = tqparentItem->findChildObject(child);
|
|
|
|
|
childItem = parentItem->findChildObject(child);
|
|
|
|
|
}
|
|
|
|
|
if (childItem) {
|
|
|
|
|
childItem->setText(text);
|
|
|
|
|
} else {
|
|
|
|
|
const Uml::ListView_Type lvt = Model_Utils::convert_OT_LVT(child);
|
|
|
|
|
childItem = new UMLListViewItem(tqparentItem, text, lvt, child);
|
|
|
|
|
childItem = new UMLListViewItem(parentItem, text, lvt, child);
|
|
|
|
|
if (! m_doc->loading()) {
|
|
|
|
|
ensureItemVisible(childItem);
|
|
|
|
|
clearSelection();
|
|
|
|
@ -799,13 +799,13 @@ void UMLListView::childObjectAdded(UMLClassifierListItem* child, UMLClassifier*
|
|
|
|
|
|
|
|
|
|
void UMLListView::childObjectRemoved(UMLClassifierListItem* obj) {
|
|
|
|
|
UMLClassifier *tqparent = const_cast<UMLClassifier*>(dynamic_cast<const UMLClassifier*>(sender()));
|
|
|
|
|
UMLListViewItem *tqparentItem = findUMLObject(tqparent);
|
|
|
|
|
if (tqparentItem == NULL) {
|
|
|
|
|
UMLListViewItem *parentItem = findUMLObject(tqparent);
|
|
|
|
|
if (parentItem == NULL) {
|
|
|
|
|
kError() << "UMLListView::childObjectRemoved(" << obj->getName()
|
|
|
|
|
<< "): cannot find tqparent UMLListViewItem" << endl;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
tqparentItem->deleteChildItem(obj);
|
|
|
|
|
parentItem->deleteChildItem(obj);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UMLListView::slotDiagramRenamed(Uml::IDType id) {
|
|
|
|
@ -1842,13 +1842,13 @@ void UMLListView::slotCutSuccessful() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UMLListView::addNewItem(UMLListViewItem *tqparentItem, Uml::ListView_Type type) {
|
|
|
|
|
void UMLListView::addNewItem(UMLListViewItem *parentItem, Uml::ListView_Type type) {
|
|
|
|
|
if (type == Uml::lvt_Datatype) {
|
|
|
|
|
tqparentItem = m_datatypeFolder;
|
|
|
|
|
parentItem = m_datatypeFolder;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UMLListViewItem * newItem = NULL;
|
|
|
|
|
tqparentItem->setOpen( true );
|
|
|
|
|
parentItem->setOpen( true );
|
|
|
|
|
|
|
|
|
|
Uml::Icon_Type icon = Model_Utils::convert_LVT_IT(type);
|
|
|
|
|
|
|
|
|
@ -1856,7 +1856,7 @@ void UMLListView::addNewItem(UMLListViewItem *tqparentItem, Uml::ListView_Type t
|
|
|
|
|
if (Model_Utils::typeIsDiagram(type)) {
|
|
|
|
|
Uml::Diagram_Type dt = Model_Utils::convert_LVT_DT(type);
|
|
|
|
|
name = getUniqueDiagramName(dt);
|
|
|
|
|
newItem = new UMLListViewItem(tqparentItem, name, type, Uml::id_None);
|
|
|
|
|
newItem = new UMLListViewItem(parentItem, name, type, Uml::id_None);
|
|
|
|
|
} else {
|
|
|
|
|
Uml::Object_Type ot = Model_Utils::convert_LVT_OT(type);
|
|
|
|
|
if (ot == Uml::ot_UMLObject) {
|
|
|
|
@ -1864,20 +1864,20 @@ void UMLListView::addNewItem(UMLListViewItem *tqparentItem, Uml::ListView_Type t
|
|
|
|
|
<< type << endl;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
UMLPackage *tqparentPkg =
|
|
|
|
|
dynamic_cast<UMLPackage*>(tqparentItem->getUMLObject());
|
|
|
|
|
if (tqparentPkg == NULL) {
|
|
|
|
|
UMLPackage *parentPkg =
|
|
|
|
|
dynamic_cast<UMLPackage*>(parentItem->getUMLObject());
|
|
|
|
|
if (parentPkg == NULL) {
|
|
|
|
|
kError() << "UMLListView::addNewItem(type " << type
|
|
|
|
|
<< "): tqparentPkg is NULL" << endl;
|
|
|
|
|
<< "): parentPkg is NULL" << endl;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (Model_Utils::typeIsClassifierList(type)) {
|
|
|
|
|
UMLClassifier *tqparent = static_cast<UMLClassifier*>(tqparentPkg);
|
|
|
|
|
UMLClassifier *tqparent = static_cast<UMLClassifier*>(parentPkg);
|
|
|
|
|
name = tqparent->uniqChildName(ot);
|
|
|
|
|
} else {
|
|
|
|
|
name = Model_Utils::uniqObjectName(ot, tqparentPkg);
|
|
|
|
|
name = Model_Utils::uniqObjectName(ot, parentPkg);
|
|
|
|
|
}
|
|
|
|
|
newItem = new UMLListViewItem(tqparentItem, name, type, (UMLObject*)0);
|
|
|
|
|
newItem = new UMLListViewItem(parentItem, name, type, (UMLObject*)0);
|
|
|
|
|
}
|
|
|
|
|
m_bIgnoreCancelRename = false;
|
|
|
|
|
newItem->setIcon( icon );
|
|
|
|
@ -2073,15 +2073,15 @@ UMLObject *UMLListView::createUMLObject( UMLListViewItem * item, Uml::Object_Typ
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UMLListViewItem * tqparentItem = static_cast<UMLListViewItem *>(item->tqparent());
|
|
|
|
|
const Uml::ListView_Type lvt = tqparentItem->getType();
|
|
|
|
|
UMLListViewItem * parentItem = static_cast<UMLListViewItem *>(item->tqparent());
|
|
|
|
|
const Uml::ListView_Type lvt = parentItem->getType();
|
|
|
|
|
if (! Model_Utils::typeIsContainer(lvt)) {
|
|
|
|
|
kError() << "UMLListView::createUMLObject(" << object->getName()
|
|
|
|
|
<< "): tqparentItem (" << lvt << " is not a container" << endl;
|
|
|
|
|
<< "): parentItem (" << lvt << " is not a container" << endl;
|
|
|
|
|
delete object;
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
UMLPackage *pkg = static_cast<UMLPackage*>(tqparentItem->getUMLObject());
|
|
|
|
|
UMLPackage *pkg = static_cast<UMLPackage*>(parentItem->getUMLObject());
|
|
|
|
|
object->setUMLPackage(pkg);
|
|
|
|
|
pkg->addObject(object);
|
|
|
|
|
connectNewObjectsSlots(object);
|
|
|
|
@ -2198,15 +2198,15 @@ void UMLListView::createDiagram( UMLListViewItem * item, Uml::Diagram_Type type
|
|
|
|
|
delete item;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
UMLListViewItem *tqparentItem = static_cast<UMLListViewItem*>(item->tqparent());
|
|
|
|
|
UMLFolder *tqparentFolder = dynamic_cast<UMLFolder*>(tqparentItem->getUMLObject());
|
|
|
|
|
if (tqparentFolder == NULL) {
|
|
|
|
|
UMLListViewItem *parentItem = static_cast<UMLListViewItem*>(item->tqparent());
|
|
|
|
|
UMLFolder *parentFolder = dynamic_cast<UMLFolder*>(parentItem->getUMLObject());
|
|
|
|
|
if (parentFolder == NULL) {
|
|
|
|
|
kError() << "UMLListView::createDiagram(" << name
|
|
|
|
|
<< "): tqparent UMLObject is not a UMLFolder" << endl;
|
|
|
|
|
delete item;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
view = new UMLView(tqparentFolder);
|
|
|
|
|
view = new UMLView(parentFolder);
|
|
|
|
|
view->setName( name );
|
|
|
|
|
view->setType( type );
|
|
|
|
|
view->setID( UniqueID::gen() );
|
|
|
|
@ -2223,7 +2223,7 @@ TQString UMLListView::getUniqueDiagramName(Uml::Diagram_Type type) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UMLListView::isUnique( UMLListViewItem * item, const TQString &name ) {
|
|
|
|
|
UMLListViewItem * tqparentItem = static_cast<UMLListViewItem *>( item -> tqparent() );
|
|
|
|
|
UMLListViewItem * parentItem = static_cast<UMLListViewItem *>( item -> tqparent() );
|
|
|
|
|
Uml::ListView_Type type = item -> getType();
|
|
|
|
|
switch( type ) {
|
|
|
|
|
case Uml::lvt_Class_Diagram:
|
|
|
|
@ -2283,10 +2283,10 @@ bool UMLListView::isUnique( UMLListViewItem * item, const TQString &name ) {
|
|
|
|
|
case Uml::lvt_Deployment_Folder:
|
|
|
|
|
case Uml::lvt_EntityRelationship_Folder:
|
|
|
|
|
{
|
|
|
|
|
Uml::ListView_Type lvt = tqparentItem->getType();
|
|
|
|
|
Uml::ListView_Type lvt = parentItem->getType();
|
|
|
|
|
if (!Model_Utils::typeIsContainer(lvt))
|
|
|
|
|
return (m_doc->findUMLObject(name) == NULL);
|
|
|
|
|
UMLPackage *pkg = static_cast<UMLPackage*>(tqparentItem->getUMLObject());
|
|
|
|
|
UMLPackage *pkg = static_cast<UMLPackage*>(parentItem->getUMLObject());
|
|
|
|
|
if (pkg == NULL) {
|
|
|
|
|
kError() << "UMLListView::isUnique: internal error - "
|
|
|
|
|
<< "tqparent listviewitem is package but has no UMLObject" << endl;
|
|
|
|
@ -2302,7 +2302,7 @@ bool UMLListView::isUnique( UMLListViewItem * item, const TQString &name ) {
|
|
|
|
|
case Uml::lvt_Operation:
|
|
|
|
|
case Uml::lvt_EnumLiteral:
|
|
|
|
|
{
|
|
|
|
|
UMLClassifier *tqparent = static_cast<UMLClassifier*>(tqparentItem->getUMLObject());
|
|
|
|
|
UMLClassifier *tqparent = static_cast<UMLClassifier*>(parentItem->getUMLObject());
|
|
|
|
|
return (tqparent->findChildObject(name) == NULL);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -2401,16 +2401,16 @@ bool UMLListView::loadChildrenFromXMI( UMLListViewItem * tqparent, TQDomElement
|
|
|
|
|
} else if (Model_Utils::typeIsFolder(lvType)) {
|
|
|
|
|
// Synthesize the UMLFolder here
|
|
|
|
|
UMLObject *umlParent = tqparent->getUMLObject();
|
|
|
|
|
UMLPackage *tqparentPkg = dynamic_cast<UMLPackage*>(umlParent);
|
|
|
|
|
if (tqparentPkg == NULL) {
|
|
|
|
|
UMLPackage *parentPkg = dynamic_cast<UMLPackage*>(umlParent);
|
|
|
|
|
if (parentPkg == NULL) {
|
|
|
|
|
kError() << pfx << "umlParent(" << umlParent << ") is not a UMLPackage"
|
|
|
|
|
<< endl;
|
|
|
|
|
domElement = node.toElement();
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
UMLFolder *f = new UMLFolder(label, nID);
|
|
|
|
|
f->setUMLPackage(tqparentPkg);
|
|
|
|
|
tqparentPkg->addObject(f);
|
|
|
|
|
f->setUMLPackage(parentPkg);
|
|
|
|
|
parentPkg->addObject(f);
|
|
|
|
|
pObject = f;
|
|
|
|
|
item = new UMLListViewItem(tqparent, label, lvType, pObject);
|
|
|
|
|
// Moving all relevant UMLObjects to the new UMLFolder is done below,
|
|
|
|
@ -2490,7 +2490,7 @@ bool UMLListView::loadChildrenFromXMI( UMLListViewItem * tqparent, TQDomElement
|
|
|
|
|
<< tqparent->getText() << " (" << tqparent << ") != "
|
|
|
|
|
<< itmParent->getText() << " (" << itmParent << ")" << endl;
|
|
|
|
|
if (item == m_datatypeFolder && itmParent == m_lv[Uml::mt_Logical]) {
|
|
|
|
|
kDebug() << pfx << "Retqparenting the Datatypes folder is prohibited" << endl;
|
|
|
|
|
kDebug() << pfx << "Reparenting the Datatypes folder is prohibited" << endl;
|
|
|
|
|
} else {
|
|
|
|
|
UMLListViewItem *newItem = moveObject(nID, lvType, tqparent);
|
|
|
|
|
item = newItem;
|
|
|
|
|