<commit_before>/*******************************************************************************
 * Copyright (c) 2004 Actuate Corporation .
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *  Actuate Corporation  - initial API and implementation
 *******************************************************************************/

package org.eclipse.birt.report.designer.internal.lib.editparts;

import org.eclipse.birt.report.designer.internal.ui.editors.schematic.editparts.DummyEditpart;
import org.eclipse.birt.report.designer.internal.ui.editors.schematic.editparts.GraphicalPartFactory;
import org.eclipse.birt.report.model.api.LibraryHandle;
import org.eclipse.birt.report.model.api.MasterPageHandle;
import org.eclipse.birt.report.model.api.SimpleMasterPageHandle;
import org.eclipse.gef.EditPart;

/**
 * Factory to populate the edit part for given model type
 *  
 */
public class LibraryGraphicalPartFactory extends GraphicalPartFactory
{

	public EditPart createEditPart( EditPart context, Object model )
	{
		//default edit part
		EditPart editPart = null;
		if ( model instanceof LibraryHandle )
		{
			return new LibraryReportDesignEditPart( model );
		}

		if ( ignoreModel( model ) )
		{
			editPart = new EmptyEditPart( model );
		}
		if ( editPart != null )
		{
			return editPart;
		}
		editPart = super.createEditPart( context, model );
		if ( editPart == null || editPart instanceof DummyEditpart )
		{
			editPart = new EmptyEditPart( model );
		}
		return editPart;
	}

	private boolean ignoreModel( Object model )
	{
//		if ( model instanceof ReportElementModel
//				&& ( ( (ReportElementModel) model ).getElementHandle( ) instanceof SimpleMasterPageHandle ) )<commit_msg>- Summary:Fix bug 192344,Refresh library issue in library file[01].<commit_after>/*******************************************************************************
 * Copyright (c) 2004 Actuate Corporation .
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *  Actuate Corporation  - initial API and implementation
 *******************************************************************************/

package org.eclipse.birt.report.designer.internal.lib.editparts;

import org.eclipse.birt.report.designer.internal.ui.editors.schematic.editparts.DestroyEditPart;
import org.eclipse.birt.report.designer.internal.ui.editors.schematic.editparts.DummyEditpart;
import org.eclipse.birt.report.designer.internal.ui.editors.schematic.editparts.GraphicalPartFactory;
import org.eclipse.birt.report.model.api.LibraryHandle;
import org.eclipse.birt.report.model.api.MasterPageHandle;
import org.eclipse.birt.report.model.api.SimpleMasterPageHandle;
import org.eclipse.gef.EditPart;

/**
 * Factory to populate the edit part for given model type
 *  
 */
public class LibraryGraphicalPartFactory extends GraphicalPartFactory
{

	public EditPart createEditPart( EditPart context, Object model )
	{
		//default edit part
		EditPart editPart = null;
		if ( model instanceof LibraryHandle )
		{
			return new LibraryReportDesignEditPart( model );
		}

		if ( ignoreModel( model ) )
		{
			editPart = new EmptyEditPart( model );
		}
		if ( editPart != null )
		{
			return editPart;
		}
		editPart = super.createEditPart( context, model );
		if (!(editPart instanceof DestroyEditPart) && (editPart == null || editPart instanceof DummyEditpart ))
		{
			editPart = new EmptyEditPart( model );
		}
		return editPart;
	}

	private boolean ignoreModel( Object model )
	{
//		if ( model instanceof ReportElementModel
//				&& ( ( (ReportElementModel) model ).getElementHandle( ) instanceof SimpleMasterPageHandle ) )
{'fraction_non_alphanumeric': 0.16650099403578528, 'fraction_numerical': 0.005964214711729622, 'mean_word_length': 4.717329545454546, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5666235', 'n_tokens_mistral': 1182, 'n_tokens_neox': 1082, 'n_words': 283}