/** * Returns the resource for the specified path. * * @param path the path for which the resource should be returned * @return the resource specified by the path or <code>null</code> */ protected IResource findResource(IPath path) { IWorkspace workspace= ResourcesPlugin.getWorkspace(); IStatus result= workspace.validatePath( path.toString(), IResource.ROOT | IResource.PROJECT | IResource.FOLDER | IResource.FILE); if (result.isOK() && workspace.getRoot().exists(path)) return workspace.getRoot().findMember(path); return null; }
/** * Returns the resource for the specified path. * * @param path the path for which the resource should be returned * @return the resource specified by the path or <code>null</code> */ protected IResource findResource(IPath path) { IWorkspace workspace= ResourcesPlugin.getWorkspace(); IStatus result= workspace.validatePath( path.toString(), IResource.ROOT | IResource.PROJECT | IResource.FOLDER | IResource.FILE); if (result.isOK() && workspace.getRoot().exists(path)) return workspace.getRoot().findMember(path); return null; }
/** * Returns the resource for the specified path. * * @param path the path for which the resource should be returned * @return the resource specified by the path or <code>null</code> */ protected IResource findResource(IPath path) { IWorkspace workspace= ResourcesPlugin.getWorkspace(); IStatus result= workspace.validatePath( path.toString(), IResource.ROOT | IResource.PROJECT | IResource.FOLDER | IResource.FILE); if (result.isOK() && workspace.getRoot().exists(path)) return workspace.getRoot().findMember(path); return null; }
/** * Returns the resource for the specified path. * * @param path the path for which the resource should be returned * @return the resource specified by the path or <code>null</code> */ protected IResource findResource(IPath path) { IWorkspace workspace= ResourcesPlugin.getWorkspace(); IStatus result= workspace.validatePath( path.toString(), IResource.ROOT | IResource.PROJECT | IResource.FOLDER | IResource.FILE); if (result.isOK() && workspace.getRoot().exists(path)) return workspace.getRoot().findMember(path); return null; }
/** * Returns the resource for the specified path. * * @param path the path for which the resource should be returned * @return the resource specified by the path or <code>null</code> */ protected IResource findResource(IPath path) { IWorkspace workspace= JavaPlugin.getWorkspace(); IStatus result= workspace.validatePath( path.toString(), IResource.ROOT | IResource.PROJECT | IResource.FOLDER | IResource.FILE); if (result.isOK() && workspace.getRoot().exists(path)) return workspace.getRoot().findMember(path); return null; }
/** * Returns the resource for the specified path. * * @param path the path for which the resource should be returned * @return the resource specified by the path or <code>null</code> */ protected IResource findResource(IPath path) { IWorkspace workspace= JavaPlugin.getWorkspace(); IStatus result= workspace.validatePath( path.toString(), IResource.ROOT | IResource.PROJECT | IResource.FOLDER | IResource.FILE); if (result.isOK() && workspace.getRoot().exists(path)) return workspace.getRoot().findMember(path); return null; } }
/** * Returns the resource for the specified path. * * @param path the path for which the resource should be returned * @return the resource specified by the path or <code>null</code> */ protected IResource findResource(IPath path) { IWorkspace workspace= JavaPlugin.getWorkspace(); IStatus result= workspace.validatePath( path.toString(), IResource.ROOT | IResource.PROJECT | IResource.FOLDER | IResource.FILE); if (result.isOK() && workspace.getRoot().exists(path)) return workspace.getRoot().findMember(path); return null; }
/** * Returns the resource for the specified path. * * @param path the path for which the resource should be returned * @return the resource specified by the path or <code>null</code> */ protected IResource findResource(IPath path) { IWorkspace workspace= JavaPlugin.getWorkspace(); IStatus result= workspace.validatePath( path.toString(), IResource.ROOT | IResource.PROJECT | IResource.FOLDER | IResource.FILE); if (result.isOK() && workspace.getRoot().exists(path)) return workspace.getRoot().findMember(path); return null; }
/** * Returns the resource for the specified path. * * @param path the path for which the resource should be returned * @return the resource specified by the path or <code>null</code> */ protected IResource findResource(IPath path) { IWorkspace workspace= JavaPlugin.getWorkspace(); IStatus result= workspace.validatePath( path.toString(), IResource.ROOT | IResource.PROJECT | IResource.FOLDER | IResource.FILE); if (result.isOK() && workspace.getRoot().exists(path)) return workspace.getRoot().findMember(path); return null; } }
/** * Returns the resource for the specified path. * * @param path the path for which the resource should be returned * @return the resource specified by the path or <code>null</code> */ protected IResource findResource(IPath path) { IWorkspace workspace= JavaPlugin.getWorkspace(); IStatus result= workspace.validatePath( path.toString(), IResource.ROOT | IResource.PROJECT | IResource.FOLDER | IResource.FILE); if (result.isOK() && workspace.getRoot().exists(path)) return workspace.getRoot().findMember(path); return null; } }
/** * Returns the resource for the specified path. * * @param path the path for which the resource should be returned * @return the resource specified by the path or <code>null</code> */ protected IResource findResource(IPath path) { IWorkspace workspace= JavaPlugin.getWorkspace(); IStatus result= workspace.validatePath( path.toString(), IResource.ROOT | IResource.PROJECT | IResource.FOLDER | IResource.FILE); if (result.isOK() && workspace.getRoot().exists(path)) return workspace.getRoot().findMember(path); return null; } }
/** * Returns the resource for the specified path. * * @param path the path for which the resource should be returned * @return the resource specified by the path or <code>null</code> */ protected IResource findResource(IPath path) { IWorkspace workspace= JavaPlugin.getWorkspace(); IStatus result= workspace.validatePath( path.toString(), IResource.ROOT | IResource.PROJECT | IResource.FOLDER | IResource.FILE); if (result.isOK() && workspace.getRoot().exists(path)) return workspace.getRoot().findMember(path); return null; }
/** * Returns the resource object specified in the resource name entry field, * or <code>null</code> if such a resource does not exist in the workbench. * * @return the resource specified in the resource name entry field, or * <code>null</code> */ protected IResource getSourceResource() { IWorkspace workspace = IDEWorkbenchPlugin.getPluginWorkspace(); //make the path absolute to allow for optional leading slash IPath testPath = getResourcePath(); IStatus result = workspace.validatePath(testPath.toString(), IResource.ROOT | IResource.PROJECT | IResource.FOLDER | IResource.FILE); if (result.isOK() && workspace.getRoot().exists(testPath)) { return workspace.getRoot().findMember(testPath); } return null; }
/** * Validates the given string as a path for a file in this container. * * @param name path name * @return <code>true</code> if the path is valid <code>false</code> otherwise */ private boolean validateFile(String name) { IContainer container = getContainer(); IPath path = container.getFullPath().append(name); return ResourcesPlugin.getWorkspace().validatePath(path.toOSString(), IResource.FILE).isOK(); }
private RefactoringStatus checkNewPathValidity() { IContainer c= fType.getCompilationUnit().getResource().getParent(); String notRename= RefactoringCoreMessages.RenameTypeRefactoring_will_not_rename; IStatus status= c.getWorkspace().validateName(getNewElementName(), IResource.FILE); if (status.getSeverity() == IStatus.ERROR) return RefactoringStatus.createWarningStatus(status.getMessage() + ". " + notRename); //$NON-NLS-1$ status= c.getWorkspace().validatePath(createNewPath(getNewElementName()), IResource.FILE); if (status.getSeverity() == IStatus.ERROR) return RefactoringStatus.createWarningStatus(status.getMessage() + ". " + notRename); //$NON-NLS-1$ return new RefactoringStatus(); }
private RefactoringStatus checkNewPathValidity() { IContainer c = fType.getCompilationUnit().getResource().getParent(); String notRename = RefactoringCoreMessages.RenameTypeRefactoring_will_not_rename; IStatus status = c.getWorkspace().validateName(getNewElementName(), IResource.FILE); if (status.getSeverity() == IStatus.ERROR) { return RefactoringStatus.createWarningStatus(status.getMessage() + ". " + notRename); //$NON-NLS-1$ } status = c.getWorkspace().validatePath(createNewPath(getNewElementName()), IResource.FILE); if (status.getSeverity() == IStatus.ERROR) { return RefactoringStatus.createWarningStatus(status.getMessage() + ". " + notRename); //$NON-NLS-1$ } return new RefactoringStatus(); }
private RefactoringStatus checkNewPathValidity() { IContainer c= fType.getCompilationUnit().getResource().getParent(); String notRename= RefactoringCoreMessages.RenameTypeRefactoring_will_not_rename; IStatus status= c.getWorkspace().validateName(getNewElementName(), IResource.FILE); if (status.getSeverity() == IStatus.ERROR) return RefactoringStatus.createWarningStatus(status.getMessage() + ". " + notRename); //$NON-NLS-1$ status= c.getWorkspace().validatePath(createNewPath(getNewElementName()), IResource.FILE); if (status.getSeverity() == IStatus.ERROR) return RefactoringStatus.createWarningStatus(status.getMessage() + ". " + notRename); //$NON-NLS-1$ return new RefactoringStatus(); }
private RefactoringStatus checkNewPathValidity() { IContainer c= fType.getCompilationUnit().getResource().getParent(); String notRename= RefactoringCoreMessages.RenameTypeRefactoring_will_not_rename; IStatus status= c.getWorkspace().validateName(getNewElementName(), IResource.FILE); if (status.getSeverity() == IStatus.ERROR) return RefactoringStatus.createWarningStatus(status.getMessage() + ". " + notRename); //$NON-NLS-1$ status= c.getWorkspace().validatePath(createNewPath(getNewElementName()), IResource.FILE); if (status.getSeverity() == IStatus.ERROR) return RefactoringStatus.createWarningStatus(status.getMessage() + ". " + notRename); //$NON-NLS-1$ return new RefactoringStatus(); }
public RefactoringStatus checkNewElementName(String newName) throws JavaModelException { Assert.isNotNull(newName, "new name"); //$NON-NLS-1$ IContainer c= fResource.getParent(); if (c == null) return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.RenameResourceRefactoring_Internal_Error); if (c.findMember(newName) != null) return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.RenameResourceRefactoring_alread_exists); if (!c.getFullPath().isValidSegment(newName)) return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.RenameResourceRefactoring_invalidName); RefactoringStatus result= RefactoringStatus.create(c.getWorkspace().validateName(newName, fResource.getType())); if (!result.hasFatalError()) result.merge(RefactoringStatus.create(c.getWorkspace().validatePath(createNewPath(newName), fResource.getType()))); return result; }
public RefactoringStatus checkNewElementName(String newName) { Assert.isNotNull(newName, "new name"); //$NON-NLS-1$ IContainer c= fResource.getParent(); if (c == null) return RefactoringStatus.createFatalErrorStatus(RefactoringMessages.getString("RenameResourceRefactoring.Internal_Error")); //$NON-NLS-1$ if (c.findMember(newName) != null) return RefactoringStatus.createFatalErrorStatus(RefactoringMessages.getString("RenameResourceRefactoring.alread_exists")); //$NON-NLS-1$ if (!c.getFullPath().isValidSegment(newName)) return RefactoringStatus.createFatalErrorStatus(RefactoringMessages.getString("RenameResourceRefactoring.invalidName")); //$NON-NLS-1$ RefactoringStatus result= RefactoringStatus.create(c.getWorkspace().validateName(newName, fResource.getType())); if (! result.hasFatalError()) result.merge(RefactoringStatus.create(c.getWorkspace().validatePath(createNewPath(newName), fResource.getType()))); return result; }