private TreeViewItem CreateFieldTvi(DkDict.Column field) { var tvi = CreateStandardTvi(_fieldImg, field.Name, field.Prompt, new TextBox { Text = field.Definition.QuickInfoTextStr }, true); tvi.Tag = field; tvi.Expanded += FieldTvi_Expanded; tvi.MouseRightButtonDown += FieldTvi_MouseRightButtonDown; var menu = new ContextMenu(); var menuItem = new MenuItem(); menuItem.Header = "Go To Definition"; menuItem.Click += FieldGoToDefinition_Click; menuItem.Tag = field; menu.Items.Add(menuItem); menuItem = new MenuItem(); menuItem.Header = "Find All References"; menuItem.Click += FieldFindAllReferences_Click; menuItem.Tag = field; menu.Items.Add(menuItem); tvi.ContextMenu = menu; return(tvi); }
private void CreateFieldInfoItems(TreeViewItem fieldItem, DkDict.Column field) { fieldItem.Items.Add(CreateInfoTvi("Name", field.Name)); if (!string.IsNullOrEmpty(field.Prompt)) { fieldItem.Items.Add(CreateInfoTvi("Prompt", field.Prompt)); } if (!string.IsNullOrEmpty(field.Comment)) { fieldItem.Items.Add(CreateInfoTvi("Comment", field.Comment)); } fieldItem.Items.Add(CreateInfoTvi("Data Type", field.DataType.Name)); }
public TableFieldToken(Scope scope, Span span, string text, DkDict.Column field) : base(scope, span, text) { #if DEBUG if (field == null) { throw new ArgumentNullException("field"); } #endif _field = field; SourceDefinition = field.Definition; ClassifierType = Classifier.ProbeClassifierType.TableField; }
private void ParseCreateIndex() { var code = Code; DkDict.RelInd relind = null; DkDict.Table table = null; string word; if (code.ReadExactWholeWord("primary")) { AddToken(new KeywordToken(Scope, code.Span, "primary")); } if (code.ReadExactWholeWord("nopick")) { AddToken(new KeywordToken(Scope, code.Span, "nopick")); } if (code.ReadExactWholeWord("NOPICK")) { AddToken(new KeywordToken(Scope, code.Span, "NOPICK")); } if (!string.IsNullOrEmpty(word = code.PeekWordR())) { if ((relind = DkDict.Dict.GetRelInd(word)) != null) { AddToken(new IdentifierToken(Scope, code.MovePeekedSpan(), word, relind.Definition)); } else { var exp = ExpressionToken.TryParse(Scope, _createIndexEndTokens); if (exp != null) { AddToken(exp); } } } else { var exp = ExpressionToken.TryParse(Scope, _createIndexEndTokens); if (exp != null) { AddToken(exp); } } if (code.ReadExactWholeWord("on")) { AddToken(new KeywordToken(Scope, code.Span, "on")); if (!string.IsNullOrEmpty(word = code.PeekWordR()) && (table = DkDict.Dict.GetTable(word)) != null) { AddToken(new IdentifierToken(Scope, code.MovePeekedSpan(), word, table.Definition)); } else { var exp = ExpressionToken.TryParse(Scope, _createIndexEndTokens); if (exp != null) { AddToken(exp); } } } while (!code.EndOfFile) { if (code.PeekExact('(') || code.PeekExact('{')) { break; } if (!string.IsNullOrEmpty(word = code.PeekWordR())) { if (word == "description") { AddToken(new KeywordToken(Scope, code.MovePeekedSpan(), "description")); var exp = ExpressionToken.TryParse(Scope, _createIndexEndTokens); if (exp != null) { AddToken(exp); } } else if (word == "tag") { ParseTag(Scope, this, new KeywordToken(Scope, code.MovePeekedSpan(), "tag"), _createIndexEndTokens); } else { var exp = ExpressionToken.TryParse(Scope, _createIndexEndTokens); if (exp != null) { AddToken(exp); } else { break; } } } else { var exp = ExpressionToken.TryParse(Scope, _createIndexEndTokens); if (exp != null) { AddToken(exp); } else { break; } } } if (code.ReadExact('(') || code.ReadExact('{')) { var brackets = new BracketsToken(Scope); brackets.AddOpen(code.Span); AddToken(brackets); DkDict.Column field = null; while (!code.EndOfFile) { if (code.ReadExact(')') || code.ReadExact('}')) { brackets.AddClose(code.Span); break; } if (code.ReadExact(',')) { brackets.AddToken(new DelimiterToken(Scope, code.Span)); } if (table != null && !string.IsNullOrEmpty(word = code.PeekWordR()) && (field = table.GetColumn(word)) != null) { brackets.AddToken(new IdentifierToken(Scope, code.MovePeekedSpan(), word, field.Definition)); } else { var exp = ExpressionToken.TryParse(Scope, _createIndexColumnEndTokens); if (exp != null) { brackets.AddToken(exp); } else { break; } } } } }