Java Code Examples for org.eclipse.core.resources.IResource#getLocation()

The following examples show how to use org.eclipse.core.resources.IResource#getLocation() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PyPackageStateSaver.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Saves some selection in the memento object.
 */
private void save(TreePath treePath, String type) {
    if (treePath != null) {
        Object object = treePath.getLastSegment();
        if (object instanceof IAdaptable) {
            IAdaptable adaptable = (IAdaptable) object;
            IResource resource = (IResource) adaptable.getAdapter(IResource.class);
            if (resource != null) {
                IPath path = resource.getLocation();
                if (path != null) {
                    memento.createChild(type, path.toPortableString());
                }
            }
        }
    }
}
 
Example 2
Source File: RouteTreeContentProvider.java    From eip-designer with Apache License 2.0 6 votes vote down vote up
/** */
private static void findEIPModels(List<IResource> models, IPath path, IWorkspaceRoot workspaceRoot){
   IContainer container =  workspaceRoot.getContainerForLocation(path);

   try {
      IResource[] iResources = container.members();
      for (IResource iResource : iResources) {
         if ("eip".equalsIgnoreCase(iResource.getFileExtension())) {
            models.add(iResource);
         }
         if (iResource.getType() == IResource.FOLDER) {
            IPath tempPath = iResource.getLocation();
            findEIPModels(models, tempPath, workspaceRoot);
         }
      }
   } catch (CoreException e) {
      e.printStackTrace();
   }
}
 
Example 3
Source File: FileUtils.java    From gama with GNU General Public License v3.0 6 votes vote down vote up
private static String findInWorkspace(final String fp, final IContainer container, final boolean mustExist) {
	final IPath full = container.getFullPath().append(fp);
	IResource file = ROOT.getFile(full);
	if (!file.exists()) {
		// Might be a folder we're looking for
		file = ROOT.getFolder(full);
	}
	if (!file.exists()) {
		if (mustExist) { return null; }
	}
	final IPath loc = file.getLocation();
	// cf. #2997
	if (loc == null) { return fp; }
	return loc.toString();
	// getLocation() works for regular and linked files
}
 
Example 4
Source File: ResourceUtil.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Delete a broken symbolic link. Has no effect if the resource is not a
 * symbolic link or if the target of the symbolic link exists.
 *
 * @param resource
 *            the resource in the workspace.
 * @throws CoreException
 *             if an error occurs
 */
public static void deleteIfBrokenSymbolicLink(@Nullable IResource resource) throws CoreException {
    if (resource == null) {
        return;
    }
    if (resource.isLinked()) {
        IPath location = resource.getLocation();
        if (location == null || !location.toFile().exists()) {
            resource.delete(true, null);
        }
    } else {
        URI uri = resource.getLocationURI();
        if (uri != null) {
            Path linkPath = Paths.get(uri);
            if (Files.isSymbolicLink(linkPath) && !resource.exists()) {
                try {
                    Files.delete(linkPath);
                } catch (Exception e) {
                    // Do nothing.
                }
            }
        }
    }
}
 
Example 5
Source File: EIPModelTreeContentProvider.java    From eip-designer with Apache License 2.0 6 votes vote down vote up
/** */
private static void findEIPModels(List<IResource> models, IPath path, IWorkspaceRoot workspaceRoot){
   IContainer container =  workspaceRoot.getContainerForLocation(path);

   try {
      IResource[] iResources = container.members();
      for (IResource iResource : iResources) {
         if ("eip".equalsIgnoreCase(iResource.getFileExtension())) {
            models.add(iResource);
         }
         if (iResource.getType() == IResource.FOLDER) {
            IPath tempPath = iResource.getLocation();
            findEIPModels(models, tempPath, workspaceRoot);
         }
      }
   } catch (CoreException e) {
      System.err.println("CoreException while browsing " + path);
   }
}
 
Example 6
Source File: CopyFilesAndFoldersOperation.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Returns whether any of the given source resources are being recopied to
 * their current container.
 *
 * @param sourceResources
 *            the source resources
 * @param destination
 *            the destination container
 * @return <code>true</code> if at least one of the given source
 *         resource's parent container is the same as the destination
 */
boolean isDestinationSameAsSource(IResource[] sourceResources, IContainer destination) {
    IPath destinationLocation = destination.getLocation();

    for (int i = 0; i < sourceResources.length; i++) {
        IResource sourceResource = sourceResources[i];
        if (sourceResource.getParent().equals(destination)) {
            return true;
        } else if (destinationLocation != null) {
            // do thorough check to catch linked resources. Fixes bug 29913.
            IPath sourceLocation = sourceResource.getLocation();
            IPath destinationResource = destinationLocation.append(sourceResource.getName());
            if (sourceLocation != null && sourceLocation.isPrefixOf(destinationResource)) {
                return true;
            }
        }
    }
    return false;
}
 
Example 7
Source File: EIPModelTreeContentProvider.java    From eip-designer with Apache License 2.0 6 votes vote down vote up
/** */
private static void findEIPModels(List<IResource> models, IPath path, IWorkspaceRoot workspaceRoot){
   IContainer container =  workspaceRoot.getContainerForLocation(path);

   try {
      IResource[] iResources = container.members();
      for (IResource iResource : iResources) {
         if ("eip".equalsIgnoreCase(iResource.getFileExtension())) {
            models.add(iResource);
         }
         if (iResource.getType() == IResource.FOLDER) {
            IPath tempPath = iResource.getLocation();
            findEIPModels(models, tempPath, workspaceRoot);
         }
      }
   } catch (CoreException e) {
      e.printStackTrace();
   }
}
 
Example 8
Source File: JavaDocLocations.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Returns the location of the Javadoc.
 *
 * @param element
 *            whose Javadoc location has to be found
 * @param isBinary
 *            <code>true</code> if the Java element is from a binary container
 * @return the location URL of the Javadoc or <code>null</code> if the location
 *         cannot be found
 * @throws JavaModelException
 *             thrown when the Java element cannot be accessed
 * @since 3.9
 */
public static String getBaseURL(IJavaElement element, boolean isBinary) throws JavaModelException {
	if (isBinary) {
		// Source attachment usually does not include Javadoc resources
		// => Always use the Javadoc location as base:
		URL baseURL = JavaDocLocations.getJavadocLocation(element, false);
		if (baseURL != null) {
			if (baseURL.getProtocol().equals(JAR_PROTOCOL)) {
				// It's a JarURLConnection, which is not known to the browser widget.
				// Let's start the help web server:
				//					URL baseURL2 = PlatformUI.getWorkbench().getHelpSystem().resolve(baseURL.toExternalForm(), true);
				//					if (baseURL2 != null) { // can be null if org.eclipse.help.ui is not available
				//						baseURL = baseURL2;
				//					}
			}
			return baseURL.toExternalForm();
		}
	} else {
		IResource resource = element.getResource();
		if (resource != null) {
			/*
			 * Too bad: Browser widget knows nothing about EFS and custom URL handlers,
			 * so IResource#getLocationURI() does not work in all cases.
			 * We only support the local file system for now.
			 * A solution could be https://bugs.eclipse.org/bugs/show_bug.cgi?id=149022 .
			 */
			IPath location = resource.getLocation();
			if (location != null) {
				return location.toFile().toURI().toString();
			}
		}
	}
	return null;
}
 
Example 9
Source File: ResourceUtils.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
public static Location getLocation(IResource resource) throws CommonException {
	IPath location = resource.getLocation();
	if(location == null) {
		throw new CommonException("Invalid resource location: " + resource.getLocationURI());
	}
	return Location.create(location.toFile().toPath());
}
 
Example 10
Source File: NewCargoProjectWizard.java    From corrosion with Eclipse Public License 2.0 5 votes vote down vote up
private static File toFile(IResource r) {
	IPath location = r.getLocation();
	if (location != null && location.toFile().isFile()) {
		File parent = location.toFile().getParentFile();
		return parent == null ? null : parent.getAbsoluteFile();
	}
	return location == null ? null : location.toFile();
}
 
Example 11
Source File: ResourceUtils.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
public static IFileStore toFileStore(IResource r) {
   	if (r == null){
   		return null;
   	}
   	else if (r.getLocation() == null) {
   		return toFileStore(r.getLocationURI());
   	}
   	else {
   		return EFS.getLocalFileSystem().getStore(r.getLocation());
   	}
}
 
Example 12
Source File: CopyToClipboardAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private static void addFileName(Set<String> fileName, IResource resource){
	if (resource == null)
		return;
	IPath location = resource.getLocation();
	if (location != null) {
		fileName.add(location.toOSString());
	} else {
		// not a file system path. skip file.
	}
}
 
Example 13
Source File: ExternalFoldersManager.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private Map getFolders() {
	if (this.folders == null) {
		Map tempFolders = new HashMap();
		IProject project = getExternalFoldersProject();
		try {
			if (!project.isAccessible()) {
				if (project.exists()) {
					// workspace was moved (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=252571 )
					openExternalFoldersProject(project, null/*no progress*/);
				} else {
					// if project doesn't exist, do not open and recreate it as it means that there are no external folders
					return this.folders = Collections.synchronizedMap(tempFolders);
				}
			}
			IResource[] members = project.members();
			for (int i = 0, length = members.length; i < length; i++) {
				IResource member = members[i];
				if (member.getType() == IResource.FOLDER && member.isLinked() && member.getName().startsWith(LINKED_FOLDER_NAME)) {
					IPath externalFolderPath = member.getLocation();
					tempFolders.put(externalFolderPath, member);
				}
			}
		} catch (CoreException e) {
			Util.log(e, "Exception while initializing external folders"); //$NON-NLS-1$
		}
		this.folders = Collections.synchronizedMap(tempFolders);
	}
	return this.folders;
}
 
Example 14
Source File: DotnetNewWizard.java    From aCute with Eclipse Public License 2.0 5 votes vote down vote up
private File toFile(IResource r) {
	IPath location = r.getLocation();
	if (location.toFile().isFile()) {
		return location.toFile().getParentFile().getAbsoluteFile();
	}
	return location == null ? null : location.toFile();
}
 
Example 15
Source File: ExternalPackageFragmentRoot.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
protected boolean resourceExists(IResource underlyingResource) {
	if (underlyingResource == null)
		return false;
	IPath location = underlyingResource.getLocation();
	if (location == null)
		return false;
	File file = location.toFile();
	if (file == null)
		return false;
	return file.exists();
}
 
Example 16
Source File: PythonPathNature.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * @return the project pythonpath with complete paths in the filesystem.
 */
@Override
public String getOnlyProjectPythonPathStr(boolean addExternal) throws CoreException {
    String source = null;
    String external = null;
    String contributed = null;
    IProject project = fProject;
    PythonNature nature = fNature;

    if (project == null || nature == null) {
        return "";
    }

    //Substitute with variables!
    StringSubstitution stringSubstitution = new StringSubstitution(nature);

    source = (String) getProjectSourcePath(true, stringSubstitution, RETURN_STRING_WITH_SEPARATOR);
    if (addExternal) {
        external = getProjectExternalSourcePath(true, stringSubstitution);
    }
    contributed = stringSubstitution.performPythonpathStringSubstitution(getContributedSourcePath(project));

    if (source == null) {
        source = "";
    }
    //we have to work on this one to resolve to full files, as what is stored is the position
    //relative to the project location
    List<String> strings = StringUtils.splitAndRemoveEmptyTrimmed(source, '|');
    FastStringBuffer buf = new FastStringBuffer();

    for (String currentPath : strings) {
        if (currentPath.trim().length() > 0) {
            IPath p = new Path(currentPath);

            if (SharedCorePlugin.inTestMode()) {
                //in tests
                buf.append(currentPath);
                buf.append("|");
                continue;
            }

            boolean found = false;
            p = p.removeFirstSegments(1); //The first segment should always be the project (historically it's this way, but having it relative would be nicer!?!).
            IResource r = project.findMember(p);
            if (r == null) {
                r = project.getFolder(p);
            }
            if (r != null) {
                IPath location = r.getLocation();
                if (location != null) {
                    found = true;
                    buf.append(FileUtils.getFileAbsolutePath(location.toFile()));
                    buf.append("|");
                }
            }
            if (!found) {
                Log.log(IStatus.WARNING, "Unable to find the path " + currentPath + " in the project were it's \n"
                        + "added as a source folder for pydev (project: " + project.getName() + ") member:" + r,
                        null);
            }
        }
    }

    if (external == null) {
        external = "";
    }
    return buf.append("|").append(external).append("|").append(contributed).toString();
}
 
Example 17
Source File: BaseDocumentLifeCycleHandler.java    From eclipse.jdt.ls with Eclipse Public License 2.0 4 votes vote down vote up
private ICompilationUnit checkPackageDeclaration(String uri, ICompilationUnit unit) {
	if (unit.getResource() != null && unit.getJavaProject() != null && unit.getJavaProject().getProject().getName().equals(ProjectsManager.DEFAULT_PROJECT_NAME)) {
		try {
			CompilationUnit astRoot = CoreASTProvider.getInstance().getAST(unit, CoreASTProvider.WAIT_YES, new NullProgressMonitor());
			IProblem[] problems = astRoot.getProblems();
			for (IProblem problem : problems) {
				if (problem.getID() == IProblem.PackageIsNotExpectedPackage) {
					IResource file = unit.getResource();
					boolean toRemove = file.isLinked();
					if (toRemove) {
						IPath path = file.getParent().getProjectRelativePath();
						if (path.segmentCount() > 0 && JDTUtils.SRC.equals(path.segments()[0])) {
							String packageNameResource = path.removeFirstSegments(1).toString().replace(JDTUtils.PATH_SEPARATOR, JDTUtils.PERIOD);
							path = file.getLocation();
							if (path != null && path.segmentCount() > 0) {
								path = path.removeLastSegments(1);
								String pathStr = path.toString().replace(JDTUtils.PATH_SEPARATOR, JDTUtils.PERIOD);
								if (pathStr.endsWith(packageNameResource)) {
									toRemove = false;
								}
							}
						}
					}
					if (toRemove) {
						file.delete(true, new NullProgressMonitor());
						if (unit.equals(sharedASTProvider.getActiveJavaElement())) {
							sharedASTProvider.disposeAST();
						}
						unit.discardWorkingCopy();
						unit = JDTUtils.resolveCompilationUnit(uri);
						unit.becomeWorkingCopy(new NullProgressMonitor());
						triggerValidation(unit);
					}
					break;
				}
			}

		} catch (CoreException e) {
			JavaLanguageServerPlugin.logException(e.getMessage(), e);
		}
	}
	return unit;
}
 
Example 18
Source File: BundleMonitor.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
/**
 * processFile
 * 
 * @param delta
 */
private void processFile(IResourceDelta delta)
{
	IResource resource = delta.getResource();

	if (resource != null && resource.getLocation() != null)
	{
		BundleManager manager = getBundleManager();
		File file = resource.getLocation().toFile();
		String fullProjectPath = delta.getFullPath().toString();

		BundlePrecedence scope = manager.getBundlePrecedence(file);

		// don't process user bundles that are projects since file watcher will handle those
		if (scope != BundlePrecedence.USER)
		{
			switch (delta.getKind())
			{
				case IResourceDelta.ADDED:
					this.showResourceEvent("Added: " + file); //$NON-NLS-1$

					if (BUNDLE_PATTERN_DEPRECATED.matcher(fullProjectPath).matches()
							|| BUNDLE_PATTERN.matcher(fullProjectPath).matches())
					{
						manager.loadBundle(file.getParentFile());
					}
					else
					{
						manager.loadScript(file);
					}
					break;

				case IResourceDelta.REMOVED:
					this.showResourceEvent("Removed: " + file); //$NON-NLS-1$

					if (BUNDLE_PATTERN_DEPRECATED.matcher(fullProjectPath).matches()
							|| BUNDLE_PATTERN.matcher(fullProjectPath).matches())
					{
						// NOTE: we have to both unload all scripts associated with this bundle
						// and the bundle file itself. Technically, the bundle file doesn't
						// exist any more so it won't get unloaded
						manager.unloadBundle(file.getParentFile());
					}

					manager.unloadScript(file);
					break;

				case IResourceDelta.CHANGED:
					if ((delta.getFlags() & IResourceDelta.MOVED_FROM) != 0)
					{
						IPath movedFromPath = delta.getMovedFromPath();
						IResource movedFrom = ResourcesPlugin.getWorkspace().getRoot()
								.getFileForLocation(movedFromPath);

						if (movedFrom != null && movedFrom instanceof IFile)
						{
							this.showResourceEvent(MessageFormat.format("Added: {0}=>{1}", movedFrom.getLocation() //$NON-NLS-1$
									.toFile(), file));

							manager.unloadScript(movedFrom.getLocation().toFile());
							manager.loadScript(file);
						}
					}
					else if ((delta.getFlags() & IResourceDelta.MOVED_TO) != 0)
					{
						IPath movedToPath = delta.getMovedToPath();
						IResource movedTo = ResourcesPlugin.getWorkspace().getRoot()
								.getFileForLocation(movedToPath);

						if (movedTo != null && movedTo instanceof IFile)
						{
							this.showResourceEvent(MessageFormat.format("Added: {0}=>{1}", file, movedTo //$NON-NLS-1$
									.getLocation().toFile()));

							manager.unloadScript(file);
							manager.loadScript(movedTo.getLocation().toFile());
						}
					}
					else if ((delta.getFlags() & IResourceDelta.REPLACED) != 0)
					{
						this.showResourceEvent("Reload: " + file); //$NON-NLS-1$

						manager.reloadScript(file);
					}
					else if ((delta.getFlags() & IResourceDelta.CONTENT) != 0)
					{
						this.showResourceEvent("Reload: " + file); //$NON-NLS-1$

						manager.reloadScript(file);
					}
					break;
			}
		}
	}
}
 
Example 19
Source File: CPListElement.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public static CPListElement create(Object parent, IClasspathEntry curr, boolean newElement, IJavaProject project) {
	IPath path= curr.getPath();
	IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();

	// get the resource
	IResource res= null;
	boolean isMissing= false;
	IPath linkTarget= null;

	switch (curr.getEntryKind()) {
		case IClasspathEntry.CPE_CONTAINER:
			try {
				isMissing= project != null && (JavaCore.getClasspathContainer(path, project) == null);
			} catch (JavaModelException e) {
				isMissing= true;
			}
			break;
		case IClasspathEntry.CPE_VARIABLE:
			IPath resolvedPath= JavaCore.getResolvedVariablePath(path);
			isMissing=  root.findMember(resolvedPath) == null && !resolvedPath.toFile().exists();
			break;
		case IClasspathEntry.CPE_LIBRARY:
			res= root.findMember(path);
			if (res == null) {
				if (!ArchiveFileFilter.isArchivePath(path, true)) {
					if (root.getWorkspace().validatePath(path.toString(), IResource.FOLDER).isOK()
							&& root.getProject(path.segment(0)).exists()) {
						res= root.getFolder(path);
					}
				}

				IPath rawPath= path;
				if (project != null) {
					IPackageFragmentRoot[] roots= project.findPackageFragmentRoots(curr);
					if (roots.length == 1)
						rawPath= roots[0].getPath();
				}
				isMissing= !rawPath.toFile().exists(); // look for external JARs and folders
			} else if (res.isLinked()) {
				linkTarget= res.getLocation();
			}
			break;
		case IClasspathEntry.CPE_SOURCE:
			path= path.removeTrailingSeparator();
			res= root.findMember(path);
			if (res == null) {
				if (root.getWorkspace().validatePath(path.toString(), IResource.FOLDER).isOK()) {
					res= root.getFolder(path);
				}
				isMissing= true;
			} else if (res.isLinked()) {
				linkTarget= res.getLocation();
			}
			break;
		case IClasspathEntry.CPE_PROJECT:
			res= root.findMember(path);
			isMissing= (res == null);
			break;
	}
	CPListElement elem= new CPListElement(parent, project, curr.getEntryKind(), path, newElement, res, linkTarget);
	elem.setExported(curr.isExported());
	elem.setAttribute(SOURCEATTACHMENT, curr.getSourceAttachmentPath());
	elem.setAttribute(OUTPUT, curr.getOutputLocation());
	elem.setAttribute(EXCLUSION, curr.getExclusionPatterns());
	elem.setAttribute(INCLUSION, curr.getInclusionPatterns());
	elem.setAttribute(ACCESSRULES, curr.getAccessRules());
	elem.setAttribute(COMBINE_ACCESSRULES, new Boolean(curr.combineAccessRules()));

	IClasspathAttribute[] extraAttributes= curr.getExtraAttributes();
	for (int i= 0; i < extraAttributes.length; i++) {
		IClasspathAttribute attrib= extraAttributes[i];
		CPListElementAttribute attribElem= elem.findAttributeElement(attrib.getName());
		if (attribElem == null) {
			elem.createAttributeElement(attrib.getName(), attrib.getValue(), false);
		} else {
			attribElem.setValue(attrib.getValue());
		}
	}

	elem.setIsMissing(isMissing);
	return elem;
}
 
Example 20
Source File: JavaHotCodeReplaceProvider.java    From java-debug with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Answers whether children should be visited.
 * <p>
 * If the associated resource is a class file which has been changed, record it.
 * </p>
 */
@Override
public boolean visit(IResourceDelta delta) {
    if (delta == null || 0 == (delta.getKind() & IResourceDelta.CHANGED)) {
        return false;
    }
    IResource resource = delta.getResource();
    if (resource != null) {
        switch (resource.getType()) {
            case IResource.FILE:
                if (0 == (delta.getFlags() & IResourceDelta.CONTENT)) {
                    return false;
                }
                if (CLASS_FILE_EXTENSION.equals(resource.getFullPath().getFileExtension())) {
                    IPath localLocation = resource.getLocation();
                    if (localLocation != null) {
                        String path = localLocation.toOSString();
                        IClassFileReader reader = ToolFactory.createDefaultClassFileReader(path,
                                IClassFileReader.CLASSFILE_ATTRIBUTES);
                        if (reader != null) {
                            // this name is slash-delimited
                            String qualifiedName = new String(reader.getClassName());
                            boolean hasBlockingErrors = false;
                            try {
                                // If the user doesn't want to replace
                                // classfiles containing
                                // compilation errors, get the source
                                // file associated with
                                // the class file and query it for
                                // compilation errors
                                IJavaProject pro = JavaCore.create(resource.getProject());
                                ISourceAttribute sourceAttribute = reader.getSourceFileAttribute();
                                String sourceName = null;
                                if (sourceAttribute != null) {
                                    sourceName = new String(sourceAttribute.getSourceFileName());
                                }
                                IResource sourceFile = getSourceFile(pro, qualifiedName, sourceName);
                                if (sourceFile != null) {
                                    IMarker[] problemMarkers = null;
                                    problemMarkers = sourceFile.findMarkers(
                                            IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER, true,
                                            IResource.DEPTH_INFINITE);
                                    for (IMarker problemMarker : problemMarkers) {
                                        if (problemMarker.getAttribute(IMarker.SEVERITY,
                                                -1) == IMarker.SEVERITY_ERROR) {
                                            hasBlockingErrors = true;
                                            break;
                                        }
                                    }
                                }
                            } catch (CoreException e) {
                                logger.log(Level.SEVERE, "Failed to visit classes: " + e.getMessage(), e);
                            }
                            if (!hasBlockingErrors) {
                                changedFiles.add(resource);
                                // dot-delimit the name
                                fullyQualifiedNames.add(qualifiedName.replace('/', '.'));
                            }
                        }
                    }
                }
                return false;

            default:
                return true;
        }
    }
    return true;
}