mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 10:46:02 +02:00
Use generics.
This commit is contained in:
parent
5706933862
commit
99731305db
2 changed files with 36 additions and 35 deletions
|
@ -159,11 +159,11 @@ public abstract class OptionsConfigurationBlock {
|
||||||
|
|
||||||
private static final String SETTINGS_EXPANDED= "expanded"; //$NON-NLS-1$
|
private static final String SETTINGS_EXPANDED= "expanded"; //$NON-NLS-1$
|
||||||
|
|
||||||
protected final ArrayList fCheckBoxes;
|
protected final ArrayList<Button> fCheckBoxes;
|
||||||
protected final ArrayList fComboBoxes;
|
protected final ArrayList<Combo> fComboBoxes;
|
||||||
protected final ArrayList fTextBoxes;
|
protected final ArrayList<Text> fTextBoxes;
|
||||||
protected final HashMap fLabels;
|
protected final HashMap<Control, Label> fLabels;
|
||||||
protected final ArrayList fExpandedComposites;
|
protected final ArrayList<ExpandableComposite> fExpandedComposites;
|
||||||
|
|
||||||
private SelectionListener fSelectionListener;
|
private SelectionListener fSelectionListener;
|
||||||
private ModifyListener fTextModifyListener;
|
private ModifyListener fTextModifyListener;
|
||||||
|
@ -179,9 +179,9 @@ public abstract class OptionsConfigurationBlock {
|
||||||
private final IWorkingCopyManager fManager;
|
private final IWorkingCopyManager fManager;
|
||||||
private IWorkbenchPreferenceContainer fContainer;
|
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) {
|
public OptionsConfigurationBlock(IStatusChangeListener context, IProject project, Key[] allKeys, IWorkbenchPreferenceContainer container) {
|
||||||
fContext= context;
|
fContext= context;
|
||||||
|
@ -211,7 +211,7 @@ public abstract class OptionsConfigurationBlock {
|
||||||
if (fProject == null || hasProjectSpecificOptions(fProject)) {
|
if (fProject == null || hasProjectSpecificOptions(fProject)) {
|
||||||
fDisabledProjectSettings= null;
|
fDisabledProjectSettings= null;
|
||||||
} else {
|
} else {
|
||||||
fDisabledProjectSettings= new IdentityHashMap();
|
fDisabledProjectSettings= new IdentityHashMap<Key, String>();
|
||||||
for (int i= 0; i < allKeys.length; i++) {
|
for (int i= 0; i < allKeys.length; i++) {
|
||||||
Key curr= allKeys[i];
|
Key curr= allKeys[i];
|
||||||
fDisabledProjectSettings.put(curr, curr.getStoredValue(fLookupOrder, false, fManager));
|
fDisabledProjectSettings.put(curr, curr.getStoredValue(fLookupOrder, false, fManager));
|
||||||
|
@ -220,11 +220,11 @@ public abstract class OptionsConfigurationBlock {
|
||||||
|
|
||||||
settingsUpdated();
|
settingsUpdated();
|
||||||
|
|
||||||
fCheckBoxes= new ArrayList();
|
fCheckBoxes= new ArrayList<Button>();
|
||||||
fComboBoxes= new ArrayList();
|
fComboBoxes= new ArrayList<Combo>();
|
||||||
fTextBoxes= new ArrayList(2);
|
fTextBoxes= new ArrayList<Text>(2);
|
||||||
fLabels= new HashMap();
|
fLabels= new HashMap<Control, Label>();
|
||||||
fExpandedComposites= new ArrayList();
|
fExpandedComposites= new ArrayList<ExpandableComposite>();
|
||||||
|
|
||||||
fRebuildCount= getRebuildCount();
|
fRebuildCount= getRebuildCount();
|
||||||
}
|
}
|
||||||
|
@ -284,7 +284,7 @@ public abstract class OptionsConfigurationBlock {
|
||||||
ExpandableComposite expandable= getParentExpandableComposite(control);
|
ExpandableComposite expandable= getParentExpandableComposite(control);
|
||||||
if (expandable != null) {
|
if (expandable != null) {
|
||||||
for (int i= 0; i < fExpandedComposites.size(); i++) {
|
for (int i= 0; i < fExpandedComposites.size(); i++) {
|
||||||
ExpandableComposite curr= (ExpandableComposite) fExpandedComposites.get(i);
|
ExpandableComposite curr= fExpandedComposites.get(i);
|
||||||
curr.setExpanded(curr == expandable);
|
curr.setExpanded(curr == expandable);
|
||||||
}
|
}
|
||||||
expandedStateChanged(expandable);
|
expandedStateChanged(expandable);
|
||||||
|
@ -506,7 +506,8 @@ public abstract class OptionsConfigurationBlock {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ExpandableComposite createStyleSection(Composite parent, String label, int nColumns) {
|
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.setText(label);
|
||||||
excomposite.setExpanded(false);
|
excomposite.setExpanded(false);
|
||||||
excomposite.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
|
excomposite.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
|
||||||
|
@ -530,7 +531,7 @@ public abstract class OptionsConfigurationBlock {
|
||||||
|
|
||||||
protected void restoreSectionExpansionStates(IDialogSettings settings) {
|
protected void restoreSectionExpansionStates(IDialogSettings settings) {
|
||||||
for (int i= 0; i < fExpandedComposites.size(); i++) {
|
for (int i= 0; i < fExpandedComposites.size(); i++) {
|
||||||
ExpandableComposite excomposite= (ExpandableComposite) fExpandedComposites.get(i);
|
ExpandableComposite excomposite= fExpandedComposites.get(i);
|
||||||
if (settings == null) {
|
if (settings == null) {
|
||||||
excomposite.setExpanded(i == 0); // only expand the first node by default
|
excomposite.setExpanded(i == 0); // only expand the first node by default
|
||||||
} else {
|
} else {
|
||||||
|
@ -541,7 +542,7 @@ public abstract class OptionsConfigurationBlock {
|
||||||
|
|
||||||
protected void storeSectionExpansionStates(IDialogSettings settings) {
|
protected void storeSectionExpansionStates(IDialogSettings settings) {
|
||||||
for (int i= 0; i < fExpandedComposites.size(); i++) {
|
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());
|
settings.put(SETTINGS_EXPANDED + String.valueOf(i), curr.isExpanded());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -597,7 +598,7 @@ public abstract class OptionsConfigurationBlock {
|
||||||
|
|
||||||
protected String getValue(Key key) {
|
protected String getValue(Key key) {
|
||||||
if (fDisabledProjectSettings != null) {
|
if (fDisabledProjectSettings != null) {
|
||||||
return (String) fDisabledProjectSettings.get(key);
|
return fDisabledProjectSettings.get(key);
|
||||||
}
|
}
|
||||||
return key.getStoredValue(fLookupOrder, false, fManager);
|
return key.getStoredValue(fLookupOrder, false, fManager);
|
||||||
}
|
}
|
||||||
|
@ -609,7 +610,7 @@ public abstract class OptionsConfigurationBlock {
|
||||||
|
|
||||||
protected String setValue(Key key, String value) {
|
protected String setValue(Key key, String value) {
|
||||||
if (fDisabledProjectSettings != null) {
|
if (fDisabledProjectSettings != null) {
|
||||||
return (String) fDisabledProjectSettings.put(key, value);
|
return fDisabledProjectSettings.put(key, value);
|
||||||
}
|
}
|
||||||
String oldValue= getValue(key);
|
String oldValue= getValue(key);
|
||||||
key.setStoredValue(fLookupOrder[0], value, fManager);
|
key.setStoredValue(fLookupOrder[0], value, fManager);
|
||||||
|
@ -646,7 +647,7 @@ public abstract class OptionsConfigurationBlock {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean getChanges(IScopeContext currContext, List changedSettings) {
|
private boolean getChanges(IScopeContext currContext, List<Key> changedSettings) {
|
||||||
boolean needsBuild= false;
|
boolean needsBuild= false;
|
||||||
for (int i= 0; i < fAllKeys.length; i++) {
|
for (int i= 0; i < fAllKeys.length; i++) {
|
||||||
Key key= fAllKeys[i];
|
Key key= fAllKeys[i];
|
||||||
|
@ -671,14 +672,14 @@ public abstract class OptionsConfigurationBlock {
|
||||||
if (enable) {
|
if (enable) {
|
||||||
for (int i= 0; i < fAllKeys.length; i++) {
|
for (int i= 0; i < fAllKeys.length; i++) {
|
||||||
Key curr= fAllKeys[i];
|
Key curr= fAllKeys[i];
|
||||||
String val= (String) fDisabledProjectSettings.get(curr);
|
String val= fDisabledProjectSettings.get(curr);
|
||||||
curr.setStoredValue(fLookupOrder[0], val, fManager);
|
curr.setStoredValue(fLookupOrder[0], val, fManager);
|
||||||
}
|
}
|
||||||
fDisabledProjectSettings= null;
|
fDisabledProjectSettings= null;
|
||||||
updateControls();
|
updateControls();
|
||||||
validateSettings(null, null, null);
|
validateSettings(null, null, null);
|
||||||
} else {
|
} else {
|
||||||
fDisabledProjectSettings= new IdentityHashMap();
|
fDisabledProjectSettings= new IdentityHashMap<Key, String>();
|
||||||
for (int i= 0; i < fAllKeys.length; i++) {
|
for (int i= 0; i < fAllKeys.length; i++) {
|
||||||
Key curr= fAllKeys[i];
|
Key curr= fAllKeys[i];
|
||||||
String oldSetting= curr.getStoredValue(fLookupOrder, false, fManager);
|
String oldSetting= curr.getStoredValue(fLookupOrder, false, fManager);
|
||||||
|
@ -705,7 +706,7 @@ public abstract class OptionsConfigurationBlock {
|
||||||
protected boolean processChanges(IWorkbenchPreferenceContainer container) {
|
protected boolean processChanges(IWorkbenchPreferenceContainer container) {
|
||||||
IScopeContext currContext= fLookupOrder[0];
|
IScopeContext currContext= fLookupOrder[0];
|
||||||
|
|
||||||
List /* <Key>*/ changedOptions= new ArrayList();
|
List<Key> changedOptions= new ArrayList<Key>();
|
||||||
boolean needsBuild= getChanges(currContext, changedOptions);
|
boolean needsBuild= getChanges(currContext, changedOptions);
|
||||||
if (changedOptions.isEmpty()) {
|
if (changedOptions.isEmpty()) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -794,13 +795,13 @@ public abstract class OptionsConfigurationBlock {
|
||||||
protected void updateControls() {
|
protected void updateControls() {
|
||||||
// update the UI
|
// update the UI
|
||||||
for (int i= fCheckBoxes.size() - 1; i >= 0; i--) {
|
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--) {
|
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--) {
|
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) {
|
protected Button getCheckBox(Key key) {
|
||||||
for (int i= fCheckBoxes.size() - 1; i >= 0; i--) {
|
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();
|
ControlData data= (ControlData) curr.getData();
|
||||||
if (key.equals(data.getKey())) {
|
if (key.equals(data.getKey())) {
|
||||||
return curr;
|
return curr;
|
||||||
|
@ -840,7 +841,7 @@ public abstract class OptionsConfigurationBlock {
|
||||||
|
|
||||||
protected Combo getComboBox(Key key) {
|
protected Combo getComboBox(Key key) {
|
||||||
for (int i= fComboBoxes.size() - 1; i >= 0; i--) {
|
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();
|
ControlData data= (ControlData) curr.getData();
|
||||||
if (key.equals(data.getKey())) {
|
if (key.equals(data.getKey())) {
|
||||||
return curr;
|
return curr;
|
||||||
|
@ -851,7 +852,7 @@ public abstract class OptionsConfigurationBlock {
|
||||||
|
|
||||||
protected Text getTextControl(Key key) {
|
protected Text getTextControl(Key key) {
|
||||||
for (int i= fTextBoxes.size() - 1; i >= 0; i--) {
|
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();
|
ControlData data= (ControlData) curr.getData();
|
||||||
if (key.equals(data.getKey())) {
|
if (key.equals(data.getKey())) {
|
||||||
return curr;
|
return curr;
|
||||||
|
@ -878,7 +879,7 @@ public abstract class OptionsConfigurationBlock {
|
||||||
|
|
||||||
protected void setComboEnabled(Key key, boolean enabled) {
|
protected void setComboEnabled(Key key, boolean enabled) {
|
||||||
Combo combo= getComboBox(key);
|
Combo combo= getComboBox(key);
|
||||||
Label label= (Label) fLabels.get(combo);
|
Label label= fLabels.get(combo);
|
||||||
combo.setEnabled(enabled);
|
combo.setEnabled(enabled);
|
||||||
label.setEnabled(enabled);
|
label.setEnabled(enabled);
|
||||||
}
|
}
|
||||||
|
|
|
@ -309,7 +309,7 @@ public class SpellingConfigurationBlock extends OptionsConfigurationBlock {
|
||||||
Composite composite= new Composite(parent, SWT.NONE);
|
Composite composite= new Composite(parent, SWT.NONE);
|
||||||
composite.setLayout(new GridLayout());
|
composite.setLayout(new GridLayout());
|
||||||
|
|
||||||
List allControls= new ArrayList();
|
List<Control> allControls= new ArrayList<Control>();
|
||||||
final PixelConverter converter= new PixelConverter(parent);
|
final PixelConverter converter= new PixelConverter(parent);
|
||||||
|
|
||||||
final String[] trueFalse= new String[] { IPreferenceStore.TRUE, IPreferenceStore.FALSE };
|
final String[] trueFalse= new String[] { IPreferenceStore.TRUE, IPreferenceStore.FALSE };
|
||||||
|
@ -447,7 +447,7 @@ public class SpellingConfigurationBlock extends OptionsConfigurationBlock {
|
||||||
allControls.add(button);
|
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);
|
PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, ICHelpContextIds.SPELLING_CONFIGURATION_BLOCK);
|
||||||
return composite;
|
return composite;
|
||||||
|
@ -459,7 +459,7 @@ public class SpellingConfigurationBlock extends OptionsConfigurationBlock {
|
||||||
* @param composite the parent composite
|
* @param composite the parent composite
|
||||||
* @param allControls list with all controls
|
* @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);
|
Label filler= new Label(composite, SWT.NONE);
|
||||||
GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
|
GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
|
||||||
gd.horizontalSpan= 4;
|
gd.horizontalSpan= 4;
|
||||||
|
@ -627,7 +627,7 @@ public class SpellingConfigurationBlock extends OptionsConfigurationBlock {
|
||||||
fEnabledControls= null;
|
fEnabledControls= null;
|
||||||
}
|
}
|
||||||
if (!enabled && 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--) {
|
for (int i= fAllControls.length - 1; i >= 0; i--) {
|
||||||
Control control= fAllControls[i];
|
Control control= fAllControls[i];
|
||||||
if (control.isEnabled()) {
|
if (control.isEnabled()) {
|
||||||
|
@ -635,7 +635,7 @@ public class SpellingConfigurationBlock extends OptionsConfigurationBlock {
|
||||||
control.setEnabled(false);
|
control.setEnabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fEnabledControls= (Control[]) enabledControls.toArray(new Control[enabledControls.size()]);
|
fEnabledControls= enabledControls.toArray(new Control[enabledControls.size()]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue