| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| FigExtensionPointsCompartment |
|
| 1.0;1 |
| 1 | /* $Id: FigExtensionPointsCompartment.java 17753 2010-01-11 19:49:55Z linus $ | |
| 2 | ******************************************************************************* | |
| 3 | * Copyright (c) 2009-2010 Contributors - see below | |
| 4 | * All rights reserved. This program and the accompanying materials | |
| 5 | * are made available under the terms of the Eclipse Public License v1.0 | |
| 6 | * which accompanies this distribution, and is available at | |
| 7 | * http://www.eclipse.org/legal/epl-v10.html | |
| 8 | * | |
| 9 | * Contributors: | |
| 10 | * Michiel van der Wulp | |
| 11 | * Bob Tarling | |
| 12 | ******************************************************************************* | |
| 13 | * | |
| 14 | * Some portions of this file was previously release using the BSD License: | |
| 15 | */ | |
| 16 | ||
| 17 | // $Id: FigExtensionPointsCompartment.java 17753 2010-01-11 19:49:55Z linus $ | |
| 18 | // Copyright (c) 2009 The Regents of the University of California. All | |
| 19 | // Rights Reserved. Permission to use, copy, modify, and distribute this | |
| 20 | // software and its documentation without fee, and without a written | |
| 21 | // agreement is hereby granted, provided that the above copyright notice | |
| 22 | // and this paragraph appear in all copies. This software program and | |
| 23 | // documentation are copyrighted by The Regents of the University of | |
| 24 | // California. The software program and documentation are supplied "AS | |
| 25 | // IS", without any accompanying services from The Regents. The Regents | |
| 26 | // does not warrant that the operation of the program will be | |
| 27 | // uninterrupted or error-free. The end-user understands that the program | |
| 28 | // was developed for research purposes and is advised not to rely | |
| 29 | // exclusively on the program for any reason. IN NO EVENT SHALL THE | |
| 30 | // UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, | |
| 31 | // SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, | |
| 32 | // ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF | |
| 33 | // THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF | |
| 34 | // SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY | |
| 35 | // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | |
| 36 | // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE | |
| 37 | // PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF | |
| 38 | // CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, | |
| 39 | // UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | |
| 40 | ||
| 41 | package org.argouml.uml.diagram.ui; | |
| 42 | ||
| 43 | import java.awt.Rectangle; | |
| 44 | import java.util.Collection; | |
| 45 | ||
| 46 | import org.argouml.model.Model; | |
| 47 | import org.argouml.notation.NotationProviderFactory2; | |
| 48 | import org.argouml.ui.targetmanager.TargetManager; | |
| 49 | import org.argouml.uml.diagram.DiagramSettings; | |
| 50 | import org.argouml.uml.diagram.use_case.ui.FigExtensionPoint; | |
| 51 | ||
| 52 | /** | |
| 53 | * The compartment that contains extension points. | |
| 54 | * | |
| 55 | * @author michiel | |
| 56 | */ | |
| 57 | public class FigExtensionPointsCompartment extends FigCompartment { | |
| 58 | ||
| 59 | /** | |
| 60 | * The constructor. | |
| 61 | * | |
| 62 | * @param owner owning UML element | |
| 63 | * @param bounds position and size | |
| 64 | * @param settings render settings | |
| 65 | */ | |
| 66 | public FigExtensionPointsCompartment(Object owner, Rectangle bounds, | |
| 67 | DiagramSettings settings) { | |
| 68 | 0 | super(owner, bounds, settings); |
| 69 | 0 | super.populate(); |
| 70 | 0 | } |
| 71 | ||
| 72 | @Override | |
| 73 | FigSingleLineTextWithNotation createFigText(Object owner, Rectangle bounds, | |
| 74 | DiagramSettings settings) { | |
| 75 | 0 | return new FigExtensionPoint(owner, bounds, settings); |
| 76 | } | |
| 77 | ||
| 78 | @Override | |
| 79 | protected int getNotationType() { | |
| 80 | 0 | return NotationProviderFactory2.TYPE_EXTENSION_POINT; |
| 81 | } | |
| 82 | ||
| 83 | @Override | |
| 84 | protected Collection getUmlCollection() { | |
| 85 | 0 | Object usecase = getOwner(); //TODO: check! |
| 86 | 0 | return Model.getFacade().getExtensionPoints(usecase); |
| 87 | } | |
| 88 | ||
| 89 | @Override | |
| 90 | protected void createModelElement() { | |
| 91 | 0 | Object usecase = getGroup().getOwner(); //TODO: check! |
| 92 | 0 | Object ep = Model.getUseCasesFactory().buildExtensionPoint(usecase); |
| 93 | 0 | TargetManager.getInstance().setTarget(ep); |
| 94 | 0 | } |
| 95 | ||
| 96 | @Override | |
| 97 | public String getName() { | |
| 98 | 0 | return "extension points"; |
| 99 | } | |
| 100 | ||
| 101 | /** | |
| 102 | * Returns the meta type for ExtensionPoint to indicate the type of model | |
| 103 | * element within this compartment. | |
| 104 | * @return a model element type | |
| 105 | */ | |
| 106 | public Object getCompartmentType() { | |
| 107 | 0 | return Model.getMetaTypes().getExtensionPoint(); |
| 108 | } | |
| 109 | } |