| 1: | // ProjectCommands.cs | |
| 2: | // Copyright (C) 2002 Mike Krueger | |
| 3: | // | |
| 4: | // This program is free software; you can redistribute it and/or modify | |
| 5: | // it under the terms of the GNU General Public License as published by | |
| 6: | // the Free Software Foundation; either version 2 of the License, or | |
| 7: | // (at your option) any later version. | |
| 8: | // | |
| 9: | // This program is distributed in the hope that it will be useful, | |
| 10: | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11: | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 12: | // GNU General Public License for more details. | |
| 13: | // | |
| 14: | // You should have received a copy of the GNU General Public License | |
| 15: | // along with this program; if not, write to the Free Software | |
| 16: | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 17: | ||
| 18: | using System; | |
| 19: | using System.Diagnostics; | |
| 20: | using System.IO; | |
| 21: | using System.Collections; | |
| 22: | using System.Windows.Forms; | |
| 23: | ||
| 24: | using Core.AddIns; | |
| 25: | using Core.Util; | |
| 26: | using Core.Properties; | |
| 27: | using Core.Gui.Creators; | |
| 28: | ||
| 29: | using SharpDevelop.Gui; | |
| 30: | using SharpDevelop.Gui.Dialogs; | |
| 31: | using SharpDevelop.Internal.Project; | |
| 32: | ||
| 33: | namespace SharpDevelop.Base.Commands { | |
| 34: | ||
| 35: | public class RunTestsInProject : AbstractMenuCommand | |
| 36: | { | |
| 37: | public override void Run() | |
| 38: | { | |
| 39: | if (WorkbenchSingleton.Workbench.ProjectManager.CurrentProject != null) { | |
| 40: | ILanguageBinding csc = LanguageBindingManager.GetBindingPerLanguageName(WorkbenchSingleton.Workbench.ProjectManager.CurrentProject.ProjectType); | |
| 41: | string assembly = csc.GetCompiledOutputName(WorkbenchSingleton.Workbench.ProjectManager.CurrentProject); | |
| 42: | ||
| 43: | if (!File.Exists(assembly)) { | |
| 44: | MessageBox.Show("Compile the project first", "Assembly not Found", MessageBoxButtons.OK, MessageBoxIcon.Error); | |
| 45: | } else { | |
| 46: | // TODO : Remove this .NET bugfix | |
| 47: | HelperServices.ExecuteDirect ed = new HelperServices.ExecuteDirect(); | |
| 48: | string command = Application.StartupPath + | |
| 49: | Path.DirectorySeparatorChar + ".." + | |
| 50: | Path.DirectorySeparatorChar + "src" + | |
| 51: | Path.DirectorySeparatorChar + "nunit" + | |
| 52: | Path.DirectorySeparatorChar + "bin" + | |
| 53: | Path.DirectorySeparatorChar + "NUnitGUI.exe"; | |
| 54: | string args = '"' + assembly + '"'; | |
| 55: | ed.RunProgram('"'+ command+ "\" " + args, HelperServices.ShowWindowOption.normal); | |
| 56: | ||
| 57: | // Process.Start(Application.StartupPath + | |
| 58: | // Path.DirectorySeparatorChar + ".." + | |
| 59: | // Path.DirectorySeparatorChar + "src" + | |
| 60: | // Path.DirectorySeparatorChar + "nunit" + | |
| 61: | // Path.DirectorySeparatorChar + "bin" + | |
| 62: | // Path.DirectorySeparatorChar + "NUnitGUI.exe", | |
| 63: | // '"' + assembly + '"'); | |
| 64: | } | |
| 65: | } | |
| 66: | } | |
| 67: | } | |
| 68: | ||
| 69: | public class ViewProjectOptions : AbstractMenuCommand | |
| 70: | { | |
| 71: | public override void Run() | |
| 72: | { | |
| 73: | if (WorkbenchSingleton.Workbench.ProjectManager.CurrentProject == null) { | |
| 74: | return; | |
| 75: | } | |
| 76: | ||
| 77: | ||
| 78: | DefaultProperties defaultProperties = new DefaultProperties(); | |
| 79: | defaultProperties.SetProperty("Project", WorkbenchSingleton.Workbench.ProjectManager.CurrentProject); | |
| 80: | ||
| 81: | TabbedOptions optionsDialog = new TabbedOptions(defaultProperties, | |
| 82: | AddInTreeSingleton.AddInTree.GetTreeNode("/SharpDevelop/Workbench/ProjectOptions")); | |
| 83: | ||
| 84: | optionsDialog.Width = 430; | |
| 85: | optionsDialog.Height = 490; | |
| 86: | optionsDialog.FormBorderStyle = FormBorderStyle.FixedDialog; | |
| 87: | ||
| 88: | optionsDialog.Owner = (Form)WorkbenchSingleton.Workbench; | |
| 89: | optionsDialog.ShowDialog(); | |
| 90: | optionsDialog.Dispose(); | |
| 91: | ||
| 92: | WorkbenchSingleton.Workbench.ProjectManager.SaveCombine(); | |
| 93: | ||
| 94: | /* if (executor.Main.ProjectMode) { | |
| 95: | IProject project = executor.Main.ProjectBrowser.CurrentProject; | |
| 96: | ||
| 97: | TabbedOptions topt = new TabbedOptions(executor.Main); | |
| 98: | topt.Icon = GlobalResources.GetIcon("Icons.16x16.PropertiesIcon"); | |
| 99: | ||
| 100: | topt.Width = 430; | |
| 101: | topt.Height = 490; | |
| 102: | topt.FormBorderStyle = FormBorderStyle.FixedDialog; | |
| 103: | topt.AddOptionPanel(new GeneralProjectOptions(project, GlobalResources.GetString(""))); | |
| 104: | topt.AddOptionPanel(new ProjectCompilerOptionPanel(GlobalResources.GetString("Dialog.Options.PrjOptions.Settings.PanelName"), project)); | |
| 105: | ||
| 106: | topt.AddOptionPanel(new CompileFileProjectOptions(project, GlobalResources.GetString(""))); | |
| 107: | topt.AddOptionPanel(new DeployFileProjectOptions(project, GlobalResources.GetString(""))); | |
| 108: | topt.AddOptionPanel(new PropertyGridPanel("CVS", project.CVSSupport)); | |
| 109: | topt.Text = project.Name + " - " + topt.Text; | |
| 110: | ||
| 111: | if (topt.ShowDialog() == DialogResult.OK) { | |
| 112: | executor.Main.ShouldRecompile = true; | |
| 113: | executor.Main.ProjectBrowser.SaveProject(); | |
| 114: | } | |
| 115: | }*/ | |
| 116: | } | |
| 117: | } | |
| 118: | ||
| 119: | public class DeployProject : AbstractMenuCommand | |
| 120: | { | |
| 121: | public override void Run() | |
| 122: | { | |
| 123: | if (WorkbenchSingleton.Workbench.ProjectManager.CurrentProject != null) { | |
| 124: | DeployInformation.Deploy(WorkbenchSingleton.Workbench.ProjectManager.CurrentProject); | |
| 125: | } | |
| 126: | } | |
| 127: | } | |
| 128: | ||
| 129: | public class GenerateProjectDocumentation : AbstractMenuCommand | |
| 130: | { | |
| 131: | public override void Run() | |
| 132: | { | |
| 133: | if (WorkbenchSingleton.Workbench.ProjectManager.CurrentProject != null) { | |
| 134: | ILanguageBinding csc = LanguageBindingManager.GetBindingPerLanguageName(WorkbenchSingleton.Workbench.ProjectManager.CurrentProject.ProjectType); | |
| 135: | ||
| 136: | string assembly = csc.GetCompiledOutputName(WorkbenchSingleton.Workbench.ProjectManager.CurrentProject); | |
| 137: | string projectFile = Path.ChangeExtension(assembly, ".ndoc"); | |
| 138: | if (!File.Exists(projectFile)) { | |
| 139: | StreamWriter sw = File.CreateText(projectFile); | |
| 140: | sw.WriteLine("<project>"); | |
| 141: | sw.WriteLine(" <assemblies>"); | |
| 142: | sw.WriteLine(" <assembly location=\""+ assembly +"\" documentation=\"" + Path.ChangeExtension(assembly, ".xml") + "\" />"); | |
| 143: | sw.WriteLine(" </assemblies>"); | |
| 144: | /* | |
| 145: | sw.WriteLine(" <documenters>"); | |
| 146: | sw.WriteLine(" <documenter name=\"JavaDoc\">"); | |
| 147: | sw.WriteLine(" <property name=\"Title\" value=\"NDoc\" />"); | |
| 148: | sw.WriteLine(" <property name=\"OutputDirectory\" value=\".\\docs\\JavaDoc\" />"); | |
| 149: | sw.WriteLine(" <property name=\"ShowMissingSummaries\" value=\"False\" />"); | |
| 150: | sw.WriteLine(" <property name=\"ShowMissingRemarks\" value=\"False\" />"); | |
| 151: | sw.WriteLine(" <property name=\"ShowMissingParams\" value=\"False\" />"); | |
| 152: | sw.WriteLine(" <property name=\"ShowMissingReturns\" value=\"False\" />"); | |
| 153: | sw.WriteLine(" <property name=\"ShowMissingValues\" value=\"False\" />"); | |
| 154: | sw.WriteLine(" <property name=\"DocumentInternals\" value=\"False\" />"); | |
| 155: | sw.WriteLine(" <property name=\"DocumentProtected\" value=\"True\" />"); | |
| 156: | sw.WriteLine(" <property name=\"DocumentPrivates\" value=\"False\" />"); | |
| 157: | sw.WriteLine(" <property name=\"DocumentEmptyNamespaces\" value=\"False\" />"); | |
| 158: | sw.WriteLine(" <property name=\"IncludeAssemblyVersion\" value=\"False\" />"); | |
| 159: | sw.WriteLine(" <property name=\"CopyrightText\" value=\"\" />"); | |
| 160: | sw.WriteLine(" <property name=\"CopyrightHref\" value=\"\" />"); | |
| 161: | sw.WriteLine(" </documenter>"); | |
| 162: | sw.WriteLine(" <documenter name=\"MSDN\">"); | |
| 163: | sw.WriteLine(" <property name=\"OutputDirectory\" value=\".\\docs\\MSDN\" />"); | |
| 164: | sw.WriteLine(" <property name=\"HtmlHelpName\" value=\"NDoc\" />"); | |
| 165: | sw.WriteLine(" <property name=\"HtmlHelpCompilerFilename\" value=\"C:\\Program Files\\HTML Help Workshop\\hhc.exe\" />"); | |
| 166: | sw.WriteLine(" <property name=\"IncludeFavorites\" value=\"False\" />"); | |
| 167: | sw.WriteLine(" <property name=\"Title\" value=\"An NDoc Documented Class Library\" />"); | |
| 168: | sw.WriteLine(" <property name=\"SplitTOCs\" value=\"False\" />"); | |
| 169: | sw.WriteLine(" <property name=\"DefaulTOC\" value=\"\" />"); | |
| 170: | sw.WriteLine(" <property name=\"ShowVisualBasic\" value=\"True\" />"); | |
| 171: | sw.WriteLine(" <property name=\"ShowMissingSummaries\" value=\"False\" />"); | |
| 172: | sw.WriteLine(" <property name=\"ShowMissingRemarks\" value=\"False\" />"); | |
| 173: | sw.WriteLine(" <property name=\"ShowMissingParams\" value=\"False\" />"); | |
| 174: | sw.WriteLine(" <property name=\"ShowMissingValues\" value=\"False\" />"); | |
| 175: | sw.WriteLine(" <property name=\"DocumentInternals\" value=\"False\" />"); | |
| 176: | sw.WriteLine(" <property name=\"DocumentProtected\" value=\"True\" />"); | |
| 177: | sw.WriteLine(" <property name=\"DocumentPrivates\" value=\"False\" />"); | |
| 178: | sw.WriteLine(" <property name=\"DocumentEmptyNamespaces\" value=\"False\" />"); | |
| 179: | sw.WriteLine(" <property name=\"IncludeAssemblyVersion\" value=\"False\" />"); | |
| 180: | sw.WriteLine(" <property name=\"CopyrightText\" value=\"\" />"); | |
| 181: | sw.WriteLine(" <property name=\"CopyrightHref\" value=\"\" />"); | |
| 182: | sw.WriteLine(" </documenter>"); | |
| 183: | sw.WriteLine(" <documenter name=\"XML\">"); | |
| 184: | sw.WriteLine(" <property name=\"OutputFile\" value=\".\\docs\\doc.xml\" />"); | |
| 185: | sw.WriteLine(" <property name=\"ShowMissingSummaries\" value=\"False\" />"); | |
| 186: | sw.WriteLine(" <property name=\"ShowMissingRemarks\" value=\"False\" />"); | |
| 187: | sw.WriteLine(" <property name=\"ShowMissingParams\" value=\"False\" />"); | |
| 188: | sw.WriteLine(" <property name=\"ShowMissingReturns\" value=\"False\" />"); | |
| 189: | sw.WriteLine(" <property name=\"ShowMissingValues\" value=\"False\" />"); | |
| 190: | sw.WriteLine(" <property name=\"DocumentInternals\" value=\"False\" />"); | |
| 191: | sw.WriteLine(" <property name=\"DocumentProtected\" value=\"True\" />"); | |
| 192: | sw.WriteLine(" <property name=\"DocumentPrivates\" value=\"False\" />"); | |
| 193: | sw.WriteLine(" <property name=\"DocumentEmptyNamespaces\" value=\"False\" />"); | |
| 194: | sw.WriteLine(" <property name=\"IncludeAssemblyVersion\" value=\"False\" />"); | |
| 195: | sw.WriteLine(" <property name=\"CopyrightText\" value=\"\" />"); | |
| 196: | sw.WriteLine(" <property name=\"CopyrightHref\" value=\"\" />"); | |
| 197: | sw.WriteLine(" </documenter>"); | |
| 198: | sw.WriteLine(" </documenters>");*/ | |
| 199: | sw.WriteLine(" </project>"); | |
| 200: | sw.Close(); | |
| 201: | } | |
| 202: | // TODO : Remove this .NET bugfix | |
| 203: | ||
| 204: | string path = Application.StartupPath + | |
| 205: | Path.DirectorySeparatorChar + ".." + | |
| 206: | Path.DirectorySeparatorChar + "src" + | |
| 207: | Path.DirectorySeparatorChar + "NDoc" + | |
| 208: | Path.DirectorySeparatorChar + "src" + | |
| 209: | Path.DirectorySeparatorChar + "build"; | |
| 210: | ||
| 211: | HelperServices.ExecuteDirect ed = new HelperServices.ExecuteDirect(); | |
| 212: | string command = path + Path.DirectorySeparatorChar + "NDocGui.exe"; | |
| 213: | string args = '"' + projectFile + '"'; | |
| 214: | ed.RunProgram('"'+ command+ "\" " + args, HelperServices.ShowWindowOption.normal); | |
| 215: | ||
| 216: | // ProcessStartInfo psi = new ProcessStartInfo("\"" +path + | |
| 217: | // Path.DirectorySeparatorChar + "NDocGui.exe" + "\"", '"' + projectFile + '"'); | |
| 218: | // psi.WorkingDirectory = path; | |
| 219: | // psi.UseShellExecute = false; | |
| 220: | // Process p = new Process(); | |
| 221: | // p.StartInfo = psi; | |
| 222: | // p.Start(); | |
| 223: | } | |
| 224: | } | |
| 225: | } | |
| 226: | } |
This page was automatically generated by SharpDevelop.