Exemple #1
0
        public void FindRepresentedClass()
        {
            ActivateDiagramCommand c = (ActivateDiagramCommand)ActivateDiagramCommandFactory.Factory().Create(DiagramController.ModelController);

            c.Element = Class.RepresentedClass;
            c.Execute();
        }
Exemple #2
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();
        }
Exemple #3
0
        void MainWindow_ExecutedCommand(CommandBase command, bool isPartOfMacro, CommandBase macroCommand)
        {
            ActivateDiagramCommand adc = command as ActivateDiagramCommand;

            if (adc != null)
            {
                if (adc.ActivatedDiagram != null && adc.Element != null)
                {
                    DiagramTabManager.ActivateDiagramWithElement(adc.ActivatedDiagram, adc.Element);
                }

                if (adc.ActivatedDiagram == null && adc.Element != null && adc.Element is PIMClass)
                {
                    DiagramTabManager.GoToPimClass((PIMClass)adc.Element);
                }

                if (adc.ActivatedDiagram != null && adc.Element == null)
                {
                    DiagramTabManager.ActivateDiagram(((ActivateDiagramCommand)command).ActivatedDiagram);
                }
            }
        }