| /***************************************************************************** |
| * Copyright (c) 2019 CEA LIST. |
| * |
| * |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Xavier Le Pallec (for CEA LIST) xlepallec@lilo.org - Bug 558456 |
| * |
| *****************************************************************************/ |
| |
| package org.eclipse.papyrus.uml.diagram.clazz.lf.classtextualedition.mapping.js2java; |
| |
| import org.eclipse.emf.transaction.TransactionalEditingDomain; |
| import org.eclipse.papyrus.infra.gmfdiag.common.editpart.ResizeableListCompartmentEditPart; |
| import org.eclipse.papyrus.uml.diagram.clazz.lf.classtextualedition.factory.BasicFactory; |
| import org.eclipse.papyrus.uml.diagram.clazz.lf.classtextualedition.mapping.jsonstructures.JsonUmlClass; |
| //import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassEditPart; |
| import org.eclipse.papyrus.uml.diagram.common.editparts.ClassEditPart; |
| |
| public class ToEditPartFactory extends BasicFactory { |
| |
| static ToEditPartFactory instance; |
| |
| /** |
| * This method returns the instance (singleton) to use as a factory. |
| * |
| * @return instance/factory |
| */ |
| public static ToEditPartFactory getInstance() { |
| if (instance == null) { |
| instance = new ToEditPartFactory(); |
| } |
| return instance; |
| } |
| |
| private ToEditPartFactory() { |
| |
| } |
| |
| public JsonUmlClassToEditPart createJsonUmlClassToEditPart(JsonUmlClass theClass, ClassEditPart editPart) { |
| |
| Object[] arguments = { theClass, "theClass", editPart, "editPart" }; //$NON-NLS-1$ //$NON-NLS-2$ |
| if (checkNullArgument(arguments)) { |
| return null; |
| } |
| |
| return new JsonUmlClassToEditPart(theClass, editPart); |
| |
| } |
| |
| public JsonUmlOperationToEditPart createJsonUmlOperationToEditPart(TransactionalEditingDomain editingDomain, |
| ClassEditPart editPart, ResizeableListCompartmentEditPart operationCompartment) { |
| |
| Object[] arguments = { editingDomain, "editingDomain", editPart, "editPart", operationCompartment, //$NON-NLS-1$ //$NON-NLS-2$ |
| "operationCompartment" }; //$NON-NLS-1$ |
| if (checkNullArgument(arguments)) { |
| return null; |
| } |
| |
| return new JsonUmlOperationToEditPart(editingDomain, editPart, operationCompartment); |
| |
| } |
| |
| public JsonUmlPropertyToEditPart createJsonUmlPropertyToEditPart(TransactionalEditingDomain editingDomain, |
| ClassEditPart editPart, ResizeableListCompartmentEditPart attributeCompartment) { |
| |
| Object[] arguments = { editingDomain, "editingDomain", editPart, "editPart", attributeCompartment, //$NON-NLS-1$ //$NON-NLS-2$ |
| "attributeCompartment" }; //$NON-NLS-1$ |
| if (checkNullArgument(arguments)) { |
| return null; |
| } |
| |
| return new JsonUmlPropertyToEditPart(editingDomain, editPart, attributeCompartment); |
| |
| } |
| } |