public ForcesController(IForcesView view, IForcesModel model)
 {
     _view  = view;
     _model = model;
     _view.SetController(this);
     _model.AddObserver(_view);
 }
        public override bool OnContextItemDoubleClicked(string guid, EANativeType type)
        {
            if (EANativeType.Diagram != type)
            {
                return(false);
            }
            IEARepository repository = EAMain.Repository;
            IEADiagram    diagram    = repository.GetDiagramByGuid(guid);

            if (!diagram.IsForcesView())
            {
                return(false);
            }
            var forcesDiagramModel = new ForcesModel(diagram);

            if (repository.IsTabOpen(forcesDiagramModel.Name) > 0)
            {
                // naming is not optimal as tabs can have same names... need to find a solution that we can
                // distinguish tabs more optimal
                repository.ActivateTab(forcesDiagramModel.Name);
                return(true);
            }

            IForcesView forcesView = repository.AddTab(forcesDiagramModel.Name,
                                                       "DecisionViewpoints.Forces");
            IForcesController forcesController;

            if (!_controllers.ContainsKey(forcesDiagramModel.DiagramGUID))
            {
                forcesController = new ForcesController(forcesView, forcesDiagramModel);
                _controllers.Add(forcesDiagramModel.DiagramGUID, forcesController);
            }
            else
            {
                forcesController       = _controllers[forcesDiagramModel.DiagramGUID];
                forcesController.View  = forcesView;
                forcesController.Model = forcesDiagramModel;
            }

            forcesController.Update();
            return(true);
        }