| /***************************************************************************** |
| * 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.associationlabellayout.locators.source; |
| |
| import org.eclipse.draw2d.IFigure; |
| import org.eclipse.draw2d.geometry.Point; |
| import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.AssociationEditPart; |
| |
| /** |
| * A factory for locators and associated segment |
| * |
| */ |
| public class SourceLocatorFactory { |
| |
| static SourceLocatorFactory singleton; |
| |
| public static SourceLocatorFactory getInstance () { |
| if (singleton==null) |
| singleton = new SourceLocatorFactory(); |
| return singleton; |
| } |
| |
| public AssociatedSourceSegment createAssociatedSourceSegment(IFigure target, |
| AbstractSourceLabelLocator abstractLabel) { |
| return new AssociatedSourceSegment(target, abstractLabel.getAssociationFigure().getAssociationEditPart()); |
| } |
| |
| public AssociatedSourceSegment createAssociatedSourceSegment(IFigure target, |
| AssociationEditPart associationEditPart) { |
| return new AssociatedSourceSegment(target, associationEditPart); |
| } |
| |
| public MultiplicitySourceLabelLocator createMultiplicitySourceLabelLocator(IFigure parent, Point offSet, |
| int alignment) { |
| return new MultiplicitySourceLabelLocator(parent, offSet, alignment, this); |
| } |
| |
| public RoleSourceLabelLocator createRoleSourceLabelLocator(IFigure parent, Point offSet, int alignment) { |
| return new RoleSourceLabelLocator(parent, offSet, alignment, this); |
| } |
| |
| |
| } |