<commit_before>package name.abuchen.portfolio.ui.views.columns;

import org.eclipse.jface.viewers.ColumnLabelProvider;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;

import name.abuchen.portfolio.model.Adaptor;
import name.abuchen.portfolio.model.Annotated;
import name.abuchen.portfolio.model.Named;
import name.abuchen.portfolio.ui.Images;
import name.abuchen.portfolio.ui.Messages;
import name.abuchen.portfolio.ui.util.viewers.Column;
import name.abuchen.portfolio.ui.util.viewers.ColumnViewerSorter;
import name.abuchen.portfolio.ui.util.viewers.StringEditingSupport;
import name.abuchen.portfolio.util.TextUtil;

public class NoteColumn extends Column
{
    public NoteColumn()
    {
        this("note"); //$NON-NLS-1$
    }

    public NoteColumn(String id)
    {
        super(id, Messages.ColumnNote, SWT.LEFT, 200);

        setLabelProvider(new ColumnLabelProvider()
        {
            @Override
            public String getText(Object e)
            {
                Annotated n = Adaptor.adapt(Annotated.class, e);
                if (n != null)
                    return n.getNote();

                Named n2 = Adaptor.adapt(Named.class, e);
                return n2 != null ? n2.getNote() : null;
            }

            @Override
            public Image getImage(Object e)
            {
                String note = getText(e);
                return note != null && note.length() > 0 ? Images.NOTE.image() : null;
            }

            @Override
            public String getToolTipText(Object e)
            {
                String note = getText(e);
                return note == null || note.isEmpty() ? null : TextUtil.wordwrap(note);
            }

        });
        setSorter(ColumnViewerSorter.create(Annotated.class, "note")); //$NON-NLS-1$
        new StringEditingSupport(Annotated.class, "note").attachTo(this); //$NON-NLS-1$
    }
}<commit_msg>For multi-line notes, show them as single line in the securities list<commit_after>package name.abuchen.portfolio.ui.views.columns;

import org.eclipse.jface.viewers.ColumnLabelProvider;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;

import name.abuchen.portfolio.model.Adaptor;
import name.abuchen.portfolio.model.Annotated;
import name.abuchen.portfolio.model.Named;
import name.abuchen.portfolio.ui.Images;
import name.abuchen.portfolio.ui.Messages;
import name.abuchen.portfolio.ui.util.viewers.Column;
import name.abuchen.portfolio.ui.util.viewers.ColumnViewerSorter;
import name.abuchen.portfolio.ui.util.viewers.StringEditingSupport;
import name.abuchen.portfolio.util.TextUtil;

public class NoteColumn extends Column
{
    public NoteColumn()
    {
        this("note"); //$NON-NLS-1$
    }

    public NoteColumn(String id)
    {
        super(id, Messages.ColumnNote, SWT.LEFT, 200);

        setLabelProvider(new ColumnLabelProvider()
        {
            @Override
            public String getText(Object e)
            {
                Annotated n = Adaptor.adapt(Annotated.class, e);
                if (n != null)
                {
                    String note = n.getNote();
                    if(note != null)
                    {
                        note = note.replace("\n", " "); 
                    }
                    return note; 
                }

                Named n2 = Adaptor.adapt(Named.class, e);
                return n2 != null ? n2.getNote() : null;
            }

            @Override
            public Image getImage(Object e)
            {
                String note = getText(e);
                return note != null && note.length() > 0 ? Images.NOTE.image() : null;
            }

            @Override
            public String getToolTipText(Object e)
            {
                String note = getText(e);
                return note == null || note.isEmpty() ? null : TextUtil.wordwrap(note);
            }

        });
        setSorter(ColumnViewerSorter.create(Annotated.class, "note")); //$NON-NLS-1$
        new StringEditingSupport(Annotated.class, "note").attachTo(this); //$NON-NLS-1$
    }
}
{'fraction_non_alphanumeric': 0.11425091352009745, 'fraction_numerical': 0.0048721071863581, 'mean_word_length': 1.9948942377826404, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6350074', 'n_tokens_mistral': 1272, 'n_tokens_neox': 1210, 'n_words': 224}