protected override void Edit()
 {
     ElementChooserDialog chooser = new ElementChooserDialog(typeof(UML.Type));
     chooser.SelectedObject = _typedElement.Type;
     if(chooser.Run() == Gtk.ResponseType.Accept.value__)
     {
         _typedElement.Type = (UML.Type)chooser.SelectedObject;
         _hub.BroadcastElementChange(_typedElement);
     }
 }
 protected override void Edit()
 {
     ElementChooserDialog chooser = new ElementChooserDialog(typeof(UML.Classifier));
     chooser.SelectedObject = _generalization.General;
     if(chooser.Run() == Gtk.ResponseType.Accept.value__)
     {
         _generalization.General = (UML.Classifier)chooser.SelectedObject;
         _hub.BroadcastElementChange(_generalization);
     }
 }
 protected override void Edit()
 {
     ElementChooserDialog chooser = new ElementChooserDialog(typeof(UML.Interface));
     chooser.SelectedObject = _interfaceRealization.Contract;
     if(chooser.Run() == Gtk.ResponseType.Accept.value__)
     {
         _interfaceRealization.Contract = (UML.Interface)chooser.SelectedObject;
         _hub.BroadcastElementChange(_interfaceRealization);
     }
 }
Beispiel #4
0
 protected override void Edit()
 {
     ElementChooserDialog chooser = new ElementChooserDialog(typeof(UML.UseCase));
     chooser.SelectedObject = _include.Addition;
     if(chooser.Run() == Gtk.ResponseType.Accept.value__)
     {
         _include.Addition = (UML.UseCase)chooser.SelectedObject;
         _hub.BroadcastElementChange(_include);
     }
 }
 protected override void Edit()
 {
     ElementChooserDialog chooser = new ElementChooserDialog(typeof(UML.UseCase));
     chooser.SelectedObject = _extend.ExtendedCase;
     if(chooser.Run() == Gtk.ResponseType.Accept.value__)
     {
         _extend.ExtendedCase = (UML.UseCase)chooser.SelectedObject;
         _extend.ExtensionLocation.Clear();
         _hub.BroadcastElementChange(_extend);
     }
 }
 protected override void Add()
 {
     ElementChooserDialog chooser = new ElementChooserDialog(typeof(UML.Element));
     if(chooser.Run() == Gtk.ResponseType.Accept.value__)
     {
         if(!_comment.AnnotatedElement.Contains(chooser.SelectedObject))
         {
             _comment.AnnotatedElement.Add(chooser.SelectedObject);
             _hub.BroadcastElementChange(_comment);
         }
     }
 }
Beispiel #7
0
 public void NewUMLDiagram()
 {
     if(_elementsList == null || _elementsList.Count == 0)
     {
         Gtk.MessageDialog md = new Gtk.MessageDialog (
             null,
             Gtk.DialogFlags.DestroyWithParent,
             Gtk.MessageType.Info,
             Gtk.ButtonsType.Close,
             GettextCatalog.GetString ("There are no elements in the model; you should create some elements first."));
         md.Run ();
         md.Destroy();
         return;
     }
     // pick a diagram type
     DiagramTypeChooserDialog dialog = new DiagramTypeChooserDialog();
     int rtn = dialog.Run();
     if (rtn != Gtk.ResponseType.Accept.value__ && rtn != Gtk.ResponseType.Ok.value__)
     {
         return;
     }
     string diagramType = dialog.Selection;
     // pick a namespace
     ElementChooserDialog chooser = new ElementChooserDialog(
         typeof(UML.Namespace), GettextCatalog.GetString ("Choose a namespace"));
     if (_eventQueue.LastSelectedElement is UML.Namespace)
     {
         chooser.SelectedObject = _eventQueue.LastSelectedElement;
     }
     if(chooser.Run() != Gtk.ResponseType.Accept.value__) return;
     UML.Namespace ns = (UML.Namespace)chooser.SelectedObject;
     // create a new diagram
     DI.Diagram newDiagram = new DI.Diagram();
     DI.SimpleSemanticModelElement bridge = new DI.SimpleSemanticModelElement();
     bridge.TypeInfo = diagramType.Replace(" ", "") + "Diagram";
     newDiagram.SemanticModel = bridge;
     Uml2SemanticModelBridge nsbridge = new Uml2SemanticModelBridge();
     nsbridge.Element = ns;
     newDiagram.Namespace =  nsbridge;
     _elementsList.Add (newDiagram);
     // broadcast the change
     _broadcaster.BroadcastNewModel(_elementsList);
     ElementChooserDialog.SetProjectElements(_elementsList);
 }
 protected override void Add()
 {
     string typename = "ExpertCoder.Uml2." + _mixedElementsTypeName;
     try
     {
         Type type = typeof(UML.Element).Assembly.GetType(typename, true);
         ElementChooserDialog chooser = new ElementChooserDialog(type);
         if(chooser.Run() == Gtk.ResponseType.Accept.value__)
         {
             object newElement = chooser.SelectedObject;
             _mixedElements.Add(newElement);
             _hub.BroadcastElementChange(_owner);
             if(_ownerPropertyName != null)
             {
                 newElement.GetType().InvokeMember(
                     _ownerPropertyName,
                     BindingFlags.SetProperty | BindingFlags.Public | BindingFlags.Instance,
                     null,
                     newElement,
                     new object[] { _owner });
             }
         }
         _hub.BroadcastElementChange(_owner);
     }
     catch (Exception e)
     {
         Gtk.MessageDialog md = new Gtk.MessageDialog (null,
             Gtk.DialogFlags.DestroyWithParent,
             Gtk.MessageType.Error,
             Gtk.ButtonsType.Close, e.Message);
         md.Run ();
         md.Destroy();
     }
 }