summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorHendrik Still2013-07-24 19:55:46 (EDT)
committer Gerrit Code Review @ Eclipse.org2013-07-31 14:32:09 (EDT)
commitdf1c93847b49179796573d35b960d7fac7d4fbef (patch)
tree9eb641c9bb82e13255f1de71b0cdfb3112aee3cd
parentd4512cc2031b6e598b54f707d87c2f10c3feec93 (diff)
downloadeclipse.platform.ui-df1c93847b49179796573d35b960d7fac7d4fbef.zip
eclipse.platform.ui-df1c93847b49179796573d35b960d7fac7d4fbef.tar.gz
eclipse.platform.ui-df1c93847b49179796573d35b960d7fac7d4fbef.tar.bz2
Bug 413685 - Fix compiler warnings in org.eclipse.jface.preferencerefs/changes/53/14853/2
caused by moving JFace to Java 1.5 Change-Id: I5f798007d66c60e4c50d7f8cba5c72eaa1654da8 Signed-off-by: Hendrik Still <hendrik.still@gammas.de>
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/preference/FieldEditorPreferencePage.java32
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PathEditor.java4
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceDialog.java22
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceManager.java6
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceNode.java10
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceStore.java6
6 files changed, 40 insertions, 40 deletions
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/FieldEditorPreferencePage.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/FieldEditorPreferencePage.java
index 44c0952..8a24fe8 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/FieldEditorPreferencePage.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/FieldEditorPreferencePage.java
@@ -69,7 +69,7 @@ public abstract class FieldEditorPreferencePage extends PreferencePage
/**
* The field editors, or <code>null</code> if not created yet.
*/
- private List fields = null;
+ private List<FieldEditor> fields = null;
/**
* The layout style; either <code>FLAT</code> or <code>GRID</code>.
@@ -139,7 +139,7 @@ public abstract class FieldEditorPreferencePage extends PreferencePage
*/
protected void addField(FieldEditor editor) {
if (fields == null) {
- fields = new ArrayList();
+ fields = new ArrayList<FieldEditor>();
}
fields.add(editor);
}
@@ -153,7 +153,7 @@ public abstract class FieldEditorPreferencePage extends PreferencePage
((GridLayout) fieldEditorParent.getLayout()).numColumns = numColumns;
if (fields != null) {
for (int i = 0; i < fields.size(); i++) {
- FieldEditor fieldEditor = (FieldEditor) fields.get(i);
+ FieldEditor fieldEditor = fields.get(i);
fieldEditor.adjustForNumColumns(numColumns);
}
}
@@ -164,9 +164,9 @@ public abstract class FieldEditorPreferencePage extends PreferencePage
*/
protected void applyFont() {
if (fields != null) {
- Iterator e = fields.iterator();
+ Iterator<FieldEditor> e = fields.iterator();
while (e.hasNext()) {
- FieldEditor pe = (FieldEditor) e.next();
+ FieldEditor pe = e.next();
pe.applyFont();
}
}
@@ -180,9 +180,9 @@ public abstract class FieldEditorPreferencePage extends PreferencePage
private int calcNumberOfColumns() {
int result = 0;
if (fields != null) {
- Iterator e = fields.iterator();
+ Iterator<FieldEditor> e = fields.iterator();
while (e.hasNext()) {
- FieldEditor pe = (FieldEditor) e.next();
+ FieldEditor pe = e.next();
result = Math.max(result, pe.getNumberOfControls());
}
}
@@ -201,7 +201,7 @@ public abstract class FieldEditorPreferencePage extends PreferencePage
if (fields != null) {
int size = fields.size();
for (int i = 0; i < size; i++) {
- FieldEditor editor = (FieldEditor) fields.get(i);
+ FieldEditor editor = fields.get(i);
valid = valid && editor.isValid();
if (!valid) {
invalidFieldEditor = editor;
@@ -263,9 +263,9 @@ public abstract class FieldEditorPreferencePage extends PreferencePage
public void dispose() {
super.dispose();
if (fields != null) {
- Iterator e = fields.iterator();
+ Iterator<FieldEditor> e = fields.iterator();
while (e.hasNext()) {
- FieldEditor pe = (FieldEditor) e.next();
+ FieldEditor pe = e.next();
pe.setPage(null);
pe.setPropertyChangeListener(null);
pe.setPreferenceStore(null);
@@ -300,9 +300,9 @@ public abstract class FieldEditorPreferencePage extends PreferencePage
*/
protected void initialize() {
if (fields != null) {
- Iterator e = fields.iterator();
+ Iterator<FieldEditor> e = fields.iterator();
while (e.hasNext()) {
- FieldEditor pe = (FieldEditor) e.next();
+ FieldEditor pe = e.next();
pe.setPage(this);
pe.setPropertyChangeListener(this);
pe.setPreferenceStore(getPreferenceStore());
@@ -318,9 +318,9 @@ public abstract class FieldEditorPreferencePage extends PreferencePage
@Override
protected void performDefaults() {
if (fields != null) {
- Iterator e = fields.iterator();
+ Iterator<FieldEditor> e = fields.iterator();
while (e.hasNext()) {
- FieldEditor pe = (FieldEditor) e.next();
+ FieldEditor pe = e.next();
pe.loadDefault();
}
}
@@ -341,9 +341,9 @@ public abstract class FieldEditorPreferencePage extends PreferencePage
@Override
public boolean performOk() {
if (fields != null) {
- Iterator e = fields.iterator();
+ Iterator<FieldEditor> e = fields.iterator();
while (e.hasNext()) {
- FieldEditor pe = (FieldEditor) e.next();
+ FieldEditor pe = e.next();
pe.store();
pe.setPresentsDefaultValue(false);
}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PathEditor.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PathEditor.java
index ba5ba63..fadb7aa 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PathEditor.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PathEditor.java
@@ -105,10 +105,10 @@ public class PathEditor extends ListEditor {
protected String[] parseString(String stringList) {
StringTokenizer st = new StringTokenizer(stringList, File.pathSeparator
+ "\n\r");//$NON-NLS-1$
- ArrayList v = new ArrayList();
+ ArrayList<Object> v = new ArrayList<Object>();
while (st.hasMoreElements()) {
v.add(st.nextElement());
}
- return (String[]) v.toArray(new String[v.size()]);
+ return v.toArray(new String[v.size()]);
}
}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceDialog.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceDialog.java
index 197d075..853bc07 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceDialog.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceDialog.java
@@ -255,10 +255,10 @@ public class PreferenceDialog extends TrayDialog implements IPreferencePageConta
@Override
protected void cancelPressed() {
// Inform all pages that we are cancelling
- Iterator nodes = preferenceManager.getElements(PreferenceManager.PRE_ORDER).iterator();
+ Iterator<IPreferenceNode> nodes = preferenceManager.getElements(PreferenceManager.PRE_ORDER).iterator();
final boolean[] cancelOK = new boolean[] { true };
while (nodes.hasNext()) {
- final IPreferenceNode node = (IPreferenceNode) nodes.next();
+ final IPreferenceNode node = nodes.next();
if (getPage(node) != null) {
SafeRunnable.run(new SafeRunnable() {
public void run() {
@@ -301,9 +301,9 @@ public class PreferenceDialog extends TrayDialog implements IPreferencePageConta
* @see org.eclipse.core.runtime.ISafeRunnable#run()
*/
public void run() throws Exception {
- List nodes = preferenceManager.getElements(PreferenceManager.PRE_ORDER);
+ List<IPreferenceNode> nodes = preferenceManager.getElements(PreferenceManager.PRE_ORDER);
for (int i = 0; i < nodes.size(); i++) {
- IPreferenceNode node = (IPreferenceNode) nodes.get(i);
+ IPreferenceNode node = nodes.get(i);
node.disposeResources();
}
@@ -791,9 +791,9 @@ public class PreferenceDialog extends TrayDialog implements IPreferencePageConta
* found.
*/
protected IPreferenceNode findNodeMatching(String nodeId) {
- List nodes = preferenceManager.getElements(PreferenceManager.POST_ORDER);
- for (Iterator i = nodes.iterator(); i.hasNext();) {
- IPreferenceNode node = (IPreferenceNode) i.next();
+ List<IPreferenceNode> nodes = preferenceManager.getElements(PreferenceManager.POST_ORDER);
+ for (Iterator<IPreferenceNode> i = nodes.iterator(); i.hasNext();) {
+ IPreferenceNode node = i.next();
if (node.getId().equals(nodeId)) {
return node;
}
@@ -872,9 +872,9 @@ public class PreferenceDialog extends TrayDialog implements IPreferencePageConta
* </p>
*/
protected void handleSave() {
- Iterator nodes = preferenceManager.getElements(PreferenceManager.PRE_ORDER).iterator();
+ Iterator<IPreferenceNode> nodes = preferenceManager.getElements(PreferenceManager.PRE_ORDER).iterator();
while (nodes.hasNext()) {
- IPreferenceNode node = (IPreferenceNode) nodes.next();
+ IPreferenceNode node = nodes.next();
IPreferencePage page = node.getPage();
if (page instanceof PreferencePage) {
// Save now in case tbe workbench does not shutdown cleanly
@@ -972,10 +972,10 @@ public class PreferenceDialog extends TrayDialog implements IPreferencePageConta
boolean hasFailedOK = false;
try {
// Notify all the pages and give them a chance to abort
- Iterator nodes = preferenceManager.getElements(PreferenceManager.PRE_ORDER)
+ Iterator<IPreferenceNode> nodes = preferenceManager.getElements(PreferenceManager.PRE_ORDER)
.iterator();
while (nodes.hasNext()) {
- IPreferenceNode node = (IPreferenceNode) nodes.next();
+ IPreferenceNode node = nodes.next();
IPreferencePage page = node.getPage();
if (page != null) {
if (!page.performOk()){
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceManager.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceManager.java
index 4b809b1..563f7e0 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceManager.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceManager.java
@@ -124,7 +124,7 @@ public class PreferenceManager {
* @param order the traversal order, one of
* <code>PRE_ORDER</code> and <code>POST_ORDER</code>
*/
- protected void buildSequence(IPreferenceNode node, List sequence, int order) {
+ protected void buildSequence(IPreferenceNode node, List<IPreferenceNode> sequence, int order) {
if (order == PRE_ORDER) {
sequence.add(node);
}
@@ -184,10 +184,10 @@ public class PreferenceManager {
* (element type: <code>IPreferenceNode</code>)
* in the given order
*/
- public List getElements(int order) {
+ public List<IPreferenceNode> getElements(int order) {
Assert.isTrue(order == PRE_ORDER || order == POST_ORDER,
"invalid traversal order");//$NON-NLS-1$
- ArrayList sequence = new ArrayList();
+ ArrayList<IPreferenceNode> sequence = new ArrayList<IPreferenceNode>();
IPreferenceNode[] subnodes = getRoot().getSubNodes();
for (int i = 0; i < subnodes.length; i++) {
buildSequence(subnodes[i], sequence, order);
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceNode.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceNode.java
index 5644cbd..65e580a 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceNode.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceNode.java
@@ -31,7 +31,7 @@ public class PreferenceNode implements IPreferenceNode {
* The list of subnodes (immediate children) of this node (element type:
* <code>IPreferenceNode</code>).
*/
- private List subNodes;
+ private List<IPreferenceNode> subNodes;
/**
* Name of a class that implements <code>IPreferencePage</code>, or
@@ -120,7 +120,7 @@ public class PreferenceNode implements IPreferenceNode {
*/
public void add(IPreferenceNode node) {
if (subNodes == null) {
- subNodes = new ArrayList();
+ subNodes = new ArrayList<IPreferenceNode>();
}
subNodes.add(node);
}
@@ -134,7 +134,7 @@ public class PreferenceNode implements IPreferenceNode {
private Object createObject(String className) {
Assert.isNotNull(className);
try {
- Class cl = Class.forName(className);
+ Class<?> cl = Class.forName(className);
if (cl != null) {
return cl.newInstance();
}
@@ -186,7 +186,7 @@ public class PreferenceNode implements IPreferenceNode {
}
int size = subNodes.size();
for (int i = 0; i < size; i++) {
- IPreferenceNode node = (IPreferenceNode) subNodes.get(i);
+ IPreferenceNode node = subNodes.get(i);
if (id.equals(node.getId())) {
return node;
}
@@ -244,7 +244,7 @@ public class PreferenceNode implements IPreferenceNode {
if (subNodes == null) {
return new IPreferenceNode[0];
}
- return (IPreferenceNode[]) subNodes
+ return subNodes
.toArray(new IPreferenceNode[subNodes.size()]);
}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceStore.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceStore.java
index b7a140f..b37cf67 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceStore.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceStore.java
@@ -426,12 +426,12 @@ public class PreferenceStore extends EventManager implements
* @return an array of preference names
*/
public String[] preferenceNames() {
- ArrayList list = new ArrayList();
- Enumeration it = properties.propertyNames();
+ ArrayList<String> list = new ArrayList<String>();
+ Enumeration<String> it = (Enumeration<String>) properties.propertyNames();
while (it.hasMoreElements()) {
list.add(it.nextElement());
}
- return (String[]) list.toArray(new String[list.size()]);
+ return list.toArray(new String[list.size()]);
}
/*