|
Lines 26-31
Link Here
|
| 26 |
import org.eclipse.core.runtime.IPath; |
26 |
import org.eclipse.core.runtime.IPath; |
| 27 |
import org.eclipse.core.runtime.IProgressMonitor; |
27 |
import org.eclipse.core.runtime.IProgressMonitor; |
| 28 |
import org.eclipse.core.runtime.Path; |
28 |
import org.eclipse.core.runtime.Path; |
|
|
29 |
import org.eclipse.jem.util.logger.proxy.Logger; |
| 29 |
import org.eclipse.wst.common.componentcore.ComponentCore; |
30 |
import org.eclipse.wst.common.componentcore.ComponentCore; |
| 30 |
import org.eclipse.wst.common.componentcore.internal.ComponentResource; |
31 |
import org.eclipse.wst.common.componentcore.internal.ComponentResource; |
| 31 |
import org.eclipse.wst.common.componentcore.internal.StructureEdit; |
32 |
import org.eclipse.wst.common.componentcore.internal.StructureEdit; |
|
Lines 77-105
Link Here
|
| 77 |
try { |
78 |
try { |
| 78 |
|
79 |
|
| 79 |
structureEdit = StructureEdit.getStructureEditForRead(getProject()); |
80 |
structureEdit = StructureEdit.getStructureEditForRead(getProject()); |
| 80 |
WorkbenchComponent component = structureEdit.getComponent(); |
81 |
if (structureEdit != null) // bug 199229 |
| 81 |
if (null != component) { |
82 |
{ |
| 82 |
ResourceTreeRoot root = ResourceTreeRoot.getDeployResourceTreeRoot(component); |
83 |
WorkbenchComponent component = structureEdit.getComponent(); |
| 83 |
ComponentResource[] resources = root.findModuleResources(getRuntimePath().append(aPath), ResourceTreeNode.CREATE_NONE); |
84 |
if (null != component) |
| 84 |
|
85 |
{ |
| 85 |
for (int i = 0; i < resources.length; i++) { |
86 |
ResourceTreeRoot root = ResourceTreeRoot.getDeployResourceTreeRoot(component); |
| 86 |
// return the resources corresponding to the root, not any of the children if its a folder |
87 |
ComponentResource[] resources = root.findModuleResources(getRuntimePath().append(aPath), ResourceTreeNode.CREATE_NONE); |
| 87 |
if (resources[i].getRuntimePath().equals(getRuntimePath().append(aPath))) { |
88 |
|
| 88 |
IResource platformResource = getProject().findMember(resources[i].getSourcePath()); |
89 |
for (int i = 0; i < resources.length; i++) |
| 89 |
if (platformResource == null) |
90 |
{ |
| 90 |
platformResource = ResourcesPlugin.getWorkspace().getRoot().findMember(resources[i].getSourcePath()); |
91 |
// return the resources corresponding to the root, not any of the children if its a folder |
| 91 |
if (platformResource != null) { |
92 |
if (resources[i].getRuntimePath().equals(getRuntimePath().append(aPath))) { |
| 92 |
switch (platformResource.getType()) { |
93 |
IResource platformResource = getProject().findMember(resources[i].getSourcePath()); |
| 93 |
case IResource.FOLDER : |
94 |
if (platformResource == null) |
| 94 |
case IResource.PROJECT : |
95 |
platformResource = ResourcesPlugin.getWorkspace().getRoot().findMember(resources[i].getSourcePath()); |
| 95 |
return ComponentCore.createFolder(getProject(), getRuntimePath().append(aPath)); |
96 |
if (platformResource != null) |
| 96 |
case IResource.FILE : |
97 |
{ |
| 97 |
return new VirtualFile(getProject(), getRuntimePath().append(aPath)); |
98 |
switch (platformResource.getType()) |
|
|
99 |
{ |
| 100 |
case IResource.FOLDER : |
| 101 |
case IResource.PROJECT : |
| 102 |
return ComponentCore.createFolder(getProject(), getRuntimePath().append(aPath)); |
| 103 |
case IResource.FILE : |
| 104 |
return new VirtualFile(getProject(), getRuntimePath().append(aPath)); |
| 105 |
} |
| 106 |
} |
| 98 |
} |
107 |
} |
| 99 |
} |
108 |
} |
| 100 |
} |
109 |
} |
| 101 |
} |
110 |
} |
| 102 |
} |
|
|
| 103 |
} finally { |
111 |
} finally { |
| 104 |
if (structureEdit != null) |
112 |
if (structureEdit != null) |
| 105 |
structureEdit.dispose(); |
113 |
structureEdit.dispose(); |