<commit_before>/**
 * This program and the accompanying materials
 * are made available under the terms of the License
 * which accompanies this distribution in the file LICENSE.txt
 */
package com.archimatetool.editor;

import org.eclipse.draw2d.IFigure;
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gef.GraphicalViewer;
import org.eclipse.gef.editparts.ScalableFreeformRootEditPart;
import org.eclipse.gef.ui.parts.ScrollingGraphicalViewer;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

import com.archimatetool.editor.diagram.editparts.ArchimateDiagramEditPartFactory;
import com.archimatetool.model.IArchimateDiagramModel;
import com.archimatetool.model.IDiagramModelObject;


/**
 * A very basic Archimate Editor for testing consisting of a basic GraphicalViewer and Root Edit Part
 * with no dependency on the Workbench, Edit Parts and so on
 * 
 * @author <NAME>
 */
@SuppressWarnings("nls")
public class ArchimateTestEditor {
    
    private GraphicalViewer graphicalViewer;
    private IArchimateDiagramModel dm;
    
    public ArchimateTestEditor() {
        // Create a new display
        if(Display.getCurrent() == null) {
            new Display();
        }
        
        graphicalViewer = new ScrollingGraphicalViewer();
        graphicalViewer.createControl(new Shell());
        
        graphicalViewer.setEditPartFactory(new ArchimateDiagramEditPartFactory());
        graphicalViewer.setRootEditPart(new ScalableFreeformRootEditPart());
    }

    public void setDiagramModel(IArchimateDiagramModel dm) {
        this.dm = dm;
        graphicalViewer.setContents(dm);
    }
    
    public IArchimateDiagramModel getDiagramModel() {
        return dm;
    }
    <commit_msg>[Unit Tests] ArchimateTestEditor has no need to create Display<commit_after>/**
 * This program and the accompanying materials
 * are made available under the terms of the License
 * which accompanies this distribution in the file LICENSE.txt
 */
package com.archimatetool.editor;

import org.eclipse.draw2d.IFigure;
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gef.GraphicalViewer;
import org.eclipse.gef.editparts.ScalableFreeformRootEditPart;
import org.eclipse.gef.ui.parts.ScrollingGraphicalViewer;
import org.eclipse.swt.widgets.Shell;

import com.archimatetool.editor.diagram.editparts.ArchimateDiagramEditPartFactory;
import com.archimatetool.model.IArchimateDiagramModel;
import com.archimatetool.model.IDiagramModelObject;


/**
 * A very basic Archimate Editor for testing consisting of a basic GraphicalViewer and Root Edit Part
 * with no dependency on the Workbench, Edit Parts and so on
 * 
 * @author <NAME>
 */
@SuppressWarnings("nls")
public class ArchimateTestEditor {
    
    private GraphicalViewer graphicalViewer;
    private IArchimateDiagramModel dm;
    
    public ArchimateTestEditor() {
        graphicalViewer = new ScrollingGraphicalViewer();
        graphicalViewer.createControl(new Shell());
        
        graphicalViewer.setEditPartFactory(new ArchimateDiagramEditPartFactory());
        graphicalViewer.setRootEditPart(new ScalableFreeformRootEditPart());
    }

    public void setDiagramModel(IArchimateDiagramModel dm) {
        this.dm = dm;
        graphicalViewer.setContents(dm);
    }
    
    public IArchimateDiagramModel getDiagramModel() {
        return dm;
    }
    
{'fraction_non_alphanumeric': 0.07708210277613703, 'fraction_numerical': 0.0005906674542232723, 'mean_word_length': 4.002954209748892, 'pattern_counts': {'":': 0, '<': 5, '<?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': '263999', 'n_tokens_mistral': 989, 'n_tokens_neox': 975, 'n_words': 230}