summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorHendrik Still2013-07-24 08:16:38 (EDT)
committer Gerrit Code Review @ Eclipse.org2013-07-29 15:24:40 (EDT)
commit31c790f2cee57694eebf9e31afbd9cb82d0eff55 (patch)
tree7e5e63fe475769cbc666902aea066144a39f66e0
parenteed1302da726969deb2d6554f75f9ecfc0bcdb8f (diff)
downloadeclipse.platform.ui-31c790f2cee57694eebf9e31afbd9cb82d0eff55.zip
eclipse.platform.ui-31c790f2cee57694eebf9e31afbd9cb82d0eff55.tar.gz
eclipse.platform.ui-31c790f2cee57694eebf9e31afbd9cb82d0eff55.tar.bz2
Bug 413624 - Fix compiler warnings in org.eclipse.jface.dialogs causedrefs/changes/10/14810/2
by moving JFace to Java 1.5 Change-Id: Id41cbdbfeedc2a44cc5e48072a9489a8cf8526fa Signed-off-by: Hendrik Still <hendrik.still@gammas.de>
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ControlEnableState.java12
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/Dialog.java6
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/DialogSettings.java62
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ErrorDialog.java10
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/PopupDialog.java12
5 files changed, 51 insertions, 51 deletions
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ControlEnableState.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ControlEnableState.java
index cba792b..10bc3bb 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ControlEnableState.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ControlEnableState.java
@@ -25,12 +25,12 @@ public class ControlEnableState {
* List of exception controls (element type: <code>Control</code>);
* <code>null</code> if none.
*/
- private List exceptions = null;
+ private List<Control> exceptions = null;
/**
* List of saved states (element type: <code>ItemState</code>).
*/
- private List states;
+ private List<ItemState> states;
/**
* Internal class for recording the enable/disable state of a single
@@ -89,9 +89,9 @@ public class ControlEnableState {
* the list of controls to not disable (element type:
* <code>Control</code>), or <code>null</code> if none
*/
- protected ControlEnableState(Control w, List exceptions) {
+ protected ControlEnableState(Control w, List<Control> exceptions) {
super();
- states = new ArrayList();
+ states = new ArrayList<ItemState>();
this.exceptions = exceptions;
readStateForAndDisable(w);
}
@@ -120,7 +120,7 @@ public class ControlEnableState {
* <code>Control</code>)
* @return an object capturing the enable/disable state
*/
- public static ControlEnableState disable(Control w, List exceptions) {
+ public static ControlEnableState disable(Control w, List<Control> exceptions) {
return new ControlEnableState(w, exceptions);
}
@@ -152,7 +152,7 @@ public class ControlEnableState {
public void restore() {
int size = states.size();
for (int i = 0; i < size; i++) {
- ((ItemState) states.get(i)).restore();
+ states.get(i).restore();
}
}
}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/Dialog.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/Dialog.java
index edbef2c..033ef2f 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/Dialog.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/Dialog.java
@@ -209,7 +209,7 @@ public abstract class Dialog extends Window {
/**
* Collection of buttons created by the <code>createButton</code> method.
*/
- private HashMap buttons = new HashMap();
+ private HashMap<Integer, Button> buttons = new HashMap<Integer, Button>();
/**
* Font metrics to use for determining pixel sizes.
@@ -839,7 +839,7 @@ public abstract class Dialog extends Window {
* @since 2.0
*/
protected Button getButton(int id) {
- return (Button) buttons.get(new Integer(id));
+ return buttons.get(new Integer(id));
}
/**
@@ -997,7 +997,7 @@ public abstract class Dialog extends Window {
boolean returnValue = super.close();
if (returnValue) {
- buttons = new HashMap();
+ buttons = new HashMap<Integer, Button>();
buttonBar = null;
dialogArea = null;
}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/DialogSettings.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/DialogSettings.java
index 381ab94..a5d7ca4 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/DialogSettings.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/DialogSettings.java
@@ -76,14 +76,14 @@ public class DialogSettings implements IDialogSettings {
/* A Map of DialogSettings representing each sections in a DialogSettings.
It maps the DialogSettings' name to the DialogSettings */
- private Map sections;
+ private Map<String, IDialogSettings> sections;
/* A Map with all the keys and values of this sections.
Either the keys an values are restricted to strings. */
- private Map items;
+ private Map<String, String> items;
// A Map with all the keys mapped to array of strings.
- private Map arrayItems;
+ private Map<String, String[]> arrayItems;
private static final String TAG_SECTION = "section";//$NON-NLS-1$
@@ -107,9 +107,9 @@ public class DialogSettings implements IDialogSettings {
*/
public DialogSettings(String sectionName) {
name = sectionName;
- items = new HashMap();
- arrayItems = new HashMap();
- sections = new HashMap();
+ items = new HashMap<String, String>();
+ arrayItems = new HashMap<String, String[]>();
+ sections = new HashMap<String, IDialogSettings>();
}
/* (non-Javadoc)
@@ -152,35 +152,35 @@ public class DialogSettings implements IDialogSettings {
* @since 3.9
*/
public IDialogSettings removeSection(String sectionName) {
- return (IDialogSettings) sections.remove(sectionName);
+ return sections.remove(sectionName);
}
/* (non-Javadoc)
* Method declared on IDialogSettings.
*/
public String get(String key) {
- return (String) items.get(key);
+ return items.get(key);
}
/* (non-Javadoc)
* Method declared on IDialogSettings.
*/
public String[] getArray(String key) {
- return (String[]) arrayItems.get(key);
+ return arrayItems.get(key);
}
/* (non-Javadoc)
* Method declared on IDialogSettings.
*/
public boolean getBoolean(String key) {
- return Boolean.valueOf((String) items.get(key)).booleanValue();
+ return Boolean.valueOf(items.get(key)).booleanValue();
}
/* (non-Javadoc)
* Method declared on IDialogSettings.
*/
public double getDouble(String key) throws NumberFormatException {
- String setting = (String) items.get(key);
+ String setting = items.get(key);
if (setting == null) {
throw new NumberFormatException(
"There is no setting associated with the key \"" + key + "\"");//$NON-NLS-1$ //$NON-NLS-2$
@@ -193,7 +193,7 @@ public class DialogSettings implements IDialogSettings {
* Method declared on IDialogSettings.
*/
public float getFloat(String key) throws NumberFormatException {
- String setting = (String) items.get(key);
+ String setting = items.get(key);
if (setting == null) {
throw new NumberFormatException(
"There is no setting associated with the key \"" + key + "\"");//$NON-NLS-1$ //$NON-NLS-2$
@@ -206,7 +206,7 @@ public class DialogSettings implements IDialogSettings {
* Method declared on IDialogSettings.
*/
public int getInt(String key) throws NumberFormatException {
- String setting = (String) items.get(key);
+ String setting = items.get(key);
if (setting == null) {
//new Integer(null) will throw a NumberFormatException and meet our spec, but this message
//is clearer.
@@ -221,7 +221,7 @@ public class DialogSettings implements IDialogSettings {
* Method declared on IDialogSettings.
*/
public long getLong(String key) throws NumberFormatException {
- String setting = (String) items.get(key);
+ String setting = items.get(key);
if (setting == null) {
//new Long(null) will throw a NumberFormatException and meet our spec, but this message
//is clearer.
@@ -264,14 +264,14 @@ public class DialogSettings implements IDialogSettings {
* Method declared on IDialogSettings.
*/
public IDialogSettings getSection(String sectionName) {
- return (IDialogSettings) sections.get(sectionName);
+ return sections.get(sectionName);
}
/* (non-Javadoc)
* Method declared on IDialogSettings.
*/
public IDialogSettings[] getSections() {
- Collection values = sections.values();
+ Collection<IDialogSettings> values = sections.values();
DialogSettings[] result = new DialogSettings[values.size()];
values.toArray(result);
return result;
@@ -336,7 +336,7 @@ public class DialogSettings implements IDialogSettings {
Element child = (Element) l.item(i);
String key = child.getAttribute(TAG_KEY);
NodeList list = child.getElementsByTagName(TAG_ITEM);
- List valueList = new ArrayList();
+ List<String> valueList = new ArrayList<String>();
for (int j = 0; j < list.getLength(); j++) {
Element node = (Element) list.item(j);
if (child == node.getParentNode()) {
@@ -431,25 +431,25 @@ public class DialogSettings implements IDialogSettings {
* Save the settings in the <code>document</code>.
*/
private void save(XMLWriter out) throws IOException {
- HashMap attributes = new HashMap(2);
+ HashMap<String, String> attributes = new HashMap<String, String>(2);
attributes.put(TAG_NAME, name == null ? "" : name); //$NON-NLS-1$
out.startTag(TAG_SECTION, attributes);
attributes.clear();
- for (Iterator i = items.keySet().iterator(); i.hasNext();) {
- String key = (String) i.next();
+ for (Iterator<String> i = items.keySet().iterator(); i.hasNext();) {
+ String key = i.next();
attributes.put(TAG_KEY, key == null ? "" : key); //$NON-NLS-1$
- String string = (String) items.get(key);
+ String string = items.get(key);
attributes.put(TAG_VALUE, string == null ? "" : string); //$NON-NLS-1$
out.printTag(TAG_ITEM, attributes, true);
}
attributes.clear();
- for (Iterator i = arrayItems.keySet().iterator(); i.hasNext();) {
- String key = (String) i.next();
+ for (Iterator<String> i = arrayItems.keySet().iterator(); i.hasNext();) {
+ String key = i.next();
attributes.put(TAG_KEY, key == null ? "" : key); //$NON-NLS-1$
out.startTag(TAG_LIST, attributes);
- String[] value = (String[]) arrayItems.get(key);
+ String[] value = arrayItems.get(key);
attributes.clear();
if (value != null) {
for (int index = 0; index < value.length; index++) {
@@ -461,7 +461,7 @@ public class DialogSettings implements IDialogSettings {
out.endTag(TAG_LIST);
attributes.clear();
}
- for (Iterator i = sections.values().iterator(); i.hasNext();) {
+ for (Iterator<IDialogSettings> i = sections.values().iterator(); i.hasNext();) {
((DialogSettings) i.next()).save(out);
}
out.endTag(TAG_SECTION);
@@ -527,18 +527,18 @@ public class DialogSettings implements IDialogSettings {
* @param close should the tag be ended automatically (=> empty tag)
* @throws IOException
*/
- public void printTag(String name, HashMap parameters, boolean close) throws IOException {
+ public void printTag(String name, HashMap<String, String> parameters, boolean close) throws IOException {
printTag(name, parameters, true, true, close);
}
- private void printTag(String name, HashMap parameters, boolean shouldTab, boolean newLine, boolean close) throws IOException {
+ private void printTag(String name, HashMap<String, String> parameters, boolean shouldTab, boolean newLine, boolean close) throws IOException {
StringBuffer sb = new StringBuffer();
sb.append('<');
sb.append(name);
if (parameters != null) {
- for (Enumeration e = Collections.enumeration(parameters.keySet()); e.hasMoreElements();) {
+ for (Enumeration<String> e = Collections.enumeration(parameters.keySet()); e.hasMoreElements();) {
sb.append(" "); //$NON-NLS-1$
- String key = (String) e.nextElement();
+ String key = e.nextElement();
sb.append(key);
sb.append("=\""); //$NON-NLS-1$
sb.append(getEscaped(String.valueOf(parameters.get(key))));
@@ -565,12 +565,12 @@ public class DialogSettings implements IDialogSettings {
* @param parameters map of parameters
* @throws IOException
*/
- public void startTag(String name, HashMap parameters) throws IOException {
+ public void startTag(String name, HashMap<String, String> parameters) throws IOException {
startTag(name, parameters, true);
tab++;
}
- private void startTag(String name, HashMap parameters, boolean newLine) throws IOException {
+ private void startTag(String name, HashMap<String, String> parameters, boolean newLine) throws IOException {
printTag(name, parameters, true, newLine, false);
}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ErrorDialog.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ErrorDialog.java
index 923e31e..b6208da 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ErrorDialog.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ErrorDialog.java
@@ -495,9 +495,9 @@ public class ErrorDialog extends IconAndMessageDialog {
}
String message = buildingStatus.getMessage();
sb.append(message);
- java.util.List lines = readLines(sb.toString());
- for (Iterator iterator = lines.iterator(); iterator.hasNext();) {
- String line = (String) iterator.next();
+ java.util.List<String> lines = readLines(sb.toString());
+ for (Iterator<String> iterator = lines.iterator(); iterator.hasNext();) {
+ String line = iterator.next();
listToPopulate.add(line);
}
incrementNesting = true;
@@ -541,8 +541,8 @@ public class ErrorDialog extends IconAndMessageDialog {
}
}
- private static java.util.List readLines(final String s) {
- java.util.List lines = new ArrayList();
+ private static java.util.List<String> readLines(final String s) {
+ java.util.List<String> lines = new ArrayList<String>();
BufferedReader reader = new BufferedReader(new StringReader(s));
String line;
try {
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/PopupDialog.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/PopupDialog.java
index ebab941..ad19c7f 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/PopupDialog.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/PopupDialog.java
@@ -1488,7 +1488,7 @@ public class PopupDialog extends Window {
* color assigned
*/
private void applyForegroundColor(Color color, Control control,
- List exclusions) {
+ List<Control> exclusions) {
if (!exclusions.contains(control)) {
control.setForeground(color);
}
@@ -1513,7 +1513,7 @@ public class PopupDialog extends Window {
* color assigned
*/
private void applyBackgroundColor(Color color, Control control,
- List exclusions) {
+ List<Control> exclusions) {
if (!exclusions.contains(control)) {
control.setBackground(color);
}
@@ -1567,8 +1567,8 @@ public class PopupDialog extends Window {
*
* @return the List of controls
*/
- protected List getForegroundColorExclusions() {
- List list = new ArrayList(3);
+ protected List<Control> getForegroundColorExclusions() {
+ List<Control> list = new ArrayList<Control>(3);
if (infoLabel != null) {
list.add(infoLabel);
}
@@ -1588,8 +1588,8 @@ public class PopupDialog extends Window {
*
* @return the List of controls
*/
- protected List getBackgroundColorExclusions() {
- List list = new ArrayList(2);
+ protected List<Control> getBackgroundColorExclusions() {
+ List<Control> list = new ArrayList<Control>(2);
if (titleSeparator != null) {
list.add(titleSeparator);
}