private LookupList GetTagLookupList(AspNetTag tag) { List <Type> controlTypes = GetTagControlTypes(tag); List <LookupListItem> lookupItems = new List <LookupListItem>(); foreach (Type type in controlTypes) { LookupListItem item = GetItem(type); item.Category = QuickSharp.CodeAssist.Constants.WEBCONTROL; item.MenuItems.Clear(); lookupItems.Add(item); } string insertionTemplate = String.Format("{0}>", QuickSharp.CodeAssist.Constants. INSERTION_TEMPLATE_TEXT_PLACEHOLDER); if (!tag.ClosingTag) { insertionTemplate = String.Format( "{0} ID=\"{1}\" runat=\"server\"></{2}:{0}>", QuickSharp.CodeAssist.Constants. INSERTION_TEMPLATE_TEXT_PLACEHOLDER, QuickSharp.CodeAssist.Constants. INSERTION_TEMPLATE_CPOS_PLACEHOLDER, tag.TagPrefix); } return(new LookupList( tag.LookAhead, lookupItems, insertionTemplate)); }
protected List <LookupListItem> BuildSchemaTableList(Schema schema) { List <LookupListItem> list = new List <LookupListItem>(); foreach (Table table in schema.Tables.Values) { LookupListItem item = new LookupListItem(); item.DisplayText = table.Name; item.InsertText = GetEscapedName(table.Name); if (table.IsView) { item.ToolTipText = String.Format("{0} {1}", Resources.TooltipView, GetEscapedFullName(table.FullName)); item.Category = QuickSharp.CodeAssist.Constants.VIEW; } else { item.ToolTipText = String.Format("{0} {1}", Resources.TooltipTable, GetEscapedFullName(table.FullName)); item.Category = QuickSharp.CodeAssist.Constants.TABLE; } list.Add(item); } return(list); }
private void AddField( Dictionary <String, LookupListItem> foundItems, MemberInfo item) { FieldInfo fi = (FieldInfo)item; if (fi.IsPrivate) { return; } if (!foundItems.ContainsKey(fi.Name)) { LookupListItem li = new LookupListItem(); li.DisplayText = fi.Name; li.InsertText = fi.Name; li.ToolTipText = String.Format("{0} {1}", JScriptFormattingTools.GetTypeSignature(fi.FieldType), fi.Name); if (fi.IsLiteral) { if (fi.IsPublic) { li.Category = QuickSharp.CodeAssist.Constants.CONSTANT; } else { li.Category = QuickSharp.CodeAssist.Constants.CONSTANT_FRIEND; } } else { if (fi.IsPublic) { li.Category = QuickSharp.CodeAssist.Constants.FIELD; } else if (fi.IsFamily) { li.Category = QuickSharp.CodeAssist.Constants.EXCEPTION_PROTECTED; } else if (fi.IsPrivate) { li.Category = QuickSharp.CodeAssist.Constants.FIELD_PRIVATE; } else { li.Category = QuickSharp.CodeAssist.Constants.FIELD_FRIEND; } } foundItems.Add(li.DisplayText, li); } }
private void AddProperty( Dictionary <String, LookupListItem> foundItems, MemberInfo item) { PropertyInfo pi = (PropertyInfo)item; if (!foundItems.ContainsKey(pi.Name)) { LookupListItem li = new LookupListItem(); li.DisplayText = pi.Name; li.InsertText = pi.Name; li.Category = QuickSharp.CodeAssist.Constants.PROPERTIES; li.ToolTipText = String.Format("{0} {1}", JScriptFormattingTools.GetTypeSignature(pi.PropertyType), pi.Name); foundItems.Add(pi.Name, li); } else { foundItems[pi.Name].ToolTipText = String.Format("{0} {1}", JScriptFormattingTools.GetTypeSignature(pi.PropertyType), pi.Name); } }
private List <LookupListItem> GetPropertyValueList( List <string> cssPropertyValues) { List <LookupListItem> list = new List <LookupListItem>(); foreach (string s in cssPropertyValues) { LookupListItem item = new LookupListItem(); if (s.StartsWith("~")) { item.DisplayText = s.Substring(1); item.InsertText = String.Empty; item.Category = QuickSharp.CodeAssist.Constants.FIELD; } else if (s.StartsWith("#")) { item.DisplayText = s.Substring(1); item.InsertText = String.Empty; item.Category = QuickSharp.CodeAssist.Constants.EXCEPTION; } else { item.DisplayText = s; item.InsertText = s; item.Category = QuickSharp.CodeAssist.Constants.CONSTANT; } list.Add(item); } return(list); }
/* * Find the immediate child namespaces belonging to a namespace. */ protected List <LookupListItem> FindNamespaceChildLookupItems( string parentNamespace) { List <String> foundNamespaces = new List <String>(); foreach (string ns in fullNamespaceList) { if (ns == parentNamespace) { continue; } if (ns.StartsWith(parentNamespace)) { string childNamespace = ns.Substring(parentNamespace.Length); if (childNamespace[0] != '.') { continue; } string[] split = childNamespace.Split('.'); if (String.IsNullOrEmpty(split[1])) { continue; } if (!foundNamespaces.Contains(split[1])) { foundNamespaces.Add(split[1]); } } } List <LookupListItem> listItems = new List <LookupListItem>(); foreach (string ns in foundNamespaces) { LookupListItem lli = new LookupListItem(); lli.DisplayText = ns; lli.InsertText = ns; lli.ToolTipText = String.Format("namespace {0}", ns); lli.Category = QuickSharp.CodeAssist.Constants.NAMESPACE; listItems.Add(lli); } if (listItems.Count > 0) { return(listItems); } else { return(null); } }
/* * Create a LookupListItem from a type. */ protected LookupListItem GetItem(Type type) { string typeName = CSharpFormattingTools.GetTypeSignature(type); string fullName = CSharpFormattingTools.GetTypeSignature(type, true); LookupListItem item = new LookupListItem(); item.DisplayText = typeName; item.InsertText = type.ContainsGenericParameters ? CSharpFormattingTools.RemoveGenericSignature(typeName) : typeName; // Classify the type - order is important here if (type.IsClass && type.IsSubclassOf(typeof(System.Delegate))) { item.Category = QuickSharp.CodeAssist.Constants.DELEGATE; item.ToolTipText = String.Format("delegate {0}", fullName); } else if (type.IsEnum) { item.Category = QuickSharp.CodeAssist.Constants.ENUM; item.ToolTipText = String.Format("enum {0}", fullName); } else if (type.IsValueType) { item.Category = QuickSharp.CodeAssist.Constants.VALUETYPE; item.ToolTipText = String.Format("struct {0}", fullName); AddConstructors(type, item); } else if (type.IsInterface) { item.Category = QuickSharp.CodeAssist.Constants.INTERFACE; item.ToolTipText = String.Format("interface {0}", fullName); } else { if (type.IsSealed) { item.Category = QuickSharp.CodeAssist.Constants.CLASS_SEALED; } else { item.Category = QuickSharp.CodeAssist.Constants.CLASS; } item.ToolTipText = String.Format("class {0}", fullName); AddConstructors(type, item); } return(item); }
public List <LookupListItem> GetList( DeclarationContext declarationContext) { List <LookupListItem> list = new List <LookupListItem>(); foreach (PropertyDefinition property in _properties) { /* * Can only see statics in a static context. */ if (declarationContext == DeclarationContext.Static && !property.IsStatic) { continue; } /* * Add the property to the list. */ LookupListItem listItem = new LookupListItem(); listItem.DisplayText = property.Name; if (property.Visibility == "internal" || property.IsProtectedInternal) { listItem.Category = QuickSharp.CodeAssist.Constants.PROPERTIES_FRIEND; } else if (property.Visibility == "protected") { listItem.Category = QuickSharp.CodeAssist.Constants.PROPERTIES_PROTECTED; } else if (property.Visibility == "private") { listItem.Category = QuickSharp.CodeAssist.Constants.PROPERTIES_PRIVATE; } else { listItem.Category = QuickSharp.CodeAssist.Constants.PROPERTIES; } listItem.ToolTipText = String.Format("{0} {1}", property.ReturnType, property.Name); listItem.InsertText = property.Name; list.Add(listItem); } return(list); }
protected List <LookupListItem> GetImmediateChildNamespaces( string target) { List <String> foundItems = new List <String>(); if (target == String.Empty) { foundItems.AddRange(rootNamespaceList); } else { foreach (string name in fullNamespaceList) { if (name == target) { continue; } if (!name.StartsWith(target)) { continue; } string child = name.Substring(target.Length); if (child[0] != '.') { continue; } string[] split = child.Split('.'); if (!foundItems.Contains(split[1])) { foundItems.Add(split[1]); } } } List <LookupListItem> namespaces = new List <LookupListItem>(); foreach (string name in foundItems) { LookupListItem li = new LookupListItem(); li.DisplayText = name; li.InsertText = name; li.ToolTipText = String.Format("namespace {0}", name); li.Category = QuickSharp.CodeAssist.Constants.NAMESPACE; namespaces.Add(li); } return(namespaces); }
private List <LookupListItem> GetAttributeList(string tag, bool isHTML5) { string attributes = String.Empty; if (isHTML5) { if (!html5TagDictionary.ContainsKey(tag)) { return(null); } attributes = html5TagDictionary[tag].Attributes; attributes += GLOBAL; } else { if (!xhtmlTagDictionary.ContainsKey(tag)) { return(null); } attributes = xhtmlTagDictionary[tag].Attributes; attributes = attributes.Replace("CORE", CORE); attributes = attributes.Replace("I18N", I18N); attributes = attributes.Replace("EVENT", EVENT); } attributes = attributes.Trim(); if (attributes == String.Empty) { return(null); } List <LookupListItem> list = new List <LookupListItem>(); string[] split = attributes.Split(); foreach (string attr in split) { LookupListItem item = new LookupListItem(); item.DisplayText = attr; item.InsertText = attr; item.Category = QuickSharp.CodeAssist.Constants.PROPERTIES; list.Add(item); } return(list); }
private List <LookupListItem> GetPropertyList( Dictionary <string, List <string> > cssProperties) { List <LookupListItem> list = new List <LookupListItem>(); foreach (string s in cssProperties.Keys) { LookupListItem item = new LookupListItem(); item.DisplayText = s; item.InsertText = s; item.Category = QuickSharp.CodeAssist.Constants.PROPERTIES; list.Add(item); } return(list); }
private void AddExtensionMethod( Dictionary <String, LookupListItem> foundItems, MethodInfo mi) { if (!foundItems.ContainsKey(mi.Name)) { LookupListItem lli = new LookupListItem(); lli.DisplayText = mi.Name; lli.InsertText = mi.Name; lli.ToolTipText = String.Format( "{0} {1}_OVR_\r\nDeclared in: {2}", CSharpFormattingTools.GetTypeSignature(mi.ReturnType), CSharpFormattingTools.GetMethodSignature(mi, true, true), mi.DeclaringType.FullName); lli.Category = QuickSharp.CodeAssist.Constants.METHOD_EXTENSION; LookupMenuItem lmi = new LookupMenuItem(); lmi.DisplayText = String.Format("{0} {1}", CSharpFormattingTools.GetTypeSignature(mi.ReturnType), CSharpFormattingTools.GetMethodSignature(mi, true, true)); lmi.InsertText = CSharpFormattingTools.GetMethodSignature(mi, true, true); lli.MenuItems.Add(lmi); foundItems.Add(lli.DisplayText, lli); } else { // Overloaded methods LookupListItem lli = foundItems[mi.Name]; LookupMenuItem lmi = new LookupMenuItem(); lmi.DisplayText = String.Format("{0} {1}", CSharpFormattingTools.GetTypeSignature(mi.ReturnType), CSharpFormattingTools.GetMethodSignature(mi, true, true)); lmi.InsertText = CSharpFormattingTools.GetMethodSignature(mi, true, true); lli.MenuItems.Add(lmi); } }
protected List <LookupListItem> GetVisibleTypes( string source, DeclaredVariables variables, bool includeNamespaces, bool includeVariables) { List <LookupListItem> list = new List <LookupListItem>(); if (includeNamespaces) { /* * Add all members of declared namespaces. */ List <LookupListItem> itemList = FindNamespaceTypeLookupItems( GetNamespaceList(source)); if (itemList != null) { list.AddRange(itemList); } } if (includeVariables) { /* * Add visible declared variables. */ foreach (Variable v in variables.Items) { LookupListItem item = new LookupListItem(); item.DisplayText = v.Name; item.InsertText = v.Name; item.Category = QuickSharp.CodeAssist.Constants.FIELD; item.ToolTipText = String.Format("{0} {1}", v.GetVariableType(), v.Name); list.Add(item); } } return(list); }
private void AddEvent( Dictionary <String, LookupListItem> foundItems, MemberInfo item) { EventInfo ei = (EventInfo)item; if (!foundItems.ContainsKey(ei.Name)) { LookupListItem li = new LookupListItem(); li.DisplayText = ei.Name; li.InsertText = ei.Name; li.ToolTipText = ei.EventHandlerType.Name; li.Category = QuickSharp.CodeAssist.Constants.EVENT; foundItems.Add(li.DisplayText, li); } }
protected List <LookupListItem> BuildSchemaList() { List <LookupListItem> list = new List <LookupListItem>(); foreach (Schema schema in activeDatabase.Schemata.Values) { LookupListItem item = new LookupListItem(); item.DisplayText = schema.Name; item.InsertText = GetEscapedName(schema.Name); item.ToolTipText = String.Format("{0} {1}", Resources.TooltipSchema, GetEscapedName(schema.Name)); item.Category = QuickSharp.CodeAssist.Constants.NAMESPACE; list.Add(item); } return(list); }
public IEnumerable <LookupListItem <Guid?> > GetProjectIterationsForMenu(Guid?projectId) { List <LookupListItem <Guid?> > result = new List <LookupListItem <Guid?> >(); if (projectId == null) { return(result); } Dictionary <string, string> additonProperty = new Dictionary <string, string>(); additonProperty["IterationNameAndTime"] = "null"; CriteriaOperator filter = new BinaryOperator("ProjectId", projectId); var iterationList = _objectSpace.GetObjects("ProjectIteration", filter, additonProperty) .AsQueryable().OrderBy("StartDate desc"); Katrin.Domain.Impl.ProjectTask task = this.GetSelectedEntity(); Guid?defaultIterationId = task.ProjectIterationId; var displayNameFormat = "{0} ({1:yy/MM/dd} - {2:yy/MM/dd})"; string unassignCaption = ResourceService.GetString("Unassigned"); LookupListItem <Guid?> itemUnassign = new LookupListItem <Guid?>(); itemUnassign.DisplayName = unassignCaption; itemUnassign.Value = null; itemUnassign.IsDeafult = task.ProjectIterationId == null; result.Add(itemUnassign); foreach (var iterationObj in iterationList) { var iteration = ConvertData.Convert <Katrin.Domain.Impl.ProjectIteration>(iterationObj); Guid projectIterationId = iteration.ProjectIterationId; bool isDefault = projectIterationId == defaultIterationId; LookupListItem <Guid?> item = new LookupListItem <Guid?>(); item.Value = projectIterationId; item.IsDeafult = isDefault; item.DisplayName = string.Format(displayNameFormat, iteration.Name, iteration.StartDate, iteration.Deadline); result.Add(item); } return(result); }
private List <LookupListItem> GetAttributeValueList(string tag, string attr, bool isHTML5) { // Set the dictionary Dictionary <String, String> attrDictionary = (isHTML5 ? html5AttrDictionary : xhtmlAttrDictionary); // Try tag specific value first... string key = String.Format("{0}|{1}", tag, attr); // If not found, try generic... if (!attrDictionary.ContainsKey(key)) { key = attr; // Fail if not found if (!attrDictionary.ContainsKey(key)) { return(null); } } string values = attrDictionary[key].Trim(); if (values == String.Empty) { return(null); } List <LookupListItem> list = new List <LookupListItem>(); string[] split = values.Split(); foreach (string val in split) { LookupListItem item = new LookupListItem(); item.DisplayText = val; item.InsertText = val; item.Category = QuickSharp.CodeAssist.Constants.CONSTANT; list.Add(item); } return(list); }
protected void AddConstructors(Type type, LookupListItem item) { BindingFlags bindingAttr = BindingFlags.Public | BindingFlags.FlattenHierarchy | BindingFlags.Instance; ConstructorInfo[] cia = type.GetConstructors(bindingAttr); foreach (ConstructorInfo ci in cia) { LookupMenuItem lmi = new LookupMenuItem(); lmi.DisplayText = CSharpFormattingTools. GetConstructorSignature(ci, type); lmi.InsertText = CSharpFormattingTools. GetMinimalConstructorSignature(ci, type); item.MenuItems.Add(lmi); } }
private List <LookupListItem> GetTagList(bool isHTML5) { // Set the dictionary Dictionary <String, TagItem> tagDictionary = (isHTML5 ? html5TagDictionary : xhtmlTagDictionary); // Get the tags List <LookupListItem> list = new List <LookupListItem>(); foreach (string tag in tagDictionary.Keys) { LookupListItem item = new LookupListItem(); item.DisplayText = tag; item.InsertText = tag; item.TemplateIndex = tagDictionary[tag].TemplateIndex; item.Category = QuickSharp.CodeAssist.Constants.WEBCONTROL; list.Add(item); } return(list); }
protected List <LookupListItem> BuildTableAliasList() { List <LookupListItem> list = new List <LookupListItem>(); foreach (TableAlias alias in tableAliases.Values) { LookupListItem item = new LookupListItem(); item.DisplayText = alias.DisplayName; item.InsertText = GetEscapedFullName(alias.DisplayName); item.ToolTipText = String.Format("{0} {1} = {2}", Resources.TooltipAlias, GetEscapedFullName(alias.DisplayName), GetEscapedFullName(alias.TableDisplayName)); item.Category = QuickSharp.CodeAssist.Constants.TABLE_ALIAS; list.Add(item); } return(list); }
protected List <LookupListItem> BuildTableColumnList(Table table) { List <LookupListItem> list = new List <LookupListItem>(); foreach (TableColumn col in table.Columns) { LookupListItem item = new LookupListItem(); item.DisplayText = col.Name; item.InsertText = GetEscapedName(col.Name); item.ToolTipText = String.Format("{0} {1}.{2}", col.Type, GetEscapedFullName(table.FullName), GetEscapedName(col.Name)); item.Category = QuickSharp.CodeAssist.Constants.FIELD; list.Add(item); } return(list); }
private void AddEvent( Dictionary <String, LookupListItem> foundItems, MemberInfo memberInfo, string targetName, int lineStartPos) { EventInfo ei = (EventInfo)memberInfo; if (!foundItems.ContainsKey(ei.Name)) { LookupListItem li = new LookupListItem(); li.DisplayText = ei.Name; li.InsertText = ei.Name; li.ToolTipText = ei.EventHandlerType.Name; li.Category = QuickSharp.CodeAssist.Constants.EVENT; AddEventHandlerMenuItems( targetName, ei.Name, ei.EventHandlerType, lineStartPos, li); foundItems.Add(li.DisplayText, li); } }
public List <LookupListItem> GetList(int lineStartPos) { List <LookupListItem> list = new List <LookupListItem>(); foreach (Variable v in _declaredVariables) { LookupListItem item = new LookupListItem(); item.DisplayText = v.Name; item.InsertText = v.Name; item.Category = QuickSharp.CodeAssist.Constants.FIELD; item.ToolTipText = String.Format("{0} {1}", FormatNestedType(v.GetVariableType()), v.Name); item.MenuItems.Add( GetPropertyMenuItem(v, lineStartPos)); list.Add(item); } return(list); }
public IEnumerable <LookupListItem <Guid?> > GetProjectMembersForMemu(Guid?projectId) { List <LookupListItem <Guid?> > result = new List <LookupListItem <Guid?> >(); if (projectId == null) { return(result); } Dictionary <string, string> additonProperty = new Dictionary <string, string>(); additonProperty["Member"] = "Member"; CriteriaOperator filter = new BinaryOperator("ProjectId", projectId); var memberList = _objectSpace.GetObjects("ProjectMember", filter, additonProperty); Katrin.Domain.Impl.ProjectTask task = this.GetSelectedEntity(); //add unassign string unassignCaption = ResourceService.GetString("Unassigned"); LookupListItem <Guid?> itemUnassign = new LookupListItem <Guid?>(); itemUnassign.DisplayName = unassignCaption; itemUnassign.Value = null; itemUnassign.IsDeafult = task.OwnerId == null; result.Add(itemUnassign); foreach (var member in memberList) { var projectMemeber = ConvertData.Convert <Katrin.Domain.Impl.ProjectMember>(member); LookupListItem <Guid?> item = new LookupListItem <Guid?>(); item.Value = projectMemeber.Member.UserId; item.IsDeafult = task.OwnerId == item.Value; item.DisplayName = projectMemeber.Member.FullName; result.Add(item); } return(result); }
private LookupList GetDollarExpressionLookupList(Match match) { /* * Only create the list if there's one to create! */ if (_webConfigAppSettings.Count == 0 && _webConfigConnectionStrings.Count == 0) { return(null); } /* * Get the appropriate list. */ // No lookup before end tag if (match.Groups[4].Value != String.Empty) { return(null); } List <LookupListItem> items = new List <LookupListItem>(); if (match.Groups[2].Value == String.Empty) { LookupListItem item1 = new LookupListItem(); item1.DisplayText = Constants.APP_SETTINGS; item1.InsertText = Constants.APP_SETTINGS + ":"; item1.Category = QuickSharp.CodeAssist.Constants.PROPERTIES; items.Add(item1); LookupListItem item2 = new LookupListItem(); item2.DisplayText = Constants.CONNECTION_STRINGS; item2.InsertText = Constants.CONNECTION_STRINGS + ":"; item2.Category = QuickSharp.CodeAssist.Constants.PROPERTIES; items.Add(item2); return(new LookupList(match.Groups[1].Value, items)); } if (match.Groups[1].Value == Constants.APP_SETTINGS) { foreach (String appSetting in _webConfigAppSettings) { LookupListItem item = new LookupListItem(); item.DisplayText = appSetting; item.InsertText = appSetting; item.Category = QuickSharp.CodeAssist.Constants.CONSTANT; items.Add(item); } } if (match.Groups[1].Value == Constants.CONNECTION_STRINGS) { foreach (String connectionString in _webConfigConnectionStrings) { LookupListItem item = new LookupListItem(); item.DisplayText = connectionString; item.InsertText = connectionString; item.Category = QuickSharp.CodeAssist.Constants.CONSTANT; items.Add(item); } } return(new LookupList(match.Groups[3].Value, items)); }
private LookupList GetTagAttributesLookupList(AspNetTag tag) { string controlName = tag.LookAhead.ToLower(); Type controlType = null; foreach (Type t in GetTagControlTypes(tag)) { if (controlName == t.Name.ToLower()) { controlType = t; break; } } if (controlType == null) { return(null); } /* * Get the public properties. */ List <LookupListItem> items = new List <LookupListItem>(); BindingFlags flags = BindingFlags.Public | BindingFlags.FlattenHierarchy | BindingFlags.Instance; List <String> foundNames = new List <String>(); foreach (MethodInfo mi in controlType.GetMethods(flags)) { if (!mi.Name.StartsWith("set_") && !mi.Name.StartsWith("add_")) { continue; } string name = mi.Name.Substring(4); if (mi.Name.StartsWith("add_")) { name = "On" + name; } if (foundNames.Contains(name)) { continue; } foundNames.Add(name); LookupListItem li = new LookupListItem(); li.DisplayText = name; li.InsertText = name; li.Category = QuickSharp.CodeAssist.Constants.PROPERTIES; items.Add(li); } /* * Get the lookahead. */ string lookAhead = String.Empty; string[] split = tag.Context.Split(' '); if (split[split.Length - 1] != String.Empty) { lookAhead = split[split.Length - 1]; } lookAhead = lookAhead.Trim(); string insertionTemplate = String.Format("{0}=\"{1}\"", QuickSharp.CodeAssist.Constants. INSERTION_TEMPLATE_TEXT_PLACEHOLDER, QuickSharp.CodeAssist.Constants. INSERTION_TEMPLATE_CPOS_PLACEHOLDER); return(new LookupList(lookAhead, items, insertionTemplate)); }
private LookupList GetDirectiveSectionLookupList( string text, int pos) { text = text.Substring(0, pos); // Save for later string lastToken = GetLastToken(text); int i = text.LastIndexOf("<%@"); if (i == -1) { return(null); } text = text.Substring(i); Regex re = new Regex(@"<%@\s+(\w*)(\s*)"); Match match = re.Match(text); if (!match.Success) { return(null); } // Get directive string name = match.Groups[1].Value; List <LookupListItem> items = new List <LookupListItem>(); if (match.Groups[2].Value == String.Empty) { // Get Directive list foreach (string key in _pageDirectives.Keys) { LookupListItem item = new LookupListItem(); item.DisplayText = item.InsertText = key; item.Category = QuickSharp.CodeAssist.Constants.VALUETYPE; items.Add(item); } string insertionTemplate = String.Format("{0} ", QuickSharp.CodeAssist.Constants. INSERTION_TEMPLATE_TEXT_PLACEHOLDER); return(new LookupList(name, items, insertionTemplate)); } else { // Get attribute list if (!_pageDirectives.ContainsKey(name)) { return(null); } string[] split = _pageDirectives[name].Split(); foreach (string attribute in split) { LookupListItem item = new LookupListItem(); item.DisplayText = item.InsertText = attribute; item.Category = QuickSharp.CodeAssist.Constants.PROPERTIES; items.Add(item); } string insertionTemplate = String.Format("{0}=\"{1}\"", QuickSharp.CodeAssist.Constants. INSERTION_TEMPLATE_TEXT_PLACEHOLDER, QuickSharp.CodeAssist.Constants. INSERTION_TEMPLATE_CPOS_PLACEHOLDER); return(new LookupList(lastToken, items, insertionTemplate)); } }
public List <LookupListItem> GetList( DeclarationContext declarationContext) { Dictionary <String, LookupListItem> dict = new Dictionary <String, LookupListItem>(); foreach (MethodDefinition method in _methods) { /* * Hide any dummy methods used intenally. * The convention is that such methods begin * with a '0' which is illegal in C#. */ if (method.Name[0] == '0') { continue; } /* * Check visibility of methods. */ bool showMethod = false; if (method.IsStatic && declarationContext != DeclarationContext.Instance) { showMethod = true; } if (!method.IsStatic && declarationContext != DeclarationContext.Static) { showMethod = true; } if (!showMethod) { continue; } /* * Add the method to the list. */ if (!dict.ContainsKey(method.Name)) { LookupListItem listItem = new LookupListItem(); listItem.DisplayText = method.Name; if (method.Visibility == "internal" || method.IsProtectedInternal) { listItem.Category = QuickSharp.CodeAssist.Constants.METHOD_FRIEND; } else if (method.Visibility == "protected") { listItem.Category = QuickSharp.CodeAssist.Constants.METHOD_PROTECTED; } else if (method.Visibility == "private") { listItem.Category = QuickSharp.CodeAssist.Constants.METHOD_PRIVATE; } else { listItem.Category = QuickSharp.CodeAssist.Constants.METHOD; } if (method.ReturnType != null) { listItem.ToolTipText = String.Format("{0} {1}({2})", method.ReturnType, method.Name, method.Parameters); } else { listItem.ToolTipText = String.Format("{0}({1})", method.Name, method.Parameters); } listItem.InsertText = method.Name; LookupMenuItem menuItem = new LookupMenuItem(); menuItem.DisplayText = listItem.ToolTipText; menuItem.InsertText = String.Format("{0}({1})", method.Name, GetParameterNames(method)); listItem.MenuItems.Add(menuItem); dict[method.Name] = listItem; } else { LookupListItem listItem = dict[method.Name]; LookupMenuItem menuItem = new LookupMenuItem(); if (method.ReturnType != null) { menuItem.DisplayText = String.Format("{0} {1}({2})", method.ReturnType, method.Name, method.Parameters); } else { menuItem.DisplayText = String.Format("{0}({1})", method.Name, method.Parameters); } menuItem.InsertText = String.Format("{0}({1})", method.Name, method.Parameters); listItem.MenuItems.Add(menuItem); } } /* * Convert the dictionary to a list and fixup the * overloaded items to show the correct icon and * tooltip text. */ List <LookupListItem> list = new List <LookupListItem>(); foreach (LookupListItem listItem in dict.Values) { if (listItem.MenuItems.Count > 1) { switch (listItem.Category) { case QuickSharp.CodeAssist.Constants.METHOD_FRIEND: listItem.Category = QuickSharp.CodeAssist.Constants.METHODOVERLOAD_FRIEND; break; case QuickSharp.CodeAssist.Constants.METHOD_PROTECTED: listItem.Category = QuickSharp.CodeAssist.Constants.METHODOVERLOAD_PROTECTED; break; case QuickSharp.CodeAssist.Constants.METHOD_PRIVATE: listItem.Category = QuickSharp.CodeAssist.Constants.METHODOVERLOAD_PRIVATE; break; default: listItem.Category = QuickSharp.CodeAssist.Constants.METHODOVERLOAD; break; } listItem.ToolTipText = String.Format("{0} (+{1} {2})", listItem.ToolTipText, listItem.MenuItems.Count - 1, listItem.MenuItems.Count == 2 ? "overload" : "overloads"); } list.Add(listItem); } return(list); }
/* * Create a LookupListItem from a type. */ protected LookupListItem GetItem(Type type) { string typeName = CSharpFormattingTools.GetTypeSignature(type); string fullName = CSharpFormattingTools.GetTypeSignature(type, true); LookupListItem item = new LookupListItem(); item.DisplayText = typeName; item.InsertText = type.ContainsGenericParameters ? CSharpFormattingTools.RemoveGenericSignature(typeName) : typeName; // Classify the type - order is important here if (type.IsClass && type.IsSubclassOf(typeof(System.Delegate))) { item.Category = QuickSharp.CodeAssist.Constants.DELEGATE; item.ToolTipText = String.Format("delegate {0}", fullName); } else if (type.IsEnum) { item.Category = QuickSharp.CodeAssist.Constants.ENUM; item.ToolTipText = String.Format("enum {0}", fullName); } else if (type.IsValueType) { item.Category = QuickSharp.CodeAssist.Constants.VALUETYPE; item.ToolTipText = String.Format("struct {0}", fullName); } else if (type.IsInterface) { item.Category = QuickSharp.CodeAssist.Constants.INTERFACE; item.ToolTipText = String.Format("interface {0}", fullName); } else { if (type.IsSealed) { item.Category = QuickSharp.CodeAssist.Constants.CLASS_SEALED; } else { item.Category = QuickSharp.CodeAssist.Constants.CLASS; } item.ToolTipText = String.Format("class {0}", fullName); BindingFlags bindingAttr = BindingFlags.Public | BindingFlags.FlattenHierarchy | BindingFlags.Instance; ConstructorInfo[] cia = type.GetConstructors(bindingAttr); foreach (ConstructorInfo ci in cia) { LookupMenuItem lmi = new LookupMenuItem(); lmi.DisplayText = JScriptFormattingTools. GetConstructorSignature(ci, type); lmi.InsertText = JScriptFormattingTools. GetMinimalConstructorSignature(ci, type); item.MenuItems.Add(lmi); } } return(item); }
public void DimensionItemChange(ArrayList dimensions) { if (dimensions == null) { return; } if (widths.Count <= 0) { for (int p = 0; p < arrColums.Count(); p++) { widths.Add(this.FindControl(arrColums[p] + "Cell", false).WidthF); weights.Add(((XRTableCell)this.FindControl(arrColums[p] + "Cell", false)).Weight); } } float width = DimensionCell.WidthF; if (firstWeight == 0) { firstWeight = UnitNameCell.Weight; } double weight = firstWeight; float avgWidth = width / (dimensions.Count + 1); double avgWeight = weight / (dimensions.Count + 1); dimensionRow.Cells.Clear(); dimensionCellRow.Cells.Clear(); XRTableCell headerCell = new XRTableCell(); headerCell.Text = GetLocalizedCaption("UnitType"); headerCell.WidthF = avgWidth; headerCell.BackColor = Color.FromArgb(196, 220, 255); headerCell.TextAlignment = TextAlignment.MiddleCenter; headerCell.Borders = BorderSide.Left | BorderSide.Top; headerCell.Weight = avgWeight; headerCell.Font = new System.Drawing.Font("Tahoma", 8, FontStyle.Bold); headerCell.ForeColor = Color.Black; headerCell.BorderColor = Color.White; XRTableCell detailCell = new XRTableCell(); detailCell.BackColor = Color.FromArgb(255, 237, 196); detailCell.BorderColor = Color.FromArgb(232, 205, 162); detailCell.Borders = BorderSide.Left | BorderSide.Top; detailCell.TextAlignment = TextAlignment.MiddleCenter; detailCell.WidthF = avgWidth; detailCell.Weight = avgWeight; detailCell.DataBindings.Add("Text", null, "UnitName"); dimensionRow.Cells.Add(headerCell); dimensionCellRow.Cells.Add(detailCell); bool resetDemenIndex = true; dimensionCount = dimensions.Count; if (dimensions.Count > 1) { PageHeader.Visible = true; Detail.Visible = true; ReportFooter.Visible = false; } else { SelectChart(chartSelectValue); } foreach (var item in dimensions) { LookupListItem <int?> lookup = (LookupListItem <int?>)item; headerCell = new XRTableCell(); headerCell.Text = lookup.DisplayName; headerCell.WidthF = avgWidth; detailCell = new XRTableCell(); detailCell.DataBindings.Add("Text", null, ((Dimension)lookup.Value).ToString()); detailCell.WidthF = avgWidth; if (lookup.Value == dimsionValue) { resetDemenIndex = false; } headerCell.Borders = BorderSide.Left | BorderSide.Top; headerCell.BackColor = Color.FromArgb(196, 220, 255); headerCell.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; headerCell.Weight = avgWeight; headerCell.Font = new System.Drawing.Font("Tahoma", 8, FontStyle.Bold); headerCell.ForeColor = Color.Black; headerCell.BorderColor = Color.White; detailCell.BackColor = Color.FromArgb(255, 237, 196); detailCell.BorderColor = Color.FromArgb(232, 205, 162); detailCell.Borders = BorderSide.Left | BorderSide.Top; detailCell.TextAlignment = TextAlignment.MiddleCenter; detailCell.Weight = avgWeight; dimensionRow.Cells.Add(headerCell); dimensionCellRow.Cells.Add(detailCell); } if (resetDemenIndex) { dimsionValue = 0; } for (int i = 0; i < arrColums.Count(); i++) { headerCell = new XRTableCell(); headerCell.Text = GetLocalizedCaption(arrColums[i]); headerCell.WidthF = widths[i]; headerCell.Weight = weights[i]; detailCell = new XRTableCell(); if (isRate[i]) { detailCell.DataBindings.Add("Text", null, arrColums[i], "{0:0.00%}"); } else { detailCell.DataBindings.Add("Text", null, arrColums[i]); } detailCell.Name = arrColums[i] + "Cell"; detailCell.WidthF = widths[i]; detailCell.Weight = weights[i]; headerCell.Borders = BorderSide.Left | BorderSide.Top; headerCell.BackColor = Color.FromArgb(196, 220, 255); headerCell.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; headerCell.Font = new System.Drawing.Font("Tahoma", 8, FontStyle.Bold); headerCell.ForeColor = Color.Black; headerCell.BorderColor = Color.White; detailCell.BackColor = Color.FromArgb(255, 237, 196); detailCell.BorderColor = Color.FromArgb(232, 205, 162); detailCell.Borders = BorderSide.Left | BorderSide.Top; detailCell.TextAlignment = TextAlignment.MiddleCenter; dimensionRow.Cells.Add(headerCell); dimensionCellRow.Cells.Add(detailCell); } }