1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-05 08:46:02 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2011-05-23 21:07:44 +00:00
parent a69e4f47a1
commit 25dd44749e

View file

@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* IBM - Initial API and implementation * IBM - Initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.ui.dialogs; package org.eclipse.cdt.ui.dialogs;
@ -77,7 +77,7 @@ public class IndexerBlock extends AbstractCOptionPage {
private PreferenceScopeBlock fPrefScopeBlock; private PreferenceScopeBlock fPrefScopeBlock;
private Button fEnableIndexer; private Button fEnableIndexer;
private Combo fIndexersComboBox; private Combo fIndexersComboBox;
private HashMap<String, IndexerConfig> fIndexerConfigMap; private HashMap<String, IndexerConfig> fIndexerConfigMap;
private String fTheOneIndexerID; private String fTheOneIndexerID;
private Composite fIndexerPageComposite; private Composite fIndexerPageComposite;
private AbstractIndexerPage fCurrentPage; private AbstractIndexerPage fCurrentPage;
@ -95,13 +95,11 @@ public class IndexerBlock extends AbstractCOptionPage {
setDescription(INDEXER_DESCRIPTION); setDescription(INDEXER_DESCRIPTION);
initializeIndexerConfigMap(); initializeIndexerConfigMap();
} }
@Override @Override
public boolean isValid() { public boolean isValid() {
return super.isValid() && (fCurrentPage == null || fCurrentPage.isValid()); return super.isValid() && (fCurrentPage == null || fCurrentPage.isValid());
} }
@Override @Override
public String getErrorMessage() { public String getErrorMessage() {
@ -112,7 +110,6 @@ public class IndexerBlock extends AbstractCOptionPage {
return msg; return msg;
} }
/** /**
* Create a profile page only on request * Create a profile page only on request
*/ */
@ -133,8 +130,7 @@ public class IndexerBlock extends AbstractCOptionPage {
if (fPage == null) { if (fPage == null) {
try { try {
fPage= (AbstractIndexerPage) fElement.createExecutableExtension(ATTRIB_CLASS); fPage= (AbstractIndexerPage) fElement.createExecutableExtension(ATTRIB_CLASS);
} } catch (Exception e) {
catch (Exception e) {
CUIPlugin.log(e); CUIPlugin.log(e);
} }
if (fPage == null) { if (fPage == null) {
@ -204,7 +200,7 @@ public class IndexerBlock extends AbstractCOptionPage {
fEnableIndexer.addSelectionListener(indexerChangeListener); fEnableIndexer.addSelectionListener(indexerChangeListener);
// add combo to select indexer // add combo to select indexer
Group group= ControlFactory.createGroup(fPreferenceContent,INDEXER_COMBO_LABEL, 1); Group group= ControlFactory.createGroup(fPreferenceContent, INDEXER_COMBO_LABEL, 1);
gd= (GridData) group.getLayoutData(); gd= (GridData) group.getLayoutData();
gd.grabExcessHorizontalSpace= true; gd.grabExcessHorizontalSpace= true;
@ -294,8 +290,7 @@ public class IndexerBlock extends AbstractCOptionPage {
ICProjectDescription prefs= prjDescMgr.getProjectDescription(getProject(), false); ICProjectDescription prefs= prjDescMgr.getProjectDescription(getProject(), false);
selectBuildConfigInCombo(prefs.getActiveConfiguration().getName()); selectBuildConfigInCombo(prefs.getActiveConfiguration().getName());
fBuildConfigComboBox.setEnabled(false); fBuildConfigComboBox.setEnabled(false);
} } else {
else {
// independent of the scope // independent of the scope
fBuildConfigComboBox.setEnabled(true); fBuildConfigComboBox.setEnabled(true);
} }
@ -310,8 +305,7 @@ public class IndexerBlock extends AbstractCOptionPage {
} }
if (enable) { if (enable) {
fEnableState= null; fEnableState= null;
} } else {
else {
fEnableState= ControlEnableState.disable(fPreferenceContent); fEnableState= ControlEnableState.disable(fPreferenceContent);
} }
} }
@ -345,7 +339,6 @@ public class IndexerBlock extends AbstractCOptionPage {
names[j++]= fIndexerConfigMap.get(id).getName(); names[j++]= fIndexerConfigMap.get(id).getName();
} }
} }
@SuppressWarnings("unchecked")
final Comparator<Object> collator = Collator.getInstance(); final Comparator<Object> collator = Collator.getInstance();
Arrays.sort(names, collator); Arrays.sort(names, collator);
fIndexersComboBox.setItems(names); fIndexersComboBox.setItems(names);
@ -371,7 +364,6 @@ public class IndexerBlock extends AbstractCOptionPage {
ICConfigurationDescription config = configs[i]; ICConfigurationDescription config = configs[i];
names[i]= config.getName(); names[i]= config.getName();
} }
@SuppressWarnings("unchecked")
final Comparator<Object> collator = Collator.getInstance(); final Comparator<Object> collator = Collator.getInstance();
Arrays.sort(names, collator); Arrays.sort(names, collator);
fBuildConfigComboBox.setItems(names); fBuildConfigComboBox.setItems(names);
@ -382,7 +374,7 @@ public class IndexerBlock extends AbstractCOptionPage {
private void selectBuildConfigInCombo(String useName) { private void selectBuildConfigInCombo(String useName) {
String[] names= fBuildConfigComboBox.getItems(); String[] names= fBuildConfigComboBox.getItems();
int selectedIndex = 0; int selectedIndex = 0;
for (int i=0; i<names.length; i++){ for (int i = 0; i < names.length; i++){
if (names[i].equals(useName)) if (names[i].equals(useName))
selectedIndex = i; selectedIndex = i;
} }
@ -398,8 +390,7 @@ public class IndexerBlock extends AbstractCOptionPage {
if (getIndexerName(indexerId) == null) { if (getIndexerName(indexerId) == null) {
if (fCurrentProperties != null) { if (fCurrentProperties != null) {
props= fCurrentProperties; props= fCurrentProperties;
} } else {
else {
props= IndexerPreferences.getProperties(getProject(), IndexerPreferences.SCOPE_INSTANCE); props= IndexerPreferences.getProperties(getProject(), IndexerPreferences.SCOPE_INSTANCE);
} }
} }
@ -419,7 +410,7 @@ public class IndexerBlock extends AbstractCOptionPage {
String indexerName = getIndexerName(indexerId); String indexerName = getIndexerName(indexerId);
String[] indexerList = fIndexersComboBox.getItems(); String[] indexerList = fIndexersComboBox.getItems();
int selectedIndex = 0; int selectedIndex = 0;
for (int i=0; i<indexerList.length; i++){ for (int i = 0; i < indexerList.length; i++){
if (indexerList[i].equals(indexerName)) if (indexerList[i].equals(indexerName))
selectedIndex = i; selectedIndex = i;
} }
@ -479,7 +470,6 @@ public class IndexerBlock extends AbstractCOptionPage {
fCurrentPage= page; fCurrentPage= page;
} }
/** /**
* Adds all the contributed Indexer Pages to a map * Adds all the contributed Indexer Pages to a map
*/ */
@ -552,11 +542,10 @@ public class IndexerBlock extends AbstractCOptionPage {
ICProjectDescription prefs= prjDescMgr.getProjectDescription(getProject(), true); ICProjectDescription prefs= prjDescMgr.getProjectDescription(getProject(), true);
if (scope == IndexerPreferences.SCOPE_INSTANCE) { if (scope == IndexerPreferences.SCOPE_INSTANCE) {
prefs.useDefaultConfigurationRelations(); prefs.useDefaultConfigurationRelations();
} } else {
else { prefs.setConfigurationRelations(useActive ?
prefs.setConfigurationRelations(useActive ICProjectDescriptionPreferences.CONFIGS_LINK_SETTINGS_AND_ACTIVE :
? ICProjectDescriptionPreferences.CONFIGS_LINK_SETTINGS_AND_ACTIVE ICProjectDescriptionPreferences.CONFIGS_INDEPENDENT);
: ICProjectDescriptionPreferences.CONFIGS_INDEPENDENT);
} }
if (!useActive) { if (!useActive) {
final ICConfigurationDescription config= prefs.getConfigurationByName(fBuildConfigComboBox.getText()); final ICConfigurationDescription config= prefs.getConfigurationByName(fBuildConfigComboBox.getText());
@ -575,8 +564,7 @@ public class IndexerBlock extends AbstractCOptionPage {
if (fPrefScopeBlock != null) { if (fPrefScopeBlock != null) {
fPrefScopeBlock.setInstanceScope(); fPrefScopeBlock.setInstanceScope();
onPreferenceScopeChange(); onPreferenceScopeChange();
} } else {
else {
fCurrentProperties= IndexerPreferences.getDefaultIndexerProperties(); fCurrentProperties= IndexerPreferences.getDefaultIndexerProperties();
updateForNewProperties(IndexerPreferences.SCOPE_INSTANCE); updateForNewProperties(IndexerPreferences.SCOPE_INSTANCE);
} }
@ -612,8 +600,7 @@ public class IndexerBlock extends AbstractCOptionPage {
if (container instanceof ICOptionContainerExtension) { if (container instanceof ICOptionContainerExtension) {
try { try {
return ((ICOptionContainerExtension) container).getProjectHandle(); return ((ICOptionContainerExtension) container).getProjectHandle();
} } catch (Exception e) {
catch (Exception e) {
return null; return null;
} }
} }