Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 23ab36584910eb3f12aed80fa9c00ccef7a3e878 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*******************************************************************************
 * Copyright (c) 2007, 2015 THALES GLOBAL SERVICES and others.
 * 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:
 *    Obeo - initial API and implementation
 *******************************************************************************/
package org.eclipse.sirius.diagram.ui.tools.api.graphical.edit.styles;

import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
import org.eclipse.sirius.diagram.ui.provider.Messages;

/**
 * This class wraps an
 * {@link org.eclipse.gmf.runtime.draw2d.ui.figures.IBorderItemLocator} that
 * must be used instead {@link IBorderItemLocator}. As GMF generated code uses
 * {@link IBorderItemLocator} instead
 * {@link org.eclipse.gmf.runtime.draw2d.ui.figures.IBorderItemLocator} this
 * wrapper lets the client to use the good interface.
 * 
 * @author ymortier
 */
public class IBorderItemLocatorWrapper implements IBorderItemLocator {

    /** The wrapped locator. */
    private org.eclipse.gmf.runtime.draw2d.ui.figures.IBorderItemLocator wrappedLocator;

    /**
     * Create a new <code>IBorderItemLocatorWrapper</code>.
     * 
     * @param locator
     *            the locator to wrap.
     * @throws IllegalArgumentException
     *             if <code>locator</code> is <code>null</code>.
     */
    public IBorderItemLocatorWrapper(final org.eclipse.gmf.runtime.draw2d.ui.figures.IBorderItemLocator locator) throws IllegalArgumentException {
        if (locator == null) {
            throw new IllegalArgumentException(Messages.IBorderItemLocatorWrapper_nullLocator);
        }
        this.wrappedLocator = locator;
    }

    /**
     * {@inheritDoc}
     * 
     * @see org.eclipse.gmf.runtime.draw2d.ui.figures.IBorderItemLocator#getCurrentSideOfParent()
     */
    @Override
    public int getCurrentSideOfParent() {
        return this.wrappedLocator.getCurrentSideOfParent();
    }

    /**
     * {@inheritDoc}
     * 
     * @see org.eclipse.gmf.runtime.draw2d.ui.figures.IBorderItemLocator#getValidLocation(org.eclipse.draw2d.geometry.Rectangle,
     *      org.eclipse.draw2d.IFigure)
     */
    @Override
    public Rectangle getValidLocation(final Rectangle proposedLocation, final IFigure borderItem) {
        return this.wrappedLocator.getValidLocation(proposedLocation, borderItem);
    }

    /**
     * {@inheritDoc}
     * 
     * @see org.eclipse.gmf.runtime.draw2d.ui.figures.IBorderItemLocator#setConstraint(org.eclipse.draw2d.geometry.Rectangle)
     */
    @Override
    public void setConstraint(final Rectangle constraint) {
        this.wrappedLocator.setConstraint(constraint);
    }

    /**
     * {@inheritDoc}
     * 
     * @see org.eclipse.draw2d.Locator#relocate(org.eclipse.draw2d.IFigure)
     */
    @Override
    public void relocate(final IFigure target) {
        this.wrappedLocator.relocate(target);
    }

}

Back to the top