public OpenItemCommand(TreeViewModel treeViewModel, MainViewModel mainViewModel, IseIntegrator iseIntegrator, TokenLocator tokenLocator) { this.treeViewModel = treeViewModel; this.mainViewModel = mainViewModel; this.iseIntegrator = iseIntegrator; this.tokenLocator = tokenLocator; }
private void InitializeCustomTokens() { FirstCharCapitalFormatToken fccFormatToken = new FirstCharCapitalFormatToken(); if (TokenLocator.GetTokenRule(fccFormatToken.Token, TokenTypes.Modifier) == null) { TokenLocator.AddCustomValidationRule(new FirstCharCapitalFormatToken()); } }
public void OpenItem(TreeViewEntryItemModel item, string searchText) { if (this.IseIntegrator == null) { throw new InvalidOperationException("IseIntegrator has not ben set yet."); } if (item == null) { return; } if (item.Node.NodeType == NodeType.File) { bool wasOpen = (this.IseIntegrator.SelectedFilePath == item.Node.Path); if (!wasOpen) { this.IseIntegrator.GoToFile(item.Node.Path); } else { this.IseIntegrator.SetFocusOnCurrentTab(); } if (searchText != null && searchText.Length > 2) { EditorInfo editorInfo = (wasOpen ? this.IseIntegrator.GetCurrentLineWithColumnIndex() : null); TokenPosition tokenPos = TokenLocator.LocateNextToken(item.Node.Path, searchText, editorInfo); if (tokenPos.MatchLength > 2) { this.IseIntegrator.SelectText(tokenPos.Line, tokenPos.Column, tokenPos.MatchLength); } else if (string.IsNullOrEmpty(this.IseIntegrator.SelectedText)) { tokenPos = TokenLocator.LocateSubtoken(item.Node.Path, searchText); if (tokenPos.MatchLength > 2) { this.IseIntegrator.SelectText(tokenPos.Line, tokenPos.Column, tokenPos.MatchLength); } } } } else if (item.Node.NodeType == NodeType.Function) { var node = ((PowershellItemNode)item.Node); this.IseIntegrator.GoToFile(node.FilePath); this.IseIntegrator.SelectText(node.PowershellItem.StartLine, node.PowershellItem.StartColumn, node.Name.Length); } else if (item.Node.NodeType == NodeType.Directory) { item.IsExpanded = !item.IsExpanded; } }