void BrowserArtifact::menu() { QMenu m(name,0); QMenu clsubm(0); QMenu gensubm(0); QMenu editsubm(0); QMenu roundtripbodysubm(0); QMenu roundtripsubm(0); QMenu toolm(0); QString cpp_h_path; QString cpp_src_path; QString java_path; QString php_path; QString python_path; QString idl_path; MenuFactory::createTitle(m, def->definition(FALSE, TRUE)); m.addSeparator(); if (!deletedp()) { if (!is_edited) { MenuFactory::addItem(m, QObject::tr("Edit"), 0, QObject::tr("to edit the <i>artifact</i>, \ a double click with the left mouse button does the same thing")); if (!is_read_only && (edition_number == 0)) { m.addSeparator(); MenuFactory::addItem(m, QObject::tr("Delete"), 1, QObject::tr("to delete the <i>artifact</i>. \ Note that you can undelete it after")); } }
const QPixmap * BrowserRelation::pixmap(int) const { if (deletedp()) return DeletedRelationIcon; const QPixmap * px = ProfiledStereotypes::browserPixmap(def->get_stereotype()); if (px != 0) return px ; switch (def->is_a(this) ? def->get_uml_visibility_a() : def->get_uml_visibility_b()) { case UmlPublic: return PublicRelationIcon; case UmlProtected: return ProtectedRelationIcon; case UmlPrivate: return PrivateRelationIcon; default: return PackageRelationIcon; } }
void BrowserComponent::menu() { QMenu m(name,0); QMenu rqsubm(0); QMenu prsubm(0); QMenu rzsubm(0); QMenu toolm(0); MenuFactory::createTitle(m, def->definition(FALSE, TRUE)); m.addSeparator(); if (!deletedp()) { if (!is_edited) { MenuFactory::addItem(m, QObject::tr("New nested component"), 4, QObject::tr("to add an <i>nested component</i> to the <i>component</i>")); m.addSeparator(); MenuFactory::addItem(m, QObject::tr("Edit"), 0, QObject::tr("to edit the <i>component</i>, \ a double click with the left mouse button does the same thing")); if (!is_read_only && (edition_number == 0)) { m.addSeparator(); MenuFactory::addItem(m, QObject::tr("Delete"), 1, QObject::tr("to delete the <i>component</i>. \ Note that you can undelete it after")); } }
// does not really delete it for undelete management void BasicData::delete_it() { if (!deletedp()) { set_deletedp(TRUE); emit deleted(); removed.append(this); } }
void BasicData::undelete(QString &, QString &) { if (deletedp()) { set_deletedp(FALSE); emit changed(); removed.removeRef(this); } }
void SimpleRelationData::delete_it() { if (!deletedp()) { if (!browser_node->deletedp()) browser_node->delete_it(); BasicData::delete_it(); } }
void TransitionData::delete_it() { if (!deletedp()) { if (!browser_node->deletedp()) browser_node->delete_it(); BasicData::delete_it(); } }
const QPixmap* BrowserSimpleRelation::pixmap(int) const { if (deletedp()) return DeletedRelationIcon; const QPixmap * px = ProfiledStereotypes::browserPixmap(def->get_stereotype()); return (px != 0) ? px : SimpleRelationIcon; }
const QPixmap * BrowserComponent::pixmap(int) const { if (deletedp()) return DeletedComponentIcon; const QPixmap * px = ProfiledStereotypes::browserPixmap(def->get_stereotype()); return (px != 0) ? px : ComponentIcon; }
const QPixmap * BrowserArtifact::pixmap(int) const { if (deletedp()) return DeletedArtifactIcon; const QPixmap * px = ProfiledStereotypes::browserPixmap(def->get_stereotype()); return (px != 0) ? px : ArtifactIcon; }
const QPixmap * BrowserDeploymentView::pixmap(int) const { if (deletedp()) return DeletedDeploymentViewIcon; const QPixmap * px = ProfiledStereotypes::browserPixmap(def->get_stereotype()); return (px != 0) ? px : DeploymentViewIcon; }
const QPixmap * BrowserClassInstance::pixmap(int) const { if (deletedp()) return DeletedClassInstanceIcon; const QPixmap * px = ProfiledStereotypes::browserPixmap(def->get_stereotype()); return (px != 0) ? px : ClassInstanceIcon; }
void BrowserNode::init_save_counter() { if (! deletedp()) { must_be_saved_counter += 1; Q3ListViewItem * child = firstChild(); while (child != 0) { ((BrowserNode *) child)->init_save_counter(); child = child->nextSibling(); } } }
bool BrowserRelation::undelete(bool, QString & warning, QString & renamed) { if (! deletedp()) return FALSE; if (def->get_start_class()->deletedp() || def->get_end_class()->deletedp()) { if (def->is_a(this)) warning += QString("<li><b>") + quote(def->get_name(this)) + "</b> " + TR("from") + " <b>" + def->get_start_class()->full_name() + "</b> " + TR("to") + " <b>" + def->get_end_class()->full_name() + "</b>\n"; else warning += QString("<li><b>") + def->get_name(this) + "</b> " + TR("from") + " <b>" + def->get_end_class()->full_name() + "</b> " + TR("to") + " <b>" + quote(def->get_start_class()->full_name()) + "</b>\n"; return FALSE; } else { switch (get_type()) { case UmlGeneralisation: case UmlRealize: if (!def->get_start_class()->check_inherit(def->get_end_class()).isEmpty()) { warning += QString("<li><b>") + quote(def->get_name(this)) + "</b> " + TR("because <b>%1</b> cannot (or already) inherit on <b>%2</b>", def->get_start_class()->full_name(), def->get_end_class()->full_name()) + "\n"; return FALSE; } break; default: break; } } if (def->undelete(warning, renamed, this, is_deleted)) { renamed += QString("<li><b>") + full_name() + "</b>\n"; modified(); } if (RelationData::isa_inherit(get_type()) && !strcmp(def->get_start_class()->get_data()->get_stereotype(), "stereotype") && !strcmp(def->get_end_class()->get_data()->get_stereotype(), "stereotype")) ProfiledStereotypes::recompute(TRUE); package_modified(); repaint(); return TRUE; }
void RelationData::undelete(QString & warning, QString & renamed) { if (deletedp()) { BasicData::undelete(warning, renamed); if (start->deletedp()) start->undelete(FALSE, warning, renamed); if (end && end->deletedp()) end->undelete(FALSE, warning, renamed); } }
void RelationData::delete_it() { if (!deletedp()) { if (type != UmlRelations) { // a true relation if (!start->deletedp()) start->delete_it(); if (end && !end->deletedp()) end->delete_it(); } BasicData::delete_it(); } }
BrowserColDiagram::~BrowserColDiagram() { if (deletedp() && !modifiedp()) { QString fn; fn.sprintf("%d.diagram", get_ident()); QDir d = BrowserView::get_dir(); QFile::remove(d.absFilePath(fn)); } all.remove(get_ident()); delete def; }
void BrowserNode::delete_it() { if (! deletedp()) { if (UndefinedNodePackage == 0) { // not during a read QString warning; if (!delete_internal(warning)) { warning = full_name() + TR(" cannot be deleted because :") + warning; warn(warning); } else { // mark modified to not delete the associated file(s) // on exit if no save was done before is_modified = TRUE; } if (BrowserSearchDialog::get() != 0) BrowserSearchDialog::get()->update(); if (ReferenceDialog::get() != 0) ReferenceDialog::get()->update(); } else { // during a read : no check is_deleted = TRUE; if (is_marked) { marked_list.removeRef(this); is_marked = FALSE; } if (is_writable()) package_modified(); if (get_data() != 0) get_data()->delete_it(); // delete the sub elts Q3ListViewItem * child; for (child = firstChild(); child != 0; child = child->nextSibling()) if (! ((BrowserNode *) child)->deletedp()) ((BrowserNode *) child)->delete_it(); setOpen(FALSE); must_be_deleted(); } } }
void BrowserRelation::menu() { Q3PopupMenu m(0, name); Q3PopupMenu toolm(0); MenuFactory::createTitle(m, def->definition(FALSE, TRUE)); m.insertSeparator(); if (!deletedp()) { if (!in_edition()) { m.setWhatsThis(m.insertItem(TR("Edit"), 0), TR("to edit the <i>relation</i>, \ a double click with the left mouse button does the same thing")); if (!is_read_only && (edition_number == 0)) { if (RelationData::isa_association(def->get_type())) { m.setWhatsThis(m.insertItem(TR("Duplicate"), 1), TR("to copy the <i>relation</i> in a new one")); if (get_oper == 0) m.setWhatsThis(m.insertItem(TR("New get operation"), 4), TR("to auto define the <i>get operation</i>")); if (set_oper == 0) m.setWhatsThis(m.insertItem(TR("New set operation"), 5), TR("to auto define the <i>set operation</i>")); if ((get_oper == 0) && (set_oper == 0)) m.setWhatsThis(m.insertItem(TR("New get and set operation"), 6), TR("to auto define the <i>get</i> and <i>set operation</i>s")); m.insertSeparator(); } } m.setWhatsThis(m.insertItem(TR("Referenced by"), 8), TR("to know who reference the <i>relation</i>")); m.insertSeparator(); if (!is_read_only && (edition_number == 0)) { m.setWhatsThis(m.insertItem(TR("Delete"), 2), TR("to delete the <i>relation</i>. \ Note that you can undelete it after")); } m.insertSeparator(); }
void BrowserRelation::menu() { QMenu m(name,0); QMenu toolm(0); MenuFactory::createTitle(m, def->definition(FALSE, TRUE)); m.addSeparator(); if (!deletedp()) { if (!in_edition()) { MenuFactory::addItem(m, QObject::tr("Edit"), 0, QObject::tr("to edit the <i>relation</i>, \ a double click with the left mouse button does the same thing")); if (!is_read_only && (edition_number == 0)) { if (RelationData::isa_association(def->get_type())) { MenuFactory::addItem(m, QObject::tr("Duplicate"), 1, QObject::tr("to copy the <i>relation</i> in a new one")); if (get_oper == 0) MenuFactory::addItem(m, QObject::tr("New get operation"), 4, QObject::tr("to auto define the <i>get operation</i>")); if (set_oper == 0) MenuFactory::addItem(m, QObject::tr("New set operation"), 5, QObject::tr("to auto define the <i>set operation</i>")); if ((get_oper == 0) && (set_oper == 0)) MenuFactory::addItem(m, QObject::tr("New get and set operation"), 6, QObject::tr("to auto define the <i>get</i> and <i>set operation</i>s")); m.addSeparator(); } } MenuFactory::addItem(m, QObject::tr("Referenced by"), 8, QObject::tr("to know who reference the <i>relation</i>")); m.addSeparator(); if (!is_read_only && (edition_number == 0)) { MenuFactory::addItem(m, QObject::tr("Delete"), 2, QObject::tr("to delete the <i>relation</i>. \ Note that you can undelete it after")); } m.addSeparator(); }
BrowserObjectDiagram::~BrowserObjectDiagram() { if (deletedp() && !modifiedp()) { QString fn; fn.sprintf("%d.diagram", get_ident()); QDir d = BrowserView::get_dir(); QFile::remove(d.absFilePath(fn)); } on_close(); // if(window) // window->set_browser_diagram(0); all.remove(get_ident()); delete def; }
void BrowserSimpleRelation::menu() { Q3PopupMenu m(0, name); Q3PopupMenu toolm(0); MenuFactory::createTitle(m, def->definition(FALSE, TRUE)); m.insertSeparator(); if (!deletedp()) { if (!in_edition()) { m.setWhatsThis(m.insertItem(TR("Edit"), 0), TR("to edit the <i>relation</i>, \ a double click with the left mouse button does the same thing")); if (!is_read_only && (edition_number == 0)) { m.setWhatsThis(m.insertItem(TR("Delete"), 2), TR("to delete the <i>relation</i>. \ Note that you can undelete it after")); } m.insertSeparator(); }
bool BrowserClassInstance::undelete(bool, QString & warning, QString & renamed) { if (! deletedp()) return FALSE; if (def->get_class()->deletedp()) { warning += QString("<li><b>") + quote(name) + ":" + quote(def->get_class()->get_name()) + "</b>\n"; return FALSE; } is_deleted = FALSE; def->undelete(warning, renamed); package_modified(); repaint(); return TRUE; }
bool BrowserNode::undelete(bool rec, QString & warning, QString & renamed) { bool result; if (deletedp()) { // undelete the node QString s = name; bool ren = FALSE; while (((BrowserNode *)parent()) ->wrong_child_name(s, get_type(), allow_spaces(), allow_empty())) { s = "_" + s; ren = TRUE; } is_deleted = FALSE; is_modified = TRUE; get_data()->undelete(warning, renamed); if (ren) { set_name(s); renamed += QString("<li><b>") + full_name() + "</b>\n"; } result = TRUE; package_modified(); } else result = FALSE; if (rec) { // undelete the sub elts Q3ListViewItem * child; for (child = firstChild(); child != 0; child = child->nextSibling()) result |= ((BrowserNode *) child)->undelete(rec, warning, renamed); } if (result) repaint(); return result; }
bool BrowserSimpleRelation::undelete(bool, QString & warning, QString & renamed) { if (! deletedp()) return FALSE; if (def->get_start_node()->deletedp() || def->get_end_node()->deletedp()) { warning += QString("<li><b>") + quote(def->definition(FALSE, FALSE)) + "</b> " + TR("from") + " <b>" + def->get_start_node()->full_name() + "</b> " + TR("to") + " <b>" + def->get_end_node()->full_name() + "</b>\n"; return FALSE; } else { switch (get_type()) { case UmlInherit: // use case if (!def->get_start_node()->check_inherit(def->get_end_node()).isEmpty()) { warning += QString("<li><b>") + quote(def->definition(FALSE, FALSE)) + "</b> " + TR("because <b>%1</b> cannot (or already) inherit on <b>%2</b>", def->get_start_node()->full_name(), def->get_end_node()->full_name()) + "\n"; return FALSE; } break; default: break; } } is_deleted = FALSE; def->undelete(warning, renamed); package_modified(); repaint(); return TRUE; }
bool BrowserOperation::undelete(bool rec, QString & warning, QString & renamed) { if (deletedp()) { if (get_of != 0) { if (get_of->deletedp()) { warning += QString("<li><b>") + quote(def->definition(TRUE, FALSE)) + "</b>\n"; return FALSE; } } else if (set_of != 0) { if (set_of->deletedp()) { warning += QString("<li><b>") + quote(def->definition(TRUE, FALSE)) + "</b>\n"; return FALSE; } } return BrowserNode::undelete(rec, warning, renamed); } else return FALSE; }
void BrowserTransition::menu() { QMenu m("transition",0); QMenu toolm(0); MenuFactory::createTitle(m, def->definition(FALSE, TRUE)); m.addSeparator(); if (!deletedp()) { if (!in_edition()) { MenuFactory::addItem(m, QObject::tr("Edit"), 0, QObject::tr("to edit the <i>transition</i>, \ a double click with the left mouse button does the same thing")); if (!is_read_only && (edition_number == 0)) { MenuFactory::addItem(m, QObject::tr("Delete"), 2, QObject::tr("to delete the <i>transition</i>. \ Note that you can undelete it after")); } m.addSeparator(); }
bool BrowserFlow::undelete(bool, QString & warning, QString & renamed) { if (! deletedp()) return FALSE; if (def->get_start_node()->deletedp() || def->get_end_node()->deletedp()) { warning += QString("<li><b>") + quote(name) + "</b> " + TR("from") + " <b>" + def->get_start_node()->full_name() + "</b> " + TR("to") + " <b>" + def->get_end_node()->full_name() + "</b>\n"; return FALSE; } is_deleted = FALSE; def->undelete(warning, renamed); package_modified(); repaint(); return TRUE; }
void BrowserDeploymentView::menu() { QMenu m(0); QMenu subm(0); QMenu roundtripm(0); QMenu roundtripbodym(0); QMenu toolm(0); MenuFactory::createTitle(m, def->definition(FALSE, TRUE)); m.addSeparator(); if (!deletedp()) { if (!is_read_only && (edition_number == 0)) { MenuFactory::addItem(m, QObject::tr("New deployment diagram"), 0, QObject::tr("to add a <i>deployment diagram</i>")); MenuFactory::addItem(m, QObject::tr("New node"), 1, QObject::tr("to add a <i>node</i>")); MenuFactory::addItem(m, QObject::tr("New artifact"), 2, QObject::tr("to add an <i>artifact</i>")); m.addSeparator(); } if (!is_edited) { MenuFactory::addItem(m, QObject::tr("Edit"), 3, QObject::tr("to edit the <i>deployment view</i>")); if (!is_read_only) { m.addSeparator(); //MenuFactory::addItem(m, "Edit node settings", 4), // "to set the sub node's settings"); MenuFactory::addItem(m, QObject::tr("Edit drawing settings"), 5, QObject::tr("to set how the sub <i>deployment diagrams</i>'s items must be drawn")); if (edition_number == 0) { m.addSeparator(); MenuFactory::addItem(m, QObject::tr("Delete"), 6, QObject::tr("to delete the <i>deployment view</i> and its sub items. \ Note that you can undelete them after")); } }
BrowserSeqDiagram::~BrowserSeqDiagram() { if (deletedp() && !modifiedp()) { QString fn; fn.sprintf("%d.diagram", get_ident()); QDir d = BrowserView::get_dir(); QFile::remove(d.absFilePath(fn)); } #if 0 // already done before browser->clear if (window) delete window; #endif all.remove(get_ident()); delete def; }