<commit_before>//
// OrcAnnotationHover.java -- Java class OrcAnnotationHover
// Project OrcEclipse
//
// $Id$
//
// Created by jthywiss on Aug 26, 2009.
//
// Copyright (c) 2009 The University of Texas at Austin. All rights reserved.
//
// Use and redistribution of this file is governed by the license terms in
// the LICENSE file found in the project's top-level directory and also found at
// URL: http://orc.csres.utexas.edu/license.shtml .
//

package edu.utexas.cs.orc.orceclipse.edit;

import java.util.List;

import org.eclipse.imp.editor.AnnotationHoverBase;
import org.eclipse.jface.text.source.Annotation;
import org.eclipse.imp.services.IAnnotationHover;
import org.eclipse.jface.text.source.ISourceViewer;

/**
 * Provides the text for a hover over an annotation in the editor.
 * <p>
 * This subclass exists solely to fix IMP bugs.
 *
 * @author jthywiss
 */
public class OrcAnnotationHover extends AnnotationHoverBase implements IAnnotationHover {

	/* (non-Javadoc)
	 * @see org.eclipse.imp.editor.AnnotationHoverBase#getHoverInfo(org.eclipse.jface.text.source.ISourceViewer, int)
	 */
	@Override
	public String getHoverInfo(ISourceViewer sourceViewer, int lineNumber) {
        List<Annotation> srcAnnotations= getSourceAnnotationsForLine(sourceViewer, lineNumber);
        
        for (Annotation annotation : srcAnnotations) {
        	if (annotation.getType().startsWith("org.eclipse.ui.workbench.texteditor.quickdiff")) {
        		srcAnnotations.remove(annotation);
        	}
        }

        return formatAnnotationList(srcAnnotations);
	}

}<commit_msg>Eliminate repeated annotation hover text items<commit_after>//
// OrcAnnotationHover.java -- Java class OrcAnnotationHover
// Project OrcEclipse
//
// $Id$
//
// Created by jthywiss on Aug 26, 2009.
//
// Copyright (c) 2009 The University of Texas at Austin. All rights reserved.
//
// Use and redistribution of this file is governed by the license terms in
// the LICENSE file found in the project's top-level directory and also found at
// URL: http://orc.csres.utexas.edu/license.shtml .
//

package edu.utexas.cs.orc.orceclipse.edit;

import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import org.eclipse.imp.editor.AnnotationHoverBase;
import org.eclipse.jface.text.source.Annotation;
import org.eclipse.imp.services.IAnnotationHover;
import org.eclipse.jface.text.source.ISourceViewer;

/**
 * Provides the text for a hover over an annotation in the editor.
 * <p>
 * This subclass exists solely to fix IMP bugs.
 *
 * @author jthywiss
 */
public class OrcAnnotationHover extends AnnotationHoverBase implements IAnnotationHover {

	/* (non-Javadoc)
	 * @see org.eclipse.imp.editor.AnnotationHoverBase#getHoverInfo(org.eclipse.jface.text.source.ISourceViewer, int)
	 */
	@Override
	public String getHoverInfo(ISourceViewer sourceViewer, int lineNumber) {
        List<Annotation> srcAnnotations= getSourceAnnotationsForLine(sourceViewer, lineNumber);
        
        Set<String> annotationMessages = new HashSet<String>();
        for (Iterator<Annotation> annoIter = srcAnnotations.iterator(); annoIter.hasNext(); ) {
        	Annotation annotation = annoIter.next();
        	if (annotation.getType().startsWith("org.eclipse.ui.workbench.texteditor.quickdiff")) {
        		annoIter.remove();
        	} else if (annotationMessages.contains(annotation.getText())) {
        		annoIter.remove();
        	} else {
        		annotationMessages.add(annotation.getText());
        	}
        }

        return formatAnnotationList(srcAnnotations);
	}

}
{'fraction_non_alphanumeric': 0.1078896013381656, 'fraction_numerical': 0.005575689991636465, 'mean_word_length': 3.635658914728682, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, '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': '5397601', 'n_tokens_mistral': 1113, 'n_tokens_neox': 1067, 'n_words': 267}