Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 42120e80709fc7498e14b6d739052e3c76640ddd (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
/*******************************************************************************
 * Copyright (c) 2018 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.editor;

import org.eclipse.gef.DragTracker;
import org.eclipse.gef.Request;
import org.eclipse.gef.internal.ui.rulers.RulerDragTracker;
import org.eclipse.gef.internal.ui.rulers.RulerEditPart;

/**
 * A specific {@link RulerEditPart} to use a specific {@link RulerDragTracker}, to insert blank space instead of create
 * guide, if Ctrl key is pressed.
 * 
 * @author <a href="mailto:laurent.redor@obeo.fr">Laurent Redor</a>
 */
@SuppressWarnings("restriction")
public class SiriusRulerEditPart extends RulerEditPart {

    /**
     * Default constructor.
     * 
     * @param model
     *            The primary model object that this EditPart represents
     */
    public SiriusRulerEditPart(Object model) {
        super(model);
    }

    @Override
    public DragTracker getDragTracker(Request request) {
        DragTracker result = SiriusBlankSpacesDragTracker.getDragTracker(this, diagramViewer, request, true, false);
        if (result == null) {
            return super.getDragTracker(request);
        } else {
            return result;
        }
    }
}

Back to the top