Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainWindow"/> class.
        /// </summary>
        /// <param name="file">File to be opened on startup</param>
        public MainWindow(string file)
        {
            this.Icon = (System.Windows.Media.ImageSource)FindResource("X");
#if DEBUG
            PresentationTraceSources.DataBindingSource.Listeners.Add(new ConsoleTraceListener());
            PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Error;
#endif
            InitializeComponent();

            InitializeRegistrationSets();

            DiagramTabManager     = new MainWindowDiagramTabManager(this);
            ShortcutActionManager = new ShortcutActionManager(this);
            ShortcutActionManager.RegisterStandardShortcuts();

            projectsWindow.DiagramDClick           += DiagramTabManager.DiagramDoubleClick;
            projectsWindow.DiagramRemove           += DiagramTabManager.DiagramRemoveHandler;
            projectsWindow.DiagramRename           += DiagramTabManager.DiagramRenameHandler;
            projectsWindow.MainWindow               = this;
            navigatorWindow.NavigatorSelectedClass += OnNavigatorSelectedClass;

            ActiveDiagramChanged += OnActiveDiagramChanged;

            ProjectChanged  += OnProjectChanged;
            ProjectChanging += OnProjectChanging;

            filename = file;

#if DEBUG
            WindowTraceListener traceListener = new WindowTraceListener {
                TextBox = logWindow.tbDebug
            };
            Debug.Listeners.Add(traceListener);
            if (Directory.Exists(@"D:\Programování\XCase\Test\output\"))
            {
                test.Visibility    = Visibility.Visible;
                testall.Visibility = Visibility.Visible;
            }
#else
            //logBrowserMenuItem.Visibility = Visibility.Hidden;
#endif
        }
Esempio n. 2
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();
        }