Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: e5d78fd3962eed3cdab581a47868d7547fcc164a (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
/*******************************************************************************
 * Copyright (c) 2011 THALES GLOBAL SERVICES.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Obeo - initial API and implementation
 *******************************************************************************/
package org.eclipse.sirius.diagram.tools.internal.palette;

import org.eclipse.gef.Tool;
import org.eclipse.gef.requests.CreationFactory;
import org.eclipse.gmf.runtime.diagram.ui.services.palette.PaletteFactory;

/**
 * A specific {@link PaletteFactory} to create a {@link CreationTool} with the
 * specified {@link CreationFactory}.
 * 
 * @author <a href="mailto:esteban.dugueperoux@obeo.fr">Esteban Dugueperoux</a>
 */
public class ConnectionCreationToolPaletteFactory implements PaletteFactory {

    private CreationFactory creationFactory;

    /**
     * Default constructor.
     * 
     * @param creationFactory
     *            the {@link CreationFactory} to use to create the
     *            {@link CreationTool}
     */
    public ConnectionCreationToolPaletteFactory(CreationFactory creationFactory) {
        this.creationFactory = creationFactory;
    }

    /**
     * Overridden to create a {@link ConnectionCreationTool} with the specified
     * {@link CreationFactory}.
     * 
     * {@inheritDoc}
     */
    public Tool createTool(String toolId) {
        ConnectionCreationTool connectionCreationTool = new ConnectionCreationTool(creationFactory);
        return connectionCreationTool;
    }

    /**
     * {@inheritDoc}
     */
    public Object getTemplate(String templateId) {
        return creationFactory;
    }

}

Back to the top