Browse Source

Path of the errors in files are now parsed correctly.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@10 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Mike Krüger 22 years ago
parent
commit
8690a09871
  1. 19
      AddIns/ICSharpCode.SharpDevelop.addin
  2. 2
      src/Main/Base/Project/Src/Commands/BuildCommands.cs
  3. 59
      src/Main/Base/Project/Src/Gui/Pads/CompilerMessageView/CompilerMessageView.cs
  4. 2
      src/Main/Base/Project/Src/Gui/Pads/CompilerMessageView/CompulerMessageViewToolbarCommands.cs
  5. 46
      src/Main/Base/Project/Src/Project/MSBuildProject.cs
  6. 13
      src/Main/Base/Project/Src/Services/Tasks/Task.cs
  7. 10
      src/Main/Core/Project/Src/AddInTree/AddIn/StandardErbauer/MenuItem/Gui/MenuCommand.cs

19
AddIns/ICSharpCode.SharpDevelop.addin

@ -512,6 +512,25 @@
tooltip = "Toggle Word Wrap" tooltip = "Toggle Word Wrap"
class = "ICSharpCode.SharpDevelop.Gui.ToggleeMessageViewWordWrap"/> class = "ICSharpCode.SharpDevelop.Gui.ToggleeMessageViewWordWrap"/>
</Path> </Path>
<Path name = "/SharpDevelop/Pads/CompilerMessageView/ContextMenu">
<MenuItem id = "Copy"
label = "${res:XML.MainMenu.EditMenu.Copy}"
icon = "Icons.16x16.CopyIcon"
type = "Item"
description = "${res:XML.MainMenu.EditMenu.Copy.Description}"
shortcut = "Control|C"
class = "ICSharpCode.SharpDevelop.Commands.Copy"/>
<MenuItem id = "SelectAll"
label = "${res:XML.MainMenu.EditMenu.SelectAll}"
description = "${res:XML.MainMenu.EditMenu.SelectAll.Description}"
type = "Item"
shortcut = "Control|A"
class = "ICSharpCode.SharpDevelop.Commands.SelectAll"/>
<MenuItem id = "Clear"
icon = "OutputPad.Toolbar.ClearOutputWindow"
label = "Clear All"
class = "ICSharpCode.SharpDevelop.Gui.ClearOutputWindow"/>
</Path>
<Path name = "/SharpDevelop/Pads/ErrorList/Toolbar"> <Path name = "/SharpDevelop/Pads/ErrorList/Toolbar">
<ToolbarItem id = "Errors" <ToolbarItem id = "Errors"

2
src/Main/Base/Project/Src/Commands/BuildCommands.cs

@ -87,7 +87,7 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
{ {
if (results != null) { if (results != null) {
foreach (CompilerError error in results.Errors) { foreach (CompilerError error in results.Errors) {
TaskService.Tasks.Add(new Task(ProjectService.CurrentProject, error)); TaskService.Tasks.Add(new Task(error));
} }
if (results.Errors.Count > 0) { if (results.Errors.Count > 0) {
WorkbenchSingleton.Workbench.GetPad(typeof(ErrorList)).BringPadToFront(); WorkbenchSingleton.Workbench.GetPad(typeof(ErrorList)).BringPadToFront();

59
src/Main/Base/Project/Src/Gui/Pads/CompilerMessageView/CompilerMessageView.cs

@ -25,7 +25,7 @@ namespace ICSharpCode.SharpDevelop.Gui
/// This class displays the errors and warnings which the compiler outputs and /// This class displays the errors and warnings which the compiler outputs and
/// allows the user to jump to the source of the warnig / error /// allows the user to jump to the source of the warnig / error
/// </summary> /// </summary>
public class CompilerMessageView : AbstractPadContent public class CompilerMessageView : AbstractPadContent, IClipboardHandler
{ {
static CompilerMessageView instance; static CompilerMessageView instance;
@ -95,7 +95,8 @@ namespace ICSharpCode.SharpDevelop.Gui
myPanel.SuspendLayout(); myPanel.SuspendLayout();
textEditorControl.Dock = DockStyle.Fill; textEditorControl.Dock = DockStyle.Fill;
textEditorControl.ReadOnly = true; textEditorControl.ReadOnly = true;
textEditorControl.ContextMenuStrip = MenuService.CreateContextMenu(this, "/SharpDevelop/Pads/CompilerMessageView/ContextMenu");
properties = (Properties)PropertyService.Get(OutputWindowOptionsPanel.OutputWindowsProperty, new Properties()); properties = (Properties)PropertyService.Get(OutputWindowOptionsPanel.OutputWindowsProperty, new Properties());
textEditorControl.Font = FontSelectionPanel.ParseFont(properties.Get("DefaultFont", new Font("Courier New", 10).ToString()).ToString()); textEditorControl.Font = FontSelectionPanel.ParseFont(properties.Get("DefaultFont", new Font("Courier New", 10).ToString()).ToString());
@ -340,5 +341,59 @@ namespace ICSharpCode.SharpDevelop.Gui
public event EventHandler MessageCategoryAdded; public event EventHandler MessageCategoryAdded;
public event EventHandler SelectedCategoryIndexChanged; public event EventHandler SelectedCategoryIndexChanged;
#region ICSharpCode.SharpDevelop.Gui.IClipboardHandler interface implementation
public bool EnableCut {
get {
return false;
}
}
public bool EnableCopy {
get {
return true;
}
}
public bool EnablePaste {
get {
return false;
}
}
public bool EnableDelete {
get {
return false;
}
}
public bool EnableSelectAll {
get {
return true;
}
}
public void Cut()
{
}
public void Copy()
{
textEditorControl.Copy();
}
public void Paste()
{
}
public void Delete()
{
}
public void SelectAll()
{
textEditorControl.SelectAll();
}
#endregion
} }
} }

2
src/Main/Base/Project/Src/Gui/Pads/CompilerMessageView/CompulerMessageViewToolbarCommands.cs

@ -62,7 +62,7 @@ namespace ICSharpCode.SharpDevelop.Gui
} }
} }
public class ClearOutputWindow : AbstractComboBoxCommand public class ClearOutputWindow : AbstractCommand
{ {
public override void Run() public override void Run()
{ {

46
src/Main/Base/Project/Src/Project/MSBuildProject.cs

@ -264,9 +264,12 @@ namespace ICSharpCode.SharpDevelop.Project
// isDirty = TaskService.Errors != 0; // isDirty = TaskService.Errors != 0;
// } // }
// //
readonly static Regex normalError = new Regex(@"^(?<file>\S.*)\((?<line>\d+),(?<column>\d+)\):\s+(?<error>\w+)\s+(?<number>[\d\w]+):\s+(?<message>.*)$", RegexOptions.Compiled); readonly static Regex normalError = new Regex(@"(?<file>\S.*)\((?<line>\d+),(?<column>\d+)\):\s+(?<error>\w+)\s+(?<number>[\d\w]+):\s+(?<message>.*)", RegexOptions.Compiled);
readonly static Regex generalError = new Regex(@"^(?<error>\S.+)\s+(?<number>[\d\w]+):\s+(?<message>.*)$", RegexOptions.Compiled); readonly static Regex compilerError = new Regex(@"(?<who>[^:]*):\s+(?<error>\w+)\s+(?<number>[\d\w]+):\s+(?<message>.*)", RegexOptions.Compiled);
readonly static Regex projectName = new Regex(@"^Project\s+\""(?<name>[^""]*)\""", RegexOptions.Compiled); readonly static Regex generalError = new Regex(@"(?<error>\S.+)\s+(?<number>[\d\w]+):\s+(?<message>.*)", RegexOptions.Compiled);
readonly static Regex projectName = new Regex(@"Project\s+\""[^""]*\""[^""]*\""(?<name>[^""]*)\""", RegexOptions.Compiled);
static CompilerError GetCompilerError(string line, string workingPath) static CompilerError GetCompilerError(string line, string workingPath)
{ {
@ -281,6 +284,14 @@ namespace ICSharpCode.SharpDevelop.Project
error.ErrorText = match.Result("${message}"); error.ErrorText = match.Result("${message}");
return error; return error;
} }
match = compilerError.Match(line);
if (match.Success) {
CompilerError error = new CompilerError();
error.IsWarning = match.Result("${error}") == "warning";
error.ErrorNumber = match.Result("${number}");
error.ErrorText = match.Result("${who}") + ":" + match.Result("${message}");
return error;
}
match = generalError.Match(line); match = generalError.Match(line);
if (match.Success) { if (match.Success) {
@ -292,7 +303,7 @@ namespace ICSharpCode.SharpDevelop.Project
} }
return null; return null;
} }
public static CompilerResults RunMSBuild(string fileName, string target) public static CompilerResults RunMSBuild(string fileName, string target)
{ {
WorkbenchSingleton.Workbench.GetPad(typeof(CompilerMessageView)).BringPadToFront(); WorkbenchSingleton.Workbench.GetPad(typeof(CompilerMessageView)).BringPadToFront();
@ -317,11 +328,9 @@ namespace ICSharpCode.SharpDevelop.Project
string line = reader.ReadLine(); string line = reader.ReadLine();
if (line != null) { if (line != null) {
TaskService.BuildMessageViewCategory.AppendText(line + Environment.NewLine); TaskService.BuildMessageViewCategory.AppendText(line + Environment.NewLine);
Match match = projectName.Match(line); Match match = projectName.Match(line);
if (match.Success) { if (match.Success) {
string name = match.Result("${name}"); string name = match.Result("${name}");
if (name != null) { if (name != null) {
workingDirectory = Path.GetDirectoryName(name); workingDirectory = Path.GetDirectoryName(name);
} }
@ -330,12 +339,33 @@ namespace ICSharpCode.SharpDevelop.Project
if (error != null) { if (error != null) {
results.Errors.Add(error); results.Errors.Add(error);
} }
} }
results.Output.Add(line); results.Output.Add(line);
} }
System.Windows.Forms.Application.DoEvents(); System.Windows.Forms.Application.DoEvents();
} }
TaskService.BuildMessageViewCategory.AppendText(reader.ReadToEnd() + Environment.NewLine); while (true) {
string line = reader.ReadLine();
if (line == null) {
break;
}
TaskService.BuildMessageViewCategory.AppendText(line + Environment.NewLine);
Console.WriteLine(line);
Match match = projectName.Match(line);
if (match.Success) {
string name = match.Result("${name}");
if (name != null) {
workingDirectory = Path.GetDirectoryName(name);
}
} else {
CompilerError error = GetCompilerError(line, workingDirectory);
if (error != null) {
results.Errors.Add(error);
}
}
results.Output.Add(line);
}
// TaskService.BuildMessageViewCategory.AppendText(reader.ReadToEnd() + Environment.NewLine);
p.WaitForExit(); p.WaitForExit();
// AfterBuild(); // AfterBuild();
return results; return results;

13
src/Main/Base/Project/Src/Services/Tasks/Task.cs

@ -89,19 +89,6 @@ namespace ICSharpCode.Core
this.line = line; this.line = line;
} }
public Task(IProject project, CompilerError error)
{
this.project = project;
type = error.IsWarning ? TaskType.Warning : TaskType.Error;
column = error.Column - 1;
line = error.Line - 1;
description = error.ErrorText + "(" + error.ErrorNumber + ")";
if (!Path.IsPathRooted(error.FileName)) {
fileName = Path.Combine(project.Directory, error.FileName);
} else {
fileName = error.FileName;
}
}
public Task(CompilerError error) public Task(CompilerError error)
{ {
type = error.IsWarning ? TaskType.Warning : TaskType.Error; type = error.IsWarning ? TaskType.Warning : TaskType.Error;

10
src/Main/Core/Project/Src/AddInTree/AddIn/StandardErbauer/MenuItem/Gui/MenuCommand.cs

@ -18,7 +18,7 @@ namespace ICSharpCode.Core
{ {
object caller; object caller;
Codon codon; Codon codon;
IMenuCommand menuCommand = null; ICommand menuCommand = null;
string description = ""; string description = "";
string localizedText = null; string localizedText = null;
@ -31,7 +31,7 @@ namespace ICSharpCode.Core
} }
} }
public IMenuCommand Command { public ICommand Command {
get { get {
if (menuCommand == null) { if (menuCommand == null) {
CreateCommand(); CreateCommand();
@ -43,7 +43,7 @@ namespace ICSharpCode.Core
void CreateCommand() void CreateCommand()
{ {
try { try {
menuCommand = (IMenuCommand)codon.AddIn.CreateObject(codon.Properties["class"]); menuCommand = (ICommand)codon.AddIn.CreateObject(codon.Properties["class"]);
} catch (Exception e) { } catch (Exception e) {
MessageService.ShowError(e, "Can't create menu command : " + codon.ID); MessageService.ShowError(e, "Can't create menu command : " + codon.ID);
} }
@ -113,8 +113,8 @@ namespace ICSharpCode.Core
ConditionFailedAction failedAction = codon.GetFailedAction(caller); ConditionFailedAction failedAction = codon.GetFailedAction(caller);
bool isEnabled = failedAction != ConditionFailedAction.Disable; bool isEnabled = failedAction != ConditionFailedAction.Disable;
if (menuCommand != null) { if (menuCommand != null && menuCommand is IMenuCommand) {
isEnabled &= menuCommand.IsEnabled; isEnabled &= ((IMenuCommand)menuCommand).IsEnabled;
} }
return isEnabled; return isEnabled;
} }

Loading…
Cancel
Save