<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
 *******************************************************************************/
/*
 * Created on Apr 12, 2005
  */
package org.eclipse.mylar.ui;

import org.eclipse.jface.viewers.*;
import org.eclipse.mylar.core.IMylarStructureBridge;
import org.eclipse.mylar.core.MylarPlugin;
import org.eclipse.mylar.core.model.ITaskscapeNode;
import org.eclipse.mylar.core.model.internal.TaskscapeEdge;
import org.eclipse.mylar.ui.internal.UiUtil;


/**
 * @author <NAME>
 */
public class InterestDecoratorLightweight implements ILightweightLabelDecorator {

    public InterestDecoratorLightweight() {
        super();
    }

    public void decorate(Object element, IDecoration decoration) {
        try {
            ITaskscapeNode node = null;
            IMylarStructureBridge adapter = MylarPlugin.getDefault().getStructureBridge(element);
            if (element instanceof TaskscapeEdge) {
                decoration.setForegroundColor(MylarUiPlugin.getDefault().getColorMap().RELATIONSHIP);
            } else  if (element instanceof ITaskscapeNode) {
                node = (ITaskscapeNode)element;
            } else {
                if (adapter != null && adapter.getResourceExtension() != null) {
                    node = MylarPlugin.getTaskscapeManager().getNode(adapter.getHandleIdentifier(element));
                }
            }
            if (node != null) {
                decoration.setBackgroundColor(UiUtil.getBackgroundForElement(node));
                decoration.setForegroundColor(UiUtil.getForegroundForElement(node));      
                if (adapter != null && adapter.canBeLandmark(element) 
                    && node.getDegreeOfInterest().isLandmark() 
                    && !node.getDegreeOfInterest().isPredicted()) {
                    decoration.setFont(UiUtil.BOLD);
                } 
            } 
        } catch (Exception e) {
        	MylarPlugin.log(e, "decoration failed");
        }
    } 
  
    public void addListener(ILabelProviderListener listener) {
    	// don't care about listeners
    }

    public void dispose() {
    	// don't care when we are disposed
    }
<commit_msg>Fixed ConcurrentModificationException<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
 *******************************************************************************/
/*
 * Created on Apr 12, 2005
  */
package org.eclipse.mylar.ui;

import java.util.ConcurrentModificationException;

import org.eclipse.jface.viewers.*;
import org.eclipse.mylar.core.IMylarStructureBridge;
import org.eclipse.mylar.core.MylarPlugin;
import org.eclipse.mylar.core.model.ITaskscapeNode;
import org.eclipse.mylar.core.model.internal.TaskscapeEdge;
import org.eclipse.mylar.ui.internal.UiUtil;


/**
 * @author <NAME>
 */
public class InterestDecoratorLightweight implements ILightweightLabelDecorator {

    public InterestDecoratorLightweight() {
        super();
    }

    public void decorate(Object element, IDecoration decoration) {
    	IMylarStructureBridge adapter = null;
    	try {
    		adapter = MylarPlugin.getDefault().getStructureBridge(element);
	    } catch (ConcurrentModificationException cme) {
	    	// ignored, because we can add structure bridges during decoration
	    }
    	try {
    		ITaskscapeNode node = null;
            if (element instanceof TaskscapeEdge) {
                decoration.setForegroundColor(MylarUiPlugin.getDefault().getColorMap().RELATIONSHIP);
            } else  if (element instanceof ITaskscapeNode) {
                node = (ITaskscapeNode)element;
            } else {
                if (adapter != null && adapter.getResourceExtension() != null) {
                    node = MylarPlugin.getTaskscapeManager().getNode(adapter.getHandleIdentifier(element));
                }
            }
            if (node != null) {
                decoration.setBackgroundColor(UiUtil.getBackgroundForElement(node));
                decoration.setForegroundColor(UiUtil.getForegroundForElement(node));      
                if (adapter != null && adapter.canBeLandmark(element) 
                    && node.getDegreeOfInterest().isLandmark() 
                    && !node.getDegreeOfInterest().isPredicted()) {
                    decoration.setFont(UiUtil.BOLD);
                } 
            }
        } catch (Exception e) {
        	MylarPlugin.log(e, "decoration failed");
        }
    } 
  
    public void addListener(ILabelProviderListener listener) {
    	// don't care about listeners
    }

    public void dispose() {
    	// don't care when we are disposed
    }

{'fraction_non_alphanumeric': 0.1462882096069869, 'fraction_numerical': 0.006550218340611353, 'mean_word_length': 2.791034482758621, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '7664582', 'n_tokens_mistral': 1483, 'n_tokens_neox': 1392, 'n_words': 312}