예제 #1
0
        void PPSMtoPSM(P_PSMDiagram D)
        {
            NewModelClassCommand addPIMClass = NewModelClassCommandFactory.Factory().Create(DiagramController.ModelController) as NewModelClassCommand;

            addPIMClass.Package = DiagramController.Project.Schema.Model;
            addPIMClass.Execute();
            tempPIMClass = addPIMClass.CreatedClass.Element;

            X.p.Maximum    = X.ClassesCount;
            X.p.Value      = 0;
            X.p.Visibility = Visibility.Visible;
            X.l.Visibility = Visibility.Visible;
            if (!Layout)
            {
                TreeLayout.SwitchOff();
            }
            Stopwatch S = new Stopwatch();

            S.Start();
            if (UseCommands)
            {
                GeneratePSM(D);
            }
            else
            {
                DiagramController.getUndoStack().Invalidate();
                DiagramController.getRedoStack().Invalidate();
                GeneratePSM2(D);
            }
            S.Stop();
            X.t.Text += "Generated PSM in " + S.ElapsedMilliseconds.ToString() + "ms" + Environment.NewLine;

            S = new Stopwatch();
            S.Start();
            if (UseCommands)
            {
                LinkSRs(D);
            }
            else
            {
                LinkSRs2(D);
            }
            S.Stop();
            X.t.Text += "Linked SRs in " + S.ElapsedMilliseconds.ToString() + "ms" + Environment.NewLine;
            if (!Layout)
            {
                TreeLayout.SwitchOn();
            }

            //Only to refresh GUI, which normally happens after each command
            ActivateDiagramCommand A = ActivateDiagramCommandFactory.Factory().Create(DiagramController.ModelController) as ActivateDiagramCommand;

            A.Set(DiagramController.Diagram);
            A.Execute();
        }
예제 #2
0
        private void OnAddClassClick(object sender, RoutedEventArgs e)
        {
            MenuItem m = sender as MenuItem;

            if (m.DataContext == null || m.DataContext is Package)
            {
                NewModelClassCommand newClassCommand = (NewModelClassCommand)NewModelClassCommandFactory.Factory().Create(project.GetModelController());
                if (m.DataContext == null)
                {
                    newClassCommand.Package = model;
                }
                else
                {
                    newClassCommand.Package = m.DataContext as Package;
                }
                newClassCommand.Execute();
            }
        }