summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorHendrik Still2013-07-25 17:48:36 (EDT)
committer Gerrit Code Review @ Eclipse.org2013-07-31 14:29:13 (EDT)
commitd4512cc2031b6e598b54f707d87c2f10c3feec93 (patch)
treee56e5546d541a9a399242dadcd4f7ab2690ba93c
parentb8361f58ee24a39c51331c544ce8fb3dd6979993 (diff)
downloadeclipse.platform.ui-d4512cc2031b6e598b54f707d87c2f10c3feec93.zip
eclipse.platform.ui-d4512cc2031b6e598b54f707d87c2f10c3feec93.tar.gz
eclipse.platform.ui-d4512cc2031b6e598b54f707d87c2f10c3feec93.tar.bz2
Bug 413688 - Fix compiler warnings in org.eclipse.jface.util caused byrefs/changes/75/14875/4
moving JFace to Java 1.5 Change-Id: If212e6ebc40bcabaf6a75779f8fe79c7ace64ffa Signed-off-by: Hendrik Still <hendrik.still@gammas.de>
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/util/BidiUtils.java2
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/util/DelegatingDragAdapter.java20
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/util/DelegatingDropAdapter.java8
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/util/Policy.java14
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/util/SafeRunnableDialog.java2
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/util/Util.java21
6 files changed, 33 insertions, 34 deletions
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/util/BidiUtils.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/util/BidiUtils.java
index 1a29c5c..5013576 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/util/BidiUtils.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/util/BidiUtils.java
@@ -79,7 +79,7 @@ public final class BidiUtils {
* Listener cache. Map from structured text type id ({@link String})
* to structured text segment listener ({@link SegmentListener}).
*/
- private static final Map/*<String, SegmentListener>*/ structuredTextSegmentListeners = new HashMap();
+ private static final Map<String, SegmentListener> structuredTextSegmentListeners = new HashMap<String, SegmentListener>();
/**
* The LRE char
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/util/DelegatingDragAdapter.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/util/DelegatingDragAdapter.java
index b1668b5..f51960e 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/util/DelegatingDragAdapter.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/util/DelegatingDragAdapter.java
@@ -88,9 +88,9 @@ import org.eclipse.swt.dnd.TransferData;
* @since 3.0
*/
public class DelegatingDragAdapter implements DragSourceListener {
- private List listeners = new ArrayList();
+ private List<TransferDragSourceListener> listeners = new ArrayList<TransferDragSourceListener>();
- private List activeListeners = new ArrayList();
+ private List<TransferDragSourceListener> activeListeners = new ArrayList<TransferDragSourceListener>();
private TransferDragSourceListener currentListener;
@@ -124,9 +124,9 @@ public class DelegatingDragAdapter implements DragSourceListener {
// The drag was canceled and currentListener was never set, so send the
// dragFinished event to all the active listeners.
event.doit = false;
- Iterator iterator = activeListeners.iterator();
+ Iterator<TransferDragSourceListener> iterator = activeListeners.iterator();
while (iterator.hasNext()) {
- ((TransferDragSourceListener) iterator.next())
+ iterator.next()
.dragFinished(event);
}
}
@@ -171,11 +171,11 @@ public class DelegatingDragAdapter implements DragSourceListener {
// if (Policy.DEBUG_DRAG_DROP)
// System.out.println("Drag Start: " + toString()); //$NON-NLS-1$
boolean doit = false; // true if any one of the listeners can handle the drag
- List transfers = new ArrayList(listeners.size());
+ List<Transfer> transfers = new ArrayList<Transfer>(listeners.size());
activeListeners.clear();
for (int i = 0; i < listeners.size(); i++) {
- final TransferDragSourceListener listener = (TransferDragSourceListener) listeners
+ final TransferDragSourceListener listener = listeners
.get(i);
event.doit = true; // restore event.doit
SafeRunnable.run(new SafeRunnable() {
@@ -191,7 +191,7 @@ public class DelegatingDragAdapter implements DragSourceListener {
}
if (doit) {
- ((DragSource) event.widget).setTransfer((Transfer[]) transfers
+ ((DragSource) event.widget).setTransfer(transfers
.toArray(new Transfer[transfers.size()]));
}
@@ -206,7 +206,7 @@ public class DelegatingDragAdapter implements DragSourceListener {
public Transfer[] getTransfers() {
Transfer[] types = new Transfer[listeners.size()];
for (int i = 0; i < listeners.size(); i++) {
- TransferDragSourceListener listener = (TransferDragSourceListener) listeners
+ TransferDragSourceListener listener = listeners
.get(i);
types[i] = listener.getTransfer();
}
@@ -252,9 +252,9 @@ public class DelegatingDragAdapter implements DragSourceListener {
if (event.dataType == null) {
return;
}
- Iterator iterator = activeListeners.iterator();
+ Iterator<TransferDragSourceListener> iterator = activeListeners.iterator();
while (iterator.hasNext()) {
- TransferDragSourceListener listener = (TransferDragSourceListener) iterator
+ TransferDragSourceListener listener = iterator
.next();
if (listener.getTransfer().isSupportedType(event.dataType)) {
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/util/DelegatingDropAdapter.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/util/DelegatingDropAdapter.java
index d9626c5..fc6f2d1 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/util/DelegatingDropAdapter.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/util/DelegatingDropAdapter.java
@@ -99,7 +99,7 @@ import org.eclipse.swt.dnd.TransferData;
* @since 3.0
*/
public class DelegatingDropAdapter implements DropTargetListener {
- private List listeners = new ArrayList();
+ private List<TransferDropTargetListener> listeners = new ArrayList<TransferDropTargetListener>();
private TransferDropTargetListener currentListener;
@@ -273,7 +273,7 @@ public class DelegatingDropAdapter implements DropTargetListener {
public Transfer[] getTransfers() {
Transfer[] types = new Transfer[listeners.size()];
for (int i = 0; i < listeners.size(); i++) {
- TransferDropTargetListener listener = (TransferDropTargetListener) listeners
+ TransferDropTargetListener listener = listeners
.get(i);
types[i] = listener.getTransfer();
}
@@ -352,9 +352,9 @@ public class DelegatingDropAdapter implements DropTargetListener {
// to something other than what the user indicated.
event.detail = originalDropType;
- Iterator iter = listeners.iterator();
+ Iterator<TransferDropTargetListener> iter = listeners.iterator();
while (iter.hasNext()) {
- TransferDropTargetListener listener = (TransferDropTargetListener) iter
+ TransferDropTargetListener listener = iter
.next();
TransferData dataType = getSupportedTransferType(event.dataTypes,
listener);
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/util/Policy.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/util/Policy.java
index 1242afe..a07f55a 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/util/Policy.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/util/Policy.java
@@ -42,7 +42,7 @@ public class Policy {
private static ILogger log;
- private static Comparator viewerComparator;
+ private static Comparator<String> viewerComparator;
private static AnimatorFactory animatorFactory;
@@ -172,8 +172,8 @@ public class Policy {
*
* @return a default comparator used by JFace to sort strings
*/
- private static Comparator getDefaultComparator() {
- return new Comparator() {
+ private static Comparator<String> getDefaultComparator() {
+ return new Comparator<String>() {
/**
* Compares string s1 to string s2.
*
@@ -188,8 +188,8 @@ public class Policy {
* @exception ClassCastException
* the arguments cannot be cast to Strings.
*/
- public int compare(Object s1, Object s2) {
- return ((String) s1).compareTo((String) s2);
+ public int compare(String s1, String s2) {
+ return s1.compareTo(s2);
}
};
}
@@ -200,7 +200,7 @@ public class Policy {
* @return the comparator used by JFace to sort strings
* @since 3.2
*/
- public static Comparator getComparator() {
+ public static Comparator<String> getComparator() {
if (viewerComparator == null) {
viewerComparator = getDefaultComparator();
}
@@ -214,7 +214,7 @@ public class Policy {
* comparator used by JFace to sort strings
* @since 3.2
*/
- public static void setComparator(Comparator comparator) {
+ public static void setComparator(Comparator<String> comparator) {
org.eclipse.core.runtime.Assert.isTrue(viewerComparator == null);
viewerComparator = comparator;
}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/util/SafeRunnableDialog.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/util/SafeRunnableDialog.java
index ea4f433..48c6d2c 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/util/SafeRunnableDialog.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/util/SafeRunnableDialog.java
@@ -43,7 +43,7 @@ class SafeRunnableDialog extends ErrorDialog {
private TableViewer statusListViewer;
- private Collection statuses = new ArrayList();
+ private Collection<IStatus> statuses = new ArrayList<IStatus>();
/**
* Create a new instance of the receiver on a status.
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/util/Util.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/util/Util.java
index 08dcf5b..09146e0 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/util/Util.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/util/Util.java
@@ -33,8 +33,8 @@ public final class Util {
* An unmodifiable, empty, sorted set. This value is guaranteed to never
* change and never be <code>null</code>.
*/
- public static final SortedSet EMPTY_SORTED_SET = Collections
- .unmodifiableSortedSet(new TreeSet());
+ public static final SortedSet<?> EMPTY_SORTED_SET = Collections
+ .unmodifiableSortedSet(new TreeSet<Object>());
/**
* A common zero-length string. It avoids needing write <code>NON-NLS</code>
@@ -51,7 +51,7 @@ public final class Util {
* The class which the object should be; must not be
* <code>null</code>.
*/
- public static final void assertInstance(final Object object, final Class c) {
+ public static final void assertInstance(final Object object, final Class<?> c) {
assertInstance(object, c, false);
}
@@ -69,7 +69,7 @@ public final class Util {
* Whether the object is allowed to be <code>null</code>.
*/
private static final void assertInstance(final Object object,
- final Class c, final boolean allowNull) {
+ final Class<?> c, final boolean allowNull) {
if (object == null && allowNull) {
return;
}
@@ -120,8 +120,8 @@ public final class Util {
* @return The result of the comparison. <code>null</code> is considered
* to be the least possible value.
*/
- public static final int compare(final Comparable left,
- final Comparable right) {
+ public static final <T extends Comparable<? super T>> int compare(final T left,
+ final T right) {
if (left == null && right == null) {
return 0;
} else if (left == null) {
@@ -145,8 +145,8 @@ public final class Util {
* to be the least possible value. A shorter array is considered
* less than a longer array.
*/
- public static final int compare(final Comparable[] left,
- final Comparable[] right) {
+ public static final <T extends Comparable<? super T>> int compare(final T[] left,
+ final T[] right) {
if (left == null && right == null) {
return 0;
} else if (left == null) {
@@ -187,7 +187,7 @@ public final class Util {
* to be the least possible value. A shorter list is considered less
* than a longer list.
*/
- public static final int compare(final List left, final List right) {
+ public static final <T extends Comparable<? super T>> int compare(final List<T> left, final List<T> right) {
if (left == null && right == null) {
return 0;
} else if (left == null) {
@@ -203,8 +203,7 @@ public final class Util {
}
for (int i = 0; i < l; i++) {
- int compareTo = compare((Comparable) left.get(i),
- (Comparable) right.get(i));
+ int compareTo = compare(left.get(i), right.get(i));
if (compareTo != 0) {
return compareTo;