public Reformatter(Source source, Context context) { this.source = source; this.context = context; this.doc = context.document(); }
public FortranIndentTask(Context context) { this.context = context; doc = context.document(); }
public FortranReformatter(Context context) { this.context = context; this.doc = context.document(); }
public CppIndentTask(Context context) { this.context = context; doc = context.document(); }
public Reformatter(Context context) { this.context = context; this.doc = context.document(); }
@Override public void modify(final Context context) { assert context != null; context.document().render(new Runnable() { @Override public void run() { modifyUnderWriteLock(context); } }); }
public ReformatTask createTask(Context context) { Source source = Source.forDocument(context.document()); return source != null ? new GsfReformatTask(source, context) : null; } }
public ReformatTask createTask(Context context) { Source source = Source.create(context.document()); return source != null ? new Reformatter(source, context) : null; } }
private int getColumn(Tree tree) throws BadLocationException { int startOffset = getStartPosition(tree); if (startOffset < 0) { return -1; } int lineStartOffset = context.lineStartOffset(startOffset); return getCol(context.document().getText(lineStartOffset, startOffset - lineStartOffset)); }
private void modifyUnderWriteLock(Context context) { try { context.modifyIndent(Utilities.getRowStart((BaseDocument) context.document(), context.caretOffset()), indentation); } catch (BadLocationException ex) { Exceptions.printStackTrace(ex); } }
@Override public void reindent(final Context context) { String mimeType = getMimeTypeAtOffset(context.document(), context.startOffset()); if (FileUtils.PHP_MIME_TYPE.equals(mimeType)) { Indentation indent = new IndentationCounter((BaseDocument) context.document()).count(context.caretOffset()); indent.modify(context); } }
currentEmbeddingLength = -1; newIndents = new HashMap<Integer, Integer>(); cs = CodeStyle.getDefault(context.document()); for (Region region : context.indentRegions()) { if (initRegionData(region)) { if (linesToAddStar.contains(startOffset)) { context.modifyIndent(startOffset, 0); context.document().insertString(startOffset, "* ", null); //NOI18N context.document().remove(startOffset - 1 - len, len);
public void reformat(Context context, ParserResult info) { Document document = context.document(); int startOffset = context.startOffset(); int endOffset = context.endOffset(); if (codeStyle != null) { reindent(context, document, startOffset, endOffset, info, false); } else { RubyFormatter f = new RubyFormatter(CodeStyle.get(document), -1); f.reindent(context, document, startOffset, endOffset, info, false); } }
public void reindent(Context context) { Document document = context.document(); int startOffset = context.startOffset(); int endOffset = context.endOffset(); if (codeStyle != null) { // Make sure we're not reindenting HTML content reindent(context, document, startOffset, endOffset, null, true); } else { RubyFormatter f = new RubyFormatter(CodeStyle.get(document), -1); f.reindent(context, document, startOffset, endOffset, null, true); } }
ts = null; currentEmbeddingStartOffset = 0; currentEmbeddingLength = context.document().getLength(); TokenSequence<?> tseq = TokenHierarchy.get(context.document()).tokenSequence(); while(tseq != null && (region.getStartOffset() == 0 || tseq.moveNext())) { tseq.move(region.getStartOffset()); com.sun.tools.javac.util.Context ctx = javacTask.getContext(); JavaCompiler.instance(ctx).genEndPos = true; text = context.document().getText(currentEmbeddingStartOffset, currentEmbeddingLength); if (JavacParser.MIME_TYPE.equals(context.mimePath())) { cut = javacTask.parse(FileObjects.memoryFileObject("", "", text)).iterator().next(); //NOI18N
private void reindent(final Context context, ParserResult info, final boolean indentOnly) { Document document = context.document(); final int endOffset = Math.min(context.endOffset(), document.getLength());
public void reindent() throws BadLocationException { //Formatter f = getFormatter(); Formatter f = null; BaseDocument baseDoc = (BaseDocument)context.document(); List<Language> list = LanguageRegistry.getInstance().getEmbeddedLanguages(baseDoc, context.startOffset()); if (context.endOffset()-context.startOffset() < 4) { // for line reindents etc. for (Language l : list) { if (l.getFormatter() != null) { f = l.getFormatter(); break; } } } if (f == null) { f = getFormatter(); } if (f != null) { f.reindent(context); } }
currentIndent = newIndent != null ? newIndent : context.lineIndent(lineStartOffset); } else if (align) { currentIndent = getCol(context.document().getText(lineStartOffset, startOffset - lineStartOffset)); } else { currentIndent = addContinuationIndent ? getContinuationIndent(path, currentIndent) : currentIndent + cs.getIndentSize();
public void reindent () throws BadLocationException { StyledDocument document = (StyledDocument) context.document (); try { MimePath mimePath = MimePath.parse (context.mimePath ());
public void reindent() throws BadLocationException { BaseDocument doc = (BaseDocument) context.document(); int start = context.startOffset(); int end = Math.min(context.endOffset(), doc.getLength());