Java Code Examples for org.eclipse.core.resources.IFolder#equals()

The following examples show how to use org.eclipse.core.resources.IFolder#equals() . 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: RenamePackageProcessor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public IResource getRefactoredResource(IResource element) {
	IFolder packageFolder= (IFolder) fPackage.getResource();
	if (packageFolder == null)
		return element;

	IContainer newPackageFolder= (IContainer) getNewPackage().getResource();

	if (packageFolder.equals(element))
		return newPackageFolder;

	IPath packagePath= packageFolder.getProjectRelativePath();
	IPath elementPath= element.getProjectRelativePath();

	if (packagePath.isPrefixOf(elementPath)) {
		if (fRenameSubpackages || (element instanceof IFile && packageFolder.equals(element.getParent()))) {
			IPath pathInPackage= elementPath.removeFirstSegments(packagePath.segmentCount());
			if (element instanceof IFile)
				return newPackageFolder.getFile(pathInPackage);
			else
				return newPackageFolder.getFolder(pathInPackage);
		}
	}
	return element;
}
 
Example 2
Source File: RenamePackageProcessor.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public IResource getRefactoredResource(IResource element) {
	IFolder packageFolder= (IFolder) fPackage.getResource();
	if (packageFolder == null) {
		return element;
	}

	IContainer newPackageFolder= (IContainer) getNewPackage().getResource();

	if (packageFolder.equals(element)) {
		return newPackageFolder;
	}

	IPath packagePath= packageFolder.getProjectRelativePath();
	IPath elementPath= element.getProjectRelativePath();

	if (packagePath.isPrefixOf(elementPath)) {
		if (fRenameSubpackages || (element instanceof IFile && packageFolder.equals(element.getParent()))) {
			IPath pathInPackage= elementPath.removeFirstSegments(packagePath.segmentCount());
			if (element instanceof IFile) {
				return newPackageFolder.getFile(pathInPackage);
			} else {
				return newPackageFolder.getFolder(pathInPackage);
			}
		}
	}
	return element;
}
 
Example 3
Source File: ReorgPolicyFactory.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
private boolean isChildOfOrEqualToAnyFolder(IResource resource) {
	for (int i= 0; i < fFolders.length; i++) {
		IFolder folder= fFolders[i];
		if (folder.equals(resource) || ParentChecker.isDescendantOf(resource, folder)) {
			return true;
		}
	}
	return false;
}
 
Example 4
Source File: ReorgPolicyFactory.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
private boolean isChildOfOrEqualToAnyFolder(IResource resource) {
	for (int i= 0; i < fPackageFragments.length; i++) {
		IFolder folder= (IFolder) fPackageFragments[i].getResource();
		if (folder.equals(resource) || ParentChecker.isDescendantOf(resource, folder)) {
			return true;
		}
	}
	return false;
}
 
Example 5
Source File: ReorgPolicyFactory.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private boolean isChildOfOrEqualToAnyFolder(IResource resource) {
	for (int i= 0; i < fFolders.length; i++) {
		IFolder folder= fFolders[i];
		if (folder.equals(resource) || ParentChecker.isDescendantOf(resource, folder))
			return true;
	}
	return false;
}
 
Example 6
Source File: ReorgPolicyFactory.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private boolean isChildOfOrEqualToAnyFolder(IResource resource) {
	for (int i= 0; i < fPackageFragments.length; i++) {
		IFolder folder= (IFolder) fPackageFragments[i].getResource();
		if (folder.equals(resource) || ParentChecker.isDescendantOf(resource, folder))
			return true;
	}
	return false;
}
 
Example 7
Source File: Repository.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private boolean belongToRepositoryStore(final IRepositoryStore<?> store, final IFile file) {
    final IFolder parentFolder = store.getResource();
    if (parentFolder == null) {
        return false;
    }
    IContainer current = file.getParent();
    while (current != null && !parentFolder.equals(current)) {
        current = current.getParent();
    }
    return current != null && parentFolder.equals(current);
}