private void _timer_Tick(object sender, EventArgs e) { try { lock (_changedFiles) { if (_changedFiles.Count == 0) { return; } _timer.Stop(); //Because refreshing removes components, we need to store the current selection, // so we can correctly reset it once the files are imported from the repository. var selection = _vbe.ActiveCodePane.GetSelection(); string name = null; if (selection.QualifiedName.Component != null) { name = selection.QualifiedName.Component.Name; } ReloadVBComponents(); _vbe.SetSelection(selection.QualifiedName.Project, selection.Selection, name); } } finally { _timer.Start(); } }
private void NavigateExplorerTreeNode(object sender, TreeNodeNavigateCodeEventArgs e) { var declaration = e.Declaration; if (declaration != null) { VBE.SetSelection(new QualifiedSelection(declaration.QualifiedName.QualifiedModuleName, declaration.Selection)); } }
private void SetSelection(RegexSearchResult item) { var project = _vbe.ActiveVBProject; foreach (var proj in _parser.State.Projects) { // wtf? project = proj; break; } _vbe.SetSelection(project, item.Selection, item.Module.Name, _codePaneFactory); }
public void ReloadComponent(string filePath) { HandleVbeSinkEvents = false; var moduleName = Path.GetFileNameWithoutExtension(filePath); if (moduleName == null) { return; } var vbe = Project.VBE; var components = Project.VBComponents; var pane = vbe.ActiveCodePane; { var item = components.SingleOrDefault(f => moduleName.Equals(f.Name, StringComparison.InvariantCultureIgnoreCase)); if (item == null) { return; } if (!pane.IsWrappingNullReference) { var module = pane.CodeModule; var component = module.Parent; { var selection = new QualifiedSelection(new QualifiedModuleName(component), pane.Selection); var name = string.IsNullOrEmpty(selection.QualifiedName.ComponentName) ? null : selection.QualifiedName.ComponentName; components.RemoveSafely(item); var directory = CurrentRepository.LocalLocation; directory += directory.EndsWith("\\") ? string.Empty : "\\"; components.Import(directory + filePath); VBE.SetSelection(component.Collection.Parent, selection.Selection, name); } } else { components.RemoveSafely(item); var directory = CurrentRepository.LocalLocation; directory += directory.EndsWith("\\") ? string.Empty : "\\"; components.Import(directory + filePath); } } HandleVbeSinkEvents = true; }
private void Refresh() { //Because refreshing removes all components, we need to store the current selection, // so we can correctly reset it once the files are imported from the repository. HandleVbeSinkEvents = false; var vbe = Project.VBE; var pane = vbe.ActiveCodePane; { if (!pane.IsWrappingNullReference) { var module = pane.CodeModule; var component = module.Parent; { var selection = new QualifiedSelection(new QualifiedModuleName(component), pane.Selection); var name = string.IsNullOrEmpty(selection.QualifiedName.ComponentName) ? null : selection.QualifiedName.ComponentName; try { Project.LoadAllComponents(CurrentRepository.LocalLocation); } catch (AggregateException ex) { HandleVbeSinkEvents = true; throw new SourceControlException("Unknown exception.", ex); } VBE.SetSelection(component.Collection.Parent, selection.Selection, name); } } else { try { Project.LoadAllComponents(CurrentRepository.LocalLocation); } catch (AggregateException ex) { HandleVbeSinkEvents = true; throw new SourceControlException("Unknown exception.", ex); } } } HandleVbeSinkEvents = true; }
public static void OnNavigateIdentifierReference(VBE vbe, IdentifierReference reference) { vbe.SetSelection(reference.QualifiedModuleName.Project, reference.Selection, reference.QualifiedModuleName.Component.Name, _wrapperFactory); }
public static void OnNavigateImplementation(VBE vbe, Declaration implementation) { vbe.SetSelection(implementation.QualifiedName.QualifiedModuleName.Project, implementation.Selection, implementation.QualifiedName.QualifiedModuleName.Component.Name, _wrapperFactory); }
public static void OnNavigateIdentifierReference(VBE vbe, IdentifierReference reference) { vbe.SetSelection(new QualifiedSelection(reference.QualifiedModuleName, reference.Selection)); }
public static void OnNavigateIdentifierReference(VBE vbe, IdentifierReference reference) { vbe.SetSelection(reference.QualifiedModuleName.Project, reference.Selection, reference.QualifiedModuleName.Component.Name); }