diff --git a/BehaviorDevelopmentStudio/.vs/BehaviorDevelopmentStudio/v14/.suo b/BehaviorDevelopmentStudio/.vs/BehaviorDevelopmentStudio/v14/.suo index 6f09ac9d3b1dd2f116ee29c19138395687d687cf..88f1f9d6c0676e7fe39c54ad75ece39c61dbf3da 100644 Binary files a/BehaviorDevelopmentStudio/.vs/BehaviorDevelopmentStudio/v14/.suo and b/BehaviorDevelopmentStudio/.vs/BehaviorDevelopmentStudio/v14/.suo differ diff --git a/BehaviorDevelopmentStudio/BehaviorStudio2/CodeExplorer.cs b/BehaviorDevelopmentStudio/BehaviorStudio2/CodeExplorer.cs index dc1992a734f68920a276b921fca9fe7ba2cb18e5..62667a7be0433c6acd6c56aafb32a446a4da77f7 100644 --- a/BehaviorDevelopmentStudio/BehaviorStudio2/CodeExplorer.cs +++ b/BehaviorDevelopmentStudio/BehaviorStudio2/CodeExplorer.cs @@ -9,6 +9,7 @@ namespace BehaviorStudio2 delegate void SetListCallback(CodeExplorerItem[] lines); static Stack<CodeExplorerItemList> itemList = new Stack<CodeExplorerItemList>(); + static Stack<CodeExplorerItem> selectStack = new Stack<CodeExplorerItem>(); //static List<string> unfilteredList; static string className = ""; @@ -18,26 +19,43 @@ namespace BehaviorStudio2 InitializeComponent(); } + private void SetMethods(List<string> lines) + { + lines.RemoveAt(lines.Count - 1); + lines.Sort(); + itemList.Push(new CodeExplorerItemList(lines)); + + if (this.optionsLB.InvokeRequired) + { + SetListCallback l = new SetListCallback(_SetOptionsLB); + this.Invoke(l, new object[] { itemList.Peek().items.ToArray() }); + } + else + { + _SetOptionsLB(itemList.Peek().items.ToArray()); + } + } + private void SetLines(List<string> lines) { lines.RemoveAt(lines.Count - 1); lines.Sort(); - //unfilteredList = lines; itemList.Push(new CodeExplorerItemList(lines)); if (this.optionsLB.InvokeRequired) { - SetListCallback l = new SetListCallback(_SetLines); + SetListCallback l = new SetListCallback(_SetOptionsLB); this.Invoke(l, new object[] { itemList.Peek().items.ToArray() }); } else { - _SetLines(itemList.Peek().items.ToArray()); + _SetOptionsLB(itemList.Peek().items.ToArray()); } } - private void _SetLines(CodeExplorerItem[] items) + private void _SetOptionsLB(CodeExplorerItem[] items) { + this.optionsLB.Items.Clear(); this.optionsLB.Items.AddRange(items); } @@ -61,26 +79,6 @@ namespace BehaviorStudio2 } this.optionsLB.Items.AddRange(itemList.Peek().items.ToArray()); } - - //if (unfilteredList == null || unfilteredList.Count < 1) - //{ - // AsyncThreadClient atc = new AsyncThreadClient(); - // atc.Connect(); - // Console.WriteLine("ATC Connected!"); - // atc.SendAndReceiveThread("GETJARS<EOL>", SetLines); - //} - //else - //{ - // this.optionsLB.Items.AddRange(unfilteredList.ToArray()); - //} - } - - private void SetMethods(List<string> lines) - { - foreach (string line in lines) - { - Console.WriteLine("Line: " + line); - } } private void FindMethods(string line) @@ -120,6 +118,18 @@ namespace BehaviorStudio2 { string filter = lineTB.Text; + string[] strs = filter.Split('.'); + + if (strs.Length > 1 && strs[strs.Length - 1] == "") + { + // last char=. + filter = strs[strs.Length - 2] + "."; + } + else + { + filter = strs[strs.Length - 1].Trim(); + } + FilterList(filter); } @@ -188,8 +198,20 @@ namespace BehaviorStudio2 { if (optionsLB.SelectedIndex > -1) { - string txt = (string)optionsLB.SelectedItem; - lineTB.Text = txt; + string[] strs = lineTB.Text.Split('.'); + CodeExplorerItem cei = (CodeExplorerItem)optionsLB.SelectedItem; + selectStack.Push(cei); + strs[strs.Length - 1] = cei.GetFullDescription(false); + + string text = ""; + for(int i=0;i<strs.Length;i++) + { + text += strs[i]; + if (i < strs.Length - 1) + text += "."; + } + + lineTB.Text = text; lineTB.SelectionStart = lineTB.Text.Length; lineTB.SelectionLength = 0; } @@ -217,7 +239,7 @@ namespace BehaviorStudio2 // search through the list foreach (CodeExplorerItem item in itemList.Peek().items) { - string line = item.className; + string line = item.GetSearchName(); // convert the string to lower string lineLower = line.ToLower(); @@ -286,7 +308,7 @@ namespace BehaviorStudio2 { CodeExplorerItem.includeFullClassname = fullClassCBX.Checked; - if (optionsLB.Items.Count > 0) + if (itemList.Peek().IsClassList && optionsLB.Items.Count > 0) { int sel = optionsLB.SelectedIndex; object[] objs = new object[optionsLB.Items.Count]; @@ -303,6 +325,8 @@ namespace BehaviorStudio2 public List<CodeExplorerItem> items; public CodeExplorerItem selectedItem; + public bool IsClassList { get { return (items == null || items.Count < 1 ? false : true); } } + public CodeExplorerItemList(List<string> lines) { items = new List<CodeExplorerItem>(); @@ -328,34 +352,106 @@ namespace BehaviorStudio2 { public static bool includeFullClassname = false; - public string returnClass = ""; - public string className = ""; - public string fullClassName = ""; - public string[] paramNames = null; + string methodName = ""; + + // return value + string returnClassName = ""; + string returnFullClassName = ""; + + // class + string className = ""; + string fullClassName = ""; + + // params + string[] paramClassNames = null; + string[] paramFullClassNames = null; + + public bool IsClassItem { get; protected set; } public CodeExplorerItem(string item) { string[] its = item.Split('|'); - className = its[0]; - fullClassName = its[1]; + if (its.Length == 2) + { + // its a class item + className = its[0]; + fullClassName = its[1]; + IsClassItem = true; + } + else if (its.Length == 3) + { + // its a method item + methodName = its[0]; + + // return class + returnFullClassName = its[its.Length - 1]; + returnClassName = GetSimpleClassName(returnFullClassName); + + // params + paramFullClassNames = its[1].Trim().Split(','); + paramClassNames = new string[paramFullClassNames.Length]; + for (int i = 0; i < paramFullClassNames.Length; i++) + paramClassNames[i] = GetSimpleClassName(paramFullClassNames[i]); + } + else + { + Console.WriteLine("Error: Unable to parse code explorer item - " + item); + } + } + + public string GetSearchName() + { + if (IsClassItem) + return className; + else + return methodName; } public override string ToString() + { + return GetFullDescription(CodeExplorerItem.includeFullClassname); + } + + public string GetFullDescription(bool verbose) + { + if (IsClassItem) + { + if (verbose) + return className + "(" + fullClassName + ")"; + else + return className; + } + else + { + if (verbose) + return methodName + "(" + GetParamDescription(true) + ") " + returnFullClassName; + else + return methodName + "(" + GetParamDescription(false) + ")"; + } + } + + string GetParamDescription(bool verbose) { string desc = ""; - if (paramNames != null && paramNames.Length > 0) + if (paramClassNames != null && paramClassNames.Length > 0) { - for (int i = 0; i < paramNames.Length; i++) + for (int i = 0; i < paramClassNames.Length; i++) { if (i != 0) desc += ","; - desc += paramNames[i]; + desc += verbose ? paramFullClassNames[i] : paramClassNames[i]; } } - return className + (includeFullClassname ? "(" + fullClassName + ")" : "");// + ":" + (returnClass == null || returnClass == "" ? "null" : returnClass) + - //":" + (desc == null || returnClass == "" ? "null" : desc); + return desc; + } + + public static string GetSimpleClassName(string fclassname) + { + string[] strs = fclassname.Split('.'); + + return strs[strs.Length - 1]; } } } diff --git a/java/BDSCodeCompleteServer/dist/BDSCodeCompleteServer.jar b/java/BDSCodeCompleteServer/dist/BDSCodeCompleteServer.jar index 74d56dd885d61eaa0c07a7905cb81971cf7a42ca..5a6d3ae33445a4f2bcd323a77b28bb8b8ba70f29 100644 Binary files a/java/BDSCodeCompleteServer/dist/BDSCodeCompleteServer.jar and b/java/BDSCodeCompleteServer/dist/BDSCodeCompleteServer.jar differ diff --git a/java/BDSCodeCompleteServer/src/bdscodecompleteserver/BDSServer.java b/java/BDSCodeCompleteServer/src/bdscodecompleteserver/BDSServer.java index 23c006e13707b9bec8643e73d98a9bb8ab414e8b..43489042e42e1b952ddd18cc5010dc2022a7f9bb 100644 --- a/java/BDSCodeCompleteServer/src/bdscodecompleteserver/BDSServer.java +++ b/java/BDSCodeCompleteServer/src/bdscodecompleteserver/BDSServer.java @@ -273,12 +273,12 @@ public class BDSServer implements Runnable if (params!=null&¶ms.length>0) { for(Class<?> param : params) - paramsDesc+=param.getCanonicalName()+", "; - paramsDesc=paramsDesc.substring(0,paramsDesc.length()-2); + paramsDesc+=param.getCanonicalName()+","; + paramsDesc=paramsDesc.substring(0,paramsDesc.length()-1); } if (ret!=null) returnDesc+=ret.getCanonicalName(); - String desc = method.getName()+"("+paramsDesc+"):"+returnDesc; + String desc = method.getName()+"|"+paramsDesc+"|"+returnDesc; methodDescs.add(desc); } }