1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-09-10 12:03:16 +02:00

Fix for 200437: Only built-in Code Formatter is called

This commit is contained in:
Anton Leherbauer 2007-08-20 11:56:16 +00:00
parent 6996d6d478
commit e2c0f62d7d

View file

@ -61,6 +61,7 @@ import org.eclipse.jface.text.TabsToSpacesConverter;
import org.eclipse.jface.text.TextUtilities;
import org.eclipse.jface.text.contentassist.ContentAssistant;
import org.eclipse.jface.text.contentassist.IContentAssistant;
import org.eclipse.jface.text.formatter.FormattingContext;
import org.eclipse.jface.text.formatter.FormattingContextProperties;
import org.eclipse.jface.text.formatter.IFormattingContext;
import org.eclipse.jface.text.link.ILinkedModeListener;
@ -179,7 +180,6 @@ import org.eclipse.cdt.internal.ui.text.DocumentCharacterIterator;
import org.eclipse.cdt.internal.ui.text.ICReconcilingListener;
import org.eclipse.cdt.internal.ui.text.Symbols;
import org.eclipse.cdt.internal.ui.text.c.hover.SourceViewerInformationControl;
import org.eclipse.cdt.internal.ui.text.comment.CommentFormattingContext;
import org.eclipse.cdt.internal.ui.text.contentassist.ContentAssistPreference;
import org.eclipse.cdt.internal.ui.util.CUIHelp;
@ -250,7 +250,7 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
* @since 3.0
*/
public IFormattingContext createFormattingContext() {
IFormattingContext context= new CommentFormattingContext();
IFormattingContext context= new FormattingContext();
Map preferences;
ICElement inputCElement= getInputCElement();
@ -273,6 +273,12 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
preferences.put(DefaultCodeFormatterConstants.FORMATTER_LANGUAGE, language);
preferences.put(DefaultCodeFormatterConstants.FORMATTER_CURRENT_FILE, tu.getResource());
}
// custom formatter specified?
String customFormatterId= getPreferenceStore().getString(CCorePreferenceConstants.CODE_FORMATTER);
if (customFormatterId != null) {
preferences.put(CCorePreferenceConstants.CODE_FORMATTER, customFormatterId);
}
context.setProperty(FormattingContextProperties.CONTEXT_PREFERENCES, preferences);
return context;