1 // ProjectConfigurationPropertyPanel.cs
3 // This file was derived from a file from #Develop.
5 // Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com>
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation; either version 2 of the License, or
10 // (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 using MonoDevelop
.Projects
;
25 using MonoDevelop
.Projects
.Gui
.Dialogs
;
26 using MonoDevelop
.Components
;
27 using MonoDevelop
.Core
;
31 public class ProjectConfigurationPropertyPanel
: MultiConfigItemOptionsPanel
33 CodeGenerationPanelWidget widget
;
35 public override Widget
CreatePanelWidget()
37 return (widget
= new CodeGenerationPanelWidget ());
40 public override void LoadConfigData ()
42 widget
.LoadConfigData (this);
45 public override void ApplyChanges ()
51 partial class CodeGenerationPanelWidget
: Gtk
.Bin
53 JavaCompilerParameters compilerParameters
= null;
54 DotNetProjectConfiguration configuration
;
55 DotNetProject project
;
57 public CodeGenerationPanelWidget ()
61 ListStore store
= new ListStore (typeof (string));
62 store
.AppendValues (GettextCatalog
.GetString ("Executable"));
63 store
.AppendValues (GettextCatalog
.GetString ("Library"));
64 compileTargetCombo
.Model
= store
;
65 CellRendererText cr
= new CellRendererText ();
66 compileTargetCombo
.PackStart (cr
, true);
67 compileTargetCombo
.AddAttribute (cr
, "text", 0);
69 compilerJavacButton
.Toggled
+= new EventHandler (OnCompilerToggled
);
70 compilerGcjButton
.Toggled
+= new EventHandler (OnCompilerToggled
);
73 public void LoadConfigData (ProjectConfigurationPropertyPanel dlg
)
75 configuration
= (DotNetProjectConfiguration
) dlg
.CurrentConfiguration
;
76 project
= (DotNetProject
) dlg
.ConfiguredProject
;
77 compilerParameters
= (JavaCompilerParameters
) configuration
.CompilationParameters
;
79 compileTargetCombo
.Active
= (int) configuration
.CompileTarget
;
81 if (compilerParameters
.Compiler
== JavaCompiler
.Javac
)
82 compilerJavacButton
.Active
= true;
84 compilerGcjButton
.Active
= true;
86 enableOptimizationCheckButton
.Active
= compilerParameters
.Optimize
;
87 generateDebugInformationCheckButton
.Active
= configuration
.DebugMode
;
88 deprecationCheckButton
.Active
= compilerParameters
.Deprecation
;
89 generateWarningsCheckButton
.Active
= compilerParameters
.GenWarnings
;
90 warningsAsErrorsCheckButton
.Active
= !configuration
.RunWithWarnings
;
92 compilerEntry
.Text
= compilerParameters
.CompilerPath
;
93 classPathEntry
.Text
= compilerParameters
.ClassPath
;
94 mainClassEntry
.Text
= compilerParameters
.MainClass
;
95 symbolsEntry
.Text
= compilerParameters
.DefineSymbols
;
96 OnCompilerToggled (null, null);
99 void OnCompilerToggled (object o
, EventArgs args
)
101 if (compilerJavacButton
.Active
)
102 compilerEntry
.Text
= "javac";
104 compilerEntry
.Text
= "gcj";
109 if (compilerParameters
== null)
112 if (compilerJavacButton
.Active
)
113 compilerParameters
.Compiler
= JavaCompiler
.Javac
;
115 compilerParameters
.Compiler
= JavaCompiler
.Gcj
;
117 project
.CompileTarget
= (CompileTarget
) compileTargetCombo
.Active
;
118 compilerParameters
.GenWarnings
= generateWarningsCheckButton
.Active
;
119 compilerParameters
.Deprecation
= deprecationCheckButton
.Active
;
120 configuration
.DebugMode
= generateDebugInformationCheckButton
.Active
;
121 compilerParameters
.Optimize
= enableOptimizationCheckButton
.Active
;
122 configuration
.RunWithWarnings
= !warningsAsErrorsCheckButton
.Active
;
124 compilerParameters
.CompilerPath
= compilerEntry
.Text
;
125 compilerParameters
.ClassPath
= classPathEntry
.Text
;
126 compilerParameters
.MainClass
= mainClassEntry
.Text
;
127 compilerParameters
.DefineSymbols
= symbolsEntry
.Text
;