Skip to content
Snippets Groups Projects
Commit 45cdd4d0 authored by Reeves, David E's avatar Reeves, David E
Browse files

* added full class to data passed between java and c#

* started implementation of stack format for code exploration (to make going back easier)
* fixed ui not expanding when maximized
* added toggle for class name to allow users to see the full class (helps differentiate classes with same name)
parent 172ec011
No related branches found
No related tags found
No related merge requests found
No preview for this file type
......@@ -31,12 +31,18 @@
this.label1 = new System.Windows.Forms.Label();
this.lineTB = new System.Windows.Forms.TextBox();
this.optionsLB = new System.Windows.Forms.ListBox();
this.fullClassCBX = new System.Windows.Forms.CheckBox();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 9);
this.label1.Location = new System.Drawing.Point(3, 6);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(30, 13);
this.label1.TabIndex = 0;
......@@ -44,7 +50,7 @@
//
// lineTB
//
this.lineTB.Location = new System.Drawing.Point(48, 6);
this.lineTB.Location = new System.Drawing.Point(39, 3);
this.lineTB.Name = "lineTB";
this.lineTB.Size = new System.Drawing.Size(501, 20);
this.lineTB.TabIndex = 1;
......@@ -54,26 +60,62 @@
//
// optionsLB
//
this.optionsLB.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.optionsLB.FormattingEnabled = true;
this.optionsLB.Location = new System.Drawing.Point(12, 32);
this.optionsLB.Location = new System.Drawing.Point(12, 17);
this.optionsLB.Name = "optionsLB";
this.optionsLB.Size = new System.Drawing.Size(537, 199);
this.optionsLB.Size = new System.Drawing.Size(578, 290);
this.optionsLB.TabIndex = 2;
this.optionsLB.DoubleClick += new System.EventHandler(this.optionsLB_DoubleClick);
//
// fullClassCBX
//
this.fullClassCBX.AutoSize = true;
this.fullClassCBX.Location = new System.Drawing.Point(39, 29);
this.fullClassCBX.Name = "fullClassCBX";
this.fullClassCBX.Size = new System.Drawing.Size(138, 17);
this.fullClassCBX.TabIndex = 3;
this.fullClassCBX.Text = "Display Full Class Name";
this.fullClassCBX.UseVisualStyleBackColor = true;
this.fullClassCBX.CheckedChanged += new System.EventHandler(this.fullClassCBX_CheckedChanged);
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.lineTB);
this.splitContainer1.Panel1.Controls.Add(this.fullClassCBX);
this.splitContainer1.Panel1.Controls.Add(this.label1);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.optionsLB);
this.splitContainer1.Size = new System.Drawing.Size(602, 371);
this.splitContainer1.SplitterDistance = 44;
this.splitContainer1.TabIndex = 4;
//
// CodeExplorer
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(561, 245);
this.Controls.Add(this.optionsLB);
this.Controls.Add(this.lineTB);
this.Controls.Add(this.label1);
this.ClientSize = new System.Drawing.Size(602, 371);
this.Controls.Add(this.splitContainer1);
this.Name = "CodeExplorer";
this.Text = "Code Explorer";
this.Load += new System.EventHandler(this.CodeExplorer_Load);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel1.PerformLayout();
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
......@@ -82,5 +124,7 @@
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox lineTB;
private System.Windows.Forms.ListBox optionsLB;
private System.Windows.Forms.CheckBox fullClassCBX;
private System.Windows.Forms.SplitContainer splitContainer1;
}
}
\ No newline at end of file
......@@ -6,8 +6,12 @@ namespace BehaviorStudio2
{
public partial class CodeExplorer : Form
{
delegate void SetListCallback(List<string> lines);
static List<string> unfilteredList;
delegate void SetListCallback(CodeExplorerItem[] lines);
static Stack<CodeExplorerItemList> itemList = new Stack<CodeExplorerItemList>();
//static List<string> unfilteredList;
static string className = "";
public CodeExplorer()
{
......@@ -18,22 +22,30 @@ namespace BehaviorStudio2
{
lines.RemoveAt(lines.Count - 1);
lines.Sort();
unfilteredList = lines;
//unfilteredList = lines;
itemList.Push(new CodeExplorerItemList(lines));
if (this.optionsLB.InvokeRequired)
{
SetListCallback l = new SetListCallback(SetLines);
this.Invoke(l, new object[] { lines });
SetListCallback l = new SetListCallback(_SetLines);
this.Invoke(l, new object[] { itemList.Peek().items.ToArray() });
}
else
{
this.optionsLB.Items.AddRange(lines.ToArray());
_SetLines(itemList.Peek().items.ToArray());
}
}
private void _SetLines(CodeExplorerItem[] items)
{
this.optionsLB.Items.AddRange(items);
}
private void CodeExplorer_Load(object sender, EventArgs e)
{
if (unfilteredList == null || unfilteredList.Count < 1)
CodeExplorerItem.includeFullClassname = fullClassCBX.Checked;
if (itemList == null || itemList.Count < 1)
{
AsyncThreadClient atc = new AsyncThreadClient();
atc.Connect();
......@@ -42,8 +54,25 @@ namespace BehaviorStudio2
}
else
{
this.optionsLB.Items.AddRange(unfilteredList.ToArray());
if (itemList.Count > 1)
{
while (itemList.Count > 1)
itemList.Pop();
}
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)
......@@ -60,7 +89,7 @@ namespace BehaviorStudio2
return;
line = line.Substring(0, line.Length - 1);
string className = "";
className = "";
bool searching = true;
int index = line.Length - 1;
while (searching)
......@@ -123,12 +152,12 @@ namespace BehaviorStudio2
IncSelection();
e.Handled = true;
}
else if (e.KeyCode==Keys.Escape)
else if (e.KeyCode == Keys.Escape)
{
this.Close();
e.Handled = true;
}
else if (e.KeyCode==Keys.OemPeriod)
else if (e.KeyCode == Keys.OemPeriod)
{
SetSelectedText();
}
......@@ -137,7 +166,7 @@ namespace BehaviorStudio2
void DecSelection()
{
if (optionsLB.SelectedIndex>0)
if (optionsLB.SelectedIndex > 0)
{
int si = optionsLB.SelectedIndex;
optionsLB.SetSelected(si--, false);
......@@ -181,13 +210,14 @@ namespace BehaviorStudio2
// make the filter string lower case
string filterLower = filter.ToLower();
List<string> lines = new List<string>();
List<CodeExplorerItem> lines = new List<CodeExplorerItem>();
int selectIndex = -1;
int selectPriority = 1000;
// search through the list
foreach (string line in unfilteredList)
foreach (CodeExplorerItem item in itemList.Peek().items)
{
string line = item.className;
// convert the string to lower
string lineLower = line.ToLower();
......@@ -195,7 +225,7 @@ namespace BehaviorStudio2
if (line.StartsWith(filter))
{
// add the line to the list
lines.Add(line);
lines.Add(item);
// set the selection index and priority
// priority is used to signal if a match
// type is better than the other (lower is
......@@ -213,7 +243,7 @@ namespace BehaviorStudio2
else if (lineLower.StartsWith(filterLower))
{
// add the line to the list
lines.Add(line);
lines.Add(item);
if (selectPriority > 1)
{
// this is a middle priority match
......@@ -227,7 +257,7 @@ namespace BehaviorStudio2
else if (lineLower.Contains(filterLower))
{
// add to the list
lines.Add(line);
lines.Add(item);
if (selectPriority > 2)
{
// this is the lowest priority match
......@@ -239,10 +269,7 @@ namespace BehaviorStudio2
// clear the list and add the newly searched lines
optionsLB.Items.Clear();
foreach (string line in lines)
{
optionsLB.Items.Add(line);
}
optionsLB.Items.AddRange(lines.ToArray());
// if we found something to select then highlight it
if (selectPriority <= 2)
......@@ -254,5 +281,81 @@ namespace BehaviorStudio2
FindMethods(lineTB.Text);
}
}
private void fullClassCBX_CheckedChanged(object sender, EventArgs e)
{
CodeExplorerItem.includeFullClassname = fullClassCBX.Checked;
if (optionsLB.Items.Count > 0)
{
int sel = optionsLB.SelectedIndex;
object[] objs = new object[optionsLB.Items.Count];
optionsLB.Items.CopyTo(objs, 0);
optionsLB.Items.Clear();
optionsLB.Items.AddRange(objs);
optionsLB.SelectedIndex = sel;
}
}
}
public class CodeExplorerItemList
{
public List<CodeExplorerItem> items;
public CodeExplorerItem selectedItem;
public CodeExplorerItemList(List<string> lines)
{
items = new List<CodeExplorerItem>();
for (int i = 0; i < lines.Count; i++)
{
items.Add(new CodeExplorerItem(lines[i]));
}
}
public object[] GetObjectArray()
{
object[] objs = new object[items.Count];
for (int i = 0; i < items.Count; i++)
{
objs[i] = items[i];
}
return objs;
}
}
public class CodeExplorerItem
{
public static bool includeFullClassname = false;
public string returnClass = "";
public string className = "";
public string fullClassName = "";
public string[] paramNames = null;
public CodeExplorerItem(string item)
{
string[] its = item.Split('|');
className = its[0];
fullClassName = its[1];
}
public override string ToString()
{
string desc = "";
if (paramNames != null && paramNames.Length > 0)
{
for (int i = 0; i < paramNames.Length; i++)
{
if (i != 0)
desc += ",";
desc += paramNames[i];
}
}
return className + (includeFullClassname ? "(" + fullClassName + ")" : "");// + ":" + (returnClass == null || returnClass == "" ? "null" : returnClass) +
//":" + (desc == null || returnClass == "" ? "null" : desc);
}
}
}
No preview for this file type
......@@ -3,6 +3,7 @@
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group name="Group 20180201-03:20:09">
<file>file:/D:/code_base/CSharp/Devexpress/dev/java/BDSCodeCompleteServer/src/bdscodecompleteserver/CTClassLoader.java</file>
<file>file:/D:/code_base/CSharp/Devexpress/dev/java/BDSCodeCompleteServer/src/bdscodecompleteserver/BDSCodeCompleteServer.java</file>
<file>file:/D:/code_base/CSharp/Devexpress/dev/java/BDSCodeCompleteServer/src/bdscodecompleteserver/CodeTools.java</file>
<file>file:/D:/code_base/CSharp/Devexpress/dev/java/BDSCodeCompleteServer/src/bdscodecompleteserver/BDSServer.java</file>
......
......@@ -244,7 +244,7 @@ public class BDSServer implements Runnable
String resp="";
for (String cis[] : CodeTools.classInfo)
{
resp = cis[0]+"<EOL>";
resp = cis[0]+"|"+cis[1]+"<EOL>";
bout.write(resp);
}
resp="Sent "+CodeTools.classInfo.size()+" jars<EOR>";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment