<commit_before>/*******************************************************************************
 * Copyright (c) 2004 - 2005 University Of British Columbia and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     University Of British Columbia - initial API and implementation
 *******************************************************************************/

package org.eclipse.mylar.ui.internal;

import org.eclipse.mylar.core.IMylarElement;
import org.eclipse.mylar.core.MylarPlugin;
import org.eclipse.mylar.core.internal.CompositeContextElement;
import org.eclipse.mylar.core.internal.MylarContext;
import org.eclipse.mylar.core.internal.MylarContextManager;
import org.eclipse.mylar.core.internal.MylarContextElement;
import org.eclipse.mylar.ui.MylarUiPlugin;
import org.eclipse.mylar.ui.internal.views.Highlighter;
import org.eclipse.swt.graphics.Color;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.Workbench;

 
/**
 * @author <NAME>
 */
public class UiUtil {

    public static Color getBackgroundForElement(IMylarElement node) {
    	return getBackgroundForElement(node, false);
    }
	
    public static Color getBackgroundForElement(IMylarElement node, boolean resolveContextColor) {
        if (node == null) return null;
        if (!resolveContextColor && (node.getDegreeOfInterest().isPropagated() || node.getDegreeOfInterest().isPredicted())) {
        	return null;
        }
        
        IMylarElement dominantNode = null;
        boolean isMultiple = false;
        if (node instanceof CompositeContextElement) {
            CompositeContextElement compositeNode = (CompositeContextElement)node;
            if (compositeNode.getNodes().isEmpty()) return null;
            dominantNode = (IMylarElement)compositeNode.getNodes().toArray()[0];
            if (compositeNode.getNodes().size() > 1) isMultiple = true;
                
            for(IMylarElement concreteNode : compositeNode.getNodes()) {<commit_msg>Progress on Bugzilla Bug 109235: interest should be maintained across a refactoring<commit_after>/*******************************************************************************
 * Copyright (c) 2004 - 2005 University Of British Columbia and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     University Of British Columbia - initial API and implementation
 *******************************************************************************/

package org.eclipse.mylar.ui.internal;

import org.eclipse.mylar.core.IMylarElement;
import org.eclipse.mylar.core.MylarPlugin;
import org.eclipse.mylar.core.internal.CompositeContextElement;
import org.eclipse.mylar.core.internal.MylarContext;
import org.eclipse.mylar.core.internal.MylarContextManager;
import org.eclipse.mylar.core.internal.MylarContextElement;
import org.eclipse.mylar.ui.MylarUiPlugin;
import org.eclipse.mylar.ui.internal.views.Highlighter;
import org.eclipse.swt.graphics.Color;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.Workbench;

 
/**
 * @author <NAME>
 */
public class UiUtil {

    public static Color getBackgroundForElement(IMylarElement node) {
    	return getBackgroundForElement(node, false);
    }
	
    public static Color getBackgroundForElement(IMylarElement node, boolean force) {
        if (node == null) return null;
        if (!force && (node.getDegreeOfInterest().isPropagated() || node.getDegreeOfInterest().isPredicted())) {
        	return null;
        }
        
        IMylarElement dominantNode = null;
        boolean isMultiple = false;
        if (node instanceof CompositeContextElement) {
            CompositeContextElement compositeNode = (CompositeContextElement)node;
            if (compositeNode.getNodes().isEmpty()) return null;
            dominantNode = (IMylarElement)compositeNode.getNodes().toArray()[0];
            if (compositeNode.getNodes().size() > 1) isMultiple = true;
                
            for(IMylarElement concreteNode : compositeNode.getNodes()) {
{'fraction_non_alphanumeric': 0.15929009640666084, 'fraction_numerical': 0.007449605609114811, 'mean_word_length': 4.152370203160271, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '377827', 'n_tokens_mistral': 1251, 'n_tokens_neox': 1208, 'n_words': 283}