[Uml-devel] branches/work/soc-umbrello/umbrello
Andi Fischer
andi.fischer at hispeed.ch
Sun Oct 5 11:51:41 UTC 2008
SVN commit 868077 by fischer:
Porting r868075.
M +10 -13 codegenerators/textblock.cpp
M +6 -2 dialogs/parmpropdlg.cpp
M +8 -3 dialogs/umloperationdialog.cpp
M +45 -47 foreignkeyconstraint.cpp
M +1 -1 uml.cpp
M +3 -7 uniqueconstraint.cpp
--- branches/work/soc-umbrello/umbrello/codegenerators/textblock.cpp #868076:868077
@@ -319,20 +319,17 @@
{
QString endLine = UMLApp::app()->getCommonPolicy()->getNewLineEndingChars();
- if (&doc != 0 ) {
+ blockElement.setAttribute("tag",getTag());
- blockElement.setAttribute("tag",getTag());
-
- // only write these if different from defaults
- if (getIndentationLevel())
- blockElement.setAttribute("indentLevel", QString::number(getIndentationLevel()));
- if (!m_text.isEmpty())
- blockElement.setAttribute("text", encodeText(m_text, endLine));
- if (!getWriteOutText())
- blockElement.setAttribute("writeOutText", getWriteOutText()?"true":"false");
- if (!canDelete())
- blockElement.setAttribute("canDelete", canDelete()?"true":"false");
- }
+ // only write these if different from defaults
+ if (getIndentationLevel())
+ blockElement.setAttribute("indentLevel", QString::number(getIndentationLevel()));
+ if (!m_text.isEmpty())
+ blockElement.setAttribute("text", encodeText(m_text, endLine));
+ if (!getWriteOutText())
+ blockElement.setAttribute("writeOutText", getWriteOutText()?"true":"false");
+ if (!canDelete())
+ blockElement.setAttribute("canDelete", canDelete()?"true":"false");
}
/**
--- branches/work/soc-umbrello/umbrello/dialogs/parmpropdlg.cpp #868076:868077
@@ -132,12 +132,16 @@
m_pTypeCB->setEditable(true);
m_pTypeCB->setCompletionMode( KGlobalSettings::CompletionPopup );
// m_pTypeCB->setCompleter(...);
- insertTypesSorted(attr->getTypeName());
+ if (attr) {
+ insertTypesSorted(attr->getTypeName());
+ }
// manage stereotypes
m_pStereoTypeCB->setDuplicatesEnabled(false); //only allow one of each type in box
m_pStereoTypeCB->setCompletionMode( KGlobalSettings::CompletionPopup );
- insertStereotypesSorted(m_pAtt->getStereotype());
+ if (m_pAtt) {
+ insertStereotypesSorted(m_pAtt->getStereotype());
+ }
// set tab order
setTabOrder(m_pKind, m_pTypeCB);
--- branches/work/soc-umbrello/umbrello/dialogs/umloperationdialog.cpp #868076:868077
@@ -455,7 +455,7 @@
}
UMLClassifier *classifier = dynamic_cast<UMLClassifier*>( m_operation->parent() );
- if( classifier != 0L &&
+ if( classifier != 0 &&
classifier->checkOperationSignature(name, m_operation->getParmList(), m_operation) )
{
QString msg = i18n("An operation with that signature already exists in %1.\n", classifier->getName())
@@ -476,7 +476,10 @@
m_operation -> setVisibility( Uml::Visibility::Implementation );
QString typeName = m_pRtypeCB->currentText();
- UMLTemplate *tmplParam = classifier->findTemplate(typeName);
+ UMLTemplate *tmplParam = 0;
+ if (classifier) {
+ tmplParam = classifier->findTemplate(typeName);
+ }
if (tmplParam)
m_operation->setType(tmplParam);
else
@@ -492,7 +495,9 @@
The inverse is not true: The fact that no operation is
abstract does not mean that the class must be non-abstract.
*/
- classifier->setAbstract(true);
+ if (classifier) {
+ classifier->setAbstract(true);
+ }
}
m_operation->setStatic( m_pStaticCB->isChecked() );
m_operation->setConst( m_pQueryCB->isChecked() );
--- branches/work/soc-umbrello/umbrello/foreignkeyconstraint.cpp #868076:868077
@@ -1,11 +1,10 @@
/***************************************************************************
- * *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
- * copyright (C) 2002-2007 *
+ * copyright (C) 2002-2008 *
* Umbrello UML Modeller Authors <uml-devel at uml.sf.net> *
***************************************************************************/
@@ -24,19 +23,22 @@
UMLForeignKeyConstraint::UMLForeignKeyConstraint(UMLObject *parent,
const QString& name, Uml::IDType id)
- : UMLEntityConstraint(parent, name, id) {
+ : UMLEntityConstraint(parent, name, id)
+{
init();
}
UMLForeignKeyConstraint::UMLForeignKeyConstraint(UMLObject *parent)
- : UMLEntityConstraint( parent ) {
+ : UMLEntityConstraint( parent )
+{
init();
}
/**
* Initialisation of common variables
*/
-void UMLForeignKeyConstraint::init() {
+void UMLForeignKeyConstraint::init()
+{
// initialise attributes
m_BaseType = Uml::ot_ForeignKeyConstraint;
@@ -51,7 +53,8 @@
connect( this,SIGNAL( sigReferencedEntityChanged() ),this,SLOT( slotReferencedEntityChanged() ) );
}
-bool UMLForeignKeyConstraint::operator==( const UMLForeignKeyConstraint &rhs) {
+bool UMLForeignKeyConstraint::operator==( const UMLForeignKeyConstraint &rhs)
+{
if( this == &rhs )
return true;
@@ -59,16 +62,18 @@
return false;
return true;
+}
+UMLForeignKeyConstraint::~UMLForeignKeyConstraint()
+{
}
-UMLForeignKeyConstraint::~UMLForeignKeyConstraint() {}
-
/**
* Copy the internal presentation of this object into the UMLForeignKeyConstraint
* object.
*/
-void UMLForeignKeyConstraint::copyInto(UMLObject *lhs) const {
+void UMLForeignKeyConstraint::copyInto(UMLObject *lhs) const
+{
UMLForeignKeyConstraint *target = static_cast<UMLForeignKeyConstraint*>(lhs);
// call the parent first.
@@ -84,7 +89,8 @@
/**
* Make a clone of the UMLForeignKeyConstraint.
*/
-UMLObject* UMLForeignKeyConstraint::clone() const {
+UMLObject* UMLForeignKeyConstraint::clone() const
+{
//FIXME: The new attribute should be slaved to the NEW parent not the old.
UMLForeignKeyConstraint *clone = new UMLForeignKeyConstraint( static_cast<UMLObject*>(parent()) );
copyInto(clone);
@@ -98,8 +104,8 @@
* initial value.
* @return Returns a string representation of the UMLAttribute.
*/
-QString UMLForeignKeyConstraint::toString(Uml::Signature_Type sig ){
-
+QString UMLForeignKeyConstraint::toString(Uml::Signature_Type sig )
+{
QString s;
if(sig == Uml::st_ShowSig || sig == Uml::st_ShowSig || sig == Uml::st_SigNoVis) {
@@ -120,11 +126,11 @@
return s;
}
-
/**
* Creates the <UML:ForeignKeyConstraint> XMI element.
*/
-void UMLForeignKeyConstraint::saveToXMI( QDomDocument & qDoc, QDomElement & qElement ) {
+void UMLForeignKeyConstraint::saveToXMI( QDomDocument & qDoc, QDomElement & qElement )
+{
QDomElement foreignKeyConstraintElement = UMLObject::save( "UML:ForeignKeyConstraint", qDoc );
foreignKeyConstraintElement.setAttribute( "referencedEntity", ID2STR( m_ReferencedEntity->getID() ) );
@@ -149,7 +155,8 @@
/**
* Display the properties configuration dialog for the attribute.
*/
-bool UMLForeignKeyConstraint::showPropertiesDialog(QWidget* parent) {
+bool UMLForeignKeyConstraint::showPropertiesDialog(QWidget* parent)
+{
UMLForeignKeyConstraintDialog dialog(parent, this );
return dialog.exec();
}
@@ -160,40 +167,35 @@
* @param rAttr The Attribute of the Referenced Entity
* @return true if the attribute pair could be added successfully
*/
-bool UMLForeignKeyConstraint::addEntityAttributePair(UMLEntityAttribute* pAttr, UMLEntityAttribute* rAttr) {
-
-
+bool UMLForeignKeyConstraint::addEntityAttributePair(UMLEntityAttribute* pAttr, UMLEntityAttribute* rAttr)
+{
UMLEntity *owningParent = dynamic_cast<UMLEntity*>(parent());
if ( pAttr == NULL || rAttr == NULL ) {
- uError()<<"null values passed to function"<<endl;
+ uError() << "null values passed to function";
return false;
}
// check for sanity of pAttr ( parent entity attribute )
if (owningParent == NULL) {
- uError() << m_Name
- << "): parent " << owningParent->getName()
- << " is not a UMLEntity" << endl;
+ uError() << m_Name << ": parent is not a UMLEntity";
return false;
}
if ( owningParent->findChildObjectById( pAttr->getID() ) == NULL ) {
- uError()
- << " parent " << owningParent->getName()
- << " does not contain attribute " << pAttr->getName()<<endl;
+ uError() << " parent " << owningParent->getName()
+ << " does not contain attribute " << pAttr->getName();
return false;
}
//check for sanity of rAttr ( referenced entity attribute )
if ( m_ReferencedEntity != NULL ) {
if ( m_ReferencedEntity->findChildObjectById( rAttr->getID() ) == NULL ) {
- uError()
- << " parent " << m_ReferencedEntity->getName()
- << " does not contain attribute " << rAttr->getName()<<endl;
+ uError() << " parent " << m_ReferencedEntity->getName()
+ << " does not contain attribute " << rAttr->getName();
return false;
}
} else {
- uError()<< "Referenced Table Not set. Not Adding Pair "<< endl;
+ uError() << "Referenced Table Not set. Not Adding Pair ";
return false;
}
@@ -219,12 +221,11 @@
return true;
}
-bool UMLForeignKeyConstraint::removeEntityAttributePair(UMLEntityAttribute* /*key*/ pAttr) {
-
+bool UMLForeignKeyConstraint::removeEntityAttributePair(UMLEntityAttribute* /*key*/ pAttr)
+{
bool state = m_AttributeMap.remove( pAttr );
return state;
-
}
/**
@@ -233,8 +234,8 @@
* @param rAttr The Attribute of the Referenced Entity
* @return true if the attribute pair could be found.
*/
-bool UMLForeignKeyConstraint::hasEntityAttributePair(UMLEntityAttribute* pAttr,UMLEntityAttribute* rAttr) const {
-
+bool UMLForeignKeyConstraint::hasEntityAttributePair(UMLEntityAttribute* pAttr,UMLEntityAttribute* rAttr) const
+{
if ( m_AttributeMap.contains( pAttr ) ) {
if ( m_AttributeMap.value( pAttr ) == rAttr ) {
return true;
@@ -247,7 +248,8 @@
/**
* Loads the <UML:ForeignKeyConstraint> XMI element.
*/
-bool UMLForeignKeyConstraint::load( QDomElement & element ) {
+bool UMLForeignKeyConstraint::load( QDomElement & element )
+{
UMLDoc* doc = UMLApp::app()->getDocument();
Uml::IDType referencedEntityId = STR2ID( element.attribute("referencedEntity","" ) );
@@ -302,24 +304,22 @@
return true;
}
-
-
/**
* Set the Referenced Entity
* @param ent The Entity to Reference
*/
-void UMLForeignKeyConstraint::setReferencedEntity(UMLEntity* ent){
+void UMLForeignKeyConstraint::setReferencedEntity(UMLEntity* ent)
+{
if ( ent == m_ReferencedEntity )
return;
m_ReferencedEntity = ent;
emit sigReferencedEntityChanged();
-
}
-void UMLForeignKeyConstraint::slotReferencedEntityChanged(){
-
+void UMLForeignKeyConstraint::slotReferencedEntityChanged()
+{
// clear all mappings
m_AttributeMap.clear();
}
@@ -327,16 +327,17 @@
/**
* Clears all mappings between local and referenced attributes
*/
-void UMLForeignKeyConstraint::clearMappings(){
+void UMLForeignKeyConstraint::clearMappings()
+{
m_AttributeMap.clear();
-
}
/**
* Remimplementation from base classes
* Used to resolve forward references to referenced entities in xmi
*/
-bool UMLForeignKeyConstraint::resolveRef() {
+bool UMLForeignKeyConstraint::resolveRef()
+{
// resolve referenced entity first
UMLDoc* doc = UMLApp::app()->getDocument();
@@ -366,6 +367,3 @@
}
#include "foreignkeyconstraint.moc"
-
-
-
--- branches/work/soc-umbrello/umbrello/uml.cpp #868076:868077
@@ -2789,8 +2789,8 @@
{
if (cmd != NULL) {
m_pUndoStack->push(cmd);
+ uDebug() << cmd->text() << " [" << m_pUndoStack->count() << "]";
}
- uDebug() << cmd->text() << " [" << m_pUndoStack->count() << "]";
UMLApp::app()->enableUndo(true);
}
--- branches/work/soc-umbrello/umbrello/uniqueconstraint.cpp #868076:868077
@@ -231,14 +231,12 @@
UMLEntity *owningParent = dynamic_cast<UMLEntity*>(parent());
if ( hasEntityAttribute( attr ) ) {
- uDebug() << "Unique Constraint already contains"<<attr->getName();
+ uDebug() << "Unique Constraint already contains" << attr->getName();
return false;
}
if (owningParent == NULL) {
- uError() << m_Name
- << "): parent " << owningParent->getName()
- << " is not a UMLEntity";
+ uError() << m_Name << ": parent is not a UMLEntity";
return false;
}
@@ -266,9 +264,7 @@
UMLEntity *owningParent = dynamic_cast<UMLEntity*>(parent());
if (owningParent == NULL) {
- uError() << m_Name
- << "): parent " << owningParent->getName()
- << " is not a UMLEntity";
+ uError() << m_Name << ": parent is not a UMLEntity";
return false;
}
More information about the umbrello-devel
mailing list