Exemple #1
0
        public override void Execute(object parameter)
        {
            AddPSMDiagramCommand c = AddPSMDiagramCommandFactory.Factory().Create(CurrentProject.GetModelController()) as AddPSMDiagramCommand;

            c.Set(CurrentProject, null);
            c.Execute();
        }
Exemple #2
0
        private void OnProjectChanged()
        {
            if (CurrentProject != null)
            {
                CurrentProject.DiagramAdded   += DiagramTabManager.project_DiagramAdded;
                CurrentProject.DiagramRemoved += DiagramTabManager.project_DiagramRemoved;
                CurrentProject.GetModelController().ExecutedCommand += MainWindow_ExecutedCommand;

                bUndo.Command = CurrentProject.GetModelController().UndoCommand;
                bRedo.Command = CurrentProject.GetModelController().RedoCommand;
            }
        }
Exemple #3
0
 /// <summary>
 /// Occurs when undo stack for any PIM/PSM diagram in current project is changed
 /// (a new command is added or removed)
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public void UndoStack_ItemsChanged(object sender, EventArgs e)
 {
     if (!HasUnsavedChanges)
     {
         HasUnsavedChanges = true;
     }
     else
     {
         if (projectsWindow.versionManager == null)
         {
             if (CurrentProject.GetModelController().getUndoStack().Count == 0)
             {
                 HasUnsavedChanges = false;
             }
         }
         else
         {
             if (projectsWindow.versionManager.VersionedProjects.Values.All(p => p.GetModelController().getUndoStack().Count == 0))
             {
                 HasUnsavedChanges = false;
             }
         }
     }
 }
Exemple #4
0
        public override void Execute(object parameter)
        {
            PSMDiagram diagram = null;

            if (CurrentProject.PSMDiagrams.Count == 1)
            {
                diagram = CurrentProject.PSMDiagrams[0];
            }
            else if (CurrentProject.PSMDiagrams.Count > 1)
            {
                Dialogs.SelectPSMDiagramDialog d = new Dialogs.SelectPSMDiagramDialog(CurrentProject.PSMDiagrams);
                if (d.ShowDialog() == true)
                {
                    diagram = d.SelectedDiagram;
                }
            }

            if (diagram == null)
            {
                return;
            }

            List <PIM_Class> List = new List <PIM_Class>();

            List.AddRange(ActiveDiagramView.SelectedItems.OfType <PIM_Class>());

            foreach (PIM_Class Class in List)
            {
                DerivePSMClassToDiagramCommand c = DerivePSMClassToDiagramCommandFactory.Factory().Create(CurrentProject.GetModelController()) as DerivePSMClassToDiagramCommand;
                c.Set(Class.ClassController.Class, diagram);
                if (c.CanExecute())
                {
                    c.Execute();
                }
            }
        }
Exemple #5
0
        internal void InitializeMainMenu()
        {
            #region project commands

            bNewPIMDiagram.Command = new cmdNewPIMDiagram(this, bNewPIMDiagram);
            bNewPSMDiagram.Command = new cmdNewPSMDiagram(this, bNewPSMDiagram);
            bNewProject.Command    = new cmdNewProject(this, bNewProject);
            bSaveProject.Command   = new cmdSaveProject(this, bSaveProjectAs);
            bSaveProjectAs.Command = new cmdSaveProjectAs(this, bSaveProjectAs);
            bOpenProject.Command   = new cmdOpenProject(this, bOpenProject);
            bDeleteDiagram.Command = new cmdDeleteDiagram(this, bDeleteDiagram);

            bUndo.Command = CurrentProject.GetModelController().UndoCommand;
            bRedo.Command = CurrentProject.GetModelController().RedoCommand;

            #endregion

            #region delete commands

            bDeleteFromDiagram.Command    = new cmdDeleteFromDiagram(this, bDeleteFromDiagram);
            bDeleteFromModel.Command      = new cmdDeleteFromModel(this, bDeleteFromModel);
            bDeleteFromPSMDiagram.Command = new cmdDeleteFromPSMDiagram(this, bDeleteFromPSMDiagram);
            bDeleteContainer.Command      = new cmdDeleteContainer(this, bDeleteContainer);

            #endregion

            #region alignment commands

            bAlignTop.Command             = new cmdAlign(this, bAlignTop, EAlignment.Top);
            bAlignBottom.Command          = new cmdAlign(this, bAlignBottom, EAlignment.Bottom);
            bAlignLeft.Command            = new cmdAlign(this, bAlignLeft, EAlignment.Left);
            bAlignRight.Command           = new cmdAlign(this, bAlignRight, EAlignment.Right);
            bAlignCenterV.Command         = new cmdAlign(this, bAlignCenterV, EAlignment.CenterV);
            bAlignCenterH.Command         = new cmdAlign(this, bAlignCenterH, EAlignment.CenterH);
            bDistributeVertical.Command   = new cmdAlign(this, bDistributeVertical, EAlignment.DistributeV);
            bDistributeHorizontal.Command = new cmdAlign(this, bDistributeHorizontal, EAlignment.DistributeH);

            #endregion

            #region PIM commands

            bClass.Command           = new cmdNewClass(this, bClass);
            bCommentary.Command      = new cmdComment(this, bCommentary);
            bAssociate.Command       = new cmdAssociate(this, bAssociate);
            bPIMAddAttribute.Command = new cmdAddAttribute(this, bPIMAddAttribute);
            bPIMAddOperation.Command = new cmdAddOperation(this, bPIMAddOperation);
            bDeriveNew.Command       = new cmdDeriveNew(this, bDeriveNew);
            bDeriveExisting.Command  = new cmdDeriveExisting(this, bDeriveExisting);
            connectionCommands       = new List <IDraggedConnectionProcessor>();

            bGeneralization.Command = new cmdDragConnection(this, bGeneralization, EDraggedConnectionType.Generalization)
            {
                ToggleButtonGroup = connectionCommands
            };
            bAssociation.Command = new cmdDragConnection(this, bAssociation, EDraggedConnectionType.Association)
            {
                ToggleButtonGroup = connectionCommands
            };
            bAggregation.Command = new cmdDragConnection(this, bAggregation, EDraggedConnectionType.Aggregation)
            {
                ToggleButtonGroup = connectionCommands
            };
            bComposition.Command = new cmdDragConnection(this, bComposition, EDraggedConnectionType.Composition)
            {
                ToggleButtonGroup = connectionCommands
            };

            connectionCommands.Add((IDraggedConnectionProcessor)bGeneralization.Command);
            connectionCommands.Add((IDraggedConnectionProcessor)bAssociation.Command);
            connectionCommands.Add((IDraggedConnectionProcessor)bAggregation.Command);
            connectionCommands.Add((IDraggedConnectionProcessor)bComposition.Command);

            connectionButtons = new[] { bGeneralization, bAssociation, bAggregation, bComposition };

            bAssociationClass.Command = new cmdAssociationClass(this, bAssociationClass);

            // this command is for draging from Navigator window
            CommandBindings.Add(new CommandBinding(cmdIncludeClass, cmdIncludeClass.Executed));

            #endregion

            #region PSM commands

            cmdMoveToLeft  cmdMoveToLeft  = new cmdMoveToLeft(this, bMoveToLeft);
            cmdMoveToRight cmdMoveToRight = new cmdMoveToRight(this, bMoveToRight);
            cmdMoveToLeft.cmdMoveToRight = cmdMoveToRight;
            cmdMoveToRight.cmdMoveToLeft = cmdMoveToLeft;
            bMoveToLeft.Command          = cmdMoveToLeft;
            bMoveToRight.Command         = cmdMoveToRight;

            bPSMAddAttribute.Command    = new cmdAddPSMAttribute(this, bPSMAddAttribute);
            bMoveOutOfContainer.Command = new cmdMoveComponentOutOfContainer(this, bMoveOutOfContainer);

            bPSMCommentary.Command      = new cmdComment(this, bPSMCommentary);
            bAddChildren.Command        = new cmdAddChildren(this, bAddChildren);
            bAddAttributes.Command      = new cmdAddAttributes(this, bAddAttributes);
            bClassChoice.Command        = new cmdIntroduceClassUnion(this, bClassChoice);
            bContentChoice.Command      = new cmdIntroduceContentChoice(this, bContentChoice);
            bAttributeContainer.Command = new cmdIntroduceAttributeContainer(this, bAttributeContainer);
            bContentContainer.Command   = new cmdIntroduceContentContainer(this, bContentContainer);
            bAddSpecifications.Command  = new cmdAddSpecializations(this, bAddSpecifications);
            bXMLSchema.Command          = new cmdXmlSchema(this, bXMLSchema);
            bSampleDocument.Command     = new cmdSampleDocument(this, bSampleDocument);

            bAddPSMReference.Command = new cmdAddPSMDiagramReference(this, bAddPSMReference);
            bRemoveReference.Command = new cmdRemovePSMDiagramReference(this, bRemoveReference);
            #endregion

            #region PSM tree traversing commands

            cmdSelectParent       = new cmdSelectParent(this, null);
            cmdSelectRightSibling = new cmdSelectRightSibling(this, null);
            cmdSelectLeftSibling  = new cmdSelectLeftSibling(this, null);
            cmdSelectChild        = new cmdSelectChild(this, null);

            #endregion

            #region Reverse Engineering
            bXSDtoPSM.Command = new cmdXSDtoPSM(this, bXSDtoPSM);
            bPSMtoPIM.Command = new cmdPSMtoPIM(this, bPSMtoPIM);
            #endregion

            #region Semantic Web Services Extension
            bOWLtoPIM.Command     = new cmdOWLtoPIM(this, bOWLtoPIM);
            bPIMtoOWL.Command     = new cmdPIMtoOWL(this, bPIMtoOWL);
            bLiftingXSLT.Command  = new cmdLiftingXSLT(this, bLiftingXSLT);
            bLoweringXSLT.Command = new cmdLoweringXSLT(this, bLoweringXSLT);
            #endregion

            #region Evolution

            bFindChanges.Command = new cmdFindChanges(this, bFindChanges);
            bEvolve.Command      = new cmdEvolve(this, bEvolve);

            bCreateVersionMappingDiagram.Command   = new cmdCreateVersionMappingDiagram(this, bCreateVersionMappingDiagram);
            bMultipleMapping.Command               = new cmdMultipleMapping(this, bMultipleMapping);
            bCreateVersionMappingAttribute.Command = new cmdCreateVersionMappingAttribute(this, bCreateVersionMappingAttribute);
            bRemoveVersionMapping.Command          = new cmdRemoveVersionMapping(this, bRemoveVersionMapping);
            bLocatePreviousVersion.Command         = new cmdLocatePreviousVersion(this, bLocatePreviousVersion);
            bMapDirectly.Command = new cmdMapDirectly(this, bMapDirectly);

            #endregion

            ShortcutActionManager.Actions.Clear();
            ShortcutActionManager.RegisterStandardShortcuts();
        }
Exemple #6
0
 public override void Execute(object parameter)
 {
     if (ActiveDiagramView.Diagram is PIMDiagram)
     {
         RemoveDiagramCommand c = RemoveDiagramCommandFactory.Factory().Create(CurrentProject.GetModelController()) as RemoveDiagramCommand;
         c.Set(CurrentProject, ActiveDiagramView.Diagram as PIMDiagram);
         c.Execute();
     }
     else if (ActiveDiagramView.Diagram is PSMDiagram)
     {
         RemovePSMDiagramMacroCommand c = RemovePSMDiagramMacroCommandFactory.Factory().Create(CurrentProject.GetModelController()) as RemovePSMDiagramMacroCommand;
         c.Set(CurrentProject, ActiveDiagramView.Diagram as PSMDiagram, ActiveDiagramView.Controller);
         if (c.Commands.Count > 0)
         {
             c.Execute();
         }
     }
     else
     {
         throw new NotImplementedException();
     }
 }
Exemple #7
0
        public override void Execute(object parameter)
        {
            List <PIM_Class> List = new List <PIM_Class>();

            List.AddRange(ActiveDiagramView.SelectedItems.OfType <PIM_Class>());
            foreach (PIM_Class Class in List)
            {
                DerivePSMClassToNewDiagramCommand c = DerivePSMClassToNewDiagramCommandFactory.Factory().Create(CurrentProject.GetModelController()) as DerivePSMClassToNewDiagramCommand;
                c.Set(Class.ClassController.Class);
                if (c.CanExecute())
                {
                    c.Execute();
                }
            }
        }