/// <summary> /// Converts a member to text. /// Returns the declaration of the member as C# or VB code, e.g. /// "public void MemberName(string parameter)" /// </summary> static string GetText(IEntity entity) { IAmbience ambience = IntellisenseForm.SupportedLanguage == ESupportedLanguage.VisualBasic ? (IAmbience) new VBNetAmbience() : new CSharpAmbience(); if (entity is IMethod) { return(ambience.Convert(entity as IMethod)); } if (entity is IProperty) { return(ambience.Convert(entity as IProperty)); } if (entity is IEvent) { return(ambience.Convert(entity as IEvent)); } if (entity is IField) { return(ambience.Convert(entity as IField)); } if (entity is IClass) { return(ambience.Convert(entity as IClass)); } // unknown entity: return(entity.ToString()); }
/// <summary> /// Converts a member to text. /// Returns the declaration of the member as C# or VB code, e.g. /// "public void MemberName(string parameter)" /// </summary> private static string GetText(IEntity entity) { IAmbience ambience = MainForm.IsVisualBasic ? (IAmbience)vbAmbience : csharpAmbience; if (entity is IMethod) { return(ambience.Convert(entity as IMethod)); } if (entity is IProperty) { return(ambience.Convert(entity as IProperty)); } if (entity is IEvent) { return(ambience.Convert(entity as IEvent)); } if (entity is IField) { return(ambience.Convert(entity as IField)); } if (entity is IClass) { return(ambience.Convert(entity as IClass)); } // unknown entity: return(entity.ToString()); }
/// <summary> /// Converts a member to text. /// Returns the declaration of the member as C# or VB code, e.g. /// "public void MemberName(string parameter)" /// </summary> string GetText(IEntity entity) { return((string)o2CodeCompletion.textEditor.invokeOnThread( () => { IAmbience ambience = csharpAmbience; if (entity is IMethod) { return ambience.Convert(entity as IMethod); } if (entity is IProperty) { return ambience.Convert(entity as IProperty); } if (entity is IEvent) { return ambience.Convert(entity as IEvent); } if (entity is IField) { return ambience.Convert(entity as IField); } if (entity is IClass) { return ambience.Convert(entity as IClass); } // unknown entity: return entity.ToString(); })); }
/// <summary> /// Converts a member to text. /// Returns the declaration of the member as C# or VB code, e.g. /// "public void MemberName(string parameter)" /// </summary> static string GetText(IEntity entity) { IAmbience ambience = csharpAmbience; if (entity is IMethod) { return(ambience.Convert(entity as IMethod)); } if (entity is IProperty) { return(ambience.Convert(entity as IProperty)); } if (entity is IEvent) { return(ambience.Convert(entity as IEvent)); } if (entity is IField) { return(ambience.Convert(entity as IField)); } if (entity is IClass) { return(ambience.Convert(entity as IClass)); } // unknown entity: return(entity.ToString()); }
static string GetMemberText(IAmbience ambience, IEntity member, string expression, out bool debuggerCanShowValue) { bool tryDisplayValue = false; debuggerCanShowValue = false; StringBuilder text = new StringBuilder(); if (member is IField) { text.Append(ambience.Convert(member as IField)); tryDisplayValue = true; } else if (member is IProperty) { text.Append(ambience.Convert(member as IProperty)); tryDisplayValue = true; } else if (member is IEvent) { text.Append(ambience.Convert(member as IEvent)); } else if (member is IMethod) { text.Append(ambience.Convert(member as IMethod)); } else if (member is IClass) { text.Append(ambience.Convert(member as IClass)); } else { text.Append("unknown member "); text.Append(member.ToString()); } if (tryDisplayValue && currentDebugger != null) { LoggingService.Info("asking debugger for value of '" + expression + "'"); string currentValue = currentDebugger.GetValueAsString(expression); if (currentValue != null) { debuggerCanShowValue = true; text.Append(" = "); text.Append(currentValue); } } string documentation = member.Documentation; if (documentation != null && documentation.Length > 0) { text.Append('\n'); text.Append(ICSharpCode.SharpDevelop.Editor.CodeCompletion.CodeCompletionItem.ConvertDocumentation(documentation)); } return(text.ToString()); }
public CodeCompletionData(IMember member) { this.entity = member; imageIndex = ClassBrowserIconService.GetIcon(member); IAmbience ambience = AmbienceService.GetCurrentAmbience(); ambience.ConversionFlags = ConversionFlags.None; text = ambience.Convert(member); ambience.ConversionFlags = ConversionFlags.StandardConversionFlags; description = ambience.Convert(member); InitializePriority(member.DotNetName); }
public CodeCompletionData(IClass c) { IAmbience ambience = AmbienceService.GetCurrentAmbience(); // save class (for the delegate description shortcut) this.entity = c; imageIndex = ClassBrowserIconService.GetIcon(c); ambience.ConversionFlags = ConversionFlags.ShowTypeParameterList; text = ambience.Convert(c); ambience.ConversionFlags = ConversionFlags.StandardConversionFlags | ConversionFlags.UseFullyQualifiedMemberNames; description = ambience.Convert(c); InitializePriority(c.DotNetName); }
public CodeCompletionData(IClass c) { ambience = Parser.ProjectParser.CurrentAmbience; // save class (for the delegate description shortcut) this.c = c; imageIndex = ScriptControl.GetIcon(c); ambience.ConversionFlags = ConversionFlags.None; text = ambience.Convert(c); ambience.ConversionFlags = ConversionFlags.UseFullyQualifiedNames | ConversionFlags.ShowReturnType | ConversionFlags.ShowModifiers; description = ambience.Convert(c); documentation = c.Documentation; GetPriority(c.DotNetName); }
object GenerateHeader() { IAmbience ambience = AmbienceService.GetCurrentAmbience(); ambience.ConversionFlags = ConversionFlags.StandardConversionFlags; if (headerText == null) { headerText = ambience.Convert(entity); } if (highlightParameter < 0) { return(headerText); } if (entity is IMethod) { var method = entity as IMethod; string param = ""; if (method.Parameters.Count > highlightParameter) { param = ambience.Convert(method.Parameters[highlightParameter]); } if (!string.IsNullOrEmpty(param)) { // append ',' or ')' to avoid missing highlighting if there are multiple parameter names starting with the same substring. string[] parts = headerText.Split(new[] { param + (method.Parameters.Count - 1 == highlightParameter ? ')' : ',') }, StringSplitOptions.None); if (parts.Length != 2) { return(headerText); } return(new TextBlock { // add text wrapping TextWrapping = TextWrapping.Wrap, Inlines = { parts[0], new Bold() { Inlines = { param } }, (method.Parameters.Count - 1 == highlightParameter ? ')' : ',') + parts[1] } }); } } return(headerText); }
object GenerateHeader() { IAmbience ambience = AmbienceService.GetCurrentAmbience(); ambience.ConversionFlags = ConversionFlags.StandardConversionFlags; if (headerText == null) { headerText = ambience.Convert(entity); } if (highlightParameter < 0) { return(headerText); } if (entity is IMethod) { var method = entity as IMethod; string param = ""; if (method.Parameters.Count > highlightParameter) { param = ambience.Convert(method.Parameters[highlightParameter]); } if (!string.IsNullOrEmpty(param)) { string[] parts = headerText.Split(new[] { param }, StringSplitOptions.None); if (parts.Length != 2) { return(headerText); } return(new Span() { Inlines = { parts[0], new Bold() { Inlines = { param } }, parts[1] } }); } } return(headerText); }
static string GetName(IMember member, ConversionFlags flags) { IAmbience ambience = AmbienceService.GetCurrentAmbience(); ambience.ConversionFlags = flags | ConversionFlags.ShowParameterNames | ConversionFlags.ShowTypeParameterList; return(ambience.Convert(member)); }
void FindOverrides(object sender, EventArgs e) { MenuCommand item = (MenuCommand)sender; IMember member = (IMember)item.Tag; IEnumerable <IClass> derivedClasses = RefactoringService.FindDerivedClasses(member.DeclaringType, ParserService.AllProjectContents, false); List <SearchResultMatch> results = new List <SearchResultMatch>(); IAmbience ambience = AmbienceService.GetCurrentAmbience(); ambience.ConversionFlags = ConversionFlags.UseFullyQualifiedMemberNames | ConversionFlags.ShowTypeParameterList; foreach (IClass derivedClass in derivedClasses) { if (derivedClass.CompilationUnit == null) { continue; } if (derivedClass.CompilationUnit.FileName == null) { continue; } IMember m = MemberLookupHelper.FindSimilarMember(derivedClass, member); if (m != null && !m.Region.IsEmpty) { string matchText = ambience.Convert(m); SearchResultMatch res = new SimpleSearchResultMatch(matchText, new TextLocation(m.Region.BeginColumn - 1, m.Region.BeginLine - 1)); res.ProvidedDocumentInformation = FindReferencesAndRenameHelper.GetDocumentInformation(m.DeclaringType.CompilationUnit.FileName); results.Add(res); } } SearchResultPanel.Instance.ShowSearchResults(new SearchResult( StringParser.Parse("${res:SharpDevelop.Refactoring.OverridesOf}", new string[, ] { { "Name", member.Name } }), results )); }
public override string ToString() { IAmbience ambience = AmbienceService.GetCurrentAmbience(); ambience.ConversionFlags = ConversionFlags.ShowReturnType | ConversionFlags.ShowModifiers; return(ambience.Convert(field)); }
public override string ToString() { IAmbience ambience = AmbienceService.GetCurrentAmbience(); ambience.ConversionFlags = ConversionFlags.ShowTypeParameterList; return(ambience.Convert(c)); }
public override string ToString() { IAmbience ambience = AmbienceService.CurrentAmbience; ambience.ConversionFlags = ConversionFlags.None; return(ambience.Convert(evt)); }
public override string ToString() { IAmbience ambience = AmbienceService.GetCurrentAmbience(); ambience.ConversionFlags = ConversionFlags.ShowParameterNames; return(ambience.Convert(property)); }
public GoToMemberAction(IMember member, IAmbience ambience) { if (ambience == null) throw new ArgumentNullException("ambience"); if (member == null) throw new ArgumentNullException("member"); this.Member = member; this.Title = ambience.Convert(member); }
public GoToClassAction(IClass c, IAmbience ambience) { if (ambience == null) throw new ArgumentNullException("ambience"); if (c == null) throw new ArgumentNullException("c"); this.Class = c; this.Title = ambience.Convert(c); }
public override string ToString() { if (cachedStringRepresentation == null) { IAmbience ambience = AmbienceService.GetCurrentAmbience(); ambience.ConversionFlags = ConversionFlags.ShowParameterNames; cachedStringRepresentation = ambience.Convert(method); } return(cachedStringRepresentation); }
void AddClasses(ArrayList items, ICollection <IClass> classes) { foreach (IClass c in classes) { IAmbience ambience = AmbienceService.GetCurrentAmbience(); ambience.ConversionFlags = ConversionFlags.UseFullyQualifiedMemberNames | ConversionFlags.ShowTypeParameterList; items.Add(new ComboBoxItem(c, ambience.Convert(c), ClassBrowserIconService.GetIcon(c), true)); AddClasses(items, c.InnerClasses); } }
/// <summary> /// Converts a member to text. /// Returns the declaration of the member as C# or VB code, e.g. /// "public void MemberName(string parameter)". /// </summary> /// <param name="entity">Entity that gets converted.</param> /// <returns>The result of the conversion.</returns> private static string GetText(IEntity entity) { IAmbience ambience = MainForm.IsVisualBasic ? (IAmbience)VbAmbience : CsharpAmbience; var method = entity as IMethod; if (method != null) { return(ambience.Convert(method)); } var property = entity as IProperty; if (property != null) { return(ambience.Convert(property)); } var entityAsEvent = entity as IEvent; if (entityAsEvent != null) { return(ambience.Convert(entityAsEvent)); } var field = entity as IField; if (field != null) { return(ambience.Convert(field)); } var entityAsClass = entity as IClass; if (entityAsClass != null) { return(ambience.Convert(entityAsClass)); } // unknown entity: return(entity.ToString()); }
internal static string GetMemberText(IAmbience ambience, IEntity member) { var text = new StringBuilder(); // ReSharper disable once CanBeReplacedWithTryCastAndCheckForNull if (member is IField) { text.Append(ambience.Convert((IField)member)); } else if (member is IProperty) { text.Append(ambience.Convert((IProperty)member)); } else if (member is IEvent) { text.Append(ambience.Convert((IEvent)member)); } else if (member is IMethod) { text.Append(ambience.Convert((IMethod)member)); } else if (member is IClass) { text.Append(ambience.Convert((IClass)member)); } else { text.Append("unknown member "); text.Append(member); } var documentation = member.Documentation; if (string.IsNullOrEmpty(documentation)) { return(text.ToString()); } text.Append('\n'); text.Append(CodeCompletionData.XmlDocumentationToText(documentation)); return(text.ToString()); }
public string GetInsightData(int number) { IMember method = methods[number]; IAmbience conv = AmbienceService.GetCurrentAmbience(); conv.ConversionFlags = ConversionFlags.StandardConversionFlags | ConversionFlags.UseFullyQualifiedMemberNames; string documentation = method.Documentation; string text = conv.Convert(method); return(text + "\n" + CodeCompletionData.ConvertDocumentation(documentation)); }
public CodeCompletionData(IProperty property) { _member = property; _ambience = Parser.ProjectParser.CurrentAmbience; _ambience.ConversionFlags = ConversionFlags.ShowReturnType | ConversionFlags.ShowParameterNames | ConversionFlags.ShowModifiers; _imageIndex = ScriptControl.GetIcon(property); _text = property.Name; _description = _ambience.Convert(property); _documentation = property.Documentation; GetPriority(property.DotNetName); }
public CodeCompletionData(IEvent e) { member = e; ambience = Parser.ProjectParser.CurrentAmbience; ambience.ConversionFlags = ConversionFlags.ShowReturnType | ConversionFlags.ShowParameterNames | ConversionFlags.ShowModifiers; imageIndex = ScriptControl.GetIcon(e); text = e.Name; description = ambience.Convert(e); documentation = e.Documentation; GetPriority(e.DotNetName); }
public CodeCompletionData(IEvent e) { member = e; ambience = AmbienceService.CurrentAmbience; ambience.ConversionFlags = ConversionFlags.ShowReturnType | ConversionFlags.ShowParameterNames | ConversionFlags.ShowModifiers; imageIndex = ClassBrowserIconService.GetIcon(e); text = e.Name; description = ambience.Convert(e); documentation = e.Documentation; GetPriority(e.DotNetName); }
protected override void PrepareMembersContent() { Items.Clear(); IMethod invokeMethod = RepresentedClassType.SearchMember("Invoke", RepresentedClassType.ProjectContent.Language) as IMethod; IAmbience ambience = GetAmbience(); foreach (IParameter par in invokeMethod.Parameters) { TextSegment ts = new TextSegment(Graphics, par.Name + " : " + ambience.Convert(par.ReturnType), MemberFont, true); Items.Add(ts); } }
private static string GetMemberText(IAmbience ambience, IEntity member) { StringBuilder text = new StringBuilder(); if (member is IField) { text.Append(ambience.Convert(member as IField)); } else if (member is IProperty) { text.Append(ambience.Convert(member as IProperty)); } else if (member is IEvent) { text.Append(ambience.Convert(member as IEvent)); } else if (member is IMethod) { text.Append(ambience.Convert(member as IMethod)); } else if (member is IClass) { text.Append(ambience.Convert(member as IClass)); } else { text.Append("unknown member "); text.Append(member.ToString()); } string documentation = member.Documentation; if (!string.IsNullOrEmpty(documentation)) { text.Append('\n'); text.Append(CodeCompletionData.XmlDocumentationToText(documentation)); } return(text.ToString()); }
public GoToClassAction(IClass c, IAmbience ambience) { if (ambience == null) { throw new ArgumentNullException("ambience"); } if (c == null) { throw new ArgumentNullException("c"); } this.Class = c; this.Title = ambience.Convert(c); }
public GoToMemberAction(IMember member, IAmbience ambience) { if (ambience == null) { throw new ArgumentNullException("ambience"); } if (member == null) { throw new ArgumentNullException("member"); } this.Member = member; this.Title = ambience.Convert(member); }
internal static string GetText(IClass c) { if (ICSharpCode.Core.PropertyService.Initialized) { IAmbience ambience = c.ProjectContent.Language.GetAmbience(); ambience.ConversionFlags = ConversionFlags.ShowTypeParameterList; return(ambience.Convert(c)); } else { return(c.Name); } }
public string GetInsightData(int number) { IMember method = methods[number]; IAmbience conv = AmbienceService.CurrentAmbience; conv.ConversionFlags = ConversionFlags.StandardConversionFlags; string documentation = method.Documentation; string text; if (method is IMethod) { text = conv.Convert(method as IMethod); } else if (method is IProperty) { text = conv.Convert(method as IProperty); } else { text = method.ToString(); } return(text + "\n" + CodeCompletionData.GetDocumentation(documentation)); }
static string GetMemberText(IAmbience ambience, IEntity member) { StringBuilder text = new StringBuilder(); if (member is IField) { text.Append(ambience.Convert(member as IField)); } else if (member is IProperty) { text.Append(ambience.Convert(member as IProperty)); } else if (member is IEvent) { text.Append(ambience.Convert(member as IEvent)); } else if (member is IMethod) { text.Append(ambience.Convert(member as IMethod)); } else if (member is IClass) { text.Append(ambience.Convert(member as IClass)); } else { text.Append("unknown member "); text.Append(member.ToString()); } string documentation = member.Documentation; if (documentation != null && documentation.Length > 0) { text.Append('\n'); text.Append(CodeCompletionData.XmlDocumentationToText(documentation)); } return text.ToString(); }
internal static string GetMemberText(IAmbience ambience, IEntity member) { var text = new StringBuilder(); if (member is IField) { text.Append(ambience.Convert(member as IField)); } else if (member is IProperty) { text.Append(ambience.Convert(member as IProperty)); } else if (member is IEvent) { text.Append(ambience.Convert(member as IEvent)); } else if (member is IMethod) { text.Append(ambience.Convert(member as IMethod)); } else if (member is IClass) { text.Append(ambience.Convert(member as IClass)); } else { text.Append("unknown member "); text.Append(member); } var documentation = member.Documentation; if (string.IsNullOrEmpty(documentation)) return text.ToString(); text.Append('\n'); text.Append(CodeCompletionData.XmlDocumentationToText(documentation)); return text.ToString(); }
public CodeCompletionData(IClass c) { ambience = AmbienceService.CurrentAmbience; // save class (for the delegate description shortcut) this.c = c; imageIndex = ClassBrowserIconService.GetIcon(c); ambience.ConversionFlags = ConversionFlags.None; text = ambience.Convert(c); ambience.ConversionFlags = ConversionFlags.UseFullyQualifiedNames | ConversionFlags.ShowReturnType | ConversionFlags.ShowModifiers; description = ambience.Convert(c); documentation = c.Documentation; GetPriority(c.DotNetName); }
static string GetMemberText(IAmbience ambience, IEntity member, string expression, out bool debuggerCanShowValue) { bool tryDisplayValue = false; debuggerCanShowValue = false; StringBuilder text = new StringBuilder(); if (member is IField) { text.Append(ambience.Convert(member as IField)); tryDisplayValue = true; } else if (member is IProperty) { text.Append(ambience.Convert(member as IProperty)); tryDisplayValue = true; } else if (member is IEvent) { text.Append(ambience.Convert(member as IEvent)); } else if (member is IMethod) { text.Append(ambience.Convert(member as IMethod)); } else if (member is IClass) { text.Append(ambience.Convert(member as IClass)); } else { text.Append("unknown member "); text.Append(member.ToString()); } if (tryDisplayValue && currentDebugger != null) { LoggingService.Info("asking debugger for value of '" + expression + "'"); string currentValue = currentDebugger.GetValueAsString(expression); if (currentValue != null) { debuggerCanShowValue = true; text.Append(" = "); text.Append(currentValue); } } string documentation = member.Documentation; if (documentation != null && documentation.Length > 0) { text.Append('\n'); text.Append(ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor.CodeCompletionData.ConvertDocumentation(documentation)); } return text.ToString(); }