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); }
/******************************************************************************************** ** Auxiliary methods ********************************************************************************************/ private void OpenTopicDetailView(ITopic topic) { IEARepository repository = EAMain.Repository; //do some cleanup (find the closed tabs) foreach (string key in _tabMap.Keys.ToArray()) { if (repository.IsTabOpen(_tabMap[key]) == 0) { _tabMap.Remove(key); } } //tab is unknown, so far so good if (!_tabMap.ContainsKey(topic.GUID)) { _tabMap.Add(topic.GUID, FindUniqueTabName(topic)); } string tabName = _tabMap[topic.GUID]; if (repository.IsTabOpen(tabName) > 0) { EAMain.Repository.ActivateTab(tabName); } else { //possibility to update name, if it is a temporary one. if (!tabName.Equals(topic.Name)) { tabName = FindUniqueTabName(topic); _tabMap[topic.GUID] = tabName; } ITopicViewController topicViewController = repository.AddTab(tabName, "DecisionViewpoints.TopicViewController"); topicViewController.Topic = topic; } }
public void OpenDecisionDetailView(IDecision decision) { IEARepository repository = EAMain.Repository; //do some cleanup (find the closed tabs) foreach (string key in _tabMap.Keys.ToArray()) { if (repository.IsTabOpen(_tabMap[key]) == 0) { _tabMap.Remove(key); } } //tab is unknown, so far so good if (!_tabMap.ContainsKey(decision.GUID)) { _tabMap.Add(decision.GUID, FindUniqueTabName(decision)); } string tabName = _tabMap[decision.GUID]; if (repository.IsTabOpen(tabName) > 0) { EAMain.Repository.ActivateTab(tabName); } else { //possibility to update name, if it is a temporary one. if (!tabName.Equals(decision.Name)) { tabName = FindUniqueTabName(decision); _tabMap[decision.GUID] = tabName; } DetailView detailView = repository.AddTab(tabName, "DecisionViewpoints.DetailView"); detailView.Decision = decision; } }