diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/CodeFormatterConfigurationBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/CodeFormatterConfigurationBlock.java index 03d7f5bdeae..5e620d2e7fd 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/CodeFormatterConfigurationBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/CodeFormatterConfigurationBlock.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -52,14 +52,14 @@ public class CodeFormatterConfigurationBlock extends ProfileConfigurationBlock { fCodeStylePreview.update(); return; } - final int value= ((Integer)arg).intValue(); + final int value= ((Integer) arg).intValue(); switch (value) { - case ProfileManager.PROFILE_CREATED_EVENT: - case ProfileManager.PROFILE_DELETED_EVENT: - case ProfileManager.SELECTION_CHANGED_EVENT: - case ProfileManager.SETTINGS_CHANGED_EVENT: - fCodeStylePreview.setWorkingValues(((ProfileManager)o).getSelected().getSettings()); - fCodeStylePreview.update(); + case ProfileManager.PROFILE_CREATED_EVENT: + case ProfileManager.PROFILE_DELETED_EVENT: + case ProfileManager.SELECTION_CHANGED_EVENT: + case ProfileManager.SETTINGS_CHANGED_EVENT: + fCodeStylePreview.setWorkingValues(((ProfileManager)o).getSelected().getSettings()); + fCodeStylePreview.update(); } } } @@ -91,8 +91,9 @@ public class CodeFormatterConfigurationBlock extends ProfileConfigurationBlock { * The CPreview. */ protected TranslationUnitPreview fCodeStylePreview; - + protected CustomCodeFormatterBlock fCustomCodeFormatterBlock; + /** * Create a new CodeFormatterConfigurationBlock. */ @@ -105,7 +106,7 @@ public class CodeFormatterConfigurationBlock extends ProfileConfigurationBlock { protected IProfileVersioner createProfileVersioner() { return new ProfileVersioner(); } - + @Override protected ProfileStore createProfileStore(IProfileVersioner versioner) { return new FormatterProfileStore(versioner); @@ -141,9 +142,6 @@ public class CodeFormatterConfigurationBlock extends ProfileConfigurationBlock { return new FormatterModifyDialog(shell, profile, profileManager, profileStore, newProfile, FORMATTER_DIALOG_PREFERENCE_KEY, DIALOGSTORE_LASTSAVELOADPATH); } - /* - * @see org.eclipse.cdt.internal.ui.preferences.formatter.ProfileConfigurationBlock#performApply() - */ @Override public void performApply() { if (fCustomCodeFormatterBlock != null) { @@ -152,9 +150,6 @@ public class CodeFormatterConfigurationBlock extends ProfileConfigurationBlock { super.performApply(); } - /* - * @see org.eclipse.cdt.internal.ui.preferences.formatter.ProfileConfigurationBlock#performDefaults() - */ @Override public void performDefaults() { if (fCustomCodeFormatterBlock != null) { @@ -163,9 +158,6 @@ public class CodeFormatterConfigurationBlock extends ProfileConfigurationBlock { super.performDefaults(); } - /* - * @see org.eclipse.cdt.internal.ui.preferences.formatter.ProfileConfigurationBlock#performOk() - */ @Override public boolean performOk() { if (fCustomCodeFormatterBlock != null) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/CustomCodeFormatterBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/CustomCodeFormatterBlock.java index c8648c50273..4d07a9f9fe6 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/CustomCodeFormatterBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/CustomCodeFormatterBlock.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 QNX Software Systems and others. + * Copyright (c) 2000, 2013 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,10 +7,9 @@ * * Contributors: * QNX Software Systems - Initial API and implementation - * Sergey Prigogin, Google + * Sergey Prigogin (Google) * Anton Leherbauer (Wind River Systems) *******************************************************************************/ - package org.eclipse.cdt.internal.ui.preferences.formatter; import java.util.HashMap; @@ -48,7 +47,6 @@ import org.eclipse.cdt.internal.ui.preferences.PreferencesAccess; * If no formatter is contributed, nothing is shown. */ public class CustomCodeFormatterBlock extends Observable { - private HashMap idMap = new HashMap(); private IEclipsePreferences fPrefs; private String fDefaultFormatterId; @@ -92,7 +90,7 @@ public class CustomCodeFormatterBlock extends Observable { if (formatterId != null && !formatterId.equals(fDefaultFormatterId)) { fPrefs.put(CCorePreferenceConstants.CODE_FORMATTER, formatterId); } else { - // simply reset to the default one. + // Simply reset to the default one. performDefaults(); } } @@ -105,9 +103,9 @@ public class CustomCodeFormatterBlock extends Observable { } fFormatterCombo.clearSelection(); fFormatterCombo.setText(DEFAULT); - Iterator> iterator = idMap.entrySet().iterator(); + Iterator> iterator = idMap.entrySet().iterator(); while (iterator.hasNext()) { - Map.Entry entry = iterator.next(); + Map.Entry entry = iterator.next(); String val = entry.getValue(); if (val != null && val.equals(fDefaultFormatterId)) { fFormatterCombo.setText(entry.getKey()); @@ -125,7 +123,7 @@ public class CustomCodeFormatterBlock extends Observable { } /** - * Get the currently selected formatter id. + * Returns the currently selected formatter id. * * @return the selected formatter id or null if the default is selected. */ @@ -137,9 +135,6 @@ public class CustomCodeFormatterBlock extends Observable { return formatterId; } - /* (non-Javadoc) - * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) - */ public Control createContents(Composite parent) { if (getNumberOfAvailableFormatters() == 0) { return parent; @@ -182,7 +177,7 @@ public class CustomCodeFormatterBlock extends Observable { boolean init = false; String formatterID= fPrefs.get(CCorePreferenceConstants.CODE_FORMATTER, fDefaultFormatterId); if (formatterID != null) { - Iterator> iterator = idMap.entrySet().iterator(); + Iterator> iterator = idMap.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry entry = iterator.next(); String val = entry.getValue();