mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-11 02:05:39 +02:00
Cosmetics.
This commit is contained in:
parent
c98b965760
commit
33174d0697
2 changed files with 18 additions and 31 deletions
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -52,7 +52,7 @@ public class CodeFormatterConfigurationBlock extends ProfileConfigurationBlock {
|
||||||
fCodeStylePreview.update();
|
fCodeStylePreview.update();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final int value= ((Integer)arg).intValue();
|
final int value= ((Integer) arg).intValue();
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case ProfileManager.PROFILE_CREATED_EVENT:
|
case ProfileManager.PROFILE_CREATED_EVENT:
|
||||||
case ProfileManager.PROFILE_DELETED_EVENT:
|
case ProfileManager.PROFILE_DELETED_EVENT:
|
||||||
|
@ -93,6 +93,7 @@ public class CodeFormatterConfigurationBlock extends ProfileConfigurationBlock {
|
||||||
protected TranslationUnitPreview fCodeStylePreview;
|
protected TranslationUnitPreview fCodeStylePreview;
|
||||||
|
|
||||||
protected CustomCodeFormatterBlock fCustomCodeFormatterBlock;
|
protected CustomCodeFormatterBlock fCustomCodeFormatterBlock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new <code>CodeFormatterConfigurationBlock</code>.
|
* Create a new <code>CodeFormatterConfigurationBlock</code>.
|
||||||
*/
|
*/
|
||||||
|
@ -141,9 +142,6 @@ public class CodeFormatterConfigurationBlock extends ProfileConfigurationBlock {
|
||||||
return new FormatterModifyDialog(shell, profile, profileManager, profileStore, newProfile, FORMATTER_DIALOG_PREFERENCE_KEY, DIALOGSTORE_LASTSAVELOADPATH);
|
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
|
@Override
|
||||||
public void performApply() {
|
public void performApply() {
|
||||||
if (fCustomCodeFormatterBlock != null) {
|
if (fCustomCodeFormatterBlock != null) {
|
||||||
|
@ -152,9 +150,6 @@ public class CodeFormatterConfigurationBlock extends ProfileConfigurationBlock {
|
||||||
super.performApply();
|
super.performApply();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.cdt.internal.ui.preferences.formatter.ProfileConfigurationBlock#performDefaults()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void performDefaults() {
|
public void performDefaults() {
|
||||||
if (fCustomCodeFormatterBlock != null) {
|
if (fCustomCodeFormatterBlock != null) {
|
||||||
|
@ -163,9 +158,6 @@ public class CodeFormatterConfigurationBlock extends ProfileConfigurationBlock {
|
||||||
super.performDefaults();
|
super.performDefaults();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.cdt.internal.ui.preferences.formatter.ProfileConfigurationBlock#performOk()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean performOk() {
|
public boolean performOk() {
|
||||||
if (fCustomCodeFormatterBlock != null) {
|
if (fCustomCodeFormatterBlock != null) {
|
||||||
|
|
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,10 +7,9 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX Software Systems - Initial API and implementation
|
* QNX Software Systems - Initial API and implementation
|
||||||
* Sergey Prigogin, Google
|
* Sergey Prigogin (Google)
|
||||||
* Anton Leherbauer (Wind River Systems)
|
* Anton Leherbauer (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.ui.preferences.formatter;
|
package org.eclipse.cdt.internal.ui.preferences.formatter;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -48,7 +47,6 @@ import org.eclipse.cdt.internal.ui.preferences.PreferencesAccess;
|
||||||
* If no formatter is contributed, nothing is shown.
|
* If no formatter is contributed, nothing is shown.
|
||||||
*/
|
*/
|
||||||
public class CustomCodeFormatterBlock extends Observable {
|
public class CustomCodeFormatterBlock extends Observable {
|
||||||
|
|
||||||
private HashMap<String, String> idMap = new HashMap<String, String>();
|
private HashMap<String, String> idMap = new HashMap<String, String>();
|
||||||
private IEclipsePreferences fPrefs;
|
private IEclipsePreferences fPrefs;
|
||||||
private String fDefaultFormatterId;
|
private String fDefaultFormatterId;
|
||||||
|
@ -92,7 +90,7 @@ public class CustomCodeFormatterBlock extends Observable {
|
||||||
if (formatterId != null && !formatterId.equals(fDefaultFormatterId)) {
|
if (formatterId != null && !formatterId.equals(fDefaultFormatterId)) {
|
||||||
fPrefs.put(CCorePreferenceConstants.CODE_FORMATTER, formatterId);
|
fPrefs.put(CCorePreferenceConstants.CODE_FORMATTER, formatterId);
|
||||||
} else {
|
} else {
|
||||||
// simply reset to the default one.
|
// Simply reset to the default one.
|
||||||
performDefaults();
|
performDefaults();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,9 +103,9 @@ public class CustomCodeFormatterBlock extends Observable {
|
||||||
}
|
}
|
||||||
fFormatterCombo.clearSelection();
|
fFormatterCombo.clearSelection();
|
||||||
fFormatterCombo.setText(DEFAULT);
|
fFormatterCombo.setText(DEFAULT);
|
||||||
Iterator<Map.Entry<String,String>> iterator = idMap.entrySet().iterator();
|
Iterator<Map.Entry<String, String>> iterator = idMap.entrySet().iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
Map.Entry<String,String> entry = iterator.next();
|
Map.Entry<String, String> entry = iterator.next();
|
||||||
String val = entry.getValue();
|
String val = entry.getValue();
|
||||||
if (val != null && val.equals(fDefaultFormatterId)) {
|
if (val != null && val.equals(fDefaultFormatterId)) {
|
||||||
fFormatterCombo.setText(entry.getKey());
|
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 <code>null</code> if the default is selected.
|
* @return the selected formatter id or <code>null</code> if the default is selected.
|
||||||
*/
|
*/
|
||||||
|
@ -137,9 +135,6 @@ public class CustomCodeFormatterBlock extends Observable {
|
||||||
return formatterId;
|
return formatterId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
|
|
||||||
*/
|
|
||||||
public Control createContents(Composite parent) {
|
public Control createContents(Composite parent) {
|
||||||
if (getNumberOfAvailableFormatters() == 0) {
|
if (getNumberOfAvailableFormatters() == 0) {
|
||||||
return parent;
|
return parent;
|
||||||
|
@ -182,7 +177,7 @@ public class CustomCodeFormatterBlock extends Observable {
|
||||||
boolean init = false;
|
boolean init = false;
|
||||||
String formatterID= fPrefs.get(CCorePreferenceConstants.CODE_FORMATTER, fDefaultFormatterId);
|
String formatterID= fPrefs.get(CCorePreferenceConstants.CODE_FORMATTER, fDefaultFormatterId);
|
||||||
if (formatterID != null) {
|
if (formatterID != null) {
|
||||||
Iterator<Map.Entry<String,String>> iterator = idMap.entrySet().iterator();
|
Iterator<Map.Entry<String, String>> iterator = idMap.entrySet().iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
Map.Entry<String, String> entry = iterator.next();
|
Map.Entry<String, String> entry = iterator.next();
|
||||||
String val = entry.getValue();
|
String val = entry.getValue();
|
||||||
|
|
Loading…
Add table
Reference in a new issue