示例#1
0
 public void ShowEventsListSetup()
 {
     ASContext.Context.SetAs3Features();
     ASContext.Context.CurrentModel.Returns(new FileModel());
     dataEventModel = CreateDataEventModel();
     found = new FoundDeclaration
     {
         inClass = new ClassModel(),
         member = new MemberModel()
     };
 }
示例#2
0
        private static void ShowAddInterfaceDefList(FoundDeclaration found, List<string> interfaces)
        {
            if (GetLangIsValid())
            {
                List<ICompletionListItem> known = new List<ICompletionListItem>();

                string labelClass = TextHelper.GetString("ASCompletion.Label.AddInterfaceDef");
                foreach (String interf in interfaces)
                {
                    known.Add(new GeneratorItem(String.Format(labelClass, interf), GeneratorJobType.AddInterfaceDef, found.member, found.inClass, interf));
                }
                CompletionList.Show(known, false);
            }
        }
示例#3
0
 private static void ShowEventList(FoundDeclaration found)
 {
     List<ICompletionListItem> known = new List<ICompletionListItem>();
     string tmp = TextHelper.GetString("ASCompletion.Label.GenerateHandler");
     string labelEvent = String.Format(tmp, "Event");
     string labelDataEvent = String.Format(tmp, "DataEvent");
     string labelContext = String.Format(tmp, contextParam);
     string[] choices = (contextParam != "Event") ?
         new string[] { labelContext, labelEvent } :
         new string[] { labelEvent, labelDataEvent };
     for (int i = 0; i < choices.Length; i++)
     {
         known.Add(new GeneratorItem(choices[i],
             choices[i] == labelContext ? GeneratorJobType.ComplexEvent : GeneratorJobType.BasicEvent,
             found.member, found.inClass));
     }
     CompletionList.Show(known, false);
 }
示例#4
0
        private static void ShowNewClassList(FoundDeclaration found)
        {
            if (GetLangIsValid())
            {
                List<ICompletionListItem> known = new List<ICompletionListItem>();

                string labelClass = TextHelper.GetString("ASCompletion.Label.GenerateClass");
                known.Add(new GeneratorItem(labelClass, GeneratorJobType.Class, found.member, found.inClass));

                CompletionList.Show(known, false);
            }
        }
示例#5
0
        private static void ShowEventMetatagList(FoundDeclaration found)
        {
            List<ICompletionListItem> known = new List<ICompletionListItem>();

            string label = TextHelper.GetString("ASCompletion.Label.GenerateEventMetatag");
            known.Add(new GeneratorItem(label, GeneratorJobType.EventMetatag, found.member, found.inClass));

            CompletionList.Show(known, false);
        }
示例#6
0
 private static void ShowImplementInterface(FoundDeclaration found)
 {
     List<ICompletionListItem> known = new List<ICompletionListItem>();
     string label = TextHelper.GetString("ASCompletion.Label.ImplementInterface");
     known.Add(new GeneratorItem(label, GeneratorJobType.ImplementInterface, null, found.inClass));
     CompletionList.Show(known, false);
 }
示例#7
0
 private static void ShowChangeConstructorDeclList(FoundDeclaration found)
 {
     List<ICompletionListItem> known = new List<ICompletionListItem>();
     string label = TextHelper.GetString("ASCompletion.Label.ChangeConstructorDecl");
     known.Add(new GeneratorItem(label, GeneratorJobType.ChangeConstructorDecl, found.member, found.inClass));
     CompletionList.Show(known, false);
 }
示例#8
0
 private static void ShowGetSetList(FoundDeclaration found)
 {
     List<ICompletionListItem> known = new List<ICompletionListItem>();
     string labelGetSet = TextHelper.GetString("ASCompletion.Label.GenerateGetSet");
     string labelGet = TextHelper.GetString("ASCompletion.Label.GenerateGet");
     string labelSet = TextHelper.GetString("ASCompletion.Label.GenerateSet");
     string[] choices = new string[] { labelGetSet, labelGet, labelSet };
     for (int i = 0; i < choices.Length; i++)
     {
         known.Add(new GeneratorItem(choices[i], (GeneratorJobType)i, found.member, found.inClass));
     }
     CompletionList.Show(known, false);
 }
示例#9
0
 private static void ShowImplementInterface(FoundDeclaration found, List<ICompletionListItem> options)
 {
     string label = TextHelper.GetString("ASCompletion.Label.ImplementInterface");
     options.Add(new GeneratorItem(label, GeneratorJobType.ImplementInterface, null, found.inClass));
 }
示例#10
0
        private static void ShowEventMetatagList(FoundDeclaration found)
        {
            ContextFeatures features = ASContext.Context.Features;
            List<ICompletionListItem> known = new List<ICompletionListItem>();

            ScintillaNet.ScintillaControl Sci = ASContext.CurSciControl;

            string label = TextHelper.GetString("ASCompletion.Label.GenerateEventMetatag");
            known.Add(new GeneratorItem(label, GeneratorJobType.EventMetatag, found.member, found.inClass));

            CompletionList.Show(known, false);
        }
示例#11
0
        private static void ShowAddInterfaceDefList(FoundDeclaration found)
        {
            ContextFeatures features = ASContext.Context.Features;
            List<ICompletionListItem> known = new List<ICompletionListItem>();

            ScintillaNet.ScintillaControl Sci = ASContext.CurSciControl;

            if (PluginBase.CurrentProject != null && PluginBase.CurrentProject.Language.StartsWith("as"))
            {
                string labelClass = TextHelper.GetString("ASCompletion.Label.AddInterfaceDef");
                known.Add(new GeneratorItem(labelClass, GeneratorJobType.AddInterfaceDef, found.member, found.inClass));

                CompletionList.Show(known, false);
            }
        }
示例#12
0
        private static void ShowConstructorAndToStringList(FoundDeclaration found, bool hasConstructor, bool hasToString)
        {
            ContextFeatures features = ASContext.Context.Features;
            List<ICompletionListItem> known = new List<ICompletionListItem>();

            ScintillaNet.ScintillaControl Sci = ASContext.CurSciControl;

            if (PluginBase.CurrentProject != null && PluginBase.CurrentProject.Language.StartsWith("as"))
            {
                if (!hasConstructor)
                {
                    string labelClass = TextHelper.GetString("ASCompletion.Label.GenerateConstructor");
                    known.Add(new GeneratorItem(labelClass, GeneratorJobType.Constructor, found.member, found.inClass));
                }

                if (!hasToString)
                {
                    string labelClass = TextHelper.GetString("ASCompletion.Label.GenerateToString");
                    known.Add(new GeneratorItem(labelClass, GeneratorJobType.ToString, found.member, found.inClass));
                }

                CompletionList.Show(known, false);
            }
        }
示例#13
0
        private static void ShowNewMethodList(FoundDeclaration found)
        {
            ContextFeatures features = ASContext.Context.Features;
            List<ICompletionListItem> known = new List<ICompletionListItem>();

            ScintillaNet.ScintillaControl Sci = ASContext.CurSciControl;

            string autoSelect = "";

            ASResult result = ASComplete.GetExpressionType(Sci, Sci.WordEndPosition(Sci.CurrentPos, true));
            if (!(result != null && result.relClass != null))
            {
                result = null;
            }
            else if (found.inClass.QualifiedName.Equals(result.relClass.QualifiedName))
            {
                result = null;
            }

            ClassModel inClass = result != null ? result.relClass : found.inClass;
            bool isInterface = ClassIsInterface(inClass);

            if (!isInterface)
            {
                if (result == null)
                {
                    string label = TextHelper.GetString("ASCompletion.Label.GeneratePrivateFunction");
                    known.Add(new GeneratorItem(label, GeneratorJobType.Function, found.member, found.inClass));
                }
            }

            string labelFunPublic = TextHelper.GetString("ASCompletion.Label.GenerateFunctionPublic");
            if (isInterface)
            {
                labelFunPublic = TextHelper.GetString("ASCompletion.Label.GenerateFunctionInterface");
                autoSelect = labelFunPublic;
            }
            known.Add(new GeneratorItem(labelFunPublic, GeneratorJobType.FunctionPublic, found.member, found.inClass));

            CompletionList.Show(known, false);
        }
示例#14
0
        private static void ShowNewVarList(FoundDeclaration found)
        {
            ContextFeatures features = ASContext.Context.Features;
            List<ICompletionListItem> known = new List<ICompletionListItem>();

            ScintillaNet.ScintillaControl Sci = ASContext.CurSciControl;

            string autoSelect = "";

            ASResult result = ASComplete.GetExpressionType(Sci, Sci.WordEndPosition(Sci.CurrentPos, true));
            if (!(result != null && result.relClass != null))
            {
                result = null;
            }
            else if (found.inClass.QualifiedName.Equals(result.relClass.QualifiedName))
            {
                result = null;
            }

            bool isConst = false;
            string textAtCursor = Sci.GetWordFromPosition(Sci.CurrentPos);
            if (textAtCursor != null && textAtCursor.ToUpper().Equals(textAtCursor))
            {
                isConst = true;
            }

            ClassModel inClass = result != null ? result.relClass : found.inClass;
            bool isInterface = ClassIsInterface(inClass);

            if (!isInterface)
            {
                if (isConst)
                {
                    string labelConst = TextHelper.GetString("ASCompletion.Label.GenerateConstant");
                    known.Add(new GeneratorItem(labelConst, GeneratorJobType.Constant, found.member, found.inClass));

                    autoSelect = labelConst;
                }

                if (result == null)
                {
                    string labelVar = TextHelper.GetString("ASCompletion.Label.GeneratePrivateVar");
                    known.Add(new GeneratorItem(labelVar, GeneratorJobType.Variable, found.member, found.inClass));
                }

                string labelVarPublic = TextHelper.GetString("ASCompletion.Label.GeneratePublicVar");
                known.Add(new GeneratorItem(labelVarPublic, GeneratorJobType.VariablePublic, found.member, found.inClass));

                if (result == null)
                {
                    string labelFun = TextHelper.GetString("ASCompletion.Label.GeneratePrivateFunction");
                    known.Add(new GeneratorItem(labelFun, GeneratorJobType.Function, found.member, found.inClass));
                }
            }

            string labelFunPublic = TextHelper.GetString("ASCompletion.Label.GenerateFunctionPublic");
            if (isInterface)
            {
                labelFunPublic = TextHelper.GetString("ASCompletion.Label.GenerateFunctionInterface");
                autoSelect = labelFunPublic;
            }
            known.Add(new GeneratorItem(labelFunPublic, GeneratorJobType.FunctionPublic, found.member, found.inClass));

            if (PluginBase.CurrentProject != null && PluginBase.CurrentProject.Language.StartsWith("as"))
            {
                string labelClass = TextHelper.GetString("ASCompletion.Label.GenerateClass");
                known.Add(new GeneratorItem(labelClass, GeneratorJobType.Class, found.member, found.inClass));
            }
            CompletionList.Show(known, false);
        }
示例#15
0
 private static bool CheckAutoImport(FoundDeclaration found)
 {
     MemberList allClasses = ASContext.Context.GetAllProjectClasses();
     if (allClasses != null)
     {
         List<string> names = new List<string>();
         List<MemberModel> matches = new List<MemberModel>();
         string dotToken = "." + contextToken;
         foreach (MemberModel member in allClasses)
             if (member.Name.EndsWith(dotToken) && !names.Contains(member.Name))
             {
                 matches.Add(member);
                 names.Add(member.Name);
             }
         if (matches.Count > 0)
         {
             ShowImportClass(matches);
             return true;
         }
     }
     return false;
 }
示例#16
0
 private static void ShowChangeConstructorDeclList(FoundDeclaration found, List<ICompletionListItem> options)
 {
     string label = TextHelper.GetString("ASCompletion.Label.ChangeConstructorDecl");
     options.Add(new GeneratorItem(label, GeneratorJobType.ChangeConstructorDecl, found.member, found.inClass));
 }
示例#17
0
 private static void ShowPromoteLocalAndAddParameter(FoundDeclaration found)
 {
     List<ICompletionListItem> known = new List<ICompletionListItem>();
     string label = TextHelper.GetString("ASCompletion.Label.PromoteLocal");
     string labelMove = TextHelper.GetString("ASCompletion.Label.MoveDeclarationOnTop");
     string labelParam = TextHelper.GetString("ASCompletion.Label.AddAsParameter");
     known.Add(new GeneratorItem(label, GeneratorJobType.PromoteLocal, found.member, found.inClass));
     known.Add(new GeneratorItem(labelMove, GeneratorJobType.MoveLocalUp, found.member, found.inClass));
     known.Add(new GeneratorItem(labelParam, GeneratorJobType.AddAsParameter, found.member, found.inClass));
     CompletionList.Show(known, false);
 }
示例#18
0
 private static void ShowNewMethodList(FoundDeclaration found, List<ICompletionListItem> options)
 {
     ScintillaControl sci = ASContext.CurSciControl;
     ASResult result = ASComplete.GetExpressionType(sci, sci.WordEndPosition(sci.CurrentPos, true));
     if (result == null || result.RelClass == null || found.inClass.QualifiedName.Equals(result.RelClass.QualifiedName))
         result = null;
     string label;
     ClassModel inClass = result != null ? result.RelClass : found.inClass;
     bool isInterface = (inClass.Flags & FlagType.Interface) > 0;
     if (!isInterface && result == null)
     {
         if (GetDefaultVisibility(found.inClass) == Visibility.Protected)
             label = TextHelper.GetString("ASCompletion.Label.GenerateProtectedFunction");
         else label = TextHelper.GetString("ASCompletion.Label.GeneratePrivateFunction");
         options.Add(new GeneratorItem(label, GeneratorJobType.Function, found.member, found.inClass));
     }
     if (isInterface) label = TextHelper.GetString("ASCompletion.Label.GenerateFunctionInterface");
     else label = TextHelper.GetString("ASCompletion.Label.GenerateFunctionPublic");
     options.Add(new GeneratorItem(label, GeneratorJobType.FunctionPublic, found.member, found.inClass));
     label = TextHelper.GetString("ASCompletion.Label.GeneratePublicCallback");
     options.Add(new GeneratorItem(label, GeneratorJobType.VariablePublic, found.member, found.inClass));
 }
示例#19
0
        private static void ShowNewVarList(FoundDeclaration found)
        {
            bool generateClass = GetLangIsValid();
            ScintillaNet.ScintillaControl Sci = ASContext.CurSciControl;
            int currentPos = Sci.CurrentPos;
            ASResult exprAtCursor = ASComplete.GetExpressionType(Sci, Sci.WordEndPosition(currentPos, true));
            if (exprAtCursor == null || exprAtCursor.InClass == null || found.inClass.QualifiedName.Equals(exprAtCursor.RelClass.QualifiedName))
                exprAtCursor = null;
            ASResult exprLeft = null;
            int curWordStartPos = Sci.WordStartPosition(currentPos, true);
            if ((char)Sci.CharAt(curWordStartPos - 1) == '.') exprLeft = ASComplete.GetExpressionType(Sci, curWordStartPos - 1);
            if (exprLeft != null && exprLeft.Type == null) exprLeft = null;
            if (exprLeft != null)
            {
                if (exprLeft.Type.InFile != null && !File.Exists(exprLeft.Type.InFile.FileName)) return;
                generateClass = false;
                ClassModel curClass = ASContext.Context.CurrentClass;
                if (!isHaxe)
                {
                    if (exprLeft.Type.Equals(curClass)) exprLeft = null;
                }
                else 
                {
                    while (!curClass.IsVoid())
                    {
                        if (curClass.Equals(exprLeft.Type))
                        {
                            exprLeft = null;
                            break;
                        }
                        curClass.ResolveExtends();
                        curClass = curClass.Extends;
                    }
                }
            }
            List<ICompletionListItem> known = new List<ICompletionListItem>();
            string label;
            if ((exprAtCursor != null && exprAtCursor.RelClass != null && (exprAtCursor.RelClass.Flags & FlagType.Interface) > 0)
                || (found.inClass != null && (found.inClass.Flags & FlagType.Interface) > 0))
            {
                label = TextHelper.GetString("ASCompletion.Label.GenerateFunctionInterface");
                known.Add(new GeneratorItem(label, GeneratorJobType.FunctionPublic, found.member, found.inClass));
            }
            else
            {
                string textAtCursor = Sci.GetWordFromPosition(currentPos);
                bool isConst = textAtCursor != null && textAtCursor.ToUpper().Equals(textAtCursor);
                if (isConst)
                {
                    label = TextHelper.GetString("ASCompletion.Label.GenerateConstant");
                    known.Add(new GeneratorItem(label, GeneratorJobType.Constant, found.member, found.inClass));
                }

                bool genProtectedDecl = ASContext.Context.Features.protectedKey != null && ASContext.CommonSettings.GenerateProtectedDeclarations;
                if (exprAtCursor == null && exprLeft == null)
                {
                    if (genProtectedDecl) label = TextHelper.GetString("ASCompletion.Label.GenerateProtectedVar");
                    else label = TextHelper.GetString("ASCompletion.Label.GeneratePrivateVar");
                    known.Add(new GeneratorItem(label, GeneratorJobType.Variable, found.member, found.inClass));
                }

                label = TextHelper.GetString("ASCompletion.Label.GeneratePublicVar");
                known.Add(new GeneratorItem(label, GeneratorJobType.VariablePublic, found.member, found.inClass));

                if (exprAtCursor == null && exprLeft == null)
                {
                    if (genProtectedDecl) label = TextHelper.GetString("ASCompletion.Label.GenerateProtectedFunction");
                    else label = TextHelper.GetString("ASCompletion.Label.GeneratePrivateFunction");
                    known.Add(new GeneratorItem(label, GeneratorJobType.Function, found.member, found.inClass));
                }

                label = TextHelper.GetString("ASCompletion.Label.GenerateFunctionPublic");
                known.Add(new GeneratorItem(label, GeneratorJobType.FunctionPublic, found.member, found.inClass));

                if (generateClass)
                {
                    label = TextHelper.GetString("ASCompletion.Label.GenerateClass");
                    known.Add(new GeneratorItem(label, GeneratorJobType.Class, found.member, found.inClass));
                }
            }
            CompletionList.Show(known, false);
        }
示例#20
0
 private static void ShowNewClassList(FoundDeclaration found, List<ICompletionListItem> options)
 {
     if (GetLangIsValid())
     {
         string labelClass = TextHelper.GetString("ASCompletion.Label.GenerateClass");
         options.Add(new GeneratorItem(labelClass, GeneratorJobType.Class, found.member, found.inClass));
     }
 }
示例#21
0
 private static void ShowNewMethodList(FoundDeclaration found)
 {
     List<ICompletionListItem> known = new List<ICompletionListItem>();
     ScintillaNet.ScintillaControl Sci = ASContext.CurSciControl;
     ASResult result = ASComplete.GetExpressionType(Sci, Sci.WordEndPosition(Sci.CurrentPos, true));
     if (result == null || result.RelClass == null || found.inClass.QualifiedName.Equals(result.RelClass.QualifiedName))
         result = null;
     string label;
     ClassModel inClass = result != null ? result.RelClass : found.inClass;
     bool isInterface = (inClass.Flags & FlagType.Interface) > 0;
     if (!isInterface && result == null)
     {
         if (ASContext.Context.Features.protectedKey != null && ASContext.CommonSettings.GenerateProtectedDeclarations)
             label = TextHelper.GetString("ASCompletion.Label.GenerateProtectedFunction");
         else label = TextHelper.GetString("ASCompletion.Label.GeneratePrivateFunction");
         known.Add(new GeneratorItem(label, GeneratorJobType.Function, found.member, found.inClass));
     }
     if (isInterface) label = TextHelper.GetString("ASCompletion.Label.GenerateFunctionInterface");
     else label = TextHelper.GetString("ASCompletion.Label.GenerateFunctionPublic");
     known.Add(new GeneratorItem(label, GeneratorJobType.FunctionPublic, found.member, found.inClass));
     label = TextHelper.GetString("ASCompletion.Label.GeneratePublicCallback");
     known.Add(new GeneratorItem(label, GeneratorJobType.VariablePublic, found.member, found.inClass));
     CompletionList.Show(known, false);
 }
示例#22
0
 private static void ShowEventMetatagList(FoundDeclaration found, List<ICompletionListItem> options)
 {
     string label = TextHelper.GetString("ASCompletion.Label.GenerateEventMetatag");
     options.Add(new GeneratorItem(label, GeneratorJobType.EventMetatag, found.member, found.inClass));
 }
示例#23
0
        private static void ShowConstructorAndToStringList(FoundDeclaration found, bool hasConstructor, bool hasToString)
        {
            
            if (GetLangIsValid())
            {
                List<ICompletionListItem> known = new List<ICompletionListItem>();

                if (!hasConstructor)
                {
                    string labelClass = TextHelper.GetString("ASCompletion.Label.GenerateConstructor");
                    known.Add(new GeneratorItem(labelClass, GeneratorJobType.Constructor, found.member, found.inClass));
                }

                if (!hasToString)
                {
                    string labelClass = TextHelper.GetString("ASCompletion.Label.GenerateToString");
                    known.Add(new GeneratorItem(labelClass, GeneratorJobType.ToString, found.member, found.inClass));
                }

                CompletionList.Show(known, false);
            }
        }
示例#24
0
 private static void ShowFieldFromParameter(FoundDeclaration found, List<ICompletionListItem> options)
 {
     if (GetLangIsValid())
     {
         Hashtable parameters = new Hashtable();
         parameters["scope"] = GetDefaultVisibility(found.inClass);
         string label;
         if (GetDefaultVisibility(found.inClass) == Visibility.Protected)
             label = TextHelper.GetString("ASCompletion.Label.GenerateProtectedFieldFromParameter");
         else label = TextHelper.GetString("ASCompletion.Label.GeneratePrivateFieldFromParameter");
         options.Add(new GeneratorItem(label, GeneratorJobType.FieldFromPatameter, found.member, found.inClass, parameters));
         parameters = new Hashtable();
         parameters["scope"] = Visibility.Public;
         label = TextHelper.GetString("ASCompletion.Label.GeneratePublicFieldFromParameter");
         options.Add(new GeneratorItem(label, GeneratorJobType.FieldFromPatameter, found.member, found.inClass, parameters));
     }
 }
示例#25
0
 private static void ShowFieldFromParameter(FoundDeclaration found)
 {
     if (GetLangIsValid())
     {
         List<ICompletionListItem> known = new List<ICompletionListItem>();
         Hashtable parameters = new Hashtable();
         parameters["scope"] = GetDefaultVisibility();
         string label;
         if (ASContext.Context.Features.protectedKey != null && ASContext.CommonSettings.GenerateProtectedDeclarations)
             label = TextHelper.GetString("ASCompletion.Label.GenerateProtectedFieldFromParameter");
         else label = TextHelper.GetString("ASCompletion.Label.GeneratePrivateFieldFromParameter");
         known.Add(new GeneratorItem(label, GeneratorJobType.FieldFromPatameter, found.member, found.inClass, parameters));
         parameters = new Hashtable();
         parameters["scope"] = Visibility.Public;
         label = TextHelper.GetString("ASCompletion.Label.GeneratePublicFieldFromParameter");
         known.Add(new GeneratorItem(label, GeneratorJobType.FieldFromPatameter, found.member, found.inClass, parameters));
         CompletionList.Show(known, false);
     }
 }
示例#26
0
 private static void ShowDelegateList(FoundDeclaration found, List<ICompletionListItem> options)
 {
     string label = String.Format(TextHelper.GetString("ASCompletion.Label.GenerateHandler"), "Delegate");
     options.Add(new GeneratorItem(label, GeneratorJobType.Delegate, found.member, found.inClass));
 }
示例#27
0
 private static void ShowDelegateList(FoundDeclaration found)
 {
     List<ICompletionListItem> known = new List<ICompletionListItem>();
     string label = String.Format(TextHelper.GetString("ASCompletion.Label.GenerateHandler"), "Delegate");
     known.Add(new GeneratorItem(label, GeneratorJobType.Delegate, found.member, found.inClass));
     CompletionList.Show(known, false);
 }
示例#28
0
        private static FoundDeclaration GetDeclarationAtLine(ScintillaNet.ScintillaControl Sci, int line)
        {
            FoundDeclaration result = new FoundDeclaration();
            FileModel model = ASContext.Context.CurrentModel;

            foreach (MemberModel member in model.Members)
            {
                if (member.LineFrom <= line && member.LineTo >= line)
                {
                    result.member = member;
                    return result;
                }
            }

            foreach (ClassModel aClass in model.Classes)
            {
                if (aClass.LineFrom <= line && aClass.LineTo >= line)
                {
                    result.inClass = aClass;
                    foreach (MemberModel member in aClass.Members)
                    {
                        if (member.LineFrom <= line && member.LineTo >= line)
                        {
                            result.member = member;
                            return result;
                        }
                    }
                    return result;
                }
            }
            return result;
        }
示例#29
0
 private static void ShowGetSetList(FoundDeclaration found)
 {
     string name = GetPropertyNameFor(found.member);
     ASResult result = new ASResult();
     ClassModel curClass = ASContext.Context.CurrentClass;
     ASComplete.FindMember(name, curClass, result, FlagType.Getter, 0);
     bool hasGetter = !result.IsNull();
     ASComplete.FindMember(name, curClass, result, FlagType.Setter, 0);
     bool hasSetter = !result.IsNull();
     if (hasGetter && hasSetter) return;
     List<ICompletionListItem> known = new List<ICompletionListItem>();
     if (!hasGetter && !hasSetter)
     {
         string label = TextHelper.GetString("ASCompletion.Label.GenerateGetSet");
         known.Add(new GeneratorItem(label, GeneratorJobType.GetterSetter, found.member, found.inClass));
     }
     if (!hasGetter)
     {
         string label = TextHelper.GetString("ASCompletion.Label.GenerateGet");
         known.Add(new GeneratorItem(label, GeneratorJobType.Getter, found.member, found.inClass));
     }
     if (!hasSetter)
     {
         string label = TextHelper.GetString("ASCompletion.Label.GenerateSet");
         known.Add(new GeneratorItem(label, GeneratorJobType.Setter, found.member, found.inClass));
     }
     CompletionList.Show(known, false);
 }
示例#30
0
        private static void ShowFieldFromParameter(FoundDeclaration found)
        {
            ContextFeatures features = ASContext.Context.Features;
            List<ICompletionListItem> known = new List<ICompletionListItem>();

            ScintillaNet.ScintillaControl Sci = ASContext.CurSciControl;

            if (PluginBase.CurrentProject != null && PluginBase.CurrentProject.Language.StartsWith("as"))
            {
                Hashtable parameters = new Hashtable();
                parameters["scope"] = GetDefaultVisibility();
                string labelClass = TextHelper.GetString("ASCompletion.Label.GeneratePrivateFieldFromPatameter");
                known.Add(new GeneratorItem(labelClass, GeneratorJobType.FieldFromPatameter, found.member, found.inClass, parameters));

                parameters = new Hashtable();
                parameters["scope"] = Visibility.Public;
                labelClass = TextHelper.GetString("ASCompletion.Label.GeneratePublicFieldFromPatameter");
                known.Add(new GeneratorItem(labelClass, GeneratorJobType.FieldFromPatameter, found.member, found.inClass, parameters));

                CompletionList.Show(known, false);
            }
        }