1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Use generics.

This commit is contained in:
Sergey Prigogin 2008-04-05 22:23:06 +00:00
parent 5706933862
commit 99731305db
2 changed files with 36 additions and 35 deletions

View file

@ -159,11 +159,11 @@ public abstract class OptionsConfigurationBlock {
private static final String SETTINGS_EXPANDED= "expanded"; //$NON-NLS-1$
protected final ArrayList fCheckBoxes;
protected final ArrayList fComboBoxes;
protected final ArrayList fTextBoxes;
protected final HashMap fLabels;
protected final ArrayList fExpandedComposites;
protected final ArrayList<Button> fCheckBoxes;
protected final ArrayList<Combo> fComboBoxes;
protected final ArrayList<Text> fTextBoxes;
protected final HashMap<Control, Label> fLabels;
protected final ArrayList<ExpandableComposite> fExpandedComposites;
private SelectionListener fSelectionListener;
private ModifyListener fTextModifyListener;
@ -179,9 +179,9 @@ public abstract class OptionsConfigurationBlock {
private final IWorkingCopyManager fManager;
private IWorkbenchPreferenceContainer fContainer;
private Map fDisabledProjectSettings; // null when project specific settings are turned off
private Map<Key, String> fDisabledProjectSettings; // null when project specific settings are turned off
private int fRebuildCount; /// used to prevent multiple dialogs that ask for a rebuild
private int fRebuildCount; // used to prevent multiple dialogs that ask for a rebuild
public OptionsConfigurationBlock(IStatusChangeListener context, IProject project, Key[] allKeys, IWorkbenchPreferenceContainer container) {
fContext= context;
@ -211,7 +211,7 @@ public abstract class OptionsConfigurationBlock {
if (fProject == null || hasProjectSpecificOptions(fProject)) {
fDisabledProjectSettings= null;
} else {
fDisabledProjectSettings= new IdentityHashMap();
fDisabledProjectSettings= new IdentityHashMap<Key, String>();
for (int i= 0; i < allKeys.length; i++) {
Key curr= allKeys[i];
fDisabledProjectSettings.put(curr, curr.getStoredValue(fLookupOrder, false, fManager));
@ -220,11 +220,11 @@ public abstract class OptionsConfigurationBlock {
settingsUpdated();
fCheckBoxes= new ArrayList();
fComboBoxes= new ArrayList();
fTextBoxes= new ArrayList(2);
fLabels= new HashMap();
fExpandedComposites= new ArrayList();
fCheckBoxes= new ArrayList<Button>();
fComboBoxes= new ArrayList<Combo>();
fTextBoxes= new ArrayList<Text>(2);
fLabels= new HashMap<Control, Label>();
fExpandedComposites= new ArrayList<ExpandableComposite>();
fRebuildCount= getRebuildCount();
}
@ -284,7 +284,7 @@ public abstract class OptionsConfigurationBlock {
ExpandableComposite expandable= getParentExpandableComposite(control);
if (expandable != null) {
for (int i= 0; i < fExpandedComposites.size(); i++) {
ExpandableComposite curr= (ExpandableComposite) fExpandedComposites.get(i);
ExpandableComposite curr= fExpandedComposites.get(i);
curr.setExpanded(curr == expandable);
}
expandedStateChanged(expandable);
@ -506,7 +506,8 @@ public abstract class OptionsConfigurationBlock {
}
protected ExpandableComposite createStyleSection(Composite parent, String label, int nColumns) {
ExpandableComposite excomposite= new ExpandableComposite(parent, SWT.NONE, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT);
ExpandableComposite excomposite= new ExpandableComposite(parent, SWT.NONE,
ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT);
excomposite.setText(label);
excomposite.setExpanded(false);
excomposite.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
@ -530,7 +531,7 @@ public abstract class OptionsConfigurationBlock {
protected void restoreSectionExpansionStates(IDialogSettings settings) {
for (int i= 0; i < fExpandedComposites.size(); i++) {
ExpandableComposite excomposite= (ExpandableComposite) fExpandedComposites.get(i);
ExpandableComposite excomposite= fExpandedComposites.get(i);
if (settings == null) {
excomposite.setExpanded(i == 0); // only expand the first node by default
} else {
@ -541,7 +542,7 @@ public abstract class OptionsConfigurationBlock {
protected void storeSectionExpansionStates(IDialogSettings settings) {
for (int i= 0; i < fExpandedComposites.size(); i++) {
ExpandableComposite curr= (ExpandableComposite) fExpandedComposites.get(i);
ExpandableComposite curr= fExpandedComposites.get(i);
settings.put(SETTINGS_EXPANDED + String.valueOf(i), curr.isExpanded());
}
}
@ -597,7 +598,7 @@ public abstract class OptionsConfigurationBlock {
protected String getValue(Key key) {
if (fDisabledProjectSettings != null) {
return (String) fDisabledProjectSettings.get(key);
return fDisabledProjectSettings.get(key);
}
return key.getStoredValue(fLookupOrder, false, fManager);
}
@ -609,7 +610,7 @@ public abstract class OptionsConfigurationBlock {
protected String setValue(Key key, String value) {
if (fDisabledProjectSettings != null) {
return (String) fDisabledProjectSettings.put(key, value);
return fDisabledProjectSettings.put(key, value);
}
String oldValue= getValue(key);
key.setStoredValue(fLookupOrder[0], value, fManager);
@ -646,7 +647,7 @@ public abstract class OptionsConfigurationBlock {
return res;
}
private boolean getChanges(IScopeContext currContext, List changedSettings) {
private boolean getChanges(IScopeContext currContext, List<Key> changedSettings) {
boolean needsBuild= false;
for (int i= 0; i < fAllKeys.length; i++) {
Key key= fAllKeys[i];
@ -671,14 +672,14 @@ public abstract class OptionsConfigurationBlock {
if (enable) {
for (int i= 0; i < fAllKeys.length; i++) {
Key curr= fAllKeys[i];
String val= (String) fDisabledProjectSettings.get(curr);
String val= fDisabledProjectSettings.get(curr);
curr.setStoredValue(fLookupOrder[0], val, fManager);
}
fDisabledProjectSettings= null;
updateControls();
validateSettings(null, null, null);
} else {
fDisabledProjectSettings= new IdentityHashMap();
fDisabledProjectSettings= new IdentityHashMap<Key, String>();
for (int i= 0; i < fAllKeys.length; i++) {
Key curr= fAllKeys[i];
String oldSetting= curr.getStoredValue(fLookupOrder, false, fManager);
@ -705,7 +706,7 @@ public abstract class OptionsConfigurationBlock {
protected boolean processChanges(IWorkbenchPreferenceContainer container) {
IScopeContext currContext= fLookupOrder[0];
List /* <Key>*/ changedOptions= new ArrayList();
List<Key> changedOptions= new ArrayList<Key>();
boolean needsBuild= getChanges(currContext, changedOptions);
if (changedOptions.isEmpty()) {
return true;
@ -794,13 +795,13 @@ public abstract class OptionsConfigurationBlock {
protected void updateControls() {
// update the UI
for (int i= fCheckBoxes.size() - 1; i >= 0; i--) {
updateCheckBox((Button) fCheckBoxes.get(i));
updateCheckBox(fCheckBoxes.get(i));
}
for (int i= fComboBoxes.size() - 1; i >= 0; i--) {
updateCombo((Combo) fComboBoxes.get(i));
updateCombo(fComboBoxes.get(i));
}
for (int i= fTextBoxes.size() - 1; i >= 0; i--) {
updateText((Text) fTextBoxes.get(i));
updateText(fTextBoxes.get(i));
}
}
@ -829,7 +830,7 @@ public abstract class OptionsConfigurationBlock {
protected Button getCheckBox(Key key) {
for (int i= fCheckBoxes.size() - 1; i >= 0; i--) {
Button curr= (Button) fCheckBoxes.get(i);
Button curr= fCheckBoxes.get(i);
ControlData data= (ControlData) curr.getData();
if (key.equals(data.getKey())) {
return curr;
@ -840,7 +841,7 @@ public abstract class OptionsConfigurationBlock {
protected Combo getComboBox(Key key) {
for (int i= fComboBoxes.size() - 1; i >= 0; i--) {
Combo curr= (Combo) fComboBoxes.get(i);
Combo curr= fComboBoxes.get(i);
ControlData data= (ControlData) curr.getData();
if (key.equals(data.getKey())) {
return curr;
@ -851,7 +852,7 @@ public abstract class OptionsConfigurationBlock {
protected Text getTextControl(Key key) {
for (int i= fTextBoxes.size() - 1; i >= 0; i--) {
Text curr= (Text) fTextBoxes.get(i);
Text curr= fTextBoxes.get(i);
ControlData data= (ControlData) curr.getData();
if (key.equals(data.getKey())) {
return curr;
@ -878,7 +879,7 @@ public abstract class OptionsConfigurationBlock {
protected void setComboEnabled(Key key, boolean enabled) {
Combo combo= getComboBox(key);
Label label= (Label) fLabels.get(combo);
Label label= fLabels.get(combo);
combo.setEnabled(enabled);
label.setEnabled(enabled);
}

View file

@ -309,7 +309,7 @@ public class SpellingConfigurationBlock extends OptionsConfigurationBlock {
Composite composite= new Composite(parent, SWT.NONE);
composite.setLayout(new GridLayout());
List allControls= new ArrayList();
List<Control> allControls= new ArrayList<Control>();
final PixelConverter converter= new PixelConverter(parent);
final String[] trueFalse= new String[] { IPreferenceStore.TRUE, IPreferenceStore.FALSE };
@ -447,7 +447,7 @@ public class SpellingConfigurationBlock extends OptionsConfigurationBlock {
allControls.add(button);
}
fAllControls= (Control[]) allControls.toArray(new Control[allControls.size()]);
fAllControls= allControls.toArray(new Control[allControls.size()]);
PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, ICHelpContextIds.SPELLING_CONFIGURATION_BLOCK);
return composite;
@ -459,7 +459,7 @@ public class SpellingConfigurationBlock extends OptionsConfigurationBlock {
* @param composite the parent composite
* @param allControls list with all controls
*/
private void createEncodingFieldEditor(Composite composite, List allControls) {
private void createEncodingFieldEditor(Composite composite, List<Control> allControls) {
Label filler= new Label(composite, SWT.NONE);
GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gd.horizontalSpan= 4;
@ -627,7 +627,7 @@ public class SpellingConfigurationBlock extends OptionsConfigurationBlock {
fEnabledControls= null;
}
if (!enabled && fEnabledControls == null) {
List enabledControls= new ArrayList();
List<Control> enabledControls= new ArrayList<Control>();
for (int i= fAllControls.length - 1; i >= 0; i--) {
Control control= fAllControls[i];
if (control.isEnabled()) {
@ -635,7 +635,7 @@ public class SpellingConfigurationBlock extends OptionsConfigurationBlock {
control.setEnabled(false);
}
}
fEnabledControls= (Control[]) enabledControls.toArray(new Control[enabledControls.size()]);
fEnabledControls= enabledControls.toArray(new Control[enabledControls.size()]);
}
}
}