aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHendrik Still2013-07-26 09:43:41 (EDT)
committerGerrit Code Review @ Eclipse.org2013-07-31 15:25:16 (EDT)
commitda889edbc469f43bed8a5f440cace2e8c247ec03 (patch)
tree87aca421f1e515f10347097d171b686074c40450
parente76f3b5ff5642b2f799dc941c6dbf1e71604e67f (diff)
downloadeclipse.platform.ui-da889edbc469f43bed8a5f440cace2e8c247ec03.zip
eclipse.platform.ui-da889edbc469f43bed8a5f440cace2e8c247ec03.tar.gz
eclipse.platform.ui-da889edbc469f43bed8a5f440cace2e8c247ec03.tar.bz2
Bug 413690 - Fix the compiler warnings in packagerefs/changes/88/14888/4
org.eclipse.jface.wizard caused by moving to Java 1.5 Change-Id: Idb79ba28137a2109656dbb6b703e35fea8c22fba Signed-off-by: Hendrik Still <hendrik.still@gammas.de>
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/Wizard.java18
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/WizardDialog.java64
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/WizardSelectionPage.java4
3 files changed, 43 insertions, 43 deletions
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/Wizard.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/Wizard.java
index da8a8fe..7cd2a72 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/Wizard.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/Wizard.java
@@ -73,7 +73,7 @@ public abstract class Wizard implements IWizard {
/**
* This wizard's list of pages (element type: <code>IWizardPage</code>).
*/
- private List pages = new ArrayList();
+ private List<IWizardPage> pages = new ArrayList<IWizardPage>();
/**
* Indicates whether this wizard needs a progress monitor.
@@ -152,7 +152,7 @@ public abstract class Wizard implements IWizard {
public boolean canFinish() {
// Default implementation is to check if all pages are complete.
for (int i = 0; i < pages.size(); i++) {
- if (!((IWizardPage) pages.get(i)).isPageComplete()) {
+ if (!pages.get(i).isPageComplete()) {
return false;
}
}
@@ -170,7 +170,7 @@ public abstract class Wizard implements IWizard {
public void createPageControls(Composite pageContainer) {
// the default behavior is to create all the pages controls
for (int i = 0; i < pages.size(); i++) {
- IWizardPage page = (IWizardPage) pages.get(i);
+ IWizardPage page = pages.get(i);
page.createControl(pageContainer);
// page is responsible for ensuring the created control is
// accessable
@@ -190,7 +190,7 @@ public abstract class Wizard implements IWizard {
// notify pages
for (int i = 0; i < pages.size(); i++) {
try {
- ((IWizardPage) pages.get(i)).dispose();
+ pages.get(i).dispose();
} catch (Exception e) {
Status status = new Status(IStatus.ERROR, Policy.JFACE, IStatus.ERROR, e.getMessage(), e);
Policy.getLog().log(status);
@@ -237,7 +237,7 @@ public abstract class Wizard implements IWizard {
// last page or page not found
return null;
}
- return (IWizardPage) pages.get(index + 1);
+ return pages.get(index + 1);
}
/*
@@ -245,7 +245,7 @@ public abstract class Wizard implements IWizard {
*/
public IWizardPage getPage(String name) {
for (int i = 0; i < pages.size(); i++) {
- IWizardPage page = (IWizardPage) pages.get(i);
+ IWizardPage page = pages.get(i);
String pageName = page.getName();
if (pageName.equals(name)) {
return page;
@@ -265,7 +265,7 @@ public abstract class Wizard implements IWizard {
* (non-Javadoc) Method declared on IWizard.
*/
public IWizardPage[] getPages() {
- return (IWizardPage[]) pages.toArray(new IWizardPage[pages.size()]);
+ return pages.toArray(new IWizardPage[pages.size()]);
}
/*
@@ -278,7 +278,7 @@ public abstract class Wizard implements IWizard {
// first page or page not found
return null;
}
- return (IWizardPage) pages.get(index - 1);
+ return pages.get(index - 1);
}
/**
@@ -302,7 +302,7 @@ public abstract class Wizard implements IWizard {
if (pages.size() == 0) {
return null;
}
- return (IWizardPage) pages.get(0);
+ return pages.get(0);
}
/*
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/WizardDialog.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/WizardDialog.java
index afc7b06..3c57f4c 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/WizardDialog.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/WizardDialog.java
@@ -92,10 +92,10 @@ public class WizardDialog extends TitleAreaDialog implements IWizardContainer2,
private IWizard wizard;
// Wizards to dispose
- private ArrayList createdWizards = new ArrayList();
+ private ArrayList<IWizard> createdWizards = new ArrayList<IWizard>();
// Current nested wizards
- private ArrayList nestedWizards = new ArrayList();
+ private ArrayList<IWizard> nestedWizards = new ArrayList<IWizard>();
// The currently displayed page.
private IWizardPage currentPage = null;
@@ -339,7 +339,7 @@ public class WizardDialog extends TitleAreaDialog implements IWizardContainer2,
* @return the saved UI state
*/
private Object aboutToStart(boolean enableCancelButton) {
- Map savedState = null;
+ Map<String, Object> savedState = null;
if (getShell() != null) {
// Save focus control
Control focusControl = getShell().getDisplay().getFocusControl();
@@ -848,7 +848,7 @@ public class WizardDialog extends TitleAreaDialog implements IWizardContainer2,
// Call perform finish on outer wizards in the nested chain
// (to allow them to save state for example)
for (int i = 0; i < nestedWizards.size() - 1; i++) {
- ((IWizard) nestedWizards.get(i)).performFinish();
+ nestedWizards.get(i).performFinish();
}
// Hard close the dialog.
setReturnCode(OK);
@@ -891,7 +891,7 @@ public class WizardDialog extends TitleAreaDialog implements IWizardContainer2,
private boolean hardClose() {
// inform wizards
for (int i = 0; i < createdWizards.size(); i++) {
- IWizard createdWizard = (IWizard) createdWizards.get(i);
+ IWizard createdWizard = createdWizards.get(i);
try {
createdWizard.dispose();
} catch (Exception e) {
@@ -977,20 +977,19 @@ public class WizardDialog extends TitleAreaDialog implements IWizardContainer2,
/**
* Restores the enabled/disabled state of the given control.
*
- * @param w
+ * @param control
* the control
- * @param h
- * the map (key type: <code>String</code>, element type:
- * <code>Boolean</code>)
+ * @param saveState
+ * a map containing the enabled/disabled state of the wizard dialog's buttons
* @param key
* the key
* @see #saveEnableStateAndSet
*/
- private void restoreEnableState(Control w, Map h, String key) {
- if (w != null) {
- Boolean b = (Boolean) h.get(key);
+ private void restoreEnableState(Control control, Map<String,Object> saveState, String key) {
+ if (control != null) {
+ Boolean b = (Boolean) saveState.get(key);
if (b != null) {
- w.setEnabled(b.booleanValue());
+ control.setEnabled(b.booleanValue());
}
}
}
@@ -999,18 +998,18 @@ public class WizardDialog extends TitleAreaDialog implements IWizardContainer2,
* Restores the enabled/disabled state of the wizard dialog's buttons and
* the tree of controls for the currently showing page.
*
- * @param state
+ * @param saveState
* a map containing the saved state as returned by
* <code>saveUIState</code>
* @see #saveUIState
*/
- private void restoreUIState(Map state) {
- restoreEnableState(backButton, state, "back"); //$NON-NLS-1$
- restoreEnableState(nextButton, state, "next"); //$NON-NLS-1$
- restoreEnableState(finishButton, state, "finish"); //$NON-NLS-1$
- restoreEnableState(cancelButton, state, "cancel"); //$NON-NLS-1$
- restoreEnableState(helpButton, state, "help"); //$NON-NLS-1$
- Object pageValue = state.get("page"); //$NON-NLS-1$
+ private void restoreUIState(Map<String, Object> saveState) {
+ restoreEnableState(backButton, saveState, "back"); //$NON-NLS-1$
+ restoreEnableState(nextButton, saveState, "next"); //$NON-NLS-1$
+ restoreEnableState(finishButton, saveState, "finish"); //$NON-NLS-1$
+ restoreEnableState(cancelButton, saveState, "cancel"); //$NON-NLS-1$
+ restoreEnableState(helpButton, saveState, "help"); //$NON-NLS-1$
+ Object pageValue = saveState.get("page"); //$NON-NLS-1$
if (pageValue != null) {
((ControlEnableState) pageValue).restore();
}
@@ -1067,11 +1066,10 @@ public class WizardDialog extends TitleAreaDialog implements IWizardContainer2,
* Saves the enabled/disabled state of the given control in the given map,
* which must be modifiable.
*
- * @param w
+ * @param control
* the control, or <code>null</code> if none
- * @param h
- * the map (key type: <code>String</code>, element type:
- * <code>Boolean</code>)
+ * @param saveState
+ * a map containing the enabled/disabled state of the wizard dialog's buttons
* @param key
* the key
* @param enabled
@@ -1079,11 +1077,11 @@ public class WizardDialog extends TitleAreaDialog implements IWizardContainer2,
* <code>false</code> to disable it
* @see #restoreEnableState(Control, Map, String)
*/
- private void saveEnableStateAndSet(Control w, Map h, String key,
+ private void saveEnableStateAndSet(Control control, Map<String, Object> saveState, String key,
boolean enabled) {
- if (w != null) {
- h.put(key, w.getEnabled() ? Boolean.TRUE : Boolean.FALSE);
- w.setEnabled(enabled);
+ if (control != null) {
+ saveState.put(key, control.getEnabled() ? Boolean.TRUE : Boolean.FALSE);
+ control.setEnabled(enabled);
}
}
@@ -1100,8 +1098,8 @@ public class WizardDialog extends TitleAreaDialog implements IWizardContainer2,
* with <code>restoreUIState</code>
* @see #restoreUIState
*/
- private Map saveUIState(boolean keepCancelEnabled) {
- Map savedState = new HashMap(10);
+ private Map<String, Object> saveUIState(boolean keepCancelEnabled) {
+ Map<String, Object> savedState = new HashMap<String, Object>(10);
saveEnableStateAndSet(backButton, savedState, "back", false); //$NON-NLS-1$
saveEnableStateAndSet(nextButton, savedState, "next", false); //$NON-NLS-1$
saveEnableStateAndSet(finishButton, savedState, "finish", false); //$NON-NLS-1$
@@ -1323,7 +1321,9 @@ public class WizardDialog extends TitleAreaDialog implements IWizardContainer2,
progressMonitorPart.setVisible(false);
progressMonitorPart.removeFromCancelComponent(cancelButton);
}
- Map state = (Map) savedState;
+
+ @SuppressWarnings("unchecked")
+ Map<String,Object> state = (Map<String,Object>) savedState;
restoreUIState(state);
setDisplayCursor(null);
if (useCustomProgressMonitorPart) {
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/WizardSelectionPage.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/WizardSelectionPage.java
index ea8a648..b574037 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/WizardSelectionPage.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/WizardSelectionPage.java
@@ -36,7 +36,7 @@ public abstract class WizardSelectionPage extends WizardPage {
* List of wizard nodes that have cropped up in the past
* (element type: <code>IWizardNode</code>).
*/
- private List selectedWizardNodes = new ArrayList();
+ private List<IWizardNode> selectedWizardNodes = new ArrayList<IWizardNode>();
/**
* Creates a new wizard selection page with the given name, and
@@ -87,7 +87,7 @@ public abstract class WizardSelectionPage extends WizardPage {
super.dispose();
// notify nested wizards
for (int i = 0; i < selectedWizardNodes.size(); i++) {
- ((IWizardNode) selectedWizardNodes.get(i)).dispose();
+ selectedWizardNodes.get(i).dispose();
}
}