@Override public boolean isValidSegment(String segment) { return isValidSegment(segment, (flags & IS_FOR_WINDOWS) != 0); }
@Override public boolean isValidSegment(String segment) { return isValidSegment(segment, (flags & IS_FOR_WINDOWS) != 0); }
/** * Returns whether the given string is valid as a segment in a path on a * POSIX file system. The rules for valid segments are as follows: * <ul> * <li>the empty string is not valid * <li>any string containing the slash character ('/') is not valid * </ul> * * @param segment the path segment to check * @return <code>true</code> if the given path segment is valid, * and <code>false</code> otherwise * @since 3.7 */ public static boolean isValidPosixSegment(String segment) { return isValidSegment(segment, false); }
/** * Returns whether the given string is valid as a segment in a path on a * POSIX file system. The rules for valid segments are as follows: * <ul> * <li>the empty string is not valid * <li>any string containing the slash character ('/') is not valid * </ul> * * @param segment the path segment to check * @return <code>true</code> if the given path segment is valid, * and <code>false</code> otherwise * @since 3.7 */ public static boolean isValidPosixSegment(String segment) { return isValidSegment(segment, false); }
/** * Returns whether the given string is valid as a segment in a path on the * Windows file system. The rules for valid segments are as follows: * <ul> * <li>the empty string is not valid * <li>any string containing the slash character ('/') is not valid * <li>any string containing segment ('\') or device (':') separator * characters is not valid * </ul> * * @param segment the path segment to check * @return <code>true</code> if the given path segment is valid, * and <code>false</code> otherwise * @since 3.7 */ public static boolean isValidWindowsSegment(String segment) { return isValidSegment(segment, true); }
/** * Returns whether the given string is valid as a segment in a path on the * Windows file system. The rules for valid segments are as follows: * <ul> * <li>the empty string is not valid * <li>any string containing the slash character ('/') is not valid * <li>any string containing segment ('\') or device (':') separator * characters is not valid * </ul> * * @param segment the path segment to check * @return <code>true</code> if the given path segment is valid, * and <code>false</code> otherwise * @since 3.7 */ public static boolean isValidWindowsSegment(String segment) { return isValidSegment(segment, true); }
/** * Returns a <code>boolean</code> indicating whether the resource name rep- resents a valid resource name in the * workbench. An error message is stored for future reference if the name does not represent a valid resource name. * * @return <code>boolean</code> indicating validity of the resource name */ protected boolean validateResourceName() { String resourceName = _resourceNameField.getText(); if (resourceName.equals("")) { //$NON-NLS-1$ _problemType = PROBLEM_RESOURCE_EMPTY; _problemMessage = NLS.bind(Messages.ResourceGroup_emptyName, _resourceType ); //$NON-NLS-1$ return false; } if (!(new Path("")).isValidSegment(resourceName)) { //$NON-NLS-1$ _problemType = PROBLEM_NAME_INVALID; _problemMessage = NLS.bind(Messages .ResourceGroup_invalidFilename, resourceName ); //$NON-NLS-1$ return false; } return true; }
public boolean isValidPath(String path) { Path test = new Path(path); for (int i = 0, max = test.segmentCount(); i < max; i++) if (!isValidSegment(test.segment(i))) return false; return true; }
public boolean isValidPath(String path) { Path test = new Path(path); for (int i = 0, max = test.segmentCount(); i < max; i++) if (!isValidSegment(test.segment(i))) return false; return true; }
/** * Returns whether the given string is syntactically correct as a path on * the specified file system. The device id is the prefix up to and * including the device separator for the specified file system; the path * proper is everything to the right of it, or the entire string if there is * no device separator. When the specified platform is a file system with no * meaningful device separator, the entire string is treated as the path * proper. The device id is not checked for validity; the path proper is * correct if each of the segments in its canonicalized form is valid. * * @param path the path to check * @param forWindows true if the path is for the Windows file system * @return <code>true</code> if the given string is a valid path, * and <code>false</code> otherwise * @see #isValidSegment(String, boolean) * @since 3.7 */ private static boolean isValidPath(String path, boolean forWindows) { Path test = new Path(path, forWindows); for (int i = 0, max = test.segmentCount(); i < max; i++) if (!Path.isValidSegment(test.segment(i), forWindows)) return false; return true; }
/** * Returns whether the given string is syntactically correct as a path on * the specified file system. The device id is the prefix up to and * including the device separator for the specified file system; the path * proper is everything to the right of it, or the entire string if there is * no device separator. When the specified platform is a file system with no * meaningful device separator, the entire string is treated as the path * proper. The device id is not checked for validity; the path proper is * correct if each of the segments in its canonicalized form is valid. * * @param path the path to check * @param forWindows true if the path is for the Windows file system * @return <code>true</code> if the given string is a valid path, * and <code>false</code> otherwise * @see #isValidSegment(String, boolean) * @since 3.7 */ private static boolean isValidPath(String path, boolean forWindows) { Path test = new Path(path, forWindows); for (int i = 0, max = test.segmentCount(); i < max; i++) if (!Path.isValidSegment(test.segment(i), forWindows)) return false; return true; }
private StatusInfo nameUpdated() { StatusInfo status= new StatusInfo(); String name= fNameField.getText(); if (name.length() == 0) { status.setError(NewWizardMessages.VariableCreationDialog_error_entername); return status; } if (name.trim().length() != name.length()) { status.setError(NewWizardMessages.VariableCreationDialog_error_whitespace); } else if (!Path.ROOT.isValidSegment(name)) { status.setError(NewWizardMessages.VariableCreationDialog_error_invalidname); } else if (nameConflict(name)) { status.setError(NewWizardMessages.VariableCreationDialog_error_nameexists); } return status; }
private StatusInfo nameUpdated() { StatusInfo status= new StatusInfo(); String name= fNameField.getText(); if (name.length() == 0) { status.setError(NewWizardMessages.VariableCreationDialog_error_entername); return status; } if (name.trim().length() != name.length()) { status.setError(NewWizardMessages.VariableCreationDialog_error_whitespace); } else if (!Path.ROOT.isValidSegment(name)) { status.setError(NewWizardMessages.VariableCreationDialog_error_invalidname); } else if (nameConflict(name)) { status.setError(NewWizardMessages.VariableCreationDialog_error_nameexists); } return status; }
private StatusInfo nameUpdated() { StatusInfo status= new StatusInfo(); String name= fNameField.getText(); if (name.length() == 0) { status.setError(NewWizardMessages.VariableCreationDialog_error_entername); return status; } if (name.trim().length() != name.length()) { status.setError(NewWizardMessages.VariableCreationDialog_error_whitespace); } else if (!Path.ROOT.isValidSegment(name)) { status.setError(NewWizardMessages.VariableCreationDialog_error_invalidname); } else if (nameConflict(name)) { status.setError(NewWizardMessages.VariableCreationDialog_error_nameexists); } return status; }
case IResource.PROJECT: pathStr = path.makeRelative().toPortableString(); if(Path.ROOT.isValidSegment(pathStr)) { res = root.getProject(pathStr);
IResource resource = null; String pname = candidate.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, EMPTY_STRING); if(Path.ROOT.isValidSegment(pname)) { IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(pname); String tname = candidate.getAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, EMPTY_STRING);
IResource resource = null; String pname = candidate.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, EMPTY_STRING); if(Path.ROOT.isValidSegment(pname)) { IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(pname); String tname = candidate.getAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, EMPTY_STRING);
if (containerHandle != null && containerHandle.length() > 0) { element = JavaCore.create(containerHandle); } else if (projName != null && Path.ROOT.isValidSegment(projName)) { IJavaProject javaProject = getJavaModel().getJavaProject(projName); if (javaProject.exists()) {
if (containerHandle != null && containerHandle.length() > 0) { element = JavaCore.create(containerHandle); } else if (projName != null && Path.ROOT.isValidSegment(projName)) { IJavaProject javaProject = getJavaModel().getJavaProject(projName); if (javaProject.exists()) {
if (node.existsInFileSystem() && !Path.EMPTY.isValidSegment(node.getLocalName())) { String message = NLS.bind(Messages.resources_invalidResourceName, node.getLocalName()); errors.merge(new ResourceStatus(IResourceStatus.INVALID_RESOURCE_NAME, message));