forked from qt-creator/qt-creator
ModelEditor: Apply naming convention to getters
Change-Id: If9eaaf0dc54e26e4b7e2b8952efd951a9113f104 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -80,12 +80,12 @@ void FindComponentFromFilePath::setFilePath(const QString &filePath)
|
||||
|
||||
void FindComponentFromFilePath::visitMComponent(qmt::MComponent *component)
|
||||
{
|
||||
if (component->getName() == m_elementName) {
|
||||
if (component->name() == m_elementName) {
|
||||
QStringList elementPath;
|
||||
const qmt::MObject *ancestor = component->getOwner();
|
||||
const qmt::MObject *ancestor = component->owner();
|
||||
while (ancestor) {
|
||||
elementPath.prepend(ancestor->getName());
|
||||
ancestor = ancestor->getOwner();
|
||||
elementPath.prepend(ancestor->name());
|
||||
ancestor = ancestor->owner();
|
||||
}
|
||||
int i = elementPath.size() - 1;
|
||||
int j = m_elementsPath.size() - 1;
|
||||
@@ -161,23 +161,23 @@ void UpdateIncludeDependenciesVisitor::visitMComponent(qmt::MComponent *componen
|
||||
dependency->setFlags(qmt::MElement::REVERSE_ENGINEERED);
|
||||
dependency->setStereotypes(QStringList() << QStringLiteral("include"));
|
||||
dependency->setDirection(qmt::MDependency::A_TO_B);
|
||||
dependency->setSource(component->getUid());
|
||||
dependency->setTarget(includeComponent->getUid());
|
||||
dependency->setSource(component->uid());
|
||||
dependency->setTarget(includeComponent->uid());
|
||||
m_modelController->addRelation(component, dependency);
|
||||
}
|
||||
|
||||
// search ancestors sharing a common owner
|
||||
QList<qmt::MPackage *> componentAncestors;
|
||||
auto ancestor = dynamic_cast<qmt::MPackage *>(component->getOwner());
|
||||
auto ancestor = dynamic_cast<qmt::MPackage *>(component->owner());
|
||||
while (ancestor) {
|
||||
componentAncestors.append(ancestor);
|
||||
ancestor = dynamic_cast<qmt::MPackage *>(ancestor->getOwner());
|
||||
ancestor = dynamic_cast<qmt::MPackage *>(ancestor->owner());
|
||||
}
|
||||
QList<qmt::MPackage *> includeComponentAncestors;
|
||||
ancestor = dynamic_cast<qmt::MPackage *>(includeComponent->getOwner());
|
||||
ancestor = dynamic_cast<qmt::MPackage *>(includeComponent->owner());
|
||||
while (ancestor) {
|
||||
includeComponentAncestors.append(ancestor);
|
||||
ancestor = dynamic_cast<qmt::MPackage *>(ancestor->getOwner());
|
||||
ancestor = dynamic_cast<qmt::MPackage *>(ancestor->owner());
|
||||
}
|
||||
|
||||
int componentHighestAncestorIndex = componentAncestors.size() - 1;
|
||||
@@ -195,7 +195,7 @@ void UpdateIncludeDependenciesVisitor::visitMComponent(qmt::MComponent *componen
|
||||
int includeComponentLowestIndex = 0;
|
||||
while (index1 <= componentHighestAncestorIndex
|
||||
&& includeComponentLowestIndex <= includeComponentHighestAncestorIndex) {
|
||||
if (!componentAncestors.at(index1)->getStereotypes().isEmpty()) {
|
||||
if (!componentAncestors.at(index1)->stereotypes().isEmpty()) {
|
||||
int index2 = includeComponentLowestIndex;
|
||||
while (index2 <= includeComponentHighestAncestorIndex) {
|
||||
if (haveMatchingStereotypes(componentAncestors.at(index1), includeComponentAncestors.at(index2))) {
|
||||
@@ -204,8 +204,8 @@ void UpdateIncludeDependenciesVisitor::visitMComponent(qmt::MComponent *componen
|
||||
dependency->setFlags(qmt::MElement::REVERSE_ENGINEERED);
|
||||
dependency->setStereotypes(QStringList() << QStringLiteral("same stereotype"));
|
||||
dependency->setDirection(qmt::MDependency::A_TO_B);
|
||||
dependency->setSource(componentAncestors.at(index1)->getUid());
|
||||
dependency->setTarget(includeComponentAncestors.at(index2)->getUid());
|
||||
dependency->setSource(componentAncestors.at(index1)->uid());
|
||||
dependency->setTarget(includeComponentAncestors.at(index2)->uid());
|
||||
m_modelController->addRelation(componentAncestors.at(index1), dependency);
|
||||
}
|
||||
includeComponentLowestIndex = index2 + 1;
|
||||
@@ -224,8 +224,8 @@ void UpdateIncludeDependenciesVisitor::visitMComponent(qmt::MComponent *componen
|
||||
dependency->setFlags(qmt::MElement::REVERSE_ENGINEERED);
|
||||
dependency->setStereotypes(QStringList() << QStringLiteral("ancestor"));
|
||||
dependency->setDirection(qmt::MDependency::A_TO_B);
|
||||
dependency->setSource(componentAncestors.at(componentHighestAncestorIndex)->getUid());
|
||||
dependency->setTarget(includeComponentAncestors.at(includeComponentHighestAncestorIndex)->getUid());
|
||||
dependency->setSource(componentAncestors.at(componentHighestAncestorIndex)->uid());
|
||||
dependency->setTarget(includeComponentAncestors.at(includeComponentHighestAncestorIndex)->uid());
|
||||
m_modelController->addRelation(componentAncestors.at(componentHighestAncestorIndex), dependency);
|
||||
}
|
||||
}
|
||||
@@ -238,8 +238,8 @@ void UpdateIncludeDependenciesVisitor::visitMComponent(qmt::MComponent *componen
|
||||
dependency->setFlags(qmt::MElement::REVERSE_ENGINEERED);
|
||||
dependency->setStereotypes(QStringList() << QStringLiteral("parents"));
|
||||
dependency->setDirection(qmt::MDependency::A_TO_B);
|
||||
dependency->setSource(componentAncestors.at(0)->getUid());
|
||||
dependency->setTarget(includeComponentAncestors.at(0)->getUid());
|
||||
dependency->setSource(componentAncestors.at(0)->uid());
|
||||
dependency->setTarget(includeComponentAncestors.at(0)->uid());
|
||||
m_modelController->addRelation(componentAncestors.at(0), dependency);
|
||||
}
|
||||
}
|
||||
@@ -254,7 +254,7 @@ void UpdateIncludeDependenciesVisitor::visitMComponent(qmt::MComponent *componen
|
||||
bool UpdateIncludeDependenciesVisitor::haveMatchingStereotypes(const qmt::MObject *object1,
|
||||
const qmt::MObject *object2)
|
||||
{
|
||||
return !(object1->getStereotypes().toSet() & object2->getStereotypes().toSet()).isEmpty();
|
||||
return !(object1->stereotypes().toSet() & object2->stereotypes().toSet()).isEmpty();
|
||||
}
|
||||
|
||||
QStringList UpdateIncludeDependenciesVisitor::findFilePathOfComponent(const qmt::MComponent *component)
|
||||
@@ -266,14 +266,14 @@ QStringList UpdateIncludeDependenciesVisitor::findFilePathOfComponent(const qmt:
|
||||
collectElementPaths(projectNode, &filePaths);
|
||||
}
|
||||
QStringList elementPath;
|
||||
const qmt::MObject *ancestor = component->getOwner();
|
||||
const qmt::MObject *ancestor = component->owner();
|
||||
while (ancestor) {
|
||||
elementPath.prepend(ancestor->getName());
|
||||
ancestor = ancestor->getOwner();
|
||||
elementPath.prepend(ancestor->name());
|
||||
ancestor = ancestor->owner();
|
||||
}
|
||||
QStringList bestFilePaths;
|
||||
int maxPathLength = 1;
|
||||
foreach (const Node &node, filePaths.values(component->getName())) {
|
||||
foreach (const Node &node, filePaths.values(component->name())) {
|
||||
int i = elementPath.size() - 1;
|
||||
int j = node.m_elementPath.size() - 1;
|
||||
while (i >= 0 && j >= 0 && elementPath.at(i) == node.m_elementPath.at(j)) {
|
||||
@@ -309,7 +309,7 @@ qmt::MComponent *UpdateIncludeDependenciesVisitor::findComponentFromFilePath(con
|
||||
{
|
||||
FindComponentFromFilePath visitor;
|
||||
visitor.setFilePath(filePath);
|
||||
m_modelController->getRootPackage()->accept(&visitor);
|
||||
m_modelController->rootPackage()->accept(&visitor);
|
||||
return visitor.component();
|
||||
}
|
||||
|
||||
@@ -322,18 +322,18 @@ bool UpdateIncludeDependenciesVisitor::haveDependency(const qmt::MObject *source
|
||||
aToB = qmt::MDependency::B_TO_A;
|
||||
bToA = qmt::MDependency::A_TO_B;
|
||||
}
|
||||
foreach (const qmt::Handle<qmt::MRelation> &handle, source->getRelations()) {
|
||||
if (auto dependency = dynamic_cast<qmt::MDependency *>(handle.getTarget())) {
|
||||
if (dependency->getSource() == source->getUid()
|
||||
&& dependency->getTarget() == target->getUid()
|
||||
&& (dependency->getDirection() == aToB
|
||||
|| dependency->getDirection() == qmt::MDependency::BIDIRECTIONAL)) {
|
||||
foreach (const qmt::Handle<qmt::MRelation> &handle, source->relations()) {
|
||||
if (auto dependency = dynamic_cast<qmt::MDependency *>(handle.target())) {
|
||||
if (dependency->source() == source->uid()
|
||||
&& dependency->target() == target->uid()
|
||||
&& (dependency->direction() == aToB
|
||||
|| dependency->direction() == qmt::MDependency::BIDIRECTIONAL)) {
|
||||
return true;
|
||||
}
|
||||
if (dependency->getSource() == target->getUid()
|
||||
&& dependency->getTarget() == source->getUid()
|
||||
&& (dependency->getDirection() == bToA
|
||||
|| dependency->getDirection() == qmt::MDependency::BIDIRECTIONAL)) {
|
||||
if (dependency->source() == target->uid()
|
||||
&& dependency->target() == source->uid()
|
||||
&& (dependency->direction() == bToA
|
||||
|| dependency->direction() == qmt::MDependency::BIDIRECTIONAL)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -419,7 +419,7 @@ void ComponentViewController::createComponentModel(const ProjectExplorer::Folder
|
||||
} else {
|
||||
qmt::MPackage *requestedRootPackage = d->diagramSceneController->findSuitableParentPackage(0, diagram);
|
||||
qmt::MPackage *bestParentPackage = d->pxnodeUtilities->createBestMatchingPackagePath(requestedRootPackage, relativeElements);
|
||||
d->diagramSceneController->getModelController()->addObject(bestParentPackage, component);
|
||||
d->diagramSceneController->modelController()->addObject(bestParentPackage, component);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -431,7 +431,7 @@ void ComponentViewController::createComponentModel(const ProjectExplorer::Folder
|
||||
void ComponentViewController::updateIncludeDependencies(qmt::MPackage *rootPackage)
|
||||
{
|
||||
UpdateIncludeDependenciesVisitor visitor;
|
||||
visitor.setModelController(d->diagramSceneController->getModelController());
|
||||
visitor.setModelController(d->diagramSceneController->modelController());
|
||||
rootPackage->accept(&visitor);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user