diff options
author | Walter Harley | 2011-03-03 09:11:08 +0000 |
---|---|---|
committer | Walter Harley | 2011-03-03 09:11:08 +0000 |
commit | 526458b6e9c716596dd0c5e362d41c478db4dab2 (patch) | |
tree | bb69dd200fb0750b887839e5485ca7f1d2c54337 | |
parent | de346399a69866957803711d94b9bc9b4af7e95b (diff) | |
download | eclipse.jdt.core-526458b6e9c716596dd0c5e362d41c478db4dab2.tar.gz eclipse.jdt.core-526458b6e9c716596dd0c5e362d41c478db4dab2.tar.xz eclipse.jdt.core-526458b6e9c716596dd0c5e362d41c478db4dab2.zip |
Bug 338625: fix compiler warnings due to generifying upstream plugins
2 files changed, 36 insertions, 49 deletions
diff --git a/org.eclipse.jdt.apt.ui/src/org/eclipse/jdt/apt/ui/internal/preferences/AptConfigurationBlock.java b/org.eclipse.jdt.apt.ui/src/org/eclipse/jdt/apt/ui/internal/preferences/AptConfigurationBlock.java index ced6948ca7..d44e9a1100 100644 --- a/org.eclipse.jdt.apt.ui/src/org/eclipse/jdt/apt/ui/internal/preferences/AptConfigurationBlock.java +++ b/org.eclipse.jdt.apt.ui/src/org/eclipse/jdt/apt/ui/internal/preferences/AptConfigurationBlock.java @@ -93,7 +93,7 @@ public class AptConfigurationBlock extends BaseConfigurationBlock { private SelectionButtonDialogField fAptEnabledField; private SelectionButtonDialogField fReconcileEnabledField; private StringDialogField fGenSrcDirField; - private ListDialogField fProcessorOptionsField; + private ListDialogField<ProcessorOption> fProcessorOptionsField; private PixelConverter fPixelConverter; private Composite fBlockControl; @@ -109,9 +109,9 @@ public class AptConfigurationBlock extends BaseConfigurationBlock { /** * Event handler for Processor Options list control. */ - private class ProcessorOptionsAdapter implements IListAdapter, IDialogFieldListener { + private class ProcessorOptionsAdapter implements IListAdapter<ProcessorOption>, IDialogFieldListener { - public void customButtonPressed(ListDialogField field, int index) { + public void customButtonPressed(ListDialogField<ProcessorOption> field, int index) { switch (index) { case IDX_ADD: editOrAddProcessorOption(null); @@ -122,13 +122,12 @@ public class AptConfigurationBlock extends BaseConfigurationBlock { } } - @SuppressWarnings("rawtypes") - public void selectionChanged(ListDialogField field) { - List selectedElements= field.getSelectedElements(); + public void selectionChanged(ListDialogField<ProcessorOption> field) { + List<ProcessorOption> selectedElements= field.getSelectedElements(); field.enableButton(IDX_EDIT, canEdit(field, selectedElements)); } - public void doubleClicked(ListDialogField field) { + public void doubleClicked(ListDialogField<ProcessorOption> field) { tryToEdit(field); } @@ -136,14 +135,13 @@ public class AptConfigurationBlock extends BaseConfigurationBlock { updateModel(field); } - @SuppressWarnings("rawtypes") - private boolean canEdit(DialogField field, List selectedElements) { + private boolean canEdit(DialogField field, List<ProcessorOption> selectedElements) { if (!field.isEnabled()) return false; return selectedElements.size() == 1; } - private void tryToEdit(ListDialogField field) { + private void tryToEdit(ListDialogField<ProcessorOption> field) { List<ProcessorOption> selection= getListSelection(); if (canEdit(field, selection)) { editOrAddProcessorOption(selection.get(0)); @@ -228,7 +226,7 @@ public class AptConfigurationBlock extends BaseConfigurationBlock { Messages.AptConfigurationBlock_remove }; ProcessorOptionsAdapter optionsAdapter = new ProcessorOptionsAdapter(); - fProcessorOptionsField = new ListDialogField(optionsAdapter, buttons, new ProcessorOptionsLabelProvider()); + fProcessorOptionsField = new ListDialogField<ProcessorOption>(optionsAdapter, buttons, new ProcessorOptionsLabelProvider()); fProcessorOptionsField.setDialogFieldListener(optionsAdapter); fProcessorOptionsField.setRemoveButtonIndex(IDX_REMOVE); String[] columnHeaders= new String[] { @@ -270,7 +268,6 @@ public class AptConfigurationBlock extends BaseConfigurationBlock { /* * Helper to eliminate unchecked-conversion warning */ - @SuppressWarnings("unchecked") private List<ProcessorOption> getListElements() { return fProcessorOptionsField.getElements(); } @@ -278,7 +275,6 @@ public class AptConfigurationBlock extends BaseConfigurationBlock { /* * Helper to eliminate unchecked-conversion warning */ - @SuppressWarnings("unchecked") private List<ProcessorOption> getListSelection() { return fProcessorOptionsField.getSelectedElements(); } diff --git a/org.eclipse.jdt.apt.ui/src/org/eclipse/jdt/apt/ui/internal/preferences/FactoryPathConfigurationBlock.java b/org.eclipse.jdt.apt.ui/src/org/eclipse/jdt/apt/ui/internal/preferences/FactoryPathConfigurationBlock.java index af7aa775ad..26dd98bd80 100644 --- a/org.eclipse.jdt.apt.ui/src/org/eclipse/jdt/apt/ui/internal/preferences/FactoryPathConfigurationBlock.java +++ b/org.eclipse.jdt.apt.ui/src/org/eclipse/jdt/apt/ui/internal/preferences/FactoryPathConfigurationBlock.java @@ -15,42 +15,23 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.preferences.IScopeContext; import org.eclipse.jdt.apt.core.internal.util.FactoryContainer; import org.eclipse.jdt.apt.core.internal.util.FactoryPath; -import org.eclipse.jdt.apt.core.internal.util.FactoryPathUtil; import org.eclipse.jdt.apt.core.internal.util.FactoryPath.Attributes; +import org.eclipse.jdt.apt.core.internal.util.FactoryPathUtil; import org.eclipse.jdt.apt.core.util.AptConfig; import org.eclipse.jdt.apt.core.util.IFactoryPath; import org.eclipse.jdt.apt.ui.internal.util.ExceptionHandler; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.preferences.IScopeContext; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspaceRoot; - -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.layout.PixelConverter; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.window.Window; - -import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer; - import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.JavaCore; - -import org.eclipse.jdt.ui.wizards.BuildPathDialogAccess; - import org.eclipse.jdt.internal.ui.wizards.IStatusChangeListener; import org.eclipse.jdt.internal.ui.wizards.dialogfields.CheckedListDialogField; import org.eclipse.jdt.internal.ui.wizards.dialogfields.DialogField; @@ -58,6 +39,17 @@ import org.eclipse.jdt.internal.ui.wizards.dialogfields.IDialogFieldListener; import org.eclipse.jdt.internal.ui.wizards.dialogfields.IListAdapter; import org.eclipse.jdt.internal.ui.wizards.dialogfields.LayoutUtil; import org.eclipse.jdt.internal.ui.wizards.dialogfields.ListDialogField; +import org.eclipse.jdt.ui.wizards.BuildPathDialogAccess; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.layout.PixelConverter; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.window.Window; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer; /** @@ -98,12 +90,12 @@ public class FactoryPathConfigurationBlock extends BaseConfigurationBlock { /** * Event handler for factory path list control */ - private class FactoryPathAdapter implements IListAdapter, IDialogFieldListener { - public void customButtonPressed(ListDialogField field, int index) { + private class FactoryPathAdapter implements IListAdapter<FactoryPathEntry>, IDialogFieldListener { + public void customButtonPressed(ListDialogField<FactoryPathEntry> field, int index) { FactoryPathConfigurationBlock.this.customButtonPressed(index); } - public void selectionChanged(ListDialogField field) { + public void selectionChanged(ListDialogField<FactoryPathEntry> field) { boolean enableRemove = canRemove(); field.enableButton(IDX_REMOVE, enableRemove); boolean enableEdit = canEdit(); @@ -126,11 +118,12 @@ public class FactoryPathConfigurationBlock extends BaseConfigurationBlock { } } - public void doubleClicked(ListDialogField field) { + public void doubleClicked(ListDialogField<FactoryPathEntry> field) { if (canEdit()) { editSelectedItem(); } } + } private class FactoryPathLabelProvider extends LabelProvider implements ITableLabelProvider { @@ -214,7 +207,7 @@ public class FactoryPathConfigurationBlock extends BaseConfigurationBlock { * The GUI control representing the factory path. Its data items * are of type FactoryPathEntry. */ - private CheckedListDialogField fFactoryPathList; + private CheckedListDialogField<FactoryPathEntry> fFactoryPathList; /** * True while inside setListContents(). Used in order to efficiently @@ -232,7 +225,7 @@ public class FactoryPathConfigurationBlock extends BaseConfigurationBlock { FactoryPathAdapter adapter= new FactoryPathAdapter(); FactoryPathLabelProvider labelProvider = new FactoryPathLabelProvider(); - fFactoryPathList= new CheckedListDialogField(adapter, buttonLabels, labelProvider); + fFactoryPathList= new CheckedListDialogField<FactoryPathEntry>(adapter, buttonLabels, labelProvider); fFactoryPathList.setDialogFieldListener(adapter); fFactoryPathList.setLabelText(Messages.FactoryPathConfigurationBlock_pluginsAndJars); fFactoryPathList.setUpButtonIndex(IDX_UP); @@ -420,7 +413,6 @@ public class FactoryPathConfigurationBlock extends BaseConfigurationBlock { /* * Helper method to get rid of unchecked conversion warning */ - @SuppressWarnings("unchecked") private List<FactoryPathEntry> getListContents() { List<FactoryPathEntry> contents= fFactoryPathList.getElements(); return contents; @@ -429,7 +421,6 @@ public class FactoryPathConfigurationBlock extends BaseConfigurationBlock { /* * Helper method to get rid of unchecked conversion warning */ - @SuppressWarnings("unchecked") private List<FactoryPathEntry> getSelectedListContents() { List<FactoryPathEntry> contents= fFactoryPathList.getSelectedElements(); return contents; |