@SuppressWarnings("restriction") protected void configureDeployedName(IProject project, String deployedFileName) { // We need to remove the file extension from deployedFileName int extSeparatorPos = deployedFileName.lastIndexOf('.'); String deployedName = extSeparatorPos > -1 ? deployedFileName.substring(0, extSeparatorPos) : deployedFileName; // From jerr's patch in MNGECLIPSE-965 IVirtualComponent projectComponent = ComponentCore.createComponent(project); if (projectComponent != null && !deployedName.equals( projectComponent .getDeployedName())) { // MNGECLIPSE-2331 : Seems projectComponent.getDeployedName() // can be null StructureEdit moduleCore = null; try { moduleCore = StructureEdit.getStructureEditForWrite(project); if (moduleCore != null) { WorkbenchComponent component = moduleCore.getComponent(); if (component != null) { component.setName(deployedName); moduleCore.saveIfNecessary(null); } } } finally { if (moduleCore != null) { moduleCore.dispose(); } } } }
public IResource getEclipseResource() { synchronized (this) { if (resource == null) { IProject container = null; ComponentResource moduleResource = (ComponentResource) getTarget(); if (moduleResource != null) { IPath sourcePath = moduleResource.getSourcePath(); if (moduleResource.getOwningProject() != null) container = moduleResource.getOwningProject(); else container = StructureEdit.getContainingProject(moduleResource.getComponent()); if (container != null) resource = container.findMember(sourcePath); if (resource == null) resource = ResourcesPlugin.getWorkspace().getRoot().findMember(sourcePath); } } } return resource; }