<commit_before>package org.tigris.subversion.subclipse.ui.compare;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;

import org.eclipse.compare.ITypedElement;
import org.eclipse.compare.ResourceNode;
import org.eclipse.compare.structuremergeviewer.IStructureComparator;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.swt.widgets.Display;
import org.tigris.subversion.subclipse.core.ISVNFolder;
import org.tigris.subversion.subclipse.core.ISVNLocalFolder;
import org.tigris.subversion.subclipse.core.ISVNLocalResource;
import org.tigris.subversion.subclipse.core.ISVNRemoteResource;
import org.tigris.subversion.subclipse.core.SVNException;
import org.tigris.subversion.subclipse.ui.Policy;
import org.tigris.subversion.subclipse.ui.SVNUIPlugin;

/**
 * Node representing a local SVN file.  We can query the status of the resource to determine if
 * it has changed.  It is also used to write the contents back to the file when setContent is called.
 */
public class SVNLocalResourceNode extends ResourceNode {
	private final ISVNLocalResource svnResource;
	private ResourceEditionNode remoteResource = null;
	private ArrayList fChildren = null;
    
    public SVNLocalResourceNode(ISVNLocalResource svnResource) {
		super(svnResource.getIResource());
        this.svnResource = svnResource;
	}
	protected InputStream createStream() throws CoreException {
		return ((IFile)getResource()).getContents();
	}
	
    public ISVNLocalResource getLocalResource() {
        return svnResource;
    }
    public void setRemoteResource(ResourceEditionNode remote) {
    	remoteResource = remote;
    }
    
	//	@Override
	public String getName() {
		String name = null;
		try {
			ISVNRemoteResource baseResource = svnResource.getBaseResource();
			if (baseResource != null) {
				name = baseResource.getName();
			}
		} catch (SVNException e) {}
		
		if (name != null) {
			return name;
		}
		return super.getName();
	}
    
	// used by getContentsAction
	public void setContent(byte[] contents) {<commit_msg>Fix compare with branch/tag problem so that false differences are not shown when file name contains '+' Issue #: 1298<commit_after>package org.tigris.subversion.subclipse.ui.compare;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;

import org.eclipse.compare.ITypedElement;
import org.eclipse.compare.ResourceNode;
import org.eclipse.compare.structuremergeviewer.IStructureComparator;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.swt.widgets.Display;
import org.tigris.subversion.subclipse.core.ISVNFolder;
import org.tigris.subversion.subclipse.core.ISVNLocalFolder;
import org.tigris.subversion.subclipse.core.ISVNLocalResource;
import org.tigris.subversion.subclipse.ui.Policy;
import org.tigris.subversion.subclipse.ui.SVNUIPlugin;

/**
 * Node representing a local SVN file.  We can query the status of the resource to determine if
 * it has changed.  It is also used to write the contents back to the file when setContent is called.
 */
public class SVNLocalResourceNode extends ResourceNode {
	private final ISVNLocalResource svnResource;
	private ResourceEditionNode remoteResource = null;
	private ArrayList fChildren = null;
    
    public SVNLocalResourceNode(ISVNLocalResource svnResource) {
		super(svnResource.getIResource());
        this.svnResource = svnResource;
	}
	protected InputStream createStream() throws CoreException {
		return ((IFile)getResource()).getContents();
	}
	
    public ISVNLocalResource getLocalResource() {
        return svnResource;
    }
    public void setRemoteResource(ResourceEditionNode remote) {
    	remoteResource = remote;
    }
    
	//	@Override
	public String getName() {
		String name = svnResource.getName();
		if (name != null) {
			return name;
		}
		return super.getName();
	}
    
	// used by getContentsAction
	public void setContent(byte[] contents) {
{'fraction_non_alphanumeric': 0.08918740365558248, 'fraction_numerical': 0.0008808632459810614, 'mean_word_length': 4.9140625, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2150032', 'n_tokens_mistral': 1379, 'n_tokens_neox': 1323, 'n_words': 309}