	private static IResource getResourceForElement(Object element) {
		if (element instanceof DiffChangeSet) {
			IResource[] resources = ((DiffChangeSet) element).getResources();
			if (resources.length > 0) {
				return resources[0];
			}
		} 
		if (element instanceof SynchronizeModelElement) {
			SynchronizeModelElement modelElement = (SynchronizeModelElement) element;
			IResource resource = modelElement.getResource();
			if (resource != null) {
				return resource;
			} else {
				IDiffElement[] elements = modelElement.getChildren();
				if (elements.length > 0) {
					if (elements[0] instanceof SynchronizeModelElement) {
						return ((SynchronizeModelElement) elements[0]).getResource();
					}
				}
			}
		} 
		if (element instanceof IAdaptable) {
			IAdaptable adaptable = (IAdaptable) element;
			IResourceVariant resourceVariant = (IResourceVariant) adaptable.getAdapter(IResourceVariant.class);
			if (resourceVariant != null && resourceVariant instanceof RemoteResource) {
				RemoteResource remoteResource = (RemoteResource) resourceVariant;
				String path = remoteResource.getRepositoryRelativePath();
				for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) {
					if (project.isAccessible()) {
						ICVSResource cvsResource = CVSWorkspaceRoot.getCVSFolderFor(project);
						try {
							if (cvsResource != null && path.startsWith(cvsResource.getRepositoryRelativePath())) {
								return project;
							}
						} catch (CVSException ex) {
						}
					}
				}
			}
		}
		return null;
	}

	private static IResource getResourceForElement(Object element) {
		if (element instanceof DiffChangeSet) {
			IResource[] resources = ((DiffChangeSet) element).getResources();
			if (resources.length > 0) {
				return resources[0];
			}
		} 
		if (element instanceof SynchronizeModelElement) {
			SynchronizeModelElement modelElement = (SynchronizeModelElement) element;
			IResource resource = modelElement.getResource();
			if (resource != null) {
				return resource;
			} else {
				IDiffElement[] elements = modelElement.getChildren();
				if (elements.length > 0) {
					if (elements[0] instanceof SynchronizeModelElement) {
						return ((SynchronizeModelElement) elements[0]).getResource();
					}
				}
			}
		} 
		if (element instanceof IAdaptable) {
			IAdaptable adaptable = (IAdaptable) element;
			IResourceVariant resourceVariant = (IResourceVariant) adaptable.getAdapter(IResourceVariant.class);
			if (resourceVariant != null && resourceVariant instanceof RemoteResource) {
				RemoteResource remoteResource = (RemoteResource) resourceVariant;
				String path = remoteResource.getRepositoryRelativePath();
				if (path != null) {
					for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) {
						if (project.isAccessible()) {
							ICVSResource cvsResource = CVSWorkspaceRoot.getCVSFolderFor(project);
							try {
								if (cvsResource != null && path.startsWith(cvsResource.getRepositoryRelativePath())) {
									return project;
								}
							} catch (CVSException ex) {
							}
						}
					}
				}
			}
		}
		return null;
	}
