Author: mkrueger
Date: 2007-05-23 11:18:43 -0400 (Wed, 23 May 2007)
New Revision: 77841
Added:
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/BeforeCompileAction.cs
Modified:
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/Makefile.am
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Search/SearchProgressMonitor.cs
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui/OutputProgressMonitor.cs
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ProgressMonitors.cs
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/ProjectService.cs
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.mdp
Log:
fixed bug in pads.
Modified: branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/Makefile.am
===================================================================
--- branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/Makefile.am
2007-05-23 14:48:23 UTC (rev 77840)
+++ branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/Makefile.am
2007-05-23 15:18:43 UTC (rev 77841)
@@ -282,6 +282,7 @@
MonoDevelop.Ide.Projects/AbstractBackendBinding.cs \
MonoDevelop.Ide.Projects/BackendBindingCodon.cs \
MonoDevelop.Ide.Projects/BackendBindingService.cs \
+ MonoDevelop.Ide.Projects/BeforeCompileAction.cs \
MonoDevelop.Ide.Projects/CompilerResult.cs \
MonoDevelop.Ide.Projects/ExecutionContext.cs \
MonoDevelop.Ide.Projects/IBackendBinding.cs \
Modified:
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui/OutputProgressMonitor.cs
===================================================================
---
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui/OutputProgressMonitor.cs
2007-05-23 14:48:23 UTC (rev 77840)
+++
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui/OutputProgressMonitor.cs
2007-05-23 15:18:43 UTC (rev 77841)
@@ -75,7 +75,6 @@
outputPad.EndProgress ();
base.OnCompleted ();
- IdeApp.Workbench.ProgressMonitors.ReleasePad
(outputPad);
outputPad = null;
}
Modified:
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ProgressMonitors.cs
===================================================================
---
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ProgressMonitors.cs
2007-05-23 14:48:23 UTC (rev 77840)
+++
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ProgressMonitors.cs
2007-05-23 15:18:43 UTC (rev 77841)
@@ -105,9 +105,10 @@
// Look for an available pad
for (int n=0; n<outputMonitors.Count;
n++) {
Pad mpad = (Pad) outputMonitors
[n];
+ Console.WriteLine (mpad.Title +
" == " + title);
if (mpad.Title == title) {
pad = mpad;
- outputMonitors.RemoveAt
(n);
+// outputMonitors.RemoveAt
(n);
break;
}
}
@@ -123,16 +124,9 @@
monitorPad.Id = "OutputPad" + monitorId;
pad = IdeApp.Workbench.ShowPad (monitorPad, title,
"Bottom", icon);
if (bringToFront) pad.BringToFront ();
-
+ outputMonitors.Add (pad);
return new OutputProgressMonitor (monitorPad, title,
icon);
}
-
- internal void ReleasePad (DefaultMonitorPad pad)
- {
- lock (outputMonitors) {
- outputMonitors.Add (IdeApp.Workbench.FindPad
(pad));
- }
- }
public ISearchProgressMonitor GetSearchProgressMonitor (bool
bringToFront)
{
@@ -145,7 +139,7 @@
Pad mpad = (Pad) searchMonitors [n];
if
(((SearchResultPad)mpad.Content).AllowReuse) {
pad = mpad;
- searchMonitors.RemoveAt (n);
+// searchMonitors.RemoveAt (n);
break;
}
}
@@ -159,15 +153,11 @@
monitorPad.Id = "SearchPad" + (monitorId++);
pad = IdeApp.Workbench.ShowPad (monitorPad,
GettextCatalog.GetString ("Search Results"), "Bottom",
MonoDevelop.Core.Gui.Stock.FindIcon);
if (bringToFront) pad.BringToFront ();
+
+ searchMonitors.Add (pad);
return new SearchProgressMonitor (monitorPad, title);
}
- internal void ReleasePad (SearchResultPad pad)
- {
- lock (searchMonitors) {
- searchMonitors.Add (IdeApp.Workbench.FindPad
(pad));
- }
- }
}
}
Modified:
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Search/SearchProgressMonitor.cs
===================================================================
---
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Search/SearchProgressMonitor.cs
2007-05-23 14:48:23 UTC (rev 77840)
+++
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Search/SearchProgressMonitor.cs
2007-05-23 15:18:43 UTC (rev 77841)
@@ -95,7 +95,6 @@
outputPad.EndProgress ();
base.OnCompleted ();
- IdeApp.Workbench.ProgressMonitors.ReleasePad
(outputPad);
outputPad = null;
}
Added:
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/BeforeCompileAction.cs
===================================================================
---
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/BeforeCompileAction.cs
2007-05-23 14:48:23 UTC (rev 77840)
+++
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/BeforeCompileAction.cs
2007-05-23 15:18:43 UTC (rev 77841)
@@ -0,0 +1,38 @@
+//
+// BeforeCompileAction.cs
+//
+// Author:
+// Mike Krüger <[EMAIL PROTECTED]>
+//
+// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace MonoDevelop.Ide.Projects
+{
+ public enum BeforeCompileAction {
+ Nothing,
+ SaveAllFiles,
+ PromptForSave
+ }
+}
Modified:
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/ProjectService.cs
===================================================================
---
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/ProjectService.cs
2007-05-23 14:48:23 UTC (rev 77840)
+++
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/ProjectService.cs
2007-05-23 15:18:43 UTC (rev 77841)
@@ -95,20 +95,6 @@
set { currentBuildOperation = value; }
}
- public static IAsyncOperation BuildSolution ()
- {
- if (currentBuildOperation != null &&
!currentBuildOperation.IsCompleted) {
- return currentBuildOperation;
- }
- IProgressMonitor monitor =
IdeApp.Workbench.ProgressMonitors.GetBuildProgressMonitor ();
- ExecutionContext context = new ExecutionContext (new
DefaultExecutionHandlerFactory (), IdeApp.Workbench.ProgressMonitors);
- monitor.BeginTask (GettextCatalog.GetString ("Build
Solution {0}", Solution.Name), Solution.Items.Count);
- Services.DispatchService.ThreadDispatch (new
StatefulMessageHandler (BuildSolutionAsync), new object[] {Solution, monitor,
context});
- currentBuildOperation = monitor.AsyncOperation;
- return currentBuildOperation;
- }
-
-
static IBackendBinding GetBackendBinding (SolutionProject
project, IProgressMonitor monitor)
{
IBackendBinding result =
BackendBindingService.GetBackendBinding (project);
@@ -123,6 +109,54 @@
return result;
}
+ static List<string> dirtyFiles = new List<string> ();
+ static void MarkFileDirty (string fileName)
+ {
+ if (!dirtyFiles.Contains (fileName))
+ dirtyFiles.Add (fileName);
+ }
+
+ static void HandleBeforeCompileAction ()
+ {
+ Services.TaskService.ClearExceptCommentTasks ();
+
+ switch
((BeforeCompileAction)Runtime.Properties.GetProperty("SharpDevelop.Services.DefaultParserService.BeforeCompileAction",
BeforeCompileAction.SaveAllFiles)) {
+ case BeforeCompileAction.Nothing:
+ break;
+ case BeforeCompileAction.PromptForSave:
+ foreach (Document document in
IdeApp.Workbench.Documents) {
+ if (document.IsDirty) {
+ if
(Services.MessageService.AskQuestion(GettextCatalog.GetString ("Save changed
files?"))) {
+ MarkFileDirty
(document.FileName);
+ document.Save
();
+ } else
+ break;
+ }
+ }
+ break;
+ case BeforeCompileAction.SaveAllFiles:
+ IdeApp.Workbench.SaveAll ();
+ break;
+ default:
+ System.Diagnostics.Debug.Assert(false);
+ break;
+ }
+ }
+
+ public static IAsyncOperation BuildSolution ()
+ {
+ if (currentBuildOperation != null &&
!currentBuildOperation.IsCompleted) {
+ return currentBuildOperation;
+ }
+ HandleBeforeCompileAction ();
+ IProgressMonitor monitor =
IdeApp.Workbench.ProgressMonitors.GetBuildProgressMonitor ();
+ ExecutionContext context = new ExecutionContext (new
DefaultExecutionHandlerFactory (), IdeApp.Workbench.ProgressMonitors);
+ monitor.BeginTask (GettextCatalog.GetString ("Build
Solution {0}", Solution.Name), Solution.Items.Count);
+ Services.DispatchService.ThreadDispatch (new
StatefulMessageHandler (BuildSolutionAsync), new object[] {Solution, monitor,
context});
+ currentBuildOperation = monitor.AsyncOperation;
+ return currentBuildOperation;
+ }
+
static void BuildSolutionAsync (object data)
{
object[] array = (object[])data;
@@ -131,7 +165,7 @@
return;
IProgressMonitor monitor = array[1] as IProgressMonitor;
ExecutionContext context = array[2] as ExecutionContext;
-
+
List<CompilerResult> results = new List<CompilerResult>
();
for (int i = 0; i < solution.Items.Count; ++i) {
SolutionProject project = solution.Items[i] as
SolutionProject;
@@ -170,6 +204,7 @@
BuildDone (monitor, results);
});
monitor.Dispose ();
+ dirtyFiles.Clear ();
}
public static IAsyncOperation RebuildSolution ()
@@ -194,6 +229,7 @@
currentBuildOperation = monitor.AsyncOperation;
return currentRunOperation;
}
+
static void CleanSolutionAsync (object data)
{
object[] array = (object[])data;
@@ -221,7 +257,8 @@
if (currentBuildOperation != null &&
!currentBuildOperation.IsCompleted) {
return currentBuildOperation;
}
- IProgressMonitor monitor = new
MessageDialogProgressMonitor ();
+ HandleBeforeCompileAction ();
+ IProgressMonitor monitor =
IdeApp.Workbench.ProgressMonitors.GetBuildProgressMonitor ();
ExecutionContext context = new ExecutionContext (new
DefaultExecutionHandlerFactory (), IdeApp.Workbench.ProgressMonitors);
Services.DispatchService.ThreadDispatch (new
StatefulMessageHandler (BuildSolutionAsync), new object[] {project, monitor,
context});
@@ -235,6 +272,7 @@
SolutionProject project = array[0] as SolutionProject;
if (project == null)
return;
+
IProgressMonitor monitor = array[1] as IProgressMonitor;
ExecutionContext context = array[2] as ExecutionContext;
List<CompilerResult> results = new List<CompilerResult>
();
@@ -270,6 +308,7 @@
BuildDone (monitor, results);
});
monitor.Dispose ();
+ dirtyFiles.Clear ();
}
public static IAsyncOperation RebuildProject (SolutionProject
project)
Modified:
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.mdp
===================================================================
--- branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.mdp
2007-05-23 14:48:23 UTC (rev 77840)
+++ branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.mdp
2007-05-23 15:18:43 UTC (rev 77841)
@@ -330,6 +330,7 @@
<File
name="./MonoDevelop.Ide.Gui.Pads.SolutionPad/ReferenceFolderNodeBuilder.cs"
subtype="Code" buildaction="Compile" />
<File name="./MonoDevelop.Ide.Gui.Pads.SolutionPad/ReferenceFolderNode.cs"
subtype="Code" buildaction="Compile" />
<File
name="./MonoDevelop.Ide.Gui.Pads.SolutionPad/ReferenceProjectItemNodeBuilder.cs"
subtype="Code" buildaction="Compile" />
+ <File name="./MonoDevelop.Ide.Projects/BeforeCompileAction.cs"
subtype="Code" buildaction="Compile" />
</Contents>
<References>
<ProjectReference type="Gac" localcopy="False" refto="gecko-sharp,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=ccf7d78a55e9f021" />
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches