Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: f4e50ded37d190395b8b397c1dc7c7e29e2423b9 (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
/*******************************************************************************
 * Copyright (c) 2016 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.internal.actions;

import org.eclipse.gef.Request;
import org.eclipse.gmf.runtime.diagram.ui.actions.DiagramAction;
import org.eclipse.gmf.runtime.diagram.ui.actions.internal.l10n.DiagramUIActionsPluginImages;
import org.eclipse.sirius.diagram.ui.provider.Messages;
import org.eclipse.sirius.diagram.ui.tools.api.ui.actions.ActionIds;
import org.eclipse.ui.IWorkbenchPage;

/**
 * Action that will permit a user to snap back all existing and non empty labels
 * of a connection back to its original position relative to the connection.
 * 
 * @author <a href="mailto:pierre.guilet@obeo.fr">Pierre Guilet</a>
 */
@SuppressWarnings("restriction")
public class SiriusEdgeSnapBackAction extends DiagramAction {

    /**
     * Initialize action.
     * 
     * @param page
     *            the {@link IWorkbenchPage} where the action takes place.
     */
    public SiriusEdgeSnapBackAction(IWorkbenchPage page) {
        super(page);
    }

    @Override
    public void init() {
        super.init();
        setText(Messages.SiriusEdgeSnapBackAction_EdgeSnapBackLabel);
        setId(ActionIds.EDGE_SNAP_BACK);
        setToolTipText(Messages.SiriusEdgeSnapBackAction_EdgeSnapBackActionToolTipText);
        setImageDescriptor(DiagramUIActionsPluginImages.DESC_SNAPBACK);
        setHoverImageDescriptor(getImageDescriptor());
    }

    @Override
    protected Request createTargetRequest() {
        return new Request(ActionIds.EDGE_SNAP_BACK);
    }

    @Override
    protected boolean isSelectionListener() {
        return true;
    }

    @Override
    protected boolean isOperationHistoryListener() {
        return true;
    }

}

Back to the top