Author: dgolovin
Date: 2011-09-28 13:13:54 -0400 (Wed, 28 Sep 2011)
New Revision: 35126
Modified:
trunk/common/plugins/org.jboss.tools.common.resref.core/src/org/jboss/tools/common/resref/core/ResourceReferenceList.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/ElServiceUtil.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/FileUtil.java
Log:
https://issues.jboss.org/browse/JBIDE-9753 Multiple content web roots seem to confuse VPE
removed unnecessary checks for nulls
Modified:
trunk/common/plugins/org.jboss.tools.common.resref.core/src/org/jboss/tools/common/resref/core/ResourceReferenceList.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.resref.core/src/org/jboss/tools/common/resref/core/ResourceReferenceList.java 2011-09-28
17:01:55 UTC (rev 35125)
+++
trunk/common/plugins/org.jboss.tools.common.resref.core/src/org/jboss/tools/common/resref/core/ResourceReferenceList.java 2011-09-28
17:13:54 UTC (rev 35126)
@@ -60,7 +60,7 @@
/**
* Returns all resources for current file
* @param file
- * @return
+ * @return <code>ResourceReference</code> array that might be empty, never
returns <code>null</code>
*/
public ResourceReference[] getAllResources(IFile file) {
Set<String> locations = new HashSet<String>();
@@ -338,7 +338,12 @@
}
}
}
-
+
+ /**
+ *
+ * @param path
+ * @return <code>ResourceReference</code> array that might be empty, never
returns <code>null</code>
+ */
public ResourceReference[] getAllResources(IPath path) {
Set locations = new HashSet();
List css = new ArrayList();
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/ElServiceUtil.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/ElServiceUtil.java 2011-09-28
17:01:55 UTC (rev 35125)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/ElServiceUtil.java 2011-09-28
17:13:54 UTC (rev 35126)
@@ -74,14 +74,14 @@
final ResourceReference[] gResources =
GlobalELReferenceList.getInstance().getAllResources(workspacePath);
final ResourceReference[] elResources =
ELReferenceList.getInstance().getAllResources(resourceFile);
- int size = (gResources == null ? 0 : gResources.length);
- size += (elResources == null ? 0 : elResources.length);
+ int size = gResources.length;
+ size += elResources.length;
ResourceReference[] rst = new ResourceReference[size];
- if ((gResources != null) && (gResources.length > 0)) {
+ if (gResources.length > 0) {
System.arraycopy(gResources, 0, rst, 0, gResources.length);
}
- if ((elResources != null) && (elResources.length > 0)) {
+ if (elResources.length > 0) {
System.arraycopy(elResources, 0, rst, gResources == null ? 0 : gResources.length,
elResources.length);
}
return rst;
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/FileUtil.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/FileUtil.java 2011-09-28
17:01:55 UTC (rev 35125)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/FileUtil.java 2011-09-28
17:13:54 UTC (rev 35126)
@@ -196,7 +196,7 @@
IResource resource = ((JavaElement)fragmentRoot).resource();
if(resource instanceof IContainer && resource.exists()) {
IFile f = ((IContainer)resource).getFile(new Path(classPathResource));
- if(f != null && f.exists()) {
+ if(f.exists()) {
result = f.getLocation().toFile().getAbsolutePath();
}
}
@@ -243,7 +243,7 @@
if (fileName.startsWith("/")) { //$NON-NLS-1$
ResourceReference[] resources = AbsoluteFolderReferenceList
.getInstance().getAllResources(includeFile);
- if (resources != null && resources.length == 1) {
+ if (resources.length == 1) {
String location = resources[0].getLocation() + fileName;
IPath path = new Path(location);
file = ResourcesPlugin.getWorkspace().getRoot()
@@ -252,7 +252,7 @@
//WebArtifactEdit edit = WebArtifactEdit
// .getWebArtifactEditForRead(includeFile.getProject());
IContainer[] webRootFolders = WebUtils.getWebRootFolders(includeFile.getProject());
- if (webRootFolders != null) {
+ if (webRootFolders.length > 0) {
for (IContainer webRootFolder : webRootFolders) {
IFile handle = webRootFolder.getFile(new Path(fileName));
if (handle.exists()) {
@@ -270,7 +270,7 @@
} else {
ResourceReference[] resources = RelativeFolderReferenceList
.getInstance().getAllResources(includeFile);
- if ((resources != null) && resources.length == 1) {
+ if (resources.length == 1) {
String location = resources[0].getLocation() + File.separator
+ fileName;
IPath path = new Path(location);
@@ -291,7 +291,7 @@
IContainer[] webRootFolders = WebUtils.getWebRootFolders(project);
IPath defaultWebRootPath = null;
- if (webRootFolders != null && webRootFolders.length > 0) {
+ if (webRootFolders.length > 0) {
defaultWebRootPath = webRootFolders[0].getFullPath();
}
if (defaultWebRootPath == null) {