This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 242649
Collapse All | Expand All

(-)a/web.indent/nbproject/project.xml (+9 lines)
Lines 24-29 Link Here
24
                    </run-dependency>
24
                    </run-dependency>
25
                </dependency>
25
                </dependency>
26
                <dependency>
26
                <dependency>
27
                    <code-name-base>org.netbeans.modules.editor.settings</code-name-base>
28
                    <build-prerequisite/>
29
                    <compile-dependency/>
30
                    <run-dependency>
31
                        <release-version>1</release-version>
32
                        <specification-version>1.53</specification-version>
33
                    </run-dependency>
34
                </dependency>
35
                <dependency>
27
                    <code-name-base>org.netbeans.modules.editor.util</code-name-base>
36
                    <code-name-base>org.netbeans.modules.editor.util</code-name-base>
28
                    <build-prerequisite/>
37
                    <build-prerequisite/>
29
                    <compile-dependency/>
38
                    <compile-dependency/>
(-)a/web.indent/src/org/netbeans/modules/web/indent/api/support/AbstractIndenter.java (-1 / +25 lines)
Lines 55-61 Link Here
55
import java.util.TreeSet;
55
import java.util.TreeSet;
56
import java.util.logging.Level;
56
import java.util.logging.Level;
57
import java.util.logging.Logger;
57
import java.util.logging.Logger;
58
import java.util.prefs.Preferences;
58
import javax.swing.text.BadLocationException;
59
import javax.swing.text.BadLocationException;
60
import javax.swing.text.Document;
61
import org.netbeans.api.editor.settings.SimpleValueNames;
59
import org.netbeans.api.lexer.Language;
62
import org.netbeans.api.lexer.Language;
60
import org.netbeans.api.lexer.Token;
63
import org.netbeans.api.lexer.Token;
61
import org.netbeans.api.lexer.TokenId;
64
import org.netbeans.api.lexer.TokenId;
Lines 66-71 Link Here
66
import org.netbeans.modules.web.indent.api.embedding.JoinedTokenSequence;
69
import org.netbeans.modules.web.indent.api.embedding.JoinedTokenSequence;
67
import org.netbeans.modules.web.indent.api.embedding.VirtualSource;
70
import org.netbeans.modules.web.indent.api.embedding.VirtualSource;
68
import org.netbeans.modules.editor.indent.api.IndentUtils;
71
import org.netbeans.modules.editor.indent.api.IndentUtils;
72
import org.netbeans.modules.editor.indent.spi.CodeStylePreferences;
69
import org.netbeans.modules.editor.indent.spi.Context;
73
import org.netbeans.modules.editor.indent.spi.Context;
70
import org.netbeans.modules.web.indent.api.LexUtilities;
74
import org.netbeans.modules.web.indent.api.LexUtilities;
71
import org.openide.util.Exceptions;
75
import org.openide.util.Exceptions;
Lines 97-105 Link Here
97
    public AbstractIndenter(Language<T1> language, Context context) {
101
    public AbstractIndenter(Language<T1> language, Context context) {
98
        this.language = language;
102
        this.language = language;
99
        this.context = context;
103
        this.context = context;
100
        indentationSize = IndentUtils.indentLevelSize(getDocument());
104
        indentationSize = indentLevelSize(getDocument(), language.mimeType());
101
        formattingContext = new IndenterFormattingContext(getDocument());
105
        formattingContext = new IndenterFormattingContext(getDocument());
102
    }
106
    }
107
    
108
    //copied from org.netbeans.modules.editor.indent.api.IndentUtils as we need
109
    //to pass a second parameter to the CodeStylePreferences.get(doc) method.
110
    private static int indentLevelSize(Document doc, String mimeType) {
111
        Preferences prefs = CodeStylePreferences.get(doc, mimeType).getPreferences();
112
        int indentLevel = prefs.getInt(SimpleValueNames.INDENT_SHIFT_WIDTH, -1);
113
        
114
        if (indentLevel < 0) {
115
            boolean expandTabs = prefs.getBoolean(SimpleValueNames.EXPAND_TABS, true);
116
            if (expandTabs) {
117
                indentLevel = prefs.getInt(SimpleValueNames.SPACES_PER_TAB, 4);
118
            } else {
119
                indentLevel = prefs.getInt(SimpleValueNames.TAB_SIZE, 8);
120
            }
121
        }
122
123
        assert indentLevel >= 0 : "Invalid indentLevelSize " + indentLevel + " for " + doc; //NOI18N
124
        return indentLevel;
125
    }
126
103
127
104
    public final IndenterFormattingContext createFormattingContext() {
128
    public final IndenterFormattingContext createFormattingContext() {
105
        return formattingContext;
129
        return formattingContext;

Return to bug 242649