/** * Copyright (c) 2005-2012 by Appcelerator, Inc. All Rights Reserved. * Licensed under the terms of the Eclipse Public License (EPL). * Please see the license.txt included with this distribution for details. * Any modifications to this file must keep this entire header intact. */ package org.python.pydev.editor.autoedit; import org.python.pydev.core.ITabChangedListener; /** * Code to be used in tests. */ public class TestIndentPrefs extends AbstractIndentPrefs { private boolean useSpaces; private int tabWidth; public boolean autoPar = true; public boolean autoColon = true; public boolean autoBraces = true; public boolean autoWriteImport = true; public boolean smartIndentAfterPar = true; public boolean autoAddSelf = true; public boolean autoElse; // This is the new mode implementing as pep8: // Indenting right after a parens adds an additional level // Indenting after a variable (after a parens) indents to the parenthesis level // It should be made the default after it's properly tested. public boolean indentToParAsPep8 = false; // Old default always indents to the parenthesis level (and if // False always added a fixed amount of parenthesis as specified // by indentAfterParWidth) public boolean indentToParLevel = true; public int indentAfterParWidth = 1; public boolean autoAddLiterals = true; public boolean autoLink = true; public boolean tabStopInComment = false; public TestIndentPrefs(boolean useSpaces, int tabWidth) { this.useSpaces = useSpaces; this.tabWidth = tabWidth; } @Override public boolean getGuessTabSubstitution() { return false; } @Override public void addTabChangedListener(ITabChangedListener listener) { // No-op for testing. } public TestIndentPrefs(boolean useSpaces, int tabWidth, boolean autoPar) { this(useSpaces, tabWidth, autoPar, true); } public TestIndentPrefs(boolean useSpaces, int tabWidth, boolean autoPar, boolean autoElse) { this(useSpaces, tabWidth); this.autoPar = autoPar; this.autoElse = autoElse; } @Override public boolean getUseSpaces(boolean considerForceTabs) { if (considerForceTabs && getForceTabs()) { return false;//force use tabs } return useSpaces; } @Override public boolean getAutoLink() { return autoLink; } @Override public int getTabWidth() { return tabWidth; } @Override public boolean getAutoParentesis() { return autoPar; } @Override public boolean getAutoColon() { return autoColon; } @Override public boolean getAutoBraces() { return autoBraces; } @Override public boolean getAutoWriteImport() { return autoWriteImport; } @Override public boolean getSmartIndentPar() { return smartIndentAfterPar; } @Override public boolean getAutoAddSelf() { return autoAddSelf; } @Override public boolean getAutoDedentElse() { return autoElse; } @Override public boolean getIndentToParLevel() { return indentToParLevel; } @Override public int getIndentAfterParWidth() { return indentAfterParWidth; } @Override public boolean getSmartLineMove() { return true; } @Override public boolean getAutoLiterals() { return autoAddLiterals; } @Override public boolean getTabStopInComment() { return tabStopInComment; } @Override public void regenerateIndentString() { //ignore it } @Override public boolean getIndentToParAsPep8() { return indentToParAsPep8; } }