예제 #1
0
        /// <summary>
        /// Modify the context menu view model by adding custom menu items.
        /// </summary>
        /// <param name="contextMenu">Context menu view model containing automatically added menu items.</param>
        /// <param name="element">Host element.</param>
        public override void ProcessContextMenu(DslEditorMenuModel::MenuItemViewModel contextMenu, DslEditorTreeViewModel::ModelElementTreeViewModel element, System.Collections.Generic.List <DslEditorViewModelContracts::IModelTreeContextMenuProvider> processedProviders)
        {
            base.ProcessContextMenu(contextMenu, element, processedProviders);

            if (element.Element is global::Tum.PDE.VSPluginDSL.DomainClass2)
            {
                DslEditorMenuModel::MenuItemViewModel openModalVMs = this.FindMenuViewModel(contextMenu, "OpenModalViewsFromModelTreeId");
                if (openModalVMs == null)
                {
                    openModalVMs          = new DslEditorMenuModel::MenuItemViewModel(contextMenu.ViewModelStore);
                    openModalVMs.Text     = "Open";
                    openModalVMs.UserData = "OpenModalViewsFromModelTreeId";

                    contextMenu.Children.Insert(0, openModalVMs);
                    contextMenu.Children.Insert(1, new DslEditorMenuModel::SeparatorMenuItemViewModel(contextMenu.ViewModelStore));
                }

                if (element.Element is global::Tum.PDE.VSPluginDSL.DomainClass2)
                {
                    DslEditorMenuModel::MenuItemViewModel <DslEditorTreeViewModel::ModelElementTreeViewModel> openVM = new DslEditorMenuModel::MenuItemViewModel <DslEditorTreeViewModel::ModelElementTreeViewModel>(contextMenu.ViewModelStore);
                    openVM.Text             = "Open " + "Modal View";
                    openVM.Command          = new DslEditorCommands::DelegateCommand <DslEditorTreeViewModel::ModelElementTreeViewModel>(OpenModalDiagramTemplate);
                    openVM.CommandParameter = element;

                    openModalVMs.Children.Add(openVM);
                }
            }
        }
	    /// <summary>
        /// Modify the context menu view model by adding custom menu items.
        /// </summary>
        /// <param name="contextMenu">Context menu view model containing automatically added menu items.</param>
        /// <param name="element">Host element.</param>
        public override void ProcessContextMenu(DslEditorMenuModel::MenuItemViewModel contextMenu, DslEditorTreeViewModel::ModelElementTreeViewModel element, System.Collections.Generic.List<DslEditorViewModelContracts::IModelTreeContextMenuProvider> processedProviders)
        {
			base.ProcessContextMenu(contextMenu, element, processedProviders);
			
			if(	element.Element is global::Tum.PDE.VSPluginDSL.DomainClass2	)
			{
				DslEditorMenuModel::MenuItemViewModel openModalVMs = this.FindMenuViewModel(contextMenu, "OpenModalViewsFromModelTreeId");
				if( openModalVMs == null )
				{
					openModalVMs = new DslEditorMenuModel::MenuItemViewModel(contextMenu.ViewModelStore);
					openModalVMs.Text = "Open";
					openModalVMs.UserData = "OpenModalViewsFromModelTreeId";
				
					contextMenu.Children.Insert(0, openModalVMs);
					contextMenu.Children.Insert(1, new DslEditorMenuModel::SeparatorMenuItemViewModel(contextMenu.ViewModelStore));
				}				
			
				if( element.Element is global::Tum.PDE.VSPluginDSL.DomainClass2 )
				{
					DslEditorMenuModel::MenuItemViewModel<DslEditorTreeViewModel::ModelElementTreeViewModel> openVM = new DslEditorMenuModel::MenuItemViewModel<DslEditorTreeViewModel::ModelElementTreeViewModel>(contextMenu.ViewModelStore);
                	openVM.Text = "Open " + "Modal View";
                	openVM.Command = new DslEditorCommands::DelegateCommand<DslEditorTreeViewModel::ModelElementTreeViewModel>(OpenModalDiagramTemplate);
					openVM.CommandParameter = element;

                	openModalVMs.Children.Add(openVM);
				}

			}
        }