summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorHendrik Still2013-07-23 09:54:28 (EDT)
committer Gerrit Code Review @ Eclipse.org2013-07-23 11:28:13 (EDT)
commit819e6ff448f57dc4ee61c75ad1d8f68e4bc560e6 (patch)
tree442a9f544b25a2c7e9ee11bb3517348a8477a15a
parent6e4b8757a3fb97f5ad0c076c920988bc185eabd4 (diff)
downloadeclipse.platform.ui-819e6ff448f57dc4ee61c75ad1d8f68e4bc560e6.zip
eclipse.platform.ui-819e6ff448f57dc4ee61c75ad1d8f68e4bc560e6.tar.gz
eclipse.platform.ui-819e6ff448f57dc4ee61c75ad1d8f68e4bc560e6.tar.bz2
Bug 413529 - Fix compiler warnings in org.eclipse.jface.actionrefs/changes/79/14779/2
Change-Id: If9f56307655669f24689a211c6a11405fc7c3c62 Signed-off-by: Hendrik Still <hendrik.still@gammas.de>
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/action/Action.java2
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/action/ContributionManager.java24
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/action/CoolBarManager.java88
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/action/ExternalActionManager.java11
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/action/LegacyActionTools.java18
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/action/MenuManager.java6
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/action/SubContributionManager.java20
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/action/SubMenuManager.java18
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/action/ToolBarContributionItem.java6
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/action/ToolBarManager.java10
10 files changed, 102 insertions, 101 deletions
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/Action.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/Action.java
index 9a378d6..dc389a9 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/Action.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/Action.java
@@ -23,7 +23,7 @@ import org.eclipse.swt.widgets.Menu;
* the action's semantics.
* </p>
*/
-public abstract class Action extends AbstractAction implements IAction {
+public abstract class Action extends AbstractAction {
private static final IMenuCreator VAL_DROP_DOWN_MENU = new IMenuCreator() {
public void dispose() {
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/ContributionManager.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/ContributionManager.java
index 003ef8b..a5379bd 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/ContributionManager.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/ContributionManager.java
@@ -44,7 +44,7 @@ public abstract class ContributionManager implements IContributionManager {
/**
* The list of contribution items.
*/
- private List contributions = new ArrayList();
+ private List<IContributionItem> contributions = new ArrayList<IContributionItem>();
/**
* Indicates whether the widgets are in sync with the contributions.
@@ -104,16 +104,16 @@ public abstract class ContributionManager implements IContributionManager {
private void addToGroup(String groupName, IContributionItem item,
boolean append) {
int i;
- Iterator items = contributions.iterator();
+ Iterator<IContributionItem> items = contributions.iterator();
for (i = 0; items.hasNext(); i++) {
- IContributionItem o = (IContributionItem) items.next();
+ IContributionItem o = items.next();
if (o.isGroupMarker()) {
String id = o.getId();
if (id != null && id.equalsIgnoreCase(groupName)) {
i++;
if (append) {
for (; items.hasNext(); i++) {
- IContributionItem ci = (IContributionItem) items
+ IContributionItem ci = items
.next();
if (ci.isGroupMarker()) {
break;
@@ -177,7 +177,7 @@ public abstract class ContributionManager implements IContributionManager {
System.out.println(" Number of elements: " + size);//$NON-NLS-1$
int sum = 0;
for (int i = 0; i < size; i++) {
- if (((IContributionItem) contributions.get(i)).isVisible()) {
+ if (contributions.get(i).isVisible()) {
sum++;
}
}
@@ -189,9 +189,9 @@ public abstract class ContributionManager implements IContributionManager {
* (non-Javadoc) Method declared on IContributionManager.
*/
public IContributionItem find(String id) {
- Iterator e = contributions.iterator();
+ Iterator<IContributionItem> e = contributions.iterator();
while (e.hasNext()) {
- IContributionItem item = (IContributionItem) e.next();
+ IContributionItem item = e.next();
String itemId = item.getId();
if (itemId != null && itemId.equalsIgnoreCase(id)) {
return item;
@@ -276,7 +276,7 @@ public abstract class ContributionManager implements IContributionManager {
*/
public int indexOf(String id) {
for (int i = 0; i < contributions.size(); i++) {
- IContributionItem item = (IContributionItem) contributions.get(i);
+ IContributionItem item = contributions.get(i);
String itemId = item.getId();
if (itemId != null && itemId.equalsIgnoreCase(id)) {
return i;
@@ -376,8 +376,8 @@ public abstract class ContributionManager implements IContributionManager {
return true;
}
if (hasDynamicItems()) {
- for (Iterator iter = contributions.iterator(); iter.hasNext();) {
- IContributionItem item = (IContributionItem) iter.next();
+ for (Iterator<IContributionItem> iter = contributions.iterator(); iter.hasNext();) {
+ IContributionItem item = iter.next();
if (item.isDirty()) {
return true;
}
@@ -512,7 +512,7 @@ public abstract class ContributionManager implements IContributionManager {
}
// Remove the old item.
- final IContributionItem oldItem = (IContributionItem) contributions
+ final IContributionItem oldItem = contributions
.get(index);
itemRemoved(oldItem);
@@ -522,7 +522,7 @@ public abstract class ContributionManager implements IContributionManager {
// Go through and remove duplicates.
for (int i = contributions.size() - 1; i > index; i--) {
- IContributionItem item = (IContributionItem) contributions.get(i);
+ IContributionItem item = contributions.get(i);
if ((item != null) && (identifier.equals(item.getId()))) {
if (Policy.TRACE_TOOLBAR) {
System.out
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/CoolBarManager.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/CoolBarManager.java
index cbdf796..53ec8f1 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/CoolBarManager.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/CoolBarManager.java
@@ -46,7 +46,7 @@ public class CoolBarManager extends ContributionManager implements
/**
* The original creation order of the contribution items.
*/
- private ArrayList cbItemsCreationOrder = new ArrayList();
+ private ArrayList<IContributionItem> cbItemsCreationOrder = new ArrayList<IContributionItem>();
/**
* MenuManager for cool bar pop-up menu, or null if none.
@@ -120,22 +120,22 @@ public class CoolBarManager extends ContributionManager implements
* removed; this value is never <code>null</code>, but may be
* empty.
*/
- private ArrayList adjustContributionList(ArrayList contributionList) {
+ private ArrayList<IContributionItem> adjustContributionList(ArrayList<IContributionItem> contributionList) {
IContributionItem item;
// Fist remove a separator if it is the first element of the list
if (contributionList.size() != 0) {
- item = (IContributionItem) contributionList.get(0);
+ item = contributionList.get(0);
if (item.isSeparator()) {
contributionList.remove(0);
}
- ListIterator iterator = contributionList.listIterator();
+ ListIterator<IContributionItem> iterator = contributionList.listIterator();
// collapse consecutive separators
while (iterator.hasNext()) {
- item = (IContributionItem) iterator.next();
+ item = iterator.next();
if (item.isSeparator()) {
while (iterator.hasNext()) {
- item = (IContributionItem) iterator.next();
+ item = iterator.next();
if (item.isSeparator()) {
iterator.remove();
} else {
@@ -147,7 +147,7 @@ public class CoolBarManager extends ContributionManager implements
}
if (contributionList.size() != 0) {
// Now check last element to see if there is a separator
- item = (IContributionItem) contributionList.get(contributionList
+ item = contributionList.get(contributionList
.size() - 1);
if (item.isSeparator()) {
contributionList.remove(contributionList.size() - 1);
@@ -209,10 +209,10 @@ public class CoolBarManager extends ContributionManager implements
* @param iterator
* the list iterator.
*/
- private void collapseSeparators(ListIterator iterator) {
+ private void collapseSeparators(ListIterator<IContributionItem> iterator) {
while (iterator.hasNext()) {
- IContributionItem item = (IContributionItem) iterator.next();
+ IContributionItem item = iterator.next();
if (!item.isSeparator()) {
iterator.previous();
return;
@@ -396,9 +396,9 @@ public class CoolBarManager extends ContributionManager implements
*
* @return an array list of contribution items.
*/
- private ArrayList getItemList() {
+ private ArrayList<IContributionItem> getItemList() {
IContributionItem[] cbItems = getItems();
- ArrayList list = new ArrayList(cbItems.length);
+ ArrayList<IContributionItem> list = new ArrayList<IContributionItem>(cbItems.length);
for (int i = 0; i < cbItems.length; i++) {
list.add(cbItems[i]);
}
@@ -463,7 +463,7 @@ public class CoolBarManager extends ContributionManager implements
boolean replaced = false;
final int size = cbItemsCreationOrder.size();
for (int i = 0; i < size; i++) {
- IContributionItem created = (IContributionItem) cbItemsCreationOrder
+ IContributionItem created = cbItemsCreationOrder
.get(i);
if (created.getId() != null && created.getId().equals(item.getId())) {
cbItemsCreationOrder.set(i, item);
@@ -505,11 +505,11 @@ public class CoolBarManager extends ContributionManager implements
* Whether the current item in the iterator should be considered
* (as well as subsequent items).
*/
- private void nextRow(ListIterator iterator, boolean ignoreCurrentItem) {
+ private void nextRow(ListIterator<IContributionItem> iterator, boolean ignoreCurrentItem) {
IContributionItem currentElement = null;
if (!ignoreCurrentItem && iterator.hasPrevious()) {
- currentElement = (IContributionItem) iterator.previous();
+ currentElement = iterator.previous();
iterator.next();
}
@@ -520,7 +520,7 @@ public class CoolBarManager extends ContributionManager implements
//Find next separator
while (iterator.hasNext()) {
- IContributionItem item = (IContributionItem) iterator.next();
+ IContributionItem item = iterator.next();
if (item.isSeparator()) {
// we we find a separator, collapse any consecutive
// separators
@@ -566,7 +566,7 @@ public class CoolBarManager extends ContributionManager implements
}
// Retreives the list of contribution items as an array list
- ArrayList contributionList = getItemList();
+ ArrayList<IContributionItem> contributionList = getItemList();
// Check the size of the list
if (contributionList.size() == 0) {
@@ -584,7 +584,7 @@ public class CoolBarManager extends ContributionManager implements
// Traverse through all cool items in the coolbar add them to a new
// data structure
// in the correct order
- ArrayList displayedItems = new ArrayList(coolBar.getItemCount());
+ ArrayList<IContributionItem> displayedItems = new ArrayList<IContributionItem>(coolBar.getItemCount());
for (int i = 0; i < coolItems.length; i++) {
CoolItem coolItem = coolItems[i];
if (coolItem.getData() instanceof IContributionItem) {
@@ -603,14 +603,14 @@ public class CoolBarManager extends ContributionManager implements
}
// Determine which rows are invisible
- ArrayList existingVisibleRows = new ArrayList(4);
- ListIterator rowIterator = contributionList.listIterator();
+ ArrayList<Integer> existingVisibleRows = new ArrayList<Integer>(4);
+ ListIterator<IContributionItem> rowIterator = contributionList.listIterator();
collapseSeparators(rowIterator);
int numRow = 0;
while (rowIterator.hasNext()) {
// Scan row
while (rowIterator.hasNext()) {
- IContributionItem cbItem = (IContributionItem) rowIterator
+ IContributionItem cbItem = rowIterator
.next();
if (displayedItems.contains(cbItem)) {
existingVisibleRows.add(new Integer(numRow));
@@ -624,20 +624,20 @@ public class CoolBarManager extends ContributionManager implements
numRow++;
}
- Iterator existingRows = existingVisibleRows.iterator();
+ Iterator<Integer> existingRows = existingVisibleRows.iterator();
// Adjust row number to the first visible
if (existingRows.hasNext()) {
- row = ((Integer) existingRows.next()).intValue();
+ row = existingRows.next().intValue();
}
- HashMap itemLocation = new HashMap();
- for (ListIterator locationIterator = displayedItems.listIterator(); locationIterator
+ HashMap<IContributionItem, Integer> itemLocation = new HashMap<IContributionItem, Integer>();
+ for (ListIterator<IContributionItem> locationIterator = displayedItems.listIterator(); locationIterator
.hasNext();) {
- IContributionItem item = (IContributionItem) locationIterator
+ IContributionItem item = locationIterator
.next();
if (item.isSeparator()) {
if (existingRows.hasNext()) {
- Integer value = (Integer) existingRows.next();
+ Integer value = existingRows.next();
row = value.intValue();
} else {
row++;
@@ -649,9 +649,9 @@ public class CoolBarManager extends ContributionManager implements
}
// Insert the contribution items in their correct location
- for (ListIterator iterator = displayedItems.listIterator(); iterator
+ for (ListIterator<IContributionItem> iterator = displayedItems.listIterator(); iterator
.hasNext();) {
- IContributionItem cbItem = (IContributionItem) iterator.next();
+ IContributionItem cbItem = iterator.next();
if (cbItem.isSeparator()) {
coolItemIndex = 0;
} else {
@@ -665,7 +665,7 @@ public class CoolBarManager extends ContributionManager implements
if (contributionList.size() != 0) {
IContributionItem[] array = new IContributionItem[contributionList
.size() - 1];
- array = (IContributionItem[]) contributionList.toArray(array);
+ array = contributionList.toArray(array);
internalSetItems(array);
}
@@ -683,19 +683,19 @@ public class CoolBarManager extends ContributionManager implements
* @param itemLocation
*/
private void relocate(IContributionItem cbItem, int index,
- ArrayList contributionList, HashMap itemLocation) {
+ ArrayList<IContributionItem> contributionList, HashMap<IContributionItem, Integer> itemLocation) {
- if (!(itemLocation.get(cbItem) instanceof Integer)) {
+ if ((itemLocation.get(cbItem) == null)) {
return;
}
- int targetRow = ((Integer) itemLocation.get(cbItem)).intValue();
+ int targetRow = itemLocation.get(cbItem).intValue();
int cbInternalIndex = contributionList.indexOf(cbItem);
// by default add to end of list
int insertAt = contributionList.size();
// Find the row to place this item in.
- ListIterator iterator = contributionList.listIterator();
+ ListIterator<IContributionItem> iterator = contributionList.listIterator();
// bypass any separators at the begining
collapseSeparators(iterator);
int currentRow = -1;
@@ -709,9 +709,9 @@ public class CoolBarManager extends ContributionManager implements
// first check the position of the current element (item)
// then get the next element
while (iterator.hasNext()) {
- IContributionItem item = (IContributionItem) iterator
+ IContributionItem item = iterator
.next();
- Integer itemRow = (Integer) itemLocation.get(item);
+ Integer itemRow = itemLocation.get(item);
if (item.isSeparator()) {
break;
}
@@ -757,9 +757,9 @@ public class CoolBarManager extends ContributionManager implements
* order is the order in which the contribution items where added.
*/
public void resetItemOrder() {
- for (ListIterator iterator = cbItemsCreationOrder.listIterator(); iterator
+ for (ListIterator<IContributionItem> iterator = cbItemsCreationOrder.listIterator(); iterator
.hasNext();) {
- IContributionItem item = (IContributionItem) iterator.next();
+ IContributionItem item = iterator.next();
// if its a user separator then do not include in original order.
if ((item.getId() != null) && (item.getId().equals(USER_SEPARATOR))) {
iterator.remove();
@@ -846,7 +846,7 @@ public class CoolBarManager extends ContributionManager implements
* a cool bar.
*/
final IContributionItem[] items = getItems();
- final List visibleItems = new ArrayList(items.length);
+ final List<IContributionItem> visibleItems = new ArrayList<IContributionItem>(items.length);
for (int i = 0; i < items.length; i++) {
final IContributionItem item = items[i];
if (isChildVisible(item)) {
@@ -860,7 +860,7 @@ public class CoolBarManager extends ContributionManager implements
* to be disposed. Dynamic items are also removed.
*/
CoolItem[] coolItems = coolBar.getItems();
- final ArrayList coolItemsToRemove = new ArrayList(coolItems.length);
+ final ArrayList<CoolItem> coolItemsToRemove = new ArrayList<CoolItem>(coolItems.length);
for (int i = 0; i < coolItems.length; i++) {
final Object data = coolItems[i].getData();
if ((data == null)
@@ -873,7 +873,7 @@ public class CoolBarManager extends ContributionManager implements
// Dispose of any items in the list to be removed.
for (int i = coolItemsToRemove.size() - 1; i >= 0; i--) {
- CoolItem coolItem = (CoolItem) coolItemsToRemove.get(i);
+ CoolItem coolItem = coolItemsToRemove.get(i);
if (!coolItem.isDisposed()) {
Control control = coolItem.getControl();
if (control != null) {
@@ -890,9 +890,9 @@ public class CoolBarManager extends ContributionManager implements
IContributionItem destinationItem;
int sourceIndex = 0;
int destinationIndex = 0;
- final Iterator visibleItemItr = visibleItems.iterator();
+ final Iterator<IContributionItem> visibleItemItr = visibleItems.iterator();
while (visibleItemItr.hasNext()) {
- sourceItem = (IContributionItem) visibleItemItr.next();
+ sourceItem = visibleItemItr.next();
// Retrieve the corresponding contribution item from SWT's
// data.
@@ -984,7 +984,7 @@ public class CoolBarManager extends ContributionManager implements
if (coolBar != null) {
CoolItem[] items = coolBar.getItems();
if (items != null) {
- ArrayList children = new ArrayList(items.length);
+ ArrayList<Control> children = new ArrayList<Control>(items.length);
for (int i = 0; i < items.length; i++) {
if ((items[i].getControl() != null)
&& (!items[i].getControl().isDisposed())) {
@@ -993,7 +993,7 @@ public class CoolBarManager extends ContributionManager implements
}
// Convert array
Control[] childrenArray = new Control[0];
- childrenArray = (Control[]) children.toArray(childrenArray);
+ childrenArray = children.toArray(childrenArray);
if (childrenArray != null) {
coolBar.setTabList(childrenArray);
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/ExternalActionManager.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/ExternalActionManager.java
index f3a8b15..91f754c 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/ExternalActionManager.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/ExternalActionManager.java
@@ -17,6 +17,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.ResourceBundle;
import java.util.Set;
@@ -122,7 +123,7 @@ public final class ExternalActionManager {
* will be removed from this set and the listener removed. This value
* may be empty, but never <code>null</code>.
*/
- private final Set loggedCommandIds = new HashSet();
+ private final Set<String> loggedCommandIds = new HashSet<String>();
/**
* The list of listeners that have registered for property change
@@ -130,7 +131,7 @@ public final class ExternalActionManager {
* to listeners (<code>IPropertyChangeListener</code> or
* <code>ListenerList</code> of <code>IPropertyChangeListener</code>).
*/
- private final Map registeredListeners = new HashMap();
+ private final Map<String, Object> registeredListeners = new HashMap<String, Object>();
/**
* Constructs a new instance of <code>CommandCallback</code> with the
@@ -257,11 +258,11 @@ public final class ExternalActionManager {
public final void bindingManagerChanged(final BindingManagerEvent event) {
if (event.isActiveBindingsChanged()) {
- final Iterator listenerItr = registeredListeners.entrySet()
+ final Iterator<Entry<String, Object>> listenerItr = registeredListeners.entrySet()
.iterator();
while (listenerItr.hasNext()) {
- final Map.Entry entry = (Map.Entry) listenerItr.next();
- final String commandId = (String) entry.getKey();
+ final Entry<String, Object> entry = listenerItr.next();
+ final String commandId = entry.getKey();
final Command command = commandManager
.getCommand(commandId);
final ParameterizedCommand parameterizedCommand = new ParameterizedCommand(
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/LegacyActionTools.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/LegacyActionTools.java
index ff78c44..2f6aa6b 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/LegacyActionTools.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/LegacyActionTools.java
@@ -38,7 +38,7 @@ public final class LegacyActionTools {
*
* @see #findKeyCode
*/
- private static Map keyCodes = null;
+ private static Map<String, Integer> keyCodes = null;
/**
* Table of string representations of keys (key type: <code>Integer</code>,
@@ -47,7 +47,7 @@ public final class LegacyActionTools {
*
* @see #findKeyString
*/
- private static Map keyStrings = null;
+ private static Map<Integer, String> keyStrings = null;
/**
* The localized uppercase version of ALT
@@ -71,7 +71,7 @@ public final class LegacyActionTools {
*
* @see #findLocalizedKeyCode
*/
- private static Map localizedKeyCodes = null;
+ private static Map<String, Integer> localizedKeyCodes = null;
/**
* The localized uppercase version of SHIFT
@@ -276,7 +276,7 @@ public final class LegacyActionTools {
initKeyCodes();
}
token = token.toUpperCase();
- Integer i = (Integer) keyCodes.get(token);
+ Integer i = keyCodes.get(token);
if (i != null) {
return i.intValue();
}
@@ -305,7 +305,7 @@ public final class LegacyActionTools {
}
int i = keyCode & ~(SWT.CTRL | SWT.ALT | SWT.SHIFT | SWT.COMMAND);
Integer integer = new Integer(i);
- String result = (String) keyStrings.get(integer);
+ String result = keyStrings.get(integer);
if (result != null) {
return result;
}
@@ -331,7 +331,7 @@ public final class LegacyActionTools {
initLocalizedKeyCodes();
}
token = token.toUpperCase();
- Integer i = (Integer) localizedKeyCodes.get(token);
+ Integer i = localizedKeyCodes.get(token);
if (i != null) {
return i.intValue();
}
@@ -478,7 +478,7 @@ public final class LegacyActionTools {
* Initializes the internal key code table.
*/
private static final void initKeyCodes() {
- keyCodes = new HashMap(40);
+ keyCodes = new HashMap<String, Integer>(40);
keyCodes.put("BACKSPACE", new Integer(8)); //$NON-NLS-1$
keyCodes.put("TAB", new Integer(9)); //$NON-NLS-1$
@@ -524,7 +524,7 @@ public final class LegacyActionTools {
* Initializes the internal key string table.
*/
private static void initKeyStrings() {
- keyStrings = new HashMap(40);
+ keyStrings = new HashMap<Integer, String>(40);
keyStrings.put(new Integer(8), JFaceResources.getString("Backspace")); //$NON-NLS-1$
keyStrings.put(new Integer(9), JFaceResources.getString("Tab")); //$NON-NLS-1$
@@ -578,7 +578,7 @@ public final class LegacyActionTools {
* Initializes the localized internal key code table.
*/
private static void initLocalizedKeyCodes() {
- localizedKeyCodes = new HashMap(40);
+ localizedKeyCodes = new HashMap<String, Integer>(40);
localizedKeyCodes.put(JFaceResources
.getString("Backspace").toUpperCase(), new Integer(8)); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/MenuManager.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/MenuManager.java
index 27dc1a8..527fd2b 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/MenuManager.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/MenuManager.java
@@ -766,7 +766,7 @@ public class MenuManager extends ContributionManager implements IMenuManager {
if (menuExist()) {
// clean contains all active items without double separators
IContributionItem[] items = getItems();
- List clean = new ArrayList(items.length);
+ List<IContributionItem> clean = new ArrayList<IContributionItem>(items.length);
IContributionItem separator = null;
for (int i = 0; i < items.length; ++i) {
IContributionItem ci = items[i];
@@ -808,8 +808,8 @@ public class MenuManager extends ContributionManager implements IMenuManager {
int srcIx = 0;
int destIx = 0;
- for (Iterator e = clean.iterator(); e.hasNext();) {
- IContributionItem src = (IContributionItem) e.next();
+ for (Iterator<IContributionItem> e = clean.iterator(); e.hasNext();) {
+ IContributionItem src = e.next();
IContributionItem dest;
// get corresponding item in SWT widget
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/SubContributionManager.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/SubContributionManager.java
index de3e270..dbb9dcf 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/SubContributionManager.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/SubContributionManager.java
@@ -30,7 +30,7 @@ public abstract class SubContributionManager implements IContributionManager {
* Maps each item in the manager to a wrapper. The wrapper is used to
* control the visibility of each item.
*/
- private Map mapItemToWrapper = new HashMap();
+ private Map<IContributionItem, SubContributionItem> mapItemToWrapper = new HashMap<IContributionItem, SubContributionItem>();
/**
* The visibility of the manager,
@@ -92,12 +92,12 @@ public abstract class SubContributionManager implements IContributionManager {
* @since 3.0
*/
public void disposeManager() {
- Iterator it = mapItemToWrapper.values().iterator();
+ Iterator<SubContributionItem> it = mapItemToWrapper.values().iterator();
// Dispose items in addition to removing them.
// See bugs 64024 and 73715 for details.
// Do not use getItems() here as subclasses can override that in bad ways.
while (it.hasNext()) {
- IContributionItem item = (IContributionItem) it.next();
+ IContributionItem item = it.next();
item.dispose();
}
removeAll();
@@ -234,14 +234,14 @@ public abstract class SubContributionManager implements IContributionManager {
* @return fetch all enumeration of wrappers for the item
* @deprecated Use getItems(String value) instead.
*/
- public Enumeration items() {
- final Iterator i = mapItemToWrapper.values().iterator();
- return new Enumeration() {
+ public Enumeration<SubContributionItem> items() {
+ final Iterator<SubContributionItem> i = mapItemToWrapper.values().iterator();
+ return new Enumeration<SubContributionItem>() {
public boolean hasMoreElements() {
return i.hasNext();
}
- public Object nextElement() {
+ public SubContributionItem nextElement() {
return i.next();
}
};
@@ -288,7 +288,7 @@ public abstract class SubContributionManager implements IContributionManager {
* Method declared on IContributionManager.
*/
public IContributionItem remove(IContributionItem item) {
- SubContributionItem wrap = (SubContributionItem) mapItemToWrapper
+ SubContributionItem wrap = mapItemToWrapper
.get(item);
if (wrap == null) {
return null;
@@ -323,9 +323,9 @@ public abstract class SubContributionManager implements IContributionManager {
public void setVisible(boolean visible) {
this.visible = visible;
if (mapItemToWrapper.size() > 0) {
- Iterator it = mapItemToWrapper.values().iterator();
+ Iterator<SubContributionItem> it = mapItemToWrapper.values().iterator();
while (it.hasNext()) {
- IContributionItem item = (IContributionItem) it.next();
+ IContributionItem item = it.next();
item.setVisible(visible);
}
parentMgr.markDirty();
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/SubMenuManager.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/SubMenuManager.java
index d23ca48..e3fc7e6 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/SubMenuManager.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/SubMenuManager.java
@@ -38,7 +38,7 @@ public class SubMenuManager extends SubContributionManager implements
* monitor additions and removals. If the visibility of the manager is modified
* the visibility of the submenus is also modified.
*/
- private Map mapMenuToWrapper;
+ private Map<IMenuManager, SubMenuManager> mapMenuToWrapper;
/**
* List of registered menu listeners (element type: <code>IMenuListener</code>).
@@ -105,9 +105,9 @@ public class SubMenuManager extends SubContributionManager implements
// otherwise super's call to removeAll will remove them
// before they can be disposed
if (mapMenuToWrapper != null) {
- Iterator iter = mapMenuToWrapper.values().iterator();
+ Iterator<SubMenuManager> iter = mapMenuToWrapper.values().iterator();
while (iter.hasNext()) {
- SubMenuManager wrapper = (SubMenuManager) iter.next();
+ SubMenuManager wrapper = iter.next();
wrapper.disposeManager();
}
mapMenuToWrapper.clear();
@@ -249,9 +249,9 @@ public class SubMenuManager extends SubContributionManager implements
*/
protected IMenuManager getWrapper(IMenuManager mgr) {
if (mapMenuToWrapper == null) {
- mapMenuToWrapper = new HashMap(4);
+ mapMenuToWrapper = new HashMap<IMenuManager, SubMenuManager>(4);
}
- SubMenuManager wrapper = (SubMenuManager) mapMenuToWrapper.get(mgr);
+ SubMenuManager wrapper = mapMenuToWrapper.get(mgr);
if (wrapper == null) {
wrapper = wrapMenu(mgr);
mapMenuToWrapper.put(mgr, wrapper);
@@ -294,9 +294,9 @@ public class SubMenuManager extends SubContributionManager implements
public void removeAll() {
super.removeAll();
if (mapMenuToWrapper != null) {
- Iterator iter = mapMenuToWrapper.values().iterator();
+ Iterator<SubMenuManager> iter = mapMenuToWrapper.values().iterator();
while (iter.hasNext()) {
- SubMenuManager wrapper = (SubMenuManager) iter.next();
+ SubMenuManager wrapper = iter.next();
wrapper.removeAll();
}
mapMenuToWrapper.clear();
@@ -340,9 +340,9 @@ public class SubMenuManager extends SubContributionManager implements
public void setVisible(boolean visible) {
super.setVisible(visible);
if (mapMenuToWrapper != null) {
- Iterator iter = mapMenuToWrapper.values().iterator();
+ Iterator<SubMenuManager> iter = mapMenuToWrapper.values().iterator();
while (iter.hasNext()) {
- SubMenuManager wrapper = (SubMenuManager) iter.next();
+ SubMenuManager wrapper = iter.next();
wrapper.setVisible(visible);
}
}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/ToolBarContributionItem.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/ToolBarContributionItem.java
index be09c28..59c9b10 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/ToolBarContributionItem.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/ToolBarContributionItem.java
@@ -357,7 +357,7 @@ public class ToolBarContributionItem extends ContributionItem implements IToolBa
ToolBar toolBar = (ToolBar) control;
Rectangle toolBarBounds = toolBar.getBounds();
ToolItem[] items = toolBar.getItems();
- ArrayList hidden = new ArrayList();
+ ArrayList<ToolItem> hidden = new ArrayList<ToolItem>();
for (int i = 0; i < items.length; ++i) {
Rectangle itemBounds = items[i].getBounds();
if (!((itemBounds.x + itemBounds.width <= toolBarBounds.width) && (itemBounds.y
@@ -371,8 +371,8 @@ public class ToolBarContributionItem extends ContributionItem implements IToolBa
chevronMenuManager.dispose();
}
chevronMenuManager = new MenuManager();
- for (Iterator i = hidden.iterator(); i.hasNext();) {
- ToolItem toolItem = (ToolItem) i.next();
+ for (Iterator<ToolItem> i = hidden.iterator(); i.hasNext();) {
+ ToolItem toolItem = i.next();
IContributionItem data = (IContributionItem) toolItem.getData();
if (data instanceof ActionContributionItem) {
ActionContributionItem contribution = new ActionContributionItem(
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/ToolBarManager.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/ToolBarManager.java
index 8e0cab9..df651a1 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/ToolBarManager.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/ToolBarManager.java
@@ -247,7 +247,7 @@ public class ToolBarManager extends ContributionManager implements
// clean contains all active items without double separators
IContributionItem[] items = getItems();
- ArrayList clean = new ArrayList(items.length);
+ ArrayList<IContributionItem> clean = new ArrayList<IContributionItem>(items.length);
IContributionItem separator = null;
// long cleanStartTime= 0;
// if (DEBUG) {
@@ -280,7 +280,7 @@ public class ToolBarManager extends ContributionManager implements
// determine obsolete items (removed or non active)
ToolItem[] mi = toolBar.getItems();
- ArrayList toRemove = new ArrayList(mi.length);
+ ArrayList<ToolItem> toRemove = new ArrayList<ToolItem>(mi.length);
for (int i = 0; i < mi.length; i++) {
// there may be null items in a toolbar
if (mi[i] == null)
@@ -310,7 +310,7 @@ public class ToolBarManager extends ContributionManager implements
// remove obsolete items
for (int i = toRemove.size(); --i >= 0;) {
- ToolItem item = (ToolItem) toRemove.get(i);
+ ToolItem item = toRemove.get(i);
if (!item.isDisposed()) {
Control ctrl = item.getControl();
if (ctrl != null) {
@@ -326,8 +326,8 @@ public class ToolBarManager extends ContributionManager implements
mi = toolBar.getItems();
int srcIx = 0;
int destIx = 0;
- for (Iterator e = clean.iterator(); e.hasNext();) {
- src = (IContributionItem) e.next();
+ for (Iterator<IContributionItem> e = clean.iterator(); e.hasNext();) {
+ src = e.next();
// get corresponding item in SWT widget
if (srcIx < mi.length) {