<commit_before>package org.gemoc.gemoc_language_workbench.conf.presentation;

import org.eclipse.core.runtime.Assert;
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.jface.viewers.ContentViewer;
import org.eclipse.jface.viewers.IContentProvider;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;

public class GemocFormViewer extends ContentViewer {

	protected GemocXDSMLFormComposite viewControl;
	
	protected AdapterFactoryEditingDomain editingDomain;
	
	public GemocFormViewer(Composite parent) {
		createViewCrontrol(parent);
	}

	protected void createViewCrontrol(Composite parent){
		viewControl = new GemocXDSMLFormComposite(parent, SWT.NONE);
		//viewControl.initControl(this.getContentProvider());
		
	}
	
	@Override
	public Control getControl() {
		return viewControl;
	}

	@Override
	public ISelection getSelection() {
		// empty selection
		return new StructuredSelection();
	}

	@Override
	public void refresh() {
		// TODO Auto-generated method stub
		toString();
		
	}

	@Override
	public void setSelection(ISelection selection, boolean reveal) {
		// TODO Auto-generated method stub
		toString();
	}


    /**
     * This viewer's content provider, or <code>null</code> if none.
     */
    private IContentProvider contentProvider = null;
    
	 /**
     * Returns the content provider used by this viewer, 
     * or <code>null</code> if this view does not yet have a content
     * provider.
     * <p>
     * The <code>ContentViewer</code> implementation of this method returns the content
     * provider recorded is an internal state variable. 
     * Overriding this method is generally not required; 
     * however, if overriding in a subclass, 
     * <code>super.getContentProvider</code> must be invoked.
     * </p>
     *
     * @return the content provider, or <code>null</code> if none
     */
    public IContentProvider getContentProvider() {
        return contentProvider;
    }

	/**
     * Sets the content provider used by this viewer.
     * <p>
     * The <code>ContentViewer</code> implementation of this method records the 
     * content provider in an internal state variable.
     * Overriding this method is generally not required; 
     * however, if overriding in a subclass,
     * <code>super.setContentProvider</code> must be invoked.
     * </p>
     *
     * @param contentProvider the content provider
     * @see #getContentProvider
     */
    public void setContentProvider(IContentProvider contentProvider) {
        Assert.isNotNull(contentProvider);
        IContentProvider oldContentProvider = this.contentProvider;
        this.contentProvider = contentProvider;
        if (oldContentProvider != null) {
            Object currentInput = getInput();
            oldContentProvider.inputChanged(this, currentInput, null);
            oldContentProvider.dispose();
            contentProvider.inputChanged(this, null, currentInput);
            refresh();
        }
		viewControl.initControl(editingDomain);
    }

	public void setEditingDomain(AdapterFactoryEditingDomain editingDomain) {
		this.editingDomain = editingDomain;
	}

}<commit_msg>added scrollbar to the xdsml view<commit_after>package org.gemoc.gemoc_language_workbench.conf.presentation;

import org.eclipse.core.runtime.Assert;
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.jface.viewers.ContentViewer;
import org.eclipse.jface.viewers.IContentProvider;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;

public class GemocFormViewer extends ContentViewer {

	protected ScrolledComposite scrollControl;
	protected GemocXDSMLFormComposite viewControl;

	protected AdapterFactoryEditingDomain editingDomain;

	public GemocFormViewer(Composite parent) {
		createViewCrontrol(parent);
	}

	protected void createViewCrontrol(final Composite parent) {
		parent.setLayout(new FillLayout());
		scrollControl = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.BORDER);

		viewControl = new GemocXDSMLFormComposite(scrollControl, SWT.NONE);
		scrollControl.setContent(viewControl);
		// Set the minimum size
		// scrollControl.setMinSize(400, 400);
		scrollControl.setExpandVertical(true);
		scrollControl.setExpandHorizontal(true);
		scrollControl.addControlListener(new ControlAdapter() {
			public void controlResized(ControlEvent e) {
				org.eclipse.swt.graphics.Rectangle r = scrollControl
						.getClientArea();
				scrollControl.setMinSize(viewControl.computeSize(r.width,
						SWT.DEFAULT));
			}
		});

	}

	@Override
	public Control getControl() {
		return scrollControl;
	}

	@Override
	public ISelection getSelection() {
		// empty selection
		return new StructuredSelection();
	}

	@Override
	public void refresh() {
		// TODO Auto-generated method stub
		toString();

	}

	@Override
	public void setSelection(ISelection selection, boolean reveal) {
		// TODO Auto-generated method stub
		toString();
	}

	/**
	 * This viewer's content provider, or <code>null</code> if none.
	 */
	private IContentProvider contentProvider = null;

	/**
	 * Returns the content provider used by this viewer, or <code>null</code> if
	 * this view does not yet have a content provider.
	 * <p>
	 * The <code>ContentViewer</code> implementation of this method returns the
	 * content provider recorded is an internal state variable. Overriding this
	 * method is generally not required; however, if overriding in a subclass,
	 * <code>super.getContentProvider</code> must be invoked.
	 * </p>
	 *
	 * @return the content provider, or <code>null</code> if none
	 */
	public IContentProvider getContentProvider() {
		return contentProvider;
	}

	/**
	 * Sets the content provider used by this viewer.
	 * <p>
	 * The <code>ContentViewer</code> implementation of this method records the
	 * content provider in an internal state variable. Overriding this method is
	 * generally not required; however, if overriding in a subclass,
	 * <code>super.setContentProvider</code> must be invoked.
	 * </p>
	 *
	 * @param contentProvider
	 *            the content provider
	 * @see #getContentProvider
	 */
	public void setContentProvider(IContentProvider contentProvider) {
		Assert.isNotNull(contentProvider);
		IContentProvider oldContentProvider = this.contentProvider;
		this.contentProvider = contentProvider;
		if (oldContentProvider != null) {
			Object currentInput = getInput();
			oldContentProvider.inputChanged(this, currentInput, null);
			oldContentProvider.dispose();
			contentProvider.inputChanged(this, null, currentInput);
			refresh();
		}
		viewControl.initControl(editingDomain);
	}

	public void setEditingDomain(AdapterFactoryEditingDomain editingDomain) {
		this.editingDomain = editingDomain;
	}

}
{'fraction_non_alphanumeric': 0.09123533471359559, 'fraction_numerical': 0.0008281573498964803, 'mean_word_length': 4.131728045325779, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 39, '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': '6654151', 'n_tokens_mistral': 2175, 'n_tokens_neox': 2008, 'n_words': 526}