From 42ba9a88bb7a6ae3a652103c4e0c05f93d7360ee Mon Sep 17 00:00:00 2001 From: Philippe Herlin Date: Tue, 5 Aug 2003 19:27:41 +0000 Subject: [PATCH] Fixing CoreException when refreshing (Eclipse v3) git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@2156 51baf565-9d33-0410-a72c-fc3788e3496d --- .../pmd/eclipse/views/ViolationView.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/pmd-eclipse/src/net/sourceforge/pmd/eclipse/views/ViolationView.java b/pmd-eclipse/src/net/sourceforge/pmd/eclipse/views/ViolationView.java index 751e397d01..5a8468d9ac 100644 --- a/pmd-eclipse/src/net/sourceforge/pmd/eclipse/views/ViolationView.java +++ b/pmd-eclipse/src/net/sourceforge/pmd/eclipse/views/ViolationView.java @@ -49,6 +49,9 @@ import org.eclipse.ui.part.ViewPart; * @version $Revision$ * * $Log$ + * Revision 1.2 2003/08/05 19:27:41 phherlin + * Fixing CoreException when refreshing (Eclipse v3) + * * Revision 1.1 2003/07/07 19:24:54 phherlin * Adding PMD violations view * @@ -94,7 +97,9 @@ public class ViolationView extends ViewPart implements IOpenListener, ISelection * @see org.eclipse.ui.IWorkbenchPart#setFocus() */ public void setFocus() { - violationTableViewer.getControl().setFocus(); + if (!violationTableViewer.getControl().isDisposed()) { + violationTableViewer.getControl().setFocus(); + } } /** @@ -141,9 +146,13 @@ public class ViolationView extends ViewPart implements IOpenListener, ISelection * Force the violation table to refresh */ public void refresh() { - violationTableViewer.getControl().setRedraw(false); - violationTableViewer.refresh(); - violationTableViewer.getControl().setRedraw(true); + // Seems this can be called when table is disposed ; so test before + // refreshing + if (!violationTableViewer.getControl().isDisposed()) { + violationTableViewer.getControl().setRedraw(false); + violationTableViewer.refresh(); + violationTableViewer.getControl().setRedraw(true); + } } /** @@ -285,7 +294,7 @@ public class ViolationView extends ViewPart implements IOpenListener, ISelection } workspace.endOperation(false, null); } catch (CoreException e) { - // do nothing + ; // do nothing } } }