private void DocumentWindowChanged(Object sender, MonitorSelectionEventArgs e) { IMonitorSelectionService monitor = (IMonitorSelectionService)sender; IORMDesignerView testView = monitor.CurrentSelectionContainer as IORMDesignerView; this.CurrentDesignerView = (testView != null && testView.CurrentDesigner != null) ? testView : monitor.CurrentDocumentView as IORMDesignerView; }
/// <summary> /// Initializes a new instance of the <see cref="T:NewFactScanner"/> class. /// </summary> public FactEditorLineScanner(LanguageService service, IVsTextLines textLines) { m_LanguageService = service; m_TextLines = textLines; IMonitorSelectionService monitor = m_LanguageService.GetService(typeof(IMonitorSelectionService)) as IMonitorSelectionService; EventHandler<MonitorSelectionEventArgs> windowChange = new EventHandler<MonitorSelectionEventArgs>(DocumentWindowChanged); monitor.DocumentWindowChanged += windowChange; monitor.WindowChanged += windowChange; IORMDesignerView testView = monitor.CurrentSelectionContainer as IORMDesignerView; m_View = (testView != null && testView.CurrentDesigner != null) ? testView : monitor.CurrentDocumentView as IORMDesignerView; }
/// <summary> /// Initializes a new instance of the <see cref="T:NewFactScanner"/> class. /// </summary> public FactEditorLineScanner(LanguageService service, IVsTextLines textLines) { m_LanguageService = service; m_TextLines = textLines; IMonitorSelectionService monitor = m_LanguageService.GetService(typeof(IMonitorSelectionService)) as IMonitorSelectionService; EventHandler <MonitorSelectionEventArgs> windowChange = new EventHandler <MonitorSelectionEventArgs>(DocumentWindowChanged); monitor.DocumentWindowChanged += windowChange; monitor.WindowChanged += windowChange; IORMDesignerView testView = monitor.CurrentSelectionContainer as IORMDesignerView; m_View = (testView != null && testView.CurrentDesigner != null) ? testView : monitor.CurrentDocumentView as IORMDesignerView; }
private bool ObjectTypeExists(string name) { IORMDesignerView currentDesignerView = m_View; if (currentDesignerView != null) { // UNDONE: This is painfully slow. Use ObjectTypesDictionary on the current model List <ObjectType> temp = new List <ObjectType>(); temp.AddRange(currentDesignerView.DocData.Store.ElementDirectory.FindElements <ObjectType>()); //temp.Sort(Modeling.NamedElementComparer<ObjectType>.CurrentCulture); foreach (ObjectType o in temp) { if (o.Name == name) { return(true); } } } return(false); }