Skip to content

Commit

Permalink
Deprecate transfer listeners for removal
Browse files Browse the repository at this point in the history
The TransferDragSourceListener and TransferDropTargetListener are
effecitively equivalent to their JFace counterpart and should be used
instead.
  • Loading branch information
ptziegler authored and azoitl committed Jan 18, 2025
1 parent a428caf commit 6048a18
Show file tree
Hide file tree
Showing 14 changed files with 92 additions and 38 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2003, 2024 IBM Corporation and others.
* Copyright (c) 2003, 2025 IBM Corporation and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
Expand Down Expand Up @@ -31,6 +31,8 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.util.TransferDragSourceListener;
import org.eclipse.jface.util.TransferDropTargetListener;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IFileEditorInput;
Expand Down Expand Up @@ -136,7 +138,8 @@ protected void configureGraphicalViewer() {
@Override
protected void initializeGraphicalViewer() {
getGraphicalViewer().setContents(diagram);
getGraphicalViewer().addDropTargetListener(new TemplateTransferDropTargetListener(getGraphicalViewer()));
getGraphicalViewer().addDropTargetListener(
(TransferDropTargetListener) new TemplateTransferDropTargetListener(getGraphicalViewer()));

}

Expand All @@ -146,7 +149,8 @@ protected void initializeGraphicalViewer() {
@Override
protected void initializePaletteViewer() {
super.initializePaletteViewer();
getPaletteViewer().addDragSourceListener(new TemplateTransferDragSourceListener(getPaletteViewer()));
getPaletteViewer().addDragSourceListener(
(TransferDragSourceListener) new TemplateTransferDragSourceListener(getPaletteViewer()));
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2024 IBM Corporation and others.
* Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
Expand Down Expand Up @@ -55,6 +55,7 @@
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.util.SafeRunnable;
import org.eclipse.jface.util.TransferDragSourceListener;
import org.eclipse.jface.util.TransferDropTargetListener;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IEditorInput;
Expand Down Expand Up @@ -512,7 +513,8 @@ protected PaletteViewerProvider createPaletteViewerProvider() {
protected void configurePaletteViewer(PaletteViewer viewer) {
super.configurePaletteViewer(viewer);
viewer.setCustomizer(new LogicPaletteCustomizer());
viewer.addDragSourceListener(new TemplateTransferDragSourceListener(viewer));
viewer.addDragSourceListener(
(TransferDragSourceListener) new TemplateTransferDragSourceListener(viewer));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2024 Elias Volanakis and others.
* Copyright (c) 2004, 2025 Elias Volanakis and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
Expand Down Expand Up @@ -31,6 +31,7 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.util.TransferDragSourceListener;
import org.eclipse.jface.util.TransferDropTargetListener;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IEditorInput;
Expand Down Expand Up @@ -147,7 +148,8 @@ protected void configurePaletteViewer(PaletteViewer viewer) {
// CombinatedTemplateCreationEntries
// from the palette into the editor
// @see ShapesEditor#createTransferDropTargetListener()
viewer.addDragSourceListener(new TemplateTransferDragSourceListener(viewer));
viewer.addDragSourceListener(
(TransferDragSourceListener) new TemplateTransferDragSourceListener(viewer));
}
};
}
Expand Down
18 changes: 13 additions & 5 deletions org.eclipse.gef/src/org/eclipse/gef/EditPartViewer.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2010 IBM Corporation and others.
* Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
Expand Down Expand Up @@ -100,7 +100,10 @@ interface Conditional {
*
* @param listener a drag source listener
* @see #addDragSourceListener(TransferDragSourceListener)
* @deprecated Use {@link #addDragSourceListener(TransferDragSourceListener)}
* instead. This method will be removed after the 2027-03 release.
*/
@Deprecated(since = "3.21", forRemoval = true)
void addDragSourceListener(org.eclipse.gef.dnd.TransferDragSourceListener listener);

/**
Expand All @@ -118,7 +121,10 @@ interface Conditional {
*
* @param listener the listener
* @see #addDropTargetListener(TransferDropTargetListener)
* @deprecated Use {@link #addDragSourceListener(TransferDragSourceListener)}
* instead. This method will be removed after the 2027-03 release.
*/
@Deprecated(since = "3.21", forRemoval = true)
void addDropTargetListener(org.eclipse.gef.dnd.TransferDropTargetListener listener);

/**
Expand Down Expand Up @@ -428,9 +434,10 @@ interface Conditional {
*
* @see #addDragSourceListener(TransferDragSourceListener)
* @param listener the listener
* @deprecated
* @deprecated Use {@link #removeDragSourceListener(TransferDragSourceListener)}
* instead. This method will be removed after the 2027-03 release.
*/
@Deprecated
@Deprecated(since = "3.0", forRemoval = true)
void removeDragSourceListener(org.eclipse.gef.dnd.TransferDragSourceListener listener);

/**
Expand All @@ -448,9 +455,10 @@ interface Conditional {
*
* @see #addDropTargetListener(TransferDropTargetListener)
* @param listener
* @deprecated
* @deprecated Use {@link #removeDropTargetListener(TransferDropTargetListener)}
* instead. This method will be removed after the 2027-03 release.
*/
@Deprecated
@Deprecated(since = "3.0", forRemoval = true)
void removeDropTargetListener(org.eclipse.gef.dnd.TransferDropTargetListener listener);

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2010 IBM Corporation and others.
* Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
Expand All @@ -15,13 +15,17 @@
import org.eclipse.swt.dnd.DragSourceEvent;
import org.eclipse.swt.dnd.Transfer;

import org.eclipse.jface.util.TransferDragSourceListener;

import org.eclipse.gef.EditPartViewer;

/**
* An abstract implementation of <code>TransferDragSourceListener</code>
* associated with an {@link EditPartViewer}
*/
public abstract class AbstractTransferDragSourceListener implements TransferDragSourceListener {
@SuppressWarnings("removal")
public abstract class AbstractTransferDragSourceListener
implements TransferDragSourceListener, org.eclipse.gef.dnd.TransferDragSourceListener {

private EditPartViewer viewer;
private Transfer transfer;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2024 IBM Corporation and others.
* Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
Expand All @@ -24,6 +24,8 @@
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.dnd.TransferData;

import org.eclipse.jface.util.TransferDropTargetListener;

import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.geometry.Point;

Expand All @@ -45,7 +47,9 @@
* behavior, such as interacting with the target EditPart or its ancestors to
* achieve things like auto-scroll/auto-expose.
*/
public abstract class AbstractTransferDropTargetListener implements TransferDropTargetListener {
@SuppressWarnings("removal")
public abstract class AbstractTransferDropTargetListener
implements TransferDropTargetListener, org.eclipse.gef.dnd.TransferDropTargetListener {

private DropTargetEvent currentEvent;
private AutoexposeHelper exposeHelper;
Expand Down
16 changes: 12 additions & 4 deletions org.eclipse.gef/src/org/eclipse/gef/dnd/DelegatingDragAdapter.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2010 IBM Corporation and others.
* Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
Expand Down Expand Up @@ -46,8 +46,11 @@ public class DelegatingDragAdapter extends org.eclipse.jface.util.DelegatingDrag
* updated to reflect the change.
*
* @param listener the new listener
* @deprecated
* @deprecated Use
* {@link #addDragSourceListener(org.eclipse.jface.util.TransferDragSourceListener)}
* instead. This method will be removed after the 2027-03 release.
*/
@Deprecated(since = "3.0", forRemoval = true)
public void addDragSourceListener(TransferDragSourceListener listener) {
super.addDragSourceListener(listener);
}
Expand All @@ -56,8 +59,10 @@ public void addDragSourceListener(TransferDragSourceListener listener) {
* Combines the <code>Transfer</code>s from every TransferDragSourceListener.
*
* @return the combined <code>Transfer</code>s
* @deprecated call getTransfers() instead.
* @deprecated call getTransfers() instead. This method will be removed after
* the 2027-03 release.
*/
@Deprecated(since = "3.0", forRemoval = true)
public Transfer[] getTransferTypes() {
return super.getTransfers();
}
Expand All @@ -67,8 +72,11 @@ public Transfer[] getTransferTypes() {
* updated to reflect the change.
*
* @param listener the listener being removed
* @deprecated
* @deprecated Use
* {@link #removeDragSourceListener(org.eclipse.jface.util.TransferDragSourceListener)}
* instead. This method will be removed after the 2027-03 release.
*/
@Deprecated(since = "3.0", forRemoval = true)
public void removeDragSourceListener(TransferDragSourceListener listener) {
super.removeDragSourceListener(listener);
}
Expand Down
12 changes: 10 additions & 2 deletions org.eclipse.gef/src/org/eclipse/gef/dnd/DelegatingDropAdapter.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2010 IBM Corporation and others.
* Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
Expand Down Expand Up @@ -39,8 +39,11 @@ public class DelegatingDropAdapter extends org.eclipse.jface.util.DelegatingDrop
* Adds the given TransferDropTargetListener.
*
* @param listener the listener
* @deprecated
* @deprecated Use
* {@link #addDropTargetListener(org.eclipse.jface.util.TransferDropTargetListener)}
* instead. This method will be removed after the 2027-03 release.
*/
@Deprecated(since = "3.0", forRemoval = true)
public void addDropTargetListener(TransferDropTargetListener listener) {
super.addDropTargetListener(listener);
}
Expand All @@ -51,6 +54,7 @@ public void addDropTargetListener(TransferDropTargetListener listener) {
* @return the merged Transfers from all listeners
* @deprecated use getTransfers() instead
*/
@Deprecated(since = "3.0", forRemoval = true)
public Transfer[] getTransferTypes() {
return super.getTransfers();
}
Expand All @@ -59,7 +63,11 @@ public Transfer[] getTransferTypes() {
* Removes the given <code>TransferDropTargetListener</code>.
*
* @param listener the listener
* @deprecated Use
* {@link #removeDropTargetListener(org.eclipse.jface.util.TransferDropTargetListener)}
* instead. This method will be removed after the 2027-03 release.
*/
@Deprecated(since = "3.21", forRemoval = true)
public void removeDropTargetListener(TransferDropTargetListener listener) {
super.removeDropTargetListener(listener);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2010 IBM Corporation and others.
* Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
Expand Down Expand Up @@ -33,11 +33,12 @@
public class TemplateTransferDragSourceListener extends AbstractTransferDragSourceListener {

/**
* @deprecated Use the constructor without the transfer specified.
* @deprecated Use the constructor without the transfer specified. This
* constructor will be removed after the 2027-03 release.
* @param viewer viewer
* @param xfer xfer
*/
@Deprecated
@Deprecated(since = "3.0", forRemoval = true)
public TemplateTransferDragSourceListener(EditPartViewer viewer, Transfer xfer) {
super(viewer, xfer);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2010 IBM Corporation and others.
* Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
Expand Down Expand Up @@ -29,6 +29,7 @@
*
* @deprecated use org.eclipse.jface.util.TransferDragSourceListener instead
*/
@Deprecated(since = "3.21", forRemoval = true)
public interface TransferDragSourceListener extends org.eclipse.jface.util.TransferDragSourceListener {

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2010 IBM Corporation and others.
* Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
Expand Down Expand Up @@ -30,6 +30,7 @@
*
* @deprecated use org.eclipse.jface.util.TransferDropTargetListener instead
*/
@Deprecated(since = "3.21", forRemoval = true)
public interface TransferDropTargetListener extends org.eclipse.jface.util.TransferDropTargetListener {

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2010 IBM Corporation and others.
* Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
Expand Down Expand Up @@ -141,8 +141,11 @@ public void setSelectionManager(SelectionManager model) {

/**
* @see EditPartViewer#addDragSourceListener(org.eclipse.gef.dnd.TransferDragSourceListener)
* @deprecated Use {@link #addDragSourceListener(TransferDragSourceListener)}
* instead. This method will be removed after the 2027-03 release.
*/
@Override
@Deprecated(since = "3.21", forRemoval = true)
public void addDragSourceListener(org.eclipse.gef.dnd.TransferDragSourceListener listener) {
addDragSourceListener((TransferDragSourceListener) listener);
}
Expand All @@ -158,8 +161,11 @@ public void addDragSourceListener(TransferDragSourceListener listener) {

/**
* @see EditPartViewer#addDropTargetListener(org.eclipse.gef.dnd.TransferDropTargetListener)
* @deprecated Use {@link #addDropTargetListener(TransferDropTargetListener)}
* instead. This method will be removed after the 2027-03 release.
*/
@Override
@Deprecated(since = "3.21", forRemoval = true)
public void addDropTargetListener(org.eclipse.gef.dnd.TransferDropTargetListener listener) {
addDropTargetListener((TransferDropTargetListener) listener);
}
Expand Down Expand Up @@ -562,9 +568,10 @@ public void registerAccessibleEditPart(AccessibleEditPart acc) {

/**
* @see EditPartViewer#removeDragSourceListener(org.eclipse.gef.dnd.TransferDragSourceListener)
* @deprecated
* @deprecated Use {@link #removeDragSourceListener(TransferDragSourceListener)}
* instead. This method will be removed after the 2027-03 release.
*/
@Deprecated
@Deprecated(since = "3.0", forRemoval = true)
@Override
public void removeDragSourceListener(org.eclipse.gef.dnd.TransferDragSourceListener listener) {
removeDragSourceListener((TransferDragSourceListener) listener);
Expand All @@ -583,9 +590,10 @@ public void removeDragSourceListener(TransferDragSourceListener listener) {

/**
* @see EditPartViewer#removeDropTargetListener(org.eclipse.gef.dnd.TransferDropTargetListener)
* @deprecated
* @deprecated Use {@link #removeDropTargetListener(TransferDropTargetListener)}
* instead. This method will be removed after the 2027-03 release.
*/
@Deprecated
@Deprecated(since = "3.0", forRemoval = true)
@Override
public void removeDropTargetListener(org.eclipse.gef.dnd.TransferDropTargetListener listener) {
removeDropTargetListener((TransferDropTargetListener) listener);
Expand Down
Loading

0 comments on commit 6048a18

Please sign in to comment.