|
Lines 1-5
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2007 IBM Corporation and others. |
2 |
* Copyright (c) 2007, 2011 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse License v1.0 |
4 |
* are made available under the terms of the Eclipse License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
|
Lines 10-17
Link Here
|
| 10 |
*******************************************************************************/ |
10 |
*******************************************************************************/ |
| 11 |
package org.eclipse.jst.jsp.core.internal.util; |
11 |
package org.eclipse.jst.jsp.core.internal.util; |
| 12 |
|
12 |
|
|
|
13 |
import org.eclipse.core.resources.IContainer; |
| 13 |
import org.eclipse.core.resources.IFile; |
14 |
import org.eclipse.core.resources.IFile; |
| 14 |
import org.eclipse.core.resources.IProject; |
15 |
import org.eclipse.core.resources.IProject; |
|
|
16 |
import org.eclipse.core.resources.IResource; |
| 15 |
import org.eclipse.core.resources.ResourcesPlugin; |
17 |
import org.eclipse.core.resources.ResourcesPlugin; |
| 16 |
import org.eclipse.core.runtime.CoreException; |
18 |
import org.eclipse.core.runtime.CoreException; |
| 17 |
import org.eclipse.core.runtime.IPath; |
19 |
import org.eclipse.core.runtime.IPath; |
|
Lines 21-26
Link Here
|
| 21 |
import org.eclipse.wst.common.componentcore.ModuleCoreNature; |
23 |
import org.eclipse.wst.common.componentcore.ModuleCoreNature; |
| 22 |
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; |
24 |
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; |
| 23 |
import org.eclipse.wst.common.componentcore.resources.IVirtualFile; |
25 |
import org.eclipse.wst.common.componentcore.resources.IVirtualFile; |
|
|
26 |
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder; |
| 24 |
import org.eclipse.wst.common.componentcore.resources.IVirtualResource; |
27 |
import org.eclipse.wst.common.componentcore.resources.IVirtualResource; |
| 25 |
import org.eclipse.wst.common.project.facet.core.IFacetedProject; |
28 |
import org.eclipse.wst.common.project.facet.core.IFacetedProject; |
| 26 |
import org.eclipse.wst.common.project.facet.core.IProjectFacet; |
29 |
import org.eclipse.wst.common.project.facet.core.IProjectFacet; |
|
Lines 156-180
Link Here
|
| 156 |
return null; |
159 |
return null; |
| 157 |
|
160 |
|
| 158 |
if (basePath.segmentCount() > 1) { |
161 |
if (basePath.segmentCount() > 1) { |
| 159 |
IFile baseFile = ResourcesPlugin.getWorkspace().getRoot().getFile(basePath); |
162 |
IResource baseResource = ResourcesPlugin.getWorkspace().getRoot().findMember(basePath); |
| 160 |
IVirtualResource[] virtualResources = ComponentCore.createResources(baseFile); |
163 |
if (baseResource != null) { |
| 161 |
for (int i = 0; i < virtualResources.length; i++) { |
164 |
IVirtualResource[] virtualResources = ComponentCore.createResources(baseResource); |
| 162 |
IPath baseRuntimePath = virtualResources[i].getRuntimePath(); |
165 |
for (int i = 0; i < virtualResources.length; i++) { |
| 163 |
IPath referenceRuntimePath = null; |
166 |
IPath referenceRuntimePath = null; |
| 164 |
if (reference.startsWith(SLASH)) { |
167 |
if (reference.startsWith(SLASH)) { |
| 165 |
referenceRuntimePath = new Path(reference); |
168 |
referenceRuntimePath = new Path(reference); |
| 166 |
} |
169 |
} |
| 167 |
else { |
170 |
else { |
| 168 |
referenceRuntimePath = baseRuntimePath.removeLastSegments(1).append(reference); |
171 |
IPath baseRuntimePath = virtualResources[i].getRuntimePath(); |
| 169 |
} |
172 |
referenceRuntimePath = baseRuntimePath.removeLastSegments(1).append(reference); |
| 170 |
IVirtualFile virtualFile = ComponentCore.createFile(project, referenceRuntimePath); |
173 |
} |
| 171 |
if (virtualFile != null && virtualFile.exists()) { |
174 |
|
| 172 |
IFile[] underlyingFiles = virtualFile.getUnderlyingFiles(); |
175 |
IVirtualFile virtualFile = ComponentCore.createFile(project, referenceRuntimePath); |
| 173 |
for (int j = 0; j < underlyingFiles.length; j++) { |
176 |
if (virtualFile != null && virtualFile.exists()) { |
| 174 |
if (underlyingFiles[j].getProject().equals(project) && underlyingFiles[j].exists()) { |
177 |
IFile[] underlyingFiles = virtualFile.getUnderlyingFiles(); |
| 175 |
return underlyingFiles[j].getFullPath(); |
178 |
for (int j = 0; j < underlyingFiles.length; j++) { |
| 176 |
} |
179 |
if (underlyingFiles[j].getProject().equals(project) && underlyingFiles[j].isAccessible()) { |
|
|
180 |
return underlyingFiles[j].getFullPath(); |
| 181 |
} |
| 177 |
|
182 |
|
|
|
183 |
} |
| 184 |
} |
| 185 |
else { |
| 186 |
// http://bugs.eclipse.org/338751 |
| 187 |
IVirtualFolder virtualFolder = ComponentCore.createFolder(project, referenceRuntimePath); |
| 188 |
if (virtualFolder != null && virtualFolder.exists()) { |
| 189 |
IContainer[] underlyingFolders = virtualFolder.getUnderlyingFolders(); |
| 190 |
for (int j = 0; j < underlyingFolders.length; j++) { |
| 191 |
if (underlyingFolders[j].getProject().equals(project) && underlyingFolders[j].isAccessible()) { |
| 192 |
return underlyingFolders[j].getFullPath(); |
| 193 |
} |
| 194 |
} |
| 195 |
} |
| 178 |
} |
196 |
} |
| 179 |
} |
197 |
} |
| 180 |
} |
198 |
} |