[jbosstools-commits] JBoss Tools SVN: r43927 - in trunk/archives/plugins: org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model and 2 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Fri Sep 21 09:37:27 EDT 2012


Author: rob.stryker at jboss.com
Date: 2012-09-21 09:37:27 -0400 (Fri, 21 Sep 2012)
New Revision: 43927

Modified:
   trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/build/PostBuildRefresher.java
   trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java
   trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/PathUtils.java
   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/ArchivesRootContentProvider.java
Log:
JBIDE-12494

Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/build/PostBuildRefresher.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/build/PostBuildRefresher.java	2012-09-21 13:16:57 UTC (rev 43926)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/build/PostBuildRefresher.java	2012-09-21 13:37:27 UTC (rev 43927)
@@ -2,6 +2,7 @@
 
 import org.eclipse.core.resources.IContainer;
 import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.resources.WorkspaceJob;
@@ -31,6 +32,13 @@
 	}
 	
 	private void handlePostBuild(IArchive pkg) {
+		String projectName = pkg.getProjectName();
+		IProject p = projectName == null ? null : 
+			ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+		if( p == null || !p.exists()) {
+			return;
+		}
+		
 		IPath loc = PathUtils.getGlobalLocation(pkg);
 		IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(loc);
 		for( int i = 0; i < files.length; i++ ) {

Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java	2012-09-21 13:16:57 UTC (rev 43926)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java	2012-09-21 13:37:27 UTC (rev 43927)
@@ -103,8 +103,10 @@
 		}
 
 		public void setBasedir2(String path) {
-
-			IPath translatedPath = new Path(PathUtils.getAbsoluteLocation(path, fs.projectName, fs.inWorkspace, fs.version));
+			String s = PathUtils.getAbsoluteLocation(path, fs.projectName, fs.inWorkspace, fs.version);
+			if( s == null )
+				return;
+			IPath translatedPath = new Path(s);
 			if( workspaceRelative ) {
 				IPath p = PathUtils.getGlobalLocation(path, fs.projectName, true, fs.version);
 				setBasedir(new FileWrapper(p.toFile(), translatedPath, fs.rootArchiveRelativePath));
@@ -202,7 +204,7 @@
 	    }
 	    
 	    protected boolean isSelected(String name, File file) {
-	    	return super.isSelected(name, file) && file.isFile();
+	    	return file != null && super.isSelected(name, file) && file.isFile();
 	    }
 
 
@@ -291,6 +293,9 @@
 	    }
 
 	    public boolean couldBeIncluded(String path, boolean inWorkspace) {
+	    	if( getBasedir() == null )
+	    		return false;
+	    	
 	    	IPath targetBase = ((FileWrapper)getBasedir()).getWrapperPath();
 	    	IPath[] questionFiles = new IPath[] { new Path(path) };
 	    	if( workspaceRelative && !inWorkspace) {

Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/PathUtils.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/PathUtils.java	2012-09-21 13:16:57 UTC (rev 43926)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/PathUtils.java	2012-09-21 13:37:27 UTC (rev 43927)
@@ -66,7 +66,9 @@
 	// Get an absolute path, workspace-absolute or fs-absolute
 	public static String getAbsoluteLocation(String expression,
 			String projectName, boolean inWorkspace, double version) {
-
+		if( projectName == null )
+			return null;
+		
 		if( inWorkspace && ("".equals(expression) || ".".equals(expression))) //$NON-NLS-1$ //$NON-NLS-2$
 			return new Path(projectName).makeAbsolute().toString();
 

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-21 13:16:57 UTC (rev 43926)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesContentProviderDelegate.java	2012-09-21 13:37:27 UTC (rev 43927)
@@ -177,12 +177,18 @@
 			topChanges = getChanges(delta);
 		else if( delta.getKind() == IArchiveNodeDelta.NO_CHANGE)
 			return;
-		else
+		else if( delta.getPostNode() == null )
+			topChanges = null;
+		else 
 			topChanges = new IArchiveNode[]{delta.getPostNode()};
 
 		// now go through and refresh them
 		Display.getDefault().asyncExec(new Runnable () {
 			public void run () {
+				if( topChanges == null ) {
+					refreshViewer(null);
+					return;
+				}
 				for( int i = 0; i < topChanges.length; i++ ) {
 					refreshViewer(topChanges[i]);
 				}
@@ -207,9 +213,13 @@
 
 		if( !viewerInUse.getControl().isDisposed()) {
 			if( viewerInUse instanceof StructuredViewer ) {
-				((StructuredViewer)viewerInUse).refresh(o);
-				if( viewerInUse instanceof TreeViewer ) {
-					((TreeViewer)viewerInUse).expandToLevel(o, 1);
+				if( o == null ) {
+					((StructuredViewer)viewerInUse).refresh();
+				} else {
+					((StructuredViewer)viewerInUse).refresh(o);
+					if( viewerInUse instanceof TreeViewer ) {
+						((TreeViewer)viewerInUse).expandToLevel(o, 1);
+					}
 				}
 			} else
 				viewerInUse.refresh();

Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesRootContentProvider.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesRootContentProvider.java	2012-09-21 13:16:57 UTC (rev 43926)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesRootContentProvider.java	2012-09-21 13:37:27 UTC (rev 43927)
@@ -57,7 +57,7 @@
 				}
 				return wrap((IProject[]) tmp.toArray(new IProject[tmp.size()]));
 			}
-			if( cp != null )
+			if( cp != null && cp.isAccessible())
 				return wrap(new IProject[]{cp});
 		} else if( cp != null ){
 			return getChildren(new WrappedProject(cp, WrappedProject.NAME));



More information about the jbosstools-commits mailing list