[jbosstools-commits] JBoss Tools SVN: r43616 - trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Wed Sep 12 04:35:11 EDT 2012


Author: rob.stryker at jboss.com
Date: 2012-09-12 04:35:11 -0400 (Wed, 12 Sep 2012)
New Revision: 43616

Modified:
   trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesContentProviderDelegate.java
   trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesRootBridgeContentProvider.java
Log:
JBIDE-11927 to trunk

Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesContentProviderDelegate.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesContentProviderDelegate.java	2012-09-12 03:01:27 UTC (rev 43615)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesContentProviderDelegate.java	2012-09-12 08:35:11 UTC (rev 43616)
@@ -205,14 +205,15 @@
 		if( o instanceof WrappedProject && shouldRefreshProject())
 			o = ((WrappedProject)o).element;
 
-		if( viewerInUse instanceof StructuredViewer ) {
-			((StructuredViewer)viewerInUse).refresh(o);
-			if( viewerInUse instanceof TreeViewer ) {
-				((TreeViewer)viewerInUse).expandToLevel(o, 1);
-			}
-		} else
-			viewerInUse.refresh();
-
+		if( !viewerInUse.getControl().isDisposed()) {
+			if( viewerInUse instanceof StructuredViewer ) {
+				((StructuredViewer)viewerInUse).refresh(o);
+				if( viewerInUse instanceof TreeViewer ) {
+					((TreeViewer)viewerInUse).expandToLevel(o, 1);
+				}
+			} else
+				viewerInUse.refresh();
+		}
 	}
 	protected IArchiveNode[] getChanges(IArchiveNodeDelta delta) {
 		IArchiveNodeDelta[] children = delta.getAllAffectedChildren();

Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesRootBridgeContentProvider.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesRootBridgeContentProvider.java	2012-09-12 03:01:27 UTC (rev 43615)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesRootBridgeContentProvider.java	2012-09-12 08:35:11 UTC (rev 43616)
@@ -11,6 +11,7 @@
 package org.jboss.ide.eclipse.archives.ui.providers;
 
 import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
 import org.eclipse.jface.viewers.ITreeContentProvider;
 import org.eclipse.jface.viewers.Viewer;
 import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
@@ -36,11 +37,15 @@
 
 	public Object[] getChildren(Object parentElement) {
 		if( parentElement instanceof IProject) {
-			if(  ((IProject)parentElement).isOpen())
-				if( PrefsInitializer.getBoolean(PrefsInitializer.PREF_ALWAYS_SHOW_PROJECT_EXPLORER_NODE) || 
-						ArchivesModel.instance().canReregister(((IProject)parentElement).getLocation())) {
+			if(  ((IProject)parentElement).isOpen()) {
+				IPath loc = ((IProject)parentElement).getLocation();
+				boolean alwaysShow = PrefsInitializer.getBoolean(PrefsInitializer.PREF_ALWAYS_SHOW_PROJECT_EXPLORER_NODE); 
+				boolean fileExists = ArchivesModel.instance().canReregister(loc);
+				boolean nodeExists = ArchivesModel.instance().getRoot(loc) != null;
+				if( alwaysShow || fileExists || nodeExists ) {
 					return new Object[] { new WrappedProject((IProject)parentElement, WrappedProject.CATEGORY) };
 				}
+			}
 			return new Object[]{};
 		}
 		return delegate.getChildren(parentElement);



More information about the jbosstools-commits mailing list