<commit_before>package de.tudresden.slr.utils.quickfix;

import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.ui.IMarkerResolution;
import org.eclipse.ui.IMarkerResolutionGenerator;

public class QuickFixGenerator implements IMarkerResolutionGenerator {
	
	public IMarkerResolution[] getResolutions(IMarker marker) {
		String nodeName = "#child#";
		String subtermNote = "";
		IMarkerResolution[] iMarkerResolution;
		try {
			String[] path = ((String) marker.getAttribute("PATH")).split("/");
			nodeName = path[path.length-1];
			if (path.length > 2) {
				subtermNote = "  (As subterm of "+path[path.length-2]+")";
			}
		} catch (CoreException e) {
			System.out.println("Error getting PATH attribute of marker.");
			e.printStackTrace();
		}

		iMarkerResolution = new IMarkerResolution[] {
				new QuickFix(
						"Add '"+nodeName+"' to taxonomy."+subtermNote,
						QuickFix.ADD_TO_TAXONOMY
				),
				new QuickFix(
						"Delete '"+nodeName+"' from document taxonomy."+subtermNote,
						QuickFix.DELETE_FROM_FILE
				)
		};
		
		// if move match found, add third quickfix
		try {
			String[] path = ((String) marker.getAttribute("PATH")).split("/");
			String[] path2 = ((String) marker.getAttribute("PATH2")).split("/");
			if (path2.length > 1 && !path[1].isEmpty()) {
				iMarkerResolution = new IMarkerResolution[] {
						new QuickFix(
								"Add '"+nodeName+"' to taxonomy."+subtermNote,
								QuickFix.ADD_TO_TAXONOMY
						),
						new QuickFix(
								"Delete '"+nodeName+"' from document taxonomy."+subtermNote,
								QuickFix.DELETE_FROM_FILE
						),
						new QuickFix(
								"Correct path from '"+((String) marker.getAttribute("PATH"))+"' to '"+((String) marker.getAttribute("PATH2"))+"'",
								QuickFix.MATCH_TAXONOMY
						)
				};
			}
		} catch (CoreException e) {<commit_msg>Adjust quickfix label<commit_after>package de.tudresden.slr.utils.quickfix;

import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.ui.IMarkerResolution;
import org.eclipse.ui.IMarkerResolutionGenerator;

public class QuickFixGenerator implements IMarkerResolutionGenerator {
	
	public IMarkerResolution[] getResolutions(IMarker marker) {
		String nodeName = "#child#";
		String subtermNote = "";
		IMarkerResolution[] iMarkerResolution;
		try {
			String[] path = ((String) marker.getAttribute("PATH")).split("/");
			nodeName = path[path.length-1];
			if (path.length > 2) {
				subtermNote = "  (As subterm of "+path[path.length-2]+")";
			}
		} catch (CoreException e) {
			System.out.println("Error getting PATH attribute of marker.");
			e.printStackTrace();
		}

		iMarkerResolution = new IMarkerResolution[] {
				new QuickFix(
						"Add '"+nodeName+"' to taxonomy."+subtermNote,
						QuickFix.ADD_TO_TAXONOMY
				),
				new QuickFix(
						"Delete '"+nodeName+"' from document classification."+subtermNote,
						QuickFix.DELETE_FROM_FILE
				)
		};
		
		// if move match found, add third quickfix
		try {
			String[] path = ((String) marker.getAttribute("PATH")).split("/");
			String[] path2 = ((String) marker.getAttribute("PATH2")).split("/");
			if (path2.length > 1 && !path[1].isEmpty()) {
				iMarkerResolution = new IMarkerResolution[] {
						new QuickFix(
								"Add '"+nodeName+"' to taxonomy."+subtermNote,
								QuickFix.ADD_TO_TAXONOMY
						),
						new QuickFix(
								"Delete '"+nodeName+"' from document classification."+subtermNote,
								QuickFix.DELETE_FROM_FILE
						),
						new QuickFix(
								"Correct path in document classification.\n"+
										"('"+((String) marker.getAttribute("PATH"))+"' to '"+((String) marker.getAttribute("PATH2"))+"')",
								QuickFix.MATCH_TAXONOMY
						)
				};
			}
		} catch (CoreException e) {
{'fraction_non_alphanumeric': 0.1465018411362441, 'fraction_numerical': 0.004734350341925302, 'mean_word_length': 3.5874547647768398, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '7664811', 'n_tokens_mistral': 1512, 'n_tokens_neox': 1193, 'n_words': 246}