Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
VioletGiraffe committed Feb 11, 2014
2 parents 29dc254 + f56e7b0 commit 46e9af2
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions CPPCheckPlugin/CPPCheckPluginPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ private void documentSaved(Document document)
try
{
dynamic project = document.ProjectItem.ContainingProject.Object;
if (!isVisualCppProject(project))
{
return;
}
var currentConfig = document.ProjectItem.ConfigurationManager.ActiveConfiguration;
SourceFile sourceForAnalysis = createSourceFile(document.FullName, currentConfig, project);
if (sourceForAnalysis == null)
Expand Down Expand Up @@ -115,9 +119,7 @@ private void checkCurrentProject()
foreach (dynamic o in activeProjects)
{
dynamic project = o.Object;
Type projectObjectType = project.GetType();
var projectInterface = projectObjectType.GetInterface("Microsoft.VisualStudio.VCProjectEngine.VCProject");
if (projectInterface == null)
if (!isVisualCppProject(project))
{
System.Windows.MessageBox.Show("Only C++ projects can be checked.");
return;
Expand Down Expand Up @@ -205,6 +207,13 @@ SourceFile createSourceFile(string filePath, Configuration targetConfig, dynamic
}
}

private static bool isVisualCppProject(object project)
{
Type projectObjectType = project.GetType();
var projectInterface = projectObjectType.GetInterface("Microsoft.VisualStudio.VCProjectEngine.VCProject");
return projectInterface != null;
}

private DTE _dte = null;
private DocumentEvents _eventsHandlers = null;
private List<ICodeAnalyzer> _analyzers = new List<ICodeAnalyzer>();
Expand Down

0 comments on commit 46e9af2

Please sign in to comment.