/*
* @see org.epic.core.util.ScriptExecutor#getCommandLineOpts(java.util.List)
*/
protected List getCommandLineOpts(List additionalOptions)
{
IPreferenceStore store = new ChainedPreferenceStore(new IPreferenceStore[] {
EditorsUI.getPreferenceStore(),
PerlEditorPlugin.getDefault().getPreferenceStore() });
int numSpaces = store.getInt(PreferenceConstants.INSERT_TABS_ON_INDENT);
boolean useSpaces = store.getBoolean(PreferenceConstants.SPACES_INSTEAD_OF_TABS);
int tabWidth = useSpaces ? numSpaces : store.getInt(PreferenceConstants.EDITOR_TAB_WIDTH);
int pageSize = store.getInt(PreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN);
boolean cuddleElse = store.getBoolean(SourceFormatterPreferences.CUDDLED_ELSE);
boolean bracesLeft = store.getBoolean(SourceFormatterPreferences.BRACES_LEFT);
boolean lineUpParentheses =
store.getBoolean(SourceFormatterPreferences.LINE_UP_WITH_PARENTHESES);
boolean swallowOptionalBlankLines =
store.getBoolean(SourceFormatterPreferences.SWALLOW_OPTIONAL_BLANK_LINES);
// int containerTightnessBraces =
// store.getInt(SourceFormatterPreferences.CONTAINER_TIGHTNESS_BRACES);
// int containerTightnessParentheses =
// store.getInt(SourceFormatterPreferences.CONTAINER_TIGHTNESS_PARENTHESES);
// int containerTightnessSquareBrackets =
// store.getInt(SourceFormatterPreferences.CONTAINER_TIGHTNESS_SQUARE_BRACKETS);
List args = new ArrayList();
// args.add("perltidy");
args.add("-q");
args.add("--indent-columns=" + tabWidth);
args.add("--maximum-line-length=" + pageSize);
// cmdList.add("--brace-tightness=" + containerTightnessBraces);
// cmdList.add("--paren-tightness=" + containerTightnessParentheses);
// cmdList.add("--square-bracket-tightness=" + containerTightnessSquareBrackets);
if (!useSpaces)
{
args.add("--entab-leading-whitespace=" + tabWidth);
}
if (cuddleElse)
{
args.add("--cuddled-else");
}
if (bracesLeft)
{
args.add("--opening-brace-on-new-line");
}
if (lineUpParentheses)
{
args.add("--line-up-parentheses");
}
if (swallowOptionalBlankLines)
{
args.add("--swallow-optional-blank-lines");
}
// Read additional options
args.addAll(CommandLineTokenizer.tokenize(
store.getString(SourceFormatterPreferences.PERLTIDY_OPTIONS)));
// Add additionally passed options
if (additionalOptions != null)
{
args.addAll(additionalOptions);