Browse Source

NavigationService now suspends logging while a solution is being loaded and resumes when ParserService.LoadSolutionProjectsThreadEnded fires. It also suspends logging while the workbench is starting up.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2550 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Alpert 18 years ago
parent
commit
72ff842625
  1. 5
      src/Main/Base/Project/Src/Commands/AutostartCommands.cs
  2. 27
      src/Main/Base/Project/Src/Services/NavigationService/NavigationService.cs
  3. 10
      src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs

5
src/Main/Base/Project/Src/Commands/AutostartCommands.cs

@ -80,6 +80,8 @@ namespace ICSharpCode.SharpDevelop.Commands
//WorkbenchSingleton.MainForm.Show(); //WorkbenchSingleton.MainForm.Show();
bool didLoadCombineOrFile = false; bool didLoadCombineOrFile = false;
NavigationService.SuspendLogging();
foreach (string file in fileList) { foreach (string file in fileList) {
didLoadCombineOrFile = true; didLoadCombineOrFile = true;
@ -109,6 +111,8 @@ namespace ICSharpCode.SharpDevelop.Commands
} }
} }
NavigationService.ResumeLogging();
//WorkbenchSingleton.MainForm.Focus(); // windows.forms focus workaround //WorkbenchSingleton.MainForm.Focus(); // windows.forms focus workaround
ParserService.StartParserThread(); ParserService.StartParserThread();
@ -126,3 +130,4 @@ namespace ICSharpCode.SharpDevelop.Commands
} }
} }
} }

27
src/Main/Base/Project/Src/Services/NavigationService/NavigationService.cs

@ -59,7 +59,7 @@ namespace ICSharpCode.SharpDevelop
/// <summary> /// <summary>
/// Initializes the NavigationService. /// Initializes the NavigationService.
/// </summary> /// </summary>
/// <remarks>Must be called after the Workbench has been initialized.</remarks> /// <remarks>Must be called after the Workbench has been initialized and after the ProjectService has been initialized.</remarks>
/// <exception cref="InvalidOperationException">The <see cref="WorkbenchSingleton"/> has not yet been initialized and <see cref="WorkbenchSingleton.Workbench">Workbench</see> is <value>null</value></exception> /// <exception cref="InvalidOperationException">The <see cref="WorkbenchSingleton"/> has not yet been initialized and <see cref="WorkbenchSingleton.Workbench">Workbench</see> is <value>null</value></exception>
public static void InitializeService() public static void InitializeService()
{ {
@ -70,6 +70,10 @@ namespace ICSharpCode.SharpDevelop
// trap changes in the secondary tab via the workbench's ActiveViewContentChanged event // trap changes in the secondary tab via the workbench's ActiveViewContentChanged event
WorkbenchSingleton.Workbench.ActiveViewContentChanged += ActiveViewContentChanged; WorkbenchSingleton.Workbench.ActiveViewContentChanged += ActiveViewContentChanged;
// ignore files opened as part of loading a solution.
ProjectService.SolutionLoading += ProjectService_SolutionLoading;
ParserService.LoadSolutionProjectsThreadEnded += LoadSolutionProjectsThreadEnded;
FileService.FileRenamed += FileService_FileRenamed; FileService.FileRenamed += FileService_FileRenamed;
ProjectService.SolutionClosed += ProjectService_SolutionClosed; ProjectService.SolutionClosed += ProjectService_SolutionClosed;
serviceInitialized = true; serviceInitialized = true;
@ -348,7 +352,7 @@ namespace ICSharpCode.SharpDevelop
/// </summary> /// </summary>
public static void SuspendLogging() public static void SuspendLogging()
{ {
LoggingService.Info("NavigationSercice -- suspend logging"); LoggingService.Debug("NavigationService -- suspend logging");
loggingSuspended = true; loggingSuspended = true;
} }
@ -368,6 +372,24 @@ namespace ICSharpCode.SharpDevelop
// how to test code triggered by the user interacting with the workbench // how to test code triggered by the user interacting with the workbench
#region event trapping #region event trapping
/// <summary>
/// Prepares the NavigationService to load a new solution.
/// </summary>
/// <param name="sender">The fileName of the solution as a <see cref="String"/>.</param>
static void ProjectService_SolutionLoading(object sender, EventArgs e)
{
SuspendLogging();
}
/// <summary>
/// Prepares the NavigationService for working with a newly loaded solution
/// </summary>
/// <param name="sender"></param>
static void LoadSolutionProjectsThreadEnded(object sender, EventArgs e)
{
ResumeLogging();
}
/// <summary> /// <summary>
/// Respond to changes in the <see cref="IWorkbench.ActiveViewContent"> /// Respond to changes in the <see cref="IWorkbench.ActiveViewContent">
/// ActiveViewContent</see> by logging the new <see cref="IViewContent"/>. /// ActiveViewContent</see> by logging the new <see cref="IViewContent"/>.
@ -429,3 +451,4 @@ namespace ICSharpCode.SharpDevelop

10
src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs

@ -245,6 +245,7 @@ namespace ICSharpCode.SharpDevelop.Project
public static void LoadSolution(string fileName) public static void LoadSolution(string fileName)
{ {
BeforeLoadSolution(); BeforeLoadSolution();
OnSolutionLoading(fileName);
try { try {
openSolution = Solution.Load(fileName); openSolution = Solution.Load(fileName);
if (openSolution == null) if (openSolution == null)
@ -492,6 +493,13 @@ namespace ICSharpCode.SharpDevelop.Project
} }
} }
static void OnSolutionLoading(string fileName)
{
if (SolutionLoading != null) {
SolutionLoading(fileName, EventArgs.Empty);
}
}
static void OnSolutionLoaded(SolutionEventArgs e) static void OnSolutionLoaded(SolutionEventArgs e)
{ {
if (SolutionLoaded != null) { if (SolutionLoaded != null) {
@ -593,6 +601,7 @@ namespace ICSharpCode.SharpDevelop.Project
public static event ProjectConfigurationEventHandler ProjectConfigurationChanged; public static event ProjectConfigurationEventHandler ProjectConfigurationChanged;
public static event SolutionConfigurationEventHandler SolutionConfigurationChanged; public static event SolutionConfigurationEventHandler SolutionConfigurationChanged;
public static event EventHandler SolutionLoading;
public static event EventHandler<SolutionEventArgs> SolutionLoaded; public static event EventHandler<SolutionEventArgs> SolutionLoaded;
public static event EventHandler<SolutionEventArgs> SolutionSaved; public static event EventHandler<SolutionEventArgs> SolutionSaved;
@ -611,3 +620,4 @@ namespace ICSharpCode.SharpDevelop.Project
public static event EventHandler<ProjectItemEventArgs> ProjectItemRemoved; public static event EventHandler<ProjectItemEventArgs> ProjectItemRemoved;
} }
} }

Loading…
Cancel
Save