| /***************************************************************************** |
| * 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.autosizeableclasses.edit.policies.utils; |
| |
| import org.eclipse.gmf.runtime.notation.Shape; |
| import org.eclipse.papyrus.uml.diagram.clazz.lf.autosizeableclasses.preference.Settings; |
| import org.eclipse.papyrus.uml.diagram.common.editparts.ClassEditPart; |
| |
| /** |
| * This class is used as a factory for classes in the editPolicies.utils |
| * package. It aims specially at creating instances of class Expanding Collapsing |
| * which is used by several other classes. |
| * |
| */ |
| public class ClassExpanderCollapsertFactory { |
| |
| private static final ClassExpanderCollapsertFactory INSTANCE = new ClassExpanderCollapsertFactory(); |
| |
| /** |
| * This method returns the instance (singleton) to use as a factory. |
| * |
| * @return instance/factory |
| */ |
| public static ClassExpanderCollapsertFactory getInstance() { |
| return INSTANCE; |
| } |
| |
| private ClassExpanderCollapsertFactory() { |
| |
| } |
| |
| /** |
| * The class ExpandingCollapsing needs 3 parameters to create an instance, see |
| * {@link ClassExpanderCollapsertFactory#createExpandingCollapsing(ClassEditPart, int, Settings)}. Here |
| * the value of concerned value of concerned compartments is ALL and for general |
| * settings, it is the Eclipse settings. |
| * |
| * @param classEditPart class(EditPart) to expand/collapse |
| * @return the instance of ExpandingCollapsing set with the previous parameters |
| */ |
| public ClassExpanderCollapser createExpandingCollapsing(ClassEditPart classEditPart) { |
| return new ClassExpanderCollapser(classEditPart); |
| } |
| |
| /** |
| * The class ExpandingCollapsing needs 3 parameters to create an instance, see |
| * {@link ClassExpanderCollapsertFactory#createExpandingCollapsing(ClassEditPart, int, Settings)}. Here |
| * the value of general settings is the Eclipse settings. |
| * |
| * @param classEditPart class(EditPart) to expand/collapse |
| * @param concernedCompartment the concerned compartments (all or a specific |
| * one) |
| * @return the instance of ExpandingCollapsing set with the previous parameters |
| */ |
| public ClassExpanderCollapser createExpandingCollapsing(ClassEditPart classEditPart, int concernedCompartment) { |
| return new ClassExpanderCollapser(classEditPart, concernedCompartment); |
| } |
| |
| /** |
| * The class ExpandingCollapsing needs 3 parameters to create an instance: the |
| * class(EditPart) to expand/collapse, the concerned compartments (all or a |
| * specific one), and the general settings/options |
| * |
| * @param classEditPart class(EditPart) to expand/collapse |
| * @param concernedCompartment the concerned compartments (all or a specific |
| * one) |
| * @param defaultSettings the general settings/options |
| * @return the instance of ExpandingCollapsing set with the previous parameters |
| */ |
| public ClassExpanderCollapser createExpandingCollapsing(ClassEditPart classEditPart, int concernedCompartment, |
| Settings defaultSettings) { |
| return new ClassExpanderCollapser(classEditPart, concernedCompartment, defaultSettings); |
| } |
| |
| /** |
| * The class ExpandingCollapsing needs 3 parameters to create an instance: the |
| * class(notation level) to expand/collapse, the concerned compartments (all or a |
| * specific one), and the general settings/options |
| * |
| * @param umlClassShape class(notation level) to expand/collapse |
| * @param concernedCompartment the concerned compartments (all or a specific |
| * one) |
| * @param defaultSettings the general settings/options |
| * @return the instance of ExpandingCollapsing set with the previous parameters |
| */ |
| public ClassExpanderCollapser createExpandingCollapsing(Shape umlClassShape, int concernedCompartment, |
| Settings defaultSettings) { |
| return new ClassExpanderCollapser(umlClassShape, concernedCompartment, defaultSettings); |
| } |
| } |