<commit_before>package org.openlca.app.editors.graphical.model;

import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.GridData;
import org.eclipse.draw2d.GridLayout;
import org.eclipse.draw2d.Label;
import org.eclipse.swt.SWT;
import org.openlca.app.M;
import org.openlca.app.util.Labels;
import org.openlca.app.util.Numbers;
import org.openlca.app.util.UI;
import org.openlca.core.model.descriptors.Descriptor;
import org.openlca.core.model.descriptors.ProcessDescriptor;

class ExchangeFigure extends Figure {

	final ExchangeNode node;
	private final Label label;

	ExchangeFigure(ExchangeNode node) {
		this.node = node;
		var layout = new GridLayout(1, true);
		layout.marginWidth = 0;
		layout.marginHeight = 0;
		setLayoutManager(layout);
		label = new Label(node.getName());
		highlightQuantitativeReference(node);	
		setToolTip(new Label(tooltip()));
		add(label, new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
	}
	
	private void highlightQuantitativeReference(ExchangeNode exchangeNode) {
		if (exchangeNode.parent().process instanceof ProcessDescriptor p) {
			if (p.quantitativeReference == node.exchange.id)
				setHighlighted(true);
		}
	}<commit_msg>Fix creation of exchange figure for processes without quanitative reference<commit_after>package org.openlca.app.editors.graphical.model;

import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.GridData;
import org.eclipse.draw2d.GridLayout;
import org.eclipse.draw2d.Label;
import org.eclipse.swt.SWT;
import org.openlca.app.M;
import org.openlca.app.util.Labels;
import org.openlca.app.util.Numbers;
import org.openlca.app.util.UI;
import org.openlca.core.model.descriptors.Descriptor;
import org.openlca.core.model.descriptors.ProcessDescriptor;

class ExchangeFigure extends Figure {

	final ExchangeNode node;
	private final Label label;

	ExchangeFigure(ExchangeNode node) {
		this.node = node;
		var layout = new GridLayout(1, true);
		layout.marginWidth = 0;
		layout.marginHeight = 0;
		setLayoutManager(layout);
		label = new Label(node.getName());
		highlightQuantitativeReference(node);
		setToolTip(new Label(tooltip()));
		add(label, new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
	}

	private void highlightQuantitativeReference(ExchangeNode exchangeNode) {
		if (exchangeNode.parent().process instanceof ProcessDescriptor p
		&& p.quantitativeReference != null) {
			if (p.quantitativeReference == node.exchange.id)
				setHighlighted(true);
		}
	}
{'fraction_non_alphanumeric': 0.11287128712871287, 'fraction_numerical': 0.007920792079207921, 'mean_word_length': 5.36272040302267, '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': '1794571', 'n_tokens_mistral': 871, 'n_tokens_neox': 809, 'n_words': 167}