Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Better errors handling #1

Merged
merged 2 commits into from
May 12, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions ColtPlugin/ColtPlugin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\..\FlashDevelop\Bin\Debug\Plugins\</OutputPath>
<OutputPath>..\..\svn\FlashDevelop\Bin\Debug\Plugins\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
Expand Down Expand Up @@ -87,17 +87,6 @@
<Compile Include="Resources\LocaleHelper.cs" />
<Compile Include="Settings.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\PluginCore\PluginCore.csproj">
<Project>{61885F70-B4DC-4B44-852D-5D6D03F2A734}</Project>
<Name>PluginCore</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\ProjectManager\ProjectManager.csproj">
<Project>{E57AC379-B0A0-4D6F-BFB2-88639B280205}</Project>
<Name>ProjectManager</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\en_US.resX">
<SubType>Designer</SubType>
Expand Down Expand Up @@ -128,4 +117,14 @@
<ItemGroup>
<EmbeddedResource Include="Resources\colt.png" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\svn\External\Plugins\ProjectManager\ProjectManager.csproj">
<Project>{78101C01-E186-4954-B1DD-DEBB7905FAD8}</Project>
<Name>ProjectManager</Name>
</ProjectReference>
<ProjectReference Include="..\..\svn\PluginCore\PluginCore.csproj">
<Project>{61885F70-B4DC-4B44-852D-5D6D03F2A734}</Project>
<Name>PluginCore</Name>
</ProjectReference>
</ItemGroup>
</Project>
37 changes: 20 additions & 17 deletions ColtPlugin/ColtPlugin.sln
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual C# Express 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlashDevelop", "..\..\..\FlashDevelop\FlashDevelop.csproj", "{EFD07485-9A64-4EEC-94E7-ACBD4DA5CA93}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PluginCore", "..\..\..\PluginCore\PluginCore.csproj", "{61885F70-B4DC-4B44-852D-5D6D03F2A734}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ColtPlugin", "ColtPlugin.csproj", "{78101C02-E186-4954-B1DD-DEBB7905FAD8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectManager", "..\ProjectManager\ProjectManager.csproj", "{E57AC379-B0A0-4D6F-BFB2-88639B280205}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PluginCore", "..\..\svn\PluginCore\PluginCore.csproj", "{61885F70-B4DC-4B44-852D-5D6D03F2A734}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectManager", "..\..\svn\External\Plugins\ProjectManager\ProjectManager.csproj", "{78101C01-E186-4954-B1DD-DEBB7905FAD8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -17,22 +15,27 @@ Global
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EFD07485-9A64-4EEC-94E7-ACBD4DA5CA93}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EFD07485-9A64-4EEC-94E7-ACBD4DA5CA93}.Debug|x86.ActiveCfg = Debug|x86
{EFD07485-9A64-4EEC-94E7-ACBD4DA5CA93}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EFD07485-9A64-4EEC-94E7-ACBD4DA5CA93}.Release|x86.ActiveCfg = Release|x86
{61885F70-B4DC-4B44-852D-5D6D03F2A734}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{61885F70-B4DC-4B44-852D-5D6D03F2A734}.Debug|x86.ActiveCfg = Debug|x86
{61885F70-B4DC-4B44-852D-5D6D03F2A734}.Release|Any CPU.ActiveCfg = Release|Any CPU
{61885F70-B4DC-4B44-852D-5D6D03F2A734}.Release|x86.ActiveCfg = Release|x86
{78101C02-E186-4954-B1DD-DEBB7905FAD8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{78101C02-E186-4954-B1DD-DEBB7905FAD8}.Debug|x86.ActiveCfg = Debug|x86
{78101C02-E186-4954-B1DD-DEBB7905FAD8}.Debug|x86.Build.0 = Debug|x86
{78101C02-E186-4954-B1DD-DEBB7905FAD8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{78101C02-E186-4954-B1DD-DEBB7905FAD8}.Release|x86.ActiveCfg = Release|x86
{E57AC379-B0A0-4D6F-BFB2-88639B280205}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E57AC379-B0A0-4D6F-BFB2-88639B280205}.Debug|x86.ActiveCfg = Debug|x86
{E57AC379-B0A0-4D6F-BFB2-88639B280205}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E57AC379-B0A0-4D6F-BFB2-88639B280205}.Release|x86.ActiveCfg = Release|x86
{61885F70-B4DC-4B44-852D-5D6D03F2A734}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{61885F70-B4DC-4B44-852D-5D6D03F2A734}.Debug|Any CPU.Build.0 = Debug|Any CPU
{61885F70-B4DC-4B44-852D-5D6D03F2A734}.Debug|x86.ActiveCfg = Debug|x86
{61885F70-B4DC-4B44-852D-5D6D03F2A734}.Debug|x86.Build.0 = Debug|x86
{61885F70-B4DC-4B44-852D-5D6D03F2A734}.Release|Any CPU.ActiveCfg = Release|Any CPU
{61885F70-B4DC-4B44-852D-5D6D03F2A734}.Release|Any CPU.Build.0 = Release|Any CPU
{61885F70-B4DC-4B44-852D-5D6D03F2A734}.Release|x86.ActiveCfg = Release|x86
{61885F70-B4DC-4B44-852D-5D6D03F2A734}.Release|x86.Build.0 = Release|x86
{78101C01-E186-4954-B1DD-DEBB7905FAD8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{78101C01-E186-4954-B1DD-DEBB7905FAD8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{78101C01-E186-4954-B1DD-DEBB7905FAD8}.Debug|x86.ActiveCfg = Debug|x86
{78101C01-E186-4954-B1DD-DEBB7905FAD8}.Debug|x86.Build.0 = Debug|x86
{78101C01-E186-4954-B1DD-DEBB7905FAD8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{78101C01-E186-4954-B1DD-DEBB7905FAD8}.Release|Any CPU.Build.0 = Release|Any CPU
{78101C01-E186-4954-B1DD-DEBB7905FAD8}.Release|x86.ActiveCfg = Release|x86
{78101C01-E186-4954-B1DD-DEBB7905FAD8}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
35 changes: 28 additions & 7 deletions ColtPlugin/PluginMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,11 @@ public void HandleEvent(Object sender, NotifyEvent e, HandlingPriority prority)
Object toolStrip = (e as DataEvent).Data;
CreateToolbarButton(toolStrip as ToolStrip);
}
break;
break;

case EventType.FileSave:
if (active) ClearErrors();
break;
}
}

Expand Down Expand Up @@ -196,7 +200,7 @@ public void InitLocalization()
/// </summary>
public void AddEventHandlers()
{
EventManager.AddEventHandler(this, EventType.Command);
EventManager.AddEventHandler(this, EventType.Command | EventType.FileSave);

watcher = new FileSystemWatcher();
watcher.NotifyFilter = NotifyFilters.LastWrite;
Expand Down Expand Up @@ -273,11 +277,10 @@ private void OnFileChange(Object sender, FileSystemEventArgs e)
{
if (e.FullPath.EndsWith("compile_errors.log"))
{
// [09.05.2013 16:47:46] Philippe Elsass: the problem is that the event may happen before you are allowed to read the file
// [09.05.2013 16:48:03] Philippe Elsass: that's why the FlashErrorWatcher uses a Timer to wait a bit before reading the file
if (timer == null)
{
timer = new System.Timers.Timer();
timer.SynchronizingObject = (Form)PluginBase.MainForm; // thread safe
timer.Interval = 200;
timer.Elapsed += OnTimerElapsed;
timer.Enabled = true;
Expand All @@ -291,6 +294,8 @@ private void OnTimerElapsed(object sender, EventArgs e)
timer.Stop();
timer = null;

ClearErrors();

String message = File.ReadAllText(pathToLog);

// COLT copies sources to "incremental" folder, so let's try to find correct path and patch the output
Expand All @@ -299,6 +304,7 @@ private void OnTimerElapsed(object sender, EventArgs e)

// [09.05.2013 17:26:54] Philippe Elsass: make sure you send the log line by line to the Output
String[] messageLines = message.Split(new Char[] {'\r', '\n'});
bool hasErrors = false;
foreach (String line in messageLines) if (line.Length > 0)
{
// [08.05.2013 18:04:15] Philippe Elsass: you can also specify '-3' as 2nd parameter to the traces (error level)
Expand All @@ -315,16 +321,31 @@ private void OnTimerElapsed(object sender, EventArgs e)
{
if (File.Exists(PluginBase.CurrentProject.GetAbsolutePath(Path.Combine(sources[i], file))))
{
TraceManager.AddAsync(line.Replace(incremental, sources[i]), -3); break;
TraceManager.Add(line.Replace(incremental, sources[i]), -3);
hasErrors = true;
break;
}
}
}
else
{
// send as is
TraceManager.AddAsync(line, -3);
TraceManager.Add(line, -3);
}
}

if (hasErrors) ShowErrors();
}

private void ClearErrors()
{
EventManager.DispatchEvent(this, new DataEvent(EventType.Command, "ResultsPanel.ClearResults", null));
}

private void ShowErrors()
{
// should be an option: if the panel was hidden it captures keyboard focus
//EventManager.DispatchEvent(this, new DataEvent(EventType.Command, "ResultsPanel.ShowResults", null));
}

#endregion
Expand All @@ -346,7 +367,7 @@ private void OpenInCOLT()

if (!File.Exists(project.GetAbsolutePath(configFile)))
{
TraceManager.AddAsync("Required file (" + projectName + "Config.xml) does not exist, project must be built first...", -1);
TraceManager.Add("Required file (" + projectName + "Config.xml) does not exist, project must be built first...", -1);

EventManager.DispatchEvent(this, new DataEvent(EventType.Command, "ProjectManager.BuildProject", null));

Expand Down
Binary file modified ColtPlugin/obj/Debug/ColtPlugin.dll
Binary file not shown.