diff --git a/plugins/org.python.pydev.ast/src/org/python/pydev/core/templates/AbstractDocumentTemplateContextWithIndent.java b/plugins/org.python.pydev.ast/src/org/python/pydev/core/templates/AbstractDocumentTemplateContextWithIndent.java index 7e1971ede2..cd11a51177 100644 --- a/plugins/org.python.pydev.ast/src/org/python/pydev/core/templates/AbstractDocumentTemplateContextWithIndent.java +++ b/plugins/org.python.pydev.ast/src/org/python/pydev/core/templates/AbstractDocumentTemplateContextWithIndent.java @@ -50,7 +50,7 @@ public TemplateBuffer evaluate(Template template) throws BadLocationException, T String spacesIndentString = StringUtils.createSpaceString(getTabWidth()); //indent to needed level and - //replace any \t for the indentation string + //replace any \t for the indentation string String pattern = template.getPattern(); List splitted = StringUtils.splitInLines(pattern); @@ -94,7 +94,7 @@ public TemplateBuffer evaluate(Template template) throws BadLocationException, T } } - //recreate it (if needed). + //recreate it (if needed). if (changed) { pattern = template.getPattern(); splitted = StringUtils.splitInLines(pattern); diff --git a/plugins/org.python.pydev.ast/src/org/python/pydev/core/templates/PyDocumentTemplateContext.java b/plugins/org.python.pydev.ast/src/org/python/pydev/core/templates/PyDocumentTemplateContext.java index d4a3c9888c..6592df51d0 100644 --- a/plugins/org.python.pydev.ast/src/org/python/pydev/core/templates/PyDocumentTemplateContext.java +++ b/plugins/org.python.pydev.ast/src/org/python/pydev/core/templates/PyDocumentTemplateContext.java @@ -144,10 +144,9 @@ public String getModuleName() { * @return a template context that can handle template insertion at the given location, or null */ public static PyDocumentTemplateContext createContext(final TemplateContextType contextType, - final ISourceViewerForTemplates edit, final IRegion region, String indent) { + final ISourceViewerForTemplates edit, final IRegion region, String indentTo) { if (contextType != null) { IDocument document = edit.getDocument(); - final String indentTo = indent; return new PyDocumentTemplateContext(contextType, document, region.getOffset(), region.getLength(), indentTo, edit); } diff --git a/plugins/org.python.pydev.core/src/org/python/pydev/core/Counter.java b/plugins/org.python.pydev.core/src/org/python/pydev/core/Counter.java new file mode 100644 index 0000000000..1f4c9e7997 --- /dev/null +++ b/plugins/org.python.pydev.core/src/org/python/pydev/core/Counter.java @@ -0,0 +1,30 @@ +package org.python.pydev.core; + +public class Counter { + + private boolean ascending = true; + private int currValue = 0; + + public Counter() { + } + + public Counter(int firstValue) { + this.currValue = firstValue; + } + + public Counter(int firstValue, boolean ascending) { + this.currValue = firstValue; + this.ascending = ascending; + } + + public int next() { + int ret = this.currValue; + if (ascending) { + this.currValue += 1; + } else { + this.currValue -= 1; + } + return ret; + } + +}