/*******************************************************************************
* Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
-import net.sourceforge.phpdt.core.JavaCore;
import net.sourceforge.phpdt.internal.corext.util.CodeFormatterUtil;
import net.sourceforge.phpdt.internal.corext.util.Strings;
-import net.sourceforge.phpdt.internal.formatter.CodeFormatter;
import net.sourceforge.phpdt.internal.ui.text.IPHPPartitions;
import net.sourceforge.phpdt.internal.ui.text.JavaHeuristicScanner;
import net.sourceforge.phpdt.internal.ui.text.JavaIndenter;
/**
* Creates a JavaFormatter with the target line delimiter.
- *
+ *
* @param lineDelimiter
* the line delimiter to use
* @param initialIndentLevel
/**
* Formats the template buffer.
- *
+ *
* @param buffer
* @param context
* @throws BadLocationException
return partitionType != null
&& (partitionType.equals(IPHPPartitions.PHP_MULTILINE_COMMENT)
|| partitionType.equals(IPHPPartitions.PHP_SINGLELINE_COMMENT) || partitionType.equals(IPHPPartitions.PHP_STRING_DQ)
- || partitionType.equals(IPHPPartitions.PHP_STRING_SQ) || partitionType.equals(IPHPPartitions.PHP_PHPDOC_COMMENT));
+ || partitionType.equals(IPHPPartitions.PHP_STRING_SQ) || partitionType.equals(IPHPPartitions.PHP_STRING_HEREDOC) || partitionType.equals(IPHPPartitions.PHP_PHPDOC_COMMENT));
} catch (BadLocationException e) {
return false;
}
// private void plainFormat(TemplateBuffer templateBuffer, JavaContext context) throws BadLocationException {
- //
+ //
// IDocument doc= new Document(templateBuffer.getString());
- //
+ //
// TemplateVariable[] variables= templateBuffer.getVariables();
- //
+ //
// List offsets= variablesToPositions(variables);
- //
+ //
// Map options;
// if (context.getCompilationUnit() != null)
// options= context.getCompilationUnit().getJavaProject().getOptions(true);
// else
// options= JavaCore.getOptions();
- //
+ //
// TextEdit edit= CodeFormatterUtil.format2(CodeFormatter.K_UNKNOWN, doc.get(), fInitialIndentLevel, fLineDelimiter, options);
// if (edit == null)
// throw new BadLocationException(); // fall back to indenting
- //
+ //
// MultiTextEdit root;
// if (edit instanceof MultiTextEdit)
// root= (MultiTextEdit) edit;
// // ignore this position
// }
// }
- //
+ //
// root.apply(doc, TextEdit.UPDATE_REGIONS);
- //
+ //
// positionsToVariables(offsets, variables);
- //
+ //
// templateBuffer.setContent(doc.get(), variables);
// }
/**
* Changes the delimiter to the configured line delimiter.
- *
+ *
* @param document
* the temporary document being edited
* @param root