@@ -254,26 +254,23 @@ public void refreshChangeEditorPart(IEditorPart partRef) {
254254 activeEditorPart = partRef ;
255255 IFile file = ((IFileEditorInput ) partRef .getEditorInput ()).getFile ();
256256 IProject project = file .getProject ();
257- try {
258- if (project .hasNature (CodeCheckerNature .NATURE_ID )) {
259- String filename = projects .get (project ).getAsProjectRelativePath (file .getProjectRelativePath ().toString ());
260257
261- IWorkbenchWindow activeWindow = PlatformUI .getWorkbench ().getActiveWorkbenchWindow ();
262- if (activeWindow == null ) {
263- Logger .log (IStatus .ERROR , NULL_WINDOW );
264- return ;
265- }
266- IWorkbenchPage [] pages = activeWindow .getPages ();
258+ CodeCheckerProject ccProj = projects .get (project );
259+ String filename = "" ;
260+ if (ccProj != null )
261+ filename = ccProj .getAsProjectRelativePath (file .getProjectRelativePath ().toString ());
267262
268- this .refreshProject (pages , project , true );
269- this .refreshCurrent (pages , project , filename , true );
270- this .refreshCustom (pages , project , "" , true );
271- this .activeProject = project ;
272- }
273- } catch (CoreException e ) {
274- // TODO Auto-generated catch block
275- e .printStackTrace ();
263+ IWorkbenchWindow activeWindow = PlatformUI .getWorkbench ().getActiveWorkbenchWindow ();
264+ if (activeWindow == null ) {
265+ Logger .log (IStatus .ERROR , NULL_WINDOW );
266+ return ;
276267 }
268+ IWorkbenchPage [] pages = activeWindow .getPages ();
269+
270+ this .refreshProject (pages , project , true );
271+ this .refreshCurrent (pages , project , filename , true );
272+ this .refreshCustom (pages , project , "" , true );
273+ this .activeProject = project ;
277274 }
278275 }
279276
@@ -333,7 +330,19 @@ public void refreshAddCustomReportListView(String secondaryId) {
333330 */
334331 public void runReportJob (ReportListView target , String currentFileName ) {
335332 IProject project = target .getCurrentProject ();
336- if (project == null ) return ;
333+ if (project == null )
334+ return ;
335+ try {
336+ if (!project .hasNature (CodeCheckerNature .NATURE_ID )) {
337+ target .clearModel ();
338+ return ;
339+ }
340+ } catch (CoreException e ) {
341+ // If there is a problem with the project, clear it anyway.
342+ target .clearModel ();
343+ return ;
344+ }
345+
337346 Logger .log (IStatus .INFO , "Started Filtering Reports for project: " +project .getName ());
338347
339348 ReportParser parser = new ReportParser (reports .get (project ), currentFileName );
0 commit comments