From: axelcl Date: Sun, 9 Oct 2005 12:42:31 +0000 (+0000) Subject: Prepared better HEREDOC support; see comment for bug #1319276 X-Git-Url: http://git.phpeclipse.com Prepared better HEREDOC support; see comment for bug #1319276 --- diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/JavaFormatter.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/JavaFormatter.java index 936cf14..3b5456f 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/JavaFormatter.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/JavaFormatter.java @@ -1,10 +1,10 @@ /******************************************************************************* * 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 *******************************************************************************/ @@ -57,7 +57,7 @@ public class JavaFormatter { /** * Creates a JavaFormatter with the target line delimiter. - * + * * @param lineDelimiter * the line delimiter to use * @param initialIndentLevel @@ -73,7 +73,7 @@ public class JavaFormatter { /** * Formats the template buffer. - * + * * @param buffer * @param context * @throws BadLocationException @@ -130,7 +130,7 @@ public class JavaFormatter { 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; @@ -176,23 +176,23 @@ public class JavaFormatter { } // 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; @@ -209,11 +209,11 @@ public class JavaFormatter { // // ignore this position // } // } - // + // // root.apply(doc, TextEdit.UPDATE_REGIONS); - // + // // positionsToVariables(offsets, variables); - // + // // templateBuffer.setContent(doc.get(), variables); // } @@ -270,7 +270,7 @@ public class JavaFormatter { /** * Changes the delimiter to the configured line delimiter. - * + * * @param document * the temporary document being edited * @param root diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/actions/AddBlockCommentAction.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/actions/AddBlockCommentAction.java index 500644f..9977be9 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/actions/AddBlockCommentAction.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/actions/AddBlockCommentAction.java @@ -1,10 +1,10 @@ /******************************************************************************* * 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 *******************************************************************************/ @@ -29,14 +29,14 @@ import org.eclipse.ui.texteditor.ITextEditor; /** * Action that encloses the editor's current selection with Java block comment terminators (/* and * */). - * + * * @since 3.0 - */ + */ public class AddBlockCommentAction extends BlockCommentAction { /** * Creates a new instance. - * + * * @param bundle * the resource bundle * @param prefix @@ -73,7 +73,7 @@ public class AddBlockCommentAction extends BlockCommentAction { /** * Handle the first partition of the selected text. - * + * * @param partition * @param edits * @param factory @@ -101,7 +101,7 @@ public class AddBlockCommentAction extends BlockCommentAction { /** * Handles the end of the given partition and the start of the next partition, which is returned. - * + * * @param partition * @param edits * @param factory @@ -139,7 +139,7 @@ public class AddBlockCommentAction extends BlockCommentAction { if (wasJavadoc) { // if previous was javadoc, and the current one is not, then add block comment start - if (partType == IDocument.DEFAULT_CONTENT_TYPE || + if (partType == IDocument.DEFAULT_CONTENT_TYPE || partType == PHPDocumentPartitioner.PHP_SCRIPT_CODE || isSpecialPartition(partType)) { edits.add(factory.createEdit(partition.getOffset(), 0, getCommentStart())); @@ -161,7 +161,7 @@ public class AddBlockCommentAction extends BlockCommentAction { /** * Handles the end of the last partition. - * + * * @param partition * @param edits * @param factory @@ -186,14 +186,14 @@ public class AddBlockCommentAction extends BlockCommentAction { /** * Returns whether partType is special, i.e. a Java String,Character, or * Line End Comment partition. - * + * * @param partType * the partition type to check * @return true if partType is special, false otherwise */ private boolean isSpecialPartition(String partType) { // return partType == IJavaPartitions.JAVA_CHARACTER - return partType == IPHPPartitions.PHP_STRING_DQ || partType == IPHPPartitions.PHP_STRING_SQ + return partType == IPHPPartitions.PHP_STRING_DQ || partType == IPHPPartitions.PHP_STRING_SQ || partType == IPHPPartitions.PHP_STRING_HEREDOC || partType == IPHPPartitions.PHP_SINGLELINE_COMMENT; } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/TemplateEditorSourceViewerConfiguration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/TemplateEditorSourceViewerConfiguration.java index 129292b..7b94aa7 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/TemplateEditorSourceViewerConfiguration.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/TemplateEditorSourceViewerConfiguration.java @@ -1,10 +1,10 @@ /******************************************************************************* * 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 *******************************************************************************/ @@ -70,7 +70,7 @@ public class TemplateEditorSourceViewerConfiguration extends PHPSourceViewerConf } } } - } + } } catch (BadLocationException e) { } return null; @@ -83,18 +83,18 @@ public class TemplateEditorSourceViewerConfiguration extends PHPSourceViewerConf if (textViewer != null) { return JavaWordFinder.findWord(textViewer.getDocument(), offset); } - return null; + return null; } - - } - + + } + private final TemplateVariableProcessor fProcessor; public TemplateEditorSourceViewerConfiguration(IColorManager colorManager, IPreferenceStore store, ITextEditor editor, TemplateVariableProcessor processor) { super(colorManager, store, editor, IPHPPartitions.PHP_PARTITIONING); fProcessor= processor; } - + /* * @see SourceViewerConfiguration#getContentAssistant(ISourceViewer) */ @@ -102,14 +102,15 @@ public class TemplateEditorSourceViewerConfiguration extends PHPSourceViewerConf IPreferenceStore store= PHPeclipsePlugin.getDefault().getPreferenceStore(); JavaTextTools textTools= PHPeclipsePlugin.getDefault().getJavaTextTools(); - IColorManager manager= textTools.getColorManager(); - + IColorManager manager= textTools.getColorManager(); + ContentAssistant assistant= new ContentAssistant(); assistant.setContentAssistProcessor(fProcessor, IDocument.DEFAULT_CONTENT_TYPE); // Register the same processor for strings and single line comments to get code completion at the start of those partitions. assistant.setContentAssistProcessor(fProcessor, IPHPPartitions.PHP_STRING_DQ); assistant.setContentAssistProcessor(fProcessor, IPHPPartitions.PHP_STRING_SQ); + assistant.setContentAssistProcessor(fProcessor, IPHPPartitions.PHP_STRING_HEREDOC); assistant.setContentAssistProcessor(fProcessor, IPHPPartitions.PHP_SINGLELINE_COMMENT); assistant.setContentAssistProcessor(fProcessor, IPHPPartitions.PHP_MULTILINE_COMMENT); assistant.setContentAssistProcessor(fProcessor, IPHPPartitions.PHP_PHPDOC_COMMENT); @@ -121,7 +122,7 @@ public class TemplateEditorSourceViewerConfiguration extends PHPSourceViewerConf assistant.setContextInformationPopupOrientation(ContentAssistant.CONTEXT_INFO_ABOVE); assistant.setInformationControlCreator(getInformationControlCreator(sourceViewer)); - Color background= getColor(store, PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND, manager); + Color background= getColor(store, PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND, manager); assistant.setContextInformationPopupBackground(background); assistant.setContextSelectorBackground(background); assistant.setProposalSelectorBackground(background); @@ -130,15 +131,15 @@ public class TemplateEditorSourceViewerConfiguration extends PHPSourceViewerConf assistant.setContextInformationPopupForeground(foreground); assistant.setContextSelectorForeground(foreground); assistant.setProposalSelectorForeground(foreground); - + return assistant; - } + } private Color getColor(IPreferenceStore store, String key, IColorManager manager) { RGB rgb= PreferenceConverter.getColor(store, key); return manager.getColor(rgb); } - + /* * @see SourceViewerConfiguration#getTextHover(ISourceViewer, String, int) * @since 2.1 diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/IPHPPartitions.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/IPHPPartitions.java index 8ba709a..82fd098 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/IPHPPartitions.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/IPHPPartitions.java @@ -11,24 +11,25 @@ package net.sourceforge.phpdt.internal.ui.text; public interface IPHPPartitions { public final static String PHP_PARTITIONING = "___php_partitioning"; //$NON-NLS-1$ - + public final static String PHP_PHPDOC_COMMENT = "__php_phpdoc_comment"; //$NON-NLS-1$ public final static String PHP_SINGLELINE_COMMENT = "__php_singleline_comment"; //$NON-NLS-1$ public final static String PHP_MULTILINE_COMMENT = "__php_multiline_comment"; //$NON-NLS-1$ public final static String PHP_STRING_DQ = "__php_string"; //$NON-NLS-1$ public final static String PHP_STRING_SQ = "__php_string_sq"; //$NON-NLS-1$ + public final static String PHP_STRING_HEREDOC = "__php_string_heredoc"; //$NON-NLS-1$ public final static String JAVASCRIPT = "__javascript"; //$NON-NLS-1$ public final static String JS_MULTILINE_COMMENT = "__js_multiline_comment"; //$NON-NLS-1$ public final static String CSS = "__css"; //$NON-NLS-1$ public final static String CSS_MULTILINE_COMMENT = "__css_multiline_comment"; //$NON-NLS-1$ public final static String HTML = "__html"; //$NON-NLS-1$ public final static String HTML_MULTILINE_COMMENT = "__html_multiline_comment"; //$NON-NLS-1$ - + public final static String SMARTY = "__smarty"; //$NON-NLS-1$ public final static String SMARTY_MULTILINE_COMMENT = "__smarty_multiline_comment"; //$NON-NLS-1$ - - public final static int PHP_FILE = 1; - public final static int HTML_FILE = 2; - public final static int XML_FILE = 3; - public final static int SMARTY_FILE = 4; + + public final static int PHP_FILE = 1; + public final static int HTML_FILE = 2; + public final static int XML_FILE = 3; + public final static int SMARTY_FILE = 4; } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/SmartSemicolonAutoEditStrategy.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/SmartSemicolonAutoEditStrategy.java index 7b8e3d3..5dfea87 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/SmartSemicolonAutoEditStrategy.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/SmartSemicolonAutoEditStrategy.java @@ -1,10 +1,10 @@ /******************************************************************************* * 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 *******************************************************************************/ @@ -42,11 +42,11 @@ import org.eclipse.ui.texteditor.ITextEditorExtension3; /** * Modifies DocumentCommands inserting semicolons and opening braces to place them * smartly, i.e. moving them to the end of a line if that is what the user expects. - * + * *

In practice, semicolons and braces (and the caret) are moved to the end of the line if they are typed * anywhere except for semicolons in a for statements definition. If the line contains a semicolon * or brace after the current caret position, the cursor is moved after it.

- * + * * @see org.eclipse.jface.text.DocumentCommand * @since 3.0 */ @@ -66,7 +66,7 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { /** * Creates a new SmartSemicolonAutoEditStrategy. - * + * * @param partitioning the document partitioning */ public SmartSemicolonAutoEditStrategy(String partitioning) { @@ -97,7 +97,7 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { return; if (fCharacter == BRACECHAR && !store.getBoolean(PreferenceConstants.EDITOR_SMART_OPENING_BRACE)) return; - + IWorkbenchPage page= PHPeclipsePlugin.getActivePage(); if (page == null) return; @@ -132,17 +132,17 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { if (position < pos) return; - // never double already existing content + // never double already existing content if (alreadyPresent(document, fCharacter, position)) return; - + // don't do special processing if what we do is actually the normal behaviour String insertion= adjustSpacing(document, position, fCharacter); if (command.offset == position && insertion.equals(command.text)) return; try { - + final SmartBackspaceManager manager= (SmartBackspaceManager) editor.getAdapter(SmartBackspaceManager.class); if (manager != null && PHPeclipsePlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_SMART_BACKSPACE)) { TextEdit e1= new ReplaceEdit(command.offset, command.text.length(), document.get(command.offset, command.length)); @@ -161,7 +161,7 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { s1); manager.register(s2); } - + // 3: modify command command.offset= position; command.length= 0; @@ -175,13 +175,13 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { PHPeclipsePlugin.log(e); } - + } /** * Returns true if the document command is applied on a multi * line selection, false otherwise. - * + * * @param document the document * @param command the command * @return true if command is a multiline command @@ -197,8 +197,8 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { /** * Adds a space before a brace if it is inserted after a parenthesis, equal sign, or one - * of the keywords try, else, do. - * + * of the keywords try, else, do. + * * @param document the document we are working on * @param position the insert position of character * @param character the character to be inserted @@ -227,7 +227,7 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { /** * Checks whether a character to be inserted is already present at the insert location (perhaps * separated by some whitespace from position. - * + * * @param document the document we are working on * @param position the insert position of ch * @param character the character to be inserted @@ -246,7 +246,7 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { /** * Computes the next insert position of the given character in the current line. - * + * * @param document the document we are working on * @param line the line where the change is being made * @param offset the position of the caret in the line when character was typed @@ -283,7 +283,7 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { if (insertPos > 0 && text.charAt(insertPos - 1) == character) insertPos= insertPos - 1; } - + } else { Assert.isTrue(false); return -1; @@ -295,7 +295,7 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { /** * Computes an insert position for an opening brace if offset maps to a position in * document that looks like being the RHS of an assignment or like an array definition. - * + * * @param document the document being modified * @param line the current line under investigation * @param offset the offset of the caret position, relative to the line start. @@ -308,29 +308,29 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { if (pos == 0) return -1; - + int p= firstNonWhitespaceBackward(document, pos - 1, partitioning, -1); - + if (p == -1) return -1; - + try { - + char ch= document.getChar(p); if (ch != '=' && ch != ']') return -1; - + if (p == 0) return offset; - + p= firstNonWhitespaceBackward(document, p - 1, partitioning, -1); if (p == -1) return -1; - + ch= document.getChar(p); if (Scanner.isPHPIdentifierPart(ch) || ch == ']' || ch == '[') return offset; - + } catch (BadLocationException e) { } return -1; @@ -338,9 +338,9 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { /** * Computes an insert position for an opening brace if offset maps to a position in - * document involving a keyword taking a block after it. These are: try, + * document involving a keyword taking a block after it. These are: try, * do, synchronized, static, finally, or else. - * + * * @param document the document being modified * @param line the current line under investigation * @param offset the offset of the caret position, relative to the line start. @@ -368,7 +368,7 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { /** * Computes an insert position for an opening brace if offset maps to a position in * document with a expression in parenthesis that will take a block after the closing parenthesis. - * + * * @param document the document being modified * @param line the current line under investigation * @param offset the offset of the caret position, relative to the line start. @@ -384,7 +384,7 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { int scanTo= scanForward(document, pos, partitioning, length, '}'); if (scanTo == -1) scanTo= length; - + int closingParen= findClosingParenToLeft(document, pos, partitioning) - 1; while (true) { @@ -420,7 +420,7 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { /** * Finds a closing parenthesis to the left of position in document, where that parenthesis is only * separated by whitespace from position. If no such parenthesis can be found, position is returned. - * + * * @param document the document being modified * @param position the first character position in document to be considered * @param partitioning the document partitioning @@ -442,7 +442,7 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { /** * Finds the first whitespace character position to the right of (and including) position. - * + * * @param document the document being modified * @param position the first character position in document to be considered * @return the position of a whitespace character greater or equal than position separated only by whitespace, or -1 if none found @@ -468,8 +468,8 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { /** * Finds the highest position in document such that the position is <= position * and > bound and Character.isWhitespace(document.getChar(pos)) evaluates to false - * and the position is in the default partition. - * + * and the position is in the default partition. + * * @param document the document being modified * @param position the first character position in document to be considered * @param partitioning the document partitioning @@ -495,8 +495,8 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { /** * Finds the smallest position in document such that the position is >= position * and < bound and Character.isWhitespace(document.getChar(pos)) evaluates to false - * and the position is in the default partition. - * + * and the position is in the default partition. + * * @param document the document being modified * @param position the first character position in document to be considered * @param partitioning the document partitioning @@ -522,8 +522,8 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { /** * Finds the highest position in document such that the position is <= position * and > bound and document.getChar(position) == ch evaluates to true for at least one - * ch in chars and the position is in the default partition. - * + * ch in chars and the position is in the default partition. + * * @param document the document being modified * @param position the first character position in document to be considered * @param partitioning the document partitioning @@ -534,9 +534,9 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { private static int scanBackward(IDocument document, int position, String partitioning, int bound, char[] chars) { Assert.isTrue(bound >= -1); Assert.isTrue(position < document.getLength() ); - + Arrays.sort(chars); - + try { while (position > bound) { @@ -553,8 +553,8 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { // /** // * Finds the highest position in document such that the position is <= position // * and > bound and document.getChar(position) == ch evaluates to true -// * and the position is in the default partition. -// * +// * and the position is in the default partition. +// * // * @param document the document being modified // * @param position the first character position in document to be considered // * @param bound the first position in document to not consider any more, with scanTo > position @@ -568,8 +568,8 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { /** * Finds the lowest position in document such that the position is >= position * and < bound and document.getChar(position) == ch evaluates to true for at least one - * ch in chars and the position is in the default partition. - * + * ch in chars and the position is in the default partition. + * * @param document the document being modified * @param position the first character position in document to be considered * @param partitioning the document partitioning @@ -580,9 +580,9 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { private static int scanForward(IDocument document, int position, String partitioning, int bound, char[] chars) { Assert.isTrue(position >= 0); Assert.isTrue(bound <= document.getLength()); - + Arrays.sort(chars); - + try { while (position < bound) { @@ -599,8 +599,8 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { /** * Finds the lowest position in document such that the position is >= position * and < bound and document.getChar(position) == ch evaluates to true - * and the position is in the default partition. - * + * and the position is in the default partition. + * * @param document the document being modified * @param position the first character position in document to be considered * @param partitioning the document partitioning @@ -615,7 +615,7 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { /** * Checks whether the content of document in the range (offset, length) * contains the new keyword. - * + * * @param document the document being modified * @param offset the first character position in document to be considered * @param length the length of the character range to be considered @@ -630,7 +630,7 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { try { String text= document.get(offset, length); int pos= text.indexOf("new"); //$NON-NLS-1$ - + while (pos != -1 && !isDefaultPartition(document, pos + offset, partitioning)) pos= text.indexOf("new", pos + 2); //$NON-NLS-1$ @@ -642,7 +642,7 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { if (pos + 3 < length && Scanner.isPHPIdentifierPart(text.charAt(pos + 3))) return false; - + return true; } catch (BadLocationException e) { @@ -654,7 +654,7 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { * Checks whether the content of document at position looks like an * anonymous class definition. position must be to the left of the opening * parenthesis of the definition's parameter list. - * + * * @param document the document being modified * @param position the first character position in document to be considered * @param partitioning the document partitioning @@ -673,7 +673,7 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { /** * Checks whether position resides in a default (Java) partition of document. - * + * * @param document the document being modified * @param position the position to be checked * @param partitioning the document partitioning @@ -682,21 +682,21 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { private static boolean isDefaultPartition(IDocument document, int position, String partitioning) { Assert.isTrue(position >= 0); Assert.isTrue(position <= document.getLength()); - + try { // don't use getPartition2 since we're interested in the scanned character's partition ITypedRegion region= TextUtilities.getPartition(document, partitioning, position, false); return region.getType().equals(IDocument.DEFAULT_CONTENT_TYPE); - + } catch (BadLocationException e) { } - + return false; } /** * Finds the position of the parenthesis matching the closing parenthesis at position. - * + * * @param document the document being modified * @param position the position in document of a closing parenthesis * @param partitioning the document partitioning @@ -713,18 +713,18 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { try { Assert.isTrue(document.getChar(position) == CLOSING_PAREN); - + int depth= 1; while (true) { position= scanBackward(document, position - 1, partitioning, -1, new char[] {CLOSING_PAREN, OPENING_PAREN}); if (position == -1) return -1; - + if (document.getChar(position) == CLOSING_PAREN) depth++; else depth--; - + if (depth == 0) return position; } @@ -735,10 +735,10 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { } /** - * Checks whether, to the left of position and separated only by whitespace, + * Checks whether, to the left of position and separated only by whitespace, * document contains a keyword taking a parameter list and a block after it. - * These are: if, while, catch, for, synchronized, switch. - * + * These are: if, while, catch, for, synchronized, switch. + * * @param document the document being modified * @param position the first character position in document to be considered * @param partitioning the document partitioning @@ -758,12 +758,12 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { } /** - * Checks whether code>document contains the String like such + * Checks whether code>document contains the String like such * that its last character is at position. If like starts with a * identifier part (as determined by {@link Scanner#isPHPIdentifierPart(char)}), it is also made * sure that like is preceded by some non-identifier character or stands at the * document start. - * + * * @param document the document being modified * @param position the first character position in document to be considered * @param like the String to look for. @@ -792,23 +792,23 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { * Checks whether the content of document at position looks like a * method declaration header (i.e. only the return type and method name). position * must be just left of the opening parenthesis of the parameter list. - * + * * @param document the document being modified * @param position the first character position in document to be considered * @param partitioning the document partitioning * @return true if the content of document looks like a method definition, false otherwise */ private static boolean looksLikeMethodDecl(IDocument document, int position, String partitioning) { - + // method name position= eatIdentToLeft(document, position, partitioning); if (position < 1) return false; - + position= eatBrackets(document, position - 1, partitioning); if (position < 1) return false; - + position= eatIdentToLeft(document, position - 1, partitioning); return position != -1; @@ -817,9 +817,9 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { /** * From position to the left, eats any whitespace and then a pair of brackets * as used to declare an array return type like
String [ ]
. - * The return value is either the position of the opening bracket or position if no - * pair of brackets can be parsed. - * + * The return value is either the position of the opening bracket or position if no + * pair of brackets can be parsed. + * * @param document the document being modified * @param position the first character position in document to be considered * @param partitioning the document partitioning @@ -841,12 +841,12 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { } /** - * From position to the left, eats any whitespace and the first identifier, returning + * From position to the left, eats any whitespace and the first identifier, returning * the position of the first identifier character (in normal read order). *

When called on a document with content " some string " and positionition 13, the * return value will be 6 (the first letter in string). *

- * + * * @param document the document being modified * @param position the first character position in document to be considered * @param partitioning the document partitioning @@ -856,7 +856,7 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { if (position < 0) return -1; Assert.isTrue(position < document.getLength()); - + int p= firstNonWhitespaceBackward(document, position, partitioning, -1); if (p == -1) return -1; @@ -889,7 +889,7 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { /** * Returns a position in the first java partition after the last non-empty and non-comment partition. * There is no non-whitespace from the returned position to the end of the partition it is contained in. - * + * * @param document the document being modified * @param line the line under investigation * @param offset the caret offset into line @@ -926,11 +926,11 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { /** * Returns a valid insert location (except for whitespace) in partition or -1 if - * there is no valid insert location. + * there is no valid insert location. * An valid insert location is right after any java string or character partition, or at the end - * of a java default partition, but never behind maxOffset. Comment partitions or + * of a java default partition, but never behind maxOffset. Comment partitions or * empty java partitions do never yield valid insert positions. - * + * * @param doc the document being modified * @param partition the current partition * @param maxOffset the maximum offset to consider @@ -954,6 +954,8 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { return endOffset; if (IPHPPartitions.PHP_STRING_SQ.equals(partition.getType())) return endOffset; + if (IPHPPartitions.PHP_STRING_HEREDOC.equals(partition.getType())) + return endOffset; if (IDocument.DEFAULT_CONTENT_TYPE.equals(partition.getType())) { try { if (doc.get(partition.getOffset(), endOffset - partition.getOffset()).trim().length() == 0) @@ -964,7 +966,7 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { return INVALID; } } - // default: we don't know anything about the partition - assume valid + // default: we don't know anything about the partition - assume valid return endOffset; } @@ -972,7 +974,7 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { * Determines whether the current line contains a for statement. * Algorithm: any "for" word in the line is a positive, "for" contained in a string literal will * produce a false positive. - * + * * @param line the line where the change is being made * @param offset the position of the caret * @return true if line contains for, false otherwise @@ -988,9 +990,9 @@ public class SmartSemicolonAutoEditStrategy implements IAutoEditStrategy { } /** - * Returns the position in text after which there comes only whitespace, up to + * Returns the position in text after which there comes only whitespace, up to * offset. - * + * * @param text the text being searched * @param offset the maximum offset to search for * @return the smallest value v such that text.substring(v, offset).trim() == 0 diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/JavaTextTools.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/JavaTextTools.java index acb7427..e9edc5e 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/JavaTextTools.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/JavaTextTools.java @@ -54,15 +54,16 @@ public class JavaTextTools implements IPHPPartitions { PHP_MULTILINE_COMMENT, PHP_SINGLELINE_COMMENT, PHP_STRING_DQ, - PHP_STRING_SQ }; + PHP_STRING_SQ, + PHP_STRING_HEREDOC}; - private static XMLPartitionScanner HTML_PARTITION_SCANNER = null; +// private static XMLPartitionScanner HTML_PARTITION_SCANNER = null; - private static FastJavaPartitionScanner PHP_PARTITION_SCANNER = null; +// private static FastJavaPartitionScanner PHP_PARTITION_SCANNER = null; private static HTMLPartitionScanner SMARTY_PARTITION_SCANNER = null; - private static XMLPartitionScanner XML_PARTITION_SCANNER = null; +// private static XMLPartitionScanner XML_PARTITION_SCANNER = null; // private final static String[] TYPES= new String[] { PHPPartitionScanner.PHP, PHPPartitionScanner.JAVA_DOC, // PHPPartitionScanner.JAVA_MULTILINE_COMMENT }; @@ -107,7 +108,7 @@ public class JavaTextTools implements IPHPPartitions { /** The PHP single quoted string scanner */ // private SingleTokenPHPScanner fStringSQScanner; - + /** The PHPDoc scanner */ private PHPDocCodeScanner fPHPDocScanner; @@ -130,7 +131,7 @@ public class JavaTextTools implements IPHPPartitions { /** * The core preference store. - * + * * @since 2.1 */ private Preferences fCorePreferenceStore; @@ -149,7 +150,7 @@ public class JavaTextTools implements IPHPPartitions { // private RuleBasedScanner jspBracketScanner; /** * Creates a new Java text tools collection. - * + * * @param store * the preference store to initialize the text tools. The text tool instance installs a listener on the passed preference * store to adapt itself to changes in the preference store. In general PreferenceConstants. @@ -167,7 +168,7 @@ public class JavaTextTools implements IPHPPartitions { /** * Creates a new Java text tools collection. - * + * * @param store * the preference store to initialize the text tools. The text tool instance installs a listener on the passed preference * store to adapt itself to changes in the preference store. In general PreferenceConstants. @@ -202,7 +203,7 @@ public class JavaTextTools implements IPHPPartitions { IPreferenceConstants.PHP_SINGLELINE_COMMENT); // fStringDQScanner = new SingleTokenPHPScanner((JavaColorManager) colorManager, store, IPreferenceConstants.PHP_STRING); // fStringSQScanner = new SingleTokenPHPScanner((JavaColorManager) colorManager, store, IPreferenceConstants.PHP_STRING); - + fPHPDocScanner = new PHPDocCodeScanner((JavaColorManager) colorManager, store); // fHTMLScanner = new HTMLCodeScanner((JavaColorManager)fColorManager, store); fSmartyScanner = new SmartyCodeScanner((JavaColorManager) colorManager, store); @@ -221,7 +222,7 @@ public class JavaTextTools implements IPHPPartitions { } /** - * + * */ public XMLTextTools getXMLTextTools() { return xmlTextTools; @@ -260,7 +261,7 @@ public class JavaTextTools implements IPHPPartitions { /** * Returns the color manager which is used to manage any Java-specific colors needed for such things like syntax highlighting. - * + * * @return the color manager to be used for Java text viewers */ public JavaColorManager getColorManager() { @@ -269,7 +270,7 @@ public class JavaTextTools implements IPHPPartitions { /** * Returns a scanner which is configured to scan Java source code. - * + * * @return a Java source code scanner */ public RuleBasedScanner getCodeScanner() { @@ -278,9 +279,9 @@ public class JavaTextTools implements IPHPPartitions { /** * Returns a scanner which is configured to scan Java multiline comments. - * + * * @return a Java multiline comment scanner - * + * * @since 2.0 */ public RuleBasedScanner getMultilineCommentScanner() { @@ -289,9 +290,9 @@ public class JavaTextTools implements IPHPPartitions { /** * Returns a scanner which is configured to scan HTML code. - * + * * @return a HTML scanner - * + * * @since 2.0 */ // public RuleBasedScanner getHTMLScanner() { @@ -299,9 +300,9 @@ public class JavaTextTools implements IPHPPartitions { // } /** * Returns a scanner which is configured to scan Smarty code. - * + * * @return a Smarty scanner - * + * * @since 2.0 */ public RuleBasedScanner getSmartyScanner() { @@ -310,9 +311,9 @@ public class JavaTextTools implements IPHPPartitions { /** * Returns a scanner which is configured to scan Smarty code. - * + * * @return a Smarty scanner - * + * * @since 2.0 */ public RuleBasedScanner getSmartyDocScanner() { @@ -321,9 +322,9 @@ public class JavaTextTools implements IPHPPartitions { /** * Returns a scanner which is configured to scan Java singleline comments. - * + * * @return a Java singleline comment scanner - * + * * @since 2.0 */ public RuleBasedScanner getSinglelineCommentScanner() { @@ -332,9 +333,9 @@ public class JavaTextTools implements IPHPPartitions { /** * Returns a scanner which is configured to scan Java strings. - * + * * @return a Java string scanner - * + * * @since 2.0 */ // public RuleBasedScanner getStringScanner() { @@ -344,7 +345,7 @@ public class JavaTextTools implements IPHPPartitions { /** * Returns a scanner which is configured to scan JavaDoc compliant comments. Notes that the start sequence "/**" and the * corresponding end sequence are part of the JavaDoc comment. - * + * * @return a JavaDoc scanner */ public RuleBasedScanner getJavaDocScanner() { @@ -354,7 +355,7 @@ public class JavaTextTools implements IPHPPartitions { /** * Returns a scanner which is configured to scan Java-specific partitions, which are multi-line comments, JavaDoc comments, and * regular Java source code. - * + * * @return a Java partition scanner */ // public IPartitionTokenScanner getPartitionScanner() { @@ -363,7 +364,7 @@ public class JavaTextTools implements IPHPPartitions { /** * Factory method for creating a PHP-specific document partitioner using this object's partitions scanner. This method is a * convenience method. - * + * * @return a newly created Java document partitioner */ public IDocumentPartitioner createDocumentPartitioner() { @@ -373,7 +374,7 @@ public class JavaTextTools implements IPHPPartitions { /** * Factory method for creating a PHP-specific document partitioner using this object's partitions scanner. This method is a * convenience method. - * + * * @return a newly created Java document partitioner */ public IDocumentPartitioner createDocumentPartitioner(String extension) { @@ -418,14 +419,14 @@ public class JavaTextTools implements IPHPPartitions { /** * Sets up the Java document partitioner for the given document for the given partitioning. - * + * * @param document * the document to be set up * @param partitioning * the document partitioning * @param element * TODO - * + * * @since 3.0 */ // public void setupJavaDocumentPartitioner(IDocument document, String partitioning, Object element) { @@ -466,7 +467,7 @@ public class JavaTextTools implements IPHPPartitions { /** * Returns the names of the document position categories used by the document partitioners created by this object to manage their * partition information. If the partitioners don't use document position categories, the returned result is null. - * + * * @return the partition managing position categories or null if there is none */ public String[] getPartitionManagingPositionCategories() { @@ -475,7 +476,7 @@ public class JavaTextTools implements IPHPPartitions { /** * Determines whether the preference change encoded by the given event changes the behavior of one its contained components. - * + * * @param event * the event to be investigated * @return true if event causes a behavioral change @@ -492,7 +493,7 @@ public class JavaTextTools implements IPHPPartitions { // } /** * Adapts the behavior of the contained components to the change encoded in the given event. - * + * * @param event * the event to which to adapt * @since 2.0 @@ -551,7 +552,7 @@ public class JavaTextTools implements IPHPPartitions { } /** - * + * */ // public IPartitionTokenScanner getJSPScriptScanner() { // return jspScriptScanner; @@ -592,7 +593,7 @@ public class JavaTextTools implements IPHPPartitions { /** * Returns a scanner which is configured to scan plain text in JSP. - * + * * @return a JSP text scanner */ // public RuleBasedScanner getJSPTextScanner() { @@ -600,7 +601,7 @@ public class JavaTextTools implements IPHPPartitions { // } /** * Returns a scanner which is configured to scan plain text in JSP. - * + * * @return a JSP text scanner */ // public RuleBasedScanner getJSPBracketScanner() { @@ -635,7 +636,7 @@ public class JavaTextTools implements IPHPPartitions { /** * Sets up the Java document partitioner for the given document for the default partitioning. - * + * * @param document * the document to be set up * @since 3.0 @@ -646,7 +647,7 @@ public class JavaTextTools implements IPHPPartitions { /** * Sets up the Java document partitioner for the given document for the given partitioning. - * + * * @param document * the document to be set up * @param partitioning @@ -666,7 +667,7 @@ public class JavaTextTools implements IPHPPartitions { /** * Returns this text tool's preference store. - * + * * @return the preference store * @since 3.0 */ @@ -676,7 +677,7 @@ public class JavaTextTools implements IPHPPartitions { /** * Returns this text tool's core preference store. - * + * * @return the core preference store * @since 3.0 */ diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/PHPSourceViewerConfiguration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/PHPSourceViewerConfiguration.java index ee2d646..d749720 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/PHPSourceViewerConfiguration.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/PHPSourceViewerConfiguration.java @@ -601,7 +601,7 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration { IPHPPartitions.HTML, IPHPPartitions.HTML_MULTILINE_COMMENT, IPHPPartitions.PHP_PARTITIONING, IPHPPartitions.PHP_SINGLELINE_COMMENT, IPHPPartitions.PHP_MULTILINE_COMMENT, IPHPPartitions.PHP_PHPDOC_COMMENT, - IPHPPartitions.PHP_STRING_DQ, IPHPPartitions.PHP_STRING_SQ, IPHPPartitions.CSS, IPHPPartitions.CSS_MULTILINE_COMMENT, + IPHPPartitions.PHP_STRING_DQ, IPHPPartitions.PHP_STRING_SQ, IPHPPartitions.PHP_STRING_HEREDOC, IPHPPartitions.CSS, IPHPPartitions.CSS_MULTILINE_COMMENT, IPHPPartitions.JAVASCRIPT, IPHPPartitions.JS_MULTILINE_COMMENT, IPHPPartitions.SMARTY, IPHPPartitions.SMARTY_MULTILINE_COMMENT, @@ -625,7 +625,7 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration { public String[] getConfiguredPHPContentTypes() { return new String[] { IDocument.DEFAULT_CONTENT_TYPE, IPHPPartitions.PHP_PARTITIONING, IPHPPartitions.PHP_SINGLELINE_COMMENT, IPHPPartitions.PHP_MULTILINE_COMMENT, IPHPPartitions.PHP_PHPDOC_COMMENT, IPHPPartitions.PHP_STRING_DQ, - IPHPPartitions.PHP_STRING_SQ, IPHPPartitions.CSS, IPHPPartitions.CSS_MULTILINE_COMMENT, IPHPPartitions.JAVASCRIPT, + IPHPPartitions.PHP_STRING_SQ, IPHPPartitions.PHP_STRING_HEREDOC, IPHPPartitions.CSS, IPHPPartitions.CSS_MULTILINE_COMMENT, IPHPPartitions.JAVASCRIPT, IPHPPartitions.JS_MULTILINE_COMMENT, IPHPPartitions.SMARTY, IPHPPartitions.SMARTY_MULTILINE_COMMENT, }; } @@ -668,6 +668,7 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration { assistant.setContentAssistProcessor(processor, IPHPPartitions.PHP_PARTITIONING); assistant.setContentAssistProcessor(processor, IPHPPartitions.PHP_STRING_DQ); assistant.setContentAssistProcessor(processor, IPHPPartitions.PHP_STRING_SQ); + assistant.setContentAssistProcessor(processor, IPHPPartitions.PHP_STRING_HEREDOC); assistant.setContentAssistProcessor(new PHPDocCompletionProcessor(getEditor()), IPHPPartitions.PHP_PHPDOC_COMMENT); // assistant.enableAutoActivation(true); @@ -821,6 +822,9 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration { phpDR = new DefaultDamagerRepairer(getStringSQScanner()); phpReconciler.setDamager(phpDR, IPHPPartitions.PHP_STRING_SQ); phpReconciler.setRepairer(phpDR, IPHPPartitions.PHP_STRING_SQ); + phpDR = new DefaultDamagerRepairer(getStringDQScanner()); + phpReconciler.setDamager(phpDR, IPHPPartitions.PHP_STRING_HEREDOC); + phpReconciler.setRepairer(phpDR, IPHPPartitions.PHP_STRING_HEREDOC); phpDR = new DefaultDamagerRepairer(getSinglelineCommentScanner()); phpReconciler.setDamager(phpDR, IPHPPartitions.PHP_SINGLELINE_COMMENT); phpReconciler.setRepairer(phpDR, IPHPPartitions.PHP_SINGLELINE_COMMENT); diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPEditor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPEditor.java index d0393cf..c10ebf9 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPEditor.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPEditor.java @@ -4980,8 +4980,11 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I List segmentation = new ArrayList(); for (int i = 0; i < linePartitioning.length; i++) { - if (IPHPPartitions.PHP_STRING_DQ.equals(linePartitioning[i].getType())) + if (IPHPPartitions.PHP_STRING_DQ.equals(linePartitioning[i].getType())) { segmentation.add(linePartitioning[i]); + } else if (IPHPPartitions.PHP_STRING_HEREDOC.equals(linePartitioning[i].getType())) { + segmentation.add(linePartitioning[i]); + } } if (segmentation.size() == 0) diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPUnitEditor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPUnitEditor.java index 9c99864..39cbeae 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPUnitEditor.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPUnitEditor.java @@ -107,8 +107,8 @@ import org.eclipse.ui.texteditor.TextOperationAction; * 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 implementation + * + * Contributors: IBM Corporation - Initial implementation * www.phpeclipse.de ******************************************************************************/ /** @@ -406,6 +406,7 @@ public class PHPUnitEditor extends PHPEditor { //implements prependAutoEditStrategy(smartSemi, IDocument.DEFAULT_CONTENT_TYPE); prependAutoEditStrategy(smartSemi, IPHPPartitions.PHP_STRING_DQ); prependAutoEditStrategy(smartSemi, IPHPPartitions.PHP_STRING_SQ); + prependAutoEditStrategy(smartSemi, IPHPPartitions.PHP_STRING_HEREDOC); } /* @@ -432,7 +433,7 @@ public class PHPUnitEditor extends PHPEditor { //implements /** * Remembers data related to the current selection to be able to restore it later. - * + * * @since 3.0 */ private class RememberedSelection { @@ -542,7 +543,7 @@ public class PHPUnitEditor extends PHPEditor { //implements /** * Remembers additional data for a given offset to be able restore it later. - * + * * @since 3.0 */ private class RememberedOffset { @@ -560,7 +561,7 @@ public class PHPUnitEditor extends PHPEditor { //implements /** * Store visual properties of the given offset. - * + * * @param offset * Offset in the document */ @@ -592,7 +593,7 @@ public class PHPUnitEditor extends PHPEditor { //implements /** * Return offset recomputed from stored visual properties. - * + * * @return Offset in the document */ public int getOffset() { @@ -608,7 +609,7 @@ public class PHPUnitEditor extends PHPEditor { //implements /** * Return offset recomputed from stored visual properties. - * + * * @param newElement * Enclosing element * @return Offset in the document @@ -657,7 +658,7 @@ public class PHPUnitEditor extends PHPEditor { //implements /** * Returns the offset used to reveal the given element based on the given selection offset. - * + * * @param element * the element * @param offset @@ -683,7 +684,7 @@ public class PHPUnitEditor extends PHPEditor { //implements /** * Return Java element recomputed from stored visual properties. - * + * * @return Java element */ public IJavaElement getElement() { @@ -705,7 +706,7 @@ public class PHPUnitEditor extends PHPEditor { //implements /** * Does the given Java element contain the given offset? - * + * * @param element * Java element * @param offset @@ -721,7 +722,7 @@ public class PHPUnitEditor extends PHPEditor { //implements /** * Returns the offset of the given Java element. - * + * * @param element * Java element * @return Offset of the given Java element @@ -741,7 +742,7 @@ public class PHPUnitEditor extends PHPEditor { //implements /** * Returns the length of the given Java element. - * + * * @param element * Java element * @return Length of the given Java element @@ -761,7 +762,7 @@ public class PHPUnitEditor extends PHPEditor { //implements /** * Returns the updated java element for the old java element. - * + * * @param element * Old Java element * @return Updated Java element @@ -1186,7 +1187,7 @@ public class PHPUnitEditor extends PHPEditor { //implements /** * The remembered selection. - * + * * @since 3.0 */ private RememberedSelection fRememberedSelection = new RememberedSelection(); @@ -1383,7 +1384,7 @@ public class PHPUnitEditor extends PHPEditor { //implements /** * Reconciling listeners. - * + * * @since 3.0 */ private ListenerList fReconcilingListeners = new ListenerList(); @@ -1472,7 +1473,7 @@ public class PHPUnitEditor extends PHPEditor { //implements action.setActionDefinitionId(PHPEditorActionDefinitionIds.FORMAT); setAction("Format", action); //$NON-NLS-1$ markAsStateDependentAction("Format", true); //$NON-NLS-1$ - markAsSelectionDependentAction("Format", true); //$NON-NLS-1$ + markAsSelectionDependentAction("Format", true); //$NON-NLS-1$ // WorkbenchHelp.setHelp(action, IJavaHelpContextIds.FORMAT_ACTION); // action = new AddBlockCommentAction(PHPEditorMessages.getResourceBundle(), @@ -1500,26 +1501,26 @@ public class PHPUnitEditor extends PHPEditor { //implements // markAsStateDependentAction("Indent", true); //$NON-NLS-1$ // markAsSelectionDependentAction("Indent", true); //$NON-NLS-1$ //// WorkbenchHelp.setHelp(action, IJavaHelpContextIds.INDENT_ACTION); - // + // // action= new IndentAction(PHPEditorMessages.getResourceBundle(), // "Indent.", this, true); //$NON-NLS-1$ // setAction("IndentOnTab", action); //$NON-NLS-1$ // markAsStateDependentAction("IndentOnTab", true); //$NON-NLS-1$ // markAsSelectionDependentAction("IndentOnTab", true); //$NON-NLS-1$ - // + // action = new AddBlockCommentAction(PHPEditorMessages.getResourceBundle(), "AddBlockComment.", this); //$NON-NLS-1$ action.setActionDefinitionId(PHPEditorActionDefinitionIds.ADD_BLOCK_COMMENT); setAction("AddBlockComment", action); //$NON-NLS-1$ markAsStateDependentAction("AddBlockComment", true); //$NON-NLS-1$ - markAsSelectionDependentAction("AddBlockComment", true); //$NON-NLS-1$ + markAsSelectionDependentAction("AddBlockComment", true); //$NON-NLS-1$ // WorkbenchHelp.setHelp(action, IJavaHelpContextIds.ADD_BLOCK_COMMENT_ACTION); action = new RemoveBlockCommentAction(PHPEditorMessages.getResourceBundle(), "RemoveBlockComment.", this); //$NON-NLS-1$ action.setActionDefinitionId(PHPEditorActionDefinitionIds.REMOVE_BLOCK_COMMENT); setAction("RemoveBlockComment", action); //$NON-NLS-1$ markAsStateDependentAction("RemoveBlockComment", true); //$NON-NLS-1$ - markAsSelectionDependentAction("RemoveBlockComment", true); //$NON-NLS-1$ + markAsSelectionDependentAction("RemoveBlockComment", true); //$NON-NLS-1$ // WorkbenchHelp.setHelp(action, IJavaHelpContextIds.REMOVE_BLOCK_COMMENT_ACTION); // action= new IndentAction(PHPEditorMessages.getResourceBundle(), "Indent.", this, false); //$NON-NLS-1$ @@ -1528,7 +1529,7 @@ public class PHPUnitEditor extends PHPEditor { //implements // markAsStateDependentAction("Indent", true); //$NON-NLS-1$ // markAsSelectionDependentAction("Indent", true); //$NON-NLS-1$ //// WorkbenchHelp.setHelp(action, IJavaHelpContextIds.INDENT_ACTION); - // + // action = new IndentAction(PHPEditorMessages.getResourceBundle(), "Indent.", this, true); //$NON-NLS-1$ setAction("IndentOnTab", action); //$NON-NLS-1$ markAsStateDependentAction("IndentOnTab", true); //$NON-NLS-1$ @@ -1565,7 +1566,7 @@ public class PHPUnitEditor extends PHPEditor { //implements * Returns the most narrow element including the given offset. If reconcile is true the editor's * input element is reconciled in advance. If it is false this method only returns a result if the editor's input * element does not need to be reconciled. - * + * * @param offset * the offset included by the retrieved element * @param reconcile @@ -1947,7 +1948,7 @@ public class PHPUnitEditor extends PHPEditor { //implements /** * Handles a property change event describing a change of the php core's preferences and updates the preference related editor * properties. - * + * * @param event * the property change event */ @@ -2075,7 +2076,7 @@ public class PHPUnitEditor extends PHPEditor { //implements if (getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_P_RTRIM_ON_SAVE)) { RTrimAction trimAction = new RTrimAction(); trimAction.setActiveEditor(null, getSite().getPage().getActiveEditor()); - trimAction.run(null); + trimAction.run(null); } setStatusLineErrorMessage(null); @@ -2102,7 +2103,7 @@ public class PHPUnitEditor extends PHPEditor { //implements /** * The compilation unit editor implementation of this AbstractTextEditor method asks the user for the workspace * path of a file resource and saves the document there. See http://dev.eclipse.org/bugs/show_bug.cgi?id=6295 - * + * * @param progressMonitor * the progress monitor */ @@ -2197,13 +2198,13 @@ public class PHPUnitEditor extends PHPEditor { //implements // IJavaElement inputElement= getInputJavaElement(); // if (model == null || inputElement == null) // return; - // + // // fOverrideIndicatorManager= new OverrideIndicatorManager(model, // inputElement, null); // addReconcileListener(fOverrideIndicatorManager); // } // } - // + // // /* // * @see // net.sourceforge.phpdt.internal.ui.javaeditor.JavaEditor#uninstallOverrideIndicator() @@ -2217,7 +2218,7 @@ public class PHPUnitEditor extends PHPEditor { //implements /** * Configures the toggle comment action - * + * * @since 3.0 */ private void configureToggleCommentAction() { @@ -2314,7 +2315,7 @@ public class PHPUnitEditor extends PHPEditor { //implements /** * Asks the user if it is ok to store in non-workbench encoding. - * + * * @return if the user wants to continue */ private boolean askIfNonWorkbenchEncodingIsOk() { @@ -2446,7 +2447,7 @@ public class PHPUnitEditor extends PHPEditor { //implements // } /** * Tells whether this is the active editor in the active page. - * + * * @return true if this is the active editor in the active page * @see IWorkbenchPage#getActiveEditor(); */ @@ -2461,7 +2462,7 @@ public class PHPUnitEditor extends PHPEditor { //implements /** * Adds the given listener. Has no effect if an identical listener was not already registered. - * + * * @param listener * The reconcile listener to be added * @since 3.0 @@ -2474,7 +2475,7 @@ public class PHPUnitEditor extends PHPEditor { //implements /** * Removes the given listener. Has no effect if an identical listener was not already registered. - * + * * @param listener * the reconcile listener to be removed * @since 3.0 @@ -2557,7 +2558,7 @@ public class PHPUnitEditor extends PHPEditor { //implements *

* TODO remove once the underlying problem is solved. *

- * + * * @return the lock reconcilers may use to synchronize on */ public Object getReconcilerLock() { @@ -2566,7 +2567,7 @@ public class PHPUnitEditor extends PHPEditor { //implements /* * (non-Javadoc) - * + * * @see org.eclipse.ui.texteditor.AbstractTextEditor#editorSaved() */ protected void editorSaved() {