Bug 497807 - Use varargs in DropTarget#setTransfer
Convert snippets/examples to make use of the varargs.
Change-Id: I66dfa2ce047e995e2b561c6d0296b75b34f2a91f
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/FileViewer.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/FileViewer.java
index f3f655d..7343feb 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/FileViewer.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/FileViewer.java
@@ -492,7 +492,7 @@
*/
private DragSource createTreeDragSource(final Tree tree){
DragSource dragSource = new DragSource(tree, DND.DROP_MOVE | DND.DROP_COPY);
- dragSource.setTransfer(new Transfer[] { FileTransfer.getInstance() });
+ dragSource.setTransfer(FileTransfer.getInstance());
dragSource.addDragListener(new DragSourceListener() {
TreeItem[] dndSelection = null;
String[] sourceNames = null;
@@ -803,7 +803,7 @@
*/
private DragSource createTableDragSource(final Table table) {
DragSource dragSource = new DragSource(table, DND.DROP_MOVE | DND.DROP_COPY);
- dragSource.setTransfer(new Transfer[] { FileTransfer.getInstance() });
+ dragSource.setTransfer(FileTransfer.getInstance());
dragSource.addDragListener(new DragSourceListener() {
TableItem[] dndSelection = null;
String[] sourceNames = null;
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet171.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet171.java
index cedc975..10c282c 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet171.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet171.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -225,8 +225,7 @@
label3.setText("Drop Target for MyData2");
DragSource source = new DragSource(label1, DND.DROP_COPY);
- source.setTransfer(new Transfer[] { MyTransfer.getInstance(),
- MyTransfer2.getInstance() });
+ source.setTransfer(MyTransfer.getInstance(), MyTransfer2.getInstance());
source.addDragListener(new DragSourceAdapter() {
@Override
public void dragSetData(DragSourceEvent event) {
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet185.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet185.java
index 4bc4fd9..18d27db 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet185.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet185.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -38,7 +38,7 @@
if (i % 2 == 1) item.setText("Drop text");
}
DragSource dragSource = new DragSource(label1, DND.DROP_COPY);
- dragSource.setTransfer(new Transfer[] {TextTransfer.getInstance(), FileTransfer.getInstance()});
+ dragSource.setTransfer(TextTransfer.getInstance(), FileTransfer.getInstance());
dragSource.addDragListener(new DragSourceAdapter() {
@Override
public void dragSetData(DragSourceEvent event) {
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet210.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet210.java
index d9790da..32bae25 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet210.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet210.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -47,7 +47,7 @@
final StyledText text1 = new StyledText(shell, style);
text1.setText(string1);
DragSource source = new DragSource(text1, DND.DROP_COPY | DND.DROP_MOVE);
- source.setTransfer(new Transfer[] {TextTransfer.getInstance()});
+ source.setTransfer(TextTransfer.getInstance());
source.addDragListener(new DragSourceAdapter() {
Point selection;
@Override
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet257.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet257.java
index e62b768..4bf9bdb 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet257.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet257.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2013 IBM Corporation and others.
+ * Copyright (c) 2007, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -51,7 +51,7 @@
event.image = display.getSystemImage(SWT.ICON_WARNING);
}
});
- source.setTransfer(new Transfer[] {TextTransfer.getInstance()});
+ source.setTransfer(TextTransfer.getInstance());
source.addDragListener(new DragSourceAdapter() {
Point selection;
@Override
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet284.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet284.java
index cd27be9..452df8e 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet284.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet284.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2013 IBM Corporation and others.
+ * Copyright (c) 2007, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -44,7 +44,7 @@
public static void setDragSource (final Label label) {
int operations = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK;
final DragSource source = new DragSource (label, operations);
- source.setTransfer(new Transfer[] {URLTransfer.getInstance()});
+ source.setTransfer(URLTransfer.getInstance());
source.addDragListener (new DragSourceListener () {
@Override
public void dragStart(DragSourceEvent e) {
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet319.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet319.java
index 3922ec2..f60bfaf 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet319.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet319.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -19,22 +19,27 @@
* For a list of all SWT example snippets see
* http://www.eclipse.org/swt/snippets/
*/
-import java.awt.Frame;
+import java.awt.*;
import java.awt.datatransfer.*;
-import java.awt.dnd.DnDConstants;
+import java.awt.dnd.*;
import java.awt.dnd.DropTarget;
import java.awt.dnd.DropTargetAdapter;
-import java.awt.dnd.DropTargetDropEvent;
import java.awt.dnd.DropTargetListener;
import java.io.*;
-import java.util.Date;
-import javax.swing.JLabel;
+import java.util.*;
+
+import javax.swing.*;
import org.eclipse.swt.*;
import org.eclipse.swt.awt.*;
import org.eclipse.swt.dnd.*;
+import org.eclipse.swt.dnd.DragSource;
+import org.eclipse.swt.dnd.DragSourceAdapter;
+import org.eclipse.swt.dnd.DragSourceEvent;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
public class Snippet319 {
@@ -61,8 +66,7 @@
swtLabel.setBounds(10,10,580,50);
swtLabel.setText("SWT drag source");
DragSource dragSource = new DragSource(swtLabel, DND.DROP_COPY);
- Transfer[] transfers = new Transfer[] {new MyTypeTransfer()};
- dragSource.setTransfer(transfers);
+ dragSource.setTransfer(new MyTypeTransfer());
dragSource.addDragListener(new DragSourceAdapter() {
@Override
public void dragSetData(DragSourceEvent event) {
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet79.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet79.java
index e0ec6e8..11ca725 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet79.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet79.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -142,7 +142,7 @@
label2.setText ("Drop Target for MyData[]");
DragSource source = new DragSource (label1, DND.DROP_COPY);
- source.setTransfer (new Transfer [] {MyTransfer.getInstance ()});
+ source.setTransfer (MyTransfer.getInstance ());
source.addDragListener (new DragSourceAdapter () {
@Override
public void dragSetData (DragSourceEvent event) {
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet84.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet84.java
index 41e0681..8a2f86b 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet84.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet84.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -31,7 +31,7 @@
final Label label = new Label(shell, SWT.BORDER);
label.setText("Drag Source");
DragSource source = new DragSource(label, DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK);
- source.setTransfer(new Transfer[] {TextTransfer.getInstance()});
+ source.setTransfer(TextTransfer.getInstance());
source.addDragListener(new DragSourceAdapter() {
@Override
public void dragSetData(DragSourceEvent event) {