[Monodevelop-patches-list] r1247 - in trunk/MonoDevelop/src/AddIns/BackendBindings: . JavaBinding JavaBinding/FormatingStrategy JavaBinding/Gui JavaBinding/Project JavaBinding/ProjectTreeBuilder
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Thu Mar 25 17:19:12 EST 2004
Author: jluke
Date: 2004-03-25 17:19:12 -0500 (Thu, 25 Mar 2004)
New Revision: 1247
Added:
trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/
trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/ChangeLog
trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/FormatingStrategy/
trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/FormatingStrategy/JavaFormattingStrategy.cs
trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/Gui/
trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/Gui/ProjectConfigurationPropertyPanel.cs
trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/JavaBinding.prjx
trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/JavaBindingCompilerServices.cs
trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/JavaBindingExecutionServices.cs
trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/JavaLanguageBinding.cs
trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/Makefile.am
trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/Project/
trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/Project/JavaCompilerParameters.cs
trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/Project/JavaProject.cs
trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/ProjectTreeBuilder/
trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/ProjectTreeBuilder/JavaNodeBuilder.cs
Log:
import from SD so I can play around with it
Property changes on: trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding
___________________________________________________________________
Name: svn:ignore
+ Makefile
Makefile.am
*.dll
Added: trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/ChangeLog
===================================================================
--- trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/ChangeLog 2004-03-25 21:55:04 UTC (rev 1246)
+++ trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/ChangeLog 2004-03-25 22:19:12 UTC (rev 1247)
@@ -0,0 +1,4 @@
+2004-03-25 John Luke <jluke at cfl.rr.com>
+
+ import from SD and make it build with our
+ namespaces and SourceEditor
Added: trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/FormatingStrategy/JavaFormattingStrategy.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/FormatingStrategy/JavaFormattingStrategy.cs 2004-03-25 21:55:04 UTC (rev 1246)
+++ trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/FormatingStrategy/JavaFormattingStrategy.cs 2004-03-25 22:19:12 UTC (rev 1247)
@@ -0,0 +1,246 @@
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Mike Krüger" email="mike at icsharpcode.net"/>
+// <version value="$version"/>
+// </file>
+
+using System;
+using System.Collections;
+using System.Diagnostics;
+using System.Drawing;
+using System.Text;
+
+using MonoDevelop.TextEditor;
+using MonoDevelop.TextEditor.Document;
+using MonoDevelop.Core.Properties;
+using MonoDevelop.Core.Services;
+using MonoDevelop.Services;
+using MonoDevelop.EditorBindings.FormattingStrategy;
+
+namespace JavaBinding.FormattingStrategy
+{
+ /// <summary>
+ /// This class handles the auto and smart indenting in the textbuffer while
+ /// you type.
+ /// </summary>
+ public class JavaFormattingStrategy : DefaultFormattingStrategy
+ {
+ public JavaFormattingStrategy()
+ {
+ }
+
+ /// <summary>
+ /// Define Java specific smart indenting for a line :)
+ /// </summary>
+ protected override int SmartIndentLine(IFormattableDocument textArea, int lineNr)
+ {
+/*
+ if (lineNr > 0) {
+ LineSegment lineAbove = textArea.Document.GetLineSegment(lineNr - 1);
+ string lineAboveText = textArea.Document.GetText(lineAbove.Offset, lineAbove.Length).Trim();
+
+ LineSegment curLine = textArea.Document.GetLineSegment(lineNr);
+ string curLineText = textArea.Document.GetText(curLine.Offset, curLine.Length).Trim();
+
+ if (lineAboveText.EndsWith(")") && curLineText.StartsWith("{")) {
+ string indentation = GetIndentation(textArea, lineNr - 1);
+ textArea.Document.Replace(curLine.Offset, curLine.Length, indentation + curLineText);
+ return indentation.Length;
+ }
+
+ if (curLineText.StartsWith("}")) { // indent closing bracket.
+ int closingBracketOffset = TextUtilities.SearchBracketBackward(textArea.Document, curLine.Offset + textArea.Document.GetText(curLine.Offset, curLine.Length).IndexOf('}') - 1, '{', '}');
+ if (closingBracketOffset == -1) { // no closing bracket found -> autoindent
+ return AutoIndentLine(textArea, lineNr);
+ }
+
+ string indentation = GetIndentation(textArea, textArea.Document.GetLineNumberForOffset(closingBracketOffset));
+
+ textArea.Document.Replace(curLine.Offset, curLine.Length, indentation + curLineText);
+ return indentation.Length;
+ }
+
+ if (lineAboveText.EndsWith(";")) { // expression ended, reset to valid indent.
+ int closingBracketOffset = TextUtilities.SearchBracketBackward(textArea.Document, curLine.Offset + textArea.Document.GetText(curLine.Offset, curLine.Length).IndexOf('}') - 1, '{', '}');
+
+ if (closingBracketOffset == -1) { // no closing bracket found -> autoindent
+ return AutoIndentLine(textArea, lineNr);
+ }
+
+ int closingBracketLineNr = textArea.Document.GetLineNumberForOffset(closingBracketOffset);
+ LineSegment closingBracketLine = textArea.Document.GetLineSegment(closingBracketLineNr);
+ string closingBracketLineText = textArea.Document.GetText(closingBracketLine.Offset, closingBracketLine.Length).Trim();
+
+ string indentation = GetIndentation(textArea, closingBracketLineNr);
+
+ // special handling for switch statement formatting.
+ if (closingBracketLineText.StartsWith("switch")) {
+ if (lineAboveText.StartsWith("break;") ||
+ lineAboveText.StartsWith("goto") ||
+ lineAboveText.StartsWith("return")) {
+ } else {
+ indentation += ICSharpCode.TextEditor.Actions.Tab.GetIndentationString(textArea.Document);
+ }
+ }
+ indentation += ICSharpCode.TextEditor.Actions.Tab.GetIndentationString(textArea.Document);
+
+ textArea.Document.Replace(curLine.Offset, curLine.Length, indentation + curLineText);
+ return indentation.Length;
+ }
+
+ if (lineAboveText.EndsWith("{") || // indent opening bracket.
+ lineAboveText.EndsWith(":") || // indent case xyz:
+ (lineAboveText.EndsWith(")") && // indent single line if, for ... etc
+ (lineAboveText.StartsWith("if") ||
+ lineAboveText.StartsWith("while") ||
+ lineAboveText.StartsWith("for"))) ||
+ lineAboveText.EndsWith("else")) {
+ string indentation = GetIndentation(textArea, lineNr - 1) + ICSharpCode.TextEditor.Actions.Tab.GetIndentationString(textArea.Document);
+ textArea.Document.Replace(curLine.Offset, curLine.Length, indentation + curLineText);
+ return indentation.Length;
+ } else {
+ // try to indent linewrap
+ ArrayList bracketPos = new ArrayList();
+ for (int i = 0; i < lineAboveText.Length; ++i) { // search for a ( bracket that isn't closed
+ switch (lineAboveText[i]) {
+ case '(':
+ bracketPos.Add(i);
+ break;
+ case ')':
+ if (bracketPos.Count > 0) {
+ bracketPos.RemoveAt(bracketPos.Count - 1);
+ }
+ break;
+ }
+ }
+ if (bracketPos.Count > 0) {
+ int bracketIndex = (int)bracketPos[bracketPos.Count - 1];
+ string indentation = GetIndentation(textArea, lineNr - 1);
+
+ for (int i = 0; i <= bracketIndex; ++i) { // insert enough spaces to match
+ indentation += " "; // brace start in the next line
+ }
+
+ textArea.Document.Replace(curLine.Offset, curLine.Length, indentation + curLineText);
+ return indentation.Length;
+ }
+ }
+ }
+ return AutoIndentLine(textArea, lineNr);*/
+ return 0;
+ }
+
+ bool NeedCurlyBracket(string text)
+ {
+ int curlyCounter = 0;
+
+ bool inString = false;
+ bool inChar = false;
+
+ bool lineComment = false;
+ bool blockComment = false;
+
+ for (int i = 0; i < text.Length; ++i) {
+ switch (text[i]) {
+ case '\r':
+ case '\n':
+ lineComment = false;
+ break;
+ case '/':
+ if (blockComment) {
+ Debug.Assert(i > 0);
+ if (text[i - 1] == '*') {
+ blockComment = false;
+ }
+ }
+ if (!inString && !inChar && i + 1 < text.Length) {
+ if (!blockComment && text[i + 1] == '/') {
+ lineComment = true;
+ }
+ if (!lineComment && text[i + 1] == '*') {
+ blockComment = true;
+ }
+ }
+ break;
+ case '"':
+ inString = !inString;
+ break;
+ case '\'':
+ inChar = !inChar;
+ break;
+ case '{':
+ if (!(inString || inChar || lineComment || blockComment)) {
+ ++curlyCounter;
+ }
+ break;
+ case '}':
+ if (!(inString || inChar || lineComment || blockComment)) {
+ --curlyCounter;
+ }
+ break;
+ }
+ }
+ return curlyCounter > 0;
+ }
+
+ public override int FormatLine(IFormattableDocument textArea,int lineNr, int cursorOffset, char ch) // used for comment tag formater/inserter
+ {
+/*
+ switch (ch) {
+ case '}':
+ case '{':
+ return textArea.Document.FormattingStrategy.IndentLine(textArea, lineNr);
+ case '\n':
+ if (lineNr <= 0) {
+ return IndentLine(textArea, lineNr);
+ }
+
+ if (textArea.TextEditorProperties.AutoInsertCurlyBracket) {
+ string oldLineText = TextUtilities.GetLineAsString(textArea.Document, lineNr - 1);
+ if (oldLineText.EndsWith("{")) {
+ if (NeedCurlyBracket(textArea.Document.TextContent)) {
+ textArea.Document.Insert(textArea.Caret.Offset, "\n}");
+ IndentLine(textArea, lineNr + 1);
+ }
+ }
+ }
+
+ LineSegment lineAbove = textArea.Document.GetLineSegment(lineNr - 1);
+ string lineAboveText = textArea.Document.GetText(lineAbove.Offset, lineAbove.Length);
+
+ LineSegment curLine = textArea.Document.GetLineSegment(lineNr);
+
+ LineSegment nextLine = lineNr + 1 < textArea.Document.TotalNumberOfLines ? textArea.Document.GetLineSegment(lineNr + 1) : null;
+ string nextLineText = lineNr + 1 < textArea.Document.TotalNumberOfLines ? textArea.Document.GetText(nextLine.Offset, nextLine.Length) : "";
+
+ if (lineAbove.HighlightSpanStack != null && lineAbove.HighlightSpanStack.Count > 0) {
+ if (!((Span)lineAbove.HighlightSpanStack.Peek()).StopEOL) { // case for /* style comments
+ int index = lineAboveText.IndexOf("/*");
+
+ if (index > 0) {
+ string indentation = GetIndentation(textArea, lineNr - 1);
+ for (int i = indentation.Length; i < index; ++ i) {
+ indentation += ' ';
+ }
+ textArea.Document.Replace(curLine.Offset, cursorOffset - curLine.Offset, indentation + " * ");
+ return indentation.Length + 3;
+ }
+
+ index = lineAboveText.IndexOf("*");
+ if (index > 0) {
+ string indentation = GetIndentation(textArea, lineNr - 1);
+ for (int i = indentation.Length; i < index; ++ i) {
+ indentation += ' ';
+ }
+ textArea.Document.Replace(curLine.Offset, cursorOffset - curLine.Offset, indentation + "* ");
+ return indentation.Length + 2;
+ }
+ }
+ }
+ return IndentLine(textArea, lineNr);
+ }*/
+ return 0;
+ }
+ }
+}
Added: trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/Gui/ProjectConfigurationPropertyPanel.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/Gui/ProjectConfigurationPropertyPanel.cs 2004-03-25 21:55:04 UTC (rev 1246)
+++ trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/Gui/ProjectConfigurationPropertyPanel.cs 2004-03-25 22:19:12 UTC (rev 1247)
@@ -0,0 +1,338 @@
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Mike Krüger" email="mike at icsharpcode.net"/>
+// <version value="$version"/>
+// </file>
+
+using System;
+using System.Drawing;
+
+using MonoDevelop.Internal.Project;
+using MonoDevelop.Internal.ExternalTool;
+using MonoDevelop.Gui.Dialogs;
+using MonoDevelop.Core.Services;
+using MonoDevelop.Core.Properties;
+using MonoDevelop.Core.AddIns.Codons;
+
+namespace JavaBinding
+{
+ /// <summary>
+ /// Summary description for Form5.
+ /// </summary>
+ public class ProjectConfigurationPropertyPanel : AbstractOptionPanel
+ {
+ /*private System.Windows.Forms.GroupBox groupBox1;
+ private System.Windows.Forms.GroupBox groupBox2;
+ private System.Windows.Forms.Label label4;
+ private System.Windows.Forms.Label label5;
+
+ private System.Windows.Forms.TextBox textBox2;
+ private System.Windows.Forms.TextBox textBox3;
+ private System.Windows.Forms.Button button1;
+
+ private System.Windows.Forms.CheckBox checkBox3;
+ private System.Windows.Forms.CheckBox checkBox5;
+ private System.Windows.Forms.CheckBox checkBox6;
+ private System.Windows.Forms.CheckBox checkBox7;
+
+ private System.Windows.Forms.Label label6;
+ private System.Windows.Forms.Label label7;
+ private System.Windows.Forms.Label label8;
+
+ private System.Windows.Forms.TextBox textBox5; //Compiler Path
+ private System.Windows.Forms.TextBox textBox6; //Classpath
+ private System.Windows.Forms.TextBox textBox7; //MainClass
+
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.Container components = null;
+ ResourceService resourceService = (ResourceService)ServiceManager.Services.GetService(typeof(IResourceService));
+ JavaCompilerParameters compilerParameters = null;
+
+ public override bool ReceiveDialogMessage(DialogMessage message)
+ {
+ if (message == DialogMessage.OK) {
+ if (compilerParameters == null)
+ return true;
+ compilerParameters.GenWarnings = checkBox7.Checked;
+ compilerParameters.Deprecation = checkBox6.Checked;
+ compilerParameters.Debugmode = checkBox5.Checked;
+ compilerParameters.Optimize = checkBox3.Checked;
+ compilerParameters.OutputAssembly = textBox2.Text;
+ compilerParameters.OutputDirectory = textBox3.Text;
+
+ compilerParameters.CompilerPath = textBox5.Text;
+ compilerParameters.ClassPath = textBox6.Text;
+ compilerParameters.MainClass = textBox7.Text;
+ }
+ return true;
+ }
+
+ void SetValues(object sender, EventArgs e)
+ {
+ this.compilerParameters = (JavaCompilerParameters)((IProperties)CustomizationObject).GetProperty("Config");
+
+ checkBox3.Checked = compilerParameters.Optimize;
+ checkBox5.Checked = compilerParameters.Debugmode;
+ checkBox6.Checked = compilerParameters.Deprecation;
+ checkBox7.Checked = compilerParameters.GenWarnings;
+ textBox2.Text = compilerParameters.OutputAssembly;
+ textBox3.Text = compilerParameters.OutputDirectory;
+
+ textBox5.Text = compilerParameters.CompilerPath;
+ textBox6.Text = compilerParameters.ClassPath;
+ textBox7.Text = compilerParameters.MainClass;
+ }
+
+ void SelectFolder(object sender, EventArgs e)
+ {
+ FolderDialog fdiag = new FolderDialog();
+
+ if (fdiag.DisplayDialog(resourceService.GetString("Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription")) == DialogResult.OK) {
+ textBox3.Text = fdiag.Path;
+ }
+ }
+
+ public ProjectConfigurationPropertyPanel()
+ {
+ InitializeComponent();
+ CustomizationObjectChanged += new EventHandler(SetValues);
+ }
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ protected override void Dispose( bool disposing )
+ {
+ if( disposing )
+ {
+ if(components != null)
+ {
+ components.Dispose();
+ }
+ }
+ base.Dispose( disposing );
+ }
+
+ #region Windows Form Designer generated code
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.groupBox1 = new System.Windows.Forms.GroupBox();
+ this.checkBox6 = new System.Windows.Forms.CheckBox();
+ this.checkBox5 = new System.Windows.Forms.CheckBox();
+
+ this.checkBox3 = new System.Windows.Forms.CheckBox();
+
+ this.groupBox2 = new System.Windows.Forms.GroupBox();
+ this.button1 = new System.Windows.Forms.Button();
+ this.textBox3 = new System.Windows.Forms.TextBox();
+ this.label5 = new System.Windows.Forms.Label();
+ this.textBox2 = new System.Windows.Forms.TextBox();
+ this.label4 = new System.Windows.Forms.Label();
+
+ this.checkBox7 = new System.Windows.Forms.CheckBox();
+ this.textBox5 = new System.Windows.Forms.TextBox();
+ this.textBox6 = new System.Windows.Forms.TextBox();
+ this.textBox7 = new System.Windows.Forms.TextBox();
+
+ this.label6 = new System.Windows.Forms.Label();
+ this.label7 = new System.Windows.Forms.Label();
+ this.label8 = new System.Windows.Forms.Label();
+
+ this.groupBox1.SuspendLayout();
+ this.groupBox2.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // groupBox1
+ //
+ this.groupBox1.Controls.AddRange(new System.Windows.Forms.Control[] { this.textBox5,
+ this.textBox6,
+ this.textBox7,
+ this.label6,
+ this.label7,
+ this.label8,
+ this.checkBox5,
+ this.checkBox6,
+ this.checkBox7,
+ this.checkBox3});
+ this.groupBox1.Location = new System.Drawing.Point(8, 8);
+ this.groupBox1.Name = "groupBox1";
+ this.groupBox1.Size = new System.Drawing.Size(376, 232);
+ this.groupBox1.TabIndex = 0;
+ this.groupBox1.TabStop = false;
+ this.groupBox1.Text = resourceService.GetString("Dialog.Options.PrjOptions.Configuration.CodeGenerationGroupBox");
+
+ //
+ // checkBox6
+ //
+ this.checkBox6.Location = new System.Drawing.Point(192, 128);
+ this.checkBox6.Name = "checkBox6";
+ this.checkBox6.Size = new System.Drawing.Size(176, 16);
+ this.checkBox6.TabIndex = 8;
+ this.checkBox6.Text = "Deprecation";
+ //this.checkBox5.Text = resourceService.GetString("Dialog.Options.PrjOptions.Configuration.DebugInformationCheckBox");
+
+ //
+ // checkBox7
+ //
+ this.checkBox7.Location = new System.Drawing.Point(192, 146);
+ this.checkBox7.Name = "checkBox7";
+ this.checkBox7.Size = new System.Drawing.Size(176, 16);
+ this.checkBox7.TabIndex = 8;
+ this.checkBox7.Text = "Generate Warnings";
+ //this.checkBox5.Text = resourceService.GetString("Dialog.Options.PrjOptions.Configuration.DebugInformationCheckBox");
+
+ //
+ // checkBox5
+ //
+ this.checkBox5.Location = new System.Drawing.Point(192, 112);
+ this.checkBox5.Name = "checkBox5";
+ this.checkBox5.Size = new System.Drawing.Size(176, 16);
+ this.checkBox5.TabIndex = 8;
+ this.checkBox5.Text = resourceService.GetString("Dialog.Options.PrjOptions.Configuration.DebugInformationCheckBox");
+
+ //
+ // checkBox3
+ //
+ this.checkBox3.Location = new System.Drawing.Point(192, 96);
+ this.checkBox3.Name = "checkBox3";
+ this.checkBox3.Size = new System.Drawing.Size(176, 16);
+ this.checkBox3.TabIndex = 7;
+ this.checkBox3.Text = resourceService.GetString("Dialog.Options.PrjOptions.Configuration.OptimizeCheckBox");
+
+ //
+ // label6
+ //
+ this.label6.Location = new System.Drawing.Point(18, 50);
+ this.label6.Name = "label6";
+ this.label6.Size = new System.Drawing.Size(80, 23);
+ this.label6.TabIndex = 99;
+ this.label6.Text = "Compiler Path"; //resourceService.GetString("Dialog.Options.PrjOptions.Configuration.OutputPathLabel");
+
+ //
+ // textBox5
+ //
+ this.textBox5.Location = new System.Drawing.Point(186, 50);
+ this.textBox5.Name = "textBox5";
+ this.textBox5.Size = new System.Drawing.Size(182, 20);
+ this.textBox5.TabIndex = 1;
+ this.textBox5.Text = "";
+
+ //
+ // label7
+ //
+ this.label7.Location = new System.Drawing.Point(18, 70);
+ this.label7.Name = "label7";
+ this.label7.Size = new System.Drawing.Size(80, 23);
+ this.label7.TabIndex = 99;
+ this.label7.Text = "Class Path"; //resourceService.GetString("Dialog.Options.PrjOptions.Configuration.OutputPathLabel");
+
+ //
+ // textBox6
+ //
+ this.textBox6.Location = new System.Drawing.Point(186, 70);
+ this.textBox6.Name = "textBox6";
+ this.textBox6.Size = new System.Drawing.Size(182, 20);
+ this.textBox6.TabIndex = 1;
+ this.textBox6.Text = "";
+
+ //
+ // label8
+ //
+ this.label8.Location = new System.Drawing.Point(18, 170);
+ this.label8.Name = "label7";
+ this.label8.Size = new System.Drawing.Size(80, 23);
+ this.label8.TabIndex = 99;
+ this.label8.Text = "Main Class"; //resourceService.GetString("Dialog.Options.PrjOptions.Configuration.OutputPathLabel");
+
+
+ //
+ // textBox7
+ //
+ this.textBox7.Location = new System.Drawing.Point(186, 170);
+ this.textBox7.Name = "textBox7";
+ this.textBox7.Size = new System.Drawing.Size(182, 20);
+ this.textBox7.TabIndex = 1;
+ this.textBox7.Text = "";
+
+ //
+ // groupBox2
+ //
+ this.groupBox2.Controls.AddRange(new System.Windows.Forms.Control[] { //this.checkBox4,
+ this.button1,
+ this.textBox3,
+ this.label5,
+ this.textBox2,
+ this.label4});
+ this.groupBox2.Location = new System.Drawing.Point(8, 240);
+ this.groupBox2.Name = "groupBox2";
+ this.groupBox2.Size = new System.Drawing.Size(376, 96);
+ this.groupBox2.TabIndex = 2;
+ this.groupBox2.TabStop = false;
+ this.groupBox2.Text = resourceService.GetString("Dialog.Options.PrjOptions.Configuration.OutputGroupBox");
+
+ //
+ // button1
+ //
+ this.button1.Location = new System.Drawing.Point(344, 40);
+ this.button1.Name = "button1";
+ this.button1.Size = new System.Drawing.Size(24, 24);
+ this.button1.TabIndex = 3;
+ this.button1.Text = "...";
+ this.button1.Click += new EventHandler(SelectFolder);
+ //
+ // textBox3
+ //
+ this.textBox3.Location = new System.Drawing.Point(96, 40);
+ this.textBox3.Name = "textBox3";
+ this.textBox3.Size = new System.Drawing.Size(240, 20);
+ this.textBox3.TabIndex = 2;
+ this.textBox3.Text = "";
+ //
+ // label5
+ //
+ this.label5.Location = new System.Drawing.Point(8, 40);
+ this.label5.Name = "label5";
+ this.label5.Size = new System.Drawing.Size(80, 23);
+ this.label5.TabIndex = 99;
+ this.label5.Text = resourceService.GetString("Dialog.Options.PrjOptions.Configuration.OutputPathLabel");
+
+ //
+ // textBox2
+ //
+ this.textBox2.Location = new System.Drawing.Point(96, 16);
+ this.textBox2.Name = "textBox2";
+ this.textBox2.Size = new System.Drawing.Size(272, 20);
+ this.textBox2.TabIndex = 1;
+ this.textBox2.Text = "";
+ //
+ // label4
+ //
+ this.label4.Location = new System.Drawing.Point(8, 16);
+ this.label4.Name = "label4";
+ this.label4.Size = new System.Drawing.Size(88, 16);
+ this.label4.TabIndex = 99;
+ this.label4.Text = resourceService.GetString("Dialog.Options.PrjOptions.Configuration.WarningsAsErrorsCheckBox");
+
+ //
+ // Form5
+ //
+ this.ClientSize = new System.Drawing.Size(392, 341);
+ this.Controls.AddRange(new System.Windows.Forms.Control[] { this.groupBox2,
+ this.groupBox1});
+ this.Name = "Form5";
+ this.groupBox1.ResumeLayout(false);
+ this.groupBox2.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+ #endregion
+ */
+ }
+}
Added: trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/JavaBinding.prjx
===================================================================
--- trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/JavaBinding.prjx 2004-03-25 21:55:04 UTC (rev 1246)
+++ trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/JavaBinding.prjx 2004-03-25 22:19:12 UTC (rev 1247)
@@ -0,0 +1,37 @@
+<Project name="JavaBinding" standardNamespace="NewProject" description="" newfilesearch="None" enableviewstate="True" version="1.1" projecttype="C#">
+ <Contents>
+ <File name=".\JavaBindingCompilerServices.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
+ <File name=".\JavaLanguageBinding.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
+ <File name=".\Gui\ProjectConfigurationPropertyPanel.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
+ <File name=".\Project\JavaProject.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
+ <File name=".\Project\JavaCompilerParameters.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
+ <File name=".\JavaBindingExecutionServices.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
+ <File name=".\FormatingStrategy\JavaFormattingStrategy.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
+ <File name=".\ProjectTreeBuilder\JavaNodeBuilder.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
+ </Contents>
+ <References>
+ <Reference type="Assembly" refto="..\..\..\..\bin\SharpDevelop.Base.dll" localcopy="False" />
+ <Reference type="Assembly" refto="..\..\..\..\bin\ICSharpCode.Core.dll" localcopy="False" />
+ <Reference type="Assembly" refto="..\..\..\..\bin\ICSharpCode.TextEditor.dll" localcopy="False" />
+ <Reference type="Assembly" refto="..\..\..\..\bin\ICSharpCode.XmlForms.dll" localcopy="False" />
+ <Reference type="Assembly" refto="..\..\..\..\bin\ICSharpCode.Debugger.dll" localcopy="True" />
+ </References>
+ <DeploymentInformation target="" script="" strategy="File" />
+ <Configuration runwithwarnings="False" name="Debug">
+ <CodeGeneration runtime="MsNet" compiler="Csc" warninglevel="4" nowarn="" includedebuginformation="True" optimize="True" unsafecodeallowed="True" generateoverflowchecks="True" mainclass="" target="Library" definesymbols="" generatexmldocumentation="False" win32Icon="" />
+ <Execution commandlineparameters="" consolepause="False" />
+ <Output directory="..\..\..\..\AddIns\AddIns\BackendBindings" assembly="JavaBinding" executeScript="" executeBeforeBuild="" executeAfterBuild="" />
+ </Configuration>
+ <Configurations active="Debug">
+ <Configuration runwithwarnings="False" name="Debug">
+ <CodeGeneration runtime="MsNet" compiler="Csc" warninglevel="4" nowarn="" includedebuginformation="True" optimize="True" unsafecodeallowed="True" generateoverflowchecks="True" mainclass="" target="Library" definesymbols="" generatexmldocumentation="False" win32Icon="" />
+ <Execution commandlineparameters="" consolepause="False" />
+ <Output directory="..\..\..\..\AddIns\AddIns\BackendBindings" assembly="JavaBinding" executeScript="" executeBeforeBuild="" executeAfterBuild="" />
+ </Configuration>
+ <Configuration runwithwarnings="False" name="Release">
+ <CodeGeneration runtime="MsNet" compiler="Csc" warninglevel="4" nowarn="" includedebuginformation="True" optimize="True" unsafecodeallowed="True" generateoverflowchecks="True" mainclass="" target="Exe" definesymbols="" generatexmldocumentation="False" win32Icon="" />
+ <Execution commandlineparameters="" consolepause="True" />
+ <Output directory="..\..\..\..\AddIns\AddIns\BackendBindings" assembly="JavaBinding" executeScript="" executeBeforeBuild="" executeAfterBuild="" />
+ </Configuration>
+ </Configurations>
+</Project>
\ No newline at end of file
Added: trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/JavaBindingCompilerServices.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/JavaBindingCompilerServices.cs 2004-03-25 21:55:04 UTC (rev 1246)
+++ trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/JavaBindingCompilerServices.cs 2004-03-25 22:19:12 UTC (rev 1247)
@@ -0,0 +1,189 @@
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Mike Krüger" email="mike at icsharpcode.net"/>
+// <version value="$version"/>
+// </file>
+
+using System;
+using System.IO;
+using System.CodeDom.Compiler;
+
+using MonoDevelop.Core.Services;
+using MonoDevelop.Internal.Project;
+
+namespace JavaBinding
+{
+ /// <summary>
+ /// This class controls the compilation of C Sharp files and C Sharp projects
+ /// </summary>
+ public class JavaBindingCompilerServices
+ {
+ public bool CanCompile(string fileName)
+ {
+ return Path.GetExtension(fileName) == ".java";
+ }
+
+ public ICompilerResult CompileFile(string filename)
+ {
+ string output = "";
+ string error = "";
+ string options = "";
+
+ JavaCompilerParameters cparam = new JavaCompilerParameters();
+
+ if (cparam.Debugmode) {
+ options += " -g ";
+ } else {
+ options += " -g:none ";
+ }
+
+ if (cparam.Optimize) {
+ options += " -O ";
+ }
+
+ if (cparam.GenWarnings) {
+ options += " -nowarn ";
+ }
+ options += " -encoding utf8 ";
+
+ TempFileCollection tf = new TempFileCollection();
+
+ string outstr = "javac \"" + filename + "\" -classpath " + cparam.ClassPath + options;
+ Executor.ExecWaitWithCapture(outstr, tf, ref error , ref output);
+
+ ICompilerResult cr = ParseOutput(tf, output);
+
+ File.Delete(output);
+ File.Delete(error);
+
+ return cr;
+ }
+
+ public string GetCompiledOutputName(string fileName)
+ {
+ return Path.ChangeExtension(fileName, ".class");
+ }
+ FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
+ public string GetCompiledOutputName(IProject project)
+ {
+ JavaProject p = (JavaProject)project;
+ JavaCompilerParameters compilerparameters = (JavaCompilerParameters)p.ActiveConfiguration;
+
+ string exe = fileUtilityService.GetDirectoryNameWithSeparator(compilerparameters.OutputDirectory) + compilerparameters.OutputAssembly + ".class";
+ return exe;
+ }
+
+ public ICompilerResult CompileProject(IProject project)
+ {
+ JavaProject p = (JavaProject)project;
+ JavaCompilerParameters compilerparameters = (JavaCompilerParameters)p.ActiveConfiguration;
+
+ string exe = fileUtilityService.GetDirectoryNameWithSeparator(compilerparameters.OutputDirectory) + compilerparameters.OutputAssembly + ".class";
+ string options = "";
+
+ if (compilerparameters.Debugmode)
+ options += " -g ";
+ else
+ options += " -g:none ";
+
+ if (compilerparameters.Optimize)
+ options += " -O ";
+
+ if (compilerparameters.Deprecation)
+ options += " -deprecation ";
+
+ if (compilerparameters.GenWarnings)
+ options += " -nowarn ";
+
+ if (compilerparameters.ClassPath == null)
+ options += " -classpath " + compilerparameters.ClassPath;
+
+ options += " -encoding utf8 ";
+
+ string output = "";
+ string error = "";
+ string files = "";
+
+ foreach (ProjectFile finfo in p.ProjectFiles) {
+ if (finfo.Subtype != Subtype.Directory) {
+ switch (finfo.BuildAction) {
+ case BuildAction.Compile:
+ files = files + " \"" + finfo.Name + "\"";
+ break;
+ }
+ }
+ }
+
+ TempFileCollection tf = new TempFileCollection ();
+
+ //string CurrentDir = Directory.GetCurrentDirectory();
+ //Directory.SetCurrentDirectory(compilerparameters.OutputDirectory);
+
+ //string outstr = compilerparameters.CompilerPath + "" + files + " -classpath " + compilerparameters.ClassPath + options;
+ //string outstr = compilerparameters.CompilerPath + "" + files + " -classpath " + compilerparameters.ClassPath + options;
+ string outstr = compilerparameters.CompilerPath + " " + files + options;
+ Executor.ExecWaitWithCapture(outstr, tf, ref error , ref output);
+ ICompilerResult cr = ParseOutput(tf, output);
+
+ File.Delete(output);
+ File.Delete(error);
+
+ //Directory.SetCurrentDirectory(CurrentDir);
+
+// TempFileCollection tf = new TempFileCollection ();
+// string output = "";
+// string error = "";
+// //string outstr = compilerparameters.CompilerPath + " " + compilerparameters.OutputDirectory+"untitled.java -classpath " + compilerparameters.ClassPath + options;
+// string outstr = compilerparameters.CompilerPath + " " + compilerparameters.OutputDirectory + finfo.Name;
+// Executor.ExecWaitWithCapture(outstr, tf, ref error , ref output);
+// CompilerResults cr = ParseOutput(tf, output);
+// File.Delete(output);
+// File.Delete(error);
+
+ return cr;
+ }
+
+ ICompilerResult ParseOutput(TempFileCollection tf, string file)
+ {
+ string compilerOutput = "";
+ StreamReader sr = new StreamReader(file, System.Text.Encoding.Default);
+ CompilerResults cr = new CompilerResults(tf);
+
+ while (true)
+ {
+ string next = sr.ReadLine();
+
+ if (next == null)
+ break;
+
+ compilerOutput += next + "\n";
+
+ CompilerError error = new CompilerError();
+
+ int index1 = next.IndexOf(".java:");
+ if (index1 < 0)
+ continue;
+
+ string s1 = next.Substring(0, index1);
+ string s2 = next.Substring(index1 + 6);
+ int index2 = s2.IndexOf(":");
+ int line = Int32.Parse(next.Substring(index1 + 6,index2));
+
+// error.Column = Int32.Parse(pos2[1]);
+// error.IsWarning = what[0] == "warning";
+// error.ErrorNumber = what[what.Length - 1];
+
+ error.Column = 25;
+ error.Line = line;
+ error.ErrorText = next.Substring(index1 + index2 + 7);
+ error.FileName = Path.GetFullPath(next.Substring(0, index1) + ".java"); //Path.GetFileName(filename);
+ cr.Errors.Add(error);
+
+ }
+ sr.Close();
+ return new DefaultCompilerResult(cr, compilerOutput);
+
+ }
+ }
+}
Added: trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/JavaBindingExecutionServices.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/JavaBindingExecutionServices.cs 2004-03-25 21:55:04 UTC (rev 1246)
+++ trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/JavaBindingExecutionServices.cs 2004-03-25 22:19:12 UTC (rev 1247)
@@ -0,0 +1,79 @@
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Mike Krüger" email="mike at icsharpcode.net"/>
+// <version value="$version"/>
+// </file>
+
+using System;
+using System.IO;
+using System.Diagnostics;
+using System.Collections;
+using System.Reflection;
+using System.Resources;
+using System.Xml;
+using System.CodeDom.Compiler;
+using System.Threading;
+
+using MonoDevelop.Internal.Project;
+using MonoDevelop.Gui;
+using MonoDevelop.Core.Services;
+
+namespace JavaBinding
+{
+ /// <summary>
+ /// This class controls the compilation of C Sharp files and C Sharp projects
+ /// </summary>
+ public class JavaBindingExecutionServices
+ {
+
+ public void Execute(string filename)
+ {
+ string exe = Path.GetFileNameWithoutExtension(filename);
+ ProcessStartInfo psi = new ProcessStartInfo(Environment.GetEnvironmentVariable("ComSpec"), "/c java " + "\"" + exe + "\"" + " & pause");
+ psi.WorkingDirectory = Path.GetDirectoryName(filename);
+ psi.UseShellExecute = false;
+ try {
+ Process p = new Process();
+ p.StartInfo = psi;
+ p.Start();
+ } catch (Exception) {
+ throw new ApplicationException("Can't execute " + "\"" + exe + "\"\n(.NET bug? Try restaring SD or manual start)");
+ }
+ }
+
+ public void Execute(IProject project)
+ {
+ JavaCompilerParameters parameters = (JavaCompilerParameters)project.ActiveConfiguration;
+ FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
+ string directory = fileUtilityService.GetDirectoryNameWithSeparator(((JavaCompilerParameters)project.ActiveConfiguration).OutputDirectory);
+
+ string CurrentDir = Directory.GetCurrentDirectory();
+ Directory.SetCurrentDirectory(parameters.OutputDirectory);
+ ProcessStartInfo psi;
+ if(((JavaCompilerParameters)project.ActiveConfiguration).MainClass==null) {
+ psi = new ProcessStartInfo(Environment.GetEnvironmentVariable("ComSpec"), "/c java " + ((JavaCompilerParameters)project.ActiveConfiguration).OutputAssembly + " & pause");
+ } else {
+ if (parameters.PauseConsoleOutput) {
+ psi = new ProcessStartInfo(Environment.GetEnvironmentVariable("ComSpec"), "/c java " + ((JavaCompilerParameters)project.ActiveConfiguration).MainClass + " & pause");
+ } else {
+ psi = new ProcessStartInfo(Environment.GetEnvironmentVariable("ComSpec"), "/c java " + ((JavaCompilerParameters)project.ActiveConfiguration).MainClass);
+ }
+ }
+
+ try {
+ psi.WorkingDirectory = parameters.OutputDirectory;
+ psi.UseShellExecute = false;
+
+ Process p = new Process();
+ p.StartInfo = psi;
+ p.Start();
+ } catch (Exception) {
+ throw new ApplicationException("Can't execute");
+ }
+
+ Directory.SetCurrentDirectory(CurrentDir);
+ }
+
+ }
+}
Added: trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/JavaLanguageBinding.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/JavaLanguageBinding.cs 2004-03-25 21:55:04 UTC (rev 1246)
+++ trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/JavaLanguageBinding.cs 2004-03-25 22:19:12 UTC (rev 1247)
@@ -0,0 +1,95 @@
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Mike Krüger" email="mike at icsharpcode.net"/>
+// <version value="$version"/>
+// </file>
+
+using System;
+using System.IO;
+using System.Diagnostics;
+using System.Collections;
+using System.Reflection;
+using System.Resources;
+using System.Xml;
+
+using MonoDevelop.Internal.Project;
+using MonoDevelop.Internal.Templates;
+using MonoDevelop.Gui;
+
+namespace JavaBinding
+{
+ /// <summary>
+ /// This class describes the main functionalaty of a language binding
+ /// </summary>
+ public class JavaLanguageBinding : ILanguageBinding
+ {
+ public const string LanguageName = "Java";
+
+ JavaBindingCompilerServices compilerServices = new JavaBindingCompilerServices();
+ JavaBindingExecutionServices executionServices = new JavaBindingExecutionServices();
+
+ public string Language {
+ get {
+ return LanguageName;
+ }
+ }
+
+ public void Execute (string filename)
+ {
+ Debug.Assert(executionServices != null);
+ executionServices.Execute(filename);
+ }
+
+ public void Execute (IProject project)
+ {
+ Debug.Assert (executionServices != null);
+ executionServices.Execute (project);
+ }
+
+ public string GetCompiledOutputName(string fileName)
+ {
+ Debug.Assert(compilerServices != null);
+ return compilerServices.GetCompiledOutputName(fileName);
+ }
+
+ public string GetCompiledOutputName(IProject project)
+ {
+ Debug.Assert(compilerServices != null);
+ return compilerServices.GetCompiledOutputName(project);
+ }
+
+ public bool CanCompile(string fileName)
+ {
+ Debug.Assert(compilerServices != null);
+ return compilerServices.CanCompile(fileName);
+ }
+
+ public ICompilerResult CompileFile(string fileName)
+ {
+ Debug.Assert(compilerServices != null);
+ return compilerServices.CompileFile(fileName);
+ }
+
+ public ICompilerResult CompileProject(IProject project)
+ {
+ Debug.Assert(compilerServices != null);
+ return compilerServices.CompileProject(project);
+ }
+
+ public ICompilerResult RecompileProject(IProject project)
+ {
+ return CompileProject(project);
+ }
+
+ public IProject CreateProject(ProjectCreateInformation info, XmlElement projectOptions)
+ {
+ return new JavaProject(info, projectOptions);
+ }
+
+ public void DebugProject (IProject project)
+ {
+ //executionManager.Debug (project);
+ }
+ }
+}
Added: trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/Makefile.am
===================================================================
--- trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/Makefile.am 2004-03-25 21:55:04 UTC (rev 1246)
+++ trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/Makefile.am 2004-03-25 22:19:12 UTC (rev 1247)
@@ -0,0 +1,30 @@
+
+CSC = mcs /debug
+ASSEMBLY = JavaBinding.dll
+ADDIN = JavaBinding.addin
+
+DLLS = /r:System.Drawing.dll \
+ /r:../../../../build/bin/MonoDevelop.Core.dll \
+ /r:../../../../build/bin/MonoDevelop.SourceEditor.dll \
+ /r:../../../../build/bin/MonoDevelop.Base.dll \
+ /r:../../../../build/bin/ICSharpCode.SharpRefactory.dll \
+ /r:../../../../build/bin/MonoDevelop.Gui.Widgets.dll \
+ /r:gtk-sharp.dll
+
+FILES = ./Gui/ProjectConfigurationPropertyPanel.cs \
+./Project/JavaCompilerParameters.cs \
+./Project/JavaProject.cs \
+./JavaBindingCompilerServices.cs \
+./JavaLanguageBinding.cs \
+./FormatingStrategy/JavaFormattingStrategy.cs \
+./JavaBindingExecutionServices.cs \
+./ProjectTreeBuilder/JavaNodeBuilder.cs
+
+all: $(ASSEMBLY)
+
+$(ASSEMBLY): $(FILES)
+ $(CSC) $(DLLS) $(FILES) /out:$(ASSEMBLY) /target:library
+
+CLEANFILES = $(ASSEMBLY)
+EXTRA_DIST = $(FILES) $(ADDIN)
+
Added: trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/Project/JavaCompilerParameters.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/Project/JavaCompilerParameters.cs 2004-03-25 21:55:04 UTC (rev 1246)
+++ trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/Project/JavaCompilerParameters.cs 2004-03-25 22:19:12 UTC (rev 1247)
@@ -0,0 +1,140 @@
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Mike Krüger" email="mike at icsharpcode.net"/>
+// <version value="$version"/>
+// </file>
+
+using System;
+using System.Xml;
+using System.Diagnostics;
+
+using MonoDevelop.Internal.Project;
+
+namespace JavaBinding
+{
+ /// <summary>
+ /// This class handles project specific compiler parameters
+ /// </summary>
+ public class JavaCompilerParameters : AbstractProjectConfiguration
+ {
+ [XmlNodeName("CodeGeneration")]
+ class CodeGeneration
+ {
+ [XmlAttribute("includedebuginformation")]
+ public bool debugmode = true;
+
+ [XmlAttribute("deprecation")]
+ public bool deprecation = true;
+
+ [XmlAttribute("optimize")]
+ public bool optimize = true;
+
+ [XmlAttribute("mainclass")]
+ public string mainclass = null;
+
+ [XmlAttribute("definesymbols")]
+ public string definesymbols = String.Empty;
+
+ [XmlAttribute("classpath")]
+ public string classpath = String.Empty;
+
+ [XmlAttribute("compilerpath")]
+ public string compilerpath = "javac.exe";
+
+ [XmlAttribute("genwarnings")]
+ public bool genwarnings = false;
+ }
+
+ [XmlNodeName("Execution")]
+ class Execution
+ {
+ [XmlAttribute("consolepause")]
+ public bool pauseconsoleoutput = true;
+ }
+
+ CodeGeneration codeGeneration = new CodeGeneration();
+
+ Execution execution = new Execution();
+
+ public bool GenWarnings {
+ get {
+ return codeGeneration.genwarnings;
+ }
+ set {
+ codeGeneration.genwarnings = value;
+ }
+ }
+
+ public string ClassPath {
+ get {
+ return codeGeneration.classpath;
+ }
+ set {
+ codeGeneration.classpath = value;
+ }
+ }
+
+ public string CompilerPath {
+ get {
+ return codeGeneration.compilerpath;
+ }
+ set {
+ codeGeneration.compilerpath = value;
+ }
+ }
+
+ public bool Debugmode {
+ get {
+ return codeGeneration.debugmode;
+ }
+ set {
+ codeGeneration.debugmode = value;
+ }
+ }
+
+ public bool Deprecation {
+ get {
+ return codeGeneration.deprecation;
+ }
+ set {
+ codeGeneration.deprecation = value;
+ }
+ }
+
+ public bool Optimize {
+ get {
+ return codeGeneration.optimize;
+ }
+ set {
+ codeGeneration.optimize = value;
+ }
+ }
+
+ public string MainClass {
+ get {
+ return codeGeneration.mainclass;
+ }
+ set {
+ codeGeneration.mainclass = value;
+ }
+ }
+
+ public bool PauseConsoleOutput {
+ get {
+ return execution.pauseconsoleoutput;
+ }
+ set {
+ execution.pauseconsoleoutput = value;
+ }
+ }
+
+ public JavaCompilerParameters()
+ {
+ }
+ public JavaCompilerParameters(string name)
+ {
+ this.name = name;
+ }
+ }
+}
Added: trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/Project/JavaProject.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/Project/JavaProject.cs 2004-03-25 21:55:04 UTC (rev 1246)
+++ trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/Project/JavaProject.cs 2004-03-25 22:19:12 UTC (rev 1247)
@@ -0,0 +1,70 @@
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Mike Krüger" email="mike at icsharpcode.net"/>
+// <version value="$version"/>
+// </file>
+
+using System;
+using System.IO;
+using System.Collections;
+using System.Diagnostics;
+using System.ComponentModel;
+using System.Xml;
+
+using MonoDevelop.Internal.Project;
+using MonoDevelop.Internal.Templates;
+
+namespace JavaBinding
+{
+
+ /// <summary>
+ /// This class describes a C Sharp project and it compilation options.
+ /// </summary>
+ public class JavaProject : AbstractProject
+ {
+ public override string ProjectType {
+ get {
+ return JavaLanguageBinding.LanguageName;
+ }
+ }
+
+ public override IConfiguration CreateConfiguration()
+ {
+ return new JavaCompilerParameters();
+ }
+
+ public JavaProject()
+ {
+ }
+
+ public JavaProject(ProjectCreateInformation info, XmlElement projectOptions)
+ {
+ if (info != null) {
+ Name = info.ProjectName;
+
+ Configurations.Add(CreateConfiguration("Debug"));
+ Configurations.Add(CreateConfiguration("Release"));
+
+ XmlElement el = projectOptions;
+
+ foreach (JavaCompilerParameters parameter in Configurations) {
+ parameter.OutputDirectory = info.BinPath;
+ parameter.OutputAssembly = Name;
+
+ if (el != null) {
+ if (el.Attributes["MainClass"] != null) {
+ parameter.MainClass = el.Attributes["MainClass"].InnerText;
+ }
+ if (el.Attributes["PauseConsoleOutput"] != null) {
+ parameter.PauseConsoleOutput = Boolean.Parse(el.Attributes["PauseConsoleOutput"].InnerText);
+ }
+ if (el.Attributes["ClassPath"] != null) {
+ parameter.ClassPath = el.Attributes["ClassPath"].InnerText;
+ }
+ }
+ }
+ }
+ }
+ }
+}
Added: trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/ProjectTreeBuilder/JavaNodeBuilder.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/ProjectTreeBuilder/JavaNodeBuilder.cs 2004-03-25 21:55:04 UTC (rev 1246)
+++ trunk/MonoDevelop/src/AddIns/BackendBindings/JavaBinding/ProjectTreeBuilder/JavaNodeBuilder.cs 2004-03-25 22:19:12 UTC (rev 1247)
@@ -0,0 +1,151 @@
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Mike Krüger" email="mike at icsharpcode.net"/>
+// <version value="$version"/>
+// </file>
+
+using System;
+using System.IO;
+using System.Diagnostics;
+using System.Collections;
+using System.Reflection;
+using System.Resources;
+using System.Xml;
+
+using MonoDevelop.Core.Properties;
+using MonoDevelop.Core.Services;
+using MonoDevelop.Internal.Project;
+using MonoDevelop.Gui;
+using MonoDevelop.Gui.Pads.ProjectBrowser;
+
+namespace JavaBinding
+{
+ public class JavaNodeBuilder : IProjectNodeBuilder
+ {
+ FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
+ ResourceService resourceService = (ResourceService)ServiceManager.Services.GetService(typeof(IResourceService));
+ IconService iconService = (IconService)ServiceManager.Services.GetService(typeof(IconService));
+
+ public bool CanBuildProjectTree(IProject project)
+ {
+ return project.ProjectType == JavaLanguageBinding.LanguageName;
+ }
+
+ public AbstractBrowserNode BuildProjectTreeNode(IProject project)
+ {
+/*
+ ProjectBrowserNode projectNode = new ProjectBrowserNode(project);
+
+ projectNode.IconImage = iconService.GetImageForProjectType(project.ProjectType);
+
+ // create 'empty' directories
+ for (int i = 0; i < project.ProjectFiles.Count; ++i) {
+ if (project.ProjectFiles[i].Subtype == Subtype.Directory) {
+ string directoryName = fileUtilityService.AbsoluteToRelativePath(project.BaseDirectory, project.ProjectFiles[i].Name);
+
+ // if directoryname starts with ./ oder .\
+ if (directoryName.StartsWith(".")) {
+ directoryName = directoryName.Substring(2);
+ }
+
+ string parentDirectory = Path.GetFileName(directoryName);
+
+ AbstractBrowserNode currentPathNode = GetPath(directoryName, projectNode, true);
+
+ DirectoryNode newFolderNode = new DirectoryNode(project.ProjectFiles[i].Name);
+ newFolderNode.OpenedImage = resourceService.GetBitmap("Icons.16x16.OpenFolderBitmap");
+ newFolderNode.ClosedImage = resourceService.GetBitmap("Icons.16x16.ClosedFolderBitmap");
+
+ currentPathNode.Nodes.Add(newFolderNode);
+
+ }
+ }
+
+ // create file tree
+ for (int i = 0; i < project.ProjectFiles.Count; ++i) {
+ if (project.ProjectFiles[i].Subtype != Subtype.Directory) {
+ ProjectFile fileInformation = project.ProjectFiles[i];
+
+ string relativeFile = fileUtilityService.AbsoluteToRelativePath(project.BaseDirectory, fileInformation.Name);
+
+ string fileName = Path.GetFileName(fileInformation.Name);
+
+ switch (fileInformation.BuildAction) {
+
+ case BuildAction.Exclude:
+ break;
+
+ default:
+ AbstractBrowserNode currentPathNode = GetPath(relativeFile, projectNode, true);
+
+ AbstractBrowserNode newNode = new FileNode(fileInformation);
+ newNode.ContextmenuAddinTreePath = FileNode.ProjectFileContextMenuPath;
+ currentPathNode.Nodes.Add(newNode);
+ break;
+ }
+ }
+ }
+
+ return projectNode;
+*/
+ return null;
+ }
+
+/*
+ AbstractBrowserNode GetNodeFromCollection (TreeNodeCollection collection, string title)
+ {
+ foreach (AbstractBrowserNode node in collection) {
+ if (node.Text == title) {
+ return node;
+ }
+ }
+ return null;
+ }
+*/
+
+ public AbstractBrowserNode GetPath(string filename, AbstractBrowserNode root, bool create)
+ {
+ string directory = Path.GetDirectoryName(filename);
+ string[] treepath = directory.Split(new char[] { Path.DirectorySeparatorChar });
+ AbstractBrowserNode curpathnode = root;
+
+ foreach (string path in treepath) {
+ if (path.Length == 0 || path[0] == '.') {
+ continue;
+ }
+
+ AbstractBrowserNode node = null;
+ //AbstractBrowserNode node = GetNodeFromCollection(curpathnode.Nodes, path);
+
+ if (node == null) {
+ if (create) {
+ DirectoryNode newFolderNode = new DirectoryNode(fileUtilityService.GetDirectoryNameWithSeparator(ConstructFolderName(curpathnode)) + path);
+ curpathnode.Nodes.Add(newFolderNode);
+ curpathnode = newFolderNode;
+ continue;
+ } else {
+ return null;
+ }
+ }
+ curpathnode = node;
+ }
+
+ return curpathnode;
+ }
+
+ public string ConstructFolderName(AbstractBrowserNode folderNode)
+ {
+ if (folderNode is DirectoryNode) {
+ return ((DirectoryNode)folderNode).FolderName;
+ }
+
+ if (folderNode is ProjectBrowserNode) {
+ return ((ProjectBrowserNode)folderNode).Project.BaseDirectory;
+ }
+
+ throw new ApplicationException("Folder name construction failed, got unexpected parent node :" + folderNode);
+ }
+
+ }
+}
More information about the Monodevelop-patches-list
mailing list