コード例 #1
0
ファイル: Normalizer.cs プロジェクト: mff-uk/exolutio
        public void NormalizeSchema(PSMSchema schema)
        {
            modelVerifier = new ModelVerifier();
            //Controller.BeginMacro();

            FinalReport = new NestedCommandReport();

            bool somethingFound = false;

            while (!modelVerifier.TestSchemaNormalized(schema))
            {
                somethingFound = true;
                StackedCommand command = GetNormalizationCommand(schema);
                command.Execute();
                if (command is MacroCommand)
                {
                    NestedCommandReport commandReport = ((MacroCommand)command).GetReport();
                    ((NestedCommandReport)FinalReport).NestedReports.Add(commandReport);
                }
            }

            if (!somethingFound)
            {
                FinalReport = new CommandReport("Schema is already normalized. ");
            }
            //Controller.CommitMacro();
        }
コード例 #2
0
        public override void Execute(object parameter)
        {
            if (Current.ActiveDiagram != null && Current.ActiveDiagram.Schema is PSMSchema)
            {
                ModelVerifier verifier = new ModelVerifier();

                if (!verifier.TestSchemaNormalized((PSMSchema)Current.ActiveDiagram.Schema))
                {
                    #if SILVERLIGHT
                    ExolutioMessageBox.Show("Normalization", "Schema is not normalized", "Check command log window for details.");
                    #else
                    ExolutioMessageBox.Show("Normalization", "Schema is not normalized", "Check command log window for details.");
                    #endif
                    Current.MainWindow.DisplayLog(verifier.Log, true);
                }
                else
                {
                    #if SILVERLIGHT
                    ExolutioMessageBox.Show("Normalization", "Normalization passed", "Schema is normalized");
                    #else
                    ExolutioMessageBox.Show("Normalization", "Normalization passed", "Schema is normalized");
                    #endif
                    Current.MainWindow.DisplayReport(new CommandReport("Schema is normalized. "), true);
                }
            }
        }