Bug 564144 - Removes org.eclipse.ui.internal.DragCursors and DragHandle
Full text search also showed no usage
Change-Id: I7b85c65dc0d118243aabfcd7a11c84df44df4cad
Signed-off-by: Rolf Theunissen <rolf.theunissen@gmail.com>
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DragCursors.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DragCursors.java
deleted file mode 100644
index 76f3c01..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DragCursors.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2015 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Cursor;
-import org.eclipse.swt.widgets.Display;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-
-import org.eclipse.ui.ISharedImages;
-
-/**
- * Provides the set of cursors used for drag-and-drop.
- */
-public class DragCursors {
- public static final int INVALID = 0;
-
- public static final int LEFT = 1;
-
- public static final int RIGHT = 2;
-
- public static final int TOP = 3;
-
- public static final int BOTTOM = 4;
-
- public static final int CENTER = 5;
-
- public static final int OFFSCREEN = 6;
-
- public static final int FASTVIEW = 7;
-
- private static final Cursor cursors[] = new Cursor[8];
-
- public static int positionToDragCursor(int swtPositionConstant) {
- switch (swtPositionConstant) {
- case SWT.LEFT:
- return LEFT;
- case SWT.RIGHT:
- return RIGHT;
- case SWT.TOP:
- return TOP;
- case SWT.BOTTOM:
- return BOTTOM;
- case SWT.CENTER:
- return CENTER;
- }
-
- return INVALID;
- }
-
- /**
- * Converts a drag cursor (LEFT, RIGHT, TOP, BOTTOM, CENTER) into an SWT
- * constant (SWT.LEFT, SWT.RIGHT, SWT.TOP, SWT.BOTTOM, SWT.CENTER)
- *
- * @param dragCursorId
- * @return an SWT.* constant
- */
- public static int dragCursorToSwtConstant(int dragCursorId) {
- switch (dragCursorId) {
- case LEFT:
- return SWT.LEFT;
- case RIGHT:
- return SWT.RIGHT;
- case TOP:
- return SWT.TOP;
- case BOTTOM:
- return SWT.BOTTOM;
- case CENTER:
- return SWT.CENTER;
- }
-
- return SWT.DEFAULT;
- }
-
- /**
- * Return the cursor for a drop scenario, as identified by code. Code must be
- * one of INVALID, LEFT, RIGHT, TOP, etc. If the code is not found default to
- * INVALID.
- *
- * @param code the code
- * @return the cursor
- */
- public static Cursor getCursor(int code) {
- Display display = Display.getCurrent();
- if (cursors[code] == null) {
- ImageDescriptor source = null;
- ImageDescriptor mask = null;
- switch (code) {
- case LEFT:
- source = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJS_DND_LEFT_SOURCE);
- mask = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJS_DND_LEFT_MASK);
- cursors[LEFT] = new Cursor(display, source.getImageData(), mask.getImageData(), 16, 16);
- break;
- case RIGHT:
- source = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJS_DND_RIGHT_SOURCE);
- mask = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJS_DND_RIGHT_MASK);
- cursors[RIGHT] = new Cursor(display, source.getImageData(), mask.getImageData(), 16, 16);
- break;
- case TOP:
- source = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJS_DND_TOP_SOURCE);
- mask = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJS_DND_TOP_MASK);
- cursors[TOP] = new Cursor(display, source.getImageData(), mask.getImageData(), 16, 16);
- break;
- case BOTTOM:
- source = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJS_DND_BOTTOM_SOURCE);
- mask = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJS_DND_BOTTOM_MASK);
- cursors[BOTTOM] = new Cursor(display, source.getImageData(), mask.getImageData(), 16, 16);
- break;
- case CENTER:
- source = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJS_DND_STACK_SOURCE);
- mask = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJS_DND_STACK_MASK);
- cursors[CENTER] = new Cursor(display, source.getImageData(), mask.getImageData(), 16, 16);
- break;
- case OFFSCREEN:
- source = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJS_DND_OFFSCREEN_SOURCE);
- mask = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJS_DND_OFFSCREEN_MASK);
- cursors[OFFSCREEN] = new Cursor(display, source.getImageData(), mask.getImageData(), 16, 16);
- break;
- case FASTVIEW:
- source = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJS_DND_TOFASTVIEW_SOURCE);
- mask = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJS_DND_TOFASTVIEW_MASK);
- cursors[FASTVIEW] = new Cursor(Display.getCurrent(), source.getImageData(), mask.getImageData(), 16,
- 16);
- break;
- default:
- case INVALID:
- source = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJS_DND_INVALID_SOURCE);
- mask = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJS_DND_INVALID_MASK);
- cursors[INVALID] = new Cursor(display, source.getImageData(), mask.getImageData(), 16, 16);
- break;
- }
- }
- return cursors[code];
- }
-
- /**
- * Disposes all drag-and-drop cursors.
- */
- public static void dispose() {
- for (int idx = 0; idx < cursors.length; idx++) {
- cursors[idx].dispose();
- cursors[idx] = null;
- }
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DragHandle.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DragHandle.java
deleted file mode 100644
index 0ad5621..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DragHandle.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2019 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- * Lars Vogel <Lars.Vogel@gmail.com> - Bug 422040
- * Alexander Fedorov <alexander.fedorov@arsysop.ru> - Bug 548799
- *******************************************************************************/
-package org.eclipse.ui.internal;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Composite;
-
-public class DragHandle extends Composite implements PaintListener {
-
- Image handleImage;
- private boolean isHorizontal;
-
- private static int margin = 2;
-
- public DragHandle(Composite parent) {
- super(parent, SWT.NONE);
-
- addPaintListener(this);
-
- handleImage = new Image(parent.getDisplay(), 4, 4);
- GC context = new GC(handleImage);
- context.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
- context.drawPoint(0, 0);
- context.drawPoint(2, 0);
- context.drawPoint(3, 0);
- context.drawPoint(3, 1);
- context.drawPoint(0, 2);
- context.drawPoint(3, 2);
- context.drawPoint(0, 3);
- context.drawPoint(1, 3);
- context.drawPoint(2, 3);
- context.drawPoint(3, 3);
-
- context.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW));
- context.drawPoint(1, 0);
- context.drawPoint(0, 1);
-
- context.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW));
- context.drawPoint(1, 1);
-
- context.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW));
- context.drawPoint(1, 2);
- context.drawPoint(2, 1);
- context.drawPoint(2, 2);
-
- context.dispose();
-
- setCursor(parent.getDisplay().getSystemCursor(SWT.CURSOR_SIZEALL));
- }
-
- @Override
- public void paintControl(PaintEvent e) {
- Point size = getSize();
-
- if (handleImage != null) {
- Rectangle ibounds = handleImage.getBounds();
-
- int x = ((size.x - 2 * margin) % ibounds.width) / 2 + margin;
- int y = ((size.y - 2 * margin) % ibounds.height) / 2 + margin;
-
- for (;;) {
- e.gc.drawImage(handleImage, x, y);
- if (isHorizontal) {
- x += ibounds.width;
- if (x + ibounds.width > size.x - margin) {
- break;
- }
- } else {
- y += ibounds.height;
- if (y + ibounds.height > size.y - margin) {
- break;
- }
- }
- }
- }
- }
-
- @Override
- public Point computeSize(int wHint, int hHint, boolean changed) {
- Point result = new Point(wHint, hHint);
-
- Rectangle ibounds = handleImage.getBounds();
-
- if (wHint == SWT.DEFAULT) {
- result.x = ibounds.width + 2 * margin;
- }
-
- if (hHint == SWT.DEFAULT) {
- result.y = ibounds.height + 2 * margin;
- }
-
- return result;
- }
-
- public void setHorizontal(boolean isHorizontal) {
- this.isHorizontal = isHorizontal;
- }
-
- @Override
- public void dispose() {
- if (isDisposed()) {
- return;
- }
- handleImage.dispose();
- super.dispose();
- }
-}