1 19 20 package org.netbeans.modules.java.guards; 21 22 import java.util.List ; 23 import org.netbeans.api.editor.guards.GuardedSection; 24 import org.netbeans.spi.editor.guards.GuardedEditorSupport; 25 import org.netbeans.spi.editor.guards.support.AbstractGuardedSectionsProvider; 26 27 31 public final class JavaGuardedSectionsProvider extends AbstractGuardedSectionsProvider { 32 33 public JavaGuardedSectionsProvider(GuardedEditorSupport editor) { 34 super(editor); 35 } 36 37 public char[] writeSections(List <GuardedSection> sections, char[] buff) { 38 JavaGuardedWriter writer = new JavaGuardedWriter(); 39 writer.setGuardedSection(sections); 40 return writer.translate(buff); 41 } 42 43 public AbstractGuardedSectionsProvider.Result readSections(char[] buff) { 44 JavaGuardedReader reader = new JavaGuardedReader(this); 45 return new AbstractGuardedSectionsProvider.Result( 46 reader.translateToCharBuff(buff), 47 reader.getGuardedSections() 48 ); 49 } 50 51 52 } 53 | Popular Tags |