[MonoDevelop] MD architecture changes
Lluis Sanchez
lluis@ximian.com
Tue, 11 Jan 2005 22:43:31 +0100
--=-c4OOBNpqJQ5bgDrXCPw/
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Hi!
This is a patch that fixes some issues in the MD design. It is a huge
patch, sorry about that, but all changes are somehow related and it is
not easy to split it.
The goal of most of changes is to simplify the MD API, make it more
extensible and make it easier to write addins.
This is a summary of the changes:
* First of all, I renamed AbstractProject into Project, and
removed the IProject interface.
* The project hierarchy has been simplified a bit. Until now it
was something like:
Combine --->* CombineEntry ---> Project
---> Combine
Now it is like:
Combine --->* CombineEntry
... and Combine and Project are subclasses of CombineEntry. It
is also possible to implement new subclasses of CombineEntry, so
a combine can contain not only source code projects, but also
other kinds of projects (for example, database management
projects, documentation projects, or whatever). There is a new
file format manager that can be used to register new file
formats for combine entries.
* Addins now can add custom properties to Combine and Project
objects, and those will be saved in the project or combine file.
* There is a new serialization engine. All code for saving and
loading projects and combines has been riped out from the
Project and Combine classes, and reimplemented in PrjxFileFormat
and CmbxFileFormat using the serialization engine. Since it is a
generic engine, it can be reused for other needs.
* I implemented the concept of Project Binding, which has some of
the functionality that LanguageBinding had until now. The idea
is that we have Project Types on one side, such as ASP.NET
project, GTK# project or NUnit project, and in the other side we
have languages, and we can orthogonally relate them.
Project bindings define how a project behaves, independently
from which language does it use. Things like execution,
debugging, deployment are common to all .net languages, since
all of them generate language independent assemblies. Language
Bindings are only in charge of compiling source code.
Notice that only .NET languages can be supported by implementing
ILanguageBinding. Non .NET languages can be supported by
implementing a specific IProjectBinding. There is a new subclass
of Project called DotNetProject, which provides that .net
language pluggability.
Project subclasses are defined by Project Bindings instead of
Language Bindings. There is no CSharpProject any more. Instead,
there is a DotNetProject which uses the c# language binding to
compile the files.
* A lot of code has been factorized into MonoDevelop.Base. It is
code that deals with the execution of assemblies, common
compilation parameters, and common project configuration
dialogs.
That's it. Comments are welcome,
Lluis.
--=-c4OOBNpqJQ5bgDrXCPw/
Content-Disposition: attachment; filename=md.diff
Content-Type: text/x-patch; name=md.diff; charset=UTF-8
Content-Transfer-Encoding: 8bit
Index: configure.in
===================================================================
--- configure.in (revision 2122)
+++ configure.in (working copy)
@@ -205,8 +205,6 @@
po/Makefile.in
Core/src/AddIns/prj2make-sharp-lib/Makefile
Core/src/AddIns/prj2make-sharp-lib/AssemblyInfo.cs
-Core/src/AddIns/BackendBindings/NemerleBinding/NemerleBindingExecutionServices.cs
-Core/src/AddIns/BackendBindings/CSharpBinding/CSharpBindingExecutionManager.cs
Extras/Makefile
Extras/MonoQuery/Makefile
])
Index: Core/src/MonoDevelop.Base/Commands/RunCommands.cs
===================================================================
--- Core/src/MonoDevelop.Base/Commands/RunCommands.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Commands/RunCommands.cs (working copy)
@@ -60,24 +60,16 @@
ShowAfterCompileStatus();
} else {
if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow != null) {
- ILanguageBinding binding = Runtime.Languages.GetBindingPerFileName(WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.ContentName);
-
- if (binding != null) {
- if (binding == null || !binding.CanCompile(WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.ContentName)) {
- Runtime.MessageService.ShowError(String.Format (GettextCatalog.GetString ("Language binding {0} can't compile {1}"), binding.Language, WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.ContentName));
- } else {
- new SaveFile().Run();
- ICompilerResult res = binding.CompileFile(WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.ContentName);
- taskService.ClearTasks ();
- foreach (CompilerError err in res.CompilerResults.Errors) {
- taskService.AddTask(new Task(null, err));
- }
- taskService.CompilerOutput = res.CompilerOutput;
- taskService.NotifyTaskChange();
- ShowAfterCompileStatus();
- }
+ new SaveFile().Run();
+ Project tempProject = Runtime.ProjectService.CreateSingleFileProject (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.ContentName);
+ if (tempProject != null) {
+ taskService.ClearTasks ();
+ taskService.CompilerOutput = "";
+ ICompilerResult res = tempProject.Compile ();
+ taskService.CompilerOutput = res.CompilerOutput;
+ ShowAfterCompileStatus();
} else {
- Runtime.MessageService.ShowError(GettextCatalog.GetString ("No source file for compilation found. Please save unsaved files"));
+ Runtime.MessageService.ShowError(GettextCatalog.GetString ("The current file can't be compiled."));
}
}
}
@@ -98,15 +90,12 @@
public override void Run()
{
lock (CompileLockObject) {
- if (Runtime.ProjectService.CurrentOpenCombine != null) {
- Runtime.TaskService.CompilerOutput = String.Empty;
- Runtime.ProjectService.OnStartBuild();
- RunWithWait();
- //Thread t = new Thread(new ThreadStart(CompileThread));
- //t.IsBackground = true;
- //t.Start();
- }
-
+ Runtime.TaskService.CompilerOutput = String.Empty;
+ Runtime.ProjectService.OnStartBuild();
+ //RunWithWait();
+ Thread t = new Thread(new ThreadStart(CompileThread));
+ t.IsBackground = true;
+ t.Start();
}
}
}
@@ -126,24 +115,16 @@
Compile.ShowAfterCompileStatus();
} else {
if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow != null) {
- ILanguageBinding binding = Runtime.Languages.GetBindingPerFileName(WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.ContentName);
-
- if (binding != null) {
- if (binding == null || !binding.CanCompile(WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.ContentName)) {
- Runtime.MessageService.ShowError(String.Format (GettextCatalog.GetString ("Language binding {0} can't compile {1}"), binding.Language, WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.ContentName));
- } else {
- new SaveFile().Run();
- ICompilerResult res = binding.CompileFile(WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.ContentName);
- taskService.ClearTasks();
- foreach (CompilerError err in res.CompilerResults.Errors) {
- taskService.AddTask(new Task(null, err));
- }
- taskService.CompilerOutput = res.CompilerOutput;
- taskService.NotifyTaskChange();
- Compile.ShowAfterCompileStatus();
- }
+ new SaveFile().Run();
+ Project tempProject = Runtime.ProjectService.CreateSingleFileProject (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.ContentName);
+ if (tempProject != null) {
+ taskService.ClearTasks ();
+ taskService.CompilerOutput = "";
+ ICompilerResult res = tempProject.Compile ();
+ taskService.CompilerOutput = res.CompilerOutput;
+ Compile.ShowAfterCompileStatus();
} else {
- Runtime.MessageService.ShowError(GettextCatalog.GetString ("No source file for compilation found. Please save unsaved files"));
+ Runtime.MessageService.ShowError(GettextCatalog.GetString ("The current file can't be compiled."));
}
}
}
@@ -197,12 +178,12 @@
}
} else {
if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow != null) {
- new Compile().RunWithWait();
if (Runtime.TaskService.Errors == 0) {
- ILanguageBinding binding = Runtime.Languages.GetBindingPerFileName(WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.ContentName);
- if (binding != null) {
+ Project tempProject = Runtime.ProjectService.CreateSingleFileProject (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.ContentName);
+ if (tempProject != null) {
+ tempProject.Compile ();
projectService.OnBeforeStartProject();
- binding.Execute(WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.ContentName);
+ tempProject.Execute ();
} else {
Runtime.MessageService.ShowError(GettextCatalog.GetString ("No runnable executable found."));
}
@@ -219,13 +200,11 @@
public override void Run()
{
- if (Runtime.ProjectService.CurrentOpenCombine != null) {
- RunThread(); // TODO FIXME PEDRO
-
- //Thread t = new Thread(new ThreadStart(RunThread));
- //t.IsBackground = true;
- //t.Start();
- }
+ RunThread(); // TODO FIXME PEDRO
+
+ //Thread t = new Thread(new ThreadStart(RunThread));
+ //t.IsBackground = true;
+ //t.Start();
}
}
@@ -290,7 +269,7 @@
public override void Run ()
{
if (Runtime.ProjectService.CurrentOpenCombine != null) {
- Runtime.ProjectService.GenerateMakefiles ();
+ Runtime.ProjectService.CurrentOpenCombine.GenerateMakefiles ();
}
}
}
Index: Core/src/MonoDevelop.Base/Commands/ProjectCommands.cs
===================================================================
--- Core/src/MonoDevelop.Base/Commands/ProjectCommands.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Commands/ProjectCommands.cs (working copy)
@@ -26,8 +26,7 @@
public override void Run()
{
if (Runtime.ProjectService.CurrentSelectedProject != null) {
- ILanguageBinding csc = Runtime.Languages.GetBindingPerLanguageName (Runtime.ProjectService.CurrentSelectedProject.ProjectType);
- string assembly = csc.GetCompiledOutputName (Runtime.ProjectService.CurrentSelectedProject);
+ string assembly = Runtime.ProjectService.CurrentSelectedProject.GetOutputFileName ();
if (!File.Exists(assembly)) {
Runtime.MessageService.ShowError (GettextCatalog.GetString ("Assembly not Found (Compile the project first)"));
@@ -47,7 +46,7 @@
{
public override void Run()
{
- IProject selectedProject = Runtime.ProjectService.CurrentSelectedProject;
+ Project selectedProject = Runtime.ProjectService.CurrentSelectedProject;
if (selectedProject == null) {
return;
}
@@ -57,7 +56,7 @@
ProjectOptionsDialog optionsDialog = new ProjectOptionsDialog(selectedProject, generalOptionsNode, configurationPropertiesNode);
if (optionsDialog.Run() == (int)Gtk.ResponseType.Ok) {
- Runtime.ProjectService.MarkProjectDirty (selectedProject);
+ Runtime.ProjectService.CurrentSelectedProject.NeedsBuilding = true;
}
Runtime.ProjectService.SaveCombine();
@@ -85,9 +84,7 @@
{
try {
if (Runtime.ProjectService.CurrentSelectedProject != null) {
- ILanguageBinding csc = Runtime.Languages.GetBindingPerLanguageName (Runtime.ProjectService.CurrentSelectedProject.ProjectType);
-
- string assembly = csc.GetCompiledOutputName (Runtime.ProjectService.CurrentSelectedProject);
+ string assembly = Runtime.ProjectService.CurrentSelectedProject.GetOutputFileName ();
string projectFile = Path.ChangeExtension(assembly, ".ndoc");
if (!File.Exists(projectFile)) {
StreamWriter sw = File.CreateText(projectFile);
Index: Core/src/MonoDevelop.Base/Commands/ProjectBrowserCommands/ResourceFolderNodeCommands.cs
===================================================================
--- Core/src/MonoDevelop.Base/Commands/ProjectBrowserCommands/ResourceFolderNodeCommands.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Commands/ProjectBrowserCommands/ResourceFolderNodeCommands.cs (working copy)
@@ -41,7 +41,7 @@
FolderNode node = browser.SelectedNode as FolderNode;
if (node != null) {
- IProject project = ((ProjectBrowserNode) node.Parent).Project;
+ Project project = ((ProjectBrowserNode) node.Parent).Project;
show_dialog:
@@ -63,7 +63,7 @@
}
foreach (string fileName in files) {
- ProjectFile fileInformation = Runtime.ProjectService.AddFileToProject(project, fileName, BuildAction.EmbedAsResource);
+ ProjectFile fileInformation = project.AddFile (fileName, BuildAction.EmbedAsResource);
AbstractBrowserNode newResNode = new FileNode(fileInformation);
newResNode.Image = Stock.ResourceFileIcon;
Index: Core/src/MonoDevelop.Base/Commands/ProjectBrowserCommands/ReferenceFolderNodeCommands.cs
===================================================================
--- Core/src/MonoDevelop.Base/Commands/ProjectBrowserCommands/ReferenceFolderNodeCommands.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Commands/ProjectBrowserCommands/ReferenceFolderNodeCommands.cs (working copy)
@@ -36,7 +36,7 @@
FolderNode node = browser.SelectedNode as FolderNode;
if (node != null) {
- IProject project = ((ProjectBrowserNode)node.Parent).Project;
+ Project project = ((ProjectBrowserNode)node.Parent).Project;
SelectReferenceDialog selDialog = new SelectReferenceDialog(project);
if (selDialog.Run() == (int)Gtk.ResponseType.Ok) {
@@ -63,7 +63,7 @@
ProjectBrowserView browser = (ProjectBrowserView)Owner;
ReferenceNode node = browser.SelectedNode as ReferenceNode;
if (node != null) {
- IProject project = node.Project; //((ProjectBrowserNode)node.Parent.Parent).Project;
+ Project project = node.Project; //((ProjectBrowserNode)node.Parent.Parent).Project;
IParserService parserService = (IParserService)MonoDevelop.Core.Services.ServiceManager.Services.GetService(typeof(IParserService));
ProjectReference refInfo = (ProjectWebReference)node.UserData;
@@ -83,7 +83,7 @@
bool bInitReferences = false;
if (node != null) {
- IProject project = ((ProjectBrowserNode)node.Parent).Project;
+ Project project = ((ProjectBrowserNode)node.Parent).Project;
/* using (AddWebReferenceDialog refDialog = new AddWebReferenceDialog(project)) {
if (refDialog.ShowDialog() == DialogResult.OK) {
Index: Core/src/MonoDevelop.Base/Commands/ProjectBrowserCommands/CombineNodeCommands.cs
===================================================================
--- Core/src/MonoDevelop.Base/Commands/ProjectBrowserCommands/CombineNodeCommands.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Commands/ProjectBrowserCommands/CombineNodeCommands.cs (working copy)
@@ -49,7 +49,7 @@
{
try
{
- int newNodeIndex = node.Nodes.Add(ProjectBrowserView.BuildProjectTreeNode((IProject)node.Combine.AddEntry(npdlg.NewProjectLocation)));
+ int newNodeIndex = node.Nodes.Add(ProjectBrowserView.BuildProjectTreeNode((Project)node.Combine.AddEntry(npdlg.NewProjectLocation)));
Runtime.ProjectService.SaveCombine ();
// expand to the new node
node.Nodes[newNodeIndex].Expand();
@@ -111,8 +111,8 @@
try {
object obj = node.Combine.AddEntry(fdiag.Filename);
int newNodeIndex = -1;
- if (obj is IProject) {
- newNodeIndex = node.Nodes.Add(ProjectBrowserView.BuildProjectTreeNode((IProject)obj));
+ if (obj is Project) {
+ newNodeIndex = node.Nodes.Add(ProjectBrowserView.BuildProjectTreeNode((Project)obj));
} else {
newNodeIndex = node.Nodes.Add(ProjectBrowserView.BuildCombineTreeNode((Combine)obj));
}
@@ -149,8 +149,8 @@
try {
object obj = node.Combine.AddEntry(fdiag.Filename);
int newNodeIndex = -1;
- if (obj is IProject) {
- newNodeIndex = node.Nodes.Add(ProjectBrowserView.BuildProjectTreeNode((IProject)obj));
+ if (obj is Project) {
+ newNodeIndex = node.Nodes.Add(ProjectBrowserView.BuildProjectTreeNode((Project)obj));
} else {
newNodeIndex = node.Nodes.Add(ProjectBrowserView.BuildCombineTreeNode((Combine)obj));
}
Index: Core/src/MonoDevelop.Base/Commands/CustomStringTagProvider.cs
===================================================================
--- Core/src/MonoDevelop.Base/Commands/CustomStringTagProvider.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Commands/CustomStringTagProvider.cs (working copy)
@@ -23,6 +23,7 @@
using MonoDevelop.Services;
using MonoDevelop.Gui;
using MonoDevelop.Gui.Dialogs;
+using MonoDevelop.Internal.Project;
namespace MonoDevelop.Commands
{
@@ -52,11 +53,12 @@
string GetCurrentTargetPath()
{
if (projectService.CurrentSelectedProject != null) {
- return projectService.GetOutputAssemblyName(projectService.CurrentSelectedProject);
+ return projectService.CurrentSelectedProject.GetOutputFileName ();
}
if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow != null) {
string fileName = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.ContentName;
- return projectService.GetOutputAssemblyName(fileName);
+ Project project = projectService.GetProject (fileName);
+ if (project != null) return project.GetOutputFileName();
}
return String.Empty;
}
@@ -116,22 +118,23 @@
case "PROJECTDIR":
if (projectService.CurrentSelectedProject != null) {
- return projectService.GetFileName(projectService.CurrentSelectedProject);
+ return projectService.CurrentSelectedProject.BaseDirectory;
}
break;
case "PROJECTFILENAME":
if (projectService.CurrentSelectedProject != null) {
try {
- return Path.GetFileName(projectService.GetFileName(projectService.CurrentSelectedProject));
+ return Path.GetFileName(projectService.CurrentSelectedProject.FileName);
} catch (Exception) {}
}
break;
case "COMBINEDIR":
- return Path.GetDirectoryName (projectService.GetFileName(projectService.CurrentOpenCombine));
+ return Path.GetDirectoryName (projectService.CurrentOpenCombine.FileName);
+
case "COMBINEFILENAME":
try {
- return Path.GetFileName(projectService.GetFileName(projectService.CurrentOpenCombine));
+ return Path.GetFileName(projectService.CurrentOpenCombine.FileName);
} catch (Exception) {}
break;
case "STARTUPPATH":
Index: Core/src/MonoDevelop.Base/Services/File/DefaultFileService.cs
===================================================================
--- Core/src/MonoDevelop.Base/Services/File/DefaultFileService.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Services/File/DefaultFileService.cs (working copy)
@@ -51,14 +51,14 @@
class LoadFileWrapper
{
IDisplayBinding binding;
- IProject project;
+ Project project;
public LoadFileWrapper(IDisplayBinding binding)
{
this.binding = binding;
}
- public LoadFileWrapper(IDisplayBinding binding, IProject project)
+ public LoadFileWrapper(IDisplayBinding binding, Project project)
{
this.binding = binding;
this.project = project;
@@ -148,7 +148,7 @@
IDisplayBinding binding = Runtime.Gui.DisplayBindings.GetBindingPerFileName(fileName);
if (binding != null) {
- IProject project = null;
+ Project project = null;
Combine combine = null;
GetProjectAndCombineFromFile (fileName, out project, out combine);
@@ -182,21 +182,17 @@
if(oFileInfo.OnFileOpened!=null) oFileInfo.OnFileOpened();
}
- protected void GetProjectAndCombineFromFile (string fileName, out IProject project, out Combine combine)
+ protected void GetProjectAndCombineFromFile (string fileName, out Project project, out Combine combine)
{
combine = Runtime.ProjectService.CurrentOpenCombine;
project = null;
if (combine != null)
{
- ArrayList projectslist = Combine.GetAllProjects(combine);
-
- foreach (ProjectCombineEntry projectaux in projectslist)
+ foreach (Project projectaux in combine.GetAllProjects())
{
- if (projectaux.Project.IsFileInProject (fileName))
- {
- project = projectaux.Project;
- }
+ if (projectaux.IsFileInProject (fileName))
+ project = projectaux;
}
}
}
Index: Core/src/MonoDevelop.Base/Services/Tasks/Task.cs
===================================================================
--- Core/src/MonoDevelop.Base/Services/Tasks/Task.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Services/Tasks/Task.cs (working copy)
@@ -25,7 +25,7 @@
string description;
string fileName;
TaskType type;
- IProject project;
+ Project project;
int line;
int column;
@@ -40,7 +40,7 @@
description);
}
- public IProject Project {
+ public Project Project {
get {
return project;
}
@@ -91,7 +91,7 @@
this.line = line;
}
- public Task(IProject project, CompilerError error)
+ public Task(Project project, CompilerError error)
{
this.project = project;
type = error.IsWarning ? error.ErrorNumber == "COMMENT" ? TaskType.Comment : TaskType.Warning : TaskType.Error;
Index: Core/src/MonoDevelop.Base/Services/Project/DefaultProjectService.cs
===================================================================
--- Core/src/MonoDevelop.Base/Services/Project/DefaultProjectService.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Services/Project/DefaultProjectService.cs (working copy)
@@ -14,9 +14,13 @@
using MonoDevelop.Gui;
using MonoDevelop.Internal.Project;
+using MonoDevelop.Internal.Serialization;
using MonoDevelop.Core.Properties;
using MonoDevelop.Core.Services;
+using MonoDevelop.Core.AddIns.Codons;
+using MonoDevelop.Internal.Templates;
+using MonoDevelop.Core.AddIns;
namespace MonoDevelop.Services
{
@@ -29,13 +33,14 @@
public class DefaultProjectService : AbstractService, IProjectService
{
- IProject currentProject = null;
+ Project currentProject = null;
Combine currentCombine = null;
Combine openCombine = null;
+ DataContext dataContext = new DataContext ();
+ FileFormatManager formatManager = new FileFormatManager ();
+ ProjectBindingCodon[] projectBindings;
- string openCombineFileName = null;
-
- public IProject CurrentSelectedProject {
+ public Project CurrentSelectedProject {
get {
return currentProject;
}
@@ -68,10 +73,10 @@
bool IsDirtyFileInCombine {
get {
- ArrayList projects = Combine.GetAllProjects(openCombine);
+ CombineEntryCollection projects = openCombine.GetAllProjects();
- foreach (ProjectCombineEntry projectEntry in projects) {
- foreach (ProjectFile fInfo in projectEntry.Project.ProjectFiles) {
+ foreach (Project projectEntry in projects) {
+ foreach (ProjectFile fInfo in projectEntry.ProjectFiles) {
foreach (IViewContent content in WorkbenchSingleton.Workbench.ViewContentCollection) {
if (content.IsDirty && content.ContentName == fInfo.Name) {
return true;
@@ -92,28 +97,78 @@
}
}
+ public DataContext DataContext {
+ get { return dataContext; }
+ }
+
+ public FileFormatManager FileFormats {
+ get { return formatManager; }
+ }
+
public void SaveCombinePreferences()
{
- if (CurrentOpenCombine != null) {
- SaveCombinePreferences(CurrentOpenCombine, openCombineFileName);
+ if (CurrentOpenCombine != null)
+ SaveCombinePreferences(CurrentOpenCombine);
+ }
+
+ public CombineEntry ReadFile (string file)
+ {
+ IFileFormat format = formatManager.GetFileFormat (Path.GetExtension (file));
+
+ if (format == null)
+ throw new InvalidOperationException ("Unknown file format: " + file);
+
+ CombineEntry obj = format.ReadFile (file) as CombineEntry;
+ if (obj == null)
+ throw new InvalidOperationException ("Invalid file format: " + file);
+
+ return obj;
+ }
+
+ public void WriteFile (string file, CombineEntry entry)
+ {
+ IFileFormat format = formatManager.GetFileFormat (Path.GetExtension (file));
+
+ if (format == null)
+ throw new InvalidOperationException ("Unknown file format: " + file);
+
+ format.WriteFile (file, entry);
+ }
+
+ public Project CreateSingleFileProject (string file)
+ {
+ foreach (ProjectBindingCodon projectBinding in projectBindings) {
+ Project project = projectBinding.ProjectBinding.CreateSingleFileProject (file);
+ if (project != null)
+ return project;
}
+ return null;
}
+ public Project CreateProject (string type, ProjectCreateInformation info, XmlElement projectOptions)
+ {
+ foreach (ProjectBindingCodon projectBinding in projectBindings) {
+ if (projectBinding.ProjectBinding.Name == type) {
+ Project project = projectBinding.ProjectBinding.CreateProject (info, projectOptions);
+ return project;
+ }
+ }
+ return null;
+ }
+
public void CloseCombine()
{
CloseCombine(true);
}
- public void CloseCombine(bool saveCombinePreferencies)
+ public void CloseCombine (bool saveCombinePreferencies)
{
if (CurrentOpenCombine != null) {
if (saveCombinePreferencies)
- SaveCombinePreferences(CurrentOpenCombine, openCombineFileName);
- GenerateMakefiles ();
+ SaveCombinePreferences (CurrentOpenCombine);
Combine closedCombine = CurrentOpenCombine;
CurrentSelectedProject = null;
CurrentOpenCombine = CurrentSelectedCombine = null;
- openCombineFileName = null;
WorkbenchSingleton.Workbench.CloseAllViews();
OnCombineClosed(new CombineEventArgs(closedCombine));
closedCombine.Dispose();
@@ -143,12 +198,12 @@
LoadCombine(validcombine);
} else {
Combine loadingCombine = new Combine();
- IProject project = (IProject)loadingCombine.AddEntry(filename);
+ Project project = (Project)loadingCombine.AddEntry(filename);
if (project == null) {
return;
}
loadingCombine.Name = project.Name;
- loadingCombine.SaveCombine(validcombine);
+ loadingCombine.Save (validcombine);
LoadCombine(validcombine);
}
} else {
@@ -169,10 +224,7 @@
return;
}
- Combine loadingCombine = new Combine();
- loadingCombine.LoadCombine(filename);
- openCombine = loadingCombine;
- openCombineFileName = filename;
+ openCombine = (Combine) ReadFile (filename);
Runtime.FileService.RecentOpen.AddLastProject (filename, openCombine.Name);
@@ -183,80 +235,31 @@
openCombine.ReferenceAddedToProject += new ProjectReferenceEventHandler (NotifyReferenceAddedToProject);
openCombine.ReferenceRemovedFromProject += new ProjectReferenceEventHandler (NotifyReferenceRemovedFromProject);
- RestoreCombinePreferences(CurrentOpenCombine, openCombineFileName);
+ RestoreCombinePreferences (CurrentOpenCombine);
}
- void Save(string fileName)
- {
- openCombineFileName = System.IO.Path.GetFullPath (fileName);
- openCombine.SaveCombine(fileName);
- openCombine.SaveAllProjects();
- }
-
- public ProjectReference AddReferenceToProject(IProject prj, string filename)
- {
- foreach (ProjectReference rInfo in prj.ProjectReferences) {
- if (rInfo.Reference == filename) {
- return rInfo;
- }
- }
- ProjectReference newReferenceInformation = new ProjectReference(ReferenceType.Assembly, filename);
- prj.ProjectReferences.Add(newReferenceInformation);
- return newReferenceInformation;
- }
-
- public ProjectFile AddFileToProject(IProject prj, string filename, BuildAction action)
- {
- foreach (ProjectFile fInfo in prj.ProjectFiles) {
- if (fInfo.Name == filename) {
- return fInfo;
- }
- }
- ProjectFile newFileInformation = new ProjectFile(filename, action);
- prj.ProjectFiles.Add(newFileInformation);
- return newFileInformation;
- }
-
- public void AddFileToProject(IProject prj, ProjectFile projectFile) {
- prj.ProjectFiles.Add(projectFile);
- }
-
-
public void SaveCombine()
{
- Save(openCombineFileName);
+ openCombine.Save ();
}
- public void MarkFileDirty(string filename)
+ public void MarkFileDirty (string filename)
{
if (openCombine != null) {
- ProjectCombineEntry entry = openCombine.GetProjectEntryContaining(filename);
+ Project entry = openCombine.GetProjectEntryContaining (filename);
if (entry != null) {
- entry.IsDirty = true;
+ entry.NeedsBuilding = true;
}
}
}
-
- public void MarkProjectDirty(IProject project)
- {
- if (openCombine != null) {
- ArrayList projectEntries = Combine.GetAllProjects(openCombine);
- foreach (ProjectCombineEntry entry in projectEntries) {
- if (entry.Project == project) {
- entry.IsDirty = true;
- break;
- }
- }
- }
- }
-
+
public void CompileCombine()
{
if (openCombine != null) {
DoBeforeCompileAction();
Runtime.TaskService.ClearTasks();
- openCombine.Build(false);
+ openCombine.Build ();
}
}
@@ -266,11 +269,12 @@
DoBeforeCompileAction();
Runtime.TaskService.ClearTasks();
- openCombine.Build(true);
+ openCombine.Clean ();
+ openCombine.Build ();
}
}
- ILanguageBinding BeforeCompile(IProject project)
+ void BeforeCompile (Project project)
{
DoBeforeCompileAction();
@@ -289,11 +293,9 @@
} catch (Exception e) {
throw new ApplicationException("Can't create project output directory " + outputDir + " original exception:\n" + e.ToString());
}
- // cut&paste EDND
- return Runtime.Languages.GetBindingPerLanguageName(project.ProjectType);
}
- void AfterCompile(IProject project, ICompilerResult res)
+ void AfterCompile (Project project, ICompilerResult res)
{
// cut&pasted from CombineEntry.cs
foreach (CompilerError err in res.CompilerResults.Errors) {
@@ -310,14 +312,17 @@
Runtime.TaskService.NotifyTaskChange();
}
- public void RecompileProject(IProject project)
+ public void RecompileProject(Project project)
{
- AfterCompile(project, BeforeCompile(project).RecompileProject(project));
+ project.Clean ();
+ BeforeCompile (project);
+ AfterCompile(project, project.Compile ());
}
- public void CompileProject(IProject project)
+ public void CompileProject(Project project)
{
- AfterCompile(project, BeforeCompile(project).CompileProject(project));
+ BeforeCompile (project);
+ AfterCompile(project, project.Compile ());
}
void DoBeforeCompileAction()
@@ -357,35 +362,21 @@
}
}
- public ProjectFile RetrieveFileInformationForFile(string fileName)
- {
- ArrayList projects = Combine.GetAllProjects(openCombine);
-
- foreach (ProjectCombineEntry projectEntry in projects) {
- foreach (ProjectFile fInfo in projectEntry.Project.ProjectFiles) {
- if (fInfo.Name == fileName) {
- return fInfo;
- }
- }
- }
- return null;
- }
-
void RemoveFileFromAllProjects(string fileName)
{
- ArrayList projects = Combine.GetAllProjects(openCombine);
+ CombineEntryCollection projects = openCombine.GetAllProjects();
restart:
- foreach (ProjectCombineEntry projectEntry in projects) {
- foreach (ProjectReference rInfo in projectEntry.Project.ProjectReferences) {
+ foreach (Project projectEntry in projects) {
+ foreach (ProjectReference rInfo in projectEntry.ProjectReferences) {
if (rInfo.ReferenceType == ReferenceType.Assembly && rInfo.Reference == fileName) {
- projectEntry.Project.ProjectReferences.Remove(rInfo);
+ projectEntry.ProjectReferences.Remove(rInfo);
goto restart;
}
}
- foreach (ProjectFile fInfo in projectEntry.Project.ProjectFiles) {
+ foreach (ProjectFile fInfo in projectEntry.ProjectFiles) {
if (fInfo.Name == fileName) {
- projectEntry.Project.ProjectFiles.Remove(fInfo);
+ projectEntry.ProjectFiles.Remove(fInfo);
goto restart;
}
}
@@ -394,13 +385,13 @@
void RemoveAllInDirectory(string dirName)
{
- ArrayList projects = Combine.GetAllProjects(openCombine);
+ CombineEntryCollection projects = openCombine.GetAllProjects();
restart:
- foreach (ProjectCombineEntry projectEntry in projects) {
- foreach (ProjectFile fInfo in projectEntry.Project.ProjectFiles) {
+ foreach (Project projectEntry in projects) {
+ foreach (ProjectFile fInfo in projectEntry.ProjectFiles) {
if (fInfo.Name.StartsWith(dirName)) {
- projectEntry.Project.ProjectFiles.Remove(fInfo);
+ projectEntry.ProjectFiles.Remove(fInfo);
goto restart;
}
}
@@ -420,10 +411,10 @@
void RenameFileInAllProjects(string oldName, string newName)
{
- ArrayList projects = Combine.GetAllProjects(openCombine);
+ CombineEntryCollection projects = openCombine.GetAllProjects();
- foreach (ProjectCombineEntry projectEntry in projects) {
- foreach (ProjectFile fInfo in projectEntry.Project.ProjectFiles) {
+ foreach (Project projectEntry in projects) {
+ foreach (ProjectFile fInfo in projectEntry.ProjectFiles) {
if (fInfo.Name == oldName) {
fInfo.Name = newName;
}
@@ -433,10 +424,10 @@
void RenameDirectoryInAllProjects(string oldName, string newName)
{
- ArrayList projects = Combine.GetAllProjects(openCombine);
+ CombineEntryCollection projects = openCombine.GetAllProjects();
- foreach (ProjectCombineEntry projectEntry in projects) {
- foreach (ProjectFile fInfo in projectEntry.Project.ProjectFiles) {
+ foreach (Project projectEntry in projects) {
+ foreach (ProjectFile fInfo in projectEntry.ProjectFiles) {
if (fInfo.Name.StartsWith(oldName)) {
fInfo.Name = newName + fInfo.Name.Substring(oldName.Length);
}
@@ -459,8 +450,16 @@
public override void InitializeService()
{
base.InitializeService();
+
+ formatManager.RegisterFileFormat ("prjx", new PrjxFileFormat ());
+ formatManager.RegisterFileFormat ("cmbx", new CmbxFileFormat ());
+ DataContext.IncludeType (typeof(Combine));
+ DataContext.IncludeType (typeof(Project));
+
Runtime.FileService.FileRemoved += new FileEventHandler(CheckFileRemove);
Runtime.FileService.FileRenamed += new FileEventHandler(CheckFileRename);
+
+ projectBindings = (ProjectBindingCodon[])(AddInTreeSingleton.AddInTree.GetTreeNode("/SharpDevelop/Workbench/ProjectBindings").BuildChildItems(null)).ToArray(typeof(ProjectBindingCodon));
}
string MakeValidName(string str)
@@ -472,9 +471,11 @@
return tmp;
}
- void RestoreCombinePreferences(Combine combine, string combinefilename)
+ void RestoreCombinePreferences (Combine combine)
{
+ string combinefilename = combine.FileName;
string directory = Runtime.Properties.ConfigDirectory + "CombinePreferences";
+
if (!Directory.Exists(directory)) {
return;
}
@@ -524,9 +525,11 @@
}
}
- void SaveCombinePreferences(Combine combine, string combinefilename)
+ void SaveCombinePreferences (Combine combine)
{
+ string combinefilename = combine.FileName;
string directory = Runtime.Properties.ConfigDirectory + "CombinePreferences";
+
if (!Directory.Exists(directory)) {
Directory.CreateDirectory(directory);
}
@@ -585,7 +588,6 @@
//********* own events
protected virtual void OnCombineOpened(CombineEventArgs e)
{
- GenerateMakefiles ();
if (CombineOpened != null) {
CombineOpened(this, e);
}
@@ -615,39 +617,13 @@
}
}
- public virtual void OnRenameProject(ProjectRenameEventArgs e)
+ public Project GetProject (string projectName)
{
- GenerateMakefiles ();
- if (ProjectRenamed != null) {
- ProjectRenamed(this, e);
+ CombineEntryCollection allProjects = CurrentOpenCombine.GetAllProjects();
+ foreach (Project project in allProjects) {
+ if (project.Name == projectName)
+ return project;
}
- }
-
- public bool ExistsEntryWithName(string name)
- {
- ArrayList allProjects = Combine.GetAllProjects(openCombine);
- foreach (ProjectCombineEntry projectEntry in allProjects) {
- if (projectEntry.Project.Name == name) {
- return true;
- }
- }
- return false;
- }
-
- public string GetOutputAssemblyName(IProject project)
- {
- ILanguageBinding binding = Runtime.Languages.GetBindingPerLanguageName(project.ProjectType);
- return binding.GetCompiledOutputName(project);
- }
-
- public string GetOutputAssemblyName(string projectName)
- {
- ArrayList allProjects = Combine.GetAllProjects(CurrentOpenCombine);
- foreach (ProjectCombineEntry projectEntry in allProjects) {
- if (projectEntry.Project.Name == projectName) {
- return GetOutputAssemblyName(projectEntry.Project);
- }
- }
return null;
}
@@ -659,7 +635,6 @@
} else {
RemoveFileFromAllProjects(fileName);
}
- GenerateMakefiles ();
}
}
@@ -710,7 +685,6 @@
protected virtual void OnFileRemovedFromProject (ProjectFileEventArgs e)
{
- GenerateMakefiles ();
if (FileRemovedFromProject != null) {
FileRemovedFromProject(this, e);
}
@@ -718,7 +692,6 @@
protected virtual void OnFileAddedToProject (ProjectFileEventArgs e)
{
- GenerateMakefiles ();
if (FileAddedToProject != null) {
FileAddedToProject (this, e);
}
@@ -733,7 +706,6 @@
protected virtual void OnReferenceRemovedFromProject (ProjectReferenceEventArgs e)
{
- GenerateMakefiles ();
if (ReferenceRemovedFromProject != null) {
ReferenceRemovedFromProject (this, e);
}
@@ -741,57 +713,11 @@
protected virtual void OnReferenceAddedToProject (ProjectReferenceEventArgs e)
{
- GenerateMakefiles ();
if (ReferenceAddedToProject != null) {
ReferenceAddedToProject (this, e);
}
}
- public string GetFileName(IProject project)
- {
- if (openCombine != null) {
- ArrayList projects = Combine.GetAllProjects(openCombine);
- foreach (ProjectCombineEntry projectCombineEntry in projects) {
- if (projectCombineEntry.Project == project) {
- return projectCombineEntry.Filename;
- }
- }
- }
- return String.Empty;
- }
-
- public string GetFileName(Combine combine)
- {
- if (combine == openCombine) {
- return openCombineFileName;
- }
- Stack combines = new Stack();
- combines.Push(openCombine);
- while (combines.Count > 0) {
- Combine curCombine = (Combine)combines.Pop();
- foreach (CombineEntry entry in curCombine.Entries) {
- CombineCombineEntry combineEntry = (CombineCombineEntry)entry;
- if (combineEntry != null) {
- if (combineEntry.Combine == combine) {
- return entry.Filename;
- }
- combines.Push(combineEntry.Combine);
- }
- }
- }
-
- return String.Empty;
- }
-
- public void GenerateMakefiles ()
- {
- if (openCombine != null)
- try {
- openCombine.GenerateMakefiles ();
- }
- catch { }
- }
-
public event ProjectFileEventHandler FileRemovedFromProject;
public event ProjectFileEventHandler FileAddedToProject;
public event ProjectFileEventHandler FileChangedInProject;
@@ -805,7 +731,6 @@
public event CombineEventHandler CombineClosed;
public event CombineEventHandler CurrentSelectedCombineChanged;
- public event ProjectRenameEventHandler ProjectRenamed;
public event ProjectEventHandler CurrentProjectChanged;
public event ProjectReferenceEventHandler ReferenceAddedToProject;
Index: Core/src/MonoDevelop.Base/Services/Project/ProjectRenameEventArgs.cs
===================================================================
--- Core/src/MonoDevelop.Base/Services/Project/ProjectRenameEventArgs.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Services/Project/ProjectRenameEventArgs.cs (working copy)
@@ -14,11 +14,11 @@
public class ProjectRenameEventArgs : EventArgs
{
- IProject project;
+ Project project;
string oldName;
string newName;
- public IProject Project {
+ public Project Project {
get {
return project;
}
@@ -36,7 +36,7 @@
}
}
- public ProjectRenameEventArgs(IProject project, string oldName, string newName)
+ public ProjectRenameEventArgs(Project project, string oldName, string newName)
{
this.project = project;
this.oldName = oldName;
Index: Core/src/MonoDevelop.Base/Services/Project/IProjectService.cs
===================================================================
--- Core/src/MonoDevelop.Base/Services/Project/IProjectService.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Services/Project/IProjectService.cs (working copy)
@@ -7,9 +7,12 @@
using System;
using System.Collections;
+using System.Xml;
using MonoDevelop.Gui;
using MonoDevelop.Internal.Project;
+using MonoDevelop.Internal.Serialization;
+using MonoDevelop.Internal.Templates;
namespace MonoDevelop.Services
{
@@ -23,7 +26,7 @@
/// Gets/Sets the current selected project. (e.g. the project
/// that contains the file that has the focus)
/// </remarks>
- IProject CurrentSelectedProject {
+ Project CurrentSelectedProject {
get;
set;
}
@@ -51,6 +54,18 @@
get;
}
+ DataContext DataContext {
+ get;
+ }
+
+ FileFormatManager FileFormats {
+ get;
+ }
+
+ CombineEntry ReadFile (string file);
+
+ void WriteFile (string file, CombineEntry entry);
+
/// <remarks>
/// Closes the root combine
/// </remarks>
@@ -62,16 +77,6 @@
void CloseCombine(bool saveCombinePreferencies);
/// <remarks>
- /// Gets the file name from one combine which is currently opened
- /// </remarks>
- string GetFileName(Combine combine);
-
- /// <remarks>
- /// Gets the file name from one project which is currently opened
- /// </remarks>
- string GetFileName(IProject project);
-
- /// <remarks>
/// Compile the root combine.
/// </remarks>
void CompileCombine();
@@ -85,12 +90,12 @@
/// Compiles a specific project, if the project isn't dirty this
/// method does nothing
/// </remarks>
- void CompileProject(IProject project);
+ void CompileProject(Project project);
/// <remarks>
/// Compiles a specific project (forced!)
/// </remarks>
- void RecompileProject(IProject project);
+ void RecompileProject(Project project);
/// <remarks>
/// Opens a new root combine, closes the old root combine automatically.
@@ -109,43 +114,12 @@
void SaveCombinePreferences();
/// <remarks>
- /// Add a reference to a given project (only assembly references)
- /// </remarks>
- ProjectReference AddReferenceToProject(IProject prj, string filename);
-
- /// <remarks>
- /// Add a file to a given project
- /// </remarks>
- ProjectFile AddFileToProject(IProject prj, string filename, BuildAction action);
-
- /// <remarks>
- /// Add a file to a given project
- /// </remarks>
- void AddFileToProject(IProject prj, ProjectFile projectFile);
-
- /// <remarks>
/// Mark a file dirty, the project in which the file is in will be compiled
/// in the next compiler run.
/// </remarks>
void MarkFileDirty(string filename);
/// <remarks>
- /// Mark a project dirty, the project will be compiled
- /// in the next compiler run.
- void MarkProjectDirty(IProject project);
-
- /// <remarks>
- /// If the file given by fileName is inside a currently open project this method
- /// gets the ProjectFile for this file, returns null otherwise.
- /// </remarks>
- ProjectFile RetrieveFileInformationForFile(string fileName);
-
- /// <summary>
- /// Returns true if a project has this name
- /// </summary>
- bool ExistsEntryWithName(string name);
-
- /// <remarks>
/// Only to be called by the compile actions.
/// </remarks>
void OnStartBuild();
@@ -161,29 +135,16 @@
void OnBeforeStartProject();
/// <remarks>
- /// Only to be called by AbstractProject
- /// </remarks>
- void OnRenameProject(ProjectRenameEventArgs e);
-
- /// <remarks>
- /// Gets the file name of the output assembly of a given project
- /// (Or at least the 'main' file)
- /// </remarks>
- string GetOutputAssemblyName(IProject project);
-
- /// <remarks>
- /// Gets the file name of the output assembly of a given file
- /// (Or at least the 'main' file)
- /// </remarks>
- string GetOutputAssemblyName(string fileName);
-
- /// <remarks>
/// Removes a file from it's project(s)
/// </remarks>
void RemoveFileFromProject(string fileName);
- void GenerateMakefiles ();
+ Project CreateSingleFileProject (string file);
+ Project CreateProject (string type, ProjectCreateInformation info, XmlElement projectOptions);
+
+ Project GetProject (string projectName);
+
/// <remarks>
/// Is called, when a file is removed from and added to a project.
/// </remarks>
@@ -235,10 +196,5 @@
/// Called after the current selected combine has chaned
/// </remarks>
event CombineEventHandler CurrentSelectedCombineChanged;
-
- /// <remarks>
- /// Called after a project got renamed
- /// </remarks>
- event ProjectRenameEventHandler ProjectRenamed;
}
}
Index: Core/src/MonoDevelop.Base/Services/Project/FileFormatManager.cs
===================================================================
--- Core/src/MonoDevelop.Base/Services/Project/FileFormatManager.cs (revision 0)
+++ Core/src/MonoDevelop.Base/Services/Project/FileFormatManager.cs (revision 0)
@@ -0,0 +1,30 @@
+
+using System;
+using System.Collections;
+using MonoDevelop.Internal.Project;
+
+namespace MonoDevelop.Services
+{
+ public class FileFormatManager
+ {
+ Hashtable fileFormats = new Hashtable ();
+
+ public void RegisterFileFormat (string fileExtension, IFileFormat serializer)
+ {
+ fileFormats [NormalizeExtension(fileExtension)] = serializer;
+ }
+
+ public IFileFormat GetFileFormat (string fileExtension)
+ {
+ return fileFormats [NormalizeExtension(fileExtension)] as IFileFormat;
+ }
+
+ string NormalizeExtension (string ext)
+ {
+ if (ext.StartsWith ("."))
+ return ext.Substring (1);
+ else
+ return ext;
+ }
+ }
+}
Index: Core/src/MonoDevelop.Base/Services/Project/ProjectEventArgs.cs
===================================================================
--- Core/src/MonoDevelop.Base/Services/Project/ProjectEventArgs.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Services/Project/ProjectEventArgs.cs (working copy)
@@ -14,15 +14,15 @@
public class ProjectEventArgs : EventArgs
{
- IProject project;
+ Project project;
- public IProject Project {
+ public Project Project {
get {
return project;
}
}
- public ProjectEventArgs(IProject project)
+ public ProjectEventArgs(Project project)
{
this.project = project;
}
Index: Core/src/MonoDevelop.Base/Services/StatusBar/DefaultStatusBarService.cs
===================================================================
--- Core/src/MonoDevelop.Base/Services/StatusBar/DefaultStatusBarService.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Services/StatusBar/DefaultStatusBarService.cs (working copy)
@@ -58,6 +58,11 @@
statusBar.Worked (work, status);
}
+ void IProgressMonitor.Pulse ()
+ {
+ statusBar.Pulse ();
+ }
+
void IProgressMonitor.Done()
{
statusBar.Done ();
Index: Core/src/MonoDevelop.Base/Services/ParserService/DefaultParserService.cs
===================================================================
--- Core/src/MonoDevelop.Base/Services/ParserService/DefaultParserService.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Services/ParserService/DefaultParserService.cs (working copy)
@@ -60,12 +60,12 @@
class CompilationUnitTypeResolver: ITypeResolver
{
public IClass CallingClass;
- IProject project;
+ Project project;
ICompilationUnit unit;
DefaultParserService parserService;
bool allResolved;
- public CompilationUnitTypeResolver (IProject project, ICompilationUnit unit, DefaultParserService parserService)
+ public CompilationUnitTypeResolver (Project project, ICompilationUnit unit, DefaultParserService parserService)
{
this.project = project;
this.unit = unit;
@@ -261,7 +261,6 @@
projectService.FileAddedToProject += new ProjectFileEventHandler (OnProjectFilesChanged);
projectService.ReferenceAddedToProject += new ProjectReferenceEventHandler (OnProjectReferencesChanged);
projectService.ReferenceRemovedFromProject += new ProjectReferenceEventHandler (OnProjectReferencesChanged);
- projectService.ProjectRenamed += new ProjectRenameEventHandler(OnProjectRenamed);
}
internal CodeCompletionDatabase GetDatabase (string uri)
@@ -269,7 +268,7 @@
return GetDatabase (null, uri);
}
- internal ProjectCodeCompletionDatabase GetProjectDatabase (IProject project)
+ internal ProjectCodeCompletionDatabase GetProjectDatabase (Project project)
{
if (project == null) return null;
return (ProjectCodeCompletionDatabase) GetDatabase (null, "Project:" + project.Name);
@@ -350,7 +349,7 @@
}
}
- void LoadProjectDatabase (IProject project)
+ void LoadProjectDatabase (Project project)
{
lock (databases)
{
@@ -361,9 +360,9 @@
databases [uri] = db;
foreach (ReferenceEntry re in db.References)
- {
GetDatabase (re.Uri);
- }
+
+ project.NameChanged += new CombineEntryRenamedEventHandler (OnProjectRenamed);
}
}
@@ -380,10 +379,11 @@
}
}
- void UnloadProjectDatabase (IProject project)
+ void UnloadProjectDatabase (Project project)
{
string uri = "Project:" + project.Name;
UnloadDatabase (uri);
+ project.NameChanged -= new CombineEntryRenamedEventHandler (OnProjectRenamed);
}
void CleanUnusedDatabases ()
@@ -413,17 +413,17 @@
public void LoadCombineDatabases (Combine combine)
{
- ArrayList projects = Combine.GetAllProjects(combine);
- foreach (ProjectCombineEntry entry in projects) {
- LoadProjectDatabase (entry.Project);
+ CombineEntryCollection projects = combine.GetAllProjects();
+ foreach (Project entry in projects) {
+ LoadProjectDatabase (entry);
}
}
public void UnloadCombineDatabases (Combine combine)
{
- ArrayList projects = Combine.GetAllProjects(combine);
- foreach (ProjectCombineEntry entry in projects) {
- UnloadProjectDatabase (entry.Project);
+ CombineEntryCollection projects = combine.GetAllProjects();
+ foreach (Project entry in projects) {
+ UnloadProjectDatabase (entry);
}
}
@@ -442,9 +442,9 @@
e.Combine.EntryRemoved -= combineEntryRemovedHandler;
}
- void OnProjectRenamed (object sender, ProjectRenameEventArgs args)
+ void OnProjectRenamed (object sender, CombineEntryRenamedEventArgs args)
{
- ProjectCodeCompletionDatabase db = GetProjectDatabase (args.Project);
+ ProjectCodeCompletionDatabase db = GetProjectDatabase ((Project) args.CombineEntry);
if (db == null) return;
db.Rename (args.NewName);
@@ -456,18 +456,18 @@
void OnCombineEntryAdded (object sender, CombineEntryEventArgs args)
{
- if (args.CombineEntry is ProjectCombineEntry)
- LoadProjectDatabase (((ProjectCombineEntry)args.CombineEntry).Project);
- else if (args.CombineEntry is CombineCombineEntry)
- LoadCombineDatabases (((CombineCombineEntry)args.CombineEntry).Combine);
+ if (args.CombineEntry is Project)
+ LoadProjectDatabase ((Project)args.CombineEntry);
+ else if (args.CombineEntry is Combine)
+ LoadCombineDatabases ((Combine)args.CombineEntry);
}
void OnCombineEntryRemoved (object sender, CombineEntryEventArgs args)
{
- if (args.CombineEntry is ProjectCombineEntry)
- UnloadProjectDatabase (((ProjectCombineEntry)args.CombineEntry).Project);
- else if (args.CombineEntry is CombineCombineEntry)
- UnloadCombineDatabases (((CombineCombineEntry)args.CombineEntry).Combine);
+ if (args.CombineEntry is Project)
+ UnloadProjectDatabase ((Project) args.CombineEntry);
+ else if (args.CombineEntry is Combine)
+ UnloadCombineDatabases ((Combine) args.CombineEntry);
CleanUnusedDatabases ();
}
@@ -706,12 +706,12 @@
#region Default Parser Layer dependent functions
- public IClass GetClass (IProject project, string typeName)
+ public IClass GetClass (Project project, string typeName)
{
return GetClass(project, typeName, false, true);
}
- public IClass GetClass (IProject project, string typeName, bool deepSearchReferences, bool caseSensitive)
+ public IClass GetClass (Project project, string typeName, bool deepSearchReferences, bool caseSensitive)
{
if (deepSearchReferences)
return DeepGetClass (project, typeName, caseSensitive);
@@ -719,7 +719,7 @@
return GetClass (project, typeName, caseSensitive);
}
- public IClass GetClass (IProject project, string typeName, bool caseSensitive)
+ public IClass GetClass (Project project, string typeName, bool caseSensitive)
{
CodeCompletionDatabase db = project != null ? GetProjectDatabase (project) : GetActiveFileDatabase ();
if (db != null) {
@@ -738,7 +738,7 @@
return db.GetClass (typeName, caseSensitive);
}
- public IClass DeepGetClass (IProject project, string typeName, bool caseSensitive)
+ public IClass DeepGetClass (Project project, string typeName, bool caseSensitive)
{
CodeCompletionDatabase db = (project != null) ? GetProjectDatabase (project) : GetActiveFileDatabase ();
@@ -770,12 +770,12 @@
return null;
}
- public string[] GetNamespaceList (IProject project, string subNameSpace)
+ public string[] GetNamespaceList (Project project, string subNameSpace)
{
return GetNamespaceList (project, subNameSpace, true);
}
- public string[] GetNamespaceList (IProject project, string subNameSpace, bool caseSensitive)
+ public string[] GetNamespaceList (Project project, string subNameSpace, bool caseSensitive)
{
ArrayList contents = new ArrayList ();
@@ -796,12 +796,12 @@
return (string[]) contents.ToArray (typeof(string));
}
- public ArrayList GetNamespaceContents (IProject project, string namspace, bool includeReferences)
+ public ArrayList GetNamespaceContents (Project project, string namspace, bool includeReferences)
{
return GetNamespaceContents (project, namspace, includeReferences, true);
}
- public ArrayList GetNamespaceContents (IProject project, string namspace, bool includeReferences, bool caseSensitive)
+ public ArrayList GetNamespaceContents (Project project, string namspace, bool includeReferences, bool caseSensitive)
{
ArrayList contents = new ArrayList ();
@@ -826,12 +826,12 @@
return contents;
}
- public bool NamespaceExists(IProject project, string name)
+ public bool NamespaceExists(Project project, string name)
{
return NamespaceExists(project, name, true);
}
- public bool NamespaceExists(IProject project, string name, bool caseSensitive)
+ public bool NamespaceExists(Project project, string name, bool caseSensitive)
{
CodeCompletionDatabase db = (project != null) ? GetProjectDatabase (project) : GetActiveFileDatabase ();
if (db != null) {
@@ -848,12 +848,12 @@
return db.NamespaceExists (name, caseSensitive);
}
- public string SearchNamespace(IProject project, IUsing usin, string partitialNamespaceName)
+ public string SearchNamespace(Project project, IUsing usin, string partitialNamespaceName)
{
return SearchNamespace(project, usin, partitialNamespaceName, true);
}
- public string SearchNamespace(IProject project, IUsing usin, string partitialNamespaceName, bool caseSensitive)
+ public string SearchNamespace(Project project, IUsing usin, string partitialNamespaceName, bool caseSensitive)
{
// Console.WriteLine("SearchNamespace : >{0}<", partitialNamespaceName);
if (NamespaceExists(project, partitialNamespaceName, caseSensitive)) {
@@ -896,7 +896,7 @@
/// <remarks>
/// use the usings and the name of the namespace to find a class
/// </remarks>
- public IClass SearchType (IProject project, string name, IClass callingClass, ICompilationUnit unit)
+ public IClass SearchType (Project project, string name, IClass callingClass, ICompilationUnit unit)
{
if (name == null || name == String.Empty)
return null;
@@ -937,12 +937,12 @@
return null;
}
- public IClass SearchType(IProject project, IUsing iusing, string partitialTypeName)
+ public IClass SearchType(Project project, IUsing iusing, string partitialTypeName)
{
return SearchType(project, iusing, partitialTypeName, true);
}
- public IClass SearchType(IProject project, IUsing iusing, string partitialTypeName, bool caseSensitive)
+ public IClass SearchType(Project project, IUsing iusing, string partitialTypeName, bool caseSensitive)
{
// Console.WriteLine("Search type : >{0}<", partitialTypeName);
IClass c = GetClass(project, partitialTypeName, caseSensitive);
@@ -999,7 +999,7 @@
return null;
}
- public bool ResolveTypes (IProject project, ICompilationUnit unit, ClassCollection types, out ClassCollection result)
+ public bool ResolveTypes (Project project, ICompilationUnit unit, ClassCollection types, out ClassCollection result)
{
CompilationUnitTypeResolver tr = new CompilationUnitTypeResolver (project, unit, this);
@@ -1015,7 +1015,7 @@
return allResolved;
}
- public IEnumerable GetClassInheritanceTree (IProject project, IClass cls)
+ public IEnumerable GetClassInheritanceTree (Project project, IClass cls)
{
return new ClassInheritanceEnumerator (this, project, cls);
}
@@ -1046,10 +1046,10 @@
if (fileContent == null) {
if (Runtime.ProjectService.CurrentOpenCombine != null) {
- ArrayList projects = Combine.GetAllProjects (Runtime.ProjectService.CurrentOpenCombine);
- foreach (ProjectCombineEntry entry in projects) {
- if (entry.Project.IsFileInProject(fileName)) {
- fileContent = entry.Project.GetParseableFileContent(fileName);
+ CombineEntryCollection projects = Runtime.ProjectService.CurrentOpenCombine.GetAllProjects ();
+ foreach (Project entry in projects) {
+ if (entry.IsFileInProject(fileName)) {
+ fileContent = entry.GetParseableFileContent(fileName);
}
}
}
@@ -1159,7 +1159,7 @@
////////////////////////////////////
- public ArrayList CtrlSpace(IParserService parserService, IProject project, int caretLine, int caretColumn, string fileName)
+ public ArrayList CtrlSpace(IParserService parserService, Project project, int caretLine, int caretColumn, string fileName)
{
IParser parser = GetParser(fileName);
if (parser != null) {
@@ -1168,7 +1168,7 @@
return null;
}
- public ArrayList IsAsResolve (IProject project, string expression, int caretLineNumber, int caretColumn, string fileName, string fileContent)
+ public ArrayList IsAsResolve (Project project, string expression, int caretLineNumber, int caretColumn, string fileName, string fileContent)
{
try {
IParser parser = GetParser (fileName);
@@ -1181,7 +1181,7 @@
}
}
- public ResolveResult Resolve(IProject project,
+ public ResolveResult Resolve(Project project,
string expression,
int caretLineNumber,
int caretColumn,
@@ -1210,7 +1210,7 @@
get { return nameTable; }
}
- public string MonodocResolver (IProject project, string expression, int caretLineNumber, int caretColumn, string fileName, string fileContent)
+ public string MonodocResolver (Project project, string expression, int caretLineNumber, int caretColumn, string fileName, string fileContent)
{
try {
IParser parser = GetParser (fileName);
@@ -1279,9 +1279,9 @@
IClass topLevelClass;
IClass currentClass = null;
Queue baseTypeQueue = new Queue();
- IProject project;
+ Project project;
- internal ClassInheritanceEnumerator(DefaultParserService parserService, IProject project, IClass topLevelClass)
+ internal ClassInheritanceEnumerator(DefaultParserService parserService, Project project, IClass topLevelClass)
{
this.parserService = parserService;
this.project = project;
Index: Core/src/MonoDevelop.Base/Services/ParserService/IParserService.cs
===================================================================
--- Core/src/MonoDevelop.Base/Services/ParserService/IParserService.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Services/ParserService/IParserService.cs (working copy)
@@ -48,22 +48,22 @@
IExpressionFinder GetExpressionFinder(string fileName);
// Default Parser Layer dependent functions
- IClass GetClass(IProject project, string typeName);
- string[] GetNamespaceList(IProject project, string subNameSpace);
- ArrayList GetNamespaceContents(IProject project, string subNameSpace, bool includeReferences);
- bool NamespaceExists(IProject project, string name);
- string SearchNamespace(IProject project, IUsing iusing, string partitialNamespaceName);
- IClass SearchType(IProject project, IUsing iusing, string partitialTypeName);
+ IClass GetClass(Project project, string typeName);
+ string[] GetNamespaceList(Project project, string subNameSpace);
+ ArrayList GetNamespaceContents(Project project, string subNameSpace, bool includeReferences);
+ bool NamespaceExists(Project project, string name);
+ string SearchNamespace(Project project, IUsing iusing, string partitialNamespaceName);
+ IClass SearchType(Project project, IUsing iusing, string partitialTypeName);
- IClass GetClass(IProject project, string typeName, bool deepSearchReferences, bool caseSensitive);
- string[] GetNamespaceList(IProject project, string subNameSpace, bool caseSensitive);
- ArrayList GetNamespaceContents(IProject project, string subNameSpace, bool includeReferences, bool caseSensitive);
- bool NamespaceExists(IProject project, string name, bool caseSensitive);
- string SearchNamespace(IProject project, IUsing iusing, string partitialNamespaceName, bool caseSensitive);
- IClass SearchType(IProject project, IUsing iusing, string partitialTypeName, bool caseSensitive);
- IClass SearchType (IProject project, string name, IClass callingClass, ICompilationUnit unit);
+ IClass GetClass(Project project, string typeName, bool deepSearchReferences, bool caseSensitive);
+ string[] GetNamespaceList(Project project, string subNameSpace, bool caseSensitive);
+ ArrayList GetNamespaceContents(Project project, string subNameSpace, bool includeReferences, bool caseSensitive);
+ bool NamespaceExists(Project project, string name, bool caseSensitive);
+ string SearchNamespace(Project project, IUsing iusing, string partitialNamespaceName, bool caseSensitive);
+ IClass SearchType(Project project, IUsing iusing, string partitialTypeName, bool caseSensitive);
+ IClass SearchType (Project project, string name, IClass callingClass, ICompilationUnit unit);
- IEnumerable GetClassInheritanceTree (IProject project, IClass cls);
+ IEnumerable GetClassInheritanceTree (Project project, IClass cls);
////////////////////////////////////////////
@@ -71,15 +71,15 @@
/// Resolves an expression.
/// The caretLineNumber and caretColumn is 1 based.
/// </summary>
- ResolveResult Resolve(IProject project,
+ ResolveResult Resolve(Project project,
string expression,
int caretLineNumber,
int caretColumn,
string fileName,
string fileContent);
- string MonodocResolver (IProject project, string expression, int caretLineNumber, int caretColumn, string fileName, string fileContent);
- ArrayList IsAsResolve (IProject project, string expression, int caretLineNumber, int caretColumn, string fileName, string fileContent);
- ArrayList CtrlSpace(IParserService parserService, IProject project, int caretLine, int caretColumn, string fileName);
+ string MonodocResolver (Project project, string expression, int caretLineNumber, int caretColumn, string fileName, string fileContent);
+ ArrayList IsAsResolve (Project project, string expression, int caretLineNumber, int caretColumn, string fileName, string fileContent);
+ ArrayList CtrlSpace(IParserService parserService, Project project, int caretLine, int caretColumn, string fileName);
string LoadAssemblyFromGac (string name);
event ParseInformationEventHandler ParseInformationChanged;
Index: Core/src/MonoDevelop.Base/Services/ParserService/CodeCompletionDatabase.cs
===================================================================
--- Core/src/MonoDevelop.Base/Services/ParserService/CodeCompletionDatabase.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Services/ParserService/CodeCompletionDatabase.cs (working copy)
@@ -628,9 +628,9 @@
internal class ProjectCodeCompletionDatabase: CodeCompletionDatabase
{
- IProject project;
+ Project project;
- public ProjectCodeCompletionDatabase (IProject project, DefaultParserService parserService)
+ public ProjectCodeCompletionDatabase (Project project, DefaultParserService parserService)
: base (parserService)
{
SetLocation (project.BaseDirectory, project.Name);
Index: Core/src/MonoDevelop.Base/Services/LanguageBinding/LanguageBindingService.cs
===================================================================
--- Core/src/MonoDevelop.Base/Services/LanguageBinding/LanguageBindingService.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Services/LanguageBinding/LanguageBindingService.cs (working copy)
@@ -69,8 +69,9 @@
return GetCodonPerLanguageName(doc.DocumentElement.Attributes["projecttype"].InnerText);
}
- public LanguageBindingService()
+ public override void InitializeService ()
{
+ base.InitializeService ();
bindings = (LanguageBindingCodon[])(AddInTreeSingleton.AddInTree.GetTreeNode("/SharpDevelop/Workbench/LanguageBindings").BuildChildItems(null)).ToArray(typeof(LanguageBindingCodon));
}
}
Index: Core/src/MonoDevelop.Base/Gui/IViewContent.cs
===================================================================
--- Core/src/MonoDevelop.Base/Gui/IViewContent.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Gui/IViewContent.cs (working copy)
@@ -95,7 +95,7 @@
/// <summary>
/// The name of the project the content is attached to
/// </summary>
- IProject Project {
+ Project Project {
get;
set;
}
Index: Core/src/MonoDevelop.Base/Gui/Dialogs/SharpDevelopAboutPanels.cs
===================================================================
--- Core/src/MonoDevelop.Base/Gui/Dialogs/SharpDevelopAboutPanels.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Gui/Dialogs/SharpDevelopAboutPanels.cs (working copy)
@@ -14,7 +14,6 @@
using MonoDevelop.Gui;
using MonoDevelop.Core.Properties;
using MonoDevelop.Core.Services;
-using MonoDevelop.Internal.Project.Collections;
using MonoDevelop.Internal.Project;
using MonoDevelop.Services;
Index: Core/src/MonoDevelop.Base/Gui/Dialogs/NewProjectDialog.cs
===================================================================
--- Core/src/MonoDevelop.Base/Gui/Dialogs/NewProjectDialog.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Gui/Dialogs/NewProjectDialog.cs (working copy)
@@ -160,7 +160,7 @@
return true;
}
- public void SaveFile(IProject project, string filename, string content, bool showFile)
+ public void SaveFile(Project project, string filename, string content, bool showFile)
{
project.ProjectFiles.Add (new ProjectFile(filename));
@@ -206,7 +206,7 @@
return;
}
- if(Runtime.ProjectService.ExistsEntryWithName(name)) {
+ if (Runtime.ProjectService.CurrentOpenCombine.Entries [name] != null) {
Runtime.MessageService.ShowError(GettextCatalog.GetString ("A Project with that name is already in your Project Space"));
dialog.Respond(Gtk.ResponseType.Reject);
dialog.Hide();
Index: Core/src/MonoDevelop.Base/Gui/Dialogs/CombineConfiguration/CombineConfigurationPanel.cs
===================================================================
--- Core/src/MonoDevelop.Base/Gui/Dialogs/CombineConfiguration/CombineConfigurationPanel.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Gui/Dialogs/CombineConfiguration/CombineConfigurationPanel.cs (working copy)
@@ -112,8 +112,8 @@
CombineEntry entry = (CombineEntry)combine.Entries[combine.GetEntryNumber(item.Text)];
int index = 0;
- if (entry.Entry is IProject) {
- IProject subproject = (IProject)entry.Entry;
+ if (entry.Entry is Project) {
+ Project subproject = (Project)entry.Entry;
for (int i = 0; i < subproject.Configurations.Count; ++i) {
string name = ((IConfiguration)subproject.Configurations[i]).Name;
if (name == item.SubItems[1].Text)
Index: Core/src/MonoDevelop.Base/Gui/Dialogs/ProjectOptionsDialog.cs
===================================================================
--- Core/src/MonoDevelop.Base/Gui/Dialogs/ProjectOptionsDialog.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Gui/Dialogs/ProjectOptionsDialog.cs (working copy)
@@ -24,14 +24,14 @@
/// </summary>
public class ProjectOptionsDialog : TreeViewOptions
{
- IProject project;
+ Project project;
IAddInTreeNode configurationNode;
Gtk.TreeIter configurationTreeNode;
Gtk.CellRendererText textRenderer; // used to set an editable node
Gtk.TreeViewColumn textColumn; // used to set an editable node
- public ProjectOptionsDialog(IProject project, IAddInTreeNode node, IAddInTreeNode configurationNode) : base(null, null)
+ public ProjectOptionsDialog(Project project, IAddInTreeNode node, IAddInTreeNode configurationNode) : base(null, null)
{
this.project = project;
this.configurationNode = configurationNode;
Index: Core/src/MonoDevelop.Base/Gui/Dialogs/WordCountDialog.cs
===================================================================
--- Core/src/MonoDevelop.Base/Gui/Dialogs/WordCountDialog.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Gui/Dialogs/WordCountDialog.cs (working copy)
@@ -153,9 +153,9 @@
void CountCombine(Combine combine, ref Report all)
{
foreach (CombineEntry entry in combine.Entries) {
- if (entry.Entry is IProject) {
+ if (entry is Project) {
// string tmp = "";
- foreach (ProjectFile finfo in ((IProject)entry.Entry).ProjectFiles) {
+ foreach (ProjectFile finfo in ((Project)entry).ProjectFiles) {
if (finfo.Subtype != Subtype.Directory &&
finfo.BuildAction == BuildAction.Compile) {
Report r = GetReport(finfo.Name);
@@ -166,7 +166,7 @@
}
}
} else
- CountCombine((Combine)entry.Entry, ref all);
+ CountCombine ((Combine)entry, ref all);
}
}
Index: Core/src/MonoDevelop.Base/Gui/Dialogs/OptionPanels/ProjectOptions/CompileFileProjectOptions.cs
===================================================================
--- Core/src/MonoDevelop.Base/Gui/Dialogs/OptionPanels/ProjectOptions/CompileFileProjectOptions.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Gui/Dialogs/OptionPanels/ProjectOptions/CompileFileProjectOptions.cs (working copy)
@@ -32,12 +32,12 @@
[Glade.Widget] Gtk.TreeView includeTreeView;
public ListStore store;
- IProject project;
+ Project project;
public CompileFileOptionsWidget (IProperties CustomizationObject) :
base ("Base.glade", "CompileFileOptionsPanel")
{
- this.project = (IProject)((IProperties)CustomizationObject).GetProperty("Project");
+ this.project = (Project)((IProperties)CustomizationObject).GetProperty("Project");
includeLabel.UseUnderline = true;
store = new ListStore (typeof(bool), typeof(string));
Index: Core/src/MonoDevelop.Base/Gui/Dialogs/OptionPanels/ProjectOptions/OutputOptionsPanel.cs
===================================================================
--- Core/src/MonoDevelop.Base/Gui/Dialogs/OptionPanels/ProjectOptions/OutputOptionsPanel.cs (revision 0)
+++ Core/src/MonoDevelop.Base/Gui/Dialogs/OptionPanels/ProjectOptions/OutputOptionsPanel.cs (revision 0)
@@ -0,0 +1,158 @@
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Mike Krger" email="mike@icsharpcode.net"/>
+// <version value="$version"/>
+// </file>
+
+using System;
+using System.IO;
+using System.Drawing;
+
+using MonoDevelop.Internal.Project;
+using MonoDevelop.Internal.ExternalTool;
+using MonoDevelop.Gui.Dialogs;
+using MonoDevelop.Gui.Widgets;
+using MonoDevelop.Core.Services;
+using MonoDevelop.Core.Properties;
+using MonoDevelop.Core.AddIns.Codons;
+using MonoDevelop.Services;
+
+using Gtk;
+
+namespace MonoDevelop.Gui.Dialogs.OptionPanels
+{
+ public class OutputOptionsPanel : AbstractOptionPanel
+ {
+ class OutputOptionsPanelWidget : GladeWidgetExtract
+ {
+ //
+ // Gtk Controls
+ //
+ [Glade.Widget] Entry assemblyNameEntry;
+ [Glade.Widget] Entry outputDirectoryEntry;
+ [Glade.Widget] Entry parametersEntry;
+ [Glade.Widget] Entry executeBeforeEntry;
+ [Glade.Widget] Entry executeScriptEntry;
+ [Glade.Widget] Entry executeAfterEntry;
+ [Glade.Widget] CheckButton pauseConsoleOutputCheckButton;
+ [Glade.Widget] Button browseButton;
+ [Glade.Widget] Button browseButton2;
+ [Glade.Widget] Button browseButton3;
+ [Glade.Widget] Button browseButton4;
+
+ DotNetProjectConfiguration configuration;
+
+ public OutputOptionsPanelWidget(IProperties CustomizationObject) : base ("Base.glade", "OutputOptionsPanel")
+ {
+ configuration = (DotNetProjectConfiguration)((IProperties)CustomizationObject).GetProperty("Config");
+ browseButton.Clicked += new EventHandler (SelectFolder);
+ browseButton2.Clicked += new EventHandler (SelectFile4);
+ browseButton3.Clicked += new EventHandler (SelectFile3);
+ browseButton4.Clicked += new EventHandler (SelectFile2);
+
+ assemblyNameEntry.Text = configuration.OutputAssembly;
+ outputDirectoryEntry.Text = configuration.OutputDirectory;
+ parametersEntry.Text = configuration.CommandLineParameters;
+ executeScriptEntry.Text = configuration.ExecuteScript;
+ executeBeforeEntry.Text = configuration.ExecuteBeforeBuild;
+ executeAfterEntry.Text = configuration.ExecuteAfterBuild;
+
+ pauseConsoleOutputCheckButton.Active = configuration.PauseConsoleOutput;
+ }
+
+ public bool Store ()
+ {
+ if (configuration == null) {
+ return true;
+ }
+
+ if (!Runtime.FileUtilityService.IsValidFileName(assemblyNameEntry.Text)) {
+ Runtime.MessageService.ShowError (GettextCatalog.GetString ("Invalid assembly name specified"));
+ return false;
+ }
+
+ if (!Runtime.FileUtilityService.IsValidFileName (outputDirectoryEntry.Text)) {
+ Runtime.MessageService.ShowError (GettextCatalog.GetString ("Invalid output directory specified"));
+ return false;
+ }
+
+ configuration.OutputAssembly = assemblyNameEntry.Text;
+ configuration.OutputDirectory = outputDirectoryEntry.Text;
+ configuration.CommandLineParameters = parametersEntry.Text;
+ configuration.ExecuteBeforeBuild = executeBeforeEntry.Text;
+ configuration.ExecuteAfterBuild = executeAfterEntry.Text;
+ configuration.ExecuteScript = executeScriptEntry.Text;
+ configuration.PauseConsoleOutput = pauseConsoleOutputCheckButton.Active;
+ return true;
+ }
+
+ void SelectFolder(object sender, EventArgs e)
+ {
+ using (FileSelector fdiag = new FileSelector (GettextCatalog.GetString ("Select the directory in which the assembly will be created"))) {
+ if (fdiag.Run () == (int) ResponseType.Ok) {
+ outputDirectoryEntry.Text = fdiag.Filename;
+ }
+
+ fdiag.Hide ();
+ }
+ }
+
+ void SelectFile2(object sender, EventArgs e)
+ {
+ using (FileSelector fdiag = new FileSelector ("")) {
+ //fdiag.Filter = StringParserService.Parse("${res:SharpDevelop.FileFilter.AllFiles}|*.*");
+ fdiag.SelectMultiple = false;
+
+ if(fdiag.Run () == (int) ResponseType.Ok) {
+ executeBeforeEntry.Text = fdiag.Filename;
+ }
+
+ fdiag.Hide ();
+ }
+ }
+
+ void SelectFile3(object sender, EventArgs e)
+ {
+ using (FileSelector fdiag = new FileSelector ("")) {
+ //fdiag.Filter = StringParserService.Parse("${res:SharpDevelop.FileFilter.AllFiles}|*.*");
+ fdiag.SelectMultiple = false;
+
+ if(fdiag.Run () == (int) ResponseType.Ok) {
+ executeAfterEntry.Text = fdiag.Filename;
+ }
+
+ fdiag.Hide ();
+ }
+ }
+
+ void SelectFile4(object sender, EventArgs e)
+ {
+ using (FileSelector fdiag = new FileSelector ("")) {
+ //fdiag.Filter = StringParserService.Parse("${res:SharpDevelop.FileFilter.AllFiles}|*.*");
+ fdiag.SelectMultiple = false;
+
+ if(fdiag.Run () == (int) ResponseType.Ok) {
+ executeScriptEntry.Text = fdiag.Filename;
+ }
+
+ fdiag.Hide ();
+ }
+ }
+ }
+
+ OutputOptionsPanelWidget widget;
+
+ public override void LoadPanelContents()
+ {
+ Add (widget = new OutputOptionsPanelWidget ((IProperties) CustomizationObject));
+ }
+
+ public override bool StorePanelContents()
+ {
+ bool result = true;
+ result = widget.Store ();
+ return result;
+ }
+ }
+}
Index: Core/src/MonoDevelop.Base/Gui/Dialogs/OptionPanels/ProjectOptions/GeneralProjectOptions.cs
===================================================================
--- Core/src/MonoDevelop.Base/Gui/Dialogs/OptionPanels/ProjectOptions/GeneralProjectOptions.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Gui/Dialogs/OptionPanels/ProjectOptions/GeneralProjectOptions.cs (working copy)
@@ -43,13 +43,13 @@
[Glade.Widget] CheckButton autoInsertNewFilesCheckButton;
[Glade.Widget] CheckButton enableViewStateCheckButton;
- IProject project;
+ Project project;
public GeneralProjectOptionsWidget (IProperties CustomizationObject) : base ("Base.glade", "GeneralProjectOptionsPanel")
{
- this.project = (IProject)((IProperties)CustomizationObject).GetProperty("Project");
+ this.project = (Project)((IProperties)CustomizationObject).GetProperty("Project");
nameLabel.UseUnderline = true;
Index: Core/src/MonoDevelop.Base/Gui/Dialogs/OptionPanels/ProjectOptions/DeployFileOptions.cs
===================================================================
--- Core/src/MonoDevelop.Base/Gui/Dialogs/OptionPanels/ProjectOptions/DeployFileOptions.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Gui/Dialogs/OptionPanels/ProjectOptions/DeployFileOptions.cs (working copy)
@@ -42,13 +42,13 @@
public ListStore store;
// Services
- IProject project;
+ Project project;
static FileUtilityService fileUtilityService = Runtime.FileUtilityService;
public DeployFileOptionsWidget (IProperties CustomizationObject) :
base ("Base.glade", "DeployFileOptionsPanel")
{
- this.project = (IProject)((IProperties)CustomizationObject).GetProperty("Project");
+ this.project = (Project)((IProperties)CustomizationObject).GetProperty("Project");
projectFileRadioButton.Clicked += new EventHandler(RadioButtonClicked);
compiledAssemblyRadioButton.Clicked += new EventHandler(RadioButtonClicked);
Index: Core/src/MonoDevelop.Base/Gui/Dialogs/ReferenceDialog/WebReference.cs
===================================================================
--- Core/src/MonoDevelop.Base/Gui/Dialogs/ReferenceDialog/WebReference.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Gui/Dialogs/ReferenceDialog/WebReference.cs (working copy)
@@ -80,7 +80,7 @@
}
- public static ProjectReference GenerateWebProxyDLL(IProject project, ServiceDescription desc) {
+ public static ProjectReference GenerateWebProxyDLL(Project project, ServiceDescription desc) {
ProjectReference refInfo = null;
string serviceName = String.Empty;
@@ -139,14 +139,14 @@
///
/// <summary>Generates a Web Service proxy DLL from a URI</summary>
///
- public static ProjectReference GenerateWebProxyDLL(IProject project, string url) {
+ public static ProjectReference GenerateWebProxyDLL(Project project, string url) {
ServiceDescription desc = ReadServiceDescription(url);
return GenerateWebProxyDLL(project, desc);
}
- public static ArrayList GenerateWebProxyCode(IProject project, ServiceDescription desc) {
+ public static ArrayList GenerateWebProxyCode(Project project, ServiceDescription desc) {
ArrayList fileList = null;
string serviceName = String.Empty;
@@ -273,7 +273,7 @@
///
/// <summary>Generates a Web Service proxy class from a URI</summary>
///
- public static ArrayList GenerateWebProxyCode(IProject project, string url) {
+ public static ArrayList GenerateWebProxyCode(Project project, string url) {
ServiceDescription desc = ReadServiceDescription(url);
Index: Core/src/MonoDevelop.Base/Gui/Dialogs/ReferenceDialog/SelectReferenceDialog.cs
===================================================================
--- Core/src/MonoDevelop.Base/Gui/Dialogs/ReferenceDialog/SelectReferenceDialog.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Gui/Dialogs/ReferenceDialog/SelectReferenceDialog.cs (working copy)
@@ -35,7 +35,7 @@
[Glade.Widget] Gtk.Notebook mainBook;
GacReferencePanel gacRefPanel;
- IProject configureProject;
+ Project configureProject;
public ArrayList ReferenceInformations {
get {
@@ -62,7 +62,7 @@
AddReferenceDialog.Hide ();
}
- public SelectReferenceDialog(IProject configureProject)
+ public SelectReferenceDialog(Project configureProject)
{
this.configureProject = configureProject;
@@ -109,13 +109,13 @@
void AddNonGacReference (ProjectReference refInfo)
{
- refTreeStore.AppendValues (System.IO.Path.GetFileName (refInfo.Reference), refInfo.ReferenceType.ToString (), System.IO.Path.GetFullPath (refInfo.GetReferencedFileName (configureProject)), refInfo);
+ refTreeStore.AppendValues (System.IO.Path.GetFileName (refInfo.Reference), refInfo.ReferenceType.ToString (), System.IO.Path.GetFullPath (refInfo.GetReferencedFileName ()), refInfo);
}
- void AddGacReference (ProjectReference refInfo, IProject referencedProject)
+ void AddGacReference (ProjectReference refInfo, Project referencedProject)
{
gacRefPanel.SignalRefChange (refInfo.Reference, true);
- refTreeStore.AppendValues (System.IO.Path.GetFileNameWithoutExtension (refInfo.GetReferencedFileName (referencedProject)), refInfo.ReferenceType.ToString (), refInfo.Reference, refInfo);
+ refTreeStore.AppendValues (System.IO.Path.GetFileNameWithoutExtension (refInfo.GetReferencedFileName ()), refInfo.ReferenceType.ToString (), refInfo.Reference, refInfo);
}
public void RemoveReference (ReferenceType referenceType, string referenceName, string referenceLocation)
Index: Core/src/MonoDevelop.Base/Gui/Dialogs/ReferenceDialog/ProjectReferencePanel.cs
===================================================================
--- Core/src/MonoDevelop.Base/Gui/Dialogs/ReferenceDialog/ProjectReferencePanel.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Gui/Dialogs/ReferenceDialog/ProjectReferencePanel.cs (working copy)
@@ -27,7 +27,7 @@
{
this.selectDialog = selectDialog;
- store = new TreeStore (typeof (string), typeof (string), typeof(IProject));
+ store = new TreeStore (typeof (string), typeof (string), typeof(Project));
treeView = new TreeView (store);
treeView.AppendColumn (GettextCatalog.GetString ("Project Name"), new CellRendererText (), "text", 0);
treeView.AppendColumn (GettextCatalog.GetString ("Project Directory"), new CellRendererText (), "text", 1);
@@ -47,12 +47,10 @@
void AddReference (TreeModel model, TreePath path, TreeIter iter)
{
- IProject project = (IProject) model.GetValue (iter, 2);
- ILanguageBinding binding = Runtime.Languages.GetBindingPerLanguageName(project.ProjectType);
-
+ Project project = (Project) model.GetValue (iter, 2);
selectDialog.AddReference(ReferenceType.Project,
project.Name,
- binding.GetCompiledOutputName(project));
+ project.GetOutputFileName());
}
public void AddReference(object sender, EventArgs e)
@@ -68,10 +66,8 @@
return;
}
- ArrayList projects = Combine.GetAllProjects(openCombine);
-
- foreach (ProjectCombineEntry projectEntry in projects) {
- store.AppendValues (projectEntry.Project.Name, projectEntry.Project.BaseDirectory, projectEntry.Project);
+ foreach (Project projectEntry in openCombine.GetAllProjects()) {
+ store.AppendValues (projectEntry.Name, projectEntry.BaseDirectory, projectEntry);
}
}
}
@@ -105,13 +101,10 @@
public void AddReference(object sender, EventArgs e)
{
foreach (ListViewItem item in SelectedItems) {
- IProject project = (IProject)item.Tag;
- LanguageBindingService languageBindingService = (LanguageBindingService)MonoDevelop.Core.Services.ServiceManager.Services.GetService(typeof(LanguageBindingService));
- ILanguageBinding binding = languageBindingService.GetBindingPerLanguageName(project.ProjectType);
-
+ Project project = (Project)item.Tag;
selectDialog.AddReference(ReferenceType.Project,
project.Name,
- binding.GetCompiledOutputName(project));
+ project.GetOutputFileName());
}
}
Index: Core/src/MonoDevelop.Base/Gui/Dialogs/ReferenceDialog/AddWebReferenceDialog.cs
===================================================================
--- Core/src/MonoDevelop.Base/Gui/Dialogs/ReferenceDialog/AddWebReferenceDialog.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Gui/Dialogs/ReferenceDialog/AddWebReferenceDialog.cs (working copy)
@@ -57,7 +57,7 @@
/// </summary>
private System.ComponentModel.Container components = null;
- private IProject project = null;
+ private Project project = null;
private ResourceService resourceService = (ResourceService)ServiceManager.Services.GetService(typeof(IResourceService));
private FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
@@ -71,7 +71,7 @@
}
}
- public AddWebReferenceDialog(IProject p)
+ public AddWebReferenceDialog(Project p)
{
//
// Required for Windows Form Designer support
Index: Core/src/MonoDevelop.Base/Gui/Pads/ClassScout/ClassScout.cs
===================================================================
--- Core/src/MonoDevelop.Base/Gui/Pads/ClassScout/ClassScout.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Gui/Pads/ClassScout/ClassScout.cs (working copy)
@@ -172,14 +172,14 @@
protected override void OnBeforeExpand (TreeViewCancelEventArgs e)
{
TreeNode nod = e.Node;
- if (nod.Tag == null || nod.Tag is IProject)
+ if (nod.Tag == null || nod.Tag is Project)
{
while (nod != null && nod.Tag == null)
nod = nod.Parent;
if (nod == null) return;
- IProject p = (IProject)nod.Tag;
+ Project p = (Project)nod.Tag;
foreach (IClassScoutNodeBuilder classBrowserNodeBuilder in classBrowserNodeBuilders) {
if (classBrowserNodeBuilder.CanBuildClassTree(p)) {
classBrowserNodeBuilder.ExpandNode (e.Node);
@@ -260,15 +260,15 @@
public void ParseCombine(Combine combine)
{
foreach (CombineEntry entry in combine.Entries) {
- if (entry is ProjectCombineEntry) {
- ParseProject(((ProjectCombineEntry)entry).Project);
+ if (entry is Project) {
+ ParseProject((Project)entry);
} else {
- ParseCombine(((CombineCombineEntry)entry).Combine);
+ ParseCombine((Combine)entry);
}
}
}
- void ParseProject(IProject p)
+ void ParseProject(Project p)
{
if (p.ProjectType == "C#") {
foreach (ProjectFile finfo in p.ProjectFiles) {
@@ -303,10 +303,10 @@
lock (combine.Entries) {
foreach (CombineEntry entry in combine.Entries) {
- if (entry is ProjectCombineEntry) {
- Populate(((ProjectCombineEntry)entry).Project, combineNode.Nodes);
+ if (entry is Project) {
+ Populate((Project)entry, combineNode.Nodes);
} else {
- Populate(((CombineCombineEntry)entry).Combine, combineNode.Nodes);
+ Populate((Combine)entry, combineNode.Nodes);
}
}
}
@@ -314,7 +314,7 @@
nodes.Add(combineNode);
}
- void Populate(IProject p, TreeNodeCollection nodes)
+ void Populate(Project p, TreeNodeCollection nodes)
{
// only C# is currently supported.
bool builderFound = false;
@@ -343,8 +343,8 @@
{
BeginUpdate();
foreach (TreeNode node in nodes) {
- if (node.Tag is IProject) {
- IProject p = (IProject)node.Tag;
+ if (node.Tag is Project) {
+ Project p = (Project)node.Tag;
if (p.IsFileInProject(e.FileName)) {
foreach (IClassScoutNodeBuilder classBrowserNodeBuilder in classBrowserNodeBuilders) {
classBrowserNodeBuilder.UpdateClassTree(node, e);
Index: Core/src/MonoDevelop.Base/Gui/Pads/ClassScout/NodeBuilder/DefaultDotNetClassScoutNodeBuilder.cs
===================================================================
--- Core/src/MonoDevelop.Base/Gui/Pads/ClassScout/NodeBuilder/DefaultDotNetClassScoutNodeBuilder.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Gui/Pads/ClassScout/NodeBuilder/DefaultDotNetClassScoutNodeBuilder.cs (working copy)
@@ -34,7 +34,7 @@
{
}
- public bool CanBuildClassTree(IProject project)
+ public bool CanBuildClassTree(Project project)
{
return true;
}
@@ -73,7 +73,7 @@
public void UpdateClassTree(TreeNode projectNode)
{
- TreeNode newNode = BuildClassTreeNode((IProject)projectNode.Tag);
+ TreeNode newNode = BuildClassTreeNode((Project)projectNode.Tag);
projectNode.Nodes.Clear();
foreach (TreeNode node in newNode.Nodes)
projectNode.Nodes.Add(node);
@@ -84,7 +84,7 @@
return (nod.Nodes.Count == 1 && nod.Nodes[0].Text == "");
}
- public TreeNode BuildClassTreeNode(IProject p)
+ public TreeNode BuildClassTreeNode(Project p)
{
Type fus = typeof (FileUtilityService);
@@ -109,17 +109,17 @@
nod = nod.Parent;
}
- IProject p = (IProject)nod.Tag;
+ Project p = (Project)nod.Tag;
ExpandNamespaceTree (p, ns, node);
}
- else if (node.Tag is IProject)
+ else if (node.Tag is Project)
{
- IProject p = (IProject)node.Tag;
+ Project p = (Project)node.Tag;
ExpandNamespaceTree (p, "", node);
}
}
- void ExpandNamespaceTree (IProject project, string ns, TreeNode node)
+ void ExpandNamespaceTree (Project project, string ns, TreeNode node)
{
if (!NeedsExpansion (node)) return;
node.Nodes.Clear ();
@@ -244,7 +244,7 @@
TreeNode node = GetNodeByPath (ns, projectNode, false);
if (node != null && node != projectNode) {
if (NeedsExpansion (node)) {
- ArrayList contents = Runtime.ParserService.GetNamespaceContents (projectNode.Tag as IProject, ns, false);
+ ArrayList contents = Runtime.ParserService.GetNamespaceContents (projectNode.Tag as Project, ns, false);
if (contents.Count == 0)
node.Remove ();
} else if (node.Nodes.Count == 0) {
Index: Core/src/MonoDevelop.Base/Gui/Pads/ClassScout/NodeBuilder/IClassScoutNodeBuilder.cs
===================================================================
--- Core/src/MonoDevelop.Base/Gui/Pads/ClassScout/NodeBuilder/IClassScoutNodeBuilder.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Gui/Pads/ClassScout/NodeBuilder/IClassScoutNodeBuilder.cs (working copy)
@@ -21,8 +21,8 @@
{
public interface IClassScoutNodeBuilder
{
- bool CanBuildClassTree(IProject project);
- TreeNode BuildClassTreeNode(IProject project);
+ bool CanBuildClassTree(Project project);
+ TreeNode BuildClassTreeNode(Project project);
void ExpandNode (TreeNode node);
void UpdateClassTree (TreeNode projectNode, ClassInformationEventArgs e);
Index: Core/src/MonoDevelop.Base/Gui/Pads/ProjectBrowser/BrowserNode/AbstractBrowserNode.cs
===================================================================
--- Core/src/MonoDevelop.Base/Gui/Pads/ProjectBrowser/BrowserNode/AbstractBrowserNode.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Gui/Pads/ProjectBrowser/BrowserNode/AbstractBrowserNode.cs (working copy)
@@ -69,7 +69,7 @@
/// any node is child of a project. THIS DON'T WORK ON COMBINE NODES!
/// (a combine node returns null)
/// </summary>
- public virtual IProject Project {
+ public virtual Project Project {
get {
if (Parent == null || !(Parent is AbstractBrowserNode)) {
return null;
Index: Core/src/MonoDevelop.Base/Gui/Pads/ProjectBrowser/BrowserNode/ProjectBrowserNode.cs
===================================================================
--- Core/src/MonoDevelop.Base/Gui/Pads/ProjectBrowser/BrowserNode/ProjectBrowserNode.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Gui/Pads/ProjectBrowser/BrowserNode/ProjectBrowserNode.cs (working copy)
@@ -26,9 +26,9 @@
public class ProjectBrowserNode : AbstractBrowserNode
{
readonly static string defaultContextMenuPath = "/SharpDevelop/Views/ProjectBrowser/ContextMenu/ProjectBrowserNode";
- IProject project;
+ Project project;
- public override IProject Project {
+ public override Project Project {
get {
return project;
}
@@ -67,22 +67,22 @@
}
*/
- public ProjectBrowserNode(IProject project)
+ public ProjectBrowserNode(Project project)
{
UserData = project;
this.project = project;
Text = project.Name;
contextmenuAddinTreePath = defaultContextMenuPath;
- project.NameChanged += new EventHandler(ProjectNameChanged);
+ project.NameChanged += new CombineEntryRenamedEventHandler (ProjectNameChanged);
}
public override void Dispose()
{
base.Dispose();
- project.NameChanged -= new EventHandler(ProjectNameChanged);
+ project.NameChanged -= new CombineEntryRenamedEventHandler (ProjectNameChanged);
}
- void ProjectNameChanged(object sender, EventArgs e)
+ void ProjectNameChanged (object sender, CombineEntryRenamedEventArgs e)
{
Text = project.Name;
}
@@ -102,31 +102,19 @@
public override bool RemoveNode()
{
Combine cmb = Combine;
- IProject prj = project;
- CombineEntry removeEntry = null;
+ Project prj = project;
bool yes = Runtime.MessageService.AskQuestion (String.Format (GettextCatalog.GetString ("Do you really want to remove project {0} from solution {1}"), project.Name, cmb.Name));
if (!yes)
return false;
- // remove combineentry
- foreach (CombineEntry entry in cmb.Entries) {
- if (entry is ProjectCombineEntry) {
- if (((ProjectCombineEntry)entry).Project == prj) {
- removeEntry = entry;
- break;
- }
- }
- }
+ cmb.RemoveEntry (prj);
- Debug.Assert(removeEntry != null);
- cmb.RemoveEntry (removeEntry);
-
// remove execute definition
CombineExecuteDefinition removeExDef = null;
foreach (CombineExecuteDefinition exDef in cmb.CombineExecuteDefinitions) {
- if (exDef.Entry == removeEntry) {
+ if (exDef.Entry == prj) {
removeExDef = exDef;
}
}
@@ -135,7 +123,7 @@
// remove configuration
foreach (DictionaryEntry dentry in cmb.Configurations) {
- ((CombineConfiguration)dentry.Value).RemoveEntry(removeEntry);
+ ((CombineConfiguration)dentry.Value).RemoveEntry (prj);
}
CombineBrowserNode cbn = ((CombineBrowserNode)Parent);
Index: Core/src/MonoDevelop.Base/Gui/Pads/ProjectBrowser/BrowserNode/ReferenceNode.cs
===================================================================
--- Core/src/MonoDevelop.Base/Gui/Pads/ProjectBrowser/BrowserNode/ReferenceNode.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Gui/Pads/ProjectBrowser/BrowserNode/ReferenceNode.cs (working copy)
@@ -76,7 +76,7 @@
public override void ActivateItem()
{
if (userData != null && userData is ProjectReference)
- Runtime.FileService.OpenFile (((ProjectReference)userData).GetReferencedFileName(Project));
+ Runtime.FileService.OpenFile (((ProjectReference)userData).GetReferencedFileName());
}
/// <summary>
Index: Core/src/MonoDevelop.Base/Gui/Pads/ProjectBrowser/BrowserNode/FileNode.cs
===================================================================
--- Core/src/MonoDevelop.Base/Gui/Pads/ProjectBrowser/BrowserNode/FileNode.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Gui/Pads/ProjectBrowser/BrowserNode/FileNode.cs (working copy)
@@ -89,7 +89,7 @@
public override void ActivateItem()
{
if (userData != null && userData is ProjectFile)
- Runtime.FileService.OpenFile (((ProjectFile)userData).Name);
+ Runtime.FileService.OpenFile (((ProjectFile)userData).FilePath);
}
public override void AfterLabelEdit(string newName)
Index: Core/src/MonoDevelop.Base/Gui/Pads/ProjectBrowser/BrowserNode/CombineBrowserNode.cs
===================================================================
--- Core/src/MonoDevelop.Base/Gui/Pads/ProjectBrowser/BrowserNode/CombineBrowserNode.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Gui/Pads/ProjectBrowser/BrowserNode/CombineBrowserNode.cs (working copy)
@@ -44,7 +44,7 @@
Image = Stock.CombineIcon;
contextmenuAddinTreePath = defaultContextMenuPath;
- combine.NameChanged += new EventHandler(UpdateCombineName);
+ combine.NameChanged += new CombineEntryRenamedEventHandler (UpdateCombineName);
}
public override void BeforeLabelEdit()
@@ -57,7 +57,7 @@
if (newName != null && newName.Trim().Length > 0 && ContainsNoInvalidChars (newName)) {
combine.Name = newName;
}
- UpdateCombineName (null, EventArgs.Empty);
+ UpdateCombineName (null, null);
}
bool ContainsNoInvalidChars (string name)
@@ -71,11 +71,11 @@
public override void UpdateNaming()
{
- UpdateCombineName(this, EventArgs.Empty);
+ UpdateCombineName(this, null);
base.UpdateNaming();
}
- public void UpdateCombineName(object sender, EventArgs e)
+ public void UpdateCombineName (object sender, CombineEntryRenamedEventArgs e)
{
switch (combine.Entries.Count) {
case 0:
@@ -108,25 +108,12 @@
if (!yes)
return false;
- CombineEntry removeEntry = null;
+ cmbNode.Combine.RemoveEntry (Combine);
- // remove combineentry
- foreach (CombineEntry entry in cmbNode.Combine.Entries) {
- if (entry is CombineCombineEntry) {
- if (((CombineCombineEntry)entry).Combine == Combine) {
- removeEntry = entry;
- break;
- }
- }
- }
-
- Debug.Assert(removeEntry != null);
- cmbNode.Combine.RemoveEntry (removeEntry);
-
// remove execute definition
CombineExecuteDefinition removeExDef = null;
foreach (CombineExecuteDefinition exDef in cmbNode.Combine.CombineExecuteDefinitions) {
- if (exDef.Entry == removeEntry) {
+ if (exDef.Entry == Combine) {
removeExDef = exDef;
}
}
@@ -135,7 +122,7 @@
// remove configuration
foreach (DictionaryEntry dentry in cmbNode.Combine.Configurations) {
- ((CombineConfiguration)dentry.Value).RemoveEntry(removeEntry);
+ ((CombineConfiguration)dentry.Value).RemoveEntry (Combine);
}
cmbNode.UpdateNaming();
Index: Core/src/MonoDevelop.Base/Gui/Pads/ProjectBrowser/ProjectBrowserView.cs
===================================================================
--- Core/src/MonoDevelop.Base/Gui/Pads/ProjectBrowser/ProjectBrowserView.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Gui/Pads/ProjectBrowser/ProjectBrowserView.cs (working copy)
@@ -64,6 +64,7 @@
public void RedrawContent()
{
+ Runtime.DispatchService.AssertGuiThread ();
BeginUpdate();
AbstractBrowserNode.ShowExtensions = Runtime.Properties.GetProperty("MonoDevelop.Gui.ProjectBrowser.ShowExtensions", true);
foreach (AbstractBrowserNode node in Nodes) {
@@ -74,6 +75,7 @@
public ProjectBrowserView() : base (true, TreeNodeComparer.GtkProjectNode)
{
+ Runtime.DispatchService.AssertGuiThread ();
WorkbenchSingleton.Workbench.ActiveWorkbenchWindowChanged += new EventHandler(ActiveWindowChanged);
Runtime.ProjectService.CombineOpened += (CombineEventHandler) Runtime.DispatchService.GuiDispatch (new CombineEventHandler (OpenCombine));
@@ -96,7 +98,7 @@
}
}
- public void RefreshTree(Combine combine)
+ void RefreshTree (Combine combine)
{
DisposeProjectNodes();
Nodes.Clear();
@@ -198,7 +200,7 @@
if (node.UserData is ProjectFile && ((ProjectFile)node.UserData).Name == fileName) {
return node;
}
- if (node.UserData is ProjectReference && ((ProjectReference)node.UserData).GetReferencedFileName(node.Project) == fileName) {
+ if (node.UserData is ProjectReference && ((ProjectReference)node.UserData).GetReferencedFileName() == fileName) {
return node;
}
@@ -235,6 +237,7 @@
/// </summary>
public void StartLabelEdit()
{
+ Runtime.DispatchService.AssertGuiThread ();
AbstractBrowserNode selectedNode = (AbstractBrowserNode)SelectedNode;
CombineBrowserNode cbn = SelectedNode as CombineBrowserNode;
if (null != cbn)
@@ -261,6 +264,7 @@
/// </summary>
public void UpdateCombineTree()
{
+ Runtime.DispatchService.AssertGuiThread ();
XmlElement storedTree = new TreeViewMemento(this).ToXmlElement(new XmlDocument());
CloseCombine(this,new CombineEventArgs(Runtime.ProjectService.CurrentOpenCombine));
OpenCombine(this, new CombineEventArgs(Runtime.ProjectService.CurrentOpenCombine));
@@ -271,8 +275,9 @@
/// <summary>
/// This method builds a ProjectBrowserNode Tree out of a given combine.
/// </summary>
- public static AbstractBrowserNode BuildProjectTreeNode(IProject project)
+ public static AbstractBrowserNode BuildProjectTreeNode(Project project)
{
+ Runtime.DispatchService.AssertGuiThread ();
IProjectNodeBuilder[] nodeBuilders = (IProjectNodeBuilder[])(AddInTreeSingleton.AddInTree.GetTreeNode(nodeBuilderPath).BuildChildItems(null)).ToArray(typeof(IProjectNodeBuilder));
IProjectNodeBuilder projectNodeBuilder = null;
foreach (IProjectNodeBuilder nodeBuilder in nodeBuilders) {
@@ -293,15 +298,16 @@
/// </summary>
public static AbstractBrowserNode BuildCombineTreeNode(Combine combine)
{
+ Runtime.DispatchService.AssertGuiThread ();
CombineBrowserNode combineNode = new CombineBrowserNode(combine);
// build subtree
foreach (CombineEntry entry in combine.Entries) {
TreeNode node = null;
- if (entry.Entry is IProject) {
- node = BuildProjectTreeNode((IProject)entry.Entry);
+ if (entry is Project) {
+ node = BuildProjectTreeNode((Project)entry);
} else {
- node = BuildCombineTreeNode((Combine)entry.Entry);
+ node = BuildCombineTreeNode((Combine)entry);
}
combineNode.Nodes.Add (node);
}
@@ -498,6 +504,7 @@
public static void MoveCopyFile(string filename, AbstractBrowserNode node, bool move, bool alreadyInPlace)
{
+ Runtime.DispatchService.AssertGuiThread ();
// FileType type = FileUtility.GetFileType(filename);
bool directory = Runtime.FileUtilityService.IsDirectory(filename);
if (
@@ -562,9 +569,9 @@
ProjectFile fInfo;
if (newparent.Project.IsCompileable(newfilename)) {
- fInfo = Runtime.ProjectService.AddFileToProject(newparent.Project, newfilename, BuildAction.Compile);
+ fInfo = newparent.Project.AddFile (newfilename, BuildAction.Compile);
} else {
- fInfo = Runtime.ProjectService.AddFileToProject(newparent.Project, newfilename, BuildAction.Nothing);
+ fInfo = newparent.Project.AddFile (newfilename, BuildAction.Nothing);
}
AbstractBrowserNode pbn = new FileNode(fInfo);
Index: Core/src/MonoDevelop.Base/Gui/Pads/ProjectBrowser/NodeBuilder/IProjectNodeBuilder.cs
===================================================================
--- Core/src/MonoDevelop.Base/Gui/Pads/ProjectBrowser/NodeBuilder/IProjectNodeBuilder.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Gui/Pads/ProjectBrowser/NodeBuilder/IProjectNodeBuilder.cs (working copy)
@@ -19,7 +19,7 @@
{
public interface IProjectNodeBuilder
{
- bool CanBuildProjectTree(IProject project);
- AbstractBrowserNode BuildProjectTreeNode(IProject project);
+ bool CanBuildProjectTree(Project project);
+ AbstractBrowserNode BuildProjectTreeNode(Project project);
}
}
Index: Core/src/MonoDevelop.Base/Gui/Pads/ProjectBrowser/NodeBuilder/DefaultDotNetNodeBuilder.cs
===================================================================
--- Core/src/MonoDevelop.Base/Gui/Pads/ProjectBrowser/NodeBuilder/DefaultDotNetNodeBuilder.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Gui/Pads/ProjectBrowser/NodeBuilder/DefaultDotNetNodeBuilder.cs (working copy)
@@ -24,7 +24,7 @@
{
public class DefaultDotNetNodeBuilder : IProjectNodeBuilder
{
- public bool CanBuildProjectTree(IProject project)
+ public bool CanBuildProjectTree(Project project)
{
return true;
}
@@ -42,7 +42,7 @@
return false;
}
- public AbstractBrowserNode BuildProjectTreeNode(IProject project)
+ public AbstractBrowserNode BuildProjectTreeNode(Project project)
{
ProjectBrowserNode projectNode = new ProjectBrowserNode(project);
projectNode.Image = Runtime.Gui.Icons.GetImageForProjectType (project.ProjectType);
@@ -198,7 +198,7 @@
return projectNode;
}
- public static void AddProjectFileNode(IProject project, AbstractBrowserNode projectNode, ProjectFile projectFile) {
+ public static void AddProjectFileNode(Project project, AbstractBrowserNode projectNode, ProjectFile projectFile) {
if(projectNode.TreeView != null)
projectNode.TreeView.BeginUpdate();
@@ -413,7 +413,7 @@
return null;
}
- public static void InitializeReferences(AbstractBrowserNode parentNode, IProject project)
+ public static void InitializeReferences(AbstractBrowserNode parentNode, Project project)
{
parentNode.Nodes.Clear();
foreach (ProjectReference referenceInformation in project.ProjectReferences) {
Index: Core/src/MonoDevelop.Base/Gui/IProgressMonitor.cs
===================================================================
--- Core/src/MonoDevelop.Base/Gui/IProgressMonitor.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Gui/IProgressMonitor.cs (working copy)
@@ -17,6 +17,8 @@
void Worked (double work, string status);
+ void Pulse ();
+
void Done();
bool Canceled {
Index: Core/src/MonoDevelop.Base/Gui/AbstractViewContent.cs
===================================================================
--- Core/src/MonoDevelop.Base/Gui/AbstractViewContent.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Gui/AbstractViewContent.cs (working copy)
@@ -17,7 +17,7 @@
{
string untitledName = "";
string contentName = null;
- IProject project = null;
+ Project project = null;
bool isDirty = false;
bool isViewOnly = false;
@@ -106,7 +106,7 @@
{
}
- public IProject Project
+ public Project Project
{
get
{
Index: Core/src/MonoDevelop.Base/Base.glade
===================================================================
--- Core/src/MonoDevelop.Base/Base.glade (revision 2122)
+++ Core/src/MonoDevelop.Base/Base.glade (working copy)
@@ -4599,4 +4599,568 @@
</child>
</widget>
+<widget class="GtkWindow" id="OutputOptionsPanel">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">OutputOptionsPanel</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+
+ <child>
+ <widget class="GtkVBox" id="vbox66">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkVBox" id="vbox67">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label93">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><b>Output</b></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox57">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label91">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox69">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkTable" id="table10">
+ <property name="visible">True</property>
+ <property name="n_rows">3</property>
+ <property name="n_columns">3</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label98">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Assembly _name</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">assemblyNameEntry</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label99">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Output _path</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">outputDirectoryEntry</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label100">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Paramet_ers</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">parametersEntry</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkEntry" id="outputDirectoryEntry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="browseButton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">...</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkEntry" id="assemblyNameEntry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkEntry" id="parametersEntry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="pauseConsoleOutputCheckButton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Pause _console output</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox68">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label94">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><b>Execute scripts </b></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox58">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label92">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkTable" id="table9">
+ <property name="visible">True</property>
+ <property name="n_rows">3</property>
+ <property name="n_columns">3</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label95">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Execute Command</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label96">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_After Build</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">executeAfterEntry</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label97">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Before build</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">executeBeforeEntry</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkEntry" id="executeScriptEntry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkEntry" id="executeAfterEntry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkEntry" id="executeBeforeEntry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="browseButton2">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">...</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="browseButton3">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">...</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="browseButton4">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">...</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
</glade-interface>
Index: Core/src/MonoDevelop.Base/ChangeLog
===================================================================
--- Core/src/MonoDevelop.Base/ChangeLog (revision 2122)
+++ Core/src/MonoDevelop.Base/ChangeLog (working copy)
@@ -1,3 +1,71 @@
+2005-01-11 Lluis Sanchez Gual <lluis@novell.com>
+
+ * Services/Project/DefaultProjectService.cs: Added support for custom
+ file formats and project types.
+
+ * Gui/Dialogs/OptionPanels/ProjectOptions/OutputOptionsPanel.cs:
+ * Base.glade: Moved here the OutputOptionsPanel dialog from the c#
+ binding.
+
+ * Internal/Codons/LanguageBinding/ILanguageBinding.cs: Moved some methods
+ to the new IProjectBinding interface, since they are language independent.
+ Actually, ILanguageBinding is now a "dot net language binding". Support for
+ non-.net languages should be implemented by extending IProjectBinding.
+
+ * Internal/Project/Project/AbstractProjectConfiguration.cs: Moved some
+ properties to the new DotNetProjectConfiguration, and added some others
+ from the language bindings.
+
+ * Internal/Project/Project/AbstractProject.cs: The IProject interface
+ is not used anymore. All serialization code has been removed and
+ reimplemented in PrjxFileFormat. Some methods have been moved to the
+ new base class CombineEntry, and some others to the DotNetProject
+ subclass.
+
+ * Internal/Project/Combine/Combine.cs: It is now a subclass of
+ CombineEntry. All serialization code has been removed and
+ reimplemented in CmbxFileFormat. The class interface has been simplified.
+
+ * Internal/Project/Combine/CombineEntry.cs: It is now the base class
+ for Combine and Project. Some common properties have been factorized
+ here.
+
+ * Internal/Templates/ProjectTemplates/ProjectTemplate.cs: LanguageName
+ is optional.
+ * Internal/Templates/ProjectTemplates/ProjectDescriptor.cs: Use the new
+ project type model.
+ * MonoDevelopCore.addin.xml: Added extension path for project types.
+
+ * Services/Project/FileFormatManager.cs: New file. Class that allows
+ to register new types of combine entry files.
+ * Internal/Conditions/LanguageActiveCondition.cs: New file. Condition
+ that checks the language of the current project.
+ * Internal/Codons/ProjectBinding/IProjectBinding.cs: New file.
+ Interface that represents a project binding.
+ * Internal/Codons/ProjectBinding/ProjectBindingCodon.cs: new codon for
+ project bindings.
+ * Internal/Project/Attributes/*: Removed. Equivalent funcionality is
+ now provided by MonoDevelop.Internal.Serialization.
+
+ * Internal/Project/IFileFormat.cs: Base interface for file format
+ implementations.
+ * Internal/Project/PrjxFileFormat.cs: Implements serialization into the
+ prjx file format.
+ * Internal/Project/CmbxFileFormat.cs: Implements serialization into the
+ cmbx file format.
+
+ * Internal/Project/Project/DotNetProject.cs:
+ * Internal/Project/Project/DotNetProjectBinding.cs:
+ * Internal/Project/Project/DotNetProjectConfiguration.cs: A basic .net
+ project implementation.
+
+ * Internal/Project/Project/IProject.cs: Removed. Not needed anymore.
+ * Internal/Project/Combine/CombineEntryRenamedEventArgs.cs: New file.
+
+ * Internal/Serialization/*: A generic data serializer.
+
+ * Other files: Follow architecture changes.
+
2004-01-03 Todd Berman <tberman@off.net>
* Commands/RunCommands.cs:
Index: Core/src/MonoDevelop.Base/Makefile.am
===================================================================
--- Core/src/MonoDevelop.Base/Makefile.am (revision 2122)
+++ Core/src/MonoDevelop.Base/Makefile.am (working copy)
@@ -72,6 +72,7 @@
Gui/Dialogs/OptionPanels/ProjectOptions/CompileFileProjectOptions.cs \
Gui/Dialogs/OptionPanels/ProjectOptions/DeployFileOptions.cs \
Gui/Dialogs/OptionPanels/ProjectOptions/GeneralProjectOptions.cs \
+Gui/Dialogs/OptionPanels/ProjectOptions/OutputOptionsPanel.cs \
Gui/Dialogs/OptionPanels/IDEOptions/BuildPanel.cs \
Gui/Dialogs/OptionPanels/IDEOptions/LoadSavePanel.cs \
Gui/Dialogs/OptionPanels/IDEOptions/SelectStylePanel.cs \
@@ -195,6 +196,7 @@
Services/Project/DefaultProjectService.cs \
Services/Project/ParseInformationEventHandler.cs \
Services/Project/CombineEventArgs.cs \
+Services/Project/FileFormatManager.cs \
Services/IconService.cs \
Services/StatusBar/DefaultStatusBarService.cs \
Services/StatusBar/IStatusBarService.cs \
@@ -229,6 +231,7 @@
Internal/Undo/IUndoableOperation.cs \
Internal/Undo/UndoStack.cs \
Internal/Undo/UndoQueue.cs \
+Internal/Conditions/LanguageActiveCondition.cs \
Internal/Conditions/OwnerStateCondition.cs \
Internal/Conditions/ProjectActiveCondition.cs \
Internal/Conditions/WindowActiveCondition.cs \
@@ -244,6 +247,8 @@
Internal/Codons/LanguageBinding/ILanguageBinding.cs \
Internal/Codons/LanguageBinding/LanguageBindingCodon.cs \
Internal/Codons/LanguageBinding/DefaultCompilerResult.cs \
+Internal/Codons/ProjectBinding/IProjectBinding.cs \
+Internal/Codons/ProjectBinding/ProjectBindingCodon.cs \
Internal/Codons/DefaultDialogPanelDescriptor.cs \
Internal/Codons/Toolbars/ToolbarItemCodon.cs \
Internal/Codons/IDialogPanel.cs \
@@ -334,10 +339,10 @@
Internal/Parser/IMethod.cs \
Internal/Parser/IComment.cs \
Internal/Parser/ICompilationUnit.cs \
-Internal/Project/Attributes/XmlNodeNameAttribute.cs \
-Internal/Project/Attributes/ConvertToRelativePathAttribute.cs \
-Internal/Project/Attributes/XmlSetAttribute.cs \
-Internal/Project/Attributes/XmlAttributeAttribute.cs \
+Internal/Project/PrjxFileFormat.cs \
+Internal/Project/CmbxFileFormat.cs \
+Internal/Project/IFileFormat.cs \
+Internal/Project/ProjectPathItemPropertyAttribute.cs \
Internal/Project/Project/Deployment/DeployInformation.cs \
Internal/Project/Project/Deployment/AssemblyDeploy.cs \
Internal/Project/Project/Deployment/ScriptDeploy.cs \
@@ -349,6 +354,9 @@
Internal/Project/Project/TypelibImporter.cs \
Internal/Project/Project/AbstractProjectConfiguration.cs \
Internal/Project/Project/AbstractProject.cs \
+Internal/Project/Project/DotNetProject.cs \
+Internal/Project/Project/DotNetProjectBinding.cs \
+Internal/Project/Project/DotNetProjectConfiguration.cs \
Internal/Project/Project/ProjectReference.cs \
Internal/Project/Project/ProjectReferenceEventArgs.cs \
Internal/Project/Project/ConvertXml.cs \
@@ -358,7 +366,6 @@
Internal/Project/Project/ProjectFile.cs \
Internal/Project/Project/ProjectFileEventArgs.cs \
Internal/Project/Project/AbstractConfiguration.cs \
-Internal/Project/Project/IProject.cs \
Internal/Project/Combine/Combine.cs \
Internal/Project/Combine/CombineExecuteDefinition.cs \
Internal/Project/Combine/CyclicBuildOrderException.cs \
@@ -366,6 +373,7 @@
Internal/Project/Combine/NoStartupCombineDefinedException.cs \
Internal/Project/Combine/CombineEntry.cs \
Internal/Project/Combine/CombineEntryEventArgs.cs \
+Internal/Project/Combine/CombineEntryRenamedEventArgs.cs \
Internal/Templates/FileDescriptionTemplate.cs \
Internal/Templates/CodeTemplate.cs \
Internal/Templates/CodeTemplateGroup.cs \
@@ -383,6 +391,29 @@
Internal/CollectionUtilities/Comparers.cs \
Internal/ExternalTool/ToolLoader.cs \
Internal/ExternalTool/ExternalTool.cs \
+Internal/Serialization/ArrayHandler.cs \
+Internal/Serialization/ArrayListHandler.cs \
+Internal/Serialization/ClassDataType.cs \
+Internal/Serialization/CollectionDataType.cs \
+Internal/Serialization/DataContext.cs \
+Internal/Serialization/DataNode.cs \
+Internal/Serialization/DataCollection.cs \
+Internal/Serialization/DataType.cs \
+Internal/Serialization/DataIncludeAttribute.cs \
+Internal/Serialization/DataItem.cs \
+Internal/Serialization/DataItemAttribute.cs \
+Internal/Serialization/DataValue.cs \
+Internal/Serialization/GenericCollectionHandler.cs \
+Internal/Serialization/IExtendedDataItem.cs \
+Internal/Serialization/ICollectionHandler.cs \
+Internal/Serialization/ExpandedCollectionAttribute.cs \
+Internal/Serialization/ItemProperty.cs \
+Internal/Serialization/ItemPropertyAttribute.cs \
+Internal/Serialization/SerializationContext.cs \
+Internal/Serialization/EnumDataType.cs \
+Internal/Serialization/PrimitiveDataType.cs \
+Internal/Serialization/XmlDataSerializer.cs \
+Internal/Serialization/DataSerializer.cs \
AssemblyInfo.cs
OPTIONS = \
Index: Core/src/MonoDevelop.Base/Internal/Codons/ProjectBinding/ProjectBindingCodon.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Codons/ProjectBinding/ProjectBindingCodon.cs (revision 0)
+++ Core/src/MonoDevelop.Base/Internal/Codons/ProjectBinding/ProjectBindingCodon.cs (revision 0)
@@ -0,0 +1,27 @@
+
+using System;
+using System.Collections;
+using System.Diagnostics;
+
+using MonoDevelop.Core.AddIns.Conditions;
+using MonoDevelop.Internal.Project;
+
+namespace MonoDevelop.Core.AddIns.Codons
+{
+ [CodonNameAttribute("ProjectBinding")]
+ public class ProjectBindingCodon : AbstractCodon
+ {
+ IProjectBinding projectBinding;
+
+ public IProjectBinding ProjectBinding {
+ get { return projectBinding; }
+ }
+
+ public override object BuildItem(object owner, ArrayList subItems, ConditionCollection conditions)
+ {
+ Debug.Assert(Class != null && Class.Length > 0);
+ projectBinding = (IProjectBinding) AddIn.CreateObject (Class);
+ return this;
+ }
+ }
+}
Index: Core/src/MonoDevelop.Base/Internal/Codons/ProjectBinding/IProjectBinding.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Codons/ProjectBinding/IProjectBinding.cs (revision 0)
+++ Core/src/MonoDevelop.Base/Internal/Codons/ProjectBinding/IProjectBinding.cs (revision 0)
@@ -0,0 +1,37 @@
+
+using System;
+using System.Collections;
+using System.Xml;
+
+using MonoDevelop.Internal.Templates;
+using MonoDevelop.Gui;
+
+namespace MonoDevelop.Internal.Project
+{
+ public interface IProjectBinding
+ {
+ /// <remarks>
+ /// Returns the project type name
+ /// </remarks>
+ string Name { get; }
+
+ /// <remarks>
+ /// Creates a Project out of the given ProjetCreateInformation object.
+ /// Each project binding must provide a representation of the project
+ /// it 'controls'.
+ /// </remarks>
+ Project CreateProject (ProjectCreateInformation info, XmlElement projectOptions);
+
+ /// <remarks>
+ /// Creates a Project for a single source file. If the file is not
+ /// valid for this project type, it must return null.
+ /// </remarks>
+ Project CreateSingleFileProject (string sourceFile);
+
+ /// <remarks>
+ /// Returns a list of autogenerated templates that can be used to
+ /// create projects of this type
+ /// </remarks>
+ ProjectTemplate[] GetDefaultTemplates ();
+ }
+}
Index: Core/src/MonoDevelop.Base/Internal/Codons/LanguageBinding/ILanguageBinding.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Codons/LanguageBinding/ILanguageBinding.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Internal/Codons/LanguageBinding/ILanguageBinding.cs (working copy)
@@ -10,6 +10,7 @@
using System.Xml;
using MonoDevelop.Internal.Templates;
+using MonoDevelop.Internal.Project;
using MonoDevelop.Gui;
namespace MonoDevelop.Internal.Project
@@ -27,45 +28,18 @@
get;
}
- /// <summary>
- /// This function executes a file, the filename is given by filename,
- /// the file was compiled by the compiler object before.
- /// </summary>
- void Execute(string fileName);
-
- void DebugProject (IProject project);
-
- /// <summary>
- /// This function executes a project, the project is given as a parameter,
- /// the project was compiled by the compiler object before.
- /// </summary>
- void Execute(IProject project);
-
- string GetCompiledOutputName(string fileName);
-
- string GetCompiledOutputName(IProject project);
-
/// <returns>
/// True, if this language binding can compile >fileName<
/// </returns>
bool CanCompile(string fileName);
- ICompilerResult CompileFile(string fileName);
+ ICompilerResult Compile (ProjectFileCollection projectFiles, ProjectReferenceCollection references, DotNetProjectConfiguration configuration);
- ICompilerResult CompileProject(IProject project);
+ void GenerateMakefile (Project project, Combine parentCombine);
- ICompilerResult RecompileProject(IProject project);
+ object CreateCompilationParameters (XmlElement projectOptions);
- void GenerateMakefile (IProject project, Combine parentCombine);
-
/// <summary>
- /// Creates a IProject out of the given ProjetCreateInformation object.
- /// Each language binding must provide a representation of the project
- /// it 'controls'.
- /// </summary>
- IProject CreateProject(ProjectCreateInformation info, XmlElement projectOptions);
-
- /// <summary>
/// Used by Comment and Uncomment operations and by Centaurus Addin.
/// </summary>
string CommentTag { get; }
Index: Core/src/MonoDevelop.Base/Internal/Project/ProjectPathItemPropertyAttribute.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Project/ProjectPathItemPropertyAttribute.cs (revision 0)
+++ Core/src/MonoDevelop.Base/Internal/Project/ProjectPathItemPropertyAttribute.cs (revision 0)
@@ -0,0 +1,48 @@
+// <file>
+// <owner name="Lluis Sanchez" email="lluis@novell.com"/>
+// <version value="$version"/>
+// </file>
+
+using System;
+using System.IO;
+using MonoDevelop.Internal.Serialization;
+using MonoDevelop.Services;
+
+namespace MonoDevelop.Internal.Project
+{
+ public class ProjectPathItemProperty: ItemPropertyAttribute
+ {
+ public ProjectPathItemProperty ()
+ {
+ SerializationDataType = typeof (PathDataType);
+ }
+
+ public ProjectPathItemProperty (string name): base (name)
+ {
+ SerializationDataType = typeof (PathDataType);
+ }
+ }
+
+ public class PathDataType: PrimitiveDataType
+ {
+ public PathDataType (Type type): base (type)
+ {
+ }
+
+ public override DataNode Serialize (SerializationContext serCtx, object mapData, object value)
+ {
+ if (value == null || ((string)value).Length == 0) return null;
+ string basePath = Path.GetDirectoryName (serCtx.BaseFile);
+ string file = Runtime.FileUtilityService.AbsoluteToRelativePath (basePath, value.ToString ());
+ return new DataValue (Name, file);
+ }
+
+ public override object Deserialize (SerializationContext serCtx, object mapData, DataNode data)
+ {
+ string basePath = Path.GetDirectoryName (serCtx.BaseFile);
+ return Runtime.FileUtilityService.RelativeToAbsolutePath (basePath, ((DataValue)data).Value);
+ }
+ }
+}
+
+
Index: Core/src/MonoDevelop.Base/Internal/Project/PrjxFileFormat.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Project/PrjxFileFormat.cs (revision 0)
+++ Core/src/MonoDevelop.Base/Internal/Project/PrjxFileFormat.cs (revision 0)
@@ -0,0 +1,171 @@
+// <file>
+// <owner name="Lluis Sanchez" email="lluis@novell.com"/>
+// <version value="$version"/>
+// </file>
+
+using System;
+using System.IO;
+using System.Xml;
+using MonoDevelop.Internal.Serialization;
+using MonoDevelop.Services;
+
+namespace MonoDevelop.Internal.Project
+{
+ public class PrjxFileFormat: IFileFormat
+ {
+ public void WriteFile (string file, object node)
+ {
+ Project project = node as Project;
+ if (project == null)
+ throw new InvalidOperationException ("The provided object is not a Project");
+
+ if (!file.EndsWith("2")) file += "2";
+ StreamWriter sw = new StreamWriter (file);
+ try {
+ XmlDataSerializer ser = new XmlDataSerializer (Runtime.ProjectService.DataContext);
+ ser.SerializationContext.BaseFile = file;
+ ser.Serialize (sw, project, typeof(Project));
+ } finally {
+ sw.Close ();
+ }
+ }
+
+ public object ReadFile (string fileName)
+ {
+ XmlTextReader reader = new XmlTextReader (new StreamReader (fileName));
+ reader.MoveToContent ();
+
+ string version = reader.GetAttribute ("version");
+ if (version == null) version = reader.GetAttribute ("fileversion");
+
+ DataSerializer serializer = new DataSerializer (Runtime.ProjectService.DataContext, fileName);
+ IProjectReader projectReader = null;
+
+ if (version == "1.0") {
+ string tempFile = Path.GetTempFileName();
+ Runtime.MessageService.ShowMessage(String.Format ("Old project file format found.\n It will be automatically converted to the current format"));
+
+ ConvertXml.Convert(fileName,
+ Runtime.Properties.DataDirectory + Path.DirectorySeparatorChar +
+ "ConversionStyleSheets" + Path.DirectorySeparatorChar +
+ "ConvertPrjx10to11.xsl",
+ tempFile);
+ reader.Close ();
+ StreamReader sr = new StreamReader (tempFile);
+ string fdata = sr.ReadToEnd ();
+ sr.Close ();
+ File.Delete (tempFile);
+ reader = new XmlTextReader (new StringReader (fdata));
+ projectReader = new ProjectReaderV1 (serializer);
+ }
+ else if (version == "1.1") {
+ projectReader = new ProjectReaderV1 (serializer);
+ }
+ else if (version == "2.0") {
+ projectReader = new ProjectReaderV2 (serializer);
+ }
+
+ try {
+ if (projectReader != null)
+ return projectReader.ReadProject (reader);
+ else
+ throw new UnknownProjectVersionException (version);
+ } finally {
+ reader.Close ();
+ }
+ }
+ }
+
+ interface IProjectReader {
+ Project ReadProject (XmlReader reader);
+ }
+
+ class ProjectReaderV1: XmlConfigurationReader, IProjectReader
+ {
+ DotNetProject project;
+ string file;
+ DataSerializer serializer;
+
+ static string [] changes = new string [] {
+ "Output/executeScript", "Execution","executeScript",
+ "Output/executeBeforeBuild", "Build","executeBeforeBuild",
+ "Output/executeAfterBuild", "Build","executeAfterBuild",
+ "runwithwarnings", "Execution","runwithwarnings",
+ "CodeGeneration/runtime", "Execution","runtime",
+ "CodeGeneration/includedebuginformation", "Build","debugmode",
+ "CodeGeneration/target", "Build","target",
+ "CompilerOptions/compilationTarget", "Build","target",
+ "CompilerOptions/includeDebugInformation", "Build","debugmode"
+ };
+
+ public ProjectReaderV1 (DataSerializer serializer)
+ {
+ this.serializer = serializer;
+ this.file = serializer.SerializationContext.BaseFile;
+ }
+
+ public Project ReadProject (XmlReader reader)
+ {
+ string langName = reader.GetAttribute ("projecttype");
+ project = new DotNetProject (langName);
+ project.FileName = file;
+ DataItem data = (DataItem) Read (reader);
+ serializer.Deserialize (project, data);
+ return project;
+ }
+
+ protected override DataNode ReadChild (XmlReader reader, DataItem parent)
+ {
+ if (reader.LocalName == "Configurations")
+ {
+ ILanguageBinding binding = Runtime.Languages.GetBindingPerLanguageName (project.LanguageName);
+ object confObj = binding.CreateCompilationParameters (null);
+ Type confType = confObj.GetType ();
+ DataContext prjContext = Runtime.ProjectService.DataContext;
+
+ DataItem item = base.ReadChild (reader, parent) as DataItem;
+ foreach (DataNode data in item.ItemData) {
+ DataItem conf = data as DataItem;
+ if (conf == null) continue;
+ prjContext.SetTypeInfo (conf, typeof(DotNetProjectConfiguration));
+ DataItem codeGeneration = conf ["CodeGeneration"] as DataItem;
+ if (codeGeneration != null)
+ prjContext.SetTypeInfo (codeGeneration, confType);
+ Transform (conf);
+ }
+ return item;
+ }
+ return base.ReadChild (reader, parent);
+ }
+
+ void Transform (DataItem conf)
+ {
+ for (int n=0; n<changes.Length; n+=3) {
+ DataNode data = conf.ItemData.Extract (changes[n]);
+ if (data != null) {
+ data.Name = changes [n+2];
+ conf.ItemData.Add (data, changes[n+1]);
+ }
+ }
+ }
+ }
+
+
+ class ProjectReaderV2: XmlConfigurationReader, IProjectReader
+ {
+ DataSerializer serializer;
+
+ public ProjectReaderV2 (DataSerializer serializer)
+ {
+ this.serializer = serializer;
+ }
+
+ public Project ReadProject (XmlReader reader)
+ {
+ DataNode data = Read (reader);
+ Project project = (Project) serializer.Deserialize (typeof(Project), data);
+ project.FileName = serializer.SerializationContext.BaseFile;
+ return project;
+ }
+ }
+}
Index: Core/src/MonoDevelop.Base/Internal/Project/IFileFormat.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Project/IFileFormat.cs (revision 0)
+++ Core/src/MonoDevelop.Base/Internal/Project/IFileFormat.cs (revision 0)
@@ -0,0 +1,11 @@
+
+using System;
+
+namespace MonoDevelop.Internal.Project
+{
+ public interface IFileFormat
+ {
+ void WriteFile (string file, object obj);
+ object ReadFile (string file);
+ }
+}
Index: Core/src/MonoDevelop.Base/Internal/Project/Attributes/XmlNodeNameAttribute.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Project/Attributes/XmlNodeNameAttribute.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Internal/Project/Attributes/XmlNodeNameAttribute.cs (working copy)
@@ -1,40 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version value="$version"/>
-// </file>
-
-using System;
-using System.Reflection;
-
-namespace MonoDevelop.Internal.Project
-{
- /// <summary>
- /// </summary>
- [AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = false)]
- public class XmlNodeNameAttribute : Attribute
- {
- string name;
-
- /// <summary>
- /// Creates a new instance.
- /// </summary>
- public XmlNodeNameAttribute(string name)
- {
- this.name = name;
- }
-
- /// <summary>
- /// Returns the name of the xmlnameattribute.
- /// </summary>
- public string Name {
- get {
- return name;
- }
- set {
- name = value;
- }
- }
- }
-}
Index: Core/src/MonoDevelop.Base/Internal/Project/Attributes/XmlSetAttribute.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Project/Attributes/XmlSetAttribute.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Internal/Project/Attributes/XmlSetAttribute.cs (working copy)
@@ -1,61 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version value="$version"/>
-// </file>
-
-using System;
-using System.Reflection;
-
-namespace MonoDevelop.Internal.Project
-{
- /// <summary>
- /// Indicates that field should be treated as a xml attribute for the codon or condition.
- /// The field is treated as a array, separated by ',' example :
- /// fileextensions = ".cpp,.cc,.C"
- /// </summary>
- [AttributeUsage(AttributeTargets.Field, Inherited=true, AllowMultiple = false)]
- public class XmlSetAttribute : Attribute
- {
- string name = null;
- Type type = null;
-
- /// <summary>
- /// Constructs a new instance.
- /// </summary>
- public XmlSetAttribute(Type type)
- {
- this.type = type;
- }
-
- public XmlSetAttribute(Type type, string name) : this(type)
- {
- this.name = name;
- }
-
- /// <summary>
- /// The name of the attribute.
- /// </summary>
- public string Name {
- get {
- return name;
- }
- set {
- name = value;
- }
- }
-
- /// <summary>
- /// The typ of the set
- /// </summary>
- public Type Type {
- get {
- return type;
- }
- set {
- type = value;
- }
- }
- }
-}
Index: Core/src/MonoDevelop.Base/Internal/Project/Attributes/ConvertToRelativePathAttribute.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Project/Attributes/ConvertToRelativePathAttribute.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Internal/Project/Attributes/ConvertToRelativePathAttribute.cs (working copy)
@@ -1,45 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version value="$version"/>
-// </file>
-
-using System;
-using System.Reflection;
-
-namespace MonoDevelop.Internal.Project
-{
- /// <summary>
- /// Indicates that field value is a file or directory which should be saved
- /// relative to the project file location.
- /// </summary>
- [AttributeUsage(AttributeTargets.Field, Inherited=true, AllowMultiple = false)]
- public class ConvertToRelativePathAttribute : Attribute
- {
- string predicatePropertyName;
-
- public ConvertToRelativePathAttribute()
- {
- }
-
- public ConvertToRelativePathAttribute(string predicatePropertyName)
- {
- this.predicatePropertyName = predicatePropertyName;
- }
-
- /// <summary>
- /// Gets the predicate property name. A predicate property is a property
- /// which returns a bool, it indicates that the path should be converted, or not
- /// (depending on the value of the property)
- /// <summary>
- public string PredicatePropertyName {
- get {
- return predicatePropertyName;
- }
- set {
- predicatePropertyName = value;
- }
- }
- }
-}
Index: Core/src/MonoDevelop.Base/Internal/Project/Attributes/XmlAttributeAttribute.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Project/Attributes/XmlAttributeAttribute.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Internal/Project/Attributes/XmlAttributeAttribute.cs (working copy)
@@ -1,40 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version value="$version"/>
-// </file>
-using System;
-using System.Reflection;
-
-namespace MonoDevelop.Internal.Project
-{
- /// <summary>
- /// Indicates that field should be treated as a xml attribute
- /// </summary>
- [AttributeUsage(AttributeTargets.Field, Inherited=true, AllowMultiple = false)]
- public class XmlAttributeAttribute : Attribute
- {
- string name;
-
- /// <summary>
- /// Constructs a new instance.
- /// </summary>
- public XmlAttributeAttribute(string name)
- {
- this.name = name;
- }
-
- /// <summary>
- /// The name of the attribute.
- /// </summary>
- public string Name {
- get {
- return name;
- }
- set {
- name = value;
- }
- }
- }
-}
Index: Core/src/MonoDevelop.Base/Internal/Project/Project/DotNetProjectConfiguration.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Project/Project/DotNetProjectConfiguration.cs (revision 0)
+++ Core/src/MonoDevelop.Base/Internal/Project/Project/DotNetProjectConfiguration.cs (revision 0)
@@ -0,0 +1,59 @@
+
+using System;
+using System.IO;
+using MonoDevelop.Internal.Serialization;
+
+namespace MonoDevelop.Internal.Project
+{
+ public enum NetRuntime {
+ Mono,
+ MonoInterpreter,
+ MsNet
+ };
+
+ public enum CompileTarget {
+ Exe,
+ Library,
+ WinExe,
+ Module
+ };
+
+ public class DotNetProjectConfiguration: AbstractProjectConfiguration
+ {
+ [ItemProperty ("Output/assembly")]
+ string assembly = "a";
+
+ [ItemProperty ("Execution/runtime")]
+ NetRuntime netRuntime = NetRuntime.MsNet;
+
+ [ItemProperty ("Build/target")]
+ CompileTarget compiletarget = CompileTarget.Exe;
+
+ [ItemProperty ("CodeGeneration")]
+ object compilationParameters;
+
+ public virtual string OutputAssembly {
+ get { return assembly; }
+ set { assembly = value; }
+ }
+
+ public NetRuntime NetRuntime {
+ get { return netRuntime; }
+ set { netRuntime = value; }
+ }
+
+ public CompileTarget CompileTarget {
+ get { return compiletarget; }
+ set { compiletarget = value; }
+ }
+
+ public object CompilationParameters {
+ get { return compilationParameters; }
+ set { compilationParameters = value; }
+ }
+
+ public string CompiledOutputName {
+ get { return Path.Combine (Path.Combine (OutputDirectory, OutputAssembly), (CompileTarget == CompileTarget.Library ? ".dll" : ".exe")); }
+ }
+ }
+}
Index: Core/src/MonoDevelop.Base/Internal/Project/Project/Deployment/IDeploymentStrategy.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Project/Project/Deployment/IDeploymentStrategy.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Internal/Project/Project/Deployment/IDeploymentStrategy.cs (working copy)
@@ -9,7 +9,7 @@
{
public interface IDeploymentStrategy
{
- void DeployProject(IProject project);
+ void DeployProject(Project project);
}
}
Index: Core/src/MonoDevelop.Base/Internal/Project/Project/Deployment/AssemblyDeploy.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Project/Project/Deployment/AssemblyDeploy.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Internal/Project/Project/Deployment/AssemblyDeploy.cs (working copy)
@@ -21,24 +21,17 @@
".dll"
};
- public void DeployProject(IProject project)
+ public void DeployProject(Project project)
{
if (project.DeployInformation.DeployTarget.Length == 0) {
Runtime.MessageService.ShowError(GettextCatalog.GetString ("Can't deploy: no deployment target set"));
return;
}
try {
- AbstractProjectConfiguration config = (AbstractProjectConfiguration)project.ActiveConfiguration;
- FileUtilityService fileUtilityService = Runtime.FileUtilityService;
- string assembly = fileUtilityService.GetDirectoryNameWithSeparator(config.OutputDirectory) + config.OutputAssembly;
-
- foreach (string ext in extensions) {
- if (File.Exists(assembly + ext)) {
- File.Copy(assembly + ext, fileUtilityService.GetDirectoryNameWithSeparator(project.DeployInformation.DeployTarget) + config.OutputAssembly + ext, true);
- return;
- }
- }
- throw new Exception("Assembly not found.");
+ if (File.Exists (project.GetOutputFileName ()))
+ File.Copy (project.GetOutputFileName (), Path.GetFileName (project.GetOutputFileName ()), true);
+ else
+ throw new Exception("Assembly not found.");
} catch (Exception e) {
Runtime.MessageService.ShowError(e);
}
Index: Core/src/MonoDevelop.Base/Internal/Project/Project/Deployment/FileDeploy.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Project/Project/Deployment/FileDeploy.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Internal/Project/Project/Deployment/FileDeploy.cs (working copy)
@@ -16,7 +16,7 @@
{
public class FileDeploy : IDeploymentStrategy
{
- public void DeployProject(IProject project)
+ public void DeployProject(Project project)
{
if (project.DeployInformation.DeployTarget.Length == 0) {
Runtime.MessageService.ShowError(GettextCatalog.GetString ("Can't deploy: you forgot to specify a deployment script"));
Index: Core/src/MonoDevelop.Base/Internal/Project/Project/Deployment/ScriptDeploy.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Project/Project/Deployment/ScriptDeploy.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Internal/Project/Project/Deployment/ScriptDeploy.cs (working copy)
@@ -16,7 +16,7 @@
{
public class ScriptDeploy : IDeploymentStrategy
{
- public void DeployProject(IProject project)
+ public void DeployProject(Project project)
{
if (project.DeployInformation.DeployScript.Length == 0) {
Runtime.MessageService.ShowError(GettextCatalog.GetString ("Can't deploy: you forgot to specify a deployment script"));
Index: Core/src/MonoDevelop.Base/Internal/Project/Project/Deployment/DeployInformation.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Project/Project/Deployment/DeployInformation.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Internal/Project/Project/Deployment/DeployInformation.cs (working copy)
@@ -10,6 +10,7 @@
using System.IO;
using System.Xml;
+using MonoDevelop.Internal.Serialization;
using MonoDevelop.Internal.Project;
namespace MonoDevelop.Internal.Project
@@ -20,14 +21,13 @@
File
}
- [XmlNodeName("DeploymentInformation")]
+ [DataItem ("DeploymentInformation")]
public class DeployInformation
{
- [XmlNodeName("Exclude")]
+ [DataItem ("Exclude")]
class ExcludeFile
{
- [XmlAttribute("file")]
- [ConvertToRelativePathAttribute()]
+ [ProjectPathItemProperty ("file")]
protected string fileName;
public string FileName {
@@ -49,16 +49,17 @@
}
}
- [XmlSetAttribute(typeof(ExcludeFile))]
+ [ItemProperty]
+ [ItemProperty ("ExcludeFile", ValueType = typeof(ExcludeFile), Scope = 1)]
ArrayList excludeFiles = new ArrayList();
- [XmlAttribute("target")]
- string deployTarget = "";
+ [ItemProperty ("target", DefaultValue = "")]
+ string deployTarget = "";
- [XmlAttribute("script")]
- string deployScript = "";
+ [ItemProperty ("script", DefaultValue = "")]
+ string deployScript = "";
- [XmlAttribute("strategy")]
+ [ItemProperty ("strategy")]
DeploymentStrategy deploymentStrategy = DeploymentStrategy.File;
public DeploymentStrategy DeploymentStrategy {
@@ -131,7 +132,7 @@
{
}
- public static void Deploy(IProject project)
+ public static void Deploy(Project project)
{
switch (project.DeployInformation.DeploymentStrategy) {
case DeploymentStrategy.File:
Index: Core/src/MonoDevelop.Base/Internal/Project/Project/IProject.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Project/Project/IProject.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Internal/Project/Project/IProject.cs (working copy)
@@ -1,165 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version value="$version"/>
-// </file>
-
-using System;
-using System.Collections;
-using System.Xml;
-using MonoDevelop.Internal.Project.Collections;
-
-namespace MonoDevelop.Internal.Project
-{
- public enum NewFileSearch {
- None,
- OnLoad,
- OnLoadAutoInsert
- }
-
- /// <summary>
- /// This interface describes the whole functionalaty a SharpDevelop project has.
- /// </summary>
- public interface IProject : IDisposable
- {
- /// <summary>
- /// Returns the language codon name, which is used
- /// to compile this project.
- /// </summary>
- string ProjectType {
- get;
- }
-
- /// <summary>
- /// Gets the directory where the projectfile is located.
- /// </summary>
- string BaseDirectory {
- get;
- }
-
- /// <summary>
- /// The name of the project.
- /// </summary>
- string Name {
- get;
- set;
- }
-
- /// <summary>
- /// The description of the project.
- /// </summary>
- string Description {
- get;
- set;
- }
-
- /// <summary>
- /// Gets/Sets the active configuration.
- /// </summary>
- IConfiguration ActiveConfiguration {
- get;
- set;
- }
-
- /// <summary>
- /// Gets the arraylist which contains all project configurations.
- /// </summary>
- ArrayList Configurations {
- get;
- }
-
- /// <summary>
- /// A collection containing all files & empty directories in the project.
- /// </summary>
- ProjectFileCollection ProjectFiles {
- get;
- }
-
- /// <summary>
- /// A collection containing all references in the project.
- /// </summary>
- ProjectReferenceCollection ProjectReferences {
- get;
- }
-
- /// <summary>
- /// The method on how newly found files (files which are in the project subdir
- /// but not in the project) are handled.
- /// </summary>
- NewFileSearch NewFileSearch {
- get;
- set;
- }
-
- /// <summary>
- /// If this property is true the state of the workbench (open files, project/class scout
- /// state) should be made persistent
- /// </summary>
- bool EnableViewState {
- get;
- set;
- }
-
-
- DeployInformation DeployInformation {
- get;
- }
-
- /// <summary>
- /// Returns true, if the language module which defined this project is able
- /// to compile the file 'fileName'. e.g. returns true, if the file fileName
- /// could be added as compileable file to the project.
- /// </summary>
- bool IsCompileable(string fileName);
-
- /// <summary>
- /// Loads this Project from fileName
- /// </summary>
- void LoadProject(string fileName);
-
- /// <summary>
- /// Saves this Project under fileName
- /// </summary>
- void SaveProject(string fileName);
-
- /// <summary>
- /// Copies all references to the bin path of this project
- /// </summary>
- /// <param name="force">
- /// if set to true all files are copied, overriding the localcopy property of
- /// the reference.
- /// </param>
- void CopyReferencesToOutputPath(bool force);
-
- /// <summary>
- /// Returns true, if a specific file (given by it's name)
- /// is inside this project.
- /// </summary>
- bool IsFileInProject(string fileName);
-
- /// <summary>
- /// Returns the file content as a string which can be parsed by the parser.
- /// The fileName must be a file name in the project. This is used for files
- /// 'behind' other files or zipped file contents etc.
- /// </summary>
- string GetParseableFileContent(string fileName);
-
- /// <summary>
- /// Creates a IConfiguration object which is used by this project type.
- /// </summary>
- IConfiguration CreateConfiguration(string name);
-
- /// <summary>
- /// Creates a IConfiguration object which is used by this project type.
- /// </summary>
- IConfiguration CreateConfiguration();
-
- event EventHandler NameChanged;
- event ProjectFileEventHandler FileRemovedFromProject;
- event ProjectFileEventHandler FileAddedToProject;
- event ProjectFileEventHandler FileChangedInProject;
- event ProjectReferenceEventHandler ReferenceRemovedFromProject;
- event ProjectReferenceEventHandler ReferenceAddedToProject;
- }
-}
Index: Core/src/MonoDevelop.Base/Internal/Project/Project/DotNetProjectBinding.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Project/Project/DotNetProjectBinding.cs (revision 0)
+++ Core/src/MonoDevelop.Base/Internal/Project/Project/DotNetProjectBinding.cs (revision 0)
@@ -0,0 +1,47 @@
+
+using System;
+using System.Xml;
+using MonoDevelop.Internal.Serialization;
+using MonoDevelop.Internal.Templates;
+using MonoDevelop.Services;
+
+namespace MonoDevelop.Internal.Project
+{
+ public class DotNetProjectBinding : IProjectBinding
+ {
+ ILanguageBinding languageBinding;
+ ProjectTemplate[] defaultTemplates = new ProjectTemplate [0];
+
+ public virtual string Name {
+ get { return "DotNet"; }
+ }
+
+ public Project CreateProject (ProjectCreateInformation info, XmlElement projectOptions)
+ {
+ string lang = projectOptions.GetAttribute ("language");
+ languageBinding = Runtime.Languages.GetBindingPerLanguageName (lang);
+ return CreateProject (lang, info, projectOptions);
+ }
+
+ protected virtual DotNetProject CreateProject (string languageName, ProjectCreateInformation info, XmlElement projectOptions)
+ {
+ return new DotNetProject (languageName, info, projectOptions);
+ }
+
+ public Project CreateSingleFileProject (string file)
+ {
+ ILanguageBinding binding = Runtime.Languages.GetBindingPerFileName (file);
+ if (binding != null) {
+ Project project = CreateProject (binding.Language, null, null);
+ project.ProjectFiles.Add (new ProjectFile (file));
+ return project;
+ }
+ return null;
+ }
+
+ public ProjectTemplate[] GetDefaultTemplates ()
+ {
+ return defaultTemplates;
+ }
+ }
+}
Index: Core/src/MonoDevelop.Base/Internal/Project/Project/AbstractProjectConfiguration.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Project/Project/AbstractProjectConfiguration.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Internal/Project/Project/AbstractProjectConfiguration.cs (working copy)
@@ -13,6 +13,7 @@
using System.Xml;
using MonoDevelop.Internal.Project;
+using MonoDevelop.Internal.Serialization;
namespace MonoDevelop.Internal.Project
{
@@ -20,93 +21,75 @@
/// External language bindings may choose to extend this class.
/// It makes things a bit easier.
/// </summary>
- [XmlNodeNameAttribute("Configuration")]
+ [DataItemAttribute("Configuration")]
public abstract class AbstractProjectConfiguration : AbstractConfiguration
{
- [XmlNodeName("Output")]
- protected class OutputConfiguration
- {
- [XmlAttribute("directory")]
- [ConvertToRelativePath()]
- public string Directory = "." + Path.DirectorySeparatorChar.ToString();
-
- [XmlAttribute("assembly")]
- public string Assembly = "a";
-
- [XmlAttribute("executeScript")]
- [ConvertToRelativePath()]
- public string ExecuteScript = String.Empty;
-
- [XmlAttribute("executeBeforeBuild")]
- [ConvertToRelativePath()]
- public string ExecuteBeforeBuild = String.Empty;
-
- [XmlAttribute("executeAfterBuild")]
- [ConvertToRelativePath()]
- public string ExecuteAfterBuild = String.Empty;
- }
+ [ProjectPathItemProperty ("Output/directory")]
+ string directory = "." + Path.DirectorySeparatorChar.ToString();
- [XmlAttribute("runwithwarnings")]
+ [ProjectPathItemProperty ("Build/executeBeforeBuild", DefaultValue = "")]
+ string executeBeforeBuild = String.Empty;
+
+ [ProjectPathItemProperty ("Build/executeAfterBuild", DefaultValue = "")]
+ string executeAfterBuild = String.Empty;
+
+ [ItemProperty ("Build/debugmode")]
+ bool debugmode = true;
+
+ [ProjectPathItemProperty ("Execution/executeScript", DefaultValue = "")]
+ string executeScript = String.Empty;
+
+ [ItemProperty ("Execution/runwithwarnings")]
protected bool runWithWarnings = false;
- protected OutputConfiguration outputConfiguration = new OutputConfiguration();
+ [ItemProperty ("Execution/commandlineparameters", DefaultValue = "")]
+ public string commandLineParameters = String.Empty;
- public virtual string OutputDirectory {
- get {
- return outputConfiguration.Directory;
- }
- set {
- outputConfiguration.Directory = value;
- }
+ [ItemProperty ("Execution/consolepause")]
+ public bool pauseconsoleoutput = true;
+
+ public AbstractProjectConfiguration()
+ {
}
- public virtual string OutputAssembly {
- get {
- return outputConfiguration.Assembly;
- }
- set {
- outputConfiguration.Assembly = value;
- }
+ public virtual string OutputDirectory {
+ get { return directory; }
+ set { directory = value; }
}
public virtual string ExecuteScript {
- get {
- return outputConfiguration.ExecuteScript;
- }
- set {
- outputConfiguration.ExecuteScript = value;
- }
+ get { return executeScript; }
+ set { executeScript = value; }
}
public virtual string ExecuteBeforeBuild {
- get {
- return outputConfiguration.ExecuteBeforeBuild;
- }
- set {
- outputConfiguration.ExecuteBeforeBuild = value;
- }
+ get { return executeBeforeBuild; }
+ set { executeBeforeBuild = value; }
}
public virtual string ExecuteAfterBuild {
- get {
- return outputConfiguration.ExecuteAfterBuild;
- }
- set {
- outputConfiguration.ExecuteAfterBuild = value;
- }
+ get { return executeAfterBuild; }
+ set { executeAfterBuild = value; }
}
public virtual bool RunWithWarnings {
- get {
- return runWithWarnings;
- }
- set {
- runWithWarnings = value;
- }
+ get { return runWithWarnings; }
+ set { runWithWarnings = value; }
}
- public AbstractProjectConfiguration()
- {
+ public bool DebugMode {
+ get { return debugmode; }
+ set { debugmode = value; }
}
+
+ public string CommandLineParameters {
+ get { return commandLineParameters; }
+ set { commandLineParameters = value; }
+ }
+
+ public bool PauseConsoleOutput {
+ get { return pauseconsoleoutput; }
+ set { pauseconsoleoutput = value; }
+ }
}
}
Index: Core/src/MonoDevelop.Base/Internal/Project/Project/DotNetProject.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Project/Project/DotNetProject.cs (revision 0)
+++ Core/src/MonoDevelop.Base/Internal/Project/Project/DotNetProject.cs (revision 0)
@@ -0,0 +1,162 @@
+
+using System;
+using System.IO;
+using System.Diagnostics;
+using System.Xml;
+using MonoDevelop.Internal.Serialization;
+using MonoDevelop.Internal.Templates;
+using MonoDevelop.Services;
+
+namespace MonoDevelop.Internal.Project
+{
+ public class DotNetProject : Project
+ {
+ [ItemProperty]
+ string language;
+
+ ILanguageBinding languageBinding;
+
+ public override string ProjectType {
+ get { return "DotNet"; }
+ }
+
+ public string LanguageName {
+ get { return language; }
+ }
+
+ internal DotNetProject (string languageName)
+ {
+ language = languageName;
+ languageBinding = Runtime.Languages.GetBindingPerLanguageName (language);
+ if (languageBinding == null)
+ throw new InvalidOperationException ("Project type not supported: " + language);
+ }
+
+ public DotNetProject (string language, ProjectCreateInformation info, XmlElement projectOptions)
+ {
+ string binPath;
+ if (info != null) {
+ Name = info.ProjectName;
+ binPath = info.BinPath;
+ } else {
+ binPath = ".";
+ }
+
+ languageBinding = Runtime.Languages.GetBindingPerLanguageName (language);
+ if (languageBinding == null) throw new InvalidOperationException ("Language not supported: " + language);
+
+ DotNetProjectConfiguration configuration = CreateConfiguration ();
+ configuration.Name = "Debug";
+ configuration.CompilationParameters = languageBinding.CreateCompilationParameters (projectOptions);
+ Configurations.Add (configuration);
+
+ configuration = CreateConfiguration ();
+ configuration.Name = "Release";
+ configuration.CompilationParameters = languageBinding.CreateCompilationParameters (projectOptions);
+ Configurations.Add (configuration);
+
+ foreach (DotNetProjectConfiguration parameter in Configurations) {
+ parameter.OutputDirectory = Path.Combine (binPath, parameter.Name);
+ parameter.OutputAssembly = Name;
+
+ if (projectOptions != null) {
+ if (projectOptions.Attributes["Target"] != null) {
+ parameter.CompileTarget = (CompileTarget)Enum.Parse(typeof(CompileTarget), projectOptions.Attributes["Target"].InnerText);
+ }
+ if (projectOptions.Attributes["PauseConsoleOutput"] != null) {
+ parameter.PauseConsoleOutput = Boolean.Parse(projectOptions.Attributes["PauseConsoleOutput"].InnerText);
+ }
+ }
+ }
+ }
+
+ protected virtual DotNetProjectConfiguration CreateConfiguration ()
+ {
+ return new DotNetProjectConfiguration ();
+ }
+
+ protected override ICompilerResult DoBuild ()
+ {
+ DotNetProjectConfiguration conf = (DotNetProjectConfiguration) ActiveConfiguration;
+ foreach (ProjectFile finfo in ProjectFiles) {
+ // Treat app.config in the project root directory as the application config
+ if (Path.GetFileName (finfo.Name).ToUpper () == "app.config".ToUpper() &&
+ Path.GetDirectoryName (finfo.Name) == BaseDirectory)
+ {
+ File.Copy (finfo.Name, conf.CompiledOutputName + ".config",true);
+ }
+ }
+
+ ICompilerResult res = languageBinding.Compile (ProjectFiles, ProjectReferences, conf);
+ CopyReferencesToOutputPath (false);
+ return res;
+ }
+
+ public override string GetOutputFileName ()
+ {
+ DotNetProjectConfiguration conf = (DotNetProjectConfiguration) ActiveConfiguration;
+ return conf.CompiledOutputName;
+ }
+
+ public override void Debug ()
+ {
+ if (Runtime.TaskService.Errors != 0) return;
+
+ DotNetProjectConfiguration configuration = (DotNetProjectConfiguration) ActiveConfiguration;
+ if (Runtime.DebuggingService != null)
+ Runtime.DebuggingService.Run (new string[] { configuration.CompiledOutputName } );
+ }
+
+ protected override void DoExecute ()
+ {
+ CopyReferencesToOutputPath (true);
+
+ DotNetProjectConfiguration configuration = (DotNetProjectConfiguration) ActiveConfiguration;
+ string args = configuration.CommandLineParameters;
+
+ ProcessStartInfo psi;
+ string runtimeStarter = "mono --debug ";
+
+ switch (configuration.NetRuntime) {
+ case NetRuntime.Mono:
+ runtimeStarter = "mono --debug ";
+ break;
+ case NetRuntime.MonoInterpreter:
+ runtimeStarter = "mint ";
+ break;
+ }
+
+ string additionalCommands = "";
+ if (configuration.PauseConsoleOutput)
+ additionalCommands = @"echo; read -p 'press any key to continue...' -n1;";
+
+ psi = new ProcessStartInfo("xterm",
+ string.Format (
+ @"-e ""{0} '{1}{2}' {3} ; {4}""",
+ runtimeStarter, configuration.CompiledOutputName, args, additionalCommands));
+ psi.UseShellExecute = false;
+
+ try {
+ psi.WorkingDirectory = Path.GetDirectoryName (configuration.CompiledOutputName);
+ psi.UseShellExecute = false;
+
+ Process p = new Process();
+ p.StartInfo = psi;
+ p.Start();
+ } catch (Exception) {
+ throw new ApplicationException("Can not execute " + "\"" + configuration.CompiledOutputName + "\"\n(Try restarting MonoDevelop or start your app manually)");
+ }
+ }
+
+ public override void GenerateMakefiles (Combine parentCombine)
+ {
+ Console.WriteLine ("Generating makefiles for " + Name);
+ languageBinding.GenerateMakefile (this, parentCombine);
+ }
+
+ public override bool IsCompileable(string fileName)
+ {
+ return languageBinding.CanCompile(LanguageName);
+ }
+ }
+}
Index: Core/src/MonoDevelop.Base/Internal/Project/Project/ProjectReference.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Project/Project/ProjectReference.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Internal/Project/Project/ProjectReference.cs (working copy)
@@ -14,6 +14,7 @@
using System.ComponentModel;
using MonoDevelop.Gui.Components;
using MonoDevelop.Internal.Project;
+using MonoDevelop.Internal.Serialization;
namespace MonoDevelop.Internal.Project
{
@@ -25,20 +26,18 @@
}
/// <summary>
- /// This class represent a reference information in an IProject object.
+ /// This class represent a reference information in an Project object.
/// </summary>
- [XmlNodeName("Reference")]
- public class ProjectReference : LocalizedObject, ICloneable
+ [DataItemAttribute ("Reference")]
+ public class ProjectReference : LocalizedObject, ICloneable, ICustomDataItem
{
- [XmlAttribute("type")]
+ [ItemProperty ("type")]
ReferenceType referenceType;
- [XmlAttribute("refto")]
- [ConvertToRelativePath("IsAssembly")]
- string reference = String.Empty;
+ string reference = String.Empty;
- [XmlAttribute("localcopy")]
- bool localCopy = true;
+ [ItemProperty ("localcopy")]
+ bool localCopy = true;
bool IsAssembly {
get {
@@ -88,7 +87,7 @@
/// Returns the file name to an assembly, regardless of what
/// type the assembly is.
/// </summary>
- public string GetReferencedFileName(IProject project)
+ public string GetReferencedFileName ()
{
switch (ReferenceType) {
case ReferenceType.Typelib:
@@ -100,8 +99,8 @@
string file = Runtime.ParserService.LoadAssemblyFromGac (GetPathToGACAssembly (this));
return file == String.Empty ? reference : file;
case ReferenceType.Project:
- string projectOutputLocation = Runtime.ProjectService.GetOutputAssemblyName(reference);
- return projectOutputLocation;
+ Project p = Runtime.ProjectService.GetProject (reference);
+ return p != null ? p.GetOutputFileName () : null;
default:
throw new NotImplementedException("unknown reference type : " + ReferenceType);
@@ -118,7 +117,31 @@
this.reference = reference;
}
+ DataCollection ICustomDataItem.Serialize (ITypeSerializer handler)
+ {
+ DataCollection data = handler.Serialize (this);
+ string refto = reference;
+ if (referenceType == ReferenceType.Assembly) {
+ string basePath = Path.GetDirectoryName (handler.SerializationContext.BaseFile);
+ refto = Runtime.FileUtilityService.AbsoluteToRelativePath (basePath, refto);
+ }
+ data.Add (new DataValue ("refto", refto));
+ return data;
+ }
+ void ICustomDataItem.Deserialize (ITypeSerializer handler, DataCollection data)
+ {
+ DataValue refto = data.Extract ("refto") as DataValue;
+ handler.Deserialize (this, data);
+ if (refto != null) {
+ reference = refto.Value;
+ if (referenceType == ReferenceType.Assembly) {
+ string basePath = Path.GetDirectoryName (handler.SerializationContext.BaseFile);
+ reference = Runtime.FileUtilityService.RelativeToAbsolutePath (basePath, reference);
+ }
+ }
+ }
+
/// <summary>
/// This method returns the absolute path to an GAC assembly.
/// </summary>
Index: Core/src/MonoDevelop.Base/Internal/Project/Project/ProjectFileEventArgs.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Project/Project/ProjectFileEventArgs.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Internal/Project/Project/ProjectFileEventArgs.cs (working copy)
@@ -14,10 +14,10 @@
public class ProjectFileEventArgs : EventArgs
{
- IProject project;
+ Project project;
ProjectFile file;
- public IProject Project {
+ public Project Project {
get {
return project;
}
@@ -29,7 +29,7 @@
}
}
- public ProjectFileEventArgs (IProject project, ProjectFile file)
+ public ProjectFileEventArgs (Project project, ProjectFile file)
{
this.project = project;
this.file = file;
Index: Core/src/MonoDevelop.Base/Internal/Project/Project/IncludeFilesDialog.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Project/Project/IncludeFilesDialog.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Internal/Project/Project/IncludeFilesDialog.cs (working copy)
@@ -37,10 +37,10 @@
// regular members
StringCollection newFiles;
- IProject project;
+ Project project;
FileUtilityService fileUtilityService = Runtime.FileUtilityService;
- public IncludeFilesDialog(IProject project, StringCollection newFiles)
+ public IncludeFilesDialog(Project project, StringCollection newFiles)
{
Console.WriteLine ("*** Include files dialog ***");
// we must do it from *here* otherwise, we get this assembly, not the caller
Index: Core/src/MonoDevelop.Base/Internal/Project/Project/TypelibImporter.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Project/Project/TypelibImporter.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Internal/Project/Project/TypelibImporter.cs (working copy)
@@ -41,7 +41,7 @@
{
}
- public string Import(ProjectReference refinfo, IProject project)
+ public string Import(ProjectReference refinfo, Project project)
{
RegistryKey root = Registry.ClassesRoot;
RegistryKey typelibsKey = root.OpenSubKey("TypeLib");
Index: Core/src/MonoDevelop.Base/Internal/Project/Project/AbstractProject.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Project/Project/AbstractProject.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Internal/Project/Project/AbstractProject.cs (working copy)
@@ -14,73 +14,58 @@
using System.Collections.Specialized;
using System.Reflection;
using System.Xml;
+using System.CodeDom.Compiler;
using MonoDevelop.Core.Properties;
using MonoDevelop.Core.AddIns;
-using MonoDevelop.Internal.Project.Collections;
using MonoDevelop.Internal.Project;
using MonoDevelop.Core.Services;
using MonoDevelop.Services;
using MonoDevelop.Gui.Components;
using MonoDevelop.Gui.Widgets;
+using MonoDevelop.Internal.Serialization;
namespace MonoDevelop.Internal.Project
{
+ public enum NewFileSearch {
+ None,
+ OnLoad,
+ OnLoadAutoInsert
+ }
+
/// <summary>
/// External language bindings must extend this class
/// </summary>
- [XmlNodeName("Project")]
- public abstract class AbstractProject : LocalizedObject, IProject
+ [DataItemAttribute ("Project")]
+ [DataInclude (typeof(ProjectFile))]
+ public abstract class Project : CombineEntry
{
readonly static string currentProjectFileVersion = "1.1";
readonly static string configurationNodeName = "Configuration";
- protected string basedirectory = String.Empty;
-
- [XmlAttribute("name")]
- protected string projectname = "New Project";
-
- [XmlAttribute("description")]
+ [ItemProperty ("Description", DefaultValue="")]
protected string description = "";
- [XmlAttribute("newfilesearch")]
+ [ItemProperty ("newfilesearch", DefaultValue = NewFileSearch.None)]
protected NewFileSearch newFileSearch = NewFileSearch.None;
- [XmlAttribute("enableviewstate")]
- protected bool enableViewState = true;
+ [ItemProperty ("enableviewstate", DefaultValue = true)]
+ protected bool enableViewState = true;
+
+ ProjectFileCollection projectFiles;
- [XmlSetAttribute(typeof(ProjectFile), "Contents")]
- protected ProjectFileCollection projectFiles = new ProjectFileCollection();
-
- [XmlSetAttribute(typeof(ProjectReference), "References")]
+ [ItemProperty ("References")]
protected ProjectReferenceCollection projectReferences = new ProjectReferenceCollection();
+ [ItemProperty ("DeploymentInformation")]
protected DeployInformation deployInformation = new DeployInformation();
- FileUtilityService fileUtilityService = Runtime.FileUtilityService;
- [Browsable(false)]
- public string BaseDirectory {
- get {
- return basedirectory;
- }
- }
+ bool isDirty = true;
- [LocalizedProperty("${res:MonoDevelop.Internal.Project.Project.Name}",
- Description ="${res:MonoDevelop.Internal.Project.Project.Description}")]
- public string Name {
- get {
- return projectname;
- }
- set {
- if (projectname != value && value != null && value.Length > 0) {
- if (!Runtime.ProjectService.ExistsEntryWithName(value)) {
- string oldName = projectname;
- projectname = value;
- Runtime.ProjectService.OnRenameProject(new ProjectRenameEventArgs(this, oldName, value));
- OnNameChanged(EventArgs.Empty);
- }
- }
- }
+ public Project ()
+ {
+ Name = "New Project";
+ projectReferences.SetProject (this);
}
[LocalizedProperty("${res:MonoDevelop.Internal.Project.ProjectClass.Description}",
@@ -96,9 +81,12 @@
}
[Browsable(false)]
+ [ItemProperty ("Contents")]
+ [ItemProperty ("File", Scope=1)]
public ProjectFileCollection ProjectFiles {
get {
- return projectFiles;
+ if (projectFiles != null) return projectFiles;
+ return projectFiles = new ProjectFileCollection (this);
}
}
@@ -109,31 +97,6 @@
}
}
- protected ArrayList configurations = new ArrayList();
- protected IConfiguration activeConfiguration = null;
-
- [Browsable(false)]
- public ArrayList Configurations {
- get {
- return configurations;
- }
- }
-
- [LocalizedProperty("${res:MonoDevelop.Internal.Project.Project.ActiveConfiguration}",
- Description = "${res:MonoDevelop.Internal.Project.Project.ActiveConfiguration.Description}")]
- [TypeConverter(typeof(ProjectActiveConfigurationTypeConverter))]
- public IConfiguration ActiveConfiguration {
- get {
- if (activeConfiguration == null && configurations.Count > 0) {
- return (IConfiguration)configurations[0];
- }
- return activeConfiguration;
- }
- set {
- activeConfiguration = value;
- }
- }
-
[LocalizedProperty("${res:MonoDevelop.Internal.Project.Project.NewFileSearch}",
Description = "${res:MonoDevelop.Internal.Project.Project.NewFileSearch.Description}")]
[DefaultValue(NewFileSearch.None)]
@@ -170,16 +133,10 @@
}
}
- public AbstractProject()
- {
- projectFiles.SetProject (this);
- projectReferences.SetProject (this);
- }
-
public bool IsFileInProject(string filename)
{
if (filename == null) return false;
- foreach (ProjectFile file in projectFiles) {
+ foreach (ProjectFile file in ProjectFiles) {
if (file.Name == filename) {
return true;
}
@@ -187,9 +144,9 @@
return false;
}
- public bool IsCompileable(string fileName)
+ public virtual bool IsCompileable (string fileName)
{
- return Runtime.Languages.GetBindingPerLanguageName (ProjectType).CanCompile(fileName);
+ return false;
}
public void SearchNewFiles()
@@ -199,7 +156,7 @@
}
StringCollection newFiles = new StringCollection();
- StringCollection collection = fileUtilityService.SearchDirectory(basedirectory, "*");
+ StringCollection collection = Runtime.FileUtilityService.SearchDirectory (BaseDirectory, "*");
foreach (string sfile in collection) {
string extension = Path.GetExtension(sfile).ToUpper();
@@ -232,7 +189,7 @@
foreach (string file in newFiles) {
ProjectFile newFile = new ProjectFile(file);
newFile.BuildAction = IsCompileable(file) ? BuildAction.Compile : BuildAction.Nothing;
- projectFiles.Add(newFile);
+ ProjectFiles.Add(newFile);
}
} else {
new IncludeFilesDialog(this, newFiles).ShowDialog();
@@ -240,273 +197,22 @@
}
}
- public virtual void LoadProject(string fileName)
+ public static Project LoadProject (string filename)
{
- basedirectory = Path.GetDirectoryName(fileName);
- XmlDocument doc = new XmlDocument();
- doc.Load(fileName);
+ Project prj = Runtime.ProjectService.ReadFile (filename) as Project;
+ if (prj == null)
+ throw new InvalidOperationException ("Invalid project file: " + filename);
- string version = null;
- if (doc.DocumentElement.Attributes["version"] == null) {
- if (doc.DocumentElement.Attributes["fileversion"] != null) {
- version = doc.DocumentElement.Attributes["fileversion"].InnerText;
- }
- } else {
- version = doc.DocumentElement.Attributes["version"].InnerText;
- }
-
- if (version != "1.0" && version != currentProjectFileVersion) {
- throw new UnknownProjectVersionException(version);
- }
- if (version == "1.0") {
- string tempFile = Path.GetTempFileName();
- Runtime.MessageService.ShowMessage(String.Format (GettextCatalog.GetString ("Old project file format found.\n It will be automatically converted to {0} information"), currentProjectFileVersion));
-
- ConvertXml.Convert(fileName,
- Runtime.Properties.DataDirectory + Path.DirectorySeparatorChar +
- "ConversionStyleSheets" + Path.DirectorySeparatorChar +
- "ConvertPrjx10to11.xsl",
- tempFile);
- try {
- File.Delete(fileName);
- File.Copy(tempFile, fileName);
- LoadProject(fileName);
- File.Delete(tempFile);
- return;
- } catch (Exception) {
- Runtime.MessageService.ShowError(GettextCatalog.GetString ("Error writing the old project file.\nCheck if you have write permission on the project file (.prjx).\n A non persistent proxy project will be created but no changes will be saved.\nIt is better if you close MonoDevelop and correct the problem."));
- if (File.Exists(tempFile)) {
- doc.Load(tempFile);
- File.Delete(tempFile);
- } else {
- Runtime.MessageService.ShowError("damn! (should never happen)");
- }
- }
- }
-
- GetXmlAttributes(doc, doc.DocumentElement, this);
-
- // add the configurations
- XmlNode configurationElement = doc.DocumentElement.SelectSingleNode("Configurations");
-
- string activeConfigurationName = configurationElement.Attributes["active"].InnerText;
-
- foreach (XmlNode configuration in configurationElement.ChildNodes) {
- if (configuration.Name == configurationNodeName) {
- IConfiguration newConfiguration = CreateConfiguration();
- GetXmlAttributes(doc, (XmlElement)configuration, newConfiguration);
- if (newConfiguration.Name == activeConfigurationName) {
- activeConfiguration = newConfiguration;
- }
- Configurations.Add(newConfiguration);
- }
- }
-
- SearchNewFiles();
-
- projectFiles.SetProject (this);
- projectReferences.SetProject (this);
+ return prj;
}
-
- void GetXmlAttributes(XmlDocument doc, XmlElement element, object o)
- {
- FieldInfo[] fieldInfos = o.GetType().GetFields(BindingFlags.FlattenHierarchy |
- BindingFlags.Public |
- BindingFlags.Instance |
- BindingFlags.NonPublic);
- foreach (FieldInfo fieldInfo in fieldInfos) {
- // set the xml attributes for this object
- XmlAttributeAttribute[] xmlAttributes = (XmlAttributeAttribute[])fieldInfo.GetCustomAttributes(typeof(XmlAttributeAttribute), true);
- ConvertToRelativePathAttribute[] convertToRelPath = (ConvertToRelativePathAttribute[])fieldInfo.GetCustomAttributes(typeof(ConvertToRelativePathAttribute), true);
- bool convertRel = convertToRelPath != null && convertToRelPath.Length > 0;
-
- if (xmlAttributes != null && xmlAttributes.Length > 0) {
- if (xmlAttributes[0].Name == null) continue;
- XmlAttribute xmlAttribute = element.Attributes[xmlAttributes[0].Name];
- if (xmlAttribute != null) {
- if (convertRel && convertToRelPath[0].PredicatePropertyName != null && convertToRelPath[0].PredicatePropertyName.Length > 0) {
- PropertyInfo myPropInfo = o.GetType().GetProperty(convertToRelPath[0].PredicatePropertyName,
- BindingFlags.Public |
- BindingFlags.NonPublic |
- BindingFlags.Instance);
- if (myPropInfo != null) {
- convertRel = (bool)myPropInfo.GetValue(o, null);
- }
- }
-
- string val = null;
- if (convertRel) {
- if (xmlAttribute.InnerText.Length == 0) {
- val = String.Empty;
- } else {
- val = fileUtilityService.RelativeToAbsolutePath(basedirectory, xmlAttribute.InnerText);
- }
- } else {
- val = xmlAttribute.InnerText;
- }
-
- if (fieldInfo.FieldType.IsEnum) {
- fieldInfo.SetValue(o, Enum.Parse(fieldInfo.FieldType,val));
- } else {
- fieldInfo.SetValue(o, Convert.ChangeType(val, fieldInfo.FieldType));
- }
- }
- } else { // add sets to the xmlElement
- XmlSetAttribute[] xmlSetAttributes = (XmlSetAttribute[])fieldInfo.GetCustomAttributes(typeof(XmlSetAttribute), true);
- if (xmlSetAttributes != null && xmlSetAttributes.Length > 0) {
- XmlElement setElement;
- if (xmlSetAttributes[0].Name == null) {
- setElement = element;
- } else {
- setElement = (XmlElement)element.SelectSingleNode("descendant::" + xmlSetAttributes[0].Name);
- }
-
- if (setElement != null) {
- IList collection = (IList)fieldInfo.GetValue(o);
- foreach (XmlNode childNode in setElement.ChildNodes) {
- object instance = xmlSetAttributes[0].Type.Assembly.CreateInstance(xmlSetAttributes[0].Type.FullName);
- GetXmlAttributes(doc, (XmlElement)childNode, instance);
- collection.Add(instance);
- }
- }
- } else { // finally try, if the field is from a type which has a XmlNodeName attribute attached
-
- XmlNodeNameAttribute[] xmlNodeNames = (XmlNodeNameAttribute[])fieldInfo.FieldType.GetCustomAttributes(typeof(XmlNodeNameAttribute), true);
-
- if (xmlNodeNames != null && xmlNodeNames.Length == 1) {
- XmlElement el = (XmlElement)element.SelectSingleNode("descendant::" + xmlNodeNames[0].Name);
- object instance = fieldInfo.FieldType.Assembly.CreateInstance(fieldInfo.FieldType.FullName);
- if (el != null) {
- GetXmlAttributes(doc, el, instance);
- }
- fieldInfo.SetValue(o, instance);
- }
- }
- }
- }
- }
- void SetXmlAttributes(XmlDocument doc, XmlElement element, object o)
+ public override void Deserialize (ITypeSerializer handler, DataCollection data)
{
- FieldInfo[] fieldInfos = o.GetType().GetFields(BindingFlags.FlattenHierarchy |
- BindingFlags.Public |
- BindingFlags.Instance |
- BindingFlags.NonPublic);
- foreach (FieldInfo fieldInfo in fieldInfos) {
- // set the xml attributes for this object
- XmlAttributeAttribute[] xmlAttributes = (XmlAttributeAttribute[])fieldInfo.GetCustomAttributes(typeof(XmlAttributeAttribute), true);
-
- ConvertToRelativePathAttribute[] convertToRelPath = (ConvertToRelativePathAttribute[])fieldInfo.GetCustomAttributes(typeof(ConvertToRelativePathAttribute), true);
- bool convertRel = convertToRelPath != null && convertToRelPath.Length > 0;
-
- if (xmlAttributes != null && xmlAttributes.Length > 0) {
- if (xmlAttributes[0].Name == null) continue;
- XmlAttribute xmlAttribute = doc.CreateAttribute(xmlAttributes[0].Name);
- object fieldValue = fieldInfo.GetValue(o);
-
- if (convertRel && convertToRelPath[0].PredicatePropertyName != null && convertToRelPath[0].PredicatePropertyName.Length > 0) {
- PropertyInfo myPropInfo = o.GetType().GetProperty(convertToRelPath[0].PredicatePropertyName,
- BindingFlags.Public |
- BindingFlags.NonPublic |
- BindingFlags.Instance);
- if (myPropInfo != null) {
- convertRel = (bool)myPropInfo.GetValue(o, null);
- }
- }
-
- if (convertRel) {
- string val = fieldValue == null ? String.Empty : fieldValue.ToString();
- if (val.Length == 0) {
- fieldValue = String.Empty;
- } else {
- fieldValue = fileUtilityService.AbsoluteToRelativePath(basedirectory, val);
- }
- }
- xmlAttribute.InnerText = fieldValue == null ? String.Empty : fieldValue.ToString();
- element.Attributes.Append(xmlAttribute);
- } else { // add sets to the xmlElement
- XmlSetAttribute[] xmlSetAttributes = (XmlSetAttribute[])fieldInfo.GetCustomAttributes(typeof(XmlSetAttribute), true);
- if (xmlSetAttributes != null && xmlSetAttributes.Length > 0) {
- XmlElement setElement;
- if (xmlSetAttributes[0].Name == null) {
- setElement = element;
- } else {
- setElement = doc.CreateElement(xmlSetAttributes[0].Name);
- }
-
- // A set must always be a collection
- ICollection collection = (ICollection)fieldInfo.GetValue(o);
- foreach (object collectionObject in collection) {
- XmlNodeNameAttribute[] xmlNodeNames = (XmlNodeNameAttribute[])collectionObject.GetType().GetCustomAttributes(typeof(XmlNodeNameAttribute), true);
- if (xmlNodeNames == null || xmlNodeNames.Length != 1) {
- throw new Exception("XmlNodeNames mismatch");
- }
- XmlElement collectionElement = doc.CreateElement(xmlNodeNames[0].Name);
- SetXmlAttributes(doc, collectionElement, collectionObject);
- setElement.AppendChild(collectionElement);
- }
- if (element != setElement) {
- element.AppendChild(setElement);
- }
- } else { // finally try, if the field is from a type which has a XmlNodeName attribute attached
- object fieldValue = fieldInfo.GetValue(o);
- if (fieldValue != null) {
- XmlNodeNameAttribute[] xmlNodeNames = (XmlNodeNameAttribute[])fieldValue.GetType().GetCustomAttributes(typeof(XmlNodeNameAttribute), true);
-
- if (xmlNodeNames != null && xmlNodeNames.Length == 1) {
- XmlElement setElement = doc.CreateElement(xmlNodeNames[0].Name);
- SetXmlAttributes(doc, setElement, fieldValue);
- element.AppendChild(setElement);
- }
- }
- }
- }
- }
+ base.Deserialize (handler, data);
+ SearchNewFiles();
+ projectReferences.SetProject (this);
}
-
- public virtual void SaveProject(string fileName)
- {
- fileName = System.IO.Path.GetFullPath (fileName);
- basedirectory = Path.GetDirectoryName(fileName);
- XmlDocument doc = new XmlDocument();
- doc.LoadXml("<Project/>");
- SetXmlAttributes(doc, doc.DocumentElement, this);
-
- // set version attribute to the root node
- XmlAttribute versionAttribute = doc.CreateAttribute("version");
- versionAttribute.InnerText = currentProjectFileVersion;
- doc.DocumentElement.Attributes.Append(versionAttribute);
-
-
- // set projecttype attribute to the root node
- XmlAttribute projecttypeAttribute = doc.CreateAttribute("projecttype");
- projecttypeAttribute.InnerText = ProjectType;
- doc.DocumentElement.Attributes.Append(projecttypeAttribute);
-
- // create the configuration nodes
- // I choosed to add the configuration nodes 'per hand' instead of using the automated
- // version, because it is more cleaner for the language binding implementors to just
- // creating a factory method for their configurations.
- XmlElement configurationElement = doc.CreateElement("Configurations");
- XmlAttribute activeConfigAttribute = doc.CreateAttribute("active");
- activeConfigAttribute.InnerText = ActiveConfiguration == null ? String.Empty : ActiveConfiguration.Name;
- configurationElement.Attributes.Append(activeConfigAttribute);
-
- foreach (IConfiguration configuration in Configurations) {
- XmlElement newConfig = doc.CreateElement(configurationNodeName);
- SetXmlAttributes(doc, newConfig, configuration);
- configurationElement.AppendChild(newConfig);
- }
-
- doc.DocumentElement.AppendChild(configurationElement);
-
- Runtime.FileUtilityService.ObservedSave(new NamedFileOperationDelegate(doc.Save),
- fileName,
- GettextCatalog.GetString ("Can't save solution\nPlease check your file and directory permissions."),
- FileErrorPolicy.ProvideAlternative);
- }
-
public virtual string GetParseableFileContent(string fileName)
{
fileName = fileName.Replace('\\', '/'); // FIXME PEDRO
@@ -523,7 +229,7 @@
if (fdiag.Run() == (int)Gtk.ResponseType.Ok) {
string filename = fdiag.Filename;
- SaveProject(filename);
+ Save (filename);
Runtime.MessageService.ShowMessage(filename, GettextCatalog.GetString ("Project saved"));
}
@@ -538,32 +244,9 @@
return;
}
foreach (ProjectReference projectReference in ProjectReferences) {
- if (projectReference.ReferenceType == ReferenceType.Project) {
- ArrayList allProjects = Combine.GetAllProjects (Runtime.ProjectService.CurrentOpenCombine);
- foreach (ProjectCombineEntry entry in allProjects)
- {
- IProject proj = entry.Project;
- if (proj.Name != projectReference.Reference)
- continue;
- foreach (ProjectReference refrnc in proj.ProjectReferences)
- {
- if (refrnc.ReferenceType != ReferenceType.Gac && (refrnc.LocalCopy || force)) {
- string referenceFileName = refrnc.GetReferencedFileName (proj);
- string destinationFileName = fileUtilityService.GetDirectoryNameWithSeparator (config.OutputDirectory) + Path.GetFileName (referenceFileName);
- try {
- if (destinationFileName != referenceFileName) {
- File.Copy (referenceFileName, destinationFileName, true);
- if (File.Exists (referenceFileName + ".mdb"))
- File.Copy (referenceFileName + ".mdb", destinationFileName + ".mdb", true);
- }
- } catch { }
- }
- }
- }
- }
if ((projectReference.LocalCopy || force) && projectReference.ReferenceType != ReferenceType.Gac) {
- string referenceFileName = projectReference.GetReferencedFileName(this);
- string destinationFileName = fileUtilityService.GetDirectoryNameWithSeparator(config.OutputDirectory) + Path.GetFileName(referenceFileName);
+ string referenceFileName = projectReference.GetReferencedFileName();
+ string destinationFileName = Runtime.FileUtilityService.GetDirectoryNameWithSeparator(config.OutputDirectory) + Path.GetFileName(referenceFileName);
try {
if (destinationFileName != referenceFileName) {
File.Copy(referenceFileName, destinationFileName, true);
@@ -577,23 +260,172 @@
}
}
- public virtual void Dispose()
+ public override void Dispose()
{
+ base.Dispose ();
foreach (ProjectFile file in ProjectFiles) {
file.Dispose ();
}
}
- public abstract IConfiguration CreateConfiguration();
+ public ProjectReference AddReference (string filename)
+ {
+ foreach (ProjectReference rInfo in ProjectReferences) {
+ if (rInfo.Reference == filename) {
+ return rInfo;
+ }
+ }
+ ProjectReference newReferenceInformation = new ProjectReference (ReferenceType.Assembly, filename);
+ ProjectReferences.Add (newReferenceInformation);
+ return newReferenceInformation;
+ }
- public virtual IConfiguration CreateConfiguration(string name)
+ public ProjectFile AddFile (string filename, BuildAction action)
{
- IConfiguration config = CreateConfiguration();
- config.Name = name;
+ foreach (ProjectFile fInfo in ProjectFiles) {
+ if (fInfo.Name == filename) {
+ return fInfo;
+ }
+ }
+ ProjectFile newFileInformation = new ProjectFile (filename, action);
+ ProjectFiles.Add (newFileInformation);
+ return newFileInformation;
+ }
+
+ public void AddFile (ProjectFile projectFile) {
+ ProjectFiles.Add (projectFile);
+ }
+
+ public override void Clean ()
+ {
+ isDirty = true;
+ }
+
+ public override void Build ()
+ {
+ Compile ();
+ }
+
+ public ICompilerResult Compile ()
+ {
+ if (isDirty) {
+ Runtime.StringParserService.Properties["Project"] = Name;
+ TaskService taskService = Runtime.TaskService;
+
+ Runtime.Gui.StatusBar.SetMessage(String.Format (GettextCatalog.GetString ("Compiling: {0}"), Name));
+
+ DoPreBuild ();
+
+ taskService.CompilerOutput += String.Format (GettextCatalog.GetString ("------ Build started: Project: {0} Configuration: {1} ------\n\nPerforming main compilation...\n"), Name, ActiveConfiguration.Name);
+
+ ICompilerResult res = DoBuild ();
+
+ DoPostBuild ();
+
+ isDirty = false;
+ foreach (System.CodeDom.Compiler.CompilerError err in res.CompilerResults.Errors) {
+ isDirty = true;
+ taskService.AddTask(new Task(this, err));
+ }
+
+ if (taskService.Errors > 0) {
+ ++CombineEntry.BuildErrors;
+ } else {
+ ++CombineEntry.BuildProjects;
+ }
+
+ taskService.CompilerOutput += String.Format (GettextCatalog.GetString ("Build complete -- {0} errors, {1} warnings\n\n"), taskService.Errors.ToString (), taskService.Warnings.ToString ());
+ return res;
+ }
+ return new DefaultCompilerResult (new CompilerResults (null), "");
+ }
+
+ protected virtual void DoPreBuild ()
+ {
+ AbstractProjectConfiguration conf = ActiveConfiguration as AbstractProjectConfiguration;
+
+ // create output directory, if not exists
+ string outputDir = conf.OutputDirectory;
+ try {
+ DirectoryInfo directoryInfo = new DirectoryInfo(outputDir);
+ if (!directoryInfo.Exists) {
+ directoryInfo.Create();
+ }
+ } catch (Exception e) {
+ throw new ApplicationException("Can't create project output directory " + outputDir + " original exception:\n" + e.ToString());
+ }
- return config;
+ if (conf != null && File.Exists(conf.ExecuteBeforeBuild)) {
+ Runtime.TaskService.CompilerOutput += String.Format (GettextCatalog.GetString ("Execute : {0}"), conf.ExecuteBeforeBuild);
+ ProcessStartInfo ps = new ProcessStartInfo(conf.ExecuteBeforeBuild);
+ ps.UseShellExecute = false;
+ ps.RedirectStandardOutput = true;
+ ps.WorkingDirectory = Path.GetDirectoryName(conf.ExecuteBeforeBuild);
+ Process process = new Process();
+ process.StartInfo = ps;
+ process.Start();
+ Runtime.TaskService.CompilerOutput += process.StandardOutput.ReadToEnd();
+ }
}
+ protected virtual ICompilerResult DoBuild ()
+ {
+ return new DefaultCompilerResult (new CompilerResults (null), "");
+ }
+
+ protected virtual void DoPostBuild ()
+ {
+ AbstractProjectConfiguration conf = ActiveConfiguration as AbstractProjectConfiguration;
+
+ if (conf != null && File.Exists(conf.ExecuteAfterBuild)) {
+ Runtime.TaskService.CompilerOutput += String.Format (GettextCatalog.GetString ("Execute : {0}"), conf.ExecuteAfterBuild);
+ ProcessStartInfo ps = new ProcessStartInfo(conf.ExecuteAfterBuild);
+ ps.UseShellExecute = false;
+ ps.RedirectStandardOutput = true;
+ ps.WorkingDirectory = Path.GetDirectoryName(conf.ExecuteAfterBuild);
+ Process process = new Process();
+ process.StartInfo = ps;
+ process.Start();
+ Runtime.TaskService.CompilerOutput += process.StandardOutput.ReadToEnd();
+ }
+ }
+
+ public override void Execute()
+ {
+ if (Runtime.TaskService.Errors != 0) return;
+ if (Runtime.TaskService.Warnings != 0 && ActiveConfiguration != null && !((AbstractProjectConfiguration) ActiveConfiguration).RunWithWarnings)
+ return;
+
+ AbstractProjectConfiguration configuration = (AbstractProjectConfiguration) ActiveConfiguration;
+ string args = configuration.CommandLineParameters;
+
+ ProcessStartInfo psi;
+ if (configuration.ExecuteScript != null && configuration.ExecuteScript.Length > 0) {
+ string additionalCommands = "";
+ if (configuration.PauseConsoleOutput)
+ additionalCommands = @"echo; read -p 'press any key to continue...' -n1;";
+ psi = new ProcessStartInfo("xterm",
+ String.Format (@"-e ""cd {3} ; '{0}' {1} ; {2}""", configuration.ExecuteScript, args, additionalCommands, BaseDirectory));
+ psi.UseShellExecute = false;
+ } else {
+ DoExecute ();
+ }
+ }
+
+
+ protected virtual void DoExecute ()
+ {
+ }
+
+ public override bool NeedsBuilding {
+ get {
+ return isDirty;
+ }
+ set {
+ isDirty = value;
+ }
+ }
+
internal void NotifyFileChangedInProject (ProjectFile file)
{
OnFileChangedInProject (new ProjectFileEventArgs (this, file));
@@ -619,13 +451,6 @@
OnReferenceAddedToProject (new ProjectReferenceEventArgs (this, reference));
}
- protected virtual void OnNameChanged(EventArgs e)
- {
- if (NameChanged != null) {
- NameChanged(this, e);
- }
- }
-
protected virtual void OnFileRemovedFromProject (ProjectFileEventArgs e)
{
if (FileRemovedFromProject != null) {
@@ -662,7 +487,6 @@
}
- public event EventHandler NameChanged;
public event ProjectFileEventHandler FileRemovedFromProject;
public event ProjectFileEventHandler FileAddedToProject;
public event ProjectFileEventHandler FileChangedInProject;
@@ -684,7 +508,7 @@
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
{
- IProject project = (IProject)context.Instance;
+ Project project = (Project)context.Instance;
foreach (IConfiguration configuration in project.Configurations) {
if (configuration.Name == value.ToString()) {
return configuration;
@@ -714,7 +538,7 @@
public override System.ComponentModel.TypeConverter.StandardValuesCollection GetStandardValues(System.ComponentModel.ITypeDescriptorContext context)
{
- return new TypeConverter.StandardValuesCollection(((IProject)context.Instance).Configurations);
+ return new TypeConverter.StandardValuesCollection(((Project)context.Instance).Configurations);
}
}
}
Index: Core/src/MonoDevelop.Base/Internal/Project/Project/AbstractConfiguration.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Project/Project/AbstractConfiguration.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Internal/Project/Project/AbstractConfiguration.cs (working copy)
@@ -7,23 +7,23 @@
using System.Xml;
using MonoDevelop.Internal.Project;
+using MonoDevelop.Internal.Serialization;
+using System.Collections;
namespace MonoDevelop.Internal.Project
{
- public abstract class AbstractConfiguration : IConfiguration
+ public abstract class AbstractConfiguration : IConfiguration, IExtendedDataItem
{
- [XmlAttribute("name")]
- protected string name = null;
+ [ItemProperty("name")]
+ string name = null;
+
+ Hashtable properties;
public string Name {
- get {
- return name;
- }
- set {
- name = value;
- }
+ get { return name; }
+ set { name = value; }
}
-
+
public object Clone()
{
return MemberwiseClone();
@@ -33,5 +33,12 @@
{
return name;
}
+
+ public IDictionary ExtendedProperties {
+ get {
+ if (properties == null) properties = new Hashtable ();
+ return properties;
+ }
+ }
}
}
Index: Core/src/MonoDevelop.Base/Internal/Project/Project/ProjectReferenceEventArgs.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Project/Project/ProjectReferenceEventArgs.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Internal/Project/Project/ProjectReferenceEventArgs.cs (working copy)
@@ -14,10 +14,10 @@
public class ProjectReferenceEventArgs : EventArgs
{
- IProject project;
+ Project project;
ProjectReference reference;
- public IProject Project {
+ public Project Project {
get {
return project;
}
@@ -29,7 +29,7 @@
}
}
- public ProjectReferenceEventArgs (IProject project, ProjectReference reference)
+ public ProjectReferenceEventArgs (Project project, ProjectReference reference)
{
this.project = project;
this.reference = reference;
Index: Core/src/MonoDevelop.Base/Internal/Project/Project/ProjectFile.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Project/Project/ProjectFile.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Internal/Project/Project/ProjectFile.cs (working copy)
@@ -11,7 +11,7 @@
using System.ComponentModel;
using System.Diagnostics;
using System.Xml;
-using MonoDevelop.Internal.Project;
+using MonoDevelop.Internal.Serialization;
using MonoDevelop.Gui.Components;
namespace MonoDevelop.Internal.Project
@@ -37,31 +37,48 @@
/// <summary>
/// This class represent a file information in an IProject object.
/// </summary>
- [XmlNodeName("File")]
public class ProjectFile : LocalizedObject, ICloneable
{
- [XmlAttribute("name"),
- ConvertToRelativePath()]
- string filename;
+ [ProjectPathItemProperty("name")]
+ string filename;
- [XmlAttribute("subtype")]
- Subtype subtype;
+ [ItemProperty("subtype")]
+ Subtype subtype;
- [XmlAttribute("buildaction")]
+ [ItemProperty("buildaction")]
BuildAction buildaction;
- [XmlAttribute("dependson"),
- ConvertToRelativePath()]
- string dependsOn;
+ [ItemProperty("dependson", DefaultValue="")]
+ string dependsOn;
- [XmlAttribute("data")]
- string data;
+ [ItemProperty("data", DefaultValue="")]
+ string data;
- [XmlAttribute(null)]
- AbstractProject project;
+ Project project;
private FileSystemWatcher ProjectFileWatcher;
+ public ProjectFile()
+ {
+ AddFileWatch();
+ }
+
+ public ProjectFile(string filename)
+ {
+ this.filename = filename;
+ subtype = Subtype.Code;
+ buildaction = BuildAction.Compile;
+ AddFileWatch();
+ }
+
+ public ProjectFile(string filename, BuildAction buildAction)
+ {
+ this.filename = filename;
+ subtype = Subtype.Code;
+ buildaction = buildAction;
+ AddFileWatch();
+ }
+
private void AddFileWatch()
{
ProjectFileWatcher = new FileSystemWatcher();
@@ -78,20 +95,25 @@
if ((this.filename == null) || (this.filename.Length == 0))
return;
-
- ProjectFileWatcher.EnableRaisingEvents = false;
- ProjectFileWatcher.Path = Path.GetDirectoryName(filename);
- ProjectFileWatcher.Filter = Path.GetFileName(filename);
- ProjectFileWatcher.EnableRaisingEvents = true;
+ try {
+ ProjectFileWatcher.EnableRaisingEvents = false;
+ ProjectFileWatcher.Path = Path.GetDirectoryName(filename);
+ ProjectFileWatcher.Filter = Path.GetFileName(filename);
+ ProjectFileWatcher.EnableRaisingEvents = true;
+ } catch {
+ Console.WriteLine ("NOT WATCHING " + filename);
+ }
+
}
private void OnChanged(object source, FileSystemEventArgs e)
{
- project.NotifyFileChangedInProject(this);
+ if (project != null)
+ project.NotifyFileChangedInProject(this);
}
- internal void SetProject (AbstractProject prj)
+ internal void SetProject (Project prj)
{
project = prj;
UpdateFileWatch();
@@ -105,14 +127,24 @@
return filename;
}
set {
- project.NotifyFileRemovedFromProject (this);
+ Debug.Assert (value != null && value.Length > 0, "name == null || name.Length == 0");
+ if (project != null) project.NotifyFileRemovedFromProject (this);
filename = value;
UpdateFileWatch();
- Debug.Assert(filename != null && filename.Length > 0, "name == null || name.Length == 0");
- project.NotifyFileAddedToProject (this);
+ if (project != null) project.NotifyFileAddedToProject (this);
}
}
+ public string FilePath {
+ get {
+ return filename;
+ }
+ }
+
+ public string RelativePath {
+ get { return filename; }
+ }
+
[Browsable(false)]
public Subtype Subtype {
get {
@@ -154,27 +186,6 @@
}
}
- public ProjectFile()
- {
- AddFileWatch();
- }
-
- public ProjectFile(string filename)
- {
- this.filename = filename;
- subtype = Subtype.Code;
- buildaction = BuildAction.Compile;
- AddFileWatch();
- }
-
- public ProjectFile(string filename, BuildAction buildAction)
- {
- this.filename = filename;
- subtype = Subtype.Code;
- buildaction = buildAction;
- AddFileWatch();
- }
-
public object Clone()
{
return MemberwiseClone();
Index: Core/src/MonoDevelop.Base/Internal/Project/Project/Collections/ProjectReferenceCollection.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Project/Project/Collections/ProjectReferenceCollection.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Internal/Project/Project/Collections/ProjectReferenceCollection.cs (working copy)
@@ -7,7 +7,7 @@
using System;
using System.Collections;
-namespace MonoDevelop.Internal.Project.Collections
+namespace MonoDevelop.Internal.Project
{
/// <summary>
/// <para>
@@ -18,17 +18,17 @@
[Serializable()]
public class ProjectReferenceCollection : CollectionBase {
- AbstractProject project;
+ Project project;
/// <summary>
/// <para>
/// Initializes a new instance of <see cref='.ProjectReferenceCollection'/>.
/// </para>
/// </summary>
- internal ProjectReferenceCollection() {
+ public ProjectReferenceCollection() {
}
- internal void SetProject (AbstractProject project)
+ internal void SetProject (Project project)
{
this.project = project;
}
@@ -46,9 +46,9 @@
return ((ProjectReference)(List[index]));
}
set {
- project.NotifyReferenceRemovedFromProject ((ProjectReference)List[index]);
+ if (project != null) project.NotifyReferenceRemovedFromProject ((ProjectReference)List[index]);
List[index] = value;
- project.NotifyReferenceAddedToProject (value);
+ if (project != null) project.NotifyReferenceAddedToProject (value);
}
}
@@ -63,7 +63,7 @@
/// <seealso cref='.ProjectReferenceCollection.AddRange'/>
public int Add(ProjectReference value) {
int i = List.Add(value);
- project.NotifyReferenceAddedToProject (value);
+ if (project != null) project.NotifyReferenceAddedToProject (value);
return i;
}
@@ -155,7 +155,7 @@
/// <seealso cref='.ProjectReferenceCollection.Add'/>
public void Insert(int index, ProjectReference value) {
List.Insert(index, value);
- project.NotifyReferenceAddedToProject (value);
+ if (project != null) project.NotifyReferenceAddedToProject (value);
}
/// <summary>
@@ -177,7 +177,7 @@
/// <exception cref='System.ArgumentException'><paramref name='value'/> is not found in the Collection. </exception>
public void Remove(ProjectReference value) {
List.Remove(value);
- project.NotifyReferenceRemovedFromProject (value);
+ if (project != null) project.NotifyReferenceRemovedFromProject (value);
}
public class ProjectReferenceEnumerator : object, IEnumerator {
Index: Core/src/MonoDevelop.Base/Internal/Project/Project/Collections/ProjectFileCollection.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Project/Project/Collections/ProjectFileCollection.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Internal/Project/Project/Collections/ProjectFileCollection.cs (working copy)
@@ -7,7 +7,7 @@
using System;
using System.Collections;
-namespace MonoDevelop.Internal.Project.Collections
+namespace MonoDevelop.Internal.Project
{
/// <summary>
/// <para>
@@ -18,21 +18,20 @@
[Serializable()]
public class ProjectFileCollection : CollectionBase {
- AbstractProject project;
+ Project project;
/// <summary>
/// <para>
/// Initializes a new instance of <see cref='.ProjectFileCollection'/>.
/// </para>
/// </summary>
- public ProjectFileCollection () {
+ public ProjectFileCollection ()
+ {
}
- internal void SetProject (AbstractProject project)
+ public ProjectFileCollection (Project project)
{
this.project = project;
- foreach (ProjectFile file in List)
- file.SetProject (project);
}
/// <summary>
@@ -48,10 +47,15 @@
return ((ProjectFile)(List[index]));
}
set {
- project.NotifyFileRemovedFromProject ((ProjectFile)List[index]);
+ if (project != null)
+ project.NotifyFileRemovedFromProject ((ProjectFile)List[index]);
+
List[index] = value;
- value.SetProject (project);
- project.NotifyFileAddedToProject (value);
+
+ if (project != null) {
+ value.SetProject (project);
+ project.NotifyFileAddedToProject (value);
+ }
}
}
@@ -66,8 +70,10 @@
/// <seealso cref='.ProjectFileCollection.AddRange'/>
public int Add(ProjectFile value) {
int i = List.Add(value);
- value.SetProject (project);
- project.NotifyFileAddedToProject (value);
+ if (project != null) {
+ value.SetProject (project);
+ project.NotifyFileAddedToProject (value);
+ }
return i;
}
@@ -159,8 +165,10 @@
/// <seealso cref='.ProjectFileCollection.Add'/>
public void Insert(int index, ProjectFile value) {
List.Insert(index, value);
- value.SetProject (project);
- project.NotifyFileAddedToProject (value);
+ if (project != null) {
+ value.SetProject (project);
+ project.NotifyFileAddedToProject (value);
+ }
}
/// <summary>
@@ -182,6 +190,8 @@
/// <exception cref='System.ArgumentException'><paramref name='value'/> is not found in the Collection. </exception>
public void Remove(ProjectFile value) {
List.Remove(value);
+ if (project != null)
+ project.NotifyFileRemovedFromProject (value);
}
public class ProjectFileEnumerator : object, IEnumerator {
Index: Core/src/MonoDevelop.Base/Internal/Project/CmbxFileFormat.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Project/CmbxFileFormat.cs (revision 0)
+++ Core/src/MonoDevelop.Base/Internal/Project/CmbxFileFormat.cs (revision 0)
@@ -0,0 +1,184 @@
+// <file>
+// <owner name="Lluis Sanchez" email="lluis@novell.com"/>
+// <version value="$version"/>
+// </file>
+
+using System;
+using System.IO;
+using System.Xml;
+using MonoDevelop.Services;
+using MonoDevelop.Internal.Serialization;
+
+namespace MonoDevelop.Internal.Project
+{
+ public class CmbxFileFormat: IFileFormat
+ {
+ public void WriteFile (string file, object node)
+ {
+ Combine combine = node as Combine;
+ if (combine == null)
+ throw new InvalidOperationException ("The provided object is not a Combine");
+
+ if (!file.EndsWith("2")) file += "2";
+ StreamWriter sw = new StreamWriter (file);
+ try {
+ XmlTextWriter tw = new XmlTextWriter (sw);
+ tw.Formatting = Formatting.Indented;
+ DataSerializer serializer = new DataSerializer (Runtime.ProjectService.DataContext, file);
+ CombineWriterV2 combineWriter = new CombineWriterV2 (serializer);
+ combineWriter.WriteCombine (tw, combine);
+ } finally {
+ sw.Close ();
+ }
+ }
+
+ public object ReadFile (string file)
+ {
+ XmlTextReader reader = new XmlTextReader (new StreamReader (file));
+ reader.MoveToContent ();
+
+ string version = reader.GetAttribute ("version");
+ if (version == null) version = reader.GetAttribute ("fileversion");
+
+ DataSerializer serializer = new DataSerializer (Runtime.ProjectService.DataContext, file);
+ ICombineReader combineReader = null;
+
+ if (version == "1.0")
+ combineReader = new CombineReaderV1 (serializer);
+ else if (version == "2.0")
+ combineReader = new CombineReaderV2 (serializer);
+
+ try {
+ if (combineReader != null)
+ return combineReader.ReadCombine (reader);
+ else
+ throw new UnknownProjectVersionException (version);
+ } finally {
+ reader.Close ();
+ }
+ }
+ }
+
+ interface ICombineReader {
+ Combine ReadCombine (XmlReader reader);
+ }
+
+ class CombineReaderV1: XmlConfigurationReader, ICombineReader
+ {
+ Combine combine;
+ string file;
+ DataSerializer serializer;
+
+ public CombineReaderV1 (DataSerializer serializer)
+ {
+ this.serializer = serializer;
+ this.file = serializer.SerializationContext.BaseFile;
+ combine = new Combine ();
+ combine.FileName = file;
+ }
+
+ public Combine ReadCombine (XmlReader reader)
+ {
+ DataItem data = (DataItem) Read (reader);
+ serializer.Deserialize (combine, data);
+ return combine;
+ }
+
+ protected override DataNode ReadChild (XmlReader reader, DataItem parent)
+ {
+ if (reader.LocalName == "Entries") {
+ if (reader.IsEmptyElement) return null;
+ string basePath = Path.GetDirectoryName (file);
+ reader.ReadStartElement ();
+ while (MoveToNextElement (reader)) {
+ string nodefile = reader.GetAttribute ("filename");
+ nodefile = Runtime.FileUtilityService.RelativeToAbsolutePath (basePath, nodefile);
+ combine.Entries.Add ((CombineEntry) Runtime.ProjectService.ReadFile (nodefile));
+ reader.Skip ();
+ }
+ reader.ReadEndElement ();
+ return null;
+ } else if (reader.LocalName == "Configurations") {
+ DataItem item = base.ReadChild (reader, parent) as DataItem;
+ foreach (DataNode data in item.ItemData) {
+ DataItem conf = data as DataItem;
+ if (conf == null) continue;
+ Runtime.ProjectService.DataContext.SetTypeInfo (conf, typeof(CombineConfiguration));
+ }
+ return item;
+ }
+
+ return base.ReadChild (reader, parent);
+ }
+ }
+
+ class CombineReaderV2: XmlConfigurationReader, ICombineReader
+ {
+ DataSerializer serializer;
+ Combine combine = new Combine ();
+
+ public CombineReaderV2 (DataSerializer serializer)
+ {
+ this.serializer = serializer;
+ combine.FileName = serializer.SerializationContext.BaseFile;
+ }
+
+ public Combine ReadCombine (XmlReader reader)
+ {
+ DataItem data = (DataItem) Read (reader);
+ serializer.Deserialize (combine, data);
+ return combine;
+ }
+
+ protected override DataNode ReadChild (XmlReader reader, DataItem parent)
+ {
+ if (reader.LocalName == "Entries") {
+ if (reader.IsEmptyElement) return null;
+ string basePath = Path.GetDirectoryName (combine.FileName);
+ reader.ReadStartElement ();
+ while (MoveToNextElement (reader)) {
+ string nodefile = reader.GetAttribute ("filename");
+ nodefile = Runtime.FileUtilityService.RelativeToAbsolutePath (basePath, nodefile);
+ combine.Entries.Add ((CombineEntry) Runtime.ProjectService.ReadFile (nodefile));
+ reader.Skip ();
+ }
+ reader.ReadEndElement ();
+ return null;
+ }
+
+ return base.ReadChild (reader, parent);
+ }
+ }
+
+ class CombineWriterV2: XmlConfigurationWriter
+ {
+ Combine combine;
+ DataSerializer serializer;
+
+ public CombineWriterV2 (DataSerializer serializer)
+ {
+ this.serializer = serializer;
+ }
+
+ public void WriteCombine (XmlWriter writer, Combine combine)
+ {
+ this.combine = combine;
+ DataItem data = (DataItem) serializer.Serialize (combine, typeof(Combine));
+ Write (writer, data);
+ }
+
+ protected override void WriteChildren (XmlWriter writer, DataItem item)
+ {
+ base.WriteChildren (writer, item);
+
+ writer.WriteStartElement ("Entries");
+ foreach (CombineEntry entry in combine.Entries) {
+ writer.WriteStartElement ("Entry");
+ writer.WriteAttributeString ("filename", entry.RelativeFileName);
+ writer.WriteEndElement ();
+ Runtime.ProjectService.WriteFile (entry.FileName, entry);
+ }
+ writer.WriteEndElement ();
+ }
+ }
+}
Index: Core/src/MonoDevelop.Base/Internal/Project/Combine/Combine.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Project/Combine/Combine.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Internal/Project/Combine/Combine.cs (working copy)
@@ -28,24 +28,31 @@
using MonoDevelop.Services;
using MonoDevelop.Internal.Project;
using MonoDevelop.Core.Properties;
-using MonoDevelop.Gui;
using MonoDevelop.Gui.Components;
using MonoDevelop.Gui.Widgets;
+using MonoDevelop.Internal.Serialization;
namespace MonoDevelop.Internal.Project
{
- public class Combine : LocalizedObject, IDisposable
+ [DataInclude (typeof(CombineConfiguration))]
+ public class Combine : CombineEntry
{
- string name = null;
+ [ItemProperty ("description")]
string description = null;
- /// <summary>
- /// name of the project to startup in singlestartup mode.
- /// </summary>
+ [ItemProperty ("StartMode/startupentry")]
string startProject = null;
+
+ [ItemProperty ("StartMode/single")]
bool singleStartup = true;
+
+ [ExpandedCollection]
+ [ItemProperty ("StartMode/Execute", ValueType = typeof(CombineExecuteDefinition))]
+ ArrayList combineExecuteDefinitions = new ArrayList();
+
bool eventsAllowed = true;
- string path = null;
+
+ [ItemProperty ("RelativeOutputPath")]
string outputdir = null;
ProjectFileEventHandler fileAddedToProjectHandler;
@@ -55,41 +62,12 @@
ProjectReferenceEventHandler referenceAddedToProjectHandler;
ProjectReferenceEventHandler referenceRemovedFromProjectHandler;
- CombineEntryCollection entries = new CombineEntryCollection();
+ CombineEntryCollection entries;
- CombineConfiguration activeConfiguration;
-
- Hashtable configurations = new Hashtable();
- ArrayList combineExecuteDefinitions = new ArrayList();
-
- [LocalizedProperty("${res:MonoDevelop.Internal.Project.Combine.ActiveConfiguration}",
- Description = "${res:MonoDevelop.Internal.Project.Combine.ActiveConfiguration.Description}")]
- [TypeConverter(typeof(CombineActiveConfigurationTypeConverter))]
- public CombineConfiguration ActiveConfiguration {
- get {
- return activeConfiguration;
- }
- set {
- activeConfiguration = value;
- }
- }
-
[Browsable(false)]
- public Hashtable Configurations {
+ public CombineEntryCollection Entries {
get {
- return configurations;
- }
- }
-
- [Browsable(false)]
- public ArrayList CombineExecuteDefinitions {
- get {
- return combineExecuteDefinitions;
- }
- }
- [Browsable(false)]
- public ICombineEntryCollection Entries {
- get {
+ if (entries == null) entries = new CombineEntryCollection (this);
return entries;
}
}
@@ -100,6 +78,7 @@
return startProject;
}
set {
+ if (Entries [value] == null) throw new ArgumentException ("Invalid entry name");
startProject = value;
OnStartupPropertyChanged(null);
}
@@ -115,34 +94,20 @@
OnStartupPropertyChanged(null);
}
}
-
- public string OutputDirectory
- {
- get {
- return outputdir;
- }
- set {
- outputdir = value;
- }
- }
- public string BaseDirectory {
+ public ArrayList CombineExecuteDefinitions {
get {
- return path;
+ return combineExecuteDefinitions;
}
}
- [LocalizedProperty("${res:MonoDevelop.Internal.Project.Combine.Name}",
- Description ="${res:MonoDevelop.Internal.Project.Combine.Name.Description}")]
- public string Name {
+ public string OutputDirectory
+ {
get {
- return name;
+ return outputdir;
}
set {
- if (name != value && value != null && value.Length > 0) {
- name = value;
- OnNameChanged(EventArgs.Empty);
- }
+ outputdir = value;
}
}
@@ -159,27 +124,14 @@
[LocalizedProperty("${res:MonoDevelop.Internal.Project.Combine.NeedsBuilding}",
Description ="${res:MonoDevelop.Internal.Project.Combine.NeedsBuilding.Description}")]
- public bool NeedsBuilding {
+ public override bool NeedsBuilding {
get {
- ArrayList projects = new ArrayList();
- GetAllProjects(projects, this);
- foreach (ProjectCombineEntry projectEntry in projects) {
- if (projectEntry.IsDirty) {
- return true;
- }
- }
+ foreach (CombineEntry entry in Entries)
+ if (entry.NeedsBuilding) return true;
return false;
}
- }
-
- public void Dispose()
- {
- if (entries != null) {
- foreach (object o in entries) {
- if (o is IDisposable) {
- ((IDisposable)o).Dispose();
- }
- }
+ set {
+ // Ignore
}
}
@@ -192,190 +144,88 @@
referenceRemovedFromProjectHandler = new ProjectReferenceEventHandler (NotifyReferenceRemovedFromProject);
}
- public Combine(string filename)
+ internal void NotifyEntryAdded (CombineEntry entry)
{
- LoadCombine(filename);
- }
-
- public IProject LoadProject(string filename)
- {
- ILanguageBinding binding = Runtime.Languages.GetBindingPerProjectFile(filename);
- if (binding == null) {
- Runtime.MessageService.ShowError(String.Format (GettextCatalog.GetString ("Can't find language binding for {0}"), filename));
- return null;
- }
+ if (startProject == null)
+ startProject = entry.Name;
- IProject project = binding.CreateProject(null, null);
- project.LoadProject(filename);
- return project;
- }
-
- public void LoadCombine(string filename)
- {
- XmlDocument doc = new XmlDocument();
- doc.Load(filename);
- path = Path.GetDirectoryName(filename);
-
- XmlElement root = doc.DocumentElement;
-
- name = root.Attributes["name"].InnerText;
- description = root.Attributes["description"].InnerText;
-
- startProject = root["StartMode"].Attributes["startupentry"].InnerText;
- singleStartup = Boolean.Parse(root["StartMode"].Attributes["single"].InnerText);
-
- XmlNodeList nodes = root["Entries"].ChildNodes;
- entries.Clear();
- FileUtilityService fileUtilityService = Runtime.FileUtilityService;
- eventsAllowed = false;
- try {
- foreach (XmlElement el in nodes) {
- string abs_path = fileUtilityService.RelativeToAbsolutePath(path, el.Attributes["filename"].InnerText);
- AddEntry(abs_path);
+ if (Configurations.Count == 0) {
+ foreach (IConfiguration pconf in entry.Configurations) {
+ if (pconf.Name == null)
+ continue;
+ CombineConfiguration cconf = new CombineConfiguration (pconf.Name);
+ Configurations.Add (cconf);
+ if (ActiveConfiguration == null)
+ ActiveConfiguration = cconf;
}
}
- finally {
- eventsAllowed = true;
- }
- nodes = root["StartMode"].ChildNodes;
- combineExecuteDefinitions.Clear();
- foreach (XmlElement el in nodes) {
- if (el.Name == "Execute") {
- CombineExecuteDefinition ced = new CombineExecuteDefinition();
- ced.Entry = GetEntry(el.Attributes["entry"].InnerText);
- ced.Type = (EntryExecuteType)Enum.Parse(typeof(EntryExecuteType), el.Attributes["type"].InnerText);
- combineExecuteDefinitions.Add(ced);
- }
- }
+ foreach (CombineConfiguration conf in Configurations)
+ conf.AddEntry (entry);
+
+ combineExecuteDefinitions.Add (new CombineExecuteDefinition (entry, EntryExecuteType.None));
- nodes = root["Configurations"].ChildNodes;
- configurations.Clear();
- foreach (XmlElement el in nodes) {
- CombineConfiguration cconf = new CombineConfiguration(el, this);
- configurations[cconf.Name] = cconf;
-
- // set the active configuration, either to the first (if the active attribute is not set)
- // or to the active configuration specified by the active attribute.
- if ((doc.DocumentElement["Configurations"].Attributes["active"] == null) || cconf.Name == doc.DocumentElement["Configurations"].Attributes["active"].InnerText) { // ok, I know that && has a higher priority than ||, but many programmers think that a bracket is easier to read ... one thing I don't find easy to read are long lines :)
- ActiveConfiguration = cconf;
- }
- }
+ if (eventsAllowed)
+ OnEntryAdded (new CombineEntryEventArgs (entry));
- string mdCombineAddition = Path.ChangeExtension (filename, "mdsx");
- if (File.Exists (mdCombineAddition)) {
- doc.Load (mdCombineAddition);
- root = doc.DocumentElement;
- if (root["RelativeOutputPath"] != null && root["RelativeOutputPath"].InnerText != null) {
- outputdir = fileUtilityService.RelativeToAbsolutePath(path, root["RelativeOutputPath"].InnerText);
- } else {
- outputdir = Path.Combine (path, Path.Combine ("build", "bin"));
- }
- } else {
- outputdir = Path.Combine (path, Path.Combine ("build", "bin"));
+ if (entry is Project)
+ {
+ Project project = entry as Project;
+ project.FileRemovedFromProject += fileAddedToProjectHandler;
+ project.FileAddedToProject += fileRemovedFromProjectHandler;
+ project.FileChangedInProject += fileChangedInProjectHandler;
+ project.ReferenceRemovedFromProject += referenceAddedToProjectHandler;
+ project.ReferenceAddedToProject += referenceRemovedFromProjectHandler;
}
+ else if (entry is Combine)
+ {
+ Combine combine = entry as Combine;
+ combine.FileRemovedFromProject += fileAddedToProjectHandler;
+ combine.FileAddedToProject += fileRemovedFromProjectHandler;
+ combine.FileChangedInProject += fileChangedInProjectHandler;
+ combine.ReferenceRemovedFromProject += referenceAddedToProjectHandler;
+ combine.ReferenceAddedToProject += referenceRemovedFromProjectHandler;
+ }
}
- public void SaveCombine(string filename)
+ public override void Deserialize (ITypeSerializer handler, DataCollection data)
{
- XmlDocument doc = new XmlDocument();
- doc.LoadXml("<Combine fileversion=\"1.0\"/>");
+ base.Deserialize (handler, data);
+
+ foreach (CombineExecuteDefinition ced in combineExecuteDefinitions)
+ ced.SetCombine (this);
- XmlAttribute combineNameAttribute = doc.CreateAttribute("name");
- combineNameAttribute.InnerText = name;
- doc.DocumentElement.Attributes.Append(combineNameAttribute);
-
- XmlAttribute combineDescriptionAttribute = doc.CreateAttribute("description");
- combineDescriptionAttribute.InnerText = description;
- doc.DocumentElement.Attributes.Append(combineDescriptionAttribute);
-
- string path = Path.GetDirectoryName(filename);
-
- XmlElement startupnode = doc.CreateElement("StartMode");
-
- XmlAttribute single = doc.CreateAttribute("startupentry");
- single.InnerText = startProject;
- startupnode.Attributes.Append(single);
-
- XmlAttribute activeconf = doc.CreateAttribute("single");
- activeconf.InnerText = singleStartup.ToString();
- startupnode.Attributes.Append(activeconf);
-
- foreach (CombineExecuteDefinition ced in combineExecuteDefinitions) {
- XmlElement el = doc.CreateElement("Execute");
-
- XmlAttribute a1 = doc.CreateAttribute("entry");
- CombineEntry centry = ced.Entry;
- if (centry == null || centry.Entry == null) {
- continue;
- }
- if (centry.Entry is IProject) {
- a1.InnerText = ((IProject)centry.Entry).Name;
+ foreach (CombineConfiguration conf in Configurations)
+ conf.SetCombine (this);
+
+ string mdCombineAddition = Path.ChangeExtension (FileName, "mdsx");
+ if (File.Exists (mdCombineAddition)) {
+ XmlDocument doc = new XmlDocument ();
+ doc.Load (mdCombineAddition);
+ string rop = doc.DocumentElement["RelativeOutputPath"].InnerText;
+ if (rop != "") {
+ outputdir = Runtime.FileUtilityService.RelativeToAbsolutePath (BaseDirectory, rop);
} else {
- a1.InnerText = ((Combine)centry.Entry).Name;
+ outputdir = Path.Combine (BaseDirectory, Path.Combine ("build", "bin"));
}
- el.Attributes.Append(a1);
-
- XmlAttribute a2 = doc.CreateAttribute("type");
- a2.InnerText = ced.Type.ToString();
- el.Attributes.Append(a2);
-
- startupnode.AppendChild(el);
+ } else {
+ outputdir = Path.Combine (BaseDirectory, Path.Combine ("build", "bin"));
}
-
- doc.DocumentElement.AppendChild(startupnode);
-
- XmlElement projectsnode = doc.CreateElement("Entries");
- FileUtilityService fileUtilityService = Runtime.FileUtilityService;
-
- foreach (CombineEntry entry in entries) {
- XmlElement el = doc.CreateElement("Entry");
-
- XmlAttribute entrynameattr = doc.CreateAttribute("filename");
- entrynameattr.InnerText = fileUtilityService.AbsoluteToRelativePath(path, entry.Filename);
- el.Attributes.Append(entrynameattr);
-
- projectsnode.AppendChild(el);
- }
- doc.DocumentElement.AppendChild(projectsnode);
-
- XmlElement confnode = doc.CreateElement("Configurations");
-
- if (ActiveConfiguration != null) {
- XmlAttribute activeconfattr = doc.CreateAttribute("active");
- activeconfattr.InnerText = ActiveConfiguration.Name;
- confnode.Attributes.Append(activeconfattr);
- }
- foreach (DictionaryEntry dentry in configurations) {
- confnode.AppendChild(((CombineConfiguration)dentry.Value).ToXmlElement(doc));
- }
- doc.DocumentElement.AppendChild(confnode);
-
- fileUtilityService.ObservedSave(new NamedFileOperationDelegate(doc.Save),
- filename,
- GettextCatalog.GetString ("Can't save solution\nPlease check your file and directory permissions."),
- FileErrorPolicy.ProvideAlternative);
+ }
- doc = new XmlDocument ();
- doc.LoadXml ("<MonoDevelopSolution fileversion=\"1.0\"/>");
- XmlElement outputElement = doc.CreateElement ("RelativeOutputPath");
- outputElement.InnerText = fileUtilityService.AbsoluteToRelativePath(path, outputdir);
-
- doc.DocumentElement.AppendChild (outputElement);
- fileUtilityService.ObservedSave (new NamedFileOperationDelegate (doc.Save),
- Path.ChangeExtension (filename, "mdsx"),
- GettextCatalog.GetString ("Can't save solution\nPlease check your file and directory permissions."),
- FileErrorPolicy.ProvideAlternative);
-
+ public override void Save ()
+ {
+ base.Save ();
+ GenerateMakefiles ();
}
- public void SaveCombineAs()
+ public void SaveCombineAs ()
{
using (FileSelector fdiag = new FileSelector (GettextCatalog.GetString ("Save Combine As..."))) {
//fdiag.Filename = System.Environment.GetEnvironmentVariable ("HOME");
if (fdiag.Run() == (int)Gtk.ResponseType.Ok) {
string filename = fdiag.Filename;
- SaveCombine(filename);
+ Save (filename);
Runtime.MessageService.ShowMessage(filename, GettextCatalog.GetString ("Combine saved"));
}
@@ -383,157 +233,53 @@
}
}
- public object AddEntry(string filename)
+ public CombineEntry AddEntry (string filename)
{
- if (Path.GetExtension(filename).ToUpper() == ".PRJX") {
- IProject project = LoadProject(filename);
- ProjectCombineEntry newEntry = new ProjectCombineEntry(project, filename);
- entries.Add(newEntry);
- combineExecuteDefinitions.Add(new CombineExecuteDefinition(newEntry, EntryExecuteType.None));
- if (startProject == null)
- startProject = project.Name;
-
- if (configurations.Count == 0) {
- foreach (IConfiguration pconf in project.Configurations) {
- if (pconf.Name == null)
- continue;
- CombineConfiguration cconf = new CombineConfiguration(pconf.Name, this);
- configurations[pconf.Name] = cconf;
- if (ActiveConfiguration == null)
- ActiveConfiguration = cconf;
- }
- }
-
- foreach (DictionaryEntry entry in configurations) {
- CombineConfiguration conf = (CombineConfiguration)entry.Value;
- conf.AddEntry(project);
- }
- if (eventsAllowed)
- OnEntryAdded (new CombineEntryEventArgs (this, newEntry));
-
- newEntry.Project.FileRemovedFromProject += fileAddedToProjectHandler;
- newEntry.Project.FileAddedToProject += fileRemovedFromProjectHandler;
- newEntry.Project.FileChangedInProject += fileChangedInProjectHandler;
- newEntry.Project.ReferenceRemovedFromProject += referenceAddedToProjectHandler;
- newEntry.Project.ReferenceAddedToProject += referenceRemovedFromProjectHandler;
-
- return project;
- } else {
- Combine combine = new Combine(filename);
- CombineCombineEntry newEntry = new CombineCombineEntry(combine, filename);
- entries.Add(newEntry);
- combineExecuteDefinitions.Add(new CombineExecuteDefinition(newEntry, EntryExecuteType.None));
- if (startProject == null)
- startProject = combine.Name;
-
- if (configurations.Count == 0) {
- foreach (DictionaryEntry dentry in combine.Configurations) {
- CombineConfiguration cconf = ((CombineConfiguration)dentry.Value);
- configurations[cconf.Name] = new CombineConfiguration(cconf.Name, this);
- if (ActiveConfiguration == null)
- ActiveConfiguration = cconf;
- }
- }
-
- foreach (DictionaryEntry entry in configurations) {
- CombineConfiguration conf = (CombineConfiguration)entry.Value;
- conf.AddEntry(combine);
- }
- if (eventsAllowed)
- OnEntryAdded (new CombineEntryEventArgs (this, newEntry));
-
- newEntry.Combine.FileRemovedFromProject += fileAddedToProjectHandler;
- newEntry.Combine.FileAddedToProject += fileRemovedFromProjectHandler;
- newEntry.Combine.FileChangedInProject += fileChangedInProjectHandler;
- newEntry.Combine.ReferenceRemovedFromProject += referenceAddedToProjectHandler;
- newEntry.Combine.ReferenceAddedToProject += referenceRemovedFromProjectHandler;
-
- return combine;
- }
+ CombineEntry entry = Runtime.ProjectService.ReadFile (filename);
+ Entries.Add (entry);
+ return entry;
}
-
+
public void RemoveEntry (CombineEntry entry)
{
- ProjectCombineEntry pce = entry as ProjectCombineEntry;
+ Project pce = entry as Project;
if (pce != null) {
- pce.Project.FileRemovedFromProject -= fileAddedToProjectHandler;
- pce.Project.FileAddedToProject -= fileRemovedFromProjectHandler;
- pce.Project.FileChangedInProject -= fileChangedInProjectHandler;
- pce.Project.ReferenceRemovedFromProject -= referenceAddedToProjectHandler;
- pce.Project.ReferenceAddedToProject -= referenceRemovedFromProjectHandler;
+ pce.FileRemovedFromProject -= fileAddedToProjectHandler;
+ pce.FileAddedToProject -= fileRemovedFromProjectHandler;
+ pce.FileChangedInProject -= fileChangedInProjectHandler;
+ pce.ReferenceRemovedFromProject -= referenceAddedToProjectHandler;
+ pce.ReferenceAddedToProject -= referenceRemovedFromProjectHandler;
}
else {
- CombineCombineEntry cce = entry as CombineCombineEntry;
+ Combine cce = entry as Combine;
if (cce != null) {
- cce.Combine.FileRemovedFromProject -= fileAddedToProjectHandler;
- cce.Combine.FileAddedToProject -= fileRemovedFromProjectHandler;
- cce.Combine.FileChangedInProject -= fileChangedInProjectHandler;
- cce.Combine.ReferenceRemovedFromProject -= referenceAddedToProjectHandler;
- cce.Combine.ReferenceAddedToProject -= referenceRemovedFromProjectHandler;
+ cce.FileRemovedFromProject -= fileAddedToProjectHandler;
+ cce.FileAddedToProject -= fileRemovedFromProjectHandler;
+ cce.FileChangedInProject -= fileChangedInProjectHandler;
+ cce.ReferenceRemovedFromProject -= referenceAddedToProjectHandler;
+ cce.ReferenceAddedToProject -= referenceRemovedFromProjectHandler;
}
}
- entries.Remove (entry);
- OnEntryRemoved (new CombineEntryEventArgs (this, entry));
+ Entries.Remove (entry);
+ OnEntryRemoved (new CombineEntryEventArgs (entry));
}
- public void SaveAllProjects()
+ public override void Debug ()
{
- foreach (CombineEntry entry in entries) {
- entry.Save();
- }
- }
-
- public int GetEntryNumber(string name)
- {
- for (int i = 0; i < entries.Count; ++i) {
- if (((CombineEntry)entries[i]).Name == name) {
- return i;
- }
- }
- return -1;
- }
-
- public CombineEntry GetEntry(string name)
- {
- for (int i = 0; i < entries.Count; ++i) {
- if (((CombineEntry)entries[i]).Name == name) {
- return (CombineEntry)entries[i];
- }
- }
- return null;
- }
-
- void StartProject(int nr)
- {
- CombineEntry entry = (CombineEntry)entries[nr];
- entry.Execute();
- }
-
- void StartProject(string name)
- {
- int entrynum = GetEntryNumber(name);
- if (entrynum == -1) {
- throw new NoStartupCombineDefinedException();
- }
- StartProject(entrynum);
- }
-
- public void Debug ()
- {
- CombineEntry entry = (CombineEntry)entries[GetEntryNumber (startProject)];
+ CombineEntry entry = Entries [startProject];
entry.Debug ();
}
- public void Execute()
+ public override void Execute()
{
if (singleStartup) {
- StartProject(startProject);
+ CombineEntry entry = (CombineEntry) Entries [startProject];
+ entry.Execute();
} else {
foreach (CombineExecuteDefinition ced in combineExecuteDefinitions) {
- if (ced.Type == EntryExecuteType.Execute) {
- StartProject(entries.IndexOf(ced.Entry));
- }
+ if (ced.Type == EntryExecuteType.Execute)
+ ced.Entry.Execute ();
}
}
}
@@ -542,43 +288,38 @@
/// Returns an ArrayList containing all ProjectEntries in this combine and
/// undercombines
/// </remarks>
- public static ArrayList GetAllProjects(Combine combine)
+ public CombineEntryCollection GetAllProjects ()
{
- ArrayList list = new ArrayList();
- GetAllProjects(list, combine);
+ CombineEntryCollection list = new CombineEntryCollection();
+ GetAllProjects (list);
return list;
}
- static void GetAllProjects(ArrayList list, Combine combine)
+ void GetAllProjects (CombineEntryCollection list)
{
- if (combine != null && combine.Entries != null) {
- foreach (CombineEntry entry in combine.Entries) {
- if (entry is ProjectCombineEntry) {
- list.Add((ProjectCombineEntry)entry);
- } else {
- GetAllProjects(list, ((CombineCombineEntry)entry).Combine);
- }
+ foreach (CombineEntry entry in Entries) {
+ if (entry is Project) {
+ list.Add (entry);
+ } else if (entry is Combine) {
+ ((Combine)entry).GetAllProjects (list);
}
- } else {
- Console.WriteLine("combine or combine.Entries == null");
}
}
- public ProjectCombineEntry GetProjectEntryContaining(string fileName)
+ public Project GetProjectEntryContaining (string fileName)
{
- ArrayList projects = new ArrayList();
- GetAllProjects(projects, this);
- foreach (ProjectCombineEntry projectEntry in projects) {
- if (projectEntry.Project.IsFileInProject(fileName)) {
+ CombineEntryCollection projects = GetAllProjects ();
+ foreach (Project projectEntry in projects) {
+ if (projectEntry.IsFileInProject(fileName)) {
return projectEntry;
}
}
return null;
}
- ArrayList TopologicalSort(ArrayList allProjects)
+ CombineEntryCollection TopologicalSort (CombineEntryCollection allProjects)
{
- ArrayList sortedEntries = new ArrayList(allProjects.Count);
+ CombineEntryCollection sortedEntries = new CombineEntryCollection ();
bool[] inserted = new bool[allProjects.Count];
bool[] triedToInsert = new bool[allProjects.Count];
for (int i = 0; i < allProjects.Count; ++i) {
@@ -592,17 +333,17 @@
return sortedEntries;
}
- void Insert(int index, ArrayList allProjects, ArrayList sortedEntries, bool[] inserted, bool[] triedToInsert)
+ void Insert(int index, CombineEntryCollection allProjects, CombineEntryCollection sortedEntries, bool[] inserted, bool[] triedToInsert)
{
if (triedToInsert[index]) {
throw new CyclicBuildOrderException();
}
triedToInsert[index] = true;
- foreach (ProjectReference reference in ((ProjectCombineEntry)allProjects[index]).Project.ProjectReferences) {
+ foreach (ProjectReference reference in ((Project)allProjects[index]).ProjectReferences) {
if (reference.ReferenceType == ReferenceType.Project) {
int j = 0;
for (; j < allProjects.Count; ++j) {
- if (reference.Reference == ((ProjectCombineEntry)allProjects[j]).Name) {
+ if (reference.Reference == ((Project)allProjects[j]).Name) {
if (!inserted[j]) {
Insert(j, allProjects, sortedEntries, inserted, triedToInsert);
}
@@ -615,40 +356,55 @@
inserted[index] = true;
}
- public void Build(bool doBuildAll)
+ public override void Clean ()
{
- ArrayList allProjects = GetAllProjects(this);
+ foreach (CombineEntry entry in Entries)
+ entry.Clean ();
+ }
+
+ public override void Build ()
+ {
+ CombineEntryCollection allProjects = GetAllProjects ();
try {
allProjects = TopologicalSort(allProjects);
} catch (CyclicBuildOrderException) {
Runtime.MessageService.ShowError(GettextCatalog.GetString ("Cyclic dependencies can not be built with this version.\nBut we are working on it."));
return;
}
- foreach (ProjectCombineEntry entry in allProjects) {
- entry.Build(doBuildAll);
+ foreach (Project entry in allProjects) {
+ entry.Build ();
if (Runtime.TaskService.Errors > 0) {
break;
}
}
}
+ public override string GetOutputFileName ()
+ {
+ return String.Empty;
+ }
+
public void GenerateMakefiles ()
{
- ArrayList allProjects = TopologicalSort (GetAllProjects (this));
+ GenerateMakefiles (null);
+ }
+
+ public override void GenerateMakefiles (Combine parentCombine)
+ {
+ CombineEntryCollection allProjects = TopologicalSort (GetAllProjects ());
ArrayList projects = new ArrayList ();
foreach (CombineEntry entry in allProjects) {
- if (entry is ProjectCombineEntry) {
+ if (entry is Project) {
entry.GenerateMakefiles (this);
- projects.Add (((ProjectCombineEntry)entry).Project);
+ projects.Add ((Project)entry);
}
else
Console.WriteLine ("Dont know how to generate makefiles for " + entry);
}
- FileUtilityService fileUtilityService = Runtime.FileUtilityService;
- string rel_outputdir = fileUtilityService.AbsoluteToRelativePath (path, outputdir);
+ string rel_outputdir = Runtime.FileUtilityService.AbsoluteToRelativePath (BaseDirectory, outputdir);
- StreamWriter buildstream = new StreamWriter (Path.Combine (path, "make.sh"));
+ StreamWriter buildstream = new StreamWriter (Path.Combine (BaseDirectory, "make.sh"));
buildstream.WriteLine ("#!/bin/sh");
buildstream.WriteLine ("# This file is autogenerated by MonoDevelop");
buildstream.WriteLine ("# Do not edit it.");
@@ -657,9 +413,9 @@
buildstream.Flush ();
buildstream.Close ();
- Syscall.chmod (Path.Combine (path, "make.sh"), FileMode.S_IRUSR | FileMode.S_IWUSR | FileMode.S_IXUSR | FileMode.S_IRGRP | FileMode.S_IWGRP | FileMode.S_IROTH);
+ Syscall.chmod (Path.Combine (BaseDirectory, "make.sh"), FileMode.S_IRUSR | FileMode.S_IWUSR | FileMode.S_IXUSR | FileMode.S_IRGRP | FileMode.S_IWGRP | FileMode.S_IROTH);
- StreamWriter stream = new StreamWriter (Path.Combine (path, "Makefile.solution." + Name.Replace (" ", "")));
+ StreamWriter stream = new StreamWriter (Path.Combine (BaseDirectory, "Makefile.solution." + Name.Replace (" ", "")));
stream.WriteLine ("# This file is autogenerated by MonoDevelop");
stream.WriteLine ("# Do not edit it.");
stream.WriteLine ();
@@ -669,7 +425,7 @@
stream.WriteLine ("OUTPUTDIR := {0}", rel_outputdir);
stream.WriteLine ();
stream.Write ("all: depcheck __init ");
- foreach (IProject proj in projects) {
+ foreach (Project proj in projects) {
stream.Write ("Makefile.{0}.all ", proj.Name.Replace (" ",""));
}
stream.WriteLine ();
@@ -680,14 +436,14 @@
stream.WriteLine ();
stream.Write ("clean: ");
- foreach (IProject proj in projects) {
+ foreach (Project proj in projects) {
stream.Write ("Makefile.{0}.clean ", proj.Name.Replace (" ", ""));
}
stream.WriteLine ();
stream.WriteLine ();
stream.Write ("depcheck: ");
- foreach (IProject proj in projects) {
+ foreach (Project proj in projects) {
stream.Write ("Makefile.{0}.depcheck ", proj.Name.Replace (" ", ""));
}
stream.WriteLine ();
@@ -697,15 +453,15 @@
if (!SingleStartupProject) {
stream.WriteLine ("\t@echo `run'ning multiple startup projects is not yet support");
} else {
- if (SingleStartProjectName != null && GetEntry (SingleStartProjectName) != null)
- stream.WriteLine ("\tcd $(OUTPUTDIR) && $(RUNTIME) {0}", GetEntry (SingleStartProjectName).GetOutputName ());
+ if (SingleStartProjectName != null && Entries [SingleStartProjectName] != null)
+ stream.WriteLine ("\tcd $(OUTPUTDIR) && $(RUNTIME) {0}", Entries [SingleStartProjectName].GetOutputFileName ());
else
stream.WriteLine ("\t@echo No startup project defined");
}
stream.WriteLine ();
- foreach (IProject proj in projects) {
- string relativeLocation = fileUtilityService.AbsoluteToRelativePath (path, proj.BaseDirectory);
+ foreach (Project proj in projects) {
+ string relativeLocation = Runtime.FileUtilityService.AbsoluteToRelativePath (BaseDirectory, proj.BaseDirectory);
stream.WriteLine ("Makefile.{0}.%:", proj.Name.Replace (" ", ""));
stream.WriteLine ("\t@cd {0} && $(MAKE) -f $(subst .$*,,$@) $*", relativeLocation);
stream.WriteLine ();
@@ -747,14 +503,6 @@
}
}
-
- protected virtual void OnNameChanged(EventArgs e)
- {
- if (NameChanged != null) {
- NameChanged(this, e);
- }
- }
-
protected virtual void OnEntryAdded(CombineEntryEventArgs e)
{
if (EntryAdded != null) {
@@ -804,7 +552,6 @@
}
}
- public event EventHandler NameChanged;
public event EventHandler StartupPropertyChanged;
public event CombineEntryEventHandler EntryAdded;
public event CombineEntryEventHandler EntryRemoved;
@@ -830,7 +577,7 @@
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
{
Combine combine = (Combine)context.Instance;
- foreach (IConfiguration configuration in combine.Configurations.Values) {
+ foreach (IConfiguration configuration in combine.Configurations) {
if (configuration.Name == value.ToString()) {
return configuration;
}
@@ -860,7 +607,7 @@
public override System.ComponentModel.TypeConverter.StandardValuesCollection GetStandardValues(System.ComponentModel.ITypeDescriptorContext context)
{
- return new TypeConverter.StandardValuesCollection(((Combine)context.Instance).Configurations.Values);
+ return new TypeConverter.StandardValuesCollection(((Combine)context.Instance).Configurations);
}
}
}
Index: Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineEntryEventArgs.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineEntryEventArgs.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineEntryEventArgs.cs (working copy)
@@ -14,24 +14,16 @@
public class CombineEntryEventArgs : EventArgs
{
- Combine combine;
CombineEntry entry;
- public Combine Combine {
- get {
- return combine;
- }
- }
-
public CombineEntry CombineEntry {
get {
return entry;
}
}
- public CombineEntryEventArgs (Combine combine, CombineEntry entry)
+ public CombineEntryEventArgs (CombineEntry entry)
{
- this.combine = combine;
this.entry = entry;
}
}
Index: Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineEntry.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineEntry.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineEntry.cs (working copy)
@@ -16,257 +16,174 @@
using MonoDevelop.Core.Properties;
using MonoDevelop.Core.Services;
using MonoDevelop.Gui;
+using MonoDevelop.Gui.Components;
using MonoDevelop.Internal.Project;
using MonoDevelop.Services;
+using MonoDevelop.Internal.Serialization;
namespace MonoDevelop.Internal.Project
{
- public abstract class CombineEntry : IDisposable
+ public abstract class CombineEntry : ICustomDataItem, IDisposable
{
public static int BuildProjects = 0;
public static int BuildErrors = 0;
- object entry;
+ [ItemProperty ("Configurations")]
+ [ItemProperty ("Configuration", ValueType=typeof(IConfiguration), Scope=1)]
+ ArrayList configurations = new ArrayList();
+
+ Combine parentCombine;
+ IConfiguration activeConfiguration;
+ string name;
+ string path;
- ArrayList dependencies = new ArrayList();
+ public event CombineEntryRenamedEventHandler NameChanged;
- string filename;
- public string Filename {
+ [ItemProperty ("name")]
+ public virtual string Name {
get {
- return filename;
+ return name;
}
set {
- filename = value;
+ if (name != value && value != null && value.Length > 0) {
+ string oldName = name;
+ name = value;
+ OnNameChanged (new CombineEntryRenamedEventArgs (this, oldName, name));
+ }
}
}
- public abstract string Name {
- get;
- }
-
- public object Entry {
+ public virtual string FileName {
get {
- return entry;
+ if (parentCombine != null)
+ return parentCombine.GetAbsoluteChildPath (path);
+ else
+ return path;
}
+ set {
+ if (parentCombine != null)
+ path = parentCombine.GetRelativeChildPath (value);
+ else
+ path = value;
+ }
}
- public CombineEntry(object entry, string filename)
- {
- this.entry = entry;
- this.filename = filename;
+ public virtual string RelativeFileName {
+ get { return path; }
}
- public void Dispose()
- {
- if (entry is IDisposable) {
- ((IDisposable)entry).Dispose();
- }
+ public string BaseDirectory {
+ get { return Path.GetDirectoryName (FileName); }
}
- public abstract void Build(bool doBuildAll);
- public abstract void Execute();
- public abstract void Save();
- public abstract void Debug ();
- public abstract void GenerateMakefiles (Combine parentCombine);
- public abstract string GetOutputName ();
- }
-
- public class ProjectCombineEntry : CombineEntry
- {
- IProject project;
- bool isDirty = true;
-
- public bool IsDirty {
- get {
- return isDirty;
- }
- set {
- isDirty = value;
- }
+ [ItemProperty ("fileversion")]
+ protected virtual string CurrentFileVersion {
+ get { return "2.0"; }
+ set {}
}
- public IProject Project {
- get {
- return project;
- }
+ public virtual void Save (string fileName)
+ {
+ FileName = fileName;
+ Save ();
}
- public override string Name {
- get {
- return project.Name;
- }
+ public virtual void Save ()
+ {
+ Runtime.ProjectService.WriteFile (FileName, this);
}
- public ProjectCombineEntry(IProject project, string filename) : base(project, filename)
+ internal void SetParentCombine (Combine combine)
{
- this.project = project;
+ parentCombine = combine;
+ if (path != null)
+ path = parentCombine.GetRelativeChildPath (path);
}
-
- public override void Build(bool doBuildAll)
- { // if you change something here look at the DefaultProjectService BeforeCompile method
- if (doBuildAll || isDirty) {
- Runtime.StringParserService.Properties["Project"] = Name;
- TaskService taskService = Runtime.TaskService;
-
- Runtime.Gui.StatusBar.SetMessage(String.Format (GettextCatalog.GetString ("Compiling: {0}"), Project.Name));
-
- // create output directory, if not exists
- string outputDir = ((AbstractProjectConfiguration)project.ActiveConfiguration).OutputDirectory;
- try {
- DirectoryInfo directoryInfo = new DirectoryInfo(outputDir);
- if (!directoryInfo.Exists) {
- directoryInfo.Create();
- }
- } catch (Exception e) {
- throw new ApplicationException("Can't create project output directory " + outputDir + " original exception:\n" + e.ToString());
- }
-
- ILanguageBinding csc = Runtime.Languages.GetBindingPerLanguageName(project.ProjectType);
-
- AbstractProjectConfiguration conf = project.ActiveConfiguration as AbstractProjectConfiguration;
-
- taskService.CompilerOutput += String.Format (GettextCatalog.GetString ("------ Build started: Project: {0} Configuration: {1} ------\n\nPerforming main compilation...\n"), Project.Name, Project.ActiveConfiguration.Name);
-
- if (conf != null && File.Exists(conf.ExecuteBeforeBuild)) {
- taskService.CompilerOutput += String.Format (GettextCatalog.GetString ("Execute : {0}"), conf.ExecuteBeforeBuild);
- ProcessStartInfo ps = new ProcessStartInfo(conf.ExecuteBeforeBuild);
- ps.UseShellExecute = false;
- ps.RedirectStandardOutput = true;
- ps.WorkingDirectory = Path.GetDirectoryName(conf.ExecuteBeforeBuild);
- Process process = new Process();
- process.StartInfo = ps;
- process.Start();
- taskService.CompilerOutput += process.StandardOutput.ReadToEnd();
- }
-
- ICompilerResult res = csc.CompileProject(project);
-
- if (conf != null && File.Exists(conf.ExecuteAfterBuild)) {
- taskService.CompilerOutput += String.Format (GettextCatalog.GetString ("Execute : {0}"), conf.ExecuteAfterBuild);
- ProcessStartInfo ps = new ProcessStartInfo(conf.ExecuteAfterBuild);
- ps.UseShellExecute = false;
- ps.RedirectStandardOutput = true;
- ps.WorkingDirectory = Path.GetDirectoryName(conf.ExecuteAfterBuild);
- Process process = new Process();
- process.StartInfo = ps;
- process.Start();
- taskService.CompilerOutput += process.StandardOutput.ReadToEnd();
- }
-
- isDirty = false;
- foreach (CompilerError err in res.CompilerResults.Errors) {
- isDirty = true;
- taskService.AddTask(new Task(project, err));
- }
-
- if (taskService.Errors > 0) {
- ++BuildErrors;
- } else {
- ++BuildProjects;
- }
-
- taskService.CompilerOutput += String.Format (GettextCatalog.GetString ("Build complete -- {0} errors, {1} warnings\n\n"), taskService.Errors.ToString (), taskService.Warnings.ToString ());
+ public ArrayList Configurations {
+ get {
+ return configurations;
}
}
- public override void Execute()
- {
- ILanguageBinding binding = Runtime.Languages.GetBindingPerLanguageName(project.ProjectType);
- if (binding == null) {
- throw new ApplicationException("can't find language binding for project ");
- }
-
- if (Runtime.TaskService.Errors == 0) {
- if (Runtime.TaskService.Warnings == 0 || project.ActiveConfiguration != null && ((AbstractProjectConfiguration)project.ActiveConfiguration).RunWithWarnings) {
- project.CopyReferencesToOutputPath (true);
- binding.Execute(project);
+ public IConfiguration ActiveConfiguration {
+ get {
+ if (activeConfiguration == null && configurations.Count > 0) {
+ return (IConfiguration)configurations[0];
}
+ return activeConfiguration;
}
-
+ set {
+ activeConfiguration = value;
+ }
}
-
- public override void Debug ()
+
+ public virtual DataCollection Serialize (ITypeSerializer handler)
{
- ILanguageBinding binding = Runtime.Languages.GetBindingPerLanguageName (project.ProjectType);
- if (binding == null) {
- Console.WriteLine ("Language binding unknown");
- return;
+ DataCollection data = handler.Serialize (this);
+ if (activeConfiguration != null) {
+ DataItem confItem = data ["Configurations"] as DataItem;
+ confItem.UniqueNames = true;
+ if (confItem != null)
+ confItem.ItemData.Add (new DataValue ("active", activeConfiguration.Name));
}
- if (Runtime.TaskService.Errors == 0)
- binding.DebugProject (project);
+ return data;
}
- public override void Save()
+ public virtual void Deserialize (ITypeSerializer handler, DataCollection data)
{
- project.SaveProject(Filename);
+ DataValue ac = null;
+ DataItem confItem = data ["Configurations"] as DataItem;
+ if (confItem != null)
+ ac = (DataValue) confItem.ItemData.Extract ("active");
+
+ handler.Deserialize (this, data);
+ if (ac != null)
+ activeConfiguration = GetConfiguration (ac.Value);
}
-
- public override void GenerateMakefiles (Combine parentCombine)
+
+ public IConfiguration GetConfiguration (string name)
{
- Console.WriteLine ("Generating makefiles for " + Name);
- ILanguageBinding langBinding = Runtime.Languages.GetBindingPerLanguageName(project.ProjectType);
- langBinding.GenerateMakefile (project, parentCombine);
+ if (configurations != null) {
+ foreach (IConfiguration conf in configurations)
+ if (conf.Name == name) return conf;
+ }
+ return null;
}
- public override string GetOutputName ()
+ public string GetAbsoluteChildPath (string relPath)
{
- ILanguageBinding langBinding = Runtime.Languages.GetBindingPerLanguageName (project.ProjectType);
- return System.IO.Path.GetFileName (langBinding.GetCompiledOutputName (project));
+ if (Path.IsPathRooted (relPath))
+ return relPath;
+ else
+ return Runtime.FileUtilityService.RelativeToAbsolutePath (BaseDirectory, relPath);
}
- }
-
- public class CombineCombineEntry : CombineEntry
- {
- Combine combine;
- public Combine Combine {
- get {
- return combine;
- }
- }
- public override string Name {
- get {
- return combine.Name;
- }
- }
-
- public CombineCombineEntry(Combine combine, string filename) : base(combine, filename)
+ public string GetRelativeChildPath (string absPath)
{
- this.combine = combine;
+ return Runtime.FileUtilityService.AbsoluteToRelativePath (BaseDirectory, absPath);
}
- public override void Build(bool doBuildAll)
+ public virtual void Dispose()
{
- combine.Build(doBuildAll);
}
- public override void Execute()
+ protected virtual void OnNameChanged (CombineEntryRenamedEventArgs e)
{
- combine.Execute();
+ if (NameChanged != null) {
+ NameChanged (this, e);
+ }
}
- public override void Save()
- {
- combine.SaveCombine(System.IO.Path.GetFullPath (Filename));
- combine.SaveAllProjects();
- }
-
- public override void Debug ()
- {
- combine.Debug ();
- }
-
- public override void GenerateMakefiles (Combine parentCombine)
- {
- }
-
- public override string GetOutputName ()
- {
- return String.Empty;
- }
+ public abstract void Clean ();
+ public abstract void Build ();
+ public abstract void Execute();
+ public abstract void Debug ();
+ public abstract void GenerateMakefiles (Combine parentCombine);
+ public abstract string GetOutputFileName ();
+ public abstract bool NeedsBuilding { get; set; }
+
}
-
public interface ICombineEntryCollection: IEnumerable
{
@@ -277,7 +194,17 @@
public class CombineEntryCollection: ICombineEntryCollection
{
ArrayList list = new ArrayList ();
+ Combine parentCombine;
+ internal CombineEntryCollection ()
+ {
+ }
+
+ internal CombineEntryCollection (Combine combine)
+ {
+ parentCombine = combine;
+ }
+
public int Count
{
get { return list.Count; }
@@ -288,6 +215,16 @@
get { return (CombineEntry) list[n]; }
}
+ public CombineEntry this [string name]
+ {
+ get {
+ for (int n=0; n<list.Count; n++)
+ if (((CombineEntry)list[n]).Name == name)
+ return (CombineEntry)list[n];
+ return null;
+ }
+ }
+
public IEnumerator GetEnumerator ()
{
return list.GetEnumerator ();
@@ -296,6 +233,10 @@
public void Add (CombineEntry entry)
{
list.Add (entry);
+ if (parentCombine != null) {
+ entry.SetParentCombine (parentCombine);
+ parentCombine.NotifyEntryAdded (entry);
+ }
}
public void Remove (CombineEntry entry)
@@ -308,6 +249,14 @@
return list.IndexOf (entry);
}
+ public int IndexOf (string name)
+ {
+ for (int n=0; n<list.Count; n++)
+ if (((CombineEntry)list[n]).Name == name)
+ return n;
+ return -1;
+ }
+
public void Clear ()
{
list.Clear ();
Index: Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineConfiguration.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineConfiguration.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineConfiguration.cs (working copy)
@@ -14,80 +14,76 @@
using System.CodeDom.Compiler;
using MonoDevelop.Internal.Project;
+using MonoDevelop.Internal.Serialization;
using MonoDevelop.Core.Properties;
using MonoDevelop.Gui;
namespace MonoDevelop.Internal.Project
{
- public class CombineConfiguration : AbstractConfiguration, IXmlConvertable
+ public class CombineConfiguration : AbstractConfiguration
{
+ [ExpandedCollection]
+ [ItemProperty]
+ [ItemProperty ("Entry", ValueType=typeof(Config), Scope=1)]
ArrayList configurations = new ArrayList();
- Combine combine;
+ [DataItem ("Entry")]
public class Config
{
+ [ItemProperty ("name")]
+ string entryName;
+
public CombineEntry Entry;
- public string ConfigurationName;
- public bool Build;
+
+ [ItemProperty ("configurationname")]
+ public string ConfigurationName;
+
+ [ItemProperty ("build")]
+ public bool Build;
+
+ internal void SetCombine (Combine combine)
+ {
+ if (entryName != null)
+ Entry = combine.Entries [entryName];
+ }
}
- public Config GetConfiguration(int number)
+ public CombineConfiguration ()
{
- if (number < configurations.Count) {
- return (Config)configurations[number];
- }
- Debug.Assert(false, "Configuration number " + number + " not found.\n" + configurations.Count + " configurations avaiable.");
- return null;
}
- public CombineConfiguration(string name, Combine combine)
+ public CombineConfiguration (string name)
{
- this.combine = combine;
- this.Name = name;
+ this.Name = name;
}
- public CombineConfiguration(XmlElement element, Combine combine)
+ internal void SetCombine (Combine combine)
{
- this.combine = combine;
- Name = element.Attributes["name"].InnerText;
-
- XmlNodeList nodes = element.ChildNodes;
- foreach (XmlElement confignode in nodes) {
- Config config = new Config();
-
- config.Entry = combine.GetEntry(confignode.Attributes["name"].InnerText);
- config.ConfigurationName = confignode.Attributes["configurationname"].InnerText;
- config.Build = Boolean.Parse(confignode.Attributes["build"].InnerText);
-
- configurations.Add(config);
- }
+ foreach (Config conf in configurations)
+ conf.SetCombine (combine);
}
- public void AddEntry(IProject project)
+ public Config GetConfiguration(int number)
{
- Config conf = new Config();
- conf.Entry = combine.GetEntry(project.Name);
- conf.ConfigurationName = project.ActiveConfiguration.Name;
- conf.Build = false;
- configurations.Add(conf);
+ if (number < configurations.Count) {
+ return (Config)configurations[number];
+ }
+ Debug.Assert(false, "Configuration number " + number + " not found.\n" + configurations.Count + " configurations avaiable.");
+ return null;
}
- public void AddEntry(Combine combine)
+
+ public void AddEntry (CombineEntry combine)
{
Config conf = new Config();
- conf.Entry = this.combine.GetEntry(combine.Name);
+ conf.Entry = combine;
conf.ConfigurationName = combine.ActiveConfiguration != null ? combine.ActiveConfiguration.Name : String.Empty;
- conf.Build = false;
+ conf.Build = false;
configurations.Add(conf);
}
- public object FromXmlElement(XmlElement element)
+ public void RemoveEntry (CombineEntry entry)
{
- return null;
- }
-
- public void RemoveEntry(CombineEntry entry)
- {
Config removeConfig = null;
foreach (Config config in configurations) {
@@ -100,39 +96,5 @@
Debug.Assert(removeConfig != null);
configurations.Remove(removeConfig);
}
-
- public XmlElement ToXmlElement(XmlDocument doc)
- {
- if (combine == null)
- throw new ApplicationException("combine can't be null");
-
- XmlElement cel = doc.CreateElement("Configuration");
-
- XmlAttribute nameattr = doc.CreateAttribute("name");
- nameattr.InnerText = Name;
- cel.Attributes.Append(nameattr);
-
- foreach (Config config in configurations) {
- if (config == null || config.Entry == null) {
- continue;
- }
- XmlElement el = doc.CreateElement("Entry");
-
- XmlAttribute attr1 = doc.CreateAttribute("name");
- attr1.InnerText = config.Entry.Name;
- el.Attributes.Append(attr1);
-
- XmlAttribute attr2 = doc.CreateAttribute("configurationname");
- attr2.InnerText = config.ConfigurationName;
- el.Attributes.Append(attr2);
-
- XmlAttribute attr3 = doc.CreateAttribute("build");
- attr3.InnerText = config.Build.ToString();
- el.Attributes.Append(attr3);
-
- cel.AppendChild(el);
- }
- return cel;
- }
}
}
Index: Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineExecuteDefinition.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineExecuteDefinition.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineExecuteDefinition.cs (working copy)
@@ -5,6 +5,8 @@
// <version value="$version"/>
// </file>
+using MonoDevelop.Internal.Serialization;
+
namespace MonoDevelop.Internal.Project
{
public enum EntryExecuteType {
@@ -14,17 +16,40 @@
public class CombineExecuteDefinition
{
- public CombineEntry Entry = null;
- public EntryExecuteType Type = EntryExecuteType.None;
+ CombineEntry combineEntry;
+ [ItemProperty ("type")]
+ EntryExecuteType type = EntryExecuteType.None;
+
+ [ItemProperty]
+ string entry;
+
public CombineExecuteDefinition()
{
}
- public CombineExecuteDefinition(CombineEntry entry, EntryExecuteType type)
+ public CombineExecuteDefinition (CombineEntry entry, EntryExecuteType type)
{
- this.Entry = entry;
- this.Type = type;
+ Entry = entry;
+ this.type = type;
}
+
+ internal void SetCombine (Combine cmb)
+ {
+ combineEntry = cmb.Entries [entry];
+ }
+
+ public CombineEntry Entry {
+ get { return combineEntry; }
+ set {
+ combineEntry = value;
+ entry = value != null ? value.Name : null;
+ }
+ }
+
+ public EntryExecuteType Type {
+ get { return type; }
+ set { type = value; }
+ }
}
}
Index: Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineEntryRenamedEventArgs.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineEntryRenamedEventArgs.cs (revision 0)
+++ Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineEntryRenamedEventArgs.cs (revision 0)
@@ -0,0 +1,36 @@
+// <file>
+// <owner name="Lluis Sanchez" email="lluis@novell.com"/>
+// <version value="$version"/>
+// </file>
+
+using System;
+
+namespace MonoDevelop.Internal.Project
+{
+ public delegate void CombineEntryRenamedEventHandler (object sender, CombineEntryRenamedEventArgs e);
+
+ public class CombineEntryRenamedEventArgs : CombineEntryEventArgs
+ {
+ string oldName;
+ string newName;
+
+ public CombineEntryRenamedEventArgs (CombineEntry node, string oldName, string newName)
+ : base (node)
+ {
+ this.oldName = oldName;
+ this.newName = newName;
+ }
+
+ public string OldName {
+ get {
+ return oldName;
+ }
+ }
+
+ public string NewName {
+ get {
+ return newName;
+ }
+ }
+ }
+}
Index: Core/src/MonoDevelop.Base/Internal/Conditions/ProjectOpenCondition.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Conditions/ProjectOpenCondition.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Internal/Conditions/ProjectOpenCondition.cs (working copy)
@@ -36,12 +36,12 @@
public override bool IsValid(object owner)
{
- IProject project = Runtime.ProjectService.CurrentSelectedProject;
+ Project project = Runtime.ProjectService.CurrentSelectedProject;
if (project == null && Runtime.ProjectService.CurrentOpenCombine != null) {
- ArrayList projects = Combine.GetAllProjects(Runtime.ProjectService.CurrentOpenCombine);
+ CombineEntryCollection projects = Runtime.ProjectService.CurrentOpenCombine.GetAllProjects();
if (projects.Count > 0) {
- project = ((ProjectCombineEntry)projects[0]).Project;
+ project = (Project)projects[0];
}
}
Index: Core/src/MonoDevelop.Base/Internal/Conditions/LanguageActiveCondition.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Conditions/LanguageActiveCondition.cs (revision 0)
+++ Core/src/MonoDevelop.Base/Internal/Conditions/LanguageActiveCondition.cs (revision 0)
@@ -0,0 +1,48 @@
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Lluis Sanchez" email="lluis@novell.com"/>
+// <version value="$version"/>
+// </file>
+
+using System;
+using System.Collections;
+using System.Xml;
+
+
+using MonoDevelop.Core.AddIns.Conditions;
+using MonoDevelop.Core.Services;
+
+using MonoDevelop.Gui;
+using MonoDevelop.Services;
+using MonoDevelop.Internal.Project;
+
+namespace MonoDevelop.Core.AddIns
+{
+ [ConditionAttribute()]
+ public class LanguageActiveCondition : AbstractCondition
+ {
+ [XmlMemberAttribute("activelanguage", IsRequired = true)]
+ string activelanguage;
+
+ public string ActiveLanguage {
+ get {
+ return activelanguage;
+ }
+ set {
+ activelanguage = value;
+ }
+ }
+
+ public override bool IsValid(object owner)
+ {
+ DotNetProject project = Runtime.ProjectService.CurrentSelectedProject as DotNetProject;
+
+ if (activelanguage == "*") {
+ return project != null;
+ }
+ return project != null && project.LanguageName == activelanguage;
+ }
+ }
+
+}
Index: Core/src/MonoDevelop.Base/Internal/Conditions/ProjectActiveCondition.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Conditions/ProjectActiveCondition.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Internal/Conditions/ProjectActiveCondition.cs (working copy)
@@ -36,7 +36,7 @@
public override bool IsValid(object owner)
{
- IProject project = Runtime.ProjectService.CurrentSelectedProject;
+ Project project = Runtime.ProjectService.CurrentSelectedProject;
if (activeproject == "*") {
return project != null;
Index: Core/src/MonoDevelop.Base/Internal/Parser/IParser.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Parser/IParser.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Internal/Parser/IParser.cs (working copy)
@@ -11,6 +11,7 @@
using MonoDevelop.Services;
using MonoDevelop.Internal.Project;
+using Project = MonoDevelop.Internal.Project.Project;
namespace MonoDevelop.Internal.Parser
{
@@ -133,17 +134,17 @@
/// The caretLineNumber and caretColumn is 1 based.
/// </summary>
ResolveResult Resolve(IParserService parserService,
- IProject project,
+ Project project,
string expression,
int caretLineNumber,
int caretColumn,
string fileName,
string fileContent);
- string MonodocResolver (IParserService parserService, IProject project, string expression, int caretLineNumber, int caretColumn, string fileName, string fileContent);
+ string MonodocResolver (IParserService parserService, Project project, string expression, int caretLineNumber, int caretColumn, string fileName, string fileContent);
- ArrayList IsAsResolve (IParserService parserService, IProject project, string expression, int caretLineNumber, int caretColumn, string fileName, string fileContent);
+ ArrayList IsAsResolve (IParserService parserService, Project project, string expression, int caretLineNumber, int caretColumn, string fileName, string fileContent);
- ArrayList CtrlSpace(IParserService parserService, IProject project, int caretLine, int caretColumn, string fileName);
+ ArrayList CtrlSpace(IParserService parserService, Project project, int caretLine, int caretColumn, string fileName);
}
}
Index: Core/src/MonoDevelop.Base/Internal/Serialization/DataType.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Serialization/DataType.cs (revision 0)
+++ Core/src/MonoDevelop.Base/Internal/Serialization/DataType.cs (revision 0)
@@ -0,0 +1,65 @@
+
+using System;
+using System.Reflection;
+
+namespace MonoDevelop.Internal.Serialization
+{
+ public abstract class DataType
+ {
+ Type type;
+ DataContext ctx;
+ string name;
+
+ public DataType (Type type)
+ {
+ this.type = type;
+ name = type.Name;
+ }
+
+ internal void SetContext (DataContext ctx)
+ {
+ this.ctx = ctx;
+ Initialize ();
+ }
+
+ protected ItemPropertyAttribute FindPropertyAttribute (object[] attributes, int scope)
+ {
+ foreach (object at in attributes) {
+ ItemPropertyAttribute iat = at as ItemPropertyAttribute;
+ if (iat != null && iat.Scope == scope) return iat;
+ }
+ return null;
+ }
+
+ protected DataContext Context {
+ get { return ctx; }
+ }
+
+ public string Name {
+ get { return name; }
+ set { name = value; }
+ }
+
+ public Type ValueType {
+ get { return type; }
+ }
+
+ protected virtual void Initialize ()
+ {
+ }
+
+ internal protected virtual object GetMapData (object[] attributes, int scope)
+ {
+ return null;
+ }
+
+ public abstract DataNode Serialize (SerializationContext serCtx, object mapData, object value);
+ public abstract object Deserialize (SerializationContext serCtx, object mapData, DataNode data);
+ public virtual void Deserialize (SerializationContext serCtx, object mapData, DataNode data, object valueInstance)
+ { throw new InvalidOperationException ("Could not create instance for type '" + ValueType + "'"); }
+
+ public abstract bool IsSimpleType { get; }
+ public abstract bool CanCreateInstance { get; }
+ public abstract bool CanReuseInstance { get; }
+ }
+}
Index: Core/src/MonoDevelop.Base/Internal/Serialization/ArrayHandler.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Serialization/ArrayHandler.cs (revision 0)
+++ Core/src/MonoDevelop.Base/Internal/Serialization/ArrayHandler.cs (revision 0)
@@ -0,0 +1,99 @@
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Lluis Sanchez" email="lluis@novell.com"/>
+// <version value="$version"/>
+// </file>
+
+using System;
+using System.Reflection;
+
+namespace MonoDevelop.Internal.Serialization
+{
+ internal class ArrayHandler: ICollectionHandler
+ {
+ Type _type;
+ Type _elementType;
+
+ public ArrayHandler (Type type)
+ {
+ _type = type;
+ _elementType = type.GetElementType ();
+ }
+
+ public Type GetItemType ()
+ {
+ return _elementType;
+ }
+
+ public bool CanCreateInstance {
+ get { return true; }
+ }
+
+ public object CreateCollection (out object position, int size)
+ {
+ position = 0;
+ return Array.CreateInstance (_elementType, size != -1 ? size : 5);
+ }
+
+ public void ResetCollection (object collection, out object position, int size)
+ {
+ throw new InvalidOperationException ("Array instance could not be reused.");
+ }
+
+ public void AddItem (ref object collection, ref object position, object item)
+ {
+ int i = (int)position;
+ Array ar = (Array) collection;
+ if (i >= ar.Length) {
+ Array newArray = Array.CreateInstance (_elementType, ar.Length + 5);
+ Array.Copy (ar, newArray, ar.Length);
+ collection = newArray;
+ newArray.SetValue (item, i);
+ }
+ else
+ ar.SetValue (item, i);
+ position = i + 1;
+ }
+
+ public void SetItem (object collection, object position, object item)
+ {
+ int i = (int)position;
+ ((Array) collection).SetValue (item, i);
+ }
+
+ public void FinishCreation (ref object collection, object position)
+ {
+ int i = (int)position;
+ Array ar = (Array) collection;
+ if (i < ar.Length) {
+ Array newArray = Array.CreateInstance (_elementType, i);
+ Array.Copy (ar, newArray, i);
+ collection = newArray;
+ }
+ }
+
+ public bool IsEmpty (object collection)
+ {
+ return collection == null || ((Array)collection).Length == 0;
+ }
+
+ public object GetInitialPosition (object collection)
+ {
+ return -1;
+ }
+
+ public bool MoveNextItem (object collection, ref object position)
+ {
+ int i = (int) position;
+ position = ++i;
+ Array ar = (Array) collection;
+ return i < ar.Length;
+ }
+
+ public object GetCurrentItem (object collection, object position)
+ {
+ return ((Array)collection).GetValue ((int)position);
+ }
+ }
+}
Index: Core/src/MonoDevelop.Base/Internal/Serialization/DataItemAttribute.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Serialization/DataItemAttribute.cs (revision 0)
+++ Core/src/MonoDevelop.Base/Internal/Serialization/DataItemAttribute.cs (revision 0)
@@ -0,0 +1,22 @@
+using System;
+using System.Xml;
+using System.Collections;
+
+namespace MonoDevelop.Internal.Serialization
+{
+ [AttributeUsage (AttributeTargets.Class, AllowMultiple = false)]
+ public class DataItemAttribute: Attribute
+ {
+ string name;
+
+ public DataItemAttribute (string name)
+ {
+ this.name = name;
+ }
+
+ public string Name {
+ get { return name; }
+ set { name = value; }
+ }
+ }
+}
Index: Core/src/MonoDevelop.Base/Internal/Serialization/DataContext.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Serialization/DataContext.cs (revision 0)
+++ Core/src/MonoDevelop.Base/Internal/Serialization/DataContext.cs (revision 0)
@@ -0,0 +1,112 @@
+// <file>
+// <owner name="Lluis Sanchez" email="lluis@novell.com"/>
+// <version value="$version"/>
+// </file>
+
+using System;
+using System.Xml;
+using System.Collections;
+
+namespace MonoDevelop.Internal.Serialization
+{
+ public class DataContext
+ {
+ Hashtable configurationTypes = new Hashtable ();
+ object[] emptyAttributes = new object[0];
+
+ public virtual SerializationContext CreateSerializationContext ()
+ {
+ return new SerializationContext ();
+ }
+
+ public DataNode SaveConfigurationData (SerializationContext serCtx, object obj, Type type)
+ {
+ if (type == null) type = obj.GetType ();
+ DataType dataType = GetConfigurationDataType (type);
+ return dataType.Serialize (serCtx, null, obj);
+ }
+
+ public object LoadConfigurationData (SerializationContext serCtx, Type type, DataNode data)
+ {
+ DataType dataType = GetConfigurationDataType (type);
+ return dataType.Deserialize (serCtx, null, data);
+ }
+
+ public void SetConfigurationItemData (SerializationContext serCtx, object obj, DataItem data)
+ {
+ ClassDataType dataType = (ClassDataType) GetConfigurationDataType (obj.GetType ());
+ dataType.SetConfigurationItemData (serCtx, obj, data);
+ }
+
+ public void RegisterProperty (Type targetType, string name, Type propertyType)
+ {
+ if (!typeof(IExtendedDataItem).IsAssignableFrom (targetType))
+ throw new InvalidOperationException ("The type '" + targetType + "' does not implement the IExtendedDataItem interface and cannot be extended with new properties");
+
+ ClassDataType ctype = (ClassDataType) GetConfigurationDataType (targetType);
+ ItemProperty prop = new ItemProperty (name, propertyType);
+ ctype.AddProperty (prop);
+ }
+
+ public void IncludeType (Type type)
+ {
+ GetConfigurationDataType (type);
+ }
+
+ public void SetTypeInfo (DataItem item, Type type)
+ {
+ item.ItemData.Add (new DataValue ("ctype", GetConfigurationDataType (type).Name));
+ }
+
+ public void RegisterProperty (Type targetType, ItemProperty property)
+ {
+ if (!typeof(IExtendedDataItem).IsAssignableFrom (targetType))
+ throw new InvalidOperationException ("The type '" + targetType + "' does not implement the IExtendedDataItem interface and cannot be extended with new properties");
+
+ ClassDataType ctype = (ClassDataType) GetConfigurationDataType (targetType);
+ ctype.AddProperty (property);
+ }
+
+ internal protected DataType GetConfigurationDataType (Type type)
+ {
+ lock (configurationTypes) {
+ DataType itemType = (DataType) configurationTypes [type];
+ if (itemType != null) return itemType;
+ itemType = CreateConfigurationDataType (type);
+ configurationTypes [type] = itemType;
+ itemType.SetContext (this);
+ return itemType;
+ }
+ }
+
+ protected virtual DataType CreateConfigurationDataType (Type type)
+ {
+ if (type.IsEnum)
+ return new EnumDataType (type);
+ else if (type.IsPrimitive || type == typeof(string))
+ return new PrimitiveDataType (type);
+ else {
+ ICollectionHandler handler = GetCollectionHandler (type);
+ if (handler != null)
+ return new CollectionDataType (type, handler);
+ else
+ return CreateClassDataType (type);
+ }
+ }
+
+ protected virtual DataType CreateClassDataType (Type type)
+ {
+ return new ClassDataType (type);
+ }
+
+ internal protected virtual ICollectionHandler GetCollectionHandler (Type type)
+ {
+ if (type.IsArray)
+ return new ArrayHandler (type);
+ else if (type == typeof(ArrayList))
+ return ArrayListHandler.Instance;
+ else
+ return GenericCollectionHandler.CreateHandler (type);
+ }
+ }
+}
Index: Core/src/MonoDevelop.Base/Internal/Serialization/DataNode.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Serialization/DataNode.cs (revision 0)
+++ Core/src/MonoDevelop.Base/Internal/Serialization/DataNode.cs (revision 0)
@@ -0,0 +1,15 @@
+
+using System;
+
+namespace MonoDevelop.Internal.Serialization
+{
+ public class DataNode
+ {
+ string name;
+
+ public string Name {
+ get { return name; }
+ set { name = value; }
+ }
+ }
+}
Index: Core/src/MonoDevelop.Base/Internal/Serialization/SerializationContext.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Serialization/SerializationContext.cs (revision 0)
+++ Core/src/MonoDevelop.Base/Internal/Serialization/SerializationContext.cs (revision 0)
@@ -0,0 +1,24 @@
+
+using System;
+
+namespace MonoDevelop.Internal.Serialization
+{
+ public class SerializationContext: IDisposable
+ {
+ string file;
+
+ public string BaseFile {
+ get { return file; }
+ set { file = value; }
+ }
+
+ public virtual void Close ()
+ {
+ }
+
+ public void Dispose ()
+ {
+ Close ();
+ }
+ }
+}
Index: Core/src/MonoDevelop.Base/Internal/Serialization/IExtendedDataItem.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Serialization/IExtendedDataItem.cs (revision 0)
+++ Core/src/MonoDevelop.Base/Internal/Serialization/IExtendedDataItem.cs (revision 0)
@@ -0,0 +1,23 @@
+using System;
+using System.Collections;
+
+namespace MonoDevelop.Internal.Serialization
+{
+ public interface IExtendedDataItem
+ {
+ IDictionary ExtendedProperties { get; }
+ }
+
+ public interface ICustomDataItem
+ {
+ DataCollection Serialize (ITypeSerializer handler);
+ void Deserialize (ITypeSerializer handler, DataCollection data);
+ }
+
+ public interface ITypeSerializer
+ {
+ DataCollection Serialize (object instance);
+ void Deserialize (object instance, DataCollection data);
+ SerializationContext SerializationContext { get; }
+ }
+}
Index: Core/src/MonoDevelop.Base/Internal/Serialization/XmlDataSerializer.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Serialization/XmlDataSerializer.cs (revision 0)
+++ Core/src/MonoDevelop.Base/Internal/Serialization/XmlDataSerializer.cs (revision 0)
@@ -0,0 +1,179 @@
+// <file>
+// <owner name="Lluis Sanchez" email="lluis@novell.com"/>
+// <version value="$version"/>
+// </file>
+
+using System;
+using System.IO;
+using System.Xml;
+using System.Collections;
+
+namespace MonoDevelop.Internal.Serialization
+{
+ public class XmlDataSerializer
+ {
+ DataSerializer serializer;
+
+ public XmlDataSerializer (DataContext ctx)
+ {
+ serializer = new DataSerializer (ctx);
+ }
+
+ public void Serialize (TextWriter writer, object obj)
+ {
+ Serialize (writer, obj, null);
+ }
+
+ public void Serialize (TextWriter writer, object obj, Type type)
+ {
+ XmlTextWriter tw = new XmlTextWriter (writer);
+ tw.Formatting = Formatting.Indented;
+ Serialize (tw, obj, type);
+ }
+
+ public void Serialize (XmlWriter writer, object obj)
+ {
+ Serialize (writer, obj, null);
+ }
+
+ public void Serialize (XmlWriter writer, object obj, Type type)
+ {
+ DataNode data = serializer.Serialize (obj, type);
+ XmlConfigurationWriter.DefaultWriter.Write (writer, data);
+ }
+
+ public object Deserialize (TextReader reader, Type type)
+ {
+ return Deserialize (new XmlTextReader (reader), type);
+ }
+
+ public object Deserialize (XmlReader reader, Type type)
+ {
+ DataNode data = XmlConfigurationReader.DefaultReader.Read (reader);
+ return serializer.Deserialize (type, data);
+ }
+
+ public SerializationContext SerializationContext {
+ get { return serializer.SerializationContext; }
+ }
+ }
+
+ public class XmlConfigurationWriter
+ {
+ public static XmlConfigurationWriter DefaultWriter = new XmlConfigurationWriter ();
+
+ public void Write (XmlWriter writer, DataNode data)
+ {
+ if (data is DataValue)
+ writer.WriteElementString (data.Name, ((DataValue)data).Value);
+ else if (data is DataItem) {
+ writer.WriteStartElement (data.Name);
+ WriteAttributes (writer, (DataItem) data);
+ WriteChildren (writer, (DataItem) data);
+ writer.WriteEndElement ();
+ }
+ }
+
+ protected virtual void WriteAttributes (XmlWriter writer, DataItem item)
+ {
+ if (item.UniqueNames) {
+ foreach (DataNode data in item.ItemData) {
+ DataValue val = data as DataValue;
+ if (val != null)
+ WriteAttribute (writer, val.Name, val.Value);
+ }
+ }
+ }
+
+ protected virtual void WriteAttribute (XmlWriter writer, string name, string value)
+ {
+ writer.WriteAttributeString (name, value);
+ }
+
+ protected virtual void WriteChildren (XmlWriter writer, DataItem item)
+ {
+ if (item.UniqueNames) {
+ foreach (DataNode data in item.ItemData) {
+ if (!(data is DataValue))
+ WriteChild (writer, data);
+ }
+ } else {
+ foreach (DataNode data in item.ItemData)
+ WriteChild (writer, data);
+ }
+ }
+
+ protected virtual void WriteChild (XmlWriter writer, DataNode data)
+ {
+ DefaultWriter.Write (writer, data);
+ }
+ }
+
+ public class XmlConfigurationReader
+ {
+ public static XmlConfigurationReader DefaultReader = new XmlConfigurationReader ();
+
+ public DataNode Read (XmlReader reader)
+ {
+ DataItem item = new DataItem ();
+ reader.MoveToContent ();
+ string name = reader.LocalName;
+ item.Name = name;
+
+ while (reader.MoveToNextAttribute ()) {
+ DataNode data = ReadAttribute (reader.LocalName, reader.Value);
+ if (data != null) item.ItemData.Add (data);
+ }
+
+ reader.MoveToElement ();
+ if (reader.IsEmptyElement) {
+ reader.Skip ();
+ return item;
+ }
+
+ reader.ReadStartElement ();
+ reader.MoveToContent ();
+
+ string text = "";
+ while (reader.NodeType != XmlNodeType.EndElement) {
+ if (reader.NodeType == XmlNodeType.Element) {
+ DataNode data = ReadChild (reader, item);
+ if (data != null) item.ItemData.Add (data);
+ } else if (reader.NodeType == XmlNodeType.Text) {
+ text += reader.Value;
+ reader.Skip ();
+ } else {
+ reader.Skip ();
+ }
+ }
+
+ reader.ReadEndElement ();
+
+ if (!item.HasItemData && text != "")
+ return new DataValue (name, text);
+
+ return item;
+ }
+
+ protected bool MoveToNextElement (XmlReader reader)
+ {
+ reader.MoveToContent ();
+ while (reader.NodeType != XmlNodeType.EndElement) {
+ if (reader.NodeType == XmlNodeType.Element)
+ return true;
+ reader.Skip ();
+ }
+ return false;
+ }
+
+ protected virtual DataNode ReadAttribute (string name, string value)
+ {
+ return new DataValue (name, value);
+ }
+
+ protected virtual DataNode ReadChild (XmlReader reader, DataItem parent)
+ {
+ return DefaultReader.Read (reader);
+ }
+ }
+}
Index: Core/src/MonoDevelop.Base/Internal/Serialization/DataCollection.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Serialization/DataCollection.cs (revision 0)
+++ Core/src/MonoDevelop.Base/Internal/Serialization/DataCollection.cs (revision 0)
@@ -0,0 +1,147 @@
+
+using System;
+using System.Collections;
+
+namespace MonoDevelop.Internal.Serialization
+{
+ public class DataCollection: IEnumerable
+ {
+ ArrayList list = new ArrayList ();
+
+ public DataCollection ()
+ {
+ }
+
+ protected ArrayList List {
+ get {
+ if (list == null) list = new ArrayList ();
+ return list;
+ }
+ }
+
+ public int Count
+ {
+ get { return list == null ? 0 : list.Count; }
+ }
+
+ public virtual DataNode this [int n]
+ {
+ get { return (DataNode) List[n]; }
+ }
+
+ public virtual DataNode this [string name]
+ {
+ get {
+ DataCollection col;
+ int i = FindData (name, out col, false);
+ if (i != -1) return (DataNode) col.List [i];
+ else return null;
+ }
+ }
+
+ int FindData (string name, out DataCollection colec, bool buildTree)
+ {
+ if (list == null) {
+ colec = null;
+ return -1;
+ }
+
+ if (name.IndexOf ('/') == -1) {
+ for (int n=0; n<list.Count; n++) {
+ DataNode data = (DataNode) list [n];
+ if (data.Name == name) {
+ colec = this;
+ return n;
+ }
+ }
+ colec = this;
+ return -1;
+ } else {
+ string[] names = name.Split ('/');
+ int pos = -1;
+ colec = this;
+ DataNode data = null;
+
+ for (int p=0; p<names.Length; p++)
+ {
+ if (p > 0) {
+ DataItem item = data as DataItem;
+ if (item != null) {
+ colec = item.ItemData;
+ } else if (buildTree) {
+ item = new DataItem ();
+ item.Name = names [p - 1];
+ colec.Add (item);
+ colec = item.ItemData;
+ } else {
+ colec = null;
+ return -1;
+ }
+ }
+
+ pos = -1;
+ for (int n=0; n<colec.List.Count; n++) {
+ data = (DataNode) colec.List [n];
+ if (data.Name == names [p]) {
+ pos = n; break;
+ }
+ }
+ }
+ return pos;
+ }
+ }
+
+ public virtual IEnumerator GetEnumerator ()
+ {
+ return list == null ? Type.EmptyTypes.GetEnumerator() : list.GetEnumerator ();
+ }
+
+ public virtual void Add (DataNode entry)
+ {
+ if (entry == null)
+ throw new ArgumentNullException ("entry");
+
+ List.Add (entry);
+ }
+
+ public virtual void Add (DataNode entry, string itemPath)
+ {
+ if (entry == null)
+ throw new ArgumentNullException ("entry");
+
+ DataCollection col;
+ int i = FindData (itemPath + "/", out col, true);
+ col.List.Add (entry);
+ }
+
+ public virtual void Remove (DataNode entry)
+ {
+ if (list != null)
+ list.Remove (entry);
+ }
+
+ public DataNode Extract (string name)
+ {
+ DataCollection col;
+ int i = FindData (name, out col, false);
+ if (i != -1) {
+ DataNode data = (DataNode) col.List [i];
+ col.list.RemoveAt (i);
+ return data;
+ }
+ return null;
+ }
+
+ public int IndexOf (DataNode entry)
+ {
+ if (list == null) return -1;
+ return list.IndexOf (entry);
+ }
+
+ public virtual void Clear ()
+ {
+ if (list != null)
+ list.Clear ();
+ }
+ }
+}
Index: Core/src/MonoDevelop.Base/Internal/Serialization/GenericCollectionHandler.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Serialization/GenericCollectionHandler.cs (revision 0)
+++ Core/src/MonoDevelop.Base/Internal/Serialization/GenericCollectionHandler.cs (revision 0)
@@ -0,0 +1,177 @@
+using System;
+using System.Collections;
+using System.Reflection;
+
+namespace MonoDevelop.Internal.Serialization
+{
+ internal abstract class GenericCollectionHandler: ICollectionHandler
+ {
+ protected Type type;
+ protected Type elementType;
+ protected MethodInfo addMethod;
+ protected object[] itemParam = new object [1];
+ bool hasPublicConstructor;
+
+ protected GenericCollectionHandler (Type type, Type elemType, MethodInfo addMethod)
+ {
+ this.type = type;
+ this.elementType = elemType;
+ this.addMethod = addMethod;
+
+ hasPublicConstructor = (type.GetConstructor (Type.EmptyTypes) != null);
+ }
+
+ public static ICollectionHandler CreateHandler (Type t)
+ {
+ Type elemType;
+
+ MethodInfo addMethod = t.GetMethod ("Add");
+ if (addMethod == null) return null;
+
+ ParameterInfo[] pars = addMethod.GetParameters();
+ if (pars.Length != 1) return null;
+ elemType = pars[0].ParameterType;
+
+ PropertyInfo indexerProp = null;
+ PropertyInfo countProp = null;
+
+ PropertyInfo[] props = t.GetProperties (BindingFlags.Instance | BindingFlags.Public);
+ foreach (PropertyInfo prop in props)
+ {
+ if (!prop.CanRead) continue;
+ ParameterInfo[] pi = prop.GetIndexParameters ();
+ if (prop.CanWrite && pi != null && pi.Length == 1 && pi[0].ParameterType == typeof(int))
+ indexerProp = prop;
+ else if (prop.Name == "Count" && prop.PropertyType == typeof(int))
+ countProp = prop;
+ }
+
+ if (indexerProp != null && countProp != null && indexerProp.PropertyType == elemType)
+ return new IndexedCollectionHandler (t, elemType, addMethod, indexerProp, countProp);
+
+ if (!typeof(IEnumerable).IsAssignableFrom (t))
+ return null;
+
+ return new EnumerableCollectionHandler (t, elemType, addMethod, countProp);
+ }
+
+ public bool CanCreateInstance {
+ get { return hasPublicConstructor; }
+ }
+
+ public Type GetItemType ()
+ {
+ return elementType;
+ }
+
+ public object CreateCollection (out object position, int size)
+ {
+ position = 0;
+ return Activator.CreateInstance (type);
+ }
+
+ public void ResetCollection (object collection, out object position, int size)
+ {
+ position = 0;
+ }
+
+ public void AddItem (ref object collection, ref object position, object item)
+ {
+ itemParam [0] = item;
+ addMethod.Invoke (collection, itemParam);
+ position = (int)position + 1;
+ }
+
+ public abstract void SetItem (object collection, object position, object item);
+
+ public void FinishCreation (ref object collection, object position)
+ {
+ }
+
+ public abstract object GetInitialPosition (object collection);
+ public abstract bool MoveNextItem (object collection, ref object position);
+ public abstract object GetCurrentItem (object collection, object position);
+ public abstract bool IsEmpty (object collection);
+ }
+
+ internal class IndexedCollectionHandler: GenericCollectionHandler
+ {
+ PropertyInfo indexer;
+ PropertyInfo count;
+
+ internal IndexedCollectionHandler (Type type, Type elemType, MethodInfo addMethod, PropertyInfo indexerProp, PropertyInfo countProp)
+ : base (type, elemType, addMethod)
+ {
+ indexer = indexerProp;
+ count = countProp;
+ }
+
+ public override void SetItem (object collection, object position, object item)
+ {
+ itemParam [0] = position;
+ indexer.SetValue (collection, item, itemParam);
+ }
+
+ public override object GetInitialPosition (object collection)
+ {
+ return -1;
+ }
+
+ public override bool MoveNextItem (object collection, ref object position)
+ {
+ int i = ((int) position) + 1;
+ position = i;
+ return i < (int) count.GetValue (collection, null);
+ }
+
+ public override object GetCurrentItem (object collection, object position)
+ {
+ itemParam [0] = position;
+ return indexer.GetValue (collection, itemParam);
+ }
+
+ public override bool IsEmpty (object collection)
+ {
+ return collection == null || (int) count.GetValue (collection, null) == 0;
+ }
+ }
+
+ internal class EnumerableCollectionHandler: GenericCollectionHandler
+ {
+ PropertyInfo count;
+
+ internal EnumerableCollectionHandler (Type type, Type elemType, MethodInfo addMethod, PropertyInfo count)
+ : base (type, elemType, addMethod)
+ {
+ this.count = count;
+ }
+
+ public override void SetItem (object collection, object position, object item)
+ {
+ AddItem (ref collection, ref position, item);
+ }
+
+ public override object GetInitialPosition (object collection)
+ {
+ return ((IEnumerable)collection).GetEnumerator ();
+ }
+
+ public override bool MoveNextItem (object collection, ref object position)
+ {
+ return ((IEnumerator)position).MoveNext ();
+ }
+
+ public override object GetCurrentItem (object collection, object position)
+ {
+ return ((IEnumerator)position).Current;
+ }
+
+ public override bool IsEmpty (object collection)
+ {
+ if (collection == null) return true;
+ if (count != null) return (int) count.GetValue (collection, null) == 0;
+ IEnumerator en = (IEnumerator) ((IEnumerable)collection).GetEnumerator ();
+ return !en.MoveNext ();
+ }
+ }
+}
Index: Core/src/MonoDevelop.Base/Internal/Serialization/ItemPropertyAttribute.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Serialization/ItemPropertyAttribute.cs (revision 0)
+++ Core/src/MonoDevelop.Base/Internal/Serialization/ItemPropertyAttribute.cs (revision 0)
@@ -0,0 +1,67 @@
+using System;
+using System.Xml;
+using System.Collections;
+
+namespace MonoDevelop.Internal.Serialization
+{
+ [AttributeUsage (AttributeTargets.Property | AttributeTargets.Field, AllowMultiple=true)]
+ public class ItemPropertyAttribute: Attribute
+ {
+ Type confType;
+ object defaultValue;
+ string name;
+ int scope;
+ Type dataType;
+ bool readOnly;
+ bool writeOnly;
+
+ public ItemPropertyAttribute ()
+ {
+ }
+
+ public ItemPropertyAttribute (Type dataType)
+ {
+ this.dataType = dataType;
+ }
+
+ public ItemPropertyAttribute (string name)
+ {
+ this.name = name;
+ }
+
+ public object DefaultValue {
+ get { return defaultValue; }
+ set { defaultValue = value; }
+ }
+
+ public string Name {
+ get { return name; }
+ set { name = value; }
+ }
+
+ public int Scope {
+ get { return scope; }
+ set { scope = value; }
+ }
+
+ public Type SerializationDataType {
+ get { return confType; }
+ set { confType = value; }
+ }
+
+ public Type ValueType {
+ get { return dataType; }
+ set { dataType = value; }
+ }
+
+ public bool ReadOnly {
+ get { return readOnly; }
+ set { readOnly = value; }
+ }
+
+ public bool WriteOnly {
+ get { return writeOnly; }
+ set { writeOnly = value; }
+ }
+ }
+}
Index: Core/src/MonoDevelop.Base/Internal/Serialization/CollectionDataType.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Serialization/CollectionDataType.cs (revision 0)
+++ Core/src/MonoDevelop.Base/Internal/Serialization/CollectionDataType.cs (revision 0)
@@ -0,0 +1,106 @@
+using System;
+using System.Xml;
+using System.Collections;
+
+namespace MonoDevelop.Internal.Serialization
+{
+ public class CollectionDataType: DataType
+ {
+ ICollectionHandler handler;
+ MapData defaultData;
+
+ protected class MapData
+ {
+ public string ItemName;
+ public DataType ItemType;
+ public object ItemMapData;
+ }
+
+ internal CollectionDataType (Type type, ICollectionHandler handler): base (type)
+ {
+ this.handler = handler;
+ }
+
+ public override bool IsSimpleType { get { return false; } }
+ public override bool CanCreateInstance { get { return handler.CanCreateInstance; } }
+ public override bool CanReuseInstance { get { return true; } }
+
+ internal protected override object GetMapData (object[] attributes, int scope)
+ {
+ DataType itemDataType = null;
+ Type itemType = null;
+
+ ItemPropertyAttribute at = FindPropertyAttribute (attributes, scope + 1);
+ if (at != null) {
+ itemType = at.ValueType;
+ if (at.SerializationDataType != null)
+ itemDataType = (DataType) Activator.CreateInstance (at.SerializationDataType, new object[] { handler.GetItemType() });
+ }
+
+ if (itemType == null) itemType = handler.GetItemType ();
+ if (itemDataType == null) itemDataType = Context.GetConfigurationDataType (itemType);
+
+ object itemMapData = itemDataType.GetMapData (attributes, scope + 1);
+ if (at == null && itemMapData == null) return null;
+
+ MapData data = new MapData ();
+ data.ItemType = itemDataType;
+ data.ItemName = (at != null && at.Name != null) ? at.Name : itemDataType.Name;
+ data.ItemMapData = itemMapData;
+ return data;
+ }
+
+ protected virtual MapData GetDefaultData ()
+ {
+ if (defaultData != null) return defaultData;
+ defaultData = new MapData ();
+ defaultData.ItemType = Context.GetConfigurationDataType (handler.GetItemType ());
+ defaultData.ItemName = defaultData.ItemType.Name;
+ return defaultData;
+ }
+
+ public override DataNode Serialize (SerializationContext serCtx, object mdata, object collection)
+ {
+ MapData mapData = (mdata != null) ? (MapData) mdata : GetDefaultData ();
+ DataItem item = new DataItem ();
+ item.Name = Name;
+ item.UniqueNames = false;
+ object pos = handler.GetInitialPosition (collection);
+ while (handler.MoveNextItem (collection, ref pos)) {
+ object val = handler.GetCurrentItem (collection, pos);
+ if (val == null) continue;
+ DataNode data = mapData.ItemType.Serialize (serCtx, mapData.ItemMapData, val);
+ data.Name = mapData.ItemName;
+ item.ItemData.Add (data);
+ }
+ return item;
+ }
+
+ public override object Deserialize (SerializationContext serCtx, object mdata, DataNode data)
+ {
+ DataCollection items = ((DataItem) data).ItemData;
+ object position;
+ object collectionInstance = handler.CreateCollection (out position, items.Count);
+ Deserialize (serCtx, mdata, items, collectionInstance, position);
+ return collectionInstance;
+ }
+
+ public override void Deserialize (SerializationContext serCtx, object mdata, DataNode data, object collectionInstance)
+ {
+ DataCollection items = ((DataItem) data).ItemData;
+ object position;
+ handler.ResetCollection (collectionInstance, out position, items.Count);
+ Deserialize (serCtx, mdata, items, collectionInstance, position);
+ }
+
+ void Deserialize (SerializationContext serCtx, object mdata, DataCollection items, object collectionInstance, object position)
+ {
+ MapData mapData = (mdata != null) ? (MapData) mdata : GetDefaultData ();
+
+ foreach (DataNode val in items) {
+ handler.AddItem (ref collectionInstance, ref position, mapData.ItemType.Deserialize (serCtx, mapData.ItemMapData, val));
+ }
+ handler.FinishCreation (ref collectionInstance, position);
+ }
+ }
+}
Index: Core/src/MonoDevelop.Base/Internal/Serialization/ExpandedCollectionAttribute.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Serialization/ExpandedCollectionAttribute.cs (revision 0)
+++ Core/src/MonoDevelop.Base/Internal/Serialization/ExpandedCollectionAttribute.cs (revision 0)
@@ -0,0 +1,11 @@
+using System;
+using System.Xml;
+using System.Collections;
+
+namespace MonoDevelop.Internal.Serialization
+{
+ [AttributeUsage (AttributeTargets.Property | AttributeTargets.Field)]
+ public class ExpandedCollectionAttribute: Attribute
+ {
+ }
+}
Index: Core/src/MonoDevelop.Base/Internal/Serialization/DataItem.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Serialization/DataItem.cs (revision 0)
+++ Core/src/MonoDevelop.Base/Internal/Serialization/DataItem.cs (revision 0)
@@ -0,0 +1,41 @@
+
+using System;
+
+namespace MonoDevelop.Internal.Serialization
+{
+ public class DataItem: DataNode
+ {
+ DataCollection data;
+ bool uniqueNames = true;
+
+ public DataCollection ItemData {
+ get {
+ if (data == null) data = new DataCollection ();
+ return data;
+ }
+ set { data = value; }
+ }
+
+ public bool HasItemData {
+ get { return data != null && data.Count > 0; }
+ }
+
+ public bool UniqueNames {
+ get { return uniqueNames; }
+ set { uniqueNames = value; }
+ }
+
+ public DataNode this [string name] {
+ get {
+ if (data == null) return null;
+ return data [name];
+ }
+ }
+
+ public DataNode Extract (string name)
+ {
+ if (data == null) return null;
+ return data.Extract (name);
+ }
+ }
+}
Index: Core/src/MonoDevelop.Base/Internal/Serialization/EnumDataType.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Serialization/EnumDataType.cs (revision 0)
+++ Core/src/MonoDevelop.Base/Internal/Serialization/EnumDataType.cs (revision 0)
@@ -0,0 +1,25 @@
+using System;
+
+namespace MonoDevelop.Internal.Serialization
+{
+ public class EnumDataType: DataType
+ {
+ public EnumDataType (Type propType): base (propType)
+ {
+ }
+
+ public override bool IsSimpleType { get { return true; } }
+ public override bool CanCreateInstance { get { return true; } }
+ public override bool CanReuseInstance { get { return false; } }
+
+ public override DataNode Serialize (SerializationContext serCtx, object mapData, object value)
+ {
+ return new DataValue (Name, value.ToString ());
+ }
+
+ public override object Deserialize (SerializationContext serCtx, object mapData, DataNode data)
+ {
+ return Enum.Parse (ValueType, ((DataValue)data).Value, false);
+ }
+ }
+}
Index: Core/src/MonoDevelop.Base/Internal/Serialization/DataIncludeAttribute.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Serialization/DataIncludeAttribute.cs (revision 0)
+++ Core/src/MonoDevelop.Base/Internal/Serialization/DataIncludeAttribute.cs (revision 0)
@@ -0,0 +1,21 @@
+using System;
+using System.Xml;
+using System.Collections;
+
+namespace MonoDevelop.Internal.Serialization
+{
+ [AttributeUsage (AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple=true)]
+ public class DataIncludeAttribute: Attribute
+ {
+ Type type;
+
+ public DataIncludeAttribute (Type type)
+ {
+ this.type = type;
+ }
+
+ public Type Type {
+ get { return type; }
+ }
+ }
+}
Index: Core/src/MonoDevelop.Base/Internal/Serialization/ClassDataType.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Serialization/ClassDataType.cs (revision 0)
+++ Core/src/MonoDevelop.Base/Internal/Serialization/ClassDataType.cs (revision 0)
@@ -0,0 +1,338 @@
+using System;
+using System.Collections;
+using System.Reflection;
+
+namespace MonoDevelop.Internal.Serialization
+{
+ public class ClassDataType: DataType
+ {
+ Hashtable properties = new Hashtable ();
+ ArrayList sortedPoperties = new ArrayList ();
+ ArrayList subtypes;
+
+ public ClassDataType (Type propType): base (propType)
+ {
+ }
+
+ public override bool IsSimpleType { get { return false; } }
+ public override bool CanCreateInstance { get { return true; } }
+ public override bool CanReuseInstance { get { return true; } }
+
+ protected override void Initialize ()
+ {
+ object[] incs = ValueType.GetCustomAttributes (typeof (DataIncludeAttribute), true);
+ foreach (DataIncludeAttribute incat in incs) {
+ Context.IncludeType (incat.Type);
+ }
+
+ if (ValueType.BaseType != null) {
+ ClassDataType baseType = (ClassDataType) Context.GetConfigurationDataType (ValueType.BaseType);
+ baseType.AddSubtype (this);
+ foreach (ItemProperty prop in baseType.Properties) {
+ properties.Add (prop.Name, prop);
+ sortedPoperties.Add (prop);
+ }
+ }
+
+ foreach (Type interf in ValueType.GetInterfaces ()) {
+ ClassDataType baseType = (ClassDataType) Context.GetConfigurationDataType (interf);
+ baseType.AddSubtype (this);
+ }
+
+ MemberInfo[] members = ValueType.GetMembers (BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
+ foreach (MemberInfo member in members) {
+ if ((member is FieldInfo || member is PropertyInfo) && member.DeclaringType == ValueType) {
+ object[] ats = member.GetCustomAttributes (true);
+
+ ItemPropertyAttribute at = FindPropertyAttribute (ats, 0);
+ if (at == null) continue;
+
+ ItemProperty prop = new ItemProperty ();
+ prop.Name = (at.Name != null) ? at.Name : member.Name;
+ prop.ExpandedCollection = member.IsDefined (typeof(ExpandedCollectionAttribute), true);
+ prop.DefaultValue = at.DefaultValue;
+ Type memberType = member is FieldInfo ? ((FieldInfo)member).FieldType : ((PropertyInfo)member).PropertyType;
+
+ if (prop.ExpandedCollection) {
+ ICollectionHandler handler = Context.GetCollectionHandler (memberType);
+ if (handler == null)
+ throw new InvalidOperationException ("ExpandedCollectionAttribute can't be applied to property '" + prop.Name + "' in type '" + ValueType + "' becuase it is not a valid collection.");
+
+ memberType = handler.GetItemType ();
+ prop.ExpandedCollectionHandler = handler;
+ }
+
+ if (at.ValueType != null)
+ prop.PropertyType = at.ValueType;
+ else
+ prop.PropertyType = memberType;
+
+ if (at.SerializationDataType != null) {
+ try {
+ prop.DataType = (DataType) Activator.CreateInstance (at.SerializationDataType, new object[] { prop.PropertyType } );
+ } catch (MissingMethodException ex) {
+ throw new InvalidOperationException ("Constructor not found for custom data type: " + at.SerializationDataType.Name + " (Type propertyType);", ex);
+ }
+ }
+
+ prop.Member = member;
+ AddProperty (prop);
+ prop.Initialize (ats, 0);
+
+ if (prop.ExpandedCollection && prop.DataType.IsSimpleType)
+ throw new InvalidOperationException ("ExpandedCollectionAttribute is not allowed in collections of simple types");
+ }
+ }
+ }
+
+ private void AddSubtype (ClassDataType subtype)
+ {
+ if (subtypes == null) subtypes = new ArrayList ();
+ subtypes.Add (subtype);
+ }
+
+ public ICollection Properties {
+ get { return sortedPoperties; }
+ }
+
+ public void AddProperty (ItemProperty prop)
+ {
+ if (!prop.IsNested) {
+ foreach (ItemProperty p in sortedPoperties) {
+ if (p.IsNested && p.NameList[0] == prop.Name)
+ throw CreateNestedConflictException (prop, p);
+ }
+ } else {
+ ItemProperty p = properties [prop.NameList[0]] as ItemProperty;
+ if (p != null)
+ throw CreateNestedConflictException (prop, p);
+ }
+
+ prop.SetContext (Context);
+ if (properties.ContainsKey (prop.Name))
+ throw new InvalidOperationException ("Duplicate property '" + prop.Name + "' in class '" + ValueType);
+ properties.Add (prop.Name, prop);
+ sortedPoperties.Add (prop);
+ }
+
+ Exception CreateNestedConflictException (ItemProperty p1, ItemProperty p2)
+ {
+ return new InvalidOperationException ("There is a conflict between the properties '" + p1.Name + "' and '" + p2.Name + "'. Nested element properties can't be mixed with normal element properties.");
+ }
+
+ public override DataNode Serialize (SerializationContext serCtx, object mapData, object obj)
+ {
+ if (obj.GetType () != ValueType) {
+ DataType subtype = Context.GetConfigurationDataType (obj.GetType ());
+ DataItem it = (DataItem) subtype.Serialize (serCtx, mapData, obj);
+ it.ItemData.Add (new DataValue ("ctype", subtype.Name));
+ it.Name = Name;
+ return it;
+ }
+
+ DataItem item = new DataItem ();
+ item.Name = Name;
+
+ ICustomDataItem citem = obj as ICustomDataItem;
+ if (citem != null) {
+ ClassTypeHandler handler = new ClassTypeHandler (serCtx, this);
+ item.ItemData = citem.Serialize (handler);
+ }
+ else
+ item.ItemData = Serialize (serCtx, obj);
+ return item;
+ }
+
+ internal DataCollection Serialize (SerializationContext serCtx, object obj)
+ {
+ DataCollection itemCol = new DataCollection ();
+
+ foreach (ItemProperty prop in Properties) {
+ if (prop.ReadOnly) continue;
+ object val = GetPropValue (prop, obj);
+ if (val == null) continue;
+ if (val.Equals (prop.DefaultValue)) continue;
+ DataCollection col = itemCol;
+ if (prop.IsNested) col = GetNestedCollection (col, prop.NameList, 0);
+
+ if (prop.ExpandedCollection) {
+ ICollectionHandler handler = prop.ExpandedCollectionHandler;
+ object pos = handler.GetInitialPosition (val);
+ while (handler.MoveNextItem (val, ref pos)) {
+ object item = handler.GetCurrentItem (val, pos);
+ if (item == null) continue;
+ DataNode data = prop.Serialize (serCtx, item);
+ data.Name = prop.SingleName;
+ col.Add (data);
+ }
+ }
+ else {
+ DataNode data = prop.Serialize (serCtx, val);
+ if (data == null) continue;
+ col.Add (data);
+ }
+ }
+ return itemCol;
+ }
+
+ DataCollection GetNestedCollection (DataCollection col, string[] nameList, int pos)
+ {
+ if (pos == nameList.Length - 1) return col;
+
+ DataItem item = col [nameList[pos]] as DataItem;
+ if (item == null) {
+ item = new DataItem ();
+ item.Name = nameList[pos];
+ col.Add (item);
+ }
+ return GetNestedCollection (item.ItemData, nameList, pos + 1);
+ }
+
+ public override object Deserialize (SerializationContext serCtx, object mapData, DataNode data)
+ {
+ DataItem item = data as DataItem;
+ if (item == null)
+ throw new InvalidOperationException ("Invalid value found for type '" + Name + "'");
+
+ DataValue ctype = item ["ctype"] as DataValue;
+ if (ctype != null && ctype.Value != Name) {
+ DataType stype = FindDerivedType (ctype.Value);
+ if (stype != null) return stype.Deserialize (serCtx, mapData, data);
+ else throw new InvalidOperationException ("Type not found: " + ctype.Value);
+ }
+
+ object obj = Activator.CreateInstance (ValueType);
+ SetConfigurationItemData (serCtx, obj, item);
+ return obj;
+ }
+
+ public void SetConfigurationItemData (SerializationContext serCtx, object obj, DataItem item)
+ {
+ ICustomDataItem citem = obj as ICustomDataItem;
+ if (citem != null) {
+ ClassTypeHandler handler = new ClassTypeHandler (serCtx, this);
+ citem.Deserialize (handler, item.ItemData);
+ }
+ else
+ Deserialize (serCtx, obj, item.ItemData);
+ }
+
+ internal void Deserialize (SerializationContext serCtx, object obj, DataCollection itemData)
+ {
+ foreach (ItemProperty prop in Properties)
+ if (prop.DefaultValue != null)
+ SetPropValue (prop, obj, prop.DefaultValue);
+
+ Deserialize (serCtx, obj, itemData, "");
+ }
+
+ void Deserialize (SerializationContext serCtx, object obj, DataCollection itemData, string baseName)
+ {
+ Hashtable expandedCollections = null;
+
+ foreach (DataNode value in itemData) {
+ ItemProperty prop = (ItemProperty) properties [baseName + value.Name];
+ if (prop == null) {
+ if (value is DataItem)
+ Deserialize (serCtx, obj, ((DataItem)value).ItemData, baseName + value.Name + "/");
+ continue;
+ }
+ if (prop.WriteOnly)
+ continue;
+
+ try {
+ if (prop.ExpandedCollection) {
+ ICollectionHandler handler = prop.ExpandedCollectionHandler;
+ if (expandedCollections == null) expandedCollections = new Hashtable ();
+
+ object pos, col;
+ if (!expandedCollections.ContainsKey (prop)) {
+ col = handler.CreateCollection (out pos, -1);
+ } else {
+ pos = expandedCollections [prop];
+ col = GetPropValue (prop, obj);
+ }
+ handler.AddItem (ref col, ref pos, prop.Deserialize (serCtx, value));
+ expandedCollections [prop] = pos;
+ SetPropValue (prop, obj, col);
+ }
+ else {
+ if (prop.HasSetter && prop.DataType.CanCreateInstance)
+ SetPropValue (prop, obj, prop.Deserialize (serCtx, value));
+ else if (prop.DataType.CanReuseInstance) {
+ object pval = GetPropValue (prop, obj);
+ if (pval == null) {
+ if (prop.HasSetter)
+ throw new InvalidOperationException ("The property is null and a new instance of '" + prop.PropertyType + "' can't be created.");
+ else
+ throw new InvalidOperationException ("The property is null and it does not have a setter.");
+ }
+ prop.Deserialize (serCtx, value, pval);
+ } else {
+ throw new InvalidOperationException ("The property does not have a setter.");
+ }
+ }
+ }
+ catch (Exception ex) {
+ throw new InvalidOperationException ("Could not set property '" + prop.Name + "' in type '" + Name + "'", ex);
+ }
+ }
+ }
+
+ void SetPropValue (ItemProperty prop, object obj, object value)
+ {
+ if (prop.Member != null)
+ prop.SetValue (obj, value);
+ else if (obj is IExtendedDataItem)
+ ((IExtendedDataItem)obj).ExtendedProperties [prop.Name] = value;
+ }
+
+ object GetPropValue (ItemProperty prop, object obj)
+ {
+ if (prop.Member != null)
+ return prop.GetValue (obj);
+ else if (obj is IExtendedDataItem)
+ return ((IExtendedDataItem)obj).ExtendedProperties [prop.Name];
+ else
+ return null;
+ }
+
+ public DataType FindDerivedType (string name)
+ {
+ if (subtypes == null) return null;
+
+ foreach (ClassDataType stype in subtypes) {
+ if (stype.Name == name) return stype;
+ DataType cst = stype.FindDerivedType (name);
+ if (cst != null) return cst;
+ }
+ return null;
+ }
+ }
+
+ internal class ClassTypeHandler: ITypeSerializer
+ {
+ SerializationContext ctx;
+ ClassDataType cdt;
+
+ internal ClassTypeHandler (SerializationContext ctx, ClassDataType cdt)
+ {
+ this.ctx = ctx;
+ this.cdt = cdt;
+ }
+
+ public DataCollection Serialize (object instance)
+ {
+ return cdt.Serialize (ctx, instance);
+ }
+
+ public void Deserialize (object instance, DataCollection data)
+ {
+ cdt.Deserialize (ctx, instance, data);
+ }
+
+ public SerializationContext SerializationContext {
+ get { return ctx; }
+ }
+ }
+}
Index: Core/src/MonoDevelop.Base/Internal/Serialization/ICollectionHandler.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Serialization/ICollectionHandler.cs (revision 0)
+++ Core/src/MonoDevelop.Base/Internal/Serialization/ICollectionHandler.cs (revision 0)
@@ -0,0 +1,28 @@
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Lluis Sanchez" email="lluis@novell.com"/>
+// <version value="$version"/>
+// </file>
+
+using System;
+
+namespace MonoDevelop.Internal.Serialization
+{
+ public interface ICollectionHandler
+ {
+ Type GetItemType ();
+
+ bool CanCreateInstance { get; }
+ object CreateCollection (out object position, int size);
+ void ResetCollection (object collection, out object position, int size);
+ void AddItem (ref object collection, ref object position, object item);
+ void SetItem (object collection, object position, object item);
+ void FinishCreation (ref object collection, object position);
+
+ bool IsEmpty (object collection);
+ object GetInitialPosition (object collection);
+ bool MoveNextItem (object collection, ref object position);
+ object GetCurrentItem (object collection, object position);
+ }
+}
Index: Core/src/MonoDevelop.Base/Internal/Serialization/DataSerializer.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Serialization/DataSerializer.cs (revision 0)
+++ Core/src/MonoDevelop.Base/Internal/Serialization/DataSerializer.cs (revision 0)
@@ -0,0 +1,54 @@
+// <file>
+// <owner name="Lluis Sanchez" email="lluis@novell.com"/>
+// <version value="$version"/>
+// </file>
+
+using System;
+using System.Xml;
+using System.Collections;
+
+namespace MonoDevelop.Internal.Serialization
+{
+ public class DataSerializer
+ {
+ SerializationContext serializationContext;
+ DataContext dataContext;
+
+ public DataSerializer (DataContext ctx)
+ {
+ dataContext = ctx;
+ serializationContext = ctx.CreateSerializationContext ();
+ }
+
+ public DataSerializer (DataContext ctx, string baseFile)
+ {
+ dataContext = ctx;
+ serializationContext = ctx.CreateSerializationContext ();
+ serializationContext.BaseFile = baseFile;
+ }
+
+ public SerializationContext SerializationContext {
+ get { return serializationContext; }
+ }
+
+ public DataNode Serialize (object obj)
+ {
+ return dataContext.SaveConfigurationData (serializationContext, obj, null);
+ }
+
+ public DataNode Serialize (object obj, Type type)
+ {
+ return dataContext.SaveConfigurationData (serializationContext, obj, type);
+ }
+
+ public object Deserialize (Type type, DataNode data)
+ {
+ return dataContext.LoadConfigurationData (serializationContext, type, data);
+ }
+
+ public void Deserialize (object obj, DataItem data)
+ {
+ dataContext.SetConfigurationItemData (serializationContext, obj, data);
+ }
+ }
+}
Index: Core/src/MonoDevelop.Base/Internal/Serialization/ItemProperty.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Serialization/ItemProperty.cs (revision 0)
+++ Core/src/MonoDevelop.Base/Internal/Serialization/ItemProperty.cs (revision 0)
@@ -0,0 +1,167 @@
+
+using System;
+using System.Reflection;
+
+namespace MonoDevelop.Internal.Serialization
+{
+ public sealed class ItemProperty
+ {
+ string name;
+ MemberInfo member;
+ DataType dataType;
+ Type propType;
+ object defaultValue;
+ DataContext ctx;
+ object mapData;
+ bool expandedCollection;
+ ICollectionHandler expandedCollectionHandler;
+ string[] nameList;
+ bool readOnly;
+ bool writeOnly;
+
+ public ItemProperty ()
+ {
+ }
+
+ public ItemProperty (string name, Type propType)
+ {
+ this.name = name;
+ this.propType = propType;
+ BuildNameList ();
+ }
+
+ void BuildNameList ()
+ {
+ if (name.IndexOf ('/') != -1) {
+ nameList = name.Split ('/');
+ }
+ }
+
+ internal void SetContext (DataContext ctx)
+ {
+ this.ctx = ctx;
+ if (dataType == null) {
+ if (propType == null) throw new InvalidOperationException ("Property type not specified");
+ dataType = ctx.GetConfigurationDataType (propType);
+ }
+ }
+
+ internal void Initialize (object[] attributes, int scope)
+ {
+ mapData = dataType.GetMapData (attributes, scope);
+ }
+
+ internal MemberInfo Member {
+ get { return member; }
+ set { CheckReadOnly (); member = value; }
+ }
+
+ public string Name {
+ get { return name; }
+ set { CheckReadOnly (); name = value; BuildNameList (); }
+ }
+
+ public object DefaultValue {
+ get { return defaultValue; }
+ set { CheckReadOnly (); defaultValue = value; }
+ }
+
+ public Type PropertyType {
+ get { return propType; }
+ set { CheckReadOnly (); propType = value; }
+ }
+
+ public bool ExpandedCollection {
+ get { return expandedCollection; }
+ set { expandedCollection = value; }
+ }
+
+ internal ICollectionHandler ExpandedCollectionHandler {
+ get { return expandedCollectionHandler; }
+ set { expandedCollectionHandler = value; }
+ }
+
+ public bool ReadOnly {
+ get { return readOnly; }
+ set { readOnly = value; }
+ }
+
+ public bool WriteOnly {
+ get { return writeOnly; }
+ set { writeOnly = value; }
+ }
+
+ public DataType DataType {
+ get { return dataType; }
+ set { CheckReadOnly (); dataType = value; }
+ }
+
+ internal string[] NameList {
+ get { return nameList; }
+ }
+
+ internal bool IsNested {
+ get { return nameList != null; }
+ }
+
+ internal string SingleName {
+ get { return nameList != null ? nameList [nameList.Length-1] : name; }
+ }
+
+ internal DataContext Context {
+ get { return ctx; }
+ }
+
+ internal object GetValue (object obj)
+ {
+ if (member != null) {
+ object val;
+ FieldInfo field = member as FieldInfo;
+ if (field != null) return field.GetValue (obj);
+ else return ((PropertyInfo)member).GetValue (obj, null);
+ } else
+ throw new InvalidOperationException ("Invalid object property");
+ }
+
+ internal void SetValue (object obj, object value)
+ {
+ if (member != null) {
+ FieldInfo field = member as FieldInfo;
+ if (field != null)
+ field.SetValue (obj, value);
+ else {
+ PropertyInfo pi = member as PropertyInfo;
+ pi.SetValue (obj, value, null);
+ }
+ } else
+ throw new InvalidOperationException ("Invalid object property");
+ }
+
+ internal bool HasSetter {
+ get { return (member is FieldInfo) || ((member is PropertyInfo) && ((PropertyInfo)member).CanWrite); }
+ }
+
+ internal DataNode Serialize (SerializationContext serCtx, object value)
+ {
+ DataNode data = dataType.Serialize (serCtx, mapData, value);
+ data.Name = SingleName;
+ return data;
+ }
+
+ internal object Deserialize (SerializationContext serCtx, DataNode data)
+ {
+ return dataType.Deserialize (serCtx, mapData, data);
+ }
+
+ internal void Deserialize (SerializationContext serCtx, DataNode data, object valueInstance)
+ {
+ dataType.Deserialize (serCtx, mapData, data, valueInstance);
+ }
+
+ void CheckReadOnly ()
+ {
+ if (ctx != null)
+ throw new InvalidOperationException ("Property can't be modified, it is already bound to a configuration context");
+ }
+ }
+}
Index: Core/src/MonoDevelop.Base/Internal/Serialization/PrimitiveDataType.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Serialization/PrimitiveDataType.cs (revision 0)
+++ Core/src/MonoDevelop.Base/Internal/Serialization/PrimitiveDataType.cs (revision 0)
@@ -0,0 +1,25 @@
+using System;
+
+namespace MonoDevelop.Internal.Serialization
+{
+ public class PrimitiveDataType: DataType
+ {
+ public PrimitiveDataType (Type propType): base (propType)
+ {
+ }
+
+ public override bool IsSimpleType { get { return true; } }
+ public override bool CanCreateInstance { get { return true; } }
+ public override bool CanReuseInstance { get { return false; } }
+
+ public override DataNode Serialize (SerializationContext serCtx, object mapData, object value)
+ {
+ return new DataValue (Name, value.ToString ());
+ }
+
+ public override object Deserialize (SerializationContext serCtx, object mapData, DataNode data)
+ {
+ return Convert.ChangeType (((DataValue)data).Value, ValueType);
+ }
+ }
+}
Index: Core/src/MonoDevelop.Base/Internal/Serialization/DataValue.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Serialization/DataValue.cs (revision 0)
+++ Core/src/MonoDevelop.Base/Internal/Serialization/DataValue.cs (revision 0)
@@ -0,0 +1,20 @@
+
+using System;
+
+namespace MonoDevelop.Internal.Serialization
+{
+ public class DataValue: DataNode
+ {
+ string value;
+
+ public DataValue (string name, string value)
+ {
+ Name = name;
+ this.value = value;
+ }
+
+ public string Value {
+ get { return value; }
+ }
+ }
+}
Index: Core/src/MonoDevelop.Base/Internal/Serialization/ArrayListHandler.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Serialization/ArrayListHandler.cs (revision 0)
+++ Core/src/MonoDevelop.Base/Internal/Serialization/ArrayListHandler.cs (revision 0)
@@ -0,0 +1,76 @@
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Lluis Sanchez" email="lluis@novell.com"/>
+// <version value="$version"/>
+// </file>
+
+using System;
+using System.Collections;
+
+namespace MonoDevelop.Internal.Serialization
+{
+ internal class ArrayListHandler: ICollectionHandler
+ {
+ public static ArrayListHandler Instance = new ArrayListHandler ();
+
+ public Type GetItemType ()
+ {
+ return typeof(object);
+ }
+
+ public bool CanCreateInstance {
+ get { return true; }
+ }
+
+ public object CreateCollection (out object position, int size)
+ {
+ position = 0;
+ if (size != -1) return new ArrayList (size);
+ else return new ArrayList ();
+ }
+
+ public void ResetCollection (object collection, out object position, int size)
+ {
+ position = 0;
+ }
+
+ public void AddItem (ref object collection, ref object position, object item)
+ {
+ ((ArrayList) collection).Add (item);
+ position = (int)position + 1;
+ }
+
+ public void SetItem (object collection, object position, object item)
+ {
+ ((ArrayList) collection) [(int)position] = item;
+ }
+
+ public void FinishCreation (ref object collection, object position)
+ {
+ }
+
+ public bool IsEmpty (object collection)
+ {
+ return collection == null || ((ArrayList)collection).Count == 0;
+ }
+
+ public object GetInitialPosition (object collection)
+ {
+ return -1;
+ }
+
+ public bool MoveNextItem (object collection, ref object position)
+ {
+ int i = (int) position;
+ position = ++i;
+ ArrayList ar = (ArrayList) collection;
+ return i < ar.Count;
+ }
+
+ public object GetCurrentItem (object collection, object position)
+ {
+ return ((ArrayList)collection) [(int)position];
+ }
+ }
+}
Index: Core/src/MonoDevelop.Base/Internal/Templates/ProjectTemplates/CombineDescriptor.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Templates/ProjectTemplates/CombineDescriptor.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Internal/Templates/ProjectTemplates/CombineDescriptor.cs (working copy)
@@ -95,10 +95,10 @@
if (File.Exists(combineLocation)) {
IMessageService messageService =(IMessageService)ServiceManager.GetService(typeof(IMessageService));
if (messageService.AskQuestion(String.Format (GettextCatalog.GetString ("Solution file {0} already exists, do you want to overwrite\nthe existing file ?"), combineLocation))) {
- newCombine.SaveCombine(combineLocation);
+ newCombine.Save (combineLocation);
}
} else {
- newCombine.SaveCombine(combineLocation);
+ newCombine.Save (combineLocation);
}
newCombine.Dispose();
return combineLocation;
Index: Core/src/MonoDevelop.Base/Internal/Templates/ProjectTemplates/ProjectTemplate.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Templates/ProjectTemplates/ProjectTemplate.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Internal/Templates/ProjectTemplates/ProjectTemplate.cs (working copy)
@@ -142,8 +142,10 @@
name = GettextCatalog.GetString (config["_Name"].InnerText);
category = config["Category"].InnerText;
- languagename = config["LanguageName"].InnerText;
+ if (config["LanguageName"] != null)
+ languagename = config["LanguageName"].InnerText;
+
if (config["_Description"] != null) {
description = GettextCatalog.GetString (config["_Description"].InnerText);
}
Index: Core/src/MonoDevelop.Base/Internal/Templates/ProjectTemplates/ProjectDescriptor.cs
===================================================================
--- Core/src/MonoDevelop.Base/Internal/Templates/ProjectTemplates/ProjectDescriptor.cs (revision 2122)
+++ Core/src/MonoDevelop.Base/Internal/Templates/ProjectTemplates/ProjectDescriptor.cs (working copy)
@@ -12,11 +12,13 @@
using System.Collections.Specialized;
using System.Diagnostics;
using System.Reflection;
+using MonoDevelop.Internal.Project;
using MonoDevelop.Core.Services;
using MonoDevelop.Services;
using MonoDevelop.Gui;
-using MonoDevelop.Internal.Project;
+using Project = MonoDevelop.Internal.Project.Project;
+
namespace MonoDevelop.Internal.Templates
{
/// <summary>
@@ -26,7 +28,7 @@
{
string name;
string relativePath;
- string languageName = null;
+ string projectType;
ArrayList files = new ArrayList(); // contains FileTemplate classes
ArrayList references = new ArrayList();
@@ -35,12 +37,6 @@
XmlElement projectOptions = null;
#region public properties
- public string LanguageName {
- get {
- return languageName;
- }
- }
-
public ArrayList Files {
get {
return files;
@@ -77,17 +73,17 @@
StringParserService stringParserService = Runtime.StringParserService;
FileUtilityService fileUtilityService = Runtime.FileUtilityService;
- string language = languageName != null && languageName.Length > 0 ? languageName : defaultLanguage;
+ if (projectOptions.Attributes ["language"] == null) {
+ projectOptions.SetAttribute ("language", defaultLanguage);
+ }
- ILanguageBinding languageinfo = Runtime.Languages.GetBindingPerLanguageName(language);
+ Project project = Runtime.ProjectService.CreateProject (projectType, projectCreateInformation, projectOptions);
- if (languageinfo == null) {
- Runtime.MessageService.ShowError(String.Format (GettextCatalog.GetString ("Can't create project with type : {0}"), language));
+ if (project == null) {
+ Runtime.MessageService.ShowError(String.Format (GettextCatalog.GetString ("Can't create project with type : {0}"), projectType));
return String.Empty;
}
- IProject project = languageinfo.CreateProject(projectCreateInformation, projectOptions);
-
string newProjectName = stringParserService.Parse(name, new string[,] {
{"ProjectName", projectCreateInformation.ProjectName}
});
@@ -153,10 +149,10 @@
if (File.Exists(projectLocation)) {
if (Runtime.MessageService.AskQuestion(String.Format (GettextCatalog.GetString ("Project file {0} already exists, do you want to overwrite\nthe existing file ?"), projectLocation), GettextCatalog.GetString ("File already exists"))) {
- project.SaveProject(projectLocation);
+ project.Save (projectLocation);
}
} else {
- project.SaveProject(projectLocation);
+ project.Save (projectLocation);
}
return projectLocation;
@@ -166,10 +162,10 @@
{
ProjectDescriptor projectDescriptor = new ProjectDescriptor(element.Attributes["name"].InnerText, element.Attributes["directory"].InnerText);
+ projectDescriptor.projectType = element.GetAttribute ("type");
+ if (projectDescriptor.projectType == "") projectDescriptor.projectType = "DotNet";
+
projectDescriptor.projectOptions = element["Options"];
- if (element.Attributes["language"] != null) {
- projectDescriptor.languageName = element.Attributes["language"].InnerText;
- }
if (element["Files"] != null) {
foreach (XmlNode node in element["Files"].ChildNodes) {
Index: Core/src/MonoDevelop.Base/MonoDevelopCore.addin.xml
===================================================================
--- Core/src/MonoDevelop.Base/MonoDevelopCore.addin.xml (revision 2122)
+++ Core/src/MonoDevelop.Base/MonoDevelopCore.addin.xml (working copy)
@@ -63,7 +63,12 @@
<Class id = "ProcessService"
class = "MonoDevelop.Services.ProcessService"/>
</Extension>
-
+
+ <Extension path = "/SharpDevelop/Workbench/ProjectBindings">
+ <ProjectBinding id = "DotNet"
+ class = "MonoDevelop.Internal.Project.DotNetProjectBinding" />
+ </Extension>
+
<Extension path = "/SharpDevelop/Workbench/DisplayBindings">
<DisplayBinding id = "Browser"
supportedformats = "Web Pages"
Index: Core/src/AddIns/DisplayBindings/SourceEditor/Gui/Dialogs/ExportProjectToHtmlDialog.cs
===================================================================
--- Core/src/AddIns/DisplayBindings/SourceEditor/Gui/Dialogs/ExportProjectToHtmlDialog.cs (revision 2122)
+++ Core/src/AddIns/DisplayBindings/SourceEditor/Gui/Dialogs/ExportProjectToHtmlDialog.cs (working copy)
@@ -38,7 +38,7 @@
FileUtilityService fileUtilityService = (FileUtilityService) ServiceManager.GetService(typeof(FileUtilityService));
IconService iconService = (IconService) ServiceManager.GetService(typeof(IconService));
- IProject project;
+ Project project;
int filesExported = 0;
int FilesExported
@@ -57,7 +57,7 @@
cancelButton.Clicked += new EventHandler (StopThread);
}
- public ExportProjectToHtmlDialog (IProject project)
+ public ExportProjectToHtmlDialog (Project project)
{
PropertyService propertyService = (PropertyService) ServiceManager.GetService (typeof (PropertyService));
this.project = project;
Index: Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog
===================================================================
--- Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog (revision 2122)
+++ Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog (working copy)
@@ -1,3 +1,19 @@
+2005-01-11 Lluis Sanchez Gual <lluis@novell.com>
+
+ * Gui/Dialogs/ExportProjectToHtmlDialog.cs:
+ * InsightWindow/MethodInsightDataProvider.cs:
+ * InsightWindow/InsightWindow.cs:
+ * InsightWindow/IInsightDataProvider.cs:
+ * InsightWindow/IndexerInsightDataProvider.cs:
+ * CodeCompletion/CompletionListWindow.cs
+ * CodeCompletion/CompletionWindow.cs:
+ * CodeCompletion/CommentCompletionDataProvider.cs:
+ * CodeCompletion/ICompletionDataProvider.cs:
+ * CodeCompletion/CodeCompletionDataProvider.cs:
+ * CodeCompletion/TemplateCompletionDataProvider.cs:
+ * Search/DocumentIterator/WholeProjectDocumentIterator.cs:
+ Follow architecture changes.
+
2004-12-14 Todd Berman <tberman@off.net>
* Gui/SourceEditorDisplayBinding.cs: Finish off some code to detect
Index: Core/src/AddIns/DisplayBindings/SourceEditor/InsightWindow/MethodInsightDataProvider.cs
===================================================================
--- Core/src/AddIns/DisplayBindings/SourceEditor/InsightWindow/MethodInsightDataProvider.cs (revision 2122)
+++ Core/src/AddIns/DisplayBindings/SourceEditor/InsightWindow/MethodInsightDataProvider.cs (working copy)
@@ -50,7 +50,7 @@
}
int initialOffset;
- public void SetupDataProvider(IProject project, string fileName, SourceEditorView textArea)
+ public void SetupDataProvider(Project project, string fileName, SourceEditorView textArea)
{
this.fileName = fileName;
this.textArea = textArea;
Index: Core/src/AddIns/DisplayBindings/SourceEditor/InsightWindow/InsightWindow.cs
===================================================================
--- Core/src/AddIns/DisplayBindings/SourceEditor/InsightWindow/InsightWindow.cs (revision 2122)
+++ Core/src/AddIns/DisplayBindings/SourceEditor/InsightWindow/InsightWindow.cs (working copy)
@@ -30,7 +30,7 @@
Gtk.Label max;
string description;
string fileName;
- IProject project;
+ Project project;
StringParserService StringParserService = (StringParserService)ServiceManager.GetService (typeof (StringParserService));
@@ -114,7 +114,7 @@
type = RegisterGType (typeof (InsightWindow));
}
- public InsightWindow(SourceEditorView control, IProject project, string fileName) : base (type)
+ public InsightWindow(SourceEditorView control, Project project, string fileName) : base (type)
{
this.control = control;
this.fileName = fileName;
Index: Core/src/AddIns/DisplayBindings/SourceEditor/InsightWindow/IInsightDataProvider.cs
===================================================================
--- Core/src/AddIns/DisplayBindings/SourceEditor/InsightWindow/IInsightDataProvider.cs (revision 2122)
+++ Core/src/AddIns/DisplayBindings/SourceEditor/InsightWindow/IInsightDataProvider.cs (working copy)
@@ -17,7 +17,7 @@
{
public interface IInsightDataProvider
{
- void SetupDataProvider(IProject project, string fileName, SourceEditorView textArea);
+ void SetupDataProvider(Project project, string fileName, SourceEditorView textArea);
bool CaretOffsetChanged();
bool CharTyped();
Index: Core/src/AddIns/DisplayBindings/SourceEditor/InsightWindow/IndexerInsightDataProvider.cs
===================================================================
--- Core/src/AddIns/DisplayBindings/SourceEditor/InsightWindow/IndexerInsightDataProvider.cs (revision 2122)
+++ Core/src/AddIns/DisplayBindings/SourceEditor/InsightWindow/IndexerInsightDataProvider.cs (working copy)
@@ -47,7 +47,7 @@
}
int initialOffset;
- public void SetupDataProvider(IProject project, string fileName, SourceEditorView textArea)
+ public void SetupDataProvider(Project project, string fileName, SourceEditorView textArea)
{
this.fileName = fileName;
this.textArea = textArea;
Index: Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CompletionListWindow.cs
===================================================================
--- Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CompletionListWindow.cs (revision 2122)
+++ Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CompletionListWindow.cs (working copy)
@@ -12,7 +12,7 @@
public class CompletionListWindow : ListWindow, IListDataProvider
{
string fileName;
- IProject project;
+ Project project;
SourceEditorView control;
TextMark triggeringMark;
ICompletionData[] completionData;
Index: Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CompletionWindow.cs
===================================================================
--- Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CompletionWindow.cs (revision 2122)
+++ Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CompletionWindow.cs (working copy)
@@ -30,7 +30,7 @@
int num_in = 0;
DeclarationViewWindow declarationviewwindow = new DeclarationViewWindow ();
string fileName;
- IProject project;
+ Project project;
static CompletionWindow wnd;
Index: Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CommentCompletionDataProvider.cs
===================================================================
--- Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CommentCompletionDataProvider.cs (revision 2122)
+++ Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CommentCompletionDataProvider.cs (working copy)
@@ -63,7 +63,7 @@
return row >= region.BeginLine && (row <= region.EndLine || region.EndLine == -1);
}
- public ICompletionData[] GenerateCompletionData (IProject project, string fileName, SourceEditorView textArea, char charTyped, Gtk.TextMark triggerMark)
+ public ICompletionData[] GenerateCompletionData (Project project, string fileName, SourceEditorView textArea, char charTyped, Gtk.TextMark triggerMark)
{
/*caretLineNumber = textArea.Caret.Line;
caretColumn = textArea.Caret.Column;
Index: Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/ICompletionDataProvider.cs
===================================================================
--- Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/ICompletionDataProvider.cs (revision 2122)
+++ Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/ICompletionDataProvider.cs (working copy)
@@ -17,6 +17,6 @@
namespace MonoDevelop.SourceEditor.CodeCompletion {
public interface ICompletionDataProvider {
- ICompletionData[] GenerateCompletionData(IProject project, string fileName, SourceEditorView textArea, char charTyped, Gtk.TextMark mark);
+ ICompletionData[] GenerateCompletionData(Project project, string fileName, SourceEditorView textArea, char charTyped, Gtk.TextMark mark);
}
}
Index: Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CodeCompletionDataProvider.cs
===================================================================
--- Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CodeCompletionDataProvider.cs (revision 2122)
+++ Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CodeCompletionDataProvider.cs (working copy)
@@ -54,7 +54,7 @@
ArrayList completionData = null;
- public ICompletionData[] GenerateCompletionData(IProject project, string fileName, SourceEditorView textArea, char charTyped, TextMark triggerMark)
+ public ICompletionData[] GenerateCompletionData(Project project, string fileName, SourceEditorView textArea, char charTyped, TextMark triggerMark)
{
completionData = new ArrayList();
this.fileName = fileName;
Index: Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/TemplateCompletionDataProvider.cs
===================================================================
--- Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/TemplateCompletionDataProvider.cs (revision 2122)
+++ Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/TemplateCompletionDataProvider.cs (working copy)
@@ -27,7 +27,7 @@
}
}
- public ICompletionData[] GenerateCompletionData(IProject project, string fileName, SourceEditorView textArea, char charTyped, Gtk.TextMark triggerMark)
+ public ICompletionData[] GenerateCompletionData(Project project, string fileName, SourceEditorView textArea, char charTyped, Gtk.TextMark triggerMark)
{
CodeTemplateGroup templateGroup = CodeTemplateLoader.GetTemplateGroupPerFilename(fileName);
if (templateGroup == null) {
Index: Core/src/AddIns/DisplayBindings/SourceEditor/Search/DocumentIterator/WholeProjectDocumentIterator.cs
===================================================================
--- Core/src/AddIns/DisplayBindings/SourceEditor/Search/DocumentIterator/WholeProjectDocumentIterator.cs (revision 2122)
+++ Core/src/AddIns/DisplayBindings/SourceEditor/Search/DocumentIterator/WholeProjectDocumentIterator.cs (working copy)
@@ -78,7 +78,7 @@
}
- void AddFiles(IProject project)
+ void AddFiles(Project project)
{
foreach (ProjectFile file in project.ProjectFiles) {
if (file.BuildAction == BuildAction.Compile &&
@@ -91,10 +91,10 @@
void AddFiles(Combine combine)
{
foreach (CombineEntry entry in combine.Entries) {
- if (entry is ProjectCombineEntry) {
- AddFiles(((ProjectCombineEntry)entry).Project);
- } else {
- AddFiles(((CombineCombineEntry)entry).Combine);
+ if (entry is Project) {
+ AddFiles ((Project)entry);
+ } else if (entry is Combine) {
+ AddFiles ((Combine)entry);
}
}
}
Index: Core/src/AddIns/BackendBindings/ILAsmBinding/ILAsmCompilerManager.cs
===================================================================
--- Core/src/AddIns/BackendBindings/ILAsmBinding/ILAsmCompilerManager.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/ILAsmBinding/ILAsmCompilerManager.cs (working copy)
@@ -29,25 +29,12 @@
{
FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.GetService(typeof(FileUtilityService));
- public string GetCompiledOutputName(string fileName)
- {
- return Path.ChangeExtension(fileName, ".exe");
- }
-
- public string GetCompiledOutputName(IProject project)
- {
- ILAsmProject p = (ILAsmProject)project;
- ILAsmCompilerParameters compilerparameters = (ILAsmCompilerParameters)p.ActiveConfiguration;
- string exe = fileUtilityService.GetDirectoryNameWithSeparator(compilerparameters.OutputDirectory) + compilerparameters.OutputAssembly + ".exe";
- return exe;
- }
-
public bool CanCompile(string fileName)
{
return Path.GetExtension(fileName).ToUpper() == ".IL";
}
- ICompilerResult Compile(ILAsmCompilerParameters compilerparameters, string[] fileNames)
+ ICompilerResult Compile (DotNetProjectConfiguration configuration, string[] fileNames)
{
// TODO: No response file possible ? @FILENAME seems not to work.
StringBuilder parameters = new StringBuilder();
@@ -57,11 +44,25 @@
parameters.Append("\" ");
}
- string outputFile = Path.GetFullPath(fileUtilityService.GetDirectoryNameWithSeparator(compilerparameters.OutputDirectory) + compilerparameters.OutputAssembly + ".exe");
+ string outputFile = configuration.CompiledOutputName;
Console.WriteLine (outputFile);
parameters.Append("/out:" + outputFile);
parameters.Append(" ");
- parameters.Append(compilerparameters.CurrentCompilerOptions.GenerateOptions());
+
+ switch (configuration.CompileTarget) {
+ case CompileTarget.Library:
+ parameters.Append("/dll ");
+ break;
+ case CompileTarget.Exe:
+ parameters.Append("/exe ");
+ break;
+ default:
+ throw new System.NotSupportedException("Unsupported compilation target : " + configuration.CompileTarget);
+ }
+
+ if (configuration.DebugMode)
+ parameters.Append("/DEBUG ");
+
string outstr = parameters.ToString();
TempFileCollection tf = new TempFileCollection();
@@ -103,22 +104,11 @@
p.WaitForExit ();
}
- public ICompilerResult CompileFile(string fileName, ILAsmCompilerParameters compilerparameters)
+ public ICompilerResult Compile (ProjectFileCollection projectFiles, ProjectReferenceCollection references, DotNetProjectConfiguration configuration)
{
- compilerparameters.OutputDirectory = Path.GetDirectoryName(fileName);
- compilerparameters.OutputAssembly = Path.GetFileNameWithoutExtension(fileName);
-
- return Compile(compilerparameters, new string[] { fileName });
- }
-
- public ICompilerResult CompileProject(IProject project)
- {
- ILAsmProject p = (ILAsmProject)project;
- ILAsmCompilerParameters compilerparameters = (ILAsmCompilerParameters)p.ActiveConfiguration;
-
ArrayList fileNames = new ArrayList();
- foreach (ProjectFile finfo in p.ProjectFiles) {
+ foreach (ProjectFile finfo in projectFiles) {
if (finfo.Subtype != Subtype.Directory) {
switch (finfo.BuildAction) {
case BuildAction.Compile:
@@ -132,7 +122,7 @@
}
}
- return Compile(compilerparameters, (string[])fileNames.ToArray(typeof(string)));
+ return Compile (configuration, (string[])fileNames.ToArray(typeof(string)));
}
string GetCompilerName()
Index: Core/src/AddIns/BackendBindings/ILAsmBinding/Gui/CompilerParametersPanel.cs
===================================================================
--- Core/src/AddIns/BackendBindings/ILAsmBinding/Gui/CompilerParametersPanel.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/ILAsmBinding/Gui/CompilerParametersPanel.cs (working copy)
@@ -22,6 +22,8 @@
public class CompilerParametersPanel : AbstractOptionPanel
{
ILAsmCompilerParameters compilerParameters = null;
+ DotNetProjectConfiguration configuration;
+
Entry outputPath = new Entry ();
Entry assemblyName = new Entry ();
RadioButton exeTarget = new RadioButton ("exe");
@@ -30,7 +32,8 @@
public override void LoadPanelContents()
{
- this.compilerParameters = (ILAsmCompilerParameters)((IProperties)CustomizationObject).GetProperty("Config");
+ configuration = (DotNetProjectConfiguration)((IProperties)CustomizationObject).GetProperty("Config");
+ compilerParameters = (ILAsmCompilerParameters) configuration.CompilationParameters;
dllTarget = new RadioButton (exeTarget, "dll");
SetupUI ();
@@ -40,13 +43,13 @@
public override bool StorePanelContents()
{
- compilerParameters.AssemblyName = assemblyName.Text;
- compilerParameters.OutputPath = outputPath.Text;
- compilerParameters.IncludeDebugInformation = debug.Active;
+ configuration.OutputAssembly = assemblyName.Text;
+ configuration.OutputDirectory = outputPath.Text;
+ configuration.DebugMode = debug.Active;
if (exeTarget.Active)
- compilerParameters.CompilationTarget = CompilationTarget.Exe;
+ configuration.CompileTarget = CompileTarget.Exe;
else
- compilerParameters.CompilationTarget = CompilationTarget.Dll;
+ configuration.CompileTarget = CompileTarget.Library;
return true;
}
@@ -73,13 +76,13 @@
void RestoreValues ()
{
- assemblyName.Text = compilerParameters.AssemblyName;
- outputPath.Text = compilerParameters.OutputPath;
- if (compilerParameters.CompilationTarget == CompilationTarget.Exe)
+ assemblyName.Text = configuration.OutputAssembly;
+ outputPath.Text = configuration.OutputDirectory;
+ if (configuration.CompileTarget == CompileTarget.Exe)
exeTarget.Active = true;
else
dllTarget.Active = true;
- debug.Active = compilerParameters.IncludeDebugInformation;
+ debug.Active = configuration.DebugMode;
}
}
}
Index: Core/src/AddIns/BackendBindings/ILAsmBinding/Project/ILAsmProject.cs
===================================================================
--- Core/src/AddIns/BackendBindings/ILAsmBinding/Project/ILAsmProject.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/ILAsmBinding/Project/ILAsmProject.cs (working copy)
@@ -1,50 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krueger" email="mike@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 ILAsmBinding
-{
- public class ILAsmProject : AbstractProject
- {
- public override string ProjectType {
- get {
- return ILAsmLanguageBinding.LanguageName;
- }
- }
-
- public ILAsmProject()
- {
- }
-
- public override IConfiguration CreateConfiguration()
- {
- return new ILAsmCompilerParameters();
- }
-
- public ILAsmProject(ProjectCreateInformation info, XmlElement projectOptions)
- {
- if (info != null) {
- Name = info.ProjectName;
- Configurations.Add(CreateConfiguration("Debug"));
- Configurations.Add(CreateConfiguration("Release"));
- foreach (ILAsmCompilerParameters parameter in Configurations) {
- parameter.OutputDirectory = info.BinPath + Path.DirectorySeparatorChar + parameter.Name;
- parameter.OutputAssembly = Name;
- }
- }
- }
- }
-}
Index: Core/src/AddIns/BackendBindings/ILAsmBinding/Project/ILAsmCompilerParameters.cs
===================================================================
--- Core/src/AddIns/BackendBindings/ILAsmBinding/Project/ILAsmCompilerParameters.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/ILAsmBinding/Project/ILAsmCompilerParameters.cs (working copy)
@@ -13,107 +13,15 @@
using System.ComponentModel;
using MonoDevelop.Gui.Components;
using MonoDevelop.Internal.Project;
+using MonoDevelop.Internal.Serialization;
namespace ILAsmBinding
{
/// <summary>
/// This class handles project specific compiler parameters
/// </summary>
- public class ILAsmCompilerParameters : AbstractProjectConfiguration
+ public class ILAsmCompilerParameters
{
- CompilerOptions compilerOptions = new CompilerOptions();
-
- [Browsable(false)]
- public CompilerOptions CurrentCompilerOptions {
- get {
- return compilerOptions;
- }
- }
-
- [LocalizedProperty("Output path",
- Description = "The path where the assembly is created.")]
- public string OutputPath {
- get {
- return OutputDirectory;
- }
- set {
- OutputDirectory = value;
- }
- }
-
- [LocalizedProperty("Output assembly",
- Description = "The assembly name.")]
- public string AssemblyName {
- get {
- return OutputAssembly;
- }
- set {
- OutputAssembly = value;
- }
- }
-
- [DefaultValue(CompilationTarget.Exe)]
- [LocalizedProperty("Compilation Target",
- Description = "The compilation target of the source code. (/dll, /exe)")]
- public CompilationTarget CompilationTarget {
- get {
- return compilerOptions.compilationTarget;
- }
- set {
- compilerOptions.compilationTarget = value;
- }
- }
-
- [DefaultValue(false)]
- [LocalizedProperty("Include debug information",
- Description = "Specifies if debug information should be omited. (/DEBUG)")]
- public bool IncludeDebugInformation {
- get {
- return compilerOptions.includeDebugInformation;
- }
- set {
- compilerOptions.includeDebugInformation = value;
- }
- }
-
- public ILAsmCompilerParameters()
- {
- }
-
- public ILAsmCompilerParameters(string name)
- {
- this.name = name;
- }
-
- [XmlNodeName("CompilerOptions")]
- public class CompilerOptions
- {
- [XmlAttribute("compilationTarget")]
- public CompilationTarget compilationTarget = CompilationTarget.Exe;
-
- [XmlAttribute("includeDebugInformation")]
- internal bool includeDebugInformation = false;
-
- public string GenerateOptions()
- {
- StringBuilder options = new StringBuilder();
- switch (compilationTarget) {
- case ILAsmBinding.CompilationTarget.Dll:
- options.Append("/dll ");
- break;
- case ILAsmBinding.CompilationTarget.Exe:
- options.Append("/exe ");
- break;
- default:
- throw new System.NotSupportedException("Unsupported compilation target : " + compilationTarget);
- }
-
- if (includeDebugInformation) {
- options.Append("/DEBUG ");
- }
-
- return options.ToString();
- }
- }
+ // Add options here
}
}
Index: Core/src/AddIns/BackendBindings/ILAsmBinding/Project/CompilationTarget.cs
===================================================================
--- Core/src/AddIns/BackendBindings/ILAsmBinding/Project/CompilationTarget.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/ILAsmBinding/Project/CompilationTarget.cs (working copy)
@@ -1,11 +0,0 @@
-using System;
-
-namespace ILAsmBinding
-{
- public enum CompilationTarget
- {
- Exe,
- Dll,
- }
-}
-
Index: Core/src/AddIns/BackendBindings/ILAsmBinding/ChangeLog
===================================================================
--- Core/src/AddIns/BackendBindings/ILAsmBinding/ChangeLog (revision 2122)
+++ Core/src/AddIns/BackendBindings/ILAsmBinding/ChangeLog (working copy)
@@ -1,3 +1,16 @@
+2005-01-11 Lluis Sanchez Gual <lluis@novell.com>
+
+ * ILAsmCompilerManager.cs:
+ * Gui/CompilerParametersPanel.cs:
+ * ILAsmBinding.addin.xml:
+ * ILAsmLanguageBinding.cs: Follow architecture changes.
+
+ * Project/ILAsmProject.cs: Removed. Not needed any more.
+ * Project/ILAsmCompilerParameters.cs: All parameters have been moved to
+ DotNetProjectConfiguration.
+ * Project/CompilationTarget.cs: Moved to Monodevelop.Base.
+ * Makefile.am: Updated.
+
2004-12-13 Lluis Sanchez Gual <lluis@novell.com>
* ILAsmCompilerManager.cs: StatusBarService.ProgressMonitor is not a
Index: Core/src/AddIns/BackendBindings/ILAsmBinding/ILAsmExecutionManager.cs
===================================================================
--- Core/src/AddIns/BackendBindings/ILAsmBinding/ILAsmExecutionManager.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/ILAsmBinding/ILAsmExecutionManager.cs (working copy)
@@ -1,59 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krueger" email="mike@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 Gtk;
-
-using MonoDevelop.Internal.Project;
-using MonoDevelop.Gui;
-using MonoDevelop.Services;
-using MonoDevelop.Core.Services;
-
-namespace ILAsmBinding
-{
- /// <summary>
- /// This class describes the main functionalaty of a language codon
- /// </summary>
- public class ILAsmExecutionManager
- {
- public void Execute(string filename, bool debug)
- {
- string exe = Path.ChangeExtension(filename, ".exe");
- ProcessStartInfo psi = new ProcessStartInfo("\"" + exe + "\"");
- psi.WorkingDirectory = Path.GetDirectoryName(exe);
- psi.UseShellExecute = true;
-
- //DebuggerService debuggerService = (DebuggerService)ServiceManager.Services.GetService(typeof(DebuggerService));
- //debuggerService.StartWithoutDebugging(psi);
- }
-
- public void Execute(IProject project, bool debug)
- {
- ILAsmCompilerParameters parameters = (ILAsmCompilerParameters)project.ActiveConfiguration;
- FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.GetService(typeof(FileUtilityService));
-
- string exe = Path.GetFullPath(Path.Combine(parameters.OutputDirectory, parameters.OutputAssembly) + ".exe");
- string fullCommand = String.Format ("-e \"mono {0};read -p 'press any key to continue...' -n1\"", exe);
- Console.WriteLine (fullCommand);
- ProcessStartInfo psi = new ProcessStartInfo("xterm", fullCommand);
- psi.WorkingDirectory = Path.GetDirectoryName (exe);
- psi.UseShellExecute = false;
- Process p = Process.Start (psi);
- p.WaitForExit ();
- //DebuggerService debuggerService = (DebuggerService)ServiceManager.Services.GetService(typeof(DebuggerService));
- //debuggerService.StartWithoutDebugging(psi);
- }
- }
-}
Index: Core/src/AddIns/BackendBindings/ILAsmBinding/ILAsmLanguageBinding.cs
===================================================================
--- Core/src/AddIns/BackendBindings/ILAsmBinding/ILAsmLanguageBinding.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/ILAsmBinding/ILAsmLanguageBinding.cs (working copy)
@@ -19,6 +19,7 @@
using MonoDevelop.Internal.Project;
using MonoDevelop.Internal.Templates;
using MonoDevelop.Gui;
+using MonoDevelop.Services;
namespace ILAsmBinding
{
@@ -26,89 +27,41 @@
{
public const string LanguageName = "ILAsm";
- ILAsmExecutionManager executionManager = new ILAsmExecutionManager();
ILAsmCompilerManager compilerManager = new ILAsmCompilerManager();
+ public ILAsmLanguageBinding ()
+ {
+ Runtime.ProjectService.DataContext.IncludeType (typeof(ILAsmCompilerParameters));
+ }
+
public string Language {
get {
return LanguageName;
}
}
- public void Execute(string filename)
- {
- Execute (filename, false);
- }
-
- public void Execute(string filename, bool debug)
- {
- Debug.Assert(executionManager != null);
- executionManager.Execute(filename, debug);
- }
-
- public void Execute (IProject project)
- {
- Execute (project, false);
- }
-
- public void DebugProject (IProject project)
- {
- Execute (project, true);
- }
-
- public void Execute(IProject project, bool debug)
- {
- Debug.Assert(executionManager != null);
- executionManager.Execute(project, debug);
- }
-
- public string GetCompiledOutputName(string fileName)
- {
- Debug.Assert(compilerManager != null);
- return compilerManager.GetCompiledOutputName(fileName);
- }
-
- public string GetCompiledOutputName(IProject project)
- {
- Debug.Assert(compilerManager != null);
- return compilerManager.GetCompiledOutputName(project);
- }
-
public bool CanCompile(string fileName)
{
Debug.Assert(compilerManager != null);
return compilerManager.CanCompile(fileName);
}
- public ICompilerResult CompileFile(string fileName)
+ public ICompilerResult Compile (ProjectFileCollection projectFiles, ProjectReferenceCollection references, DotNetProjectConfiguration configuration)
{
Debug.Assert(compilerManager != null);
- ILAsmCompilerParameters param = new ILAsmCompilerParameters();
- param.OutputAssembly = Path.ChangeExtension(fileName, ".exe");
- return compilerManager.CompileFile(fileName, param);
+ return compilerManager.Compile (projectFiles, references, configuration);
}
- public ICompilerResult CompileProject(IProject project)
+ public void GenerateMakefile (Project project, Combine parentCombine)
{
- Debug.Assert(compilerManager != null);
- return compilerManager.CompileProject(project);
+ throw new NotImplementedException ();
}
- public ICompilerResult RecompileProject(IProject project)
+ public object CreateCompilationParameters (XmlElement projectOptions)
{
- return CompileProject(project);
+ return new ILAsmCompilerParameters();
}
- public IProject CreateProject(ProjectCreateInformation info, XmlElement projectOptions)
- {
- return new ILAsmProject(info, projectOptions);
- }
-
- public void GenerateMakefile (IProject project, Combine parentCombine)
- {
- throw new NotImplementedException ();
- }
-
// source: irc
public string CommentTag
{
Index: Core/src/AddIns/BackendBindings/ILAsmBinding/Makefile.am
===================================================================
--- Core/src/AddIns/BackendBindings/ILAsmBinding/Makefile.am (revision 2122)
+++ Core/src/AddIns/BackendBindings/ILAsmBinding/Makefile.am (working copy)
@@ -9,13 +9,10 @@
FILES = \
Gui/CompilerParametersPanel.cs \
-Project/CompilationTarget.cs \
-Project/ILAsmProject.cs \
Project/ILAsmCompilerParameters.cs \
ILAsmCompilerManager.cs \
AssemblyInfo.cs \
-ILAsmLanguageBinding.cs \
-ILAsmExecutionManager.cs
+ILAsmLanguageBinding.cs
TEMPLATES = \
ILAsmConsoleProject.xpt.xml
Index: Core/src/AddIns/BackendBindings/ILAsmBinding/ILAsmBinding.addin.xml
===================================================================
--- Core/src/AddIns/BackendBindings/ILAsmBinding/ILAsmBinding.addin.xml (revision 2122)
+++ Core/src/AddIns/BackendBindings/ILAsmBinding/ILAsmBinding.addin.xml (working copy)
@@ -15,7 +15,7 @@
</Extension>
<Extension path = "/SharpDevelop/Workbench/ProjectOptions/ConfigurationProperties">
- <Conditional activeproject = "ILAsm">
+ <Conditional activelanguage = "ILAsm">
<DialogPanel id = "ILAsmCompilerParametersPanel"
_label = "Compiler"
class = "ILAsmBinding.CompilerParametersPanel"/>
Index: Core/src/AddIns/BackendBindings/NemerleBinding/NemerleBinding.addin.xml
===================================================================
--- Core/src/AddIns/BackendBindings/NemerleBinding/NemerleBinding.addin.xml (revision 2122)
+++ Core/src/AddIns/BackendBindings/NemerleBinding/NemerleBinding.addin.xml (working copy)
@@ -33,7 +33,7 @@
</Extension>
<Extension path = "/SharpDevelop/Workbench/ProjectOptions/ConfigurationProperties">
- <Conditional activeproject = "Nemerle">
+ <Conditional activelanguage = "Nemerle">
<DialogPanel id = "NemerleCodeGenerationPanel"
_label = "Code Generation"
class = "NemerleBinding.CodeGenerationPanel"/>
Index: Core/src/AddIns/BackendBindings/NemerleBinding/Nemerle.glade
===================================================================
--- Core/src/AddIns/BackendBindings/NemerleBinding/Nemerle.glade (revision 2122)
+++ Core/src/AddIns/BackendBindings/NemerleBinding/Nemerle.glade (working copy)
@@ -11,6 +11,11 @@
<property name="modal">False</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
+ <property name="decorated">True</property>
+ <property name="skip_taskbar_hint">False</property>
+ <property name="skip_pager_hint">False</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
+ <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<child>
<widget class="GtkVBox" id="vbox62">
@@ -157,6 +162,7 @@
<property name="label" translatable="yes">Do not load standard macros</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
@@ -175,6 +181,7 @@
<property name="label" translatable="yes">Do not load standard library</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
@@ -193,6 +200,7 @@
<property name="label" translatable="yes">Ignore warnings</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
@@ -279,6 +287,7 @@
<property name="label" translatable="yes">General tail call optimization</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
@@ -297,6 +306,7 @@
<property name="label" translatable="yes">Ordinal constant matching optimization</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
@@ -315,6 +325,7 @@
<property name="label" translatable="yes">String constant matching optimization</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
@@ -333,6 +344,7 @@
<property name="label" translatable="yes">Boolean constant matching optimization</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
@@ -361,381 +373,4 @@
</child>
</widget>
-<widget class="GtkWindow" id="OutputPanel">
- <property name="visible">True</property>
- <property name="title" translatable="yes">OutputPanel</property>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_NONE</property>
- <property name="modal">False</property>
- <property name="resizable">True</property>
- <property name="destroy_with_parent">False</property>
- <accessibility>
- <atkproperty name="AtkObject::accessible_name" translatable="yes">OutputPanel</atkproperty>
- </accessibility>
-
- <child>
- <widget class="GtkVBox" id="vbox66">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label93">
- <property name="visible">True</property>
- <property name="label" translatable="yes"><b>Output</b></property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox57">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkLabel" id="label91">
- <property name="visible">True</property>
- <property name="label" translatable="yes"> </property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox69">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkTable" id="table10">
- <property name="visible">True</property>
- <property name="n_rows">3</property>
- <property name="n_columns">3</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label98">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Assembly _name</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">assemblyName</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label99">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Output _path</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">outputPath</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label100">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Paramet_ers</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">parameters</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="outputPath">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char" translatable="yes">*</property>
- <property name="activates_default">False</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkButton" id="outputPathButton">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">...</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- </widget>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="assemblyName">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char" translatable="yes">*</property>
- <property name="activates_default">False</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">3</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="parameters">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char" translatable="yes">*</property>
- <property name="activates_default">False</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">3</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="y_options"></property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label94">
- <property name="visible">True</property>
- <property name="label" translatable="yes"><b>Execute scripts </b></property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox58">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkLabel" id="label92">
- <property name="visible">True</property>
- <property name="label" translatable="yes"> </property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkTable" id="table9">
- <property name="visible">True</property>
- <property name="n_rows">1</property>
- <property name="n_columns">2</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label95">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Execute Command</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="executeCommand">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char" translatable="yes">*</property>
- <property name="activates_default">False</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="y_options"></property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
-</widget>
-
</glade-interface>
Index: Core/src/AddIns/BackendBindings/NemerleBinding/NemerleBindingExecutionServices.cs.in
===================================================================
--- Core/src/AddIns/BackendBindings/NemerleBinding/NemerleBindingExecutionServices.cs.in (revision 2122)
+++ Core/src/AddIns/BackendBindings/NemerleBinding/NemerleBindingExecutionServices.cs.in (working copy)
@@ -1,59 +0,0 @@
-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 NemerleBinding
-{
- public class NemerleBindingExecutionServices
- {
-
- public void Execute(string filename)
- {
- throw new ApplicationException("No ExecuteFile");
- }
-
- public void Execute(IProject project)
- {
-
- NemerleParameters p = (NemerleParameters)project.ActiveConfiguration;
- FileUtilityService fus = (FileUtilityService)ServiceManager.GetService(typeof(FileUtilityService));
- string exe;
-
- if (p.ExecuteScript == String.Empty)
- {
- exe = "@RUNTIME@ ";
- } else
- {
- exe = p.ExecuteScript;
- }
-
- exe += " " + p.OutputAssembly + ".exe " + p.Parameters;
-
- try {
- ProcessStartInfo psi = new ProcessStartInfo("xterm",
- string.Format (
- @"-e ""{0} ;echo;read -p 'press any key to continue...' -n1""",
- exe));
- psi.WorkingDirectory = fus.GetDirectoryNameWithSeparator(p.OutputDirectory);
- psi.UseShellExecute = false;
-
- Process pr = new Process();
- pr.StartInfo = psi;
- pr.Start();
- } catch (Exception) {
- throw new ApplicationException("Can not execute");
- }
- }
-
- }
-}
Index: Core/src/AddIns/BackendBindings/NemerleBinding/Gui/OutputPanel.cs
===================================================================
--- Core/src/AddIns/BackendBindings/NemerleBinding/Gui/OutputPanel.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/NemerleBinding/Gui/OutputPanel.cs (working copy)
@@ -1,71 +0,0 @@
-using System;
-using System.IO;
-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;
-
-using Gtk;
-using MonoDevelop.Gui.Widgets;
-
-namespace NemerleBinding
-{
- public class OutputPanel : AbstractOptionPanel
- {
- class OutputPanelWidget : GladeWidgetExtract
- {
- [Glade.Widget] Entry assemblyName;
- [Glade.Widget] Entry outputPath;
- [Glade.Widget] Entry parameters;
- [Glade.Widget] Entry executeCommand;
- [Glade.Widget] Button outputPathButton;
-
- NemerleParameters compilerParameters = null;
-
- public OutputPanelWidget(IProperties CustomizationObject) : base ("Nemerle.glade", "OutputPanel")
- {
- compilerParameters = (NemerleParameters)((IProperties)CustomizationObject).GetProperty("Config");
-
- outputPathButton.Clicked += new EventHandler(SelectFolder);
- assemblyName.Text = compilerParameters.OutputAssembly;
- outputPath.Text = compilerParameters.OutputDirectory;
- parameters.Text = compilerParameters.Parameters;
- executeCommand.Text = compilerParameters.ExecuteScript;
- }
-
- public bool Store ()
- {
- compilerParameters.OutputAssembly = assemblyName.Text;
- compilerParameters.OutputDirectory = outputPath.Text;
- compilerParameters.Parameters = parameters.Text;
- compilerParameters.ExecuteScript = executeCommand.Text;
- return true;
- }
- void SelectFolder(object sender, EventArgs e)
- {
- using (FileSelector fdiag = new FileSelector ("Output Path"))
- {
- if (fdiag.Run () == (int) ResponseType.Ok)
- outputPath.Text = fdiag.Filename;
- fdiag.Hide();
- }
- }
- }
-
- OutputPanelWidget widget;
-
- public override void LoadPanelContents()
- {
- Add (widget = new OutputPanelWidget ((IProperties) CustomizationObject));
- }
-
- public override bool StorePanelContents()
- {
- return widget.Store ();
- }
- }
-}
Index: Core/src/AddIns/BackendBindings/NemerleBinding/Gui/CodeGenerationPanel.cs
===================================================================
--- Core/src/AddIns/BackendBindings/NemerleBinding/Gui/CodeGenerationPanel.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/NemerleBinding/Gui/CodeGenerationPanel.cs (working copy)
@@ -28,16 +28,18 @@
[Glade.Widget] CheckButton oscm;
NemerleParameters compilerParameters = null;
+ DotNetProjectConfiguration configuration;
public CodeGenerationPanelWidget(IProperties CustomizationObject) : base ("Nemerle.glade", "CodeGenerationPanel")
{
- compilerParameters = (NemerleParameters)((IProperties)CustomizationObject).GetProperty("Config");
+ configuration = (DotNetProjectConfiguration) ((IProperties)CustomizationObject).GetProperty("Config");
+ compilerParameters = (NemerleParameters) configuration.CompilationParameters;
- target.SetHistory ( (uint) compilerParameters.Target);
+ target.SetHistory ( (uint) configuration.CompileTarget);
nostdmacros.Active = compilerParameters.Nostdmacros;
nostdlib.Active = compilerParameters.Nostdlib;
- ignorewarnings.Active = compilerParameters.RunWithWarnings;
+ ignorewarnings.Active = configuration.RunWithWarnings;
ot.Active = compilerParameters.Ot;
obcm.Active = compilerParameters.Obcm;
oocm.Active = compilerParameters.Oocm;
@@ -46,10 +48,10 @@
public bool Store ()
{
- compilerParameters.Target = (NemerleBinding.CompileTarget)target.History;
+ configuration.CompileTarget = (CompileTarget)target.History;
compilerParameters.Nostdmacros = nostdmacros.Active;
compilerParameters.Nostdlib = nostdlib.Active;
- compilerParameters.RunWithWarnings = ignorewarnings.Active;
+ configuration.RunWithWarnings = ignorewarnings.Active;
compilerParameters.Ot = ot.Active;
compilerParameters.Obcm = obcm.Active;
compilerParameters.Oocm = oocm.Active;
Index: Core/src/AddIns/BackendBindings/NemerleBinding/NemerleBindingCompilerServices.cs
===================================================================
--- Core/src/AddIns/BackendBindings/NemerleBinding/NemerleBindingCompilerServices.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/NemerleBinding/NemerleBindingCompilerServices.cs (working copy)
@@ -80,7 +80,7 @@
FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.GetService(typeof(FileUtilityService));
static string ncc = "ncc";
- private string GetOptionsString(NemerleParameters cp)
+ private string GetOptionsString (DotNetProjectConfiguration configuration, NemerleParameters cp)
{
string options = " ";
if (cp.Nostdmacros)
@@ -95,7 +95,7 @@
options += " -Oocm";
if (cp.Oscm)
options += " -Oscm";
- if ((int)cp.Target == 1)
+ if (configuration.CompileTarget == CompileTarget.Library)
options += " -tdll";
return options;
@@ -106,35 +106,18 @@
return Path.GetExtension(fileName) == ".n";
}
- public ICompilerResult CompileFile(string fileName)
+ public ICompilerResult Compile (ProjectFileCollection projectFiles, ProjectReferenceCollection projectReferences, DotNetProjectConfiguration configuration)
{
- throw new ApplicationException("No CompileFile");
- }
-
- public string GetCompiledOutputName(string fileName)
- {
- throw new ApplicationException("No CompileFile");
- }
-
- public string GetCompiledOutputName(IProject project)
- {
- NemerleParameters cp = (NemerleParameters)project.ActiveConfiguration;
+ NemerleParameters cp = (NemerleParameters) configuration.CompilationParameters;
+ if (cp == null) cp = new NemerleParameters ();
- return fileUtilityService.GetDirectoryNameWithSeparator(cp.OutputDirectory)
- + cp.OutputAssembly + ((int)cp.Target == 0?".exe":".dll");
- }
-
- public ICompilerResult CompileProject(IProject project)
- {
- NemerleParameters cp = (NemerleParameters)project.ActiveConfiguration;
-
string references = "";
string files = "";
- foreach (ProjectReference lib in project.ProjectReferences)
- references += " -r \"" + lib.GetReferencedFileName(project) + "\"";
+ foreach (ProjectReference lib in projectReferences)
+ references += " -r \"" + lib.GetReferencedFileName() + "\"";
- foreach (ProjectFile f in project.ProjectFiles)
+ foreach (ProjectFile f in projectFiles)
if (f.Subtype != Subtype.Directory)
switch (f.BuildAction)
{
@@ -143,10 +126,10 @@
break;
}
- if (!Directory.Exists(cp.OutputDirectory))
- Directory.CreateDirectory(cp.OutputDirectory);
+ if (!Directory.Exists (configuration.OutputDirectory))
+ Directory.CreateDirectory (configuration.OutputDirectory);
- string args = "-q -no-color " + GetOptionsString(cp) + references + files + " -o " + GetCompiledOutputName(project);
+ string args = "-q -no-color " + GetOptionsString (configuration, cp) + references + files + " -o " + configuration.CompiledOutputName;
return DoCompilation (args);
}
@@ -211,14 +194,14 @@
return cr.GetResult();
}
- public void GenerateMakefile (IProject project, Combine parentCombine)
+ public void GenerateMakefile (Project project, Combine parentCombine)
{
StreamWriter stream = new StreamWriter (Path.Combine (project.BaseDirectory, "Makefile." + project.Name.Replace (" ", "")));
- NemerleProject p = (NemerleProject)project;
- NemerleParameters cp =(NemerleParameters)p.ActiveConfiguration;
+ DotNetProjectConfiguration configuration = (DotNetProjectConfiguration) project.ActiveConfiguration;
+ NemerleParameters cp = (NemerleParameters) configuration.CompilationParameters;
- string outputName = Path.GetFileName(GetCompiledOutputName(project));
+ string outputName = Path.GetFileName (configuration.CompiledOutputName);
string relativeOutputDir = fileUtilityService.AbsoluteToRelativePath (project.BaseDirectory, parentCombine.OutputDirectory);
@@ -246,26 +229,26 @@
case ReferenceType.Gac:
string pkg = sas.GetPackageFromFullName (lib.Reference);
if (pkg == "MONO-SYSTEM") {
- system_references.Add (Path.GetFileName (lib.GetReferencedFileName (project)));
+ system_references.Add (Path.GetFileName (lib.GetReferencedFileName ()));
} else if (!pkg_references.Contains (pkg)) {
pkg_references.Add (pkg);
}
break;
case ReferenceType.Assembly:
- string assembly_fileName = lib.GetReferencedFileName (project);
+ string assembly_fileName = lib.GetReferencedFileName ();
string rel_path_to = fileUtilityService.AbsoluteToRelativePath (project.BaseDirectory, Path.GetDirectoryName (assembly_fileName));
assembly_references.Add (Path.Combine (rel_path_to, Path.GetFileName (assembly_fileName)));
break;
case ReferenceType.Project:
- string project_fileName = lib.GetReferencedFileName (project);
+ string project_fileName = lib.GetReferencedFileName ();
IProjectService prjService = (IProjectService)ServiceManager.GetService (typeof (IProjectService));
- ArrayList allProjects = Combine.GetAllProjects(prjService.CurrentOpenCombine);
+ CombineEntryCollection allProjects = prjService.CurrentOpenCombine.GetAllProjects();
- foreach (ProjectCombineEntry projectEntry in allProjects) {
- if (projectEntry.Project.Name == lib.Reference) {
- string project_base_dir = fileUtilityService.AbsoluteToRelativePath (project.BaseDirectory, projectEntry.Project.BaseDirectory);
+ foreach (Project projectEntry in allProjects) {
+ if (projectEntry.Name == lib.Reference) {
+ string project_base_dir = fileUtilityService.AbsoluteToRelativePath (project.BaseDirectory, projectEntry.BaseDirectory);
- string project_output_fileName = prjService.GetOutputAssemblyName (projectEntry.Project);
+ string project_output_fileName = projectEntry.GetOutputFileName ();
project_references.Add (Path.Combine (project_base_dir, Path.GetFileName (project_output_fileName)));
}
}
@@ -349,7 +332,7 @@
stream.WriteLine ();
}
- stream.Write ("NCC_OPTIONS = " + GetOptionsString(cp));
+ stream.Write ("NCC_OPTIONS = " + GetOptionsString (configuration, cp));
stream.WriteLine ();
stream.WriteLine ();
Index: Core/src/AddIns/BackendBindings/NemerleBinding/Project/NemerleParameters.cs
===================================================================
--- Core/src/AddIns/BackendBindings/NemerleBinding/Project/NemerleParameters.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/NemerleBinding/Project/NemerleParameters.cs (working copy)
@@ -3,89 +3,68 @@
using System.Diagnostics;
using MonoDevelop.Internal.Project;
+using MonoDevelop.Internal.Serialization;
namespace NemerleBinding
{
- public enum CompileTarget
+ public class NemerleParameters
{
- Executable,
- Library
- };
-
- public class NemerleParameters : AbstractProjectConfiguration
- {
- [XmlNodeName("CodeGeneration")]
- class CodeGeneration
- {
- [XmlAttribute("target")]
- public CompileTarget target = CompileTarget.Executable;
- [XmlAttribute("nostdmacros")]
- public bool nostdmacros = false;
- [XmlAttribute("nostdlib")]
- public bool nostdlib = false;
- [XmlAttribute("ot")]
- public bool ot = false;
- [XmlAttribute("obcm")]
- public bool obcm = true;
- [XmlAttribute("oocm")]
- public bool oocm = true;
- [XmlAttribute("oscm")]
- public bool oscm = true;
-
- [XmlAttribute("parameters")]
- public string parameters = String.Empty;
- }
+ [ItemProperty("nostdmacros")]
+ public bool nostdmacros = false;
+
+ [ItemProperty("nostdlib")]
+ public bool nostdlib = false;
+
+ [ItemProperty("ot")]
+ public bool ot = false;
+
+ [ItemProperty("obcm")]
+ public bool obcm = true;
+
+ [ItemProperty("oocm")]
+ public bool oocm = true;
+
+ [ItemProperty("oscm")]
+ public bool oscm = true;
+
+ [ItemProperty("parameters")]
+ public string parameters = String.Empty;
- CodeGeneration codeGeneration = new CodeGeneration();
-
- public CompileTarget Target
- {
- get { return codeGeneration.target; }
- set { codeGeneration.target = value; }
- }
public bool Nostdmacros
{
- get { return codeGeneration.nostdmacros; }
- set { codeGeneration.nostdmacros = value; }
+ get { return nostdmacros; }
+ set { nostdmacros = value; }
}
public bool Nostdlib
{
- get { return codeGeneration.nostdlib; }
- set { codeGeneration.nostdlib = value; }
+ get { return nostdlib; }
+ set { nostdlib = value; }
}
public bool Ot
{
- get { return codeGeneration.ot; }
- set { codeGeneration.ot = value; }
+ get { return ot; }
+ set { ot = value; }
}
public bool Obcm
{
- get { return codeGeneration.obcm; }
- set { codeGeneration.obcm = value; }
+ get { return obcm; }
+ set { obcm = value; }
}
public bool Oocm
{
- get { return codeGeneration.oocm; }
- set { codeGeneration.oocm = value; }
+ get { return oocm; }
+ set { oocm = value; }
}
public bool Oscm
{
- get { return codeGeneration.oscm; }
- set { codeGeneration.oscm = value; }
+ get { return oscm; }
+ set { oscm = value; }
}
public string Parameters
{
- get { return codeGeneration.parameters; }
- set { codeGeneration.parameters = value; }
+ get { return parameters; }
+ set { parameters = value; }
}
-
- public NemerleParameters()
- {
- }
- public NemerleParameters(string name)
- {
- this.name = name;
- }
}
}
Index: Core/src/AddIns/BackendBindings/NemerleBinding/Project/NemerleProject.cs
===================================================================
--- Core/src/AddIns/BackendBindings/NemerleBinding/Project/NemerleProject.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/NemerleBinding/Project/NemerleProject.cs (working copy)
@@ -1,48 +0,0 @@
-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 NemerleBinding
-{
- public class NemerleProject : AbstractProject
- {
- public override string ProjectType {
- get {
- return NemerleLanguageBinding.LanguageName;
- }
- }
-
- public override IConfiguration CreateConfiguration()
- {
- return new NemerleParameters();
- }
-
- public NemerleProject()
- {
- }
-
- public NemerleProject(ProjectCreateInformation info, XmlElement projectOptions)
- {
- if (info != null)
- {
- Name = info.ProjectName;
-
- Configurations.Add(CreateConfiguration("Debug"));
- Configurations.Add(CreateConfiguration("Release"));
-
- foreach (NemerleParameters p in Configurations)
- {
- p.OutputDirectory = info.BinPath + Path.DirectorySeparatorChar + p.Name;
- p.OutputAssembly = Name;
- p.RunWithWarnings = true;
- }
- }
- }
- }
-}
Index: Core/src/AddIns/BackendBindings/NemerleBinding/ChangeLog
===================================================================
--- Core/src/AddIns/BackendBindings/NemerleBinding/ChangeLog (revision 2122)
+++ Core/src/AddIns/BackendBindings/NemerleBinding/ChangeLog (working copy)
@@ -1,3 +1,20 @@
+2005-01-11 Lluis Sanchez Gual <lluis@novell.com>
+
+ * NemerleBinding.addin.xml:
+ * Gui/CodeGenerationPanel.cs:
+ * NemerleLanguageBinding.cs:
+ * NemerleBindingCompilerServices.cs: Follow architecture changes.
+
+ * Project/NemerleParameters.cs: Moved some common parameters to
+ DotNetProjectConfiguration.
+
+ * Gui/OutputPanel.cs:
+ * Nemerle.glade: Removed dialog now implemented in Monodevelop.Base.
+
+ * Project/NemerleProject.cs:
+ * NemerleBindingExecutionServices.cs.in: Removed.
+ * Makefile.am: Updated.
+
2004-12-13 Lluis Sanchez Gual <lluis@novell.com>
* NemerleBindingCompilerServices.cs: StatusBarService.ProgressMonitor is
Index: Core/src/AddIns/BackendBindings/NemerleBinding/Makefile.am
===================================================================
--- Core/src/AddIns/BackendBindings/NemerleBinding/Makefile.am (revision 2122)
+++ Core/src/AddIns/BackendBindings/NemerleBinding/Makefile.am (working copy)
@@ -12,9 +12,7 @@
FILES = \
Gui/CodeGenerationPanel.cs \
-Gui/OutputPanel.cs \
Project/NemerleParameters.cs \
-Project/NemerleProject.cs \
NemerleBindingCompilerServices.cs \
NemerleLanguageBinding.cs
@@ -25,7 +23,7 @@
NemerleGtkSharpWindow.xft.xml \
EmptyNemerleFile.xft.xml
-build_sources = $(addprefix $(srcdir)/, $(FILES)) NemerleBindingExecutionServices.cs
+build_sources = $(addprefix $(srcdir)/, $(FILES))
build_TEMPLATES = $(addprefix $(ADDIN_BUILD)/templates/, $(TEMPLATES))
@@ -62,5 +60,4 @@
template_DATA = $(TEMPLATES)
CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb
-DISTCLEANFILES = NemerleBindingExecutionServices.cs
-EXTRA_DIST = $(FILES) NemerleBindingExecutionServices.cs.in Nemerle.glade $(ADDIN) $(TEMPLATES)
+EXTRA_DIST = $(FILES) Nemerle.glade $(ADDIN) $(TEMPLATES)
Index: Core/src/AddIns/BackendBindings/NemerleBinding/NemerleLanguageBinding.cs
===================================================================
--- Core/src/AddIns/BackendBindings/NemerleBinding/NemerleLanguageBinding.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/NemerleBinding/NemerleLanguageBinding.cs (working copy)
@@ -9,6 +9,7 @@
using MonoDevelop.Internal.Project;
using MonoDevelop.Internal.Templates;
using MonoDevelop.Gui;
+using MonoDevelop.Services;
namespace NemerleBinding
{
@@ -20,67 +21,36 @@
public const string LanguageName = "Nemerle";
NemerleBindingCompilerServices compilerServices = new NemerleBindingCompilerServices();
- NemerleBindingExecutionServices executionServices = new NemerleBindingExecutionServices();
- public string Language {
- get { return LanguageName; }
- }
-
- public void Execute (string filename)
+ public NemerleLanguageBinding ()
{
- executionServices.Execute(filename);
+ Runtime.ProjectService.DataContext.IncludeType (typeof(NemerleParameters));
}
- public void Execute (IProject project)
- {
- executionServices.Execute (project);
+ public string Language {
+ get { return LanguageName; }
}
- public string GetCompiledOutputName(string fileName)
- {
- return compilerServices.GetCompiledOutputName(fileName);
- }
-
- public string GetCompiledOutputName(IProject project)
- {
- return compilerServices.GetCompiledOutputName(project);
- }
-
public bool CanCompile(string fileName)
{
return compilerServices.CanCompile(fileName);
}
- public ICompilerResult CompileFile(string fileName)
+ public ICompilerResult Compile (ProjectFileCollection projectFiles, ProjectReferenceCollection references, DotNetProjectConfiguration configuration)
{
- return compilerServices.CompileFile(fileName);
+ return compilerServices.Compile (projectFiles, references, configuration);
}
- public ICompilerResult CompileProject(IProject project)
+ public void GenerateMakefile (Project project, Combine parentCombine)
{
- return compilerServices.CompileProject(project);
+ compilerServices.GenerateMakefile(project, parentCombine);
}
- public ICompilerResult RecompileProject(IProject project)
+ public object CreateCompilationParameters (XmlElement projectOptions)
{
- return CompileProject(project);
+ return new NemerleParameters ();
}
- public IProject CreateProject(ProjectCreateInformation info, XmlElement projectOptions)
- {
- return new NemerleProject(info, projectOptions);
- }
-
- public void DebugProject (IProject project)
- {
- throw new ApplicationException("No Nemele debug");
- }
-
- public void GenerateMakefile (IProject project, Combine parentCombine)
- {
- compilerServices.GenerateMakefile(project, parentCombine);
- }
-
// http://nemerle.org/csharp-diff.html
public string CommentTag
{
Index: Core/src/AddIns/BackendBindings/VBNetBinding/VB.glade
===================================================================
--- Core/src/AddIns/BackendBindings/VBNetBinding/VB.glade (revision 2122)
+++ Core/src/AddIns/BackendBindings/VBNetBinding/VB.glade (working copy)
@@ -12,6 +12,11 @@
<property name="modal">False</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
+ <property name="decorated">True</property>
+ <property name="skip_taskbar_hint">False</property>
+ <property name="skip_pager_hint">False</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
+ <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<child>
<widget class="GtkVBox" id="vbox62">
@@ -203,6 +208,7 @@
<widget class="GtkOptionMenu" id="CompileTargetOptionMenu">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="history">-1</property>
</widget>
<packing>
<property name="left_attach">1</property>
@@ -350,6 +356,7 @@
<property name="label" translatable="yes">_Generate overflow checks</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
@@ -368,6 +375,7 @@
<property name="label" translatable="yes">Allow '_unsafe' code</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
@@ -386,6 +394,7 @@
<property name="label" translatable="yes">Enable _optimizations</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
@@ -404,6 +413,7 @@
<property name="label" translatable="yes">Treat warnings as _errors</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
@@ -422,6 +432,7 @@
<property name="label" translatable="yes">Generate _xml documentation</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
@@ -450,568 +461,4 @@
</child>
</widget>
-<widget class="GtkWindow" id="OutputOptionsPanel">
- <property name="visible">True</property>
- <property name="title" translatable="yes">OutputOptionsPanel</property>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_NONE</property>
- <property name="modal">False</property>
- <property name="resizable">True</property>
- <property name="destroy_with_parent">False</property>
-
- <child>
- <widget class="GtkVBox" id="vbox66">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkVBox" id="vbox67">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label93">
- <property name="visible">True</property>
- <property name="label" translatable="yes"><b>Output</b></property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox57">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label91">
- <property name="visible">True</property>
- <property name="label" translatable="yes"> </property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox69">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkTable" id="table10">
- <property name="visible">True</property>
- <property name="n_rows">3</property>
- <property name="n_columns">3</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label98">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Assembly _name</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">assemblyNameEntry</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label99">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Output _path</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">outputDirectoryEntry</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label100">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Paramet_ers</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">parametersEntry</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="outputDirectoryEntry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char" translatable="yes">*</property>
- <property name="activates_default">False</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkButton" id="browseButton">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">...</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- </widget>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="assemblyNameEntry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char" translatable="yes">*</property>
- <property name="activates_default">False</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">3</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="parametersEntry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char" translatable="yes">*</property>
- <property name="activates_default">False</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">3</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="y_options"></property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkCheckButton" id="pauseConsoleOutputCheckButton">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Pause _console output</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox68">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label94">
- <property name="visible">True</property>
- <property name="label" translatable="yes"><b>Execute scripts </b></property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox58">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label92">
- <property name="visible">True</property>
- <property name="label" translatable="yes"> </property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkTable" id="table9">
- <property name="visible">True</property>
- <property name="n_rows">3</property>
- <property name="n_columns">3</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label95">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Execute Command</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label96">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_After Build</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">executeAfterEntry</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label97">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Before build</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">executeBeforeEntry</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="executeScriptEntry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char" translatable="yes">*</property>
- <property name="activates_default">False</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="executeAfterEntry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char" translatable="yes">*</property>
- <property name="activates_default">False</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="executeBeforeEntry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char" translatable="yes">*</property>
- <property name="activates_default">False</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkButton" id="browseButton2">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">...</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- </widget>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkButton" id="browseButton3">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">...</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- </widget>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkButton" id="browseButton4">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">...</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- </widget>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
-</widget>
-
</glade-interface>
Index: Core/src/AddIns/BackendBindings/VBNetBinding/Gui/OutputOptionsPanel.cs
===================================================================
--- Core/src/AddIns/BackendBindings/VBNetBinding/Gui/OutputOptionsPanel.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/VBNetBinding/Gui/OutputOptionsPanel.cs (working copy)
@@ -1,303 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krger" email="mike@icsharpcode.net"/>
-// <version value="$version"/>
-// </file>
-
-using System;
-using System.IO;
-using System.Drawing;
-
-using Gtk;
-
-using MonoDevelop.Internal.Project;
-using MonoDevelop.Internal.ExternalTool;
-using MonoDevelop.Gui.Dialogs;
-using MonoDevelop.Gui.Widgets;
-using MonoDevelop.Core.Services;
-using MonoDevelop.Core.Properties;
-using MonoDevelop.Core.AddIns.Codons;
-using MonoDevelop.Services;
-
-namespace VBBinding
-{
- public class OutputOptionsPanel : AbstractOptionPanel
- {
- VBCompilerParameters compilerParameters;
- static FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.GetService(typeof(FileUtilityService));
- StringParserService stringParserService = (StringParserService)ServiceManager.GetService(typeof(StringParserService));
-
- /* public override bool ReceiveDialogMessage(DialogMessage message)
- {
- if (message == DialogMessage.OK) {
- if (compilerParameters == null) {
- return true;
- }
-
- FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
- if (!fileUtilityService.IsValidFileName(ControlDictionary["assemblyNameTextBox"].Text)) {
- MessageBox.Show("Invalid assembly name specified", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1);
- return false;
- }
- if (!fileUtilityService.IsValidFileName(ControlDictionary["outputDirectoryTextBox"].Text)) {
- MessageBox.Show("Invalid output directory specified", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1);
- return false;
- }
-
- if (ControlDictionary["win32IconTextBox"].Text.Length > 0) {
- if (!fileUtilityService.IsValidFileName(ControlDictionary["win32IconTextBox"].Text)) {
- MessageBox.Show("Invalid Win32Icon specified", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1);
- return false;
- }
- if (!File.Exists(ControlDictionary["win32IconTextBox"].Text)) {
- MessageBox.Show("Win32Icon doesn't exists", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1);
- return false;
- }
- }
-
- compilerParameters.CompileTarget = (CompileTarget)((ComboBox)ControlDictionary["compileTargetComboBox"]).SelectedIndex;
- compilerParameters.OutputAssembly = ControlDictionary["assemblyNameTextBox"].Text;
- compilerParameters.OutputDirectory = ControlDictionary["outputDirectoryTextBox"].Text;
- compilerParameters.CommandLineParameters = ControlDictionary["parametersTextBox"].Text;
- compilerParameters.ExecuteBeforeBuild = ControlDictionary["executeBeforeTextBox"].Text;
- compilerParameters.ExecuteAfterBuild = ControlDictionary["executeAfterTextBox"].Text;
- compilerParameters.ExecuteScript = ControlDictionary["executeScriptTextBox"].Text;
- compilerParameters.Win32Icon = ControlDictionary["win32IconTextBox"].Text;
- compilerParameters.ExecuteBeforeBuildArguments = ControlDictionary["executeBeforeArgumentsTextBox"].Text;
- compilerParameters.ExecuteAfterBuildArguments = ControlDictionary["executeAfterArgumentsTextBox"].Text;
-
- compilerParameters.PauseConsoleOutput = ((CheckBox)ControlDictionary["pauseConsoleOutputCheckBox"]).Checked;
- }
- return true;
- }
-
- void SetValues(object sender, EventArgs e)
- {
- this.compilerParameters = (VBCompilerParameters)((IProperties)CustomizationObject).GetProperty("Config");
-
- ((ComboBox)ControlDictionary["compileTargetComboBox"]).SelectedIndex = (int)compilerParameters.CompileTarget;
- ControlDictionary["win32IconTextBox"].Text = compilerParameters.Win32Icon;
- ControlDictionary["assemblyNameTextBox"].Text = compilerParameters.OutputAssembly;
- ControlDictionary["outputDirectoryTextBox"].Text = compilerParameters.OutputDirectory;
- ControlDictionary["parametersTextBox"].Text = compilerParameters.CommandLineParameters;
- ControlDictionary["executeScriptTextBox"].Text = compilerParameters.ExecuteScript;
- ControlDictionary["executeBeforeTextBox"].Text = compilerParameters.ExecuteBeforeBuild;
- ControlDictionary["executeAfterTextBox"].Text = compilerParameters.ExecuteAfterBuild;
- ControlDictionary["executeBeforeArgumentsTextBox"].Text = compilerParameters.ExecuteBeforeBuildArguments;
- ControlDictionary["executeAfterArgumentsTextBox"].Text = compilerParameters.ExecuteAfterBuildArguments;
-
- ((CheckBox)ControlDictionary["pauseConsoleOutputCheckBox"]).Checked = compilerParameters.PauseConsoleOutput;
- }
-
- void SelectFolder(object sender, EventArgs e)
- {
- FolderDialog fdiag = new FolderDialog();
-
- if (fdiag.DisplayDialog("${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}") == DialogResult.OK) {
- ControlDictionary["outputDirectoryTextBox"].Text = fdiag.Path;
- }
- }
-
- void SelectFile2(object sender, EventArgs e)
- {
- OpenFileDialog fdiag = new OpenFileDialog();
- fdiag.Filter = stringParserService.Parse("${res:SharpDevelop.FileFilter.AllFiles}|*.*");
- fdiag.Multiselect = false;
-
- if(fdiag.ShowDialog() == DialogResult.OK) {
- ControlDictionary["executeBeforeTextBox"].Text = fdiag.FileName;
- }
- }
-
- void SelectFile3(object sender, EventArgs e)
- {
- OpenFileDialog fdiag = new OpenFileDialog();
- fdiag.Filter = stringParserService.Parse("${res:SharpDevelop.FileFilter.AllFiles}|*.*");
- fdiag.Multiselect = false;
-
- if(fdiag.ShowDialog() == DialogResult.OK) {
- ControlDictionary["executeAfterTextBox"].Text = fdiag.FileName;
- }
- }
- void SelectFile4(object sender, EventArgs e)
- {
- OpenFileDialog fdiag = new OpenFileDialog();
- fdiag.Filter = stringParserService.Parse("${res:SharpDevelop.FileFilter.AllFiles}|*.*");
- fdiag.Multiselect = false;
-
- if(fdiag.ShowDialog() == DialogResult.OK) {
- ControlDictionary["executeScriptTextBox"].Text = fdiag.FileName;
- }
- }
- void SelectWin32Icon(object sender, EventArgs e)
- {
- using (OpenFileDialog fdiag = new OpenFileDialog()) {
- fdiag.AddExtension = true;
- fdiag.Filter = stringParserService.Parse("${res:SharpDevelop.FileFilter.Icons}|*.ico|${res:SharpDevelop.FileFilter.AllFiles}|*.*");
- fdiag.Multiselect = false;
- fdiag.CheckFileExists = true;
-
- if (fdiag.ShowDialog() == DialogResult.OK) {
- ControlDictionary["win32IconTextBox"].Text = fdiag.FileName;
- }
- }
- }
-
- static PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService));
- public OutputOptionsPanel() : base(propertyService.DataDirectory + @"\resources\panels\ProjectOptions\OutputPanel.xfrm")
- {
- CustomizationObjectChanged += new EventHandler(SetValues);
- ControlDictionary["browseButton"].Click += new EventHandler(SelectFolder);
- ControlDictionary["browseButton2"].Click += new EventHandler(SelectFile2);
- ControlDictionary["browseButton3"].Click += new EventHandler(SelectFile3);
- ControlDictionary["browseButton4"].Click += new EventHandler(SelectFile4);
- ControlDictionary["browseWin32IconButton"].Click += new EventHandler(SelectWin32Icon);
-
- ResourceService resourceService = (ResourceService)ServiceManager.Services.GetService(typeof(IResourceService));
- ((ComboBox)ControlDictionary["compileTargetComboBox"]).Items.Add(resourceService.GetString("Dialog.Options.PrjOptions.Configuration.CompileTarget.Exe"));
- ((ComboBox)ControlDictionary["compileTargetComboBox"]).Items.Add(resourceService.GetString("Dialog.Options.PrjOptions.Configuration.CompileTarget.WinExe"));
- ((ComboBox)ControlDictionary["compileTargetComboBox"]).Items.Add(resourceService.GetString("Dialog.Options.PrjOptions.Configuration.CompileTarget.Library"));
- ((ComboBox)ControlDictionary["compileTargetComboBox"]).Items.Add(resourceService.GetString("Dialog.Options.PrjOptions.Configuration.CompileTarget.Module"));
-
- }
- } */
-
- static MessageService messageService = (MessageService) ServiceManager.GetService (typeof (MessageService));
-
- class OutputOptionsPanelWidget : GladeWidgetExtract
- {
- //
- // Gtk Controls
- //
- [Glade.Widget] Entry assemblyNameEntry;
- [Glade.Widget] Entry outputDirectoryEntry;
- [Glade.Widget] Entry parametersEntry;
- [Glade.Widget] Entry executeBeforeEntry;
- [Glade.Widget] Entry executeScriptEntry;
- [Glade.Widget] Entry executeAfterEntry;
- [Glade.Widget] CheckButton pauseConsoleOutputCheckButton;
- [Glade.Widget] Button browseButton;
- [Glade.Widget] Button browseButton2;
- [Glade.Widget] Button browseButton3;
- [Glade.Widget] Button browseButton4;
-
- VBCompilerParameters compilerParameters;
-
- public OutputOptionsPanelWidget(IProperties CustomizationObject) : base ("VB.glade", "OutputOptionsPanel")
- {
- this.compilerParameters = (VBCompilerParameters)((IProperties)CustomizationObject).GetProperty("Config");
- browseButton.Clicked += new EventHandler (SelectFolder);
- browseButton2.Clicked += new EventHandler (SelectFile4);
- browseButton3.Clicked += new EventHandler (SelectFile3);
- browseButton4.Clicked += new EventHandler (SelectFile2);
-
- assemblyNameEntry.Text = compilerParameters.OutputAssembly;
- outputDirectoryEntry.Text = compilerParameters.OutputDirectory;
- parametersEntry.Text = compilerParameters.CommandLineParameters;
- executeScriptEntry.Text = compilerParameters.ExecuteScript;
- executeBeforeEntry.Text = compilerParameters.ExecuteBeforeBuild;
- executeAfterEntry.Text = compilerParameters.ExecuteAfterBuild;
-
- pauseConsoleOutputCheckButton.Active = compilerParameters.PauseConsoleOutput;
- }
-
- public bool Store ()
- {
- if (compilerParameters == null) {
- return true;
- }
-
- FileUtilityService fileUtilityService = (FileUtilityService) ServiceManager.GetService (typeof (FileUtilityService));
-
- if (!fileUtilityService.IsValidFileName(assemblyNameEntry.Text)) {
- messageService.ShowError (GettextCatalog.GetString ("Invalid assembly name specified"));
- return false;
- }
-
- if (!fileUtilityService.IsValidFileName (outputDirectoryEntry.Text)) {
- messageService.ShowError (GettextCatalog.GetString ("Invalid output directory specified"));
- return false;
- }
-
- compilerParameters.OutputAssembly = assemblyNameEntry.Text;
- compilerParameters.OutputDirectory = outputDirectoryEntry.Text;
- compilerParameters.CommandLineParameters = parametersEntry.Text;
- compilerParameters.ExecuteBeforeBuild = executeBeforeEntry.Text;
- compilerParameters.ExecuteAfterBuild = executeAfterEntry.Text;
- compilerParameters.ExecuteScript = executeScriptEntry.Text;
-
- compilerParameters.PauseConsoleOutput = pauseConsoleOutputCheckButton.Active;
- return true;
- }
-
- void SelectFolder(object sender, EventArgs e)
- {
- using (FileSelector fdiag = new FileSelector (GettextCatalog.GetString ("Select the directory in which the assembly will be created"))) {
- if (fdiag.Run () == (int) ResponseType.Ok) {
- outputDirectoryEntry.Text = fdiag.Filename;
- }
-
- fdiag.Hide ();
- }
- }
-
- void SelectFile2(object sender, EventArgs e)
- {
- using (FileSelector fdiag = new FileSelector ("")) {
- //fdiag.Filter = StringParserService.Parse("${res:SharpDevelop.FileFilter.AllFiles}|*.*");
- fdiag.SelectMultiple = false;
-
- if(fdiag.Run () == (int) ResponseType.Ok) {
- executeBeforeEntry.Text = fdiag.Filename;
- }
-
- fdiag.Hide ();
- }
- }
-
- void SelectFile3(object sender, EventArgs e)
- {
- using (FileSelector fdiag = new FileSelector ("")) {
- //fdiag.Filter = StringParserService.Parse("${res:SharpDevelop.FileFilter.AllFiles}|*.*");
- fdiag.SelectMultiple = false;
-
- if(fdiag.Run () == (int) ResponseType.Ok) {
- executeAfterEntry.Text = fdiag.Filename;
- }
-
- fdiag.Hide ();
- }
- }
-
- void SelectFile4(object sender, EventArgs e)
- {
- using (FileSelector fdiag = new FileSelector ("")) {
- //fdiag.Filter = StringParserService.Parse("${res:SharpDevelop.FileFilter.AllFiles}|*.*");
- fdiag.SelectMultiple = false;
-
- if(fdiag.Run () == (int) ResponseType.Ok) {
- executeScriptEntry.Text = fdiag.Filename;
- }
-
- fdiag.Hide ();
- }
- }
- }
-
- OutputOptionsPanelWidget widget;
-
- public override void LoadPanelContents()
- {
- Add (widget = new OutputOptionsPanelWidget ((IProperties) CustomizationObject));
- }
-
- public override bool StorePanelContents()
- {
- bool result = true;
- result = widget.Store ();
- return result;
- }
- }
-
-}
Index: Core/src/AddIns/BackendBindings/VBNetBinding/Gui/VBCompilerPanel.cs
===================================================================
--- Core/src/AddIns/BackendBindings/VBNetBinding/Gui/VBCompilerPanel.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/VBNetBinding/Gui/VBCompilerPanel.cs (working copy)
@@ -29,7 +29,8 @@
SetupFromXml(Path.Combine(PropertyService.DataDirectory,
@"resources\panels\VBCompilerPanel.xfrm"));
- this.config = (VBCompilerParameters)((IProperties)CustomizationObject).GetProperty("Config");
+ DotNetProjectConfiguration cfg = (DotNetProjectConfiguration)((IProperties)CustomizationObject).GetProperty("Config");
+ config = (VBCompilerParameters) cfg.CompilationParameters;
FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
((ComboBox)ControlDictionary["compilerVersionComboBox"]).Items.Add("Standard");
Index: Core/src/AddIns/BackendBindings/VBNetBinding/Gui/ChooseRuntimePanel.cs
===================================================================
--- Core/src/AddIns/BackendBindings/VBNetBinding/Gui/ChooseRuntimePanel.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/VBNetBinding/Gui/ChooseRuntimePanel.cs (working copy)
@@ -23,7 +23,9 @@
{
public class ChooseRuntimePanel : AbstractOptionPanel
{
- VBCompilerParameters config = null;
+ VBCompilerParameters parameters;
+ DotNetProjectConfiguration configuration;
+
// FIXME: set the right rb groups
RadioButton monoRadioButton;
RadioButton mintRadioButton;
@@ -109,14 +111,15 @@
public override void LoadPanelContents()
{
- this.config = (VBCompilerParameters)((IProperties)CustomizationObject).GetProperty("Config");
+ configuration = (DotNetProjectConfiguration)((IProperties)CustomizationObject).GetProperty("Config");
+ parameters = (VBCompilerParameters) configuration.CompilationParameters;
msnetRadioButton.Active = config.NetRuntime == NetRuntime.MsNet;
monoRadioButton.Active = config.NetRuntime == NetRuntime.Mono;
mintRadioButton.Active = config.NetRuntime == NetRuntime.MonoInterpreter;
- vbcRadioButton.Active = config.VBCompiler == VBCompiler.Vbc;
- mbasRadioButton.Active = config.VBCompiler == VBCompiler.Mbas;
+ vbcRadioButton.Active = parameters.VBCompiler == VBCompiler.Vbc;
+ mbasRadioButton.Active = parameters.VBCompiler == VBCompiler.Mbas;
}
public override bool StorePanelContents()
@@ -128,7 +131,7 @@
} else {
config.NetRuntime = NetRuntime.MonoInterpreter;
}
- config.VBCompiler = vbcRadioButton.Active ? VBCompiler.Vbc : VBCompiler.Mbas;
+ parameters.VBCompiler = vbcRadioButton.Active ? VBCompiler.Vbc : VBCompiler.Mbas;
return true;
}
Index: Core/src/AddIns/BackendBindings/VBNetBinding/Gui/VBDocConfigurationPanel.cs
===================================================================
--- Core/src/AddIns/BackendBindings/VBNetBinding/Gui/VBDocConfigurationPanel.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/VBNetBinding/Gui/VBDocConfigurationPanel.cs (working copy)
@@ -31,7 +31,8 @@
/// </summary>
public static bool IsFileIncluded(string filename, VBProject project)
{
- VBCompilerParameters compilerparameters = (VBCompilerParameters)project.ActiveConfiguration;
+ DotNetProjectConfiguration config = (DotNetProjectConfiguration) project.ActiveConfiguration;
+ VBCompilerParameters compilerparameters = (VBCompilerParameters) config.CompilationParameters;
return Array.IndexOf(compilerparameters.VBDOCFiles, filename) == -1;
}
@@ -75,7 +76,8 @@
void SetValues(object sender, EventArgs e)
{
- this.compilerParameters = (VBCompilerParameters)((IProperties)CustomizationObject).GetProperty("Config");
+ DotNetProjectConfiguration config = (DotNetProjectConfiguration) ((IProperties)CustomizationObject).GetProperty("Config");
+ compilerParameters = (VBCompilerParameters) config.CompilationParameters;
project = (VBProject)((IProperties)CustomizationObject).GetProperty("Project");
((TextBox)ControlDictionary["OutputFileTextBox"]).Text = compilerParameters.VBDOCOutputFile;
Index: Core/src/AddIns/BackendBindings/VBNetBinding/Gui/CodeGenerationPanel.cs
===================================================================
--- Core/src/AddIns/BackendBindings/VBNetBinding/Gui/CodeGenerationPanel.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/VBNetBinding/Gui/CodeGenerationPanel.cs (working copy)
@@ -25,6 +25,7 @@
public class CodeGenerationPanel : AbstractOptionPanel
{
VBCompilerParameters compilerParameters = null;
+ DotNetProjectConfiguration configuration;
/*
@@ -125,6 +126,7 @@
StringParserService StringParserService = (StringParserService)ServiceManager.GetService (
typeof (StringParserService));
+ DotNetProjectConfiguration configuration;
VBCompilerParameters compilerParameters = null;
//static PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService));
@@ -132,7 +134,8 @@
public CodeGenerationPanelWidget(IProperties CustomizationObject) : base ("VB.glade", "CodeGenerationPanel")
{
- compilerParameters=(VBCompilerParameters)((IProperties)CustomizationObject).GetProperty("Config");
+ configuration = (DotNetProjectConfiguration)((IProperties)CustomizationObject).GetProperty("Config");
+ compilerParameters = (VBCompilerParameters) configuration.CompilationParameters;
SetValues();
//CustomizationObjectChanged += new EventHandler(SetValues);
}
@@ -157,7 +160,7 @@
// "${res:Dialog.Options.PrjOptions.Configuration.CompileTarget.Module}")));
CompileTargetOptionMenu.Menu=CompileTargetMenu;
- CompileTargetOptionMenu.SetHistory ( (uint) compilerParameters.CompileTarget);
+ CompileTargetOptionMenu.SetHistory ( (uint) configuration.CompileTarget);
//CompileTargetOptionMenu.Active=(int)compilerParameters.CompileTarget;
symbolsEntry.Text = compilerParameters.DefineSymbols;
@@ -168,7 +171,7 @@
enableOptimizationCheckButton.Active = compilerParameters.Optimize;
allowUnsafeCodeCheckButton.Active = compilerParameters.UnsafeCode;
generateOverflowChecksCheckButton.Active = compilerParameters.GenerateOverflowChecks;
- warningsAsErrorsCheckButton.Active = ! compilerParameters.RunWithWarnings;
+ warningsAsErrorsCheckButton.Active = ! configuration.RunWithWarnings;
warningLevelSpinButton.Value = compilerParameters.WarningLevel;
}
@@ -180,7 +183,7 @@
return true;
}
//compilerParameters.CompileTarget = (CompileTarget) CompileTargetOptionMenu.History;
- compilerParameters.CompileTarget=(CompileTarget)CompileTargetOptionMenu.History;
+ configuration.CompileTarget=(CompileTarget)CompileTargetOptionMenu.History;
compilerParameters.DefineSymbols = symbolsEntry.Text;
compilerParameters.MainClass = mainClassEntry.Text;
@@ -189,7 +192,7 @@
compilerParameters.Optimize = enableOptimizationCheckButton.Active;
compilerParameters.UnsafeCode = allowUnsafeCodeCheckButton.Active;
compilerParameters.GenerateOverflowChecks = generateOverflowChecksCheckButton.Active;
- compilerParameters.RunWithWarnings = ! warningsAsErrorsCheckButton.Active;
+ configuration.RunWithWarnings = ! warningsAsErrorsCheckButton.Active;
compilerParameters.WarningLevel = warningLevelSpinButton.ValueAsInt;
Index: Core/src/AddIns/BackendBindings/VBNetBinding/VBNetBinding.addin.xml
===================================================================
--- Core/src/AddIns/BackendBindings/VBNetBinding/VBNetBinding.addin.xml (revision 2122)
+++ Core/src/AddIns/BackendBindings/VBNetBinding/VBNetBinding.addin.xml (working copy)
@@ -34,7 +34,7 @@
</Extension>
<Extension path = "/SharpDevelop/Workbench/ProjectOptions/ConfigurationProperties">
- <Conditional activeproject = "VBNet">
+ <Conditional activelanguage = "VBNet">
<DialogPanel id = "VBNetCodeGenerationPanel"
_label = "Code Generation"
class = "VBBinding.CodeGenerationPanel"/>
@@ -42,15 +42,15 @@
</Extension>
<Extension path = "/SharpDevelop/Workbench/ProjectOptions/ConfigurationProperties">
- <Conditional activeproject = "VBNet">
+ <Conditional activelanguage = "VBNet">
<DialogPanel id = "VBNetOutputOptionsPanel"
_label = "Output Options"
- class = "VBBinding.OutputOptionsPanel"/>
+ class = "MonoDevelop.Gui.Dialogs.OptionPanels.OutputOptionsPanel"/>
</Conditional>
</Extension>
<!-- <Extension path = "/SharpDevelop/Workbench/ProjectOptions/ConfigurationProperties">
- <Conditional activeproject = "VBNet">
+ <Conditional activelanguage = "VBNet">
<DialogPanel id = "VBNetChooseRuntimePanel"
_label = "Choose Runtime"
class = "VBBinding.ChooseRuntimePanel"/>
Index: Core/src/AddIns/BackendBindings/VBNetBinding/ChangeLog
===================================================================
--- Core/src/AddIns/BackendBindings/VBNetBinding/ChangeLog (revision 2122)
+++ Core/src/AddIns/BackendBindings/VBNetBinding/ChangeLog (working copy)
@@ -1,3 +1,26 @@
+2005-01-11 Lluis Sanchez Gual <lluis@novell.com>
+
+ * VBCompilerPanel.cs:
+ * Gui/ChooseRuntimePanel.cs:
+ * Gui/VBDocConfigurationPanel.cs:
+ * Gui/CodeGenerationPanel.cs:
+ * VBNetBinding.addin.xml:
+ * ProjectNodeBuilder.cs:
+ * Parser/Parser.cs:
+ * Parser/Resolver.cs:
+ * VBBindingCompilerServices.cs:
+ * VBLanguageBinding.cs: Follow architecture changes.
+
+ * Gui/OutputOptionsPanel.cs:
+ * VB.glade: Removed dialog now implemented in Monodevelop.Base.
+
+ * Project/VBCompilerParameters.cs: Moved some parameters and enum
+ definitions to DotNetProjectConfiguration.
+
+ * Project/VBProject.cs:
+ * VBBindingExecutionServices.cs: Removed. Not needed any more.
+ * Makefile.am: Updated.
+
2004-12-13 Lluis Sanchez Gual <lluis@novell.com>
* VBBindingCompilerServices.cs: StatusBarService.ProgressMonitor is not a
Index: Core/src/AddIns/BackendBindings/VBNetBinding/ProjectNodeBuilder.cs
===================================================================
--- Core/src/AddIns/BackendBindings/VBNetBinding/ProjectNodeBuilder.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/VBNetBinding/ProjectNodeBuilder.cs (working copy)
@@ -29,12 +29,12 @@
FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.GetService(typeof(FileUtilityService));
IconService iconService = (IconService)ServiceManager.GetService(typeof(IconService));
- public bool CanBuildProjectTree(IProject project)
+ public bool CanBuildProjectTree(Project project)
{
return project.ProjectType == VBLanguageBinding.LanguageName;
}
- public AbstractBrowserNode BuildProjectTreeNode(IProject project)
+ public AbstractBrowserNode BuildProjectTreeNode(Project project)
{
ProjectBrowserNode projectNode = new ProjectBrowserNode(project);
Index: Core/src/AddIns/BackendBindings/VBNetBinding/Parser/Parser.cs
===================================================================
--- Core/src/AddIns/BackendBindings/VBNetBinding/Parser/Parser.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/VBNetBinding/Parser/Parser.cs (working copy)
@@ -121,22 +121,22 @@
- public ArrayList CtrlSpace(IParserService parserService,IProject proj, int caretLine, int caretColumn, string fileName)
+ public ArrayList CtrlSpace(IParserService parserService,Project proj, int caretLine, int caretColumn, string fileName)
{
return new Resolver(proj).CtrlSpace(parserService, caretLine, caretColumn, fileName);
}
- public ResolveResult Resolve(IParserService parserService,IProject proj, string expression, int caretLineNumber, int caretColumn, string fileName, string fileContent)
+ public ResolveResult Resolve(IParserService parserService,Project proj, string expression, int caretLineNumber, int caretColumn, string fileName, string fileContent)
{
return new Resolver(proj).Resolve(parserService,expression, caretLineNumber, caretColumn, fileName, fileContent);
}
- public ArrayList IsAsResolve (IParserService parserService, IProject project, string expression, int caretLineNumber, int caretColumn, string fileName, string fileContent)
+ public ArrayList IsAsResolve (IParserService parserService, Project project, string expression, int caretLineNumber, int caretColumn, string fileName, string fileContent)
{
return new Resolver (project).IsAsResolve (parserService, expression, caretLineNumber, caretColumn, fileName, fileContent);
}
- public string MonodocResolver (IParserService parserService, IProject project, string expression, int caretLineNumber, int caretColumn, string fileName, string fileContent)
+ public string MonodocResolver (IParserService parserService, Project project, string expression, int caretLineNumber, int caretColumn, string fileName, string fileContent)
{
return new Resolver (project).MonodocResolver (parserService, expression, caretLineNumber, caretColumn, fileName, fileContent);
}
Index: Core/src/AddIns/BackendBindings/VBNetBinding/Parser/Resolver.cs
===================================================================
--- Core/src/AddIns/BackendBindings/VBNetBinding/Parser/Resolver.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/VBNetBinding/Parser/Resolver.cs (working copy)
@@ -24,9 +24,9 @@
ICompilationUnit cu;
IClass callingClass;
LookupTableVisitor lookupTableVisitor;
- IProject project;
+ Project project;
- public Resolver (IProject project)
+ public Resolver (Project project)
{
this.project = project;
}
Index: Core/src/AddIns/BackendBindings/VBNetBinding/VBBindingExecutionServices.cs
===================================================================
--- Core/src/AddIns/BackendBindings/VBNetBinding/VBBindingExecutionServices.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/VBNetBinding/VBBindingExecutionServices.cs (working copy)
@@ -1,110 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Markus Palme" email="MarkusPalme@gmx.de"/>
-// <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.Services;
-using MonoDevelop.Core.Services;
-
-//using CSharpBinding;
-
-namespace VBBinding
-{
- /// <summary>
- /// This class controls the compilation of C Sharp files and C Sharp projects
- /// </summary>
- public class VBBindingExecutionServices //: CSharpBindingExecutionManager
- {
- public void Debug (IProject project)
- {
- FileUtilityService fileUtilityService = (FileUtilityService) ServiceManager.GetService (typeof (FileUtilityService));
- string directory = fileUtilityService.GetDirectoryNameWithSeparator(((VBCompilerParameters)project.ActiveConfiguration).OutputDirectory);
- string exe = ((VBCompilerParameters)project.ActiveConfiguration).OutputAssembly + ".exe";
-
- IDebuggingService dbgr = (IDebuggingService) ServiceManager.GetService (typeof (IDebuggingService));
- if (dbgr != null)
- dbgr.Run (new string[] { Path.Combine (directory, exe) } );
- }
-
- public void Execute(string filename)
- {
- string exe = Path.ChangeExtension(filename, ".exe");
-
- ProcessStartInfo psi = new ProcessStartInfo("/usr/bin/mono " + exe);
- psi.WorkingDirectory = Path.GetDirectoryName(exe);
- psi.UseShellExecute = false;
- try {
- Process p = new Process();
- p.StartInfo = psi;
- p.Start();
- } catch (Exception) {
- throw new ApplicationException("Can not execute " + "\"" + exe + "\"\n(Try restarting MonoDevelop or start your app manually)");
- }
- }
-
- public void Execute(IProject project)
- {
- VBCompilerParameters parameters = (VBCompilerParameters)project.ActiveConfiguration;
- FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.GetService(typeof(FileUtilityService));
-
- string directory = fileUtilityService.GetDirectoryNameWithSeparator(((VBCompilerParameters)project.ActiveConfiguration).OutputDirectory);
- string exe = ((VBCompilerParameters)project.ActiveConfiguration).OutputAssembly + ".exe";
- string args = ((VBCompilerParameters)project.ActiveConfiguration).CommandLineParameters;
-
- ProcessStartInfo psi;
- if (parameters.ExecuteScript != null && parameters.ExecuteScript.Length > 0) {
- //Console.WriteLine("EXECUTE SCRIPT!!!!!!");
- psi = new ProcessStartInfo("\"" + parameters.ExecuteScript + "\"");
- psi.UseShellExecute = false;
- } else {
- string runtimeStarter = "mono --debug ";
-
- switch (parameters.NetRuntime) {
- case NetRuntime.Mono:
- runtimeStarter = "mono --debug ";
- break;
- case NetRuntime.MonoInterpreter:
- runtimeStarter = "mint ";
- break;
- }
-
- string additionalCommands = "";
- if (parameters.PauseConsoleOutput)
- additionalCommands = @"echo; read -p 'press any key to continue...' -n1;";
-
- psi = new ProcessStartInfo("xterm",
- string.Format (
- @"-e ""{0} '{1}{2}' {3} ; {4}""",
- runtimeStarter, directory, exe, args, additionalCommands));
- psi.UseShellExecute = false;
- }
-
- try {
- psi.WorkingDirectory = Path.GetDirectoryName(directory);
- psi.UseShellExecute = false;
-
- Process p = new Process();
- p.StartInfo = psi;
- p.Start();
- } catch (Exception) {
- throw new ApplicationException("Can not execute " + "\"" + directory + exe + "\"\n(Try restarting MonoDevelop or start your app manually)");
- }
- }
-
- }
-}
Index: Core/src/AddIns/BackendBindings/VBNetBinding/VBBindingCompilerServices.cs
===================================================================
--- Core/src/AddIns/BackendBindings/VBNetBinding/VBBindingCompilerServices.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/VBNetBinding/VBBindingCompilerServices.cs (working copy)
@@ -35,33 +35,6 @@
FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.GetService(typeof(FileUtilityService));
PropertyService propertyService = (PropertyService)ServiceManager.GetService(typeof(PropertyService));
- public string GetCompiledOutputName(string fileName)
- {
- return Path.ChangeExtension(fileName, ".exe");
- }
-
- public string GetCompiledOutputName(IProject project)
- {
- VBProject p = (VBProject)project;
- VBCompilerParameters compilerparameters = (VBCompilerParameters)p.ActiveConfiguration;
- /* switch(compilerparameters.CompileTarget){
- case CompileTarget.Exe:
- System.Console.WriteLine("EXE");
- break;
- case CompileTarget.Library:
- System.Console.WriteLine("Library!");
- break;
- case CompileTarget.WinExe:
- System.Console.WriteLine("WinEXE");
- break;
- default:
- System.Console.WriteLine("Unknown case: " + compilerparameters.CompileTarget);
- break;
- }
- */
- return fileUtilityService.GetDirectoryNameWithSeparator(compilerparameters.OutputDirectory) + compilerparameters.OutputAssembly + (compilerparameters.CompileTarget == CompileTarget.Library ? ".dll" : ".exe");
- }
-
public bool CanCompile(string fileName)
{
return Path.GetExtension(fileName) == ".vb";
@@ -77,7 +50,7 @@
return "mbas";
}
- string GenerateOptions(VBCompilerParameters compilerparameters, string outputFileName)
+ string GenerateOptions (DotNetProjectConfiguration configuration, VBCompilerParameters compilerparameters, string outputFileName)
{
StringBuilder sb = new StringBuilder();
@@ -86,7 +59,7 @@
sb.Append("-nologo");sb.Append(Environment.NewLine);
sb.Append("-utf8output");sb.Append(Environment.NewLine);
-// if (compilerparameters.Debugmode) {
+// if (compilerparameters.DebugMode) {
// sb.Append("--debug+");sb.Append(Environment.NewLine);
// sb.Append("--debug:full");sb.Append(Environment.NewLine);
// }
@@ -125,7 +98,7 @@
sb.Append("-imports:");sb.Append(compilerparameters.Imports);sb.Append(Environment.NewLine);
}
- switch (compilerparameters.CompileTarget) {
+ switch (configuration.CompileTarget) {
case CompileTarget.Exe:
sb.Append("-target:exe");
break;
@@ -139,65 +112,33 @@
sb.Append("-target:module");
break;
default:
- throw new NotSupportedException("unknown compile target:" + compilerparameters.CompileTarget);
+ throw new NotSupportedException("unknown compile target:" + configuration.CompileTarget);
}
sb.Append(Environment.NewLine);
return sb.ToString();
}
- public ICompilerResult CompileFile(string filename)
+ public ICompilerResult CompileProject (ProjectFileCollection projectFiles, ProjectReferenceCollection references, DotNetProjectConfiguration configuration)
{
- //System.Console.WriteLine("CompileFile " + filename);
- string output = "";
- string error = "";
- string exe = Path.ChangeExtension(filename, ".exe");
- VBCompilerParameters compilerparameters = new VBCompilerParameters();
- string stdResponseFileName = propertyService.DataDirectory + Path.DirectorySeparatorChar + "vb.rsp";
+ VBCompilerParameters compilerparameters = (VBCompilerParameters) configuration.CompilationParameters;
+ if (compilerparameters == null) compilerparameters = new VBCompilerParameters ();
+ string exe = configuration.CompiledOutputName;
string responseFileName = Path.GetTempFileName();
-
- StreamWriter writer = new StreamWriter(responseFileName);
- writer.WriteLine(GenerateOptions(compilerparameters, exe));
- writer.WriteLine(String.Concat('"', filename, '"'));
- writer.Close();
-
- string compilerName = GetCompilerName(compilerparameters.VBCompilerVersion);
- string outstr = String.Concat(compilerName, " @", responseFileName); //, " @", stdResponseFileName);
-
- TempFileCollection tf = new TempFileCollection ();
- //Executor.ExecWaitWithCapture(outstr, tf, ref output, ref error);
- DoCompilation(outstr,tf,ref output, ref error);
-
- ICompilerResult result = ParseOutput(tf, output);
-
- File.Delete(responseFileName);
- File.Delete(output);
- File.Delete(error);
- WriteManifestFile(exe);
- return result;
- }
-
- public ICompilerResult CompileProject(IProject project)
- {
- //System.Console.WriteLine("CompileProject ");
- VBProject p = (VBProject)project;
- VBCompilerParameters compilerparameters = (VBCompilerParameters)p.ActiveConfiguration;
- string exe = fileUtilityService.GetDirectoryNameWithSeparator(compilerparameters.OutputDirectory) + compilerparameters.OutputAssembly + (compilerparameters.CompileTarget == CompileTarget.Library ? ".dll" : ".exe");
- string responseFileName = Path.GetTempFileName();
string stdResponseFileName = String.Concat(propertyService.DataDirectory, Path.DirectorySeparatorChar, "vb.rsp");
StreamWriter writer = new StreamWriter(responseFileName);
//Console.WriteLine(GenerateOptions(compilerparameters,exe));
- writer.WriteLine(GenerateOptions(compilerparameters, exe));
+ writer.WriteLine(GenerateOptions (configuration, compilerparameters, exe));
- foreach (ProjectReference lib in p.ProjectReferences) {
- string fileName = lib.GetReferencedFileName(p);
+ foreach (ProjectReference lib in references) {
+ string fileName = lib.GetReferencedFileName();
//Console.WriteLine(String.Concat("-r:",fileName));
writer.WriteLine(String.Concat("-r:", fileName));
}
// write source files and embedded resources
- foreach (ProjectFile finfo in p.ProjectFiles) {
+ foreach (ProjectFile finfo in projectFiles) {
if (finfo.Subtype != Subtype.Directory) {
switch (finfo.BuildAction) {
case BuildAction.Compile:
@@ -233,12 +174,10 @@
ICompilerResult result = ParseOutput(tf, output);
ParseOutput(tf,error);
- project.CopyReferencesToOutputPath(false);
-
File.Delete(responseFileName);
File.Delete(output);
File.Delete(error);
- if (compilerparameters.CompileTarget != CompileTarget.Library) {
+ if (configuration.CompileTarget != CompileTarget.Library) {
WriteManifestFile(exe);
}
return result;
@@ -406,20 +345,20 @@
return error;
}
- public void GenerateMakefile (IProject project, Combine parentCombine)
+ public void GenerateMakefile (Project project, Combine parentCombine)
{
StreamWriter stream = new StreamWriter (Path.Combine (project.BaseDirectory, "Makefile." + project.Name.Replace (" ", "")));
- VBProject p = (VBProject)project;
- VBCompilerParameters compilerparameters = (VBCompilerParameters)p.ActiveConfiguration;
+ DotNetProjectConfiguration configuration = (DotNetProjectConfiguration) project.ActiveConfiguration;
+ VBCompilerParameters compilerparameters = (VBCompilerParameters) configuration.CompilationParameters;
//special case for module?
- string outputName = compilerparameters.OutputAssembly + (compilerparameters.CompileTarget == CompileTarget.Library ? ".dll" : ".exe");
+ string outputName = configuration.CompiledOutputName;
string target = "";
string relativeOutputDir = fileUtilityService.AbsoluteToRelativePath (project.BaseDirectory, parentCombine.OutputDirectory);
- switch (compilerparameters.CompileTarget) {
+ switch (configuration.CompileTarget) {
case CompileTarget.Exe:
target = "exe";
break;
@@ -462,26 +401,26 @@
case ReferenceType.Gac:
string pkg = sas.GetPackageFromFullName (lib.Reference);
if (pkg == "MONO-SYSTEM") {
- system_references.Add (Path.GetFileName (lib.GetReferencedFileName (project)));
+ system_references.Add (Path.GetFileName (lib.GetReferencedFileName ()));
} else if (!pkg_references.Contains (pkg)) {
pkg_references.Add (pkg);
}
break;
case ReferenceType.Assembly:
- string assembly_fileName = lib.GetReferencedFileName (project);
+ string assembly_fileName = lib.GetReferencedFileName ();
string rel_path_to = fileUtilityService.AbsoluteToRelativePath (project.BaseDirectory, Path.GetDirectoryName (assembly_fileName));
assembly_references.Add (Path.Combine (rel_path_to, Path.GetFileName (assembly_fileName)));
break;
case ReferenceType.Project:
- string project_fileName = lib.GetReferencedFileName (project);
+ string project_fileName = lib.GetReferencedFileName ();
IProjectService prjService = (IProjectService)ServiceManager.GetService (typeof (IProjectService));
- ArrayList allProjects = Combine.GetAllProjects(prjService.CurrentOpenCombine);
+ CombineEntryCollection allProjects = prjService.CurrentOpenCombine.GetAllProjects();
- foreach (ProjectCombineEntry projectEntry in allProjects) {
- if (projectEntry.Project.Name == lib.Reference) {
- string project_base_dir = fileUtilityService.AbsoluteToRelativePath (project.BaseDirectory, projectEntry.Project.BaseDirectory);
+ foreach (Project projectEntry in allProjects) {
+ if (projectEntry.Name == lib.Reference) {
+ string project_base_dir = fileUtilityService.AbsoluteToRelativePath (project.BaseDirectory, projectEntry.BaseDirectory);
- string project_output_fileName = prjService.GetOutputAssemblyName (projectEntry.Project);
+ string project_output_fileName = projectEntry.GetOutputFileName ();
project_references.Add (Path.Combine (project_base_dir, Path.GetFileName (project_output_fileName)));
}
}
Index: Core/src/AddIns/BackendBindings/VBNetBinding/Project/VBProject.cs
===================================================================
--- Core/src/AddIns/BackendBindings/VBNetBinding/Project/VBProject.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/VBNetBinding/Project/VBProject.cs (working copy)
@@ -1,80 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Markus Palme" email="MarkusPalme@gmx.de"/>
-// <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 VBBinding
-{
- /// <summary>
- /// This class describes a VB.NET project and it compilation options.
- /// </summary>
- public class VBProject : AbstractProject
- {
- public override string ProjectType {
- get {
- return VBLanguageBinding.LanguageName;
- }
- }
-
- public override IConfiguration CreateConfiguration()
- {
- return new VBCompilerParameters();
- }
-
- public VBProject()
- {
- }
-
- public VBProject(ProjectCreateInformation info, XmlElement projectOptions)
- {
- if (info != null) {
- Name = info.ProjectName;
-
- //VBCompilerParameters debug = (VBCompilerParameters)CreateConfiguration("Debug");
- //debug.Optimize = false;
- //release.Debugmode=false;
- //Configurations.Add(debug);
-
- VBCompilerParameters release = (VBCompilerParameters)CreateConfiguration("Release");
- //release.Optimize = true;
- //release.Debugmode = false;
- //release.GenerateOverflowChecks = false;
- //release.TreatWarningsAsErrors = false;
- Configurations.Add(release);
-
- XmlElement el = projectOptions;
-
- foreach (VBCompilerParameters parameter in Configurations) {
- parameter.OutputDirectory = info.BinPath + Path.DirectorySeparatorChar + parameter.Name;
- parameter.OutputAssembly = Name;
-
- if (el != null) {
- System.Console.WriteLine("ProjectOptions " + el.OuterXml);
- if (el.Attributes["Target"] != null) {
- parameter.CompileTarget = (CompileTarget)Enum.Parse(typeof(CompileTarget), el.Attributes["Target"].InnerText);
- }
- if (el.Attributes["PauseConsoleOutput"] != null) {
- parameter.PauseConsoleOutput = Boolean.Parse(el.Attributes["PauseConsoleOutput"].InnerText);
- }
- }else{
- System.Console.WriteLine("ProjectOptions XML is NULL!");
- }
- }
- }else{
- System.Console.WriteLine("NULL Projectinfo!");
- }
- }
- }
-}
Index: Core/src/AddIns/BackendBindings/VBNetBinding/Project/VBCompilerParameters.cs
===================================================================
--- Core/src/AddIns/BackendBindings/VBNetBinding/Project/VBCompilerParameters.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/VBNetBinding/Project/VBCompilerParameters.cs (working copy)
@@ -11,168 +11,102 @@
using System.ComponentModel;
using MonoDevelop.Internal.Project;
+using MonoDevelop.Internal.Serialization;
namespace VBBinding {
- public enum CompileTarget
- {
- Exe,
- WinExe,
- Library,
- Module
- };
-
public enum VBCompiler {
Vbc,
Mbas
};
- public enum NetRuntime {
- Mono,
- MonoInterpreter,
- MsNet
- };
-
/// <summary>
/// This class handles project specific compiler parameters
/// </summary>
- public class VBCompilerParameters : AbstractProjectConfiguration
+ public class VBCompilerParameters
{
- [XmlNodeName("CodeGeneration")]
- class CodeGeneration
- {
- [XmlAttribute("compilerversion")]
- public string vbCompilerVersion = String.Empty;
-
- [XmlAttribute("runtime")]
- public NetRuntime netRuntime = NetRuntime.Mono;
-
- [XmlAttribute("compiler")]
- public VBCompiler vbCompiler = VBCompiler.Mbas;
-
- [XmlAttribute("warninglevel")]
- public int warninglevel = 4;
-
- [XmlAttribute("nowarn")]
- public string noWarnings = String.Empty;
-
- //[XmlAttribute("includedebuginformation")]
- //public bool debugmode = false;
-
- [XmlAttribute("optimize")]
- public bool optimize = true;
-
- [XmlAttribute("unsafecodeallowed")]
- public bool unsafecode = false;
-
- [XmlAttribute("generateoverflowchecks")]
- public bool generateOverflowChecks = true;
-
- [XmlAttribute("rootnamespace")]
- public string rootnamespace = String.Empty;
-
- [XmlAttribute("mainclass")]
- public string mainclass = null;
-
- [XmlAttribute("target")]
- public CompileTarget compiletarget = CompileTarget.Exe;
-
- [XmlAttribute("definesymbols")]
- public string definesymbols = String.Empty;
-
- [XmlAttribute("generatexmldocumentation")]
- public bool generateXmlDocumentation = false;
-
- [XmlAttribute("optionexplicit")]
- public bool optionExplicit = true;
-
- [XmlAttribute("optionstrict")]
- public bool optionStrict = false;
-
- [ConvertToRelativePathAttribute()]
- [XmlAttribute("win32Icon")]
- public string win32Icon = String.Empty;
-
- [XmlAttribute("imports")]
- public string imports = String.Empty;
- }
+ [ItemProperty("compilerversion")]
+ string vbCompilerVersion = String.Empty;
+
+ [ItemProperty("compiler")]
+ VBCompiler vbCompiler = VBCompiler.Mbas;
+
+ [ItemProperty("warninglevel")]
+ int warninglevel = 4;
+
+ [ItemProperty("nowarn")]
+ string noWarnings = String.Empty;
- [XmlNodeName("Execution")]
- class Execution
- {
- [XmlAttribute("consolepause")]
- public bool pauseconsoleoutput = true;
-
- [XmlAttribute("commandlineparameters")]
- public string commandLineParameters = String.Empty;
-
- }
+ [ItemProperty("optimize")]
+ bool optimize = true;
+
+ [ItemProperty("unsafecodeallowed")]
+ bool unsafecode = false;
- [XmlNodeName("VBDOC")]
- class VBDOC
- {
- [XmlAttribute("outputfile")]
- [ConvertToRelativePathAttribute()]
- public string outputfile = String.Empty;
-
- [XmlAttribute("filestoparse")]
- public string filestoparse = String.Empty;
-
- [XmlAttribute("commentprefix")]
- public string commentprefix = "'";
- }
+ [ItemProperty("generateoverflowchecks")]
+ bool generateOverflowChecks = true;
- CodeGeneration codeGeneration = new CodeGeneration();
- VBDOC vbdoc = new VBDOC();
- Execution execution = new Execution();
+ [ItemProperty("rootnamespace")]
+ string rootnamespace = String.Empty;
+ [ItemProperty("mainclass")]
+ string mainclass = null;
+
+ [ItemProperty("definesymbols")]
+ string definesymbols = String.Empty;
+
+ [ItemProperty("generatexmldocumentation")]
+ bool generateXmlDocumentation = false;
+
+ [ItemProperty("optionexplicit")]
+ bool optionExplicit = true;
+
+ [ItemProperty("optionstrict")]
+ bool optionStrict = false;
+
+ [ProjectPathItemProperty("win32Icon")]
+ string win32Icon = String.Empty;
+
+ [ItemProperty("imports")]
+ string imports = String.Empty;
+
+ [ProjectPathItemProperty("VBDOC-outputfile")]
+ string outputfile = String.Empty;
+
+ [ItemProperty("VBDOC-filestoparse")]
+ string filestoparse = String.Empty;
+
+ [ItemProperty("VBDOC-commentprefix")]
+ string commentprefix = "'";
+
[Browsable(false)]
public string VBCompilerVersion
{
get {
- return codeGeneration.vbCompilerVersion;
+ return vbCompilerVersion;
}
set {
- codeGeneration.vbCompilerVersion = value;
+ vbCompilerVersion = value;
}
}
[Browsable(false)]
public VBCompiler VBCompiler {
get {
- return codeGeneration.vbCompiler;
+ return vbCompiler;
}
set {
- codeGeneration.vbCompiler = value;
+ vbCompiler = value;
}
}
- [Browsable(false)]
- public NetRuntime NetRuntime {
- get {
- return codeGeneration.netRuntime;
- }
- set {
- codeGeneration.netRuntime = value;
- }
- }
-
- public string CommandLineParameters
- {
- get {
- return execution.commandLineParameters;
- }
- set {
- execution.commandLineParameters = value;
- }
- }
public bool GenerateOverflowChecks
{
get {
- return codeGeneration.generateOverflowChecks;
+ return generateOverflowChecks;
}
set {
- codeGeneration.generateOverflowChecks = value;
+ generateOverflowChecks = value;
}
}
@@ -182,10 +116,10 @@
// Description = "${res:BackendBindings.CompilerOptions.CodeGeneration.UnsafeCode.Description}")]
public bool UnsafeCode {
get {
- return codeGeneration.unsafecode;
+ return unsafecode;
}
set {
- codeGeneration.unsafecode = value;
+ unsafecode = value;
}
}
@@ -195,10 +129,10 @@
// Description = "${res:BackendBindings.CompilerOptions.CodeGeneration.GenerateXmlDocumentation.Description}")]
public bool GenerateXmlDocumentation {
get {
- return codeGeneration.generateXmlDocumentation;
+ return generateXmlDocumentation;
}
set {
- codeGeneration.generateXmlDocumentation = value;
+ generateXmlDocumentation = value;
}
}
@@ -209,160 +143,121 @@
// Description = "${res:BackendBindings.CompilerOptions.WarningAndErrorCategory.WarningLevel.Description}")]
public int WarningLevel {
get {
- return codeGeneration.warninglevel;
+ return warninglevel;
}
set {
- codeGeneration.warninglevel = value;
+ warninglevel = value;
}
}
public string Imports
{
get {
- return codeGeneration.imports;
+ return imports;
}
set {
- codeGeneration.imports = value;
+ imports = value;
}
}
public string Win32Icon
{
get {
- return codeGeneration.win32Icon;
+ return win32Icon;
}
set {
- codeGeneration.win32Icon = value;
+ win32Icon = value;
}
}
public string RootNamespace
{
get {
- return codeGeneration.rootnamespace;
+ return rootnamespace;
}
set {
- codeGeneration.rootnamespace = value;
+ rootnamespace = value;
}
}
public string DefineSymbols
{
get {
- return codeGeneration.definesymbols;
+ return definesymbols;
}
set {
- codeGeneration.definesymbols = value;
+ definesymbols = value;
}
}
- public bool PauseConsoleOutput
- {
- get {
- return execution.pauseconsoleoutput;
- }
- set {
- execution.pauseconsoleoutput = value;
- }
- }
-
- //public bool Debugmode
- //{
- // get {
- // return codeGeneration.debugmode;
- // }
- // set {
- // codeGeneration.debugmode = value;
- // }
- //}
-
public bool Optimize
{
get {
- return codeGeneration.optimize;
+ return optimize;
}
set {
- codeGeneration.optimize = value;
+ optimize = value;
}
}
public string MainClass
{
get {
- return codeGeneration.mainclass;
+ return mainclass;
}
set {
- codeGeneration.mainclass = value;
+ mainclass = value;
}
}
- public CompileTarget CompileTarget
- {
- get {
- return codeGeneration.compiletarget;
- }
- set {
- codeGeneration.compiletarget = value;
- }
- }
-
public bool OptionExplicit
{
get {
- return codeGeneration.optionExplicit;
+ return optionExplicit;
}
set {
- codeGeneration.optionExplicit = value;
+ optionExplicit = value;
}
}
public bool OptionStrict
{
get {
- return codeGeneration.optionStrict;
+ return optionStrict;
}
set {
- codeGeneration.optionStrict = value;
+ optionStrict = value;
}
}
public string VBDOCOutputFile
{
get {
- return vbdoc.outputfile;
+ return outputfile;
}
set {
- vbdoc.outputfile = value;
+ outputfile = value;
}
}
public string[] VBDOCFiles
{
get {
- return vbdoc.filestoparse.Split(';');
+ return filestoparse.Split(';');
}
set {
- vbdoc.filestoparse = System.String.Join(";", value);
+ filestoparse = System.String.Join(";", value);
}
}
public string VBDOCCommentPrefix
{
get {
- return vbdoc.commentprefix;
+ return commentprefix;
}
set {
- vbdoc.commentprefix = value;
+ commentprefix = value;
}
}
-
- public VBCompilerParameters()
- {
- }
-
- public VBCompilerParameters(string name)
- {
- this.name = name;
- }
}
}
Index: Core/src/AddIns/BackendBindings/VBNetBinding/Makefile.am
===================================================================
--- Core/src/AddIns/BackendBindings/VBNetBinding/Makefile.am (revision 2122)
+++ Core/src/AddIns/BackendBindings/VBNetBinding/Makefile.am (working copy)
@@ -17,10 +17,8 @@
AssemblyInfo.cs \
VBAmbience.cs \
VBBindingCompilerServices.cs \
-VBBindingExecutionServices.cs \
VBLanguageBinding.cs \
Gui/CodeGenerationPanel.cs \
-Gui/OutputOptionsPanel.cs \
Parser/ExpressionFinder.cs \
Parser/Parser.cs \
Parser/Resolver.cs \
@@ -37,8 +35,7 @@
Parser/SharpDevelopTree/Parameter.cs \
Parser/SharpDevelopTree/Property.cs \
Parser/SharpDevelopTree/ReturnType.cs \
-Project/VBCompilerParameters.cs \
-Project/VBProject.cs
+Project/VBCompilerParameters.cs
TEMPLATES = \
templates/EmptyVBFile.xft.xml \
Index: Core/src/AddIns/BackendBindings/VBNetBinding/VBLanguageBinding.cs
===================================================================
--- Core/src/AddIns/BackendBindings/VBNetBinding/VBLanguageBinding.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/VBNetBinding/VBLanguageBinding.cs (working copy)
@@ -24,7 +24,6 @@
public const string LanguageName = "VBNet";
VBBindingCompilerServices compilerServices = new VBBindingCompilerServices();
- VBBindingExecutionServices executionServices = new VBBindingExecutionServices();
public string Language {
get {
@@ -32,86 +31,28 @@
}
}
- public void Execute(string filename, bool debug)
- {
- Debug.Assert(executionServices != null);
- executionServices.Execute(filename);
- }
-
- public void Execute(IProject project, bool debug)
- {
- Debug.Assert(executionServices != null);
- if(debug){
- executionServices.Debug(project);
- }else{
- executionServices.Execute(project);
- }//if
-
- }
-
- 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)
+ public ICompilerResult Compile (ProjectFileCollection projectFiles, ProjectReferenceCollection references, DotNetProjectConfiguration configuration)
{
Debug.Assert(compilerServices != null);
- return compilerServices.CompileFile(fileName);
+ return compilerServices.CompileProject (projectFiles, references, configuration);
}
- public ICompilerResult CompileProject(IProject project)
- {
- Debug.Assert(compilerServices != null);
- return compilerServices.CompileProject(project);
- }
+ public void GenerateMakefile (Project project, Combine parentCombine)
+ {
+ compilerServices.GenerateMakefile (project, parentCombine);
+ }
- public ICompilerResult RecompileProject(IProject project)
+ public object CreateCompilationParameters (XmlElement projectOptions)
{
- return CompileProject(project);
+ return new VBCompilerParameters ();
}
-
- public IProject CreateProject(ProjectCreateInformation info, XmlElement projectOptions)
- {
- return new VBProject(info, projectOptions);
- }
-
- public virtual void Execute(string filename)
- {
- Debug.Assert(executionServices != null);
- executionServices.Execute(filename);
- }
-
- public virtual void Execute(IProject project)
- {
- Debug.Assert(executionServices != null);
- executionServices.Execute(project);
- }
-
- public void DebugProject (IProject project)
- {
- executionServices.Debug (project);
- }
-
- public void GenerateMakefile (IProject project, Combine parentCombine)
- {
- compilerServices.GenerateMakefile (project, parentCombine);
- }
-
public string CommentTag
{
get { return "'"; }
Index: Core/src/AddIns/BackendBindings/CSharpBinding/CSharpLanguageBinding.cs
===================================================================
--- Core/src/AddIns/BackendBindings/CSharpBinding/CSharpLanguageBinding.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/CSharpBinding/CSharpLanguageBinding.cs (working copy)
@@ -18,6 +18,7 @@
using MonoDevelop.Internal.Project;
using MonoDevelop.Internal.Templates;
using MonoDevelop.Gui;
+using MonoDevelop.Services;
namespace CSharpBinding
{
@@ -26,78 +27,40 @@
public const string LanguageName = "C#";
CSharpBindingCompilerManager compilerManager = new CSharpBindingCompilerManager();
- CSharpBindingExecutionManager executionManager = new CSharpBindingExecutionManager();
+ public CSharpLanguageBinding ()
+ {
+ Runtime.ProjectService.DataContext.IncludeType (typeof(CSharpCompilerParameters));
+ }
+
public string Language {
get {
return LanguageName;
}
}
- public void Execute(string filename)
- {
- Debug.Assert(executionManager != null);
- executionManager.Execute(filename);
- }
-
- public void Execute(IProject project)
- {
- Debug.Assert(executionManager != null);
- executionManager.Execute(project);
- }
-
- public void DebugProject (IProject project)
- {
- executionManager.Debug (project);
- }
-
- public string GetCompiledOutputName(string fileName)
- {
- Debug.Assert(compilerManager != null);
- return compilerManager.GetCompiledOutputName(fileName);
- }
-
- public string GetCompiledOutputName(IProject project)
- {
- Debug.Assert(compilerManager != null);
- return compilerManager.GetCompiledOutputName(project);
- }
-
public bool CanCompile(string fileName)
{
Debug.Assert(compilerManager != null);
return compilerManager.CanCompile(fileName);
}
- public ICompilerResult CompileFile(string fileName)
+ public ICompilerResult Compile (ProjectFileCollection projectFiles, ProjectReferenceCollection references, DotNetProjectConfiguration configuration)
{
Debug.Assert(compilerManager != null);
- CSharpCompilerParameters param = new CSharpCompilerParameters();
- param.OutputAssembly = Path.ChangeExtension(fileName, ".exe");
- return compilerManager.CompileFile(fileName, param);
+ return compilerManager.Compile (projectFiles, references, configuration);
}
- public ICompilerResult CompileProject(IProject project)
+ public void GenerateMakefile (Project project, Combine parentCombine)
{
- Debug.Assert(compilerManager != null);
- return compilerManager.CompileProject(project);
+ compilerManager.GenerateMakefile (project, parentCombine);
}
- public ICompilerResult RecompileProject(IProject project)
+ public object CreateCompilationParameters (XmlElement projectOptions)
{
- return CompileProject(project);
+ return new CSharpCompilerParameters();
}
- public IProject CreateProject(ProjectCreateInformation info, XmlElement projectOptions)
- {
- return new CSharpProject(info, projectOptions);
- }
-
- public void GenerateMakefile (IProject project, Combine parentCombine)
- {
- compilerManager.GenerateMakefile (project, parentCombine);
- }
-
public string CommentTag
{
get { return "//"; }
Index: Core/src/AddIns/BackendBindings/CSharpBinding/CSharpBindingExecutionManager.cs.in
===================================================================
--- Core/src/AddIns/BackendBindings/CSharpBinding/CSharpBindingExecutionManager.cs.in (revision 2122)
+++ Core/src/AddIns/BackendBindings/CSharpBinding/CSharpBindingExecutionManager.cs.in (working copy)
@@ -1,109 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@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;
-using MonoDevelop.Services;
-
-namespace CSharpBinding
-{
- /// <summary>
- /// This class describes the main functionalaty of a language codon
- /// </summary>
- public class CSharpBindingExecutionManager
- {
- public void Debug (IProject project)
- {
- FileUtilityService fileUtilityService = (FileUtilityService) ServiceManager.GetService (typeof (FileUtilityService));
- string directory = fileUtilityService.GetDirectoryNameWithSeparator(((CSharpCompilerParameters)project.ActiveConfiguration).OutputDirectory);
- string exe = ((CSharpCompilerParameters)project.ActiveConfiguration).OutputAssembly + ".exe";
-
- IDebuggingService dbgr = (IDebuggingService) ServiceManager.GetService (typeof (IDebuggingService));
- if (dbgr != null)
- dbgr.Run (new string[] { Path.Combine (directory, exe) } );
- }
-
- public void Execute(string filename)
- {
- string exe = Path.ChangeExtension(filename, ".exe");
-
- ProcessStartInfo psi = new ProcessStartInfo("@RUNTIME@ " + exe);
- psi.WorkingDirectory = Path.GetDirectoryName(exe);
- psi.UseShellExecute = false;
- try {
- Process p = new Process();
- p.StartInfo = psi;
- p.Start();
- } catch (Exception) {
- throw new ApplicationException("Can not execute " + "\"" + exe + "\"\n(Try restarting MonoDevelop or start your app manually)");
- }
- }
-
- public void Execute(IProject project)
- {
- CSharpCompilerParameters parameters = (CSharpCompilerParameters)project.ActiveConfiguration;
- FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.GetService(typeof(FileUtilityService));
-
- string directory = fileUtilityService.GetDirectoryNameWithSeparator(((CSharpCompilerParameters)project.ActiveConfiguration).OutputDirectory);
- string exe = ((CSharpCompilerParameters)project.ActiveConfiguration).OutputAssembly + ".exe";
- string args = ((CSharpCompilerParameters)project.ActiveConfiguration).CommandLineParameters;
-
- ProcessStartInfo psi;
- if (parameters.ExecuteScript != null && parameters.ExecuteScript.Length > 0) {
- string additionalCommands = "";
- if (parameters.PauseConsoleOutput)
- additionalCommands = @"echo; read -p 'press any key to continue...' -n1;";
- psi = new ProcessStartInfo("xterm",
- String.Format (@"-e ""cd {3} ; '{0}' {1} ; {2}""", parameters.ExecuteScript, args, additionalCommands, project.BaseDirectory));
- psi.UseShellExecute = false;
- } else {
- string runtimeStarter = "mono --debug ";
-
- switch (parameters.NetRuntime) {
- case NetRuntime.Mono:
- runtimeStarter = "mono --debug ";
- break;
- case NetRuntime.MonoInterpreter:
- runtimeStarter = "mint ";
- break;
- }
-
- string additionalCommands = "";
- if (parameters.PauseConsoleOutput)
- additionalCommands = @"echo; read -p 'press any key to continue...' -n1;";
-
- psi = new ProcessStartInfo("xterm",
- string.Format (
- @"-e ""{0} '{1}{2}' {3} ; {4}""",
- runtimeStarter, directory, exe, args, additionalCommands));
- psi.UseShellExecute = false;
- }
-
- try {
- psi.WorkingDirectory = Path.GetDirectoryName(directory);
- psi.UseShellExecute = false;
-
- Process p = new Process();
- p.StartInfo = psi;
- p.Start();
- } catch (Exception) {
- throw new ApplicationException("Can not execute " + "\"" + directory + exe + "\"\n(Try restarting MonoDevelop or start your app manually)");
- }
- }
- }
-}
Index: Core/src/AddIns/BackendBindings/CSharpBinding/Gui/OutputOptionsPanel.cs
===================================================================
--- Core/src/AddIns/BackendBindings/CSharpBinding/Gui/OutputOptionsPanel.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/CSharpBinding/Gui/OutputOptionsPanel.cs (working copy)
@@ -1,163 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krger" email="mike@icsharpcode.net"/>
-// <version value="$version"/>
-// </file>
-
-using System;
-using System.IO;
-using System.Drawing;
-
-using MonoDevelop.Internal.Project;
-using MonoDevelop.Internal.ExternalTool;
-using MonoDevelop.Gui.Dialogs;
-using MonoDevelop.Gui.Widgets;
-using MonoDevelop.Core.Services;
-using MonoDevelop.Core.Properties;
-using MonoDevelop.Core.AddIns.Codons;
-using MonoDevelop.Services;
-
-using Gtk;
-
-namespace CSharpBinding
-{
- public class OutputOptionsPanel : AbstractOptionPanel
- {
- static MessageService messageService = (MessageService) ServiceManager.GetService (typeof (MessageService));
-
- class OutputOptionsPanelWidget : GladeWidgetExtract
- {
- //
- // Gtk Controls
- //
- [Glade.Widget] Entry assemblyNameEntry;
- [Glade.Widget] Entry outputDirectoryEntry;
- [Glade.Widget] Entry parametersEntry;
- [Glade.Widget] Entry executeBeforeEntry;
- [Glade.Widget] Entry executeScriptEntry;
- [Glade.Widget] Entry executeAfterEntry;
- [Glade.Widget] CheckButton pauseConsoleOutputCheckButton;
- [Glade.Widget] Button browseButton;
- [Glade.Widget] Button browseButton2;
- [Glade.Widget] Button browseButton3;
- [Glade.Widget] Button browseButton4;
-
- CSharpCompilerParameters compilerParameters;
-
- public OutputOptionsPanelWidget(IProperties CustomizationObject) : base ("CSharp.glade", "OutputOptionsPanel")
- {
- this.compilerParameters = (CSharpCompilerParameters)((IProperties)CustomizationObject).GetProperty("Config");
- browseButton.Clicked += new EventHandler (SelectFolder);
- browseButton2.Clicked += new EventHandler (SelectFile4);
- browseButton3.Clicked += new EventHandler (SelectFile3);
- browseButton4.Clicked += new EventHandler (SelectFile2);
-
- assemblyNameEntry.Text = compilerParameters.OutputAssembly;
- outputDirectoryEntry.Text = compilerParameters.OutputDirectory;
- parametersEntry.Text = compilerParameters.CommandLineParameters;
- executeScriptEntry.Text = compilerParameters.ExecuteScript;
- executeBeforeEntry.Text = compilerParameters.ExecuteBeforeBuild;
- executeAfterEntry.Text = compilerParameters.ExecuteAfterBuild;
-
- pauseConsoleOutputCheckButton.Active = compilerParameters.PauseConsoleOutput;
- }
-
- public bool Store ()
- {
- if (compilerParameters == null) {
- return true;
- }
-
- FileUtilityService fileUtilityService = (FileUtilityService) ServiceManager.GetService (typeof (FileUtilityService));
-
- if (!fileUtilityService.IsValidFileName(assemblyNameEntry.Text)) {
- messageService.ShowError (GettextCatalog.GetString ("Invalid assembly name specified"));
- return false;
- }
-
- if (!fileUtilityService.IsValidFileName (outputDirectoryEntry.Text)) {
- messageService.ShowError (GettextCatalog.GetString ("Invalid output directory specified"));
- return false;
- }
-
- compilerParameters.OutputAssembly = assemblyNameEntry.Text;
- compilerParameters.OutputDirectory = outputDirectoryEntry.Text;
- compilerParameters.CommandLineParameters = parametersEntry.Text;
- compilerParameters.ExecuteBeforeBuild = executeBeforeEntry.Text;
- compilerParameters.ExecuteAfterBuild = executeAfterEntry.Text;
- compilerParameters.ExecuteScript = executeScriptEntry.Text;
-
- compilerParameters.PauseConsoleOutput = pauseConsoleOutputCheckButton.Active;
- return true;
- }
-
- void SelectFolder(object sender, EventArgs e)
- {
- using (FileSelector fdiag = new FileSelector (GettextCatalog.GetString ("Select the directory in which the assembly will be created"))) {
- if (fdiag.Run () == (int) ResponseType.Ok) {
- outputDirectoryEntry.Text = fdiag.Filename;
- }
-
- fdiag.Hide ();
- }
- }
-
- void SelectFile2(object sender, EventArgs e)
- {
- using (FileSelector fdiag = new FileSelector ("")) {
- //fdiag.Filter = StringParserService.Parse("${res:SharpDevelop.FileFilter.AllFiles}|*.*");
- fdiag.SelectMultiple = false;
-
- if(fdiag.Run () == (int) ResponseType.Ok) {
- executeBeforeEntry.Text = fdiag.Filename;
- }
-
- fdiag.Hide ();
- }
- }
-
- void SelectFile3(object sender, EventArgs e)
- {
- using (FileSelector fdiag = new FileSelector ("")) {
- //fdiag.Filter = StringParserService.Parse("${res:SharpDevelop.FileFilter.AllFiles}|*.*");
- fdiag.SelectMultiple = false;
-
- if(fdiag.Run () == (int) ResponseType.Ok) {
- executeAfterEntry.Text = fdiag.Filename;
- }
-
- fdiag.Hide ();
- }
- }
-
- void SelectFile4(object sender, EventArgs e)
- {
- using (FileSelector fdiag = new FileSelector ("")) {
- //fdiag.Filter = StringParserService.Parse("${res:SharpDevelop.FileFilter.AllFiles}|*.*");
- fdiag.SelectMultiple = false;
-
- if(fdiag.Run () == (int) ResponseType.Ok) {
- executeScriptEntry.Text = fdiag.Filename;
- }
-
- fdiag.Hide ();
- }
- }
- }
-
- OutputOptionsPanelWidget widget;
-
- public override void LoadPanelContents()
- {
- Add (widget = new OutputOptionsPanelWidget ((IProperties) CustomizationObject));
- }
-
- public override bool StorePanelContents()
- {
- bool result = true;
- result = widget.Store ();
- return result;
- }
- }
-}
Index: Core/src/AddIns/BackendBindings/CSharpBinding/Gui/ChooseRuntimePanel.cs
===================================================================
--- Core/src/AddIns/BackendBindings/CSharpBinding/Gui/ChooseRuntimePanel.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/CSharpBinding/Gui/ChooseRuntimePanel.cs (working copy)
@@ -21,7 +21,9 @@
{
public class ChooseRuntimePanel : AbstractOptionPanel
{
- CSharpCompilerParameters config = null;
+ CSharpCompilerParameters parameters;
+ DotNetProjectConfiguration config;
+
// FIXME: set the right rb groups
RadioButton msnetRadioButton = new RadioButton ("Msnet");
RadioButton monoRadioButton = new RadioButton ("Mono");
@@ -31,14 +33,15 @@
public override void LoadPanelContents()
{
- this.config = (CSharpCompilerParameters)((IProperties)CustomizationObject).GetProperty("Config");
+ config = (DotNetProjectConfiguration)((IProperties)CustomizationObject).GetProperty("Config");
+ parameters = (CSharpCompilerParameters) config.CompilationParameters;
msnetRadioButton.Active = config.NetRuntime == NetRuntime.MsNet;
monoRadioButton.Active = config.NetRuntime == NetRuntime.Mono;
mintRadioButton.Active = config.NetRuntime == NetRuntime.MonoInterpreter;
- cscRadioButton.Active = config.CsharpCompiler == CsharpCompiler.Csc;
- mcsRadioButton.Active = config.CsharpCompiler == CsharpCompiler.Mcs;
+ cscRadioButton.Active = parameters.CsharpCompiler == CsharpCompiler.Csc;
+ mcsRadioButton.Active = parameters.CsharpCompiler == CsharpCompiler.Mcs;
}
public override bool StorePanelContents()
@@ -50,7 +53,7 @@
} else {
config.NetRuntime = NetRuntime.MonoInterpreter;
}
- config.CsharpCompiler = cscRadioButton.Active ? CsharpCompiler.Csc : CsharpCompiler.Mcs;
+ parameters.CsharpCompiler = cscRadioButton.Active ? CsharpCompiler.Csc : CsharpCompiler.Mcs;
return true;
}
Index: Core/src/AddIns/BackendBindings/CSharpBinding/Gui/CodeGenerationPanel.cs
===================================================================
--- Core/src/AddIns/BackendBindings/CSharpBinding/Gui/CodeGenerationPanel.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/CSharpBinding/Gui/CodeGenerationPanel.cs (working copy)
@@ -50,12 +50,15 @@
StringParserService StringParserService = (StringParserService)ServiceManager.GetService (
typeof (StringParserService));
+ DotNetProjectConfiguration configuration;
CSharpCompilerParameters compilerParameters = null;
public CodeGenerationPanelWidget(IProperties CustomizationObject) : base ("CSharp.glade", "CodeGenerationPanel")
{
- this.compilerParameters = (CSharpCompilerParameters)((IProperties)CustomizationObject).GetProperty("Config");
-
+ configuration = (DotNetProjectConfiguration)((IProperties)CustomizationObject).GetProperty("Config");
+
+ compilerParameters = (CSharpCompilerParameters) configuration.CompilationParameters;
+
// FIXME: Enable when mcs has this feature
generateXmlOutputCheckButton.Sensitive = false;
@@ -69,18 +72,18 @@
// "${res:Dialog.Options.PrjOptions.Configuration.CompileTarget.Module}")));
CompileTargetOptionMenu.Menu = CompileTargetMenu;
- CompileTargetOptionMenu.SetHistory ( (uint) compilerParameters.CompileTarget);
+ CompileTargetOptionMenu.SetHistory ( (uint) configuration.CompileTarget);
symbolsEntry.Text = compilerParameters.DefineSymbols;
mainClassEntry.Text = compilerParameters.MainClass;
- generateDebugInformationCheckButton.Active = compilerParameters.Debugmode;
+ generateDebugInformationCheckButton.Active = configuration.DebugMode;
generateXmlOutputCheckButton.Active = compilerParameters.GenerateXmlDocumentation;
enableOptimizationCheckButton.Active = compilerParameters.Optimize;
allowUnsafeCodeCheckButton.Active = compilerParameters.UnsafeCode;
generateOverflowChecksCheckButton.Active = compilerParameters.GenerateOverflowChecks;
- warningsAsErrorsCheckButton.Active = ! compilerParameters.RunWithWarnings;
+ warningsAsErrorsCheckButton.Active = ! configuration.RunWithWarnings;
warningLevelSpinButton.Value = compilerParameters.WarningLevel;
}
@@ -89,16 +92,16 @@
if (compilerParameters == null) {
return true;
}
- compilerParameters.CompileTarget = (CompileTarget) CompileTargetOptionMenu.History;
+ configuration.CompileTarget = (CompileTarget) CompileTargetOptionMenu.History;
compilerParameters.DefineSymbols = symbolsEntry.Text;
compilerParameters.MainClass = mainClassEntry.Text;
- compilerParameters.Debugmode = generateDebugInformationCheckButton.Active;
+ configuration.DebugMode = generateDebugInformationCheckButton.Active;
compilerParameters.GenerateXmlDocumentation = generateXmlOutputCheckButton.Active;
compilerParameters.Optimize = enableOptimizationCheckButton.Active;
compilerParameters.UnsafeCode = allowUnsafeCodeCheckButton.Active;
compilerParameters.GenerateOverflowChecks = generateOverflowChecksCheckButton.Active;
- compilerParameters.RunWithWarnings = ! warningsAsErrorsCheckButton.Active;
+ configuration.RunWithWarnings = ! warningsAsErrorsCheckButton.Active;
compilerParameters.WarningLevel = warningLevelSpinButton.ValueAsInt;
Index: Core/src/AddIns/BackendBindings/CSharpBinding/CSharpBindingCompilerManager.cs
===================================================================
--- Core/src/AddIns/BackendBindings/CSharpBinding/CSharpBindingCompilerManager.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/CSharpBinding/CSharpBindingCompilerManager.cs (working copy)
@@ -29,145 +29,46 @@
{
FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.GetService(typeof(FileUtilityService));
- public string GetCompiledOutputName(string fileName)
- {
- return Path.ChangeExtension(fileName, ".exe");
- }
-
- public string GetCompiledOutputName(IProject project)
- {
- CSharpProject p = (CSharpProject)project;
- CSharpCompilerParameters compilerparameters = (CSharpCompilerParameters)p.ActiveConfiguration;
- string exe = fileUtilityService.GetDirectoryNameWithSeparator(compilerparameters.OutputDirectory) + compilerparameters.OutputAssembly + (compilerparameters.CompileTarget == CompileTarget.Library ? ".dll" : ".exe");
- return exe;
- }
-
public bool CanCompile(string fileName)
{
return Path.GetExtension(fileName).ToUpper() == ".CS";
}
-
- public ICompilerResult CompileFile(string filename, CSharpCompilerParameters compilerparameters)
- {
- string output = "";
- string error = "";
- string exe = Path.ChangeExtension(filename, ".exe");
- if (compilerparameters.OutputAssembly != null && compilerparameters.OutputAssembly.Length > 0) {
- exe = compilerparameters.OutputAssembly;
- }
- string responseFileName = Path.GetTempFileName();
-
- StreamWriter writer = new StreamWriter(responseFileName);
- writer.WriteLine("\"/out:" + exe + '"');
-
- writer.WriteLine("/nologo");
- writer.WriteLine("/utf8output");
- writer.WriteLine("/w:" + compilerparameters.WarningLevel);
-
- if (compilerparameters.Debugmode) {
- writer.WriteLine("/debug:+");
- writer.WriteLine("/debug:full");
- writer.WriteLine("/d:DEBUG");
- }
-
- if (!compilerparameters.RunWithWarnings) {
- writer.WriteLine("/warnaserror+");
- }
-
- if (compilerparameters.Optimize) {
- writer.WriteLine("/o");
- }
-
- if (compilerparameters.UnsafeCode) {
- writer.WriteLine("/unsafe");
- }
-
- if (compilerparameters.DefineSymbols.Length > 0) {
- writer.WriteLine("/define:" + '"' + compilerparameters.DefineSymbols + '"');
- }
-
- switch (compilerparameters.CompileTarget) {
- case CompileTarget.Exe:
- writer.WriteLine("/target:exe");
- break;
- case CompileTarget.WinExe:
- writer.WriteLine("/target:winexe");
- break;
- case CompileTarget.Library:
- writer.WriteLine("/target:library");
- break;
- case CompileTarget.Module:
- writer.WriteLine("/target:module");
- break;
- }
-
- writer.WriteLine('"' + filename + '"');
-
- TempFileCollection tf = new TempFileCollection ();
-
- if (compilerparameters.GenerateXmlDocumentation) {
- writer.WriteLine("\"/doc:" + Path.ChangeExtension(exe, ".xml") + '"');
- }
-
- writer.Close();
-
- // add " to the responseFileName when they aren't there
- if (!responseFileName.StartsWith("\"") && !responseFileName.EndsWith("\"")) {
- responseFileName = String.Concat("\"", responseFileName, "\"");
- }
-
- string compilerName = compilerparameters.CsharpCompiler == CsharpCompiler.Csc ? GetCompilerName() : "mcs";
- string outstr = compilerName + " @" +responseFileName;
- Executor.ExecWaitWithCapture(outstr, tf, ref output, ref error);
-
- ICompilerResult result = ParseOutput(tf, output, error);
-
- File.Delete(responseFileName);
- File.Delete(output);
- File.Delete(error);
- return result;
- }
-
- public ICompilerResult CompileProject(IProject project)
+ public ICompilerResult Compile (ProjectFileCollection projectFiles, ProjectReferenceCollection references, DotNetProjectConfiguration configuration)
{
- CSharpProject p = (CSharpProject)project;
- CSharpCompilerParameters compilerparameters = (CSharpCompilerParameters)p.ActiveConfiguration;
+ CSharpCompilerParameters compilerparameters = (CSharpCompilerParameters) configuration.CompilationParameters;
+ if (compilerparameters == null) compilerparameters = new CSharpCompilerParameters ();
- string exe = fileUtilityService.GetDirectoryNameWithSeparator(compilerparameters.OutputDirectory) + compilerparameters.OutputAssembly + (compilerparameters.CompileTarget == CompileTarget.Library ? ".dll" : ".exe");
+ string exe = configuration.CompiledOutputName;
string responseFileName = Path.GetTempFileName();
StreamWriter writer = new StreamWriter(responseFileName);
- string optionString = compilerparameters.CsharpCompiler == CsharpCompiler.Csc ? "/" : "-";
-
if (compilerparameters.CsharpCompiler == CsharpCompiler.Csc) {
writer.WriteLine("\"/out:" + exe + '"');
IProjectService projectService = (IProjectService)MonoDevelop.Core.Services.ServiceManager.GetService(typeof(IProjectService));
- ArrayList allProjects = Combine.GetAllProjects(projectService.CurrentOpenCombine);
- SystemAssemblyService sas = (SystemAssemblyService)ServiceManager.GetService (typeof (SystemAssemblyService));
ArrayList pkg_references = new ArrayList ();
- foreach (ProjectReference lib in project.ProjectReferences) {
- switch (lib.ReferenceType) {
- case ReferenceType.Gac:
- string pkg = sas.GetPackageFromFullName (lib.Reference);
- if (pkg.Trim () == String.Empty)
- continue;
- if (pkg == "MONO-SYSTEM") {
- writer.WriteLine ("\"/r:" + Path.GetFileName (lib.GetReferencedFileName (project)) + "\"");
- } else if (!pkg_references.Contains (pkg)) {
- pkg_references.Add (pkg);
- writer.WriteLine ("\"-pkg:" + pkg + "\"");
+
+ if (references != null) {
+ foreach (ProjectReference lib in references) {
+ string fileName = lib.GetReferencedFileName ();
+ switch (lib.ReferenceType) {
+ case ReferenceType.Gac:
+ string pkg = Runtime.SystemAssemblyService.GetPackageFromFullName (lib.Reference);
+ if (pkg.Trim () == String.Empty)
+ continue;
+ if (pkg == "MONO-SYSTEM") {
+ writer.WriteLine ("\"/r:" + Path.GetFileName (fileName) + "\"");
+ } else if (!pkg_references.Contains (pkg)) {
+ pkg_references.Add (pkg);
+ writer.WriteLine ("\"-pkg:" + pkg + "\"");
+ }
+ break;
+ case ReferenceType.Assembly:
+ case ReferenceType.Project:
+ writer.WriteLine ("\"/r:" + fileName + "\"");
+ break;
}
- break;
- case ReferenceType.Assembly:
- string assembly_fileName = lib.GetReferencedFileName (project);
- writer.WriteLine ("\"/r:" + assembly_fileName + "\"");
- break;
- case ReferenceType.Project:
- string project_fileName = lib.GetReferencedFileName (project);
- writer.WriteLine ("\"/r:" + project_fileName + "\"");
- break;
}
}
@@ -176,7 +77,7 @@
// writer.WriteLine("/utf8output");
// writer.WriteLine("/w:" + compilerparameters.WarningLevel);;
- if (compilerparameters.Debugmode) {
+ if (configuration.DebugMode) {
writer.WriteLine("/debug:+");
writer.WriteLine("/debug:full");
writer.WriteLine("/d:DEBUG");
@@ -186,7 +87,7 @@
// writer.WriteLine("/o");
// }
- if (compilerparameters.Win32Icon != null && compilerparameters.Win32Icon.Length > 0 && File.Exists(compilerparameters.Win32Icon)) {
+ if (compilerparameters.Win32Icon != null && compilerparameters.Win32Icon.Length > 0 && File.Exists (compilerparameters.Win32Icon)) {
writer.WriteLine("\"/win32icon:" + compilerparameters.Win32Icon + "\"");
}
@@ -202,7 +103,7 @@
writer.WriteLine("/main:" + compilerparameters.MainClass);
}
- switch (compilerparameters.CompileTarget) {
+ switch (configuration.CompileTarget) {
case CompileTarget.Exe:
writer.WriteLine("/t:exe");
break;
@@ -214,7 +115,7 @@
break;
}
- foreach (ProjectFile finfo in p.ProjectFiles) {
+ foreach (ProjectFile finfo in projectFiles) {
if (finfo.Subtype != Subtype.Directory) {
switch (finfo.BuildAction) {
case BuildAction.Compile:
@@ -227,11 +128,6 @@
break;
}
}
-
- // Treat app.config in the project root directory as the application config
- if(Path.GetFileName(finfo.Name).ToUpper()=="app.config".ToUpper() &&
- Path.GetDirectoryName(finfo.Name)==p.BaseDirectory)
- File.Copy(finfo.Name,exe+".config",true);
}
if (compilerparameters.GenerateXmlDocumentation) {
writer.WriteLine("\"/doc:" + Path.ChangeExtension(exe, ".xml") + '"');
@@ -246,14 +142,15 @@
writer.WriteLine("--wlevel " + compilerparameters.WarningLevel);
IProjectService projectService = (IProjectService)MonoDevelop.Core.Services.ServiceManager.GetService(typeof(IProjectService));
- ArrayList allProjects = Combine.GetAllProjects(projectService.CurrentOpenCombine);
-
- foreach (ProjectReference lib in p.ProjectReferences) {
- string fileName = lib.GetReferencedFileName(p);
- writer.WriteLine("-r:" + fileName );
+
+ if (references != null) {
+ foreach (ProjectReference lib in references) {
+ string fileName = lib.GetReferencedFileName ();
+ writer.WriteLine("-r:" + fileName );
+ }
}
- switch (compilerparameters.CompileTarget) {
+ switch (configuration.CompileTarget) {
case CompileTarget.Exe:
writer.WriteLine("--target exe");
break;
@@ -264,7 +161,7 @@
writer.WriteLine("--target library");
break;
}
- foreach (ProjectFile finfo in p.ProjectFiles) {
+ foreach (ProjectFile finfo in projectFiles) {
if (finfo.Subtype != Subtype.Directory) {
switch (finfo.BuildAction) {
case BuildAction.Compile:
@@ -294,26 +191,25 @@
DoCompilation(outstr, tf, ref output, ref error);
ICompilerResult result = ParseOutput(tf, output, error);
- project.CopyReferencesToOutputPath(false);
File.Delete(responseFileName);
File.Delete(output);
File.Delete(error);
return result;
}
-
- public void GenerateMakefile (IProject project, Combine parentCombine)
+
+ public void GenerateMakefile (Project project, Combine parentCombine)
{
StreamWriter stream = new StreamWriter (Path.Combine (project.BaseDirectory, "Makefile." + project.Name.Replace (" ", "")));
- CSharpProject p = (CSharpProject)project;
- CSharpCompilerParameters compilerparameters = (CSharpCompilerParameters)p.ActiveConfiguration;
+ DotNetProjectConfiguration conf = (DotNetProjectConfiguration) project.ActiveConfiguration;
+ CSharpCompilerParameters compilerparameters = (CSharpCompilerParameters) conf.CompilationParameters;
- string outputName = compilerparameters.OutputAssembly + (compilerparameters.CompileTarget == CompileTarget.Library ? ".dll" : ".exe");
+ string outputName = conf.CompiledOutputName;
string target = "";
string relativeOutputDir = fileUtilityService.AbsoluteToRelativePath (project.BaseDirectory, parentCombine.OutputDirectory);
- switch (compilerparameters.CompileTarget) {
+ switch (conf.CompileTarget) {
case CompileTarget.Exe:
target = "exe";
break;
@@ -349,34 +245,33 @@
}
}
- SystemAssemblyService sas = (SystemAssemblyService)ServiceManager.GetService (typeof (SystemAssemblyService));
foreach (ProjectReference lib in project.ProjectReferences) {
switch (lib.ReferenceType) {
case ReferenceType.Gac:
- string pkg = sas.GetPackageFromFullName (lib.Reference);
+ string pkg = Runtime.SystemAssemblyService.GetPackageFromFullName (lib.Reference);
if (pkg.Trim () == String.Empty)
continue;
if (pkg == "MONO-SYSTEM") {
- system_references.Add (Path.GetFileName (lib.GetReferencedFileName (project)));
+ system_references.Add (Path.GetFileName (lib.GetReferencedFileName ()));
} else if (!pkg_references.Contains (pkg)) {
pkg_references.Add (pkg);
}
break;
case ReferenceType.Assembly:
- string assembly_fileName = lib.GetReferencedFileName (project);
+ string assembly_fileName = lib.GetReferencedFileName ();
string rel_path_to = fileUtilityService.AbsoluteToRelativePath (project.BaseDirectory, Path.GetDirectoryName (assembly_fileName));
assembly_references.Add (Path.Combine (rel_path_to, Path.GetFileName (assembly_fileName)));
break;
case ReferenceType.Project:
- string project_fileName = lib.GetReferencedFileName (project);
+ string project_fileName = lib.GetReferencedFileName ();
IProjectService prjService = (IProjectService)ServiceManager.GetService (typeof (IProjectService));
- ArrayList allProjects = Combine.GetAllProjects(prjService.CurrentOpenCombine);
+ CombineEntryCollection allProjects = prjService.CurrentOpenCombine.GetAllProjects();
- foreach (ProjectCombineEntry projectEntry in allProjects) {
- if (projectEntry.Project.Name == lib.Reference) {
- string project_base_dir = fileUtilityService.AbsoluteToRelativePath (project.BaseDirectory, projectEntry.Project.BaseDirectory);
+ foreach (Project projectEntry in allProjects) {
+ if (projectEntry.Name == lib.Reference) {
+ string project_base_dir = fileUtilityService.AbsoluteToRelativePath (project.BaseDirectory, projectEntry.BaseDirectory);
- string project_output_fileName = prjService.GetOutputAssemblyName (projectEntry.Project);
+ string project_output_fileName = projectEntry.GetOutputFileName ();
project_references.Add (Path.Combine (project_base_dir, Path.GetFileName (project_output_fileName)));
}
}
@@ -576,7 +471,6 @@
ret = ret + "bin/mcs";
}
return ret;
-
}
ICompilerResult ParseOutput(TempFileCollection tf, string stdout, string stderr)
@@ -647,13 +541,13 @@
bool done ()
{
- ((SdStatusBar)Runtime.Gui.StatusBar.Control).Done ();
+ Runtime.Gui.StatusBar.ProgressMonitor.Done ();
return false;
}
bool pulse ()
{
- ((SdStatusBar)Runtime.Gui.StatusBar.Control).Pulse ();
+ Runtime.Gui.StatusBar.ProgressMonitor.Pulse ();
while (Gtk.Application.EventsPending ())
Gtk.Application.RunIteration ();
return false;
Index: Core/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpCompilerParameters.cs
===================================================================
--- Core/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpCompilerParameters.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpCompilerParameters.cs (working copy)
@@ -11,116 +11,69 @@
using System.ComponentModel;
using MonoDevelop.Gui.Components;
using MonoDevelop.Internal.Project;
+using MonoDevelop.Internal.Serialization;
namespace CSharpBinding
{
- public enum CompileTarget {
- Exe,
- Library,
- WinExe,
- Module
- };
-
public enum CsharpCompiler {
Csc,
Mcs
};
- public enum NetRuntime {
- Mono,
- MonoInterpreter,
- MsNet
- };
-
/// <summary>
/// This class handles project specific compiler parameters
/// </summary>
- public class CSharpCompilerParameters : AbstractProjectConfiguration
+ public class CSharpCompilerParameters
{
- [XmlNodeName("CodeGeneration")]
- public class CodeGeneration
- {
- [XmlAttribute("runtime")]
- public NetRuntime netRuntime = NetRuntime.MsNet;
-
- [XmlAttribute("compiler")]
- public CsharpCompiler csharpCompiler = CsharpCompiler.Csc;
-
- [XmlAttribute("warninglevel")]
- public int warninglevel = 4;
-
- [XmlAttribute("nowarn")]
- public string noWarnings = String.Empty;
-
- [XmlAttribute("includedebuginformation")]
- public bool debugmode = true;
-
- [XmlAttribute("optimize")]
- public bool optimize = true;
-
- [XmlAttribute("unsafecodeallowed")]
- public bool unsafecode = false;
-
- [XmlAttribute("generateoverflowchecks")]
- public bool generateOverflowChecks = true;
-
- [XmlAttribute("mainclass")]
- public string mainclass = null;
-
- [XmlAttribute("target")]
- public CompileTarget compiletarget = CompileTarget.Exe;
-
- [XmlAttribute("definesymbols")]
- public string definesymbols = String.Empty;
-
- [XmlAttribute("generatexmldocumentation")]
- public bool generateXmlDocumentation = false;
-
- [ConvertToRelativePathAttribute()]
- [XmlAttribute("win32Icon")]
- public string win32Icon = String.Empty;
- }
+ // Configuration parameters
- [XmlNodeName("Execution")]
- public class Execution
- {
- [XmlAttribute("commandlineparameters")]
- public string commandLineParameters = String.Empty;
-
- [XmlAttribute("consolepause")]
- public bool pauseconsoleoutput = true;
- }
+ [ItemProperty ("compiler")]
+ CsharpCompiler csharpCompiler = CsharpCompiler.Csc;
- protected CodeGeneration codeGeneration = new CodeGeneration();
- protected Execution execution = new Execution();
+ [ItemProperty ("warninglevel")]
+ int warninglevel = 4;
+ [ItemProperty ("nowarn", DefaultValue = "")]
+ string noWarnings = String.Empty;
+
+ [ItemProperty ("optimize")]
+ bool optimize = true;
+
+ [ItemProperty ("unsafecodeallowed")]
+ bool unsafecode = false;
+
+ [ItemProperty ("generateoverflowchecks")]
+ bool generateOverflowChecks = true;
+
+ [ItemProperty ("mainclass")]
+ string mainclass = null;
+
+ [ItemProperty ("definesymbols", DefaultValue = "")]
+ string definesymbols = String.Empty;
+
+ [ItemProperty ("generatexmldocumentation")]
+ bool generateXmlDocumentation = false;
+
+ [ProjectPathItemProperty ("win32Icon", DefaultValue = "")]
+ string win32Icon = String.Empty;
+
[Browsable(false)]
public CsharpCompiler CsharpCompiler {
get {
- return codeGeneration.csharpCompiler;
+ return csharpCompiler;
}
set {
- codeGeneration.csharpCompiler = value;
+ csharpCompiler = value;
}
}
[Browsable(false)]
- public NetRuntime NetRuntime {
- get {
- return codeGeneration.netRuntime;
- }
- set {
- codeGeneration.netRuntime = value;
- }
- }
-
- [Browsable(false)]
public string Win32Icon {
get {
- return codeGeneration.win32Icon;
+ return win32Icon;
}
set {
- codeGeneration.win32Icon = value;
+ win32Icon = value;
}
}
#region Code Generation
@@ -130,10 +83,10 @@
Description = "${res:BackendBindings.CompilerOptions.CodeGeneration.MainClass.Description}")]
public string MainClass {
get {
- return codeGeneration.mainclass;
+ return mainclass;
}
set {
- codeGeneration.mainclass = value;
+ mainclass = value;
}
}
@@ -143,36 +96,23 @@
Description = "${res:BackendBindings.CompilerOptions.CodeGeneration.DefineSymbols.Description}")]
public string DefineSymbols {
get {
- return codeGeneration.definesymbols;
+ return definesymbols;
}
set {
- codeGeneration.definesymbols = value;
+ definesymbols = value;
}
}
[DefaultValue(true)]
- [LocalizedProperty("${res:BackendBindings.CompilerOptions.CodeGeneration.DebugMode}",
- Category = "${res:BackendBindings.CompilerOptions.CodeGeneration}",
- Description = "${res:BackendBindings.CompilerOptions.CodeGeneration.DebugMode.Description}")]
- public bool Debugmode {
- get {
- return codeGeneration.debugmode;
- }
- set {
- codeGeneration.debugmode = value;
- }
- }
-
- [DefaultValue(true)]
[LocalizedProperty("${res:BackendBindings.CompilerOptions.CodeGeneration.Optimize}",
Category = "${res:BackendBindings.CompilerOptions.CodeGeneration}",
Description = "${res:BackendBindings.CompilerOptions.CodeGeneration.Optimize.Description}")]
public bool Optimize {
get {
- return codeGeneration.optimize;
+ return optimize;
}
set {
- codeGeneration.optimize = value;
+ optimize = value;
}
}
@@ -182,10 +122,10 @@
Description = "${res:BackendBindings.CompilerOptions.CodeGeneration.UnsafeCode.Description}")]
public bool UnsafeCode {
get {
- return codeGeneration.unsafecode;
+ return unsafecode;
}
set {
- codeGeneration.unsafecode = value;
+ unsafecode = value;
}
}
@@ -195,10 +135,10 @@
Description = "${res:BackendBindings.CompilerOptions.CodeGeneration.GenerateOverflowChecks.Description}")]
public bool GenerateOverflowChecks {
get {
- return codeGeneration.generateOverflowChecks;
+ return generateOverflowChecks;
}
set {
- codeGeneration.generateOverflowChecks = value;
+ generateOverflowChecks = value;
}
}
@@ -208,10 +148,10 @@
Description = "${res:BackendBindings.CompilerOptions.CodeGeneration.GenerateXmlDocumentation.Description}")]
public bool GenerateXmlDocumentation {
get {
- return codeGeneration.generateXmlDocumentation;
+ return generateXmlDocumentation;
}
set {
- codeGeneration.generateXmlDocumentation = value;
+ generateXmlDocumentation = value;
}
}
@@ -224,10 +164,10 @@
Description = "${res:BackendBindings.CompilerOptions.WarningAndErrorCategory.WarningLevel.Description}")]
public int WarningLevel {
get {
- return codeGeneration.warninglevel;
+ return warninglevel;
}
set {
- codeGeneration.warninglevel = value;
+ warninglevel = value;
}
}
@@ -237,50 +177,12 @@
Description = "${res:BackendBindings.CompilerOptions.WarningAndErrorCategory.NoWarnings.Description}")]
public string NoWarnings {
get {
- return codeGeneration.noWarnings;
+ return noWarnings;
}
set {
- codeGeneration.noWarnings = value;
+ noWarnings = value;
}
}
#endregion
- [Browsable(false)]
- public string CommandLineParameters {
- get {
- return execution.commandLineParameters;
- }
- set {
- execution.commandLineParameters = value;
- }
- }
-
- [Browsable(false)]
- public bool PauseConsoleOutput {
- get {
- return execution.pauseconsoleoutput;
- }
- set {
- execution.pauseconsoleoutput = value;
- }
- }
-
-
- [Browsable(false)]
- public CompileTarget CompileTarget {
- get {
- return codeGeneration.compiletarget;
- }
- set {
- codeGeneration.compiletarget = value;
- }
- }
-
- public CSharpCompilerParameters()
- {
- }
- public CSharpCompilerParameters(string name)
- {
- this.name = name;
- }
}
}
Index: Core/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpProject.cs
===================================================================
--- Core/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpProject.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpProject.cs (working copy)
@@ -1,66 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@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 CSharpBinding
-{
- /// <summary>
- /// This class describes a C Sharp project and it compilation options.
- /// </summary>
- public class CSharpProject : AbstractProject
- {
- public override string ProjectType {
- get {
- return CSharpLanguageBinding.LanguageName;
- }
- }
-
- public CSharpProject()
- {
- }
-
- public override IConfiguration CreateConfiguration()
- {
- return new CSharpCompilerParameters();
- }
-
- public CSharpProject(ProjectCreateInformation info, XmlElement projectOptions)
- {
- if (info != null) {
- Name = info.ProjectName;
- Configurations.Add(CreateConfiguration("Debug"));
- Configurations.Add(CreateConfiguration("Release"));
-
- foreach (CSharpCompilerParameters parameter in Configurations) {
- parameter.OutputDirectory = info.BinPath + Path.DirectorySeparatorChar + parameter.Name;
- parameter.OutputAssembly = Name;
- //}
- //XmlElement el = info.ProjectTemplate.ProjectOptions; -- moved above foreach loop
- //para variable renamed parameter
- //CSharpCompilerParameters para = ActiveConfiguration;?? - removed as nolonger needed
- if (projectOptions != null) {
- if (projectOptions.Attributes["Target"] != null) {
- parameter.CompileTarget = (CompileTarget)Enum.Parse(typeof(CompileTarget), projectOptions.Attributes["Target"].InnerText);
- }
- if (projectOptions.Attributes["PauseConsoleOutput"] != null) {
- parameter.PauseConsoleOutput = Boolean.Parse(projectOptions.Attributes["PauseConsoleOutput"].InnerText);
- }
- }
- }
- }
- }
- }
-}
Index: Core/src/AddIns/BackendBindings/CSharpBinding/ChangeLog
===================================================================
--- Core/src/AddIns/BackendBindings/CSharpBinding/ChangeLog (revision 2122)
+++ Core/src/AddIns/BackendBindings/CSharpBinding/ChangeLog (working copy)
@@ -1,3 +1,24 @@
+2005-01-11 Lluis Sanchez Gual <lluis@novell.com>
+
+ * CSharpLanguageBinding.cs:
+ * Gui/ChooseRuntimePanel.cs:
+ * Gui/CodeGenerationPanel.cs:
+ * CSharpBindingCompilerManager.cs:
+ * CSharpBinding.addin.xml:
+ * Parser/Parser.cs:
+ * Parser/Resolver.cs: Follow architecture changes.
+
+ * Project/CSharpCompilerParameters.cs: Moved some parameters and enum
+ definitions to DotNetProjectConfiguration.
+
+ * CSharp.glade:
+ * Gui/OutputOptionsPanel.cs: Removed dialog now implemented in Monodevelop.Base.
+
+ * Project/CSharpProject.cs:
+ * CSharpBindingExecutionManager.cs.in: Removed. Not needed any more.
+
+ * Makefile.am: Updated.
+
2004-12-13 Lluis Sanchez Gual <lluis@novell.com>
* CSharpBindingCompilerManager.cs: StatusBarService.ProgressMonitor is
Index: Core/src/AddIns/BackendBindings/CSharpBinding/CSharpBinding.addin.xml
===================================================================
--- Core/src/AddIns/BackendBindings/CSharpBinding/CSharpBinding.addin.xml (revision 2122)
+++ Core/src/AddIns/BackendBindings/CSharpBinding/CSharpBinding.addin.xml (working copy)
@@ -85,13 +85,13 @@
</Extension>
<Extension path = "/SharpDevelop/Workbench/ProjectOptions/ConfigurationProperties">
- <Conditional activeproject="C#">
+ <Conditional activelanguage="C#">
<DialogPanel id = "CSharpCodeGenerationPanel"
_label = "Code Generation"
class = "CSharpBinding.CodeGenerationPanel"/>
<DialogPanel id = "CSharpOutputOptionsPanel"
_label = "Output"
- class = "CSharpBinding.OutputOptionsPanel"/>
+ class = "MonoDevelop.Gui.Dialogs.OptionPanels.OutputOptionsPanel"/>
</Conditional>
</Extension>
Index: Core/src/AddIns/BackendBindings/CSharpBinding/Makefile.am
===================================================================
--- Core/src/AddIns/BackendBindings/CSharpBinding/Makefile.am (revision 2122)
+++ Core/src/AddIns/BackendBindings/CSharpBinding/Makefile.am (working copy)
@@ -11,7 +11,6 @@
FILES = \
Gui/ChooseRuntimePanel.cs \
-Gui/OutputOptionsPanel.cs \
Gui/CodeGenerationPanel.cs \
Parser/SharpDevelopTree/Event.cs \
Parser/SharpDevelopTree/Indexer.cs \
@@ -30,7 +29,6 @@
Parser/Parser.cs \
Parser/ExpressionFinder.cs \
CSharpAmbience.cs \
-Project/CSharpProject.cs \
Project/CSharpCompilerParameters.cs \
CSharpLanguageBinding.cs \
FormattingStrategy/CSharpFormattingStrategy.cs \
@@ -55,7 +53,7 @@
templates/GtkSharpWindow.xft.xml \
templates/Library.xpt.xml
-build_sources = $(addprefix $(srcdir)/, $(FILES)) CSharpBindingExecutionManager.cs
+build_sources = $(addprefix $(srcdir)/, $(FILES))
ADDIN = CSharpBinding.addin.xml
@@ -94,7 +92,5 @@
CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb
-DISTCLEANFILES = CSharpBindingExecutionManager.cs
+EXTRA_DIST = $(FILES) CSharp.glade $(ADDIN) $(TEMPLATES)
-EXTRA_DIST = $(FILES) CSharpBindingExecutionManager.cs.in CSharp.glade $(ADDIN) $(TEMPLATES)
-
Index: Core/src/AddIns/BackendBindings/CSharpBinding/CSharp.glade
===================================================================
--- Core/src/AddIns/BackendBindings/CSharpBinding/CSharp.glade (revision 2122)
+++ Core/src/AddIns/BackendBindings/CSharpBinding/CSharp.glade (working copy)
@@ -469,568 +469,4 @@
</child>
</widget>
-<widget class="GtkWindow" id="OutputOptionsPanel">
- <property name="visible">True</property>
- <property name="title" translatable="yes">OutputOptionsPanel</property>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_NONE</property>
- <property name="modal">False</property>
- <property name="resizable">True</property>
- <property name="destroy_with_parent">False</property>
-
- <child>
- <widget class="GtkVBox" id="vbox66">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkVBox" id="vbox67">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label93">
- <property name="visible">True</property>
- <property name="label" translatable="yes"><b>Output</b></property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox57">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label91">
- <property name="visible">True</property>
- <property name="label" translatable="yes"> </property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox69">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkTable" id="table10">
- <property name="visible">True</property>
- <property name="n_rows">3</property>
- <property name="n_columns">3</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label98">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Assembly _name</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">assemblyNameEntry</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label99">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Output _path</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">outputDirectoryEntry</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label100">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Paramet_ers</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">parametersEntry</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="outputDirectoryEntry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char" translatable="yes">*</property>
- <property name="activates_default">False</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkButton" id="browseButton">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">...</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- </widget>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="assemblyNameEntry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char" translatable="yes">*</property>
- <property name="activates_default">False</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">3</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="parametersEntry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char" translatable="yes">*</property>
- <property name="activates_default">False</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">3</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="y_options"></property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkCheckButton" id="pauseConsoleOutputCheckButton">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Pause _console output</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox68">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label94">
- <property name="visible">True</property>
- <property name="label" translatable="yes"><b>Execute scripts </b></property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox58">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label92">
- <property name="visible">True</property>
- <property name="label" translatable="yes"> </property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkTable" id="table9">
- <property name="visible">True</property>
- <property name="n_rows">3</property>
- <property name="n_columns">3</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label95">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Execute Command</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label96">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_After Build</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">executeAfterEntry</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label97">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Before build</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">executeBeforeEntry</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="executeScriptEntry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char" translatable="yes">*</property>
- <property name="activates_default">False</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="executeAfterEntry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char" translatable="yes">*</property>
- <property name="activates_default">False</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="executeBeforeEntry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char" translatable="yes">*</property>
- <property name="activates_default">False</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkButton" id="browseButton2">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">...</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- </widget>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkButton" id="browseButton3">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">...</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- </widget>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkButton" id="browseButton4">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">...</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- </widget>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
-</widget>
-
</glade-interface>
Index: Core/src/AddIns/BackendBindings/CSharpBinding/Parser/Parser.cs
===================================================================
--- Core/src/AddIns/BackendBindings/CSharpBinding/Parser/Parser.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/CSharpBinding/Parser/Parser.cs (working copy)
@@ -94,22 +94,22 @@
return visitor.Cu;
}
- public ArrayList CtrlSpace(IParserService parserService, IProject project, int caretLine, int caretColumn, string fileName)
+ public ArrayList CtrlSpace(IParserService parserService, Project project, int caretLine, int caretColumn, string fileName)
{
return new Resolver(project).CtrlSpace(parserService, caretLine, caretColumn, fileName);
}
- public ArrayList IsAsResolve (IParserService parserService, IProject project, string expression, int caretLineNumber, int caretColumn, string fileName, string fileContent)
+ public ArrayList IsAsResolve (IParserService parserService, Project project, string expression, int caretLineNumber, int caretColumn, string fileName, string fileContent)
{
return new Resolver (project).IsAsResolve (parserService, expression, caretLineNumber, caretColumn, fileName, fileContent);
}
- public ResolveResult Resolve(IParserService parserService, IProject project, string expression, int caretLineNumber, int caretColumn, string fileName, string fileContent)
+ public ResolveResult Resolve(IParserService parserService, Project project, string expression, int caretLineNumber, int caretColumn, string fileName, string fileContent)
{
return new Resolver(project).Resolve(parserService, expression, caretLineNumber, caretColumn, fileName, fileContent);
}
- public string MonodocResolver (IParserService parserService, IProject project, string expression, int caretLineNumber, int caretColumn, string fileName, string fileContent)
+ public string MonodocResolver (IParserService parserService, Project project, string expression, int caretLineNumber, int caretColumn, string fileName, string fileContent)
{
return new Resolver (project).MonodocResolver (parserService, expression, caretLineNumber, caretColumn, fileName, fileContent);
}
Index: Core/src/AddIns/BackendBindings/CSharpBinding/Parser/Resolver.cs
===================================================================
--- Core/src/AddIns/BackendBindings/CSharpBinding/Parser/Resolver.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/CSharpBinding/Parser/Resolver.cs (working copy)
@@ -24,9 +24,9 @@
ICompilationUnit cu;
IClass callingClass;
LookupTableVisitor lookupTableVisitor;
- IProject project;
+ Project project;
- public Resolver (IProject project)
+ public Resolver (Project project)
{
this.project = project;
}
Index: Core/src/AddIns/BackendBindings/JavaBinding/JavaBindingCompilerServices.cs
===================================================================
--- Core/src/AddIns/BackendBindings/JavaBinding/JavaBindingCompilerServices.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/JavaBinding/JavaBindingCompilerServices.cs (working copy)
@@ -19,34 +19,13 @@
{
public class JavaBindingCompilerServices
{
- JavaProject project;
-
public bool CanCompile (string fileName)
{
return Path.GetExtension(fileName) == ".java";
}
- public ICompilerResult CompileFile (string filename)
- {
- // we really dont support compiling single files
- throw new NotImplementedException ();
- }
-
- public string GetCompiledOutputName (string fileName)
- {
- return Path.ChangeExtension (fileName, ".class");
- }
-
FileUtilityService fileUtilityService = (FileUtilityService) ServiceManager.GetService(typeof(FileUtilityService));
- public string GetCompiledOutputName (IProject project)
- {
- JavaProject p = (JavaProject) project;
- JavaCompilerParameters compilerparameters = (JavaCompilerParameters) p.ActiveConfiguration;
-
- return fileUtilityService.GetDirectoryNameWithSeparator (compilerparameters.OutputDirectory) + compilerparameters.OutputAssembly + ".class";
- }
-
string GetCompilerName (JavaCompilerParameters cp)
{
if (cp.Compiler == JavaCompiler.Gcj)
@@ -57,18 +36,18 @@
return "javac";
}
- public ICompilerResult CompileProject (IProject project)
+ public ICompilerResult Compile (ProjectFileCollection projectFiles, ProjectReferenceCollection references, DotNetProjectConfiguration configuration)
{
- this.project = (JavaProject) project;
- JavaCompilerParameters compilerparameters = (JavaCompilerParameters) project.ActiveConfiguration;
+ JavaCompilerParameters compilerparameters = (JavaCompilerParameters) configuration.CompilationParameters;
+ if (compilerparameters == null) compilerparameters = new JavaCompilerParameters ();
- string outdir = compilerparameters.OutputDirectory;
- string exe = Path.Combine (outdir, compilerparameters.OutputAssembly + ".class");
+ string outdir = configuration.OutputDirectory;
+ string exe = Path.Combine (outdir, configuration.OutputAssembly + ".class");
string options = "";
string compiler = GetCompilerName (compilerparameters);
- if (compilerparameters.Debugmode)
+ if (configuration.DebugMode)
options += " -g ";
else
options += " -g:none ";
@@ -89,7 +68,7 @@
string files = "";
- foreach (ProjectFile finfo in project.ProjectFiles) {
+ foreach (ProjectFile finfo in projectFiles) {
if (finfo.Subtype != Subtype.Directory) {
switch (finfo.BuildAction) {
case BuildAction.Compile:
@@ -116,13 +95,13 @@
StreamReader output;
StreamReader error;
- DoCompilation (compiler, args, tf, out output, out error);
+ DoCompilation (compiler, args, tf, configuration, compilerparameters, out output, out error);
ICompilerResult cr = ParseOutput (tf, error);
return cr;
}
- private void DoCompilation (string compiler, string args, TempFileCollection tf, out StreamReader output, out StreamReader error)
+ private void DoCompilation (string compiler, string args, TempFileCollection tf, DotNetProjectConfiguration configuration, JavaCompilerParameters compilerparameters, out StreamReader output, out StreamReader error)
{
ProcessStartInfo si = new ProcessStartInfo (compiler, args);
si.RedirectStandardOutput = true;
@@ -142,7 +121,7 @@
System.Threading.Thread.Sleep (100);
}
- CompileToAssembly ();
+ CompileToAssembly (configuration, compilerparameters);
((SdStatusBar) sbs.Control).Done ();
// FIXME: avoid having a full buffer
@@ -152,11 +131,10 @@
error = p.StandardError;
}
- void CompileToAssembly ()
+ void CompileToAssembly (DotNetProjectConfiguration configuration, JavaCompilerParameters compilerparameters)
{
- JavaCompilerParameters compilerparameters = (JavaCompilerParameters) project.ActiveConfiguration;
- string outdir = compilerparameters.OutputDirectory;
- string outclass = Path.Combine (outdir, compilerparameters.OutputAssembly + ".class");
+ string outdir = configuration.OutputDirectory;
+ string outclass = Path.Combine (outdir, configuration.OutputAssembly + ".class");
string asm = Path.GetFileNameWithoutExtension (outclass);
// sadly I dont think we can specify the output .class name
Index: Core/src/AddIns/BackendBindings/JavaBinding/Gui/ProjectConfigurationPropertyPanel.cs
===================================================================
--- Core/src/AddIns/BackendBindings/JavaBinding/Gui/ProjectConfigurationPropertyPanel.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/JavaBinding/Gui/ProjectConfigurationPropertyPanel.cs (working copy)
@@ -47,6 +47,7 @@
private Entry mainClass = new Entry ();
JavaCompilerParameters compilerParameters = null;
+ DotNetProjectConfiguration configuration;
public override bool ReceiveDialogMessage(DialogMessage message)
{
@@ -61,10 +62,10 @@
compilerParameters.GenWarnings = checkWarnings.Active;
compilerParameters.Deprecation = checkDeprecation.Active;
- compilerParameters.Debugmode = checkDebug.Active;
+ configuration.DebugMode = checkDebug.Active;
compilerParameters.Optimize = checkOptimize.Active;
- compilerParameters.OutputAssembly = outputAssembly.Text;
- compilerParameters.OutputDirectory = outputDirectory.Text;
+ configuration.OutputAssembly = outputAssembly.Text;
+ configuration.OutputDirectory = outputDirectory.Text;
compilerParameters.CompilerPath = compilerPath.Text;
compilerParameters.ClassPath = classPath.Text;
@@ -75,7 +76,8 @@
void SetValues(object sender, EventArgs e)
{
- this.compilerParameters = (JavaCompilerParameters)((IProperties)CustomizationObject).GetProperty("Config");
+ configuration = (DotNetProjectConfiguration)((IProperties)CustomizationObject).GetProperty("Config");
+ compilerParameters = (JavaCompilerParameters) configuration.CompilationParameters;
if (compilerParameters.Compiler == JavaCompiler.Javac)
javac.Active = true;
@@ -83,11 +85,11 @@
gcj.Active = true;
checkOptimize.Active = compilerParameters.Optimize;
- checkDebug.Active = compilerParameters.Debugmode;
+ checkDebug.Active = configuration.DebugMode;
checkDeprecation.Active = compilerParameters.Deprecation;
checkWarnings.Active = compilerParameters.GenWarnings;
- outputAssembly.Text = compilerParameters.OutputAssembly;
- outputDirectory.Text = compilerParameters.OutputDirectory;
+ outputAssembly.Text = configuration.OutputAssembly;
+ outputDirectory.Text = configuration.OutputDirectory;
compilerPath.Text = compilerParameters.CompilerPath;
classPath.Text = compilerParameters.ClassPath;
Index: Core/src/AddIns/BackendBindings/JavaBinding/JavaLanguageBinding.cs
===================================================================
--- Core/src/AddIns/BackendBindings/JavaBinding/JavaLanguageBinding.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/JavaBinding/JavaLanguageBinding.cs (working copy)
@@ -16,6 +16,7 @@
using MonoDevelop.Internal.Project;
using MonoDevelop.Internal.Templates;
using MonoDevelop.Gui;
+using MonoDevelop.Services;
namespace JavaBinding
{
@@ -27,76 +28,49 @@
public const string LanguageName = "Java";
JavaBindingCompilerServices compilerServices = new JavaBindingCompilerServices();
- JavaBindingExecutionServices executionServices = new JavaBindingExecutionServices();
+ public JavaLanguageBinding ()
+ {
+ Runtime.ProjectService.DataContext.IncludeType (typeof(JavaCompilerParameters));
+ }
+
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)
+ public ICompilerResult Compile (ProjectFileCollection projectFiles, ProjectReferenceCollection references, DotNetProjectConfiguration configuration)
{
Debug.Assert(compilerServices != null);
- return compilerServices.CompileFile(fileName);
+ return compilerServices.Compile (projectFiles, references, configuration);
}
- public ICompilerResult CompileProject(IProject project)
+ public void GenerateMakefile (Project project, Combine parentCombine)
{
- Debug.Assert(compilerServices != null);
- return compilerServices.CompileProject(project);
+ throw new NotImplementedException ();
}
- public ICompilerResult RecompileProject(IProject project)
+ public object CreateCompilationParameters (XmlElement projectOptions)
{
- return CompileProject(project);
+ JavaCompilerParameters parameters = new JavaCompilerParameters ();
+ if (projectOptions != null) {
+ if (projectOptions.Attributes["MainClass"] != null) {
+ parameters.MainClass = projectOptions.GetAttribute ("MainClass");
+ }
+ if (projectOptions.Attributes["ClassPath"] != null) {
+ parameters.ClassPath = projectOptions.GetAttribute ("ClassPath");
+ }
+ }
+ return parameters;
}
- public IProject CreateProject(ProjectCreateInformation info, XmlElement projectOptions)
- {
- return new JavaProject(info, projectOptions);
- }
-
- public void DebugProject (IProject project)
- {
- //executionManager.Debug (project);
- }
-
- public void GenerateMakefile (IProject project, Combine parentCombine)
- {
- throw new NotImplementedException ();
- }
-
// http://www.nbirn.net/Resources/Developers/Conventions/Commenting/Java_Comments.htm#CommentBlock
public string CommentTag
{
Index: Core/src/AddIns/BackendBindings/JavaBinding/Project/JavaCompilerParameters.cs
===================================================================
--- Core/src/AddIns/BackendBindings/JavaBinding/Project/JavaCompilerParameters.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/JavaBinding/Project/JavaCompilerParameters.cs (working copy)
@@ -10,143 +10,100 @@
using System.Diagnostics;
using MonoDevelop.Internal.Project;
+using MonoDevelop.Internal.Serialization;
namespace JavaBinding
{
/// <summary>
/// This class handles project specific compiler parameters
/// </summary>
- public class JavaCompilerParameters : AbstractProjectConfiguration
+ public class JavaCompilerParameters
{
- [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 ("compiler")]
- public JavaCompiler compiler = JavaCompiler.Gcj;
- [XmlAttribute("compilerpath")]
- public string compilerpath = "gcj";
-
- [XmlAttribute("genwarnings")]
- public bool genwarnings = false;
- }
+ [ItemProperty("deprecation")]
+ bool deprecation = true;
- [XmlNodeName("Execution")]
- class Execution
- {
- [XmlAttribute("consolepause")]
- public bool pauseconsoleoutput = true;
- }
+ [ItemProperty("optimize")]
+ bool optimize = true;
- CodeGeneration codeGeneration = new CodeGeneration ();
+ [ItemProperty("mainclass")]
+ string mainclass = null;
- Execution execution = new Execution ();
+ [ItemProperty("definesymbols")]
+ string definesymbols = String.Empty;
+
+ [ItemProperty("classpath")]
+ string classpath = String.Empty;
+
+ [ItemProperty ("compiler")]
+ JavaCompiler compiler = JavaCompiler.Gcj;
+ [ItemProperty("compilerpath")]
+ string compilerpath = "gcj";
+
+ [ItemProperty("genwarnings")]
+ bool genwarnings = false;
+
public bool GenWarnings {
get {
- return codeGeneration.genwarnings;
+ return genwarnings;
}
set {
- codeGeneration.genwarnings = value;
+ genwarnings = value;
}
}
public string ClassPath {
get {
- return codeGeneration.classpath;
+ return classpath;
}
set {
- codeGeneration.classpath = value;
+ classpath = value;
}
}
public JavaCompiler Compiler {
get {
- return codeGeneration.compiler;
+ return compiler;
}
set {
- codeGeneration.compiler = value;
+ compiler = value;
}
}
public string CompilerPath {
get {
- return codeGeneration.compilerpath;
+ return compilerpath;
}
set {
- codeGeneration.compilerpath = value;
+ compilerpath = value;
}
}
- public bool Debugmode {
- get {
- return codeGeneration.debugmode;
- }
- set {
- codeGeneration.debugmode = value;
- }
- }
-
public bool Deprecation {
get {
- return codeGeneration.deprecation;
+ return deprecation;
}
set {
- codeGeneration.deprecation = value;
+ deprecation = value;
}
}
public bool Optimize {
get {
- return codeGeneration.optimize;
+ return optimize;
}
set {
- codeGeneration.optimize = value;
+ optimize = value;
}
}
public string MainClass {
get {
- return codeGeneration.mainclass;
+ return mainclass;
}
set {
- codeGeneration.mainclass = value;
+ mainclass = value;
}
}
-
- public bool PauseConsoleOutput {
- get {
- return execution.pauseconsoleoutput;
- }
- set {
- execution.pauseconsoleoutput = value;
- }
- }
-
- public JavaCompilerParameters()
- {
- }
-
- public JavaCompilerParameters(string name)
- {
- this.name = name;
- }
}
}
Index: Core/src/AddIns/BackendBindings/JavaBinding/Project/JavaProject.cs
===================================================================
--- Core/src/AddIns/BackendBindings/JavaBinding/Project/JavaProject.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/JavaBinding/Project/JavaProject.cs (working copy)
@@ -1,70 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@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 Java 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;
- }
- }
- }
- }
- }
- }
-}
Index: Core/src/AddIns/BackendBindings/JavaBinding/ChangeLog
===================================================================
--- Core/src/AddIns/BackendBindings/JavaBinding/ChangeLog (revision 2122)
+++ Core/src/AddIns/BackendBindings/JavaBinding/ChangeLog (working copy)
@@ -1,3 +1,17 @@
+2005-01-11 Lluis Sanchez Gual <lluis@novell.com>
+
+ * JavaBindingCompilerServices.cs:
+ * Gui/ProjectConfigurationPropertyPanel.cs:
+ * JavaLanguageBinding.cs:
+ * JavaBinding.addin.xml:
+ * ProjectTreeBuilder/JavaNodeBuilder.cs: Follow architecture changes.
+
+ * JavaCompilerParameters.cs: Moved some parameters and enum
+ definitions to DotNetProjectConfiguration.
+
+ * Project/JavaProject.cs: Removed. Not needed any more.
+ * Makefile.am: Updated.
+
2004-12-13 Lluis Sanchez Gual <lluis@novell.com>
* JavaBindingCompilerServices.cs: StatusBarService.ProgressMonitor is
Index: Core/src/AddIns/BackendBindings/JavaBinding/JavaBindingExecutionServices.cs
===================================================================
--- Core/src/AddIns/BackendBindings/JavaBinding/JavaBindingExecutionServices.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/JavaBinding/JavaBindingExecutionServices.cs (working copy)
@@ -1,60 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version value="$version"/>
-// </file>
-
-using System;
-using System.IO;
-using System.Diagnostics;
-using System.Reflection;
-
-using MonoDevelop.Internal.Project;
-using MonoDevelop.Gui;
-using MonoDevelop.Gui.Pads;
-using MonoDevelop.Core.Services;
-using MonoDevelop.Services;
-
-namespace JavaBinding
-{
- public class JavaBindingExecutionServices
- {
- public void Execute (string filename)
- {
- throw new ApplicationException ("Cannot execute a file.");
- }
-
- public void Execute (IProject project)
- {
- JavaCompilerParameters parameters = (JavaCompilerParameters) project.ActiveConfiguration;
- string exe = ((JavaCompilerParameters) project.ActiveConfiguration).OutputAssembly;
- exe = Path.ChangeExtension (exe, ".exe");
- exe = Path.Combine (parameters.OutputDirectory, exe);
-
- if (!File.Exists (exe))
- {
- IMessageService messageService = (IMessageService) ServiceManager.GetService (typeof (IMessageService));
- messageService.ShowError (String.Format (GettextCatalog.GetString ("Error running {0}"), exe));
- return;
- }
-
- string javaExec = String.Format ("-e \"mono {0}; echo; read -p 'press any key to continue...' -n1\"", exe);
- ProcessStartInfo psi = new ProcessStartInfo ("xterm", javaExec);
-
- try
- {
- psi.UseShellExecute = false;
-
- Process p = new Process ();
- p.StartInfo = psi;
- p.Start ();
- p.WaitForExit ();
- }
- catch
- {
- throw new ApplicationException (String.Format ("Cannot execute: {0}", exe));
- }
- }
- }
-}
Index: Core/src/AddIns/BackendBindings/JavaBinding/Makefile.am
===================================================================
--- Core/src/AddIns/BackendBindings/JavaBinding/Makefile.am (revision 2122)
+++ Core/src/AddIns/BackendBindings/JavaBinding/Makefile.am (working copy)
@@ -11,12 +11,10 @@
FILES = \
Gui/ProjectConfigurationPropertyPanel.cs \
Project/JavaCompilerParameters.cs \
-Project/JavaProject.cs \
JavaBindingCompilerServices.cs \
JavaCompiler.cs \
JavaLanguageBinding.cs \
FormatingStrategy/JavaFormattingStrategy.cs \
-JavaBindingExecutionServices.cs \
ProjectTreeBuilder/JavaNodeBuilder.cs
TEMPLATES = \
Index: Core/src/AddIns/BackendBindings/JavaBinding/JavaBinding.addin.xml
===================================================================
--- Core/src/AddIns/BackendBindings/JavaBinding/JavaBinding.addin.xml (revision 2122)
+++ Core/src/AddIns/BackendBindings/JavaBinding/JavaBinding.addin.xml (working copy)
@@ -51,7 +51,7 @@
</Extension>
<Extension path = "/SharpDevelop/Workbench/ProjectOptions/ConfigurationProperties">
- <Conditional activeproject = "Java">
+ <Conditional activelanguage = "Java">
<DialogPanel id = "JavaProjectPanel"
_label = "Code Generation"
class = "JavaBinding.ProjectConfigurationPropertyPanel"/>
Index: Core/src/AddIns/BackendBindings/JavaBinding/ProjectTreeBuilder/JavaNodeBuilder.cs
===================================================================
--- Core/src/AddIns/BackendBindings/JavaBinding/ProjectTreeBuilder/JavaNodeBuilder.cs (revision 2122)
+++ Core/src/AddIns/BackendBindings/JavaBinding/ProjectTreeBuilder/JavaNodeBuilder.cs (working copy)
@@ -1,4 +1,4 @@
-// <file>
+// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
@@ -27,12 +27,12 @@
FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.GetService(typeof(FileUtilityService));
IconService iconService = (IconService)ServiceManager.GetService(typeof(IconService));
- public bool CanBuildProjectTree(IProject project)
+ public bool CanBuildProjectTree(Project project)
{
return project.ProjectType == JavaLanguageBinding.LanguageName;
}
- public AbstractBrowserNode BuildProjectTreeNode(IProject project)
+ public AbstractBrowserNode BuildProjectTreeNode(Project project)
{
ProjectBrowserNode projectNode = new ProjectBrowserNode(project);
Index: Core/src/MonoDevelop.Core/ChangeLog
===================================================================
--- Core/src/MonoDevelop.Core/ChangeLog (revision 2122)
+++ Core/src/MonoDevelop.Core/ChangeLog (working copy)
@@ -1,3 +1,7 @@
+2005-01-11 Lluis Sanchez Gual <lluis@novell.com>
+
+ * AddIn.xsd: Added new codon type, and new condition.
+
2004-08-07 Todd Berman <tberman@off.net>
* AssemblyInfo.cs.in: Use new ASSEMBLY_VERSION variable.
Index: Core/src/MonoDevelop.Core/AddIn.xsd
===================================================================
--- Core/src/MonoDevelop.Core/AddIn.xsd (revision 2122)
+++ Core/src/MonoDevelop.Core/AddIn.xsd (working copy)
@@ -35,6 +35,7 @@
<xs:element ref="EditAction"/>
<xs:element ref="DialogPanel"/>
<xs:element ref="LanguageBinding"/>
+ <xs:element ref="ProjectBinding"/>
<xs:element ref="Class"/>
<xs:element ref="MenuItem"/>
<xs:element ref="FileTemplate"/>
@@ -49,6 +50,7 @@
<xs:attribute name="openwindow" type="xs:string" use="optional"/>
<xs:attribute name="iscombineopen" type="xs:string" use="optional"/>
<xs:attribute name="activeproject" type="xs:string" use="optional"/>
+ <xs:attribute name="activelanguage" type="xs:string" use="optional"/>
<xs:attribute name="openproject" type="xs:string" use="optional"/>
<xs:attribute name="textcontent" type="xs:string" use="optional"/>
<xs:attribute name="ownerstate" type="xs:string" use="optional"/>
@@ -79,6 +81,7 @@
<xs:element ref="DialogPanel"/>
<xs:element ref="DisplayBinding"/>
<xs:element ref="LanguageBinding"/>
+ <xs:element ref="ProjectBinding"/>
<xs:element ref="MenuItem"/>
<xs:element ref="ToolbarItem"/>
</xs:choice>
@@ -190,6 +193,12 @@
</xs:complexContent>
</xs:complexType>
<xs:element name="LanguageBinding" type="LanguageBinding"/>
+ <xs:complexType name="ProjectBinding">
+ <xs:complexContent>
+ <xs:extension base="AbstractCodon" />
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:element name="ProjectBinding" type="ProjectBinding"/>
<xs:complexType name="MenuItem">
<xs:complexContent>
<xs:extension base="AbstractCodon">
--=-c4OOBNpqJQ5bgDrXCPw/--