#define JAVA
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;
using JJC.Psharp.Lang;
using JJC.Psharp.Predicates;
using System.Threading;
using System.Diagnostics;
namespace OO_Assistant {
public class Form1 : System.Windows.Forms.Form {
private System.Windows.Forms.MainMenu mainMenu1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ComboBox comboBox2;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox textBox3;
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
private System.Windows.Forms.RadioButton radioButton1;
private System.Windows.Forms.RadioButton radioButton2;
private System.Windows.Forms.RadioButton radioButton3;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.TextBox textBox4;
private System.Windows.Forms.ComboBox comboBox3;
private System.Windows.Forms.Button button4;
private Term listOfNamespaces = null;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Label label5;
private Term preload_lock = new VariableTerm( );
#if JAVA
public static string arg0 = null;
#endif
public Form1() {
//
// Required for Windows Form Designer support
//
InitializeComponent();
#if JAVA
this.Text = "Object Oriented Assistant [Java]";
#endif
textBox3.Enter += new System.EventHandler( this.EnterAction );
this.Closed += new System.EventHandler( this.Close );
button5.Enabled = false;
label5.Text = "Results so far: none";
string[] files = Directory.GetFiles( "." );
Term list = SymbolTerm.makeSymbol( "[]", 0 );
foreach( string file in files ) {
if( file.EndsWith( "_database.dll" )
&& !file.Equals( ".\\ClassHierachy_database.dll" ) ) {
string ns = file.Substring( 0, file.Length - 13 );
ns = ns.Substring( 2 );
list = new ListTerm(
SymbolTerm.makeSymbol( ns ),
list );
comboBox3.Items.Add( ns );
}
}
listOfNamespaces = list;
//ThreadStart ts = new ThreadStart( LoadAssemblies );
//Thread t = new Thread( ts );
//t.IsBackground = true;
//t.Start( );
sharp = new PrologInterface(
new PushbackReader( Console.In ), Console.Out, Console.Error,
true );
sharp.addCallingAssembly( );
Term loadThread = new VariableTerm( );
sharp.setPredicate( new DoLoadAllNamespaces_3( listOfNamespaces, preload_lock, loadThread, new ReturnCs( sharp ) ) );
sharp.call( );
this.load_interface = (PrologInterface)( loadThread.toCsObject( ) );
}
public void LoadAssemblies( ) {
PrologInterface sharp = new PrologInterface(
new PushbackReader( Console.In ), Console.Out, Console.Error,
true );
sharp.addCallingAssembly( );
sharp.setPredicate( new LoadNamespaces_2( listOfNamespaces, new VariableTerm( ), new ReturnCs( sharp ) ) );
sharp.call( );
}
protected override void Dispose( bool disposing ) {
if( disposing ) {
if (components != null) {
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent() {
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.label1 = new System.Windows.Forms.Label();
this.comboBox2 = new System.Windows.Forms.ComboBox();
this.textBox1 = new System.Windows.Forms.TextBox();
this.button3 = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.textBox2 = new System.Windows.Forms.TextBox();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.label3 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.label4 = new System.Windows.Forms.Label();
this.textBox3 = new System.Windows.Forms.TextBox();
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.radioButton2 = new System.Windows.Forms.RadioButton();
this.radioButton3 = new System.Windows.Forms.RadioButton();
this.label6 = new System.Windows.Forms.Label();
this.textBox4 = new System.Windows.Forms.TextBox();
this.comboBox3 = new System.Windows.Forms.ComboBox();
this.button4 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.label5 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// label1
//
this.label1.BackColor = System.Drawing.SystemColors.Control;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.label1.Location = new System.Drawing.Point(16, 32);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(32, 16);
this.label1.TabIndex = 1;
this.label1.Text = "Find";
this.label1.Click += new System.EventHandler(this.label1_Click);
//
// comboBox2
//
this.comboBox2.Items.AddRange(new object[] {
"Method which takes arguments (unordered subset)",
"Method which takes arguments (unordered)",
"Method which takes arguments (ordered)",
"Method which returns type",
"Field of type",
"Class which defines member",
"Superclasses of",
"Direct subclasses of"});
this.comboBox2.Location = new System.Drawing.Point(336, 32);
this.comboBox2.Name = "comboBox2";
this.comboBox2.Size = new System.Drawing.Size(464, 21);
this.comboBox2.TabIndex = 4;
this.comboBox2.Text = "Method which takes arguments (unordered subset)";
this.comboBox2.SelectedIndexChanged += new System.EventHandler(this.comboBox2_SelectedIndexChanged);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(16, 72);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(784, 20);
this.textBox1.TabIndex = 5;
this.textBox1.Text = "";
this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
//
// button3
//
this.button3.Location = new System.Drawing.Point(184, 168);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(72, 24);
this.button3.TabIndex = 9;
this.button3.Text = "Search";
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// label2
//
this.label2.BackColor = System.Drawing.SystemColors.Control;
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.label2.Location = new System.Drawing.Point(344, 120);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(96, 23);
this.label2.TabIndex = 9;
this.label2.Text = "in namespace(s)";
this.label2.Click += new System.EventHandler(this.label2_Click);
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(448, 120);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(352, 20);
this.textBox2.TabIndex = 7;
this.textBox2.Text = "";
this.textBox2.TextChanged += new System.EventHandler(this.textBox2_TextChanged);
//
// comboBox1
//
this.comboBox1.Location = new System.Drawing.Point(80, 208);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(672, 21);
this.comboBox1.TabIndex = 10;
this.comboBox1.Text = "