Use the formatter line length for margin (see bug 306646 for details)
Change-Id: I788432ee4ddfa6e15164a46db348f84febc9db4b
Signed-off-by: Stefan Xenos <sxenos@gmail.com>
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditor.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditor.java
index 673d362..a5d5711 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditor.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2014 IBM Corporation and others.
+ * Copyright (c) 2000, 2015 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
@@ -9,6 +9,7 @@
* IBM Corporation - initial API and implementation
* Tom Eicher <eclipse@tom.eicher.name> - [formatting] 'Format Element' in JavaDoc does also format method body - https://bugs.eclipse.org/bugs/show_bug.cgi?id=238746
* Tom Eicher (Avaloq Evolution AG) - block selection mode
+ * Stefan Xenos (sxenos@gmail.com) - bug 306646, make editor margins follow the java formatter preference
*******************************************************************************/
package org.eclipse.jdt.internal.ui.javaeditor;
@@ -3106,6 +3107,14 @@
support.setMatchingCharacterPainterPreferenceKeys(MATCHING_BRACKETS, MATCHING_BRACKETS_COLOR, HIGHLIGHT_BRACKET_AT_CARET_LOCATION, ENCLOSING_BRACKETS);
super.configureSourceViewerDecorationSupport(support);
+
+ // The base class will have already called setMarginPainterPreferenceKeys. We override it
+ // here with more specific values for the java editor. Note that this needs to go after the
+ // call to super since the last invocation wins.
+ support.setMarginPainterPreferenceKeys(
+ AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN,
+ AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR,
+ DefaultCodeFormatterConstants.FORMATTER_LINE_SPLIT);
}
/**