<commit_before>package org.carrot2.workbench.core.ui;

import java.io.StringWriter;
import java.net.URL;
import java.util.Locale;

import org.apache.commons.lang.StringEscapeUtils;
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;
import org.carrot2.core.*;
import org.carrot2.core.attribute.AttributeNames;
import org.carrot2.workbench.core.CorePlugin;
import org.carrot2.workbench.core.helpers.Utils;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.*;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.*;
import org.eclipse.ui.browser.IWorkbenchBrowserSupport;

public class DocumentListBrowser
{
    private Browser browser;
    private ISelectionListener postSelectionListener;
    private IWorkbenchSite site;

    public void init(IWorkbenchSite site, Composite parent)
    {
        this.site = site;
        browser = new Browser(parent, SWT.NONE);
        attachToPostSelection(site.getPage());
        attachToLocationChanging();
    }

    private void attachToPostSelection(final IWorkbenchPage page)
    {
        postSelectionListener = new ISelectionListener()
        {
            public void selectionChanged(IWorkbenchPart part, ISelection selection)
            {
                if (!selection.isEmpty() && selection instanceof IStructuredSelection)
                {
                    IStructuredSelection selected = (IStructuredSelection) selection;
                    if (selected.getFirstElement() instanceof Cluster)
                    {
                        if (selected.size() == 1)
                        {
                            updateBrowserText((Cluster) selected.getFirstElement());
                        }
                        else
                        {
                            clear();
                        }
                    }
                }
                if (selection.isEmpty())
                {
                    clear();
                }
            }
        };
        page.addPostSelectionListener(postSelectionListener);
        page.addPartListener(new IPartListener()<commit_msg>bug fixed - after activating the attributes view, documents list in the editor emptied<commit_after>package org.carrot2.workbench.core.ui;

import java.io.StringWriter;
import java.net.URL;
import java.util.Locale;

import org.apache.commons.lang.StringEscapeUtils;
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;
import org.carrot2.core.*;
import org.carrot2.core.attribute.AttributeNames;
import org.carrot2.workbench.core.CorePlugin;
import org.carrot2.workbench.core.helpers.Utils;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.*;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.*;
import org.eclipse.ui.browser.IWorkbenchBrowserSupport;

public class DocumentListBrowser
{
    private Browser browser;
    private ISelectionListener postSelectionListener;
    private IWorkbenchSite site;

    public void init(IWorkbenchSite site, Composite parent)
    {
        this.site = site;
        browser = new Browser(parent, SWT.NONE);
        attachToPostSelection(site.getPage());
        attachToLocationChanging();
    }

    private void attachToPostSelection(final IWorkbenchPage page)
    {
        postSelectionListener = new ISelectionListener()
        {
            public void selectionChanged(IWorkbenchPart part, ISelection selection)
            {
                if (!selection.isEmpty() && selection instanceof IStructuredSelection)
                {
                    IStructuredSelection selected = (IStructuredSelection) selection;
                    if (selected.getFirstElement() instanceof Cluster)
                    {
                        if (selected.size() == 1)
                        {
                            updateBrowserText((Cluster) selected.getFirstElement());
                        }
                        else
                        {
                            clear();
                        }
                    }
                }
            }
        };
        page.addPostSelectionListener(postSelectionListener);
        page.addPartListener(new IPartListener()
{'fraction_non_alphanumeric': 0.08520659387711411, 'fraction_numerical': 0.002569043031470777, 'mean_word_length': 2.2154163799036475, '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': '4945434', 'n_tokens_mistral': 1225, 'n_tokens_neox': 1165, 'n_words': 224}