| /********************************************************************* |
| * Copyright (c) 2005, 2019 SAP SE |
| * |
| * This program and the accompanying materials are made |
| * available under the terms of the Eclipse Public License 2.0 |
| * which is available at https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * Contributors: |
| * SAP SE - initial API, implementation and documentation |
| * fvelasco - Bug 403664 - Enable DoubleClickFeature on the diagram background |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| **********************************************************************/ |
| package org.eclipse.graphiti.ui.internal.editor; |
| |
| import org.eclipse.gef.DragTracker; |
| import org.eclipse.gef.EditPart; |
| import org.eclipse.gef.RequestConstants; |
| import org.eclipse.gef.requests.SelectionRequest; |
| |
| /** |
| * Drag tracker to promote GFMarqueeSelectionTool. |
| * |
| * @noinstantiate This class is not intended to be instantiated by clients. |
| * @noextend This class is not intended to be subclassed by clients. |
| */ |
| public class GFMarqueeDragTracker extends GFMarqueeSelectionTool implements DragTracker { |
| |
| private EditPart editPart; |
| |
| public GFMarqueeDragTracker(EditPart editPart) { |
| this.editPart = editPart; |
| } |
| |
| /** |
| * Called when the mouse button is released. Overridden to do nothing, since |
| * a drag tracker does not need to unload when finished. |
| */ |
| @Override |
| protected void handleFinished() { |
| } |
| |
| @Override |
| protected boolean handleDoubleClick(int button) { |
| SelectionRequest request = new SelectionRequest(); |
| request.setLocation(getLocation()); |
| request.setType(RequestConstants.REQ_OPEN); |
| editPart.performRequest(request); |
| |
| return true; |
| } |
| } |