1) Fixed issue #705: Take the global 'Undo history size' to overwrite the default...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / phpeditor / PHPUnitEditor.java
index 4a9d12d..8b9382f 100644 (file)
@@ -1,24 +1,36 @@
 package net.sourceforge.phpeclipse.phpeditor;
 
-import java.lang.reflect.InvocationTargetException;
 import java.text.MessageFormat;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 
 import net.sourceforge.phpdt.core.ICompilationUnit;
 import net.sourceforge.phpdt.core.IJavaElement;
+import net.sourceforge.phpdt.core.IJavaProject;
+import net.sourceforge.phpdt.core.IMember;
 import net.sourceforge.phpdt.core.ISourceRange;
 import net.sourceforge.phpdt.core.ISourceReference;
 import net.sourceforge.phpdt.core.JavaCore;
 import net.sourceforge.phpdt.core.JavaModelException;
+import net.sourceforge.phpdt.core.dom.CompilationUnit;
 import net.sourceforge.phpdt.internal.compiler.parser.Scanner;
+import net.sourceforge.phpdt.internal.corext.codemanipulation.StubUtility;
 import net.sourceforge.phpdt.internal.ui.actions.AddBlockCommentAction;
 import net.sourceforge.phpdt.internal.ui.actions.CompositeActionGroup;
+import net.sourceforge.phpdt.internal.ui.actions.IndentAction;
 import net.sourceforge.phpdt.internal.ui.actions.RemoveBlockCommentAction;
 import net.sourceforge.phpdt.internal.ui.text.ContentAssistPreference;
 import net.sourceforge.phpdt.internal.ui.text.IPHPPartitions;
+import net.sourceforge.phpdt.internal.ui.text.JavaHeuristicScanner;
+import net.sourceforge.phpdt.internal.ui.text.JavaIndenter;
 import net.sourceforge.phpdt.internal.ui.text.PHPPairMatcher;
+import net.sourceforge.phpdt.internal.ui.text.SmartBackspaceManager;
+import net.sourceforge.phpdt.internal.ui.text.SmartSemicolonAutoEditStrategy;
+import net.sourceforge.phpdt.internal.ui.text.comment.CommentFormattingContext;
+import net.sourceforge.phpdt.internal.ui.text.java.IJavaReconcilingListener;
 import net.sourceforge.phpdt.internal.ui.text.link.LinkedPositionManager;
 import net.sourceforge.phpdt.internal.ui.text.link.LinkedPositionUI;
 import net.sourceforge.phpdt.internal.ui.text.link.LinkedPositionUI.ExitFlags;
@@ -27,9 +39,10 @@ import net.sourceforge.phpdt.ui.PreferenceConstants;
 import net.sourceforge.phpdt.ui.actions.GenerateActionGroup;
 import net.sourceforge.phpdt.ui.text.JavaTextTools;
 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
+import net.sourceforge.phpeclipse.phpeditor.actions.RTrimAction;
+import net.sourceforge.phpeclipse.ui.editor.ShowExternalPreviewAction;
 
 import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IWorkspace;
 import org.eclipse.core.resources.IWorkspaceRoot;
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.CoreException;
@@ -37,38 +50,34 @@ import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Preferences;
-
-import net.sourceforge.phpdt.internal.ui.text.java.IJavaReconcilingListener;
-
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.action.IAction;
 import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.dialogs.Dialog;
 import org.eclipse.jface.dialogs.ErrorDialog;
 import org.eclipse.jface.dialogs.IMessageProvider;
 import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
 import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.jface.preference.PreferenceConverter;
 import org.eclipse.jface.text.BadLocationException;
 import org.eclipse.jface.text.DocumentCommand;
+import org.eclipse.jface.text.IAutoEditStrategy;
 import org.eclipse.jface.text.IDocument;
 import org.eclipse.jface.text.ILineTracker;
 import org.eclipse.jface.text.IRegion;
 import org.eclipse.jface.text.ITextOperationTarget;
-import org.eclipse.jface.text.ITextSelection;
 import org.eclipse.jface.text.ITextViewerExtension;
 import org.eclipse.jface.text.ITypedRegion;
 import org.eclipse.jface.text.IWidgetTokenKeeper;
 import org.eclipse.jface.text.contentassist.ContentAssistant;
 import org.eclipse.jface.text.contentassist.IContentAssistant;
-import org.eclipse.jface.text.source.IAnnotationModel;
+import org.eclipse.jface.text.formatter.FormattingContextProperties;
+import org.eclipse.jface.text.formatter.IFormattingContext;
 import org.eclipse.jface.text.source.IOverviewRuler;
 import org.eclipse.jface.text.source.ISourceViewer;
 import org.eclipse.jface.text.source.IVerticalRuler;
 import org.eclipse.jface.text.source.SourceViewerConfiguration;
+import org.eclipse.jface.util.ListenerList;
 import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.ISelectionProvider;
 import org.eclipse.jface.window.Window;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.VerifyKeyListener;
@@ -80,366 +89,267 @@ import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.actions.ActionContext;
 import org.eclipse.ui.actions.ActionGroup;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
 import org.eclipse.ui.dialogs.SaveAsDialog;
 import org.eclipse.ui.editors.text.IStorageDocumentProvider;
-import org.eclipse.ui.help.WorkbenchHelp;
 import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
 import org.eclipse.ui.texteditor.ContentAssistAction;
 import org.eclipse.ui.texteditor.IDocumentProvider;
 import org.eclipse.ui.texteditor.ITextEditorActionConstants;
 import org.eclipse.ui.texteditor.TextOperationAction;
+
 /*******************************************************************************
  * Copyright (c) 2000, 2002 IBM Corp. and others. 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 implementation Klaus Hartlage -
- * www.eclipseproject.de
+ *
+ * Contributors: IBM Corporation - Initial implementation
+ * www.phpeclipse.de
  ******************************************************************************/
 /**
  * PHP specific text editor.
  */
-public class PHPUnitEditor extends PHPEditor{ //implements IJavaReconcilingListener {
+public class PHPUnitEditor extends PHPEditor { // implements
+       // IJavaReconcilingListener {
        interface ITextConverter {
                void customizeDocumentCommand(IDocument document,
                                DocumentCommand command);
        };
-       //  class AdaptedRulerLayout extends Layout {
-       //
-       //    protected int fGap;
-       //    protected AdaptedSourceViewer fAdaptedSourceViewer;
-       //
-       //    protected AdaptedRulerLayout(int gap, AdaptedSourceViewer asv) {
-       //      fGap = gap;
-       //      fAdaptedSourceViewer = asv;
-       //    }
-       //
-       //    protected Point computeSize(Composite composite, int wHint, int hHint,
-       // boolean flushCache) {
-       //      Control[] children = composite.getChildren();
-       //      Point s = children[children.length - 1].computeSize(SWT.DEFAULT,
-       // SWT.DEFAULT, flushCache);
-       //      if (fAdaptedSourceViewer.isVerticalRulerVisible())
-       //        s.x += fAdaptedSourceViewer.getVerticalRuler().getWidth() + fGap;
-       //      return s;
-       //    }
-       //
-       //    protected void layout(Composite composite, boolean flushCache) {
-       //      Rectangle clArea = composite.getClientArea();
-       //      if (fAdaptedSourceViewer.isVerticalRulerVisible()) {
-       //
-       //        StyledText textWidget = fAdaptedSourceViewer.getTextWidget();
-       //        Rectangle trim = textWidget.computeTrim(0, 0, 0, 0);
-       //        int scrollbarHeight = trim.height;
-       //
-       //        IVerticalRuler vr = fAdaptedSourceViewer.getVerticalRuler();
-       //        int vrWidth = vr.getWidth();
-       //
-       //        int orWidth = 0;
-       //        if (fAdaptedSourceViewer.isOverviewRulerVisible()) {
-       //          OverviewRuler or = fAdaptedSourceViewer.getOverviewRuler();
-       //          orWidth = or.getWidth();
-       //          or.getControl().setBounds(clArea.width - orWidth, scrollbarHeight,
-       // orWidth, clArea.height - 3 * scrollbarHeight);
-       //        }
-       //
-       //        textWidget.setBounds(vrWidth + fGap, 0, clArea.width - vrWidth - orWidth
-       // -
-       // 2 * fGap, clArea.height);
-       //        vr.getControl().setBounds(0, 0, vrWidth, clArea.height -
-       // scrollbarHeight);
-       //
-       //      } else {
-       //        StyledText textWidget = fAdaptedSourceViewer.getTextWidget();
-       //        textWidget.setBounds(0, 0, clArea.width, clArea.height);
-       //      }
-       //    }
-       //  };
-       //
-       //  class AdaptedSourceViewer extends SourceViewer { // extends
-       // JavaCorrectionSourceViewer {
-       //
-       //    private List fTextConverters;
-       //
-       //    private OverviewRuler fOverviewRuler;
-       //    private boolean fIsOverviewRulerVisible;
-       //    /** The viewer's overview ruler hovering controller */
-       //    private AbstractHoverInformationControlManager
-       // fOverviewRulerHoveringController;
-       //
-       //    private boolean fIgnoreTextConverters = false;
-       //
-       //    private IVerticalRuler fCachedVerticalRuler;
-       //    private boolean fCachedIsVerticalRulerVisible;
-       //
-       //    public AdaptedSourceViewer(Composite parent, IVerticalRuler ruler, int
-       // styles) {
-       //      super(parent, ruler, styles); //, CompilationUnitEditor.this);
-       //
-       //      fCachedVerticalRuler = ruler;
-       //      fCachedIsVerticalRulerVisible = (ruler != null);
-       //      fOverviewRuler = new OverviewRuler(VERTICAL_RULER_WIDTH);
-       //
-       //      delayedCreateControl(parent, styles);
-       //    }
+
+       // class AdaptedSourceViewer extends JavaSourceViewer {
+       // private List fTextConverters;
        //
-       //    /*
-       //     * @see ISourceViewer#showAnnotations(boolean)
-       //     */
-       //    public void showAnnotations(boolean show) {
-       //      fCachedIsVerticalRulerVisible = (show && fCachedVerticalRuler != null);
-       //      // super.showAnnotations(show);
-       //    }
+       // private boolean fIgnoreTextConverters = false;
        //
-       //    public IContentAssistant getContentAssistant() {
-       //      return fContentAssistant;
-       //    }
+       // // private JavaCorrectionAssistant fCorrectionAssistant;
+       // public AdaptedSourceViewer(Composite parent, IVerticalRuler
+       // verticalRuler,
+       // IOverviewRuler overviewRuler, boolean showAnnotationsOverview,
+       // int styles, IPreferenceStore store) {
+       // super(parent, verticalRuler, overviewRuler, showAnnotationsOverview,
+       // styles, store);
+       // }
        //
-       //    /*
-       //     * @see ITextOperationTarget#doOperation(int)
-       //     */
-       //    public void doOperation(int operation) {
+       // // public AdaptedSourceViewer(Composite parent,
+       // // IVerticalRuler verticalRuler, IOverviewRuler overviewRuler,
+       // // boolean showAnnotationsOverview, int styles) {
+       // // super(parent, verticalRuler, overviewRuler,
+       // // showAnnotationsOverview, styles);
+       // // }
+       // public IContentAssistant getContentAssistant() {
+       // return fContentAssistant;
+       // }
        //
-       //      if (getTextWidget() == null)
-       //        return;
+       // /*
+       // * @see ITextOperationTarget#doOperation(int)
+       // */
+       // public void doOperation(int operation) {
+       // if (getTextWidget() == null)
+       // return;
+       // switch (operation) {
+       // case CONTENTASSIST_PROPOSALS:
+       // String msg = fContentAssistant.showPossibleCompletions();
+       // setStatusLineErrorMessage(msg);
+       // return;
+       // // case CORRECTIONASSIST_PROPOSALS:
+       // // fCorrectionAssistant.showPossibleCompletions();
+       // // return;
+       // case UNDO:
+       // fIgnoreTextConverters = true;
+       // break;
+       // case REDO:
+       // fIgnoreTextConverters = true;
+       // break;
+       // }
+       // super.doOperation(operation);
+       // }
        //
-       //      switch (operation) {
-       //        case CONTENTASSIST_PROPOSALS :
-       //          String msg = fContentAssistant.showPossibleCompletions();
-       //          setStatusLineErrorMessage(msg);
-       //          return;
-       //        case UNDO :
-       //          fIgnoreTextConverters = true;
-       //          break;
-       //        case REDO :
-       //          fIgnoreTextConverters = true;
-       //          break;
-       //      }
+       // /*
+       // * @see ITextOperationTarget#canDoOperation(int)
+       // */
+       // public boolean canDoOperation(int operation) {
+       // // if (operation == CORRECTIONASSIST_PROPOSALS)
+       // // return isEditable();
+       // return super.canDoOperation(operation);
+       // }
        //
-       //      super.doOperation(operation);
-       //    }
+       // /*
+       // * @see TextViewer#handleDispose()
+       // */
+       // protected void handleDispose() {
+       // // if (fCorrectionAssistant != null) {
+       // // fCorrectionAssistant.uninstall();
+       // // fCorrectionAssistant= null;
+       // // }
+       // super.handleDispose();
+       // }
        //
-       //    public void insertTextConverter(ITextConverter textConverter, int index)
+       // public void insertTextConverter(ITextConverter textConverter, int index)
        // {
-       //      throw new UnsupportedOperationException();
-       //    }
+       // throw new UnsupportedOperationException();
+       // }
        //
-       //    public void addTextConverter(ITextConverter textConverter) {
-       //      if (fTextConverters == null) {
-       //        fTextConverters = new ArrayList(1);
-       //        fTextConverters.add(textConverter);
-       //      } else if (!fTextConverters.contains(textConverter))
-       //        fTextConverters.add(textConverter);
-       //    }
+       // public void addTextConverter(ITextConverter textConverter) {
+       // if (fTextConverters == null) {
+       // fTextConverters = new ArrayList(1);
+       // fTextConverters.add(textConverter);
+       // } else if (!fTextConverters.contains(textConverter))
+       // fTextConverters.add(textConverter);
+       // }
        //
-       //    public void removeTextConverter(ITextConverter textConverter) {
-       //      if (fTextConverters != null) {
-       //        fTextConverters.remove(textConverter);
-       //        if (fTextConverters.size() == 0)
-       //          fTextConverters = null;
-       //      }
-       //    }
+       // public void removeTextConverter(ITextConverter textConverter) {
+       // if (fTextConverters != null) {
+       // fTextConverters.remove(textConverter);
+       // if (fTextConverters.size() == 0)
+       // fTextConverters = null;
+       // }
+       // }
        //
-       //    /*
-       //     * @see TextViewer#customizeDocumentCommand(DocumentCommand)
-       //     */
-       //    protected void customizeDocumentCommand(DocumentCommand command) {
-       //      super.customizeDocumentCommand(command);
-       //      if (!fIgnoreTextConverters && fTextConverters != null) {
-       //        for (Iterator e = fTextConverters.iterator(); e.hasNext();)
-       //           ((ITextConverter) e.next()).customizeDocumentCommand(getDocument(),
+       // /*
+       // * @see TextViewer#customizeDocumentCommand(DocumentCommand)
+       // */
+       // protected void customizeDocumentCommand(DocumentCommand command) {
+       // super.customizeDocumentCommand(command);
+       // if (!fIgnoreTextConverters && fTextConverters != null) {
+       // for (Iterator e = fTextConverters.iterator(); e.hasNext();)
+       // ((ITextConverter) e.next()).customizeDocumentCommand(getDocument(),
        // command);
-       //      }
-       //      fIgnoreTextConverters = false;
-       //    }
-       //
-       //    public IVerticalRuler getVerticalRuler() {
-       //      return fCachedVerticalRuler;
-       //    }
-       //
-       //    public boolean isVerticalRulerVisible() {
-       //      return fCachedIsVerticalRulerVisible;
-       //    }
-       //
-       //    public OverviewRuler getOverviewRuler() {
-       //      return fOverviewRuler;
-       //    }
-       //
-       //    /*
-       //     * @see TextViewer#createControl(Composite, int)
-       //     */
-       //    protected void createControl(Composite parent, int styles) {
-       //      // do nothing here
-       //    }
+       // }
+       // fIgnoreTextConverters = false;
+       // }
        //
-       //    protected void delayedCreateControl(Composite parent, int styles) {
-       //      //create the viewer
-       //      super.createControl(parent, styles);
+       // // http://dev.eclipse.org/bugs/show_bug.cgi?id=19270
+       // public void updateIndentationPrefixes() {
+       // SourceViewerConfiguration configuration = getSourceViewerConfiguration();
+       // String[] types = configuration.getConfiguredContentTypes(this);
+       // for (int i = 0; i < types.length; i++) {
+       // String[] prefixes = configuration.getIndentPrefixes(this, types[i]);
+       // if (prefixes != null && prefixes.length > 0)
+       // setIndentPrefixes(prefixes, types[i]);
+       // }
+       // }
        //
-       //      Control control = getControl();
-       //      if (control instanceof Composite) {
-       //        Composite composite = (Composite) control;
-       //        composite.setLayout(new AdaptedRulerLayout(GAP_SIZE, this));
-       //        fOverviewRuler.createControl(composite, this);
-       //      }
-       //    }
-       //    protected void ensureOverviewHoverManagerInstalled() {
-       //      if (fOverviewRulerHoveringController == null && fAnnotationHover != null
-       // && fHoverControlCreator != null) {
-       //        fOverviewRulerHoveringController =
-       //          new OverviewRulerHoverManager(fOverviewRuler, this, fAnnotationHover,
-       // fHoverControlCreator);
-       //        fOverviewRulerHoveringController.install(fOverviewRuler.getControl());
-       //      }
-       //    }
+       // /*
+       // * @see IWidgetTokenOwner#requestWidgetToken(IWidgetTokenKeeper)
+       // */
+       // public boolean requestWidgetToken(IWidgetTokenKeeper requester) {
+       // if (WorkbenchHelp.isContextHelpDisplayed())
+       // return false;
+       // return super.requestWidgetToken(requester);
+       // }
        //
-       //    public void hideOverviewRuler() {
-       //      fIsOverviewRulerVisible = false;
-       //      Control control = getControl();
-       //      if (control instanceof Composite) {
-       //        Composite composite = (Composite) control;
-       //        composite.layout();
-       //      }
-       //      if (fOverviewRulerHoveringController != null) {
-       //        fOverviewRulerHoveringController.dispose();
-       //        fOverviewRulerHoveringController = null;
-       //      }
-       //    }
-       //
-       //    public void showOverviewRuler() {
-       //      fIsOverviewRulerVisible = true;
-       //      Control control = getControl();
-       //      if (control instanceof Composite) {
-       //        Composite composite = (Composite) control;
-       //        composite.layout();
-       //      }
-       //      ensureOverviewHoverManagerInstalled();
-       //    }
-       //
-       //    public boolean isOverviewRulerVisible() {
-       //      return fIsOverviewRulerVisible;
-       //    }
-       //
-       //    /*
-       //     * @see ISourceViewer#setDocument(IDocument, IAnnotationModel, int, int)
-       //     */
-       //    public void setDocument(
-       //      IDocument document,
-       //      IAnnotationModel annotationModel,
-       //      int visibleRegionOffset,
-       //      int visibleRegionLength) {
-       //      super.setDocument(document, annotationModel, visibleRegionOffset,
-       // visibleRegionLength);
-       //      fOverviewRuler.setModel(annotationModel);
-       //    }
-       //
-       //    // http://dev.eclipse.org/bugs/show_bug.cgi?id=19270
-       //    public void updateIndentationPrefixes() {
-       //      SourceViewerConfiguration configuration = getSourceViewerConfiguration();
-       //      String[] types = configuration.getConfiguredContentTypes(this);
-       //      for (int i = 0; i < types.length; i++) {
-       //        String[] prefixes = configuration.getIndentPrefixes(this, types[i]);
-       //        if (prefixes != null && prefixes.length > 0)
-       //          setIndentPrefixes(prefixes, types[i]);
-       //      }
-       //    }
-       //
-       //    /*
-       //     * @see IWidgetTokenOwner#requestWidgetToken(IWidgetTokenKeeper)
-       //     */
-       //    public boolean requestWidgetToken(IWidgetTokenKeeper requester) {
-       //      if (WorkbenchHelp.isContextHelpDisplayed())
-       //        return false;
-       //      return super.requestWidgetToken(requester);
-       //    }
-       //
-       //    /*
-       //     * @see
+       // // /*
+       // // * @see
        // org.eclipse.jface.text.source.ISourceViewer#configure(org.eclipse.jface.text.source.SourceViewerConfiguration)
-       //     */
-       //    public void configure(SourceViewerConfiguration configuration) {
-       //      super.configure(configuration);
-       //      // prependAutoEditStrategy(new SmartBracesAutoEditStrategy(this),
-       // IDocument.DEFAULT_CONTENT_TYPE);
-       //    }
-       //
-       //    protected void handleDispose() {
-       //      fOverviewRuler = null;
-       //
-       //      if (fOverviewRulerHoveringController != null) {
-       //        fOverviewRulerHoveringController.dispose();
-       //        fOverviewRulerHoveringController = null;
-       //      }
-       //
-       //      super.handleDispose();
-       //    }
-       //
-       //  };
+       // // */
+       // // public void configure(SourceViewerConfiguration configuration) {
+       // // super.configure(configuration);
+       // // // fCorrectionAssistant= new
+       // // // JavaCorrectionAssistant(CompilationUnitEditor.this);
+       // // // fCorrectionAssistant.install(this);
+       // // //TODO install SmartBracesAutoEditStrategy
+       // // // prependAutoEditStrategy(new SmartBracesAutoEditStrategy(this),
+       // // // IDocument.DEFAULT_CONTENT_TYPE);
+       // // }
+       // public void configure(SourceViewerConfiguration configuration) {
+       // super.configure(configuration);
+       // // fCorrectionAssistant= new
+       // JavaCorrectionAssistant(CompilationUnitEditor.this);
+       // // fCorrectionAssistant.install(this);
+       // IAutoEditStrategy smartSemi= new
+       // SmartSemicolonAutoEditStrategy(IPHPPartitions.PHP_PARTITIONING);
+       // prependAutoEditStrategy(smartSemi, IDocument.DEFAULT_CONTENT_TYPE);
+       // prependAutoEditStrategy(smartSemi, IPHPPartitions.PHP_STRING_DQ);
+       // prependAutoEditStrategy(smartSemi, IPHPPartitions.PHP_STRING_SQ);
+       // // prependAutoEditStrategy(smartSemi, IPHPPartitions.JAVA_CHARACTER);
+       // }
+       // };
        class AdaptedSourceViewer extends JavaSourceViewer {
+
                private List fTextConverters;
+
                private boolean fIgnoreTextConverters = false;
-               //                      private JavaCorrectionAssistant fCorrectionAssistant;
-               public AdaptedSourceViewer(Composite parent, IVerticalRuler verticalRuler, IOverviewRuler overviewRuler, boolean showAnnotationsOverview, int styles, IPreferenceStore store) {
-                       super(parent, verticalRuler, overviewRuler, showAnnotationsOverview, styles, store);
-               }
-//             public AdaptedSourceViewer(Composite parent,
-//                             IVerticalRuler verticalRuler, IOverviewRuler overviewRuler,
-//                             boolean showAnnotationsOverview, int styles) {
-//                     super(parent, verticalRuler, overviewRuler,
-//                                     showAnnotationsOverview, styles);
-//             }
+
+               // private JavaCorrectionAssistant fCorrectionAssistant;
+
+               public AdaptedSourceViewer(Composite parent,
+                               IVerticalRuler verticalRuler, IOverviewRuler overviewRuler,
+                               boolean showAnnotationsOverview, int styles,
+                               IPreferenceStore store) {
+                       super(parent, verticalRuler, overviewRuler,
+                                       showAnnotationsOverview, styles, store);
+               }
+
                public IContentAssistant getContentAssistant() {
                        return fContentAssistant;
                }
+
                /*
                 * @see ITextOperationTarget#doOperation(int)
                 */
                public void doOperation(int operation) {
+
                        if (getTextWidget() == null)
                                return;
+
                        switch (operation) {
-                               case CONTENTASSIST_PROPOSALS :
-                                       String msg = fContentAssistant.showPossibleCompletions();
-                                       setStatusLineErrorMessage(msg);
-                                       return;
-                               //                                      case CORRECTIONASSIST_PROPOSALS:
-                               //                                              fCorrectionAssistant.showPossibleCompletions();
-                               //                                              return;
-                               case UNDO :
-                                       fIgnoreTextConverters = true;
-                                       break;
-                               case REDO :
-                                       fIgnoreTextConverters = true;
-                                       break;
+                       case CONTENTASSIST_PROPOSALS:
+                               String msg = fContentAssistant.showPossibleCompletions();
+                               setStatusLineErrorMessage(msg);
+                               return;
+                               // case CORRECTIONASSIST_PROPOSALS:
+                               // msg = fCorrectionAssistant.showPossibleCompletions();
+                               // setStatusLineErrorMessage(msg);
+                               // return;
+                       case UNDO:
+                               fIgnoreTextConverters = true;
+                               super.doOperation(operation);
+                               fIgnoreTextConverters = false;
+                               return;
+                       case REDO:
+                               fIgnoreTextConverters = true;
+                               super.doOperation(operation);
+                               fIgnoreTextConverters = false;
+                               return;
                        }
+
                        super.doOperation(operation);
                }
+
                /*
                 * @see ITextOperationTarget#canDoOperation(int)
                 */
                public boolean canDoOperation(int operation) {
-                       //                              if (operation == CORRECTIONASSIST_PROPOSALS)
-                       //                                      return isEditable();
+                       // if (operation == CORRECTIONASSIST_PROPOSALS)
+                       // return isEditable();
+
                        return super.canDoOperation(operation);
                }
+
                /*
-                * @see TextViewer#handleDispose()
+                * @see org.eclipse.jface.text.source.ISourceViewerExtension2#unconfigure()
+                * @since 3.0
                 */
-               protected void handleDispose() {
-                       //                              if (fCorrectionAssistant != null) {
-                       //                                      fCorrectionAssistant.uninstall();
-                       //                                      fCorrectionAssistant= null;
-                       //                              }
-                       super.handleDispose();
+               public void unconfigure() {
+                       // if (fCorrectionAssistant != null) {
+                       // fCorrectionAssistant.uninstall();
+                       // fCorrectionAssistant = null;
+                       // }
+                       super.unconfigure();
                }
+
                public void insertTextConverter(ITextConverter textConverter, int index) {
                        throw new UnsupportedOperationException();
                }
+
                public void addTextConverter(ITextConverter textConverter) {
                        if (fTextConverters == null) {
                                fTextConverters = new ArrayList(1);
@@ -447,6 +357,7 @@ public class PHPUnitEditor extends PHPEditor{ //implements IJavaReconcilingListe
                        } else if (!fTextConverters.contains(textConverter))
                                fTextConverters.add(textConverter);
                }
+
                public void removeTextConverter(ITextConverter textConverter) {
                        if (fTextConverters != null) {
                                fTextConverters.remove(textConverter);
@@ -454,6 +365,7 @@ public class PHPUnitEditor extends PHPEditor{ //implements IJavaReconcilingListe
                                        fTextConverters = null;
                        }
                }
+
                /*
                 * @see TextViewer#customizeDocumentCommand(DocumentCommand)
                 */
@@ -464,8 +376,8 @@ public class PHPUnitEditor extends PHPEditor{ //implements IJavaReconcilingListe
                                        ((ITextConverter) e.next()).customizeDocumentCommand(
                                                        getDocument(), command);
                        }
-                       fIgnoreTextConverters = false;
                }
+
                // http://dev.eclipse.org/bugs/show_bug.cgi?id=19270
                public void updateIndentationPrefixes() {
                        SourceViewerConfiguration configuration = getSourceViewerConfiguration();
@@ -477,38 +389,493 @@ public class PHPUnitEditor extends PHPEditor{ //implements IJavaReconcilingListe
                                        setIndentPrefixes(prefixes, types[i]);
                        }
                }
+
                /*
                 * @see IWidgetTokenOwner#requestWidgetToken(IWidgetTokenKeeper)
                 */
                public boolean requestWidgetToken(IWidgetTokenKeeper requester) {
-                       if (WorkbenchHelp.isContextHelpDisplayed())
+                       if (PlatformUI.getWorkbench().getHelpSystem()
+                                       .isContextHelpDisplayed())
                                return false;
                        return super.requestWidgetToken(requester);
                }
+
+               /*
+                * @see IWidgetTokenOwnerExtension#requestWidgetToken(IWidgetTokenKeeper,
+                *      int)
+                * @since 3.0
+                */
+               public boolean requestWidgetToken(IWidgetTokenKeeper requester,
+                               int priority) {
+                       if (PlatformUI.getWorkbench().getHelpSystem()
+                                       .isContextHelpDisplayed())
+                               return false;
+                       return super.requestWidgetToken(requester, priority);
+               }
+
+               /*
+                * Get the global 'Undo history size' setting 
+                *
+                */
+        protected int getUndoHistorySize () {
+                  IPreferenceStore store= getPreferenceStore ();
+                  
+                  return store != null ? store.getInt("undoHistorySize") : 1000;
+               }
+
+               
                /*
                 * @see org.eclipse.jface.text.source.ISourceViewer#configure(org.eclipse.jface.text.source.SourceViewerConfiguration)
                 */
                public void configure(SourceViewerConfiguration configuration) {
                        super.configure(configuration);
-                       //                              fCorrectionAssistant= new
+                       // fCorrectionAssistant = new
                        // JavaCorrectionAssistant(CompilationUnitEditor.this);
-                       //                              fCorrectionAssistant.install(this);
-                       //TODO install SmartBracesAutoEditStrategy
-                       //                              prependAutoEditStrategy(new SmartBracesAutoEditStrategy(this),
-                       // IDocument.DEFAULT_CONTENT_TYPE);
+                       // fCorrectionAssistant.install(this);
+                       IAutoEditStrategy smartSemi = new SmartSemicolonAutoEditStrategy(
+                                       IPHPPartitions.PHP_PARTITIONING);
+                       prependAutoEditStrategy(smartSemi, IDocument.DEFAULT_CONTENT_TYPE);
+                       prependAutoEditStrategy(smartSemi, IPHPPartitions.PHP_STRING_DQ);
+                       prependAutoEditStrategy(smartSemi, IPHPPartitions.PHP_STRING_SQ);
+                       prependAutoEditStrategy(smartSemi,
+                                       IPHPPartitions.PHP_STRING_HEREDOC);
+            
+                       fUndoManager.setMaximalUndoLevel (this.getUndoHistorySize ());  // Set every editor to the global 'Undo history size'
                }
-       };
+
+               /*
+                * @see org.eclipse.jface.text.source.SourceViewer#createFormattingContext()
+                * @since 3.0
+                */
+               public IFormattingContext createFormattingContext() {
+                       IFormattingContext context = new CommentFormattingContext();
+
+                       Map preferences;
+                       IJavaElement inputJavaElement = getInputJavaElement();
+                       IJavaProject javaProject = inputJavaElement != null ? inputJavaElement
+                                       .getJavaProject()
+                                       : null;
+                       if (javaProject == null)
+                               preferences = new HashMap(JavaCore.getOptions());
+                       else
+                               preferences = new HashMap(javaProject.getOptions(true));
+
+                       context.storeToMap(PreferenceConstants.getPreferenceStore(),
+                                       preferences, false);
+                       context.setProperty(
+                                       FormattingContextProperties.CONTEXT_PREFERENCES,
+                                       preferences);
+
+                       return context;
+               }
+       }
+
+       /**
+        * Remembers data related to the current selection to be able to restore it
+        * later.
+        * 
+        * @since 3.0
+        */
+       private class RememberedSelection {
+               /** The remembered selection start. */
+               private RememberedOffset fStartOffset = new RememberedOffset();
+
+               /** The remembered selection end. */
+               private RememberedOffset fEndOffset = new RememberedOffset();
+
+               /**
+                * Remember current selection.
+                */
+               public void remember() {
+                       /*
+                        * https://bugs.eclipse.org/bugs/show_bug.cgi?id=52257 This method
+                        * may be called inside an async call posted to the UI thread, so
+                        * protect against intermediate disposal of the editor.
+                        */
+                       ISourceViewer viewer = getSourceViewer();
+                       if (viewer != null) {
+                               IRegion selection = getSignedSelection(viewer);
+                               int startOffset = selection.getOffset();
+                               int endOffset = startOffset + selection.getLength();
+
+                               fStartOffset.setOffset(startOffset);
+                               fEndOffset.setOffset(endOffset);
+                       }
+               }
+
+               /**
+                * Restore remembered selection.
+                */
+               public void restore() {
+                       /*
+                        * https://bugs.eclipse.org/bugs/show_bug.cgi?id=52257 This method
+                        * may be called inside an async call posted to the UI thread, so
+                        * protect against intermediate disposal of the editor.
+                        */
+                       if (getSourceViewer() == null)
+                               return;
+
+                       try {
+
+                               int startOffset, endOffset;
+                               int revealStartOffset, revealEndOffset;
+                               if (showsHighlightRangeOnly()) {
+                                       IJavaElement newStartElement = fStartOffset.getElement();
+                                       startOffset = fStartOffset
+                                                       .getRememberedOffset(newStartElement);
+                                       revealStartOffset = fStartOffset.getRevealOffset(
+                                                       newStartElement, startOffset);
+                                       if (revealStartOffset == -1)
+                                               startOffset = -1;
+
+                                       IJavaElement newEndElement = fEndOffset.getElement();
+                                       endOffset = fEndOffset.getRememberedOffset(newEndElement);
+                                       revealEndOffset = fEndOffset.getRevealOffset(newEndElement,
+                                                       endOffset);
+                                       if (revealEndOffset == -1)
+                                               endOffset = -1;
+                               } else {
+                                       startOffset = fStartOffset.getOffset();
+                                       revealStartOffset = startOffset;
+                                       endOffset = fEndOffset.getOffset();
+                                       revealEndOffset = endOffset;
+                               }
+
+                               if (startOffset == -1) {
+                                       startOffset = endOffset; // fallback to caret offset
+                                       revealStartOffset = revealEndOffset;
+                               }
+
+                               if (endOffset == -1) {
+                                       endOffset = startOffset; // fallback to other offset
+                                       revealEndOffset = revealStartOffset;
+                               }
+
+                               IJavaElement element;
+                               if (endOffset == -1) {
+                                       // fallback to element selection
+                                       element = fEndOffset.getElement();
+                                       if (element == null)
+                                               element = fStartOffset.getElement();
+                                       if (element != null)
+                                               setSelection(element);
+                                       return;
+                               }
+
+                               if (isValidSelection(revealStartOffset, revealEndOffset
+                                               - revealStartOffset)
+                                               && isValidSelection(startOffset, endOffset
+                                                               - startOffset))
+                                       selectAndReveal(startOffset, endOffset - startOffset,
+                                                       revealStartOffset, revealEndOffset
+                                                                       - revealStartOffset);
+                       } finally {
+                               fStartOffset.clear();
+                               fEndOffset.clear();
+                       }
+               }
+
+               private boolean isValidSelection(int offset, int length) {
+                       IDocumentProvider provider = getDocumentProvider();
+                       if (provider != null) {
+                               IDocument document = provider.getDocument(getEditorInput());
+                               if (document != null) {
+                                       int end = offset + length;
+                                       int documentLength = document.getLength();
+                                       return 0 <= offset && offset <= documentLength && 0 <= end
+                                                       && end <= documentLength;
+                               }
+                       }
+                       return false;
+               }
+
+       }
+
+       /**
+        * Remembers additional data for a given offset to be able restore it later.
+        * 
+        * @since 3.0
+        */
+       private class RememberedOffset {
+               /** Remembered line for the given offset */
+               private int fLine;
+
+               /** Remembered column for the given offset */
+               private int fColumn;
+
+               /** Remembered Java element for the given offset */
+               private IJavaElement fElement;
+
+               /** Remembered Java element line for the given offset */
+               private int fElementLine;
+
+               /**
+                * Store visual properties of the given offset.
+                * 
+                * @param offset
+                *            Offset in the document
+                */
+               public void setOffset(int offset) {
+                       try {
+                               IDocument document = getSourceViewer().getDocument();
+                               fLine = document.getLineOfOffset(offset);
+                               fColumn = offset - document.getLineOffset(fLine);
+                               fElement = getElementAt(offset, true);
+
+                               fElementLine = -1;
+                               if (fElement instanceof IMember) {
+                                       ISourceRange range = ((IMember) fElement).getNameRange();
+                                       if (range != null)
+                                               fElementLine = document.getLineOfOffset(range
+                                                               .getOffset());
+                               }
+                               if (fElementLine == -1)
+                                       fElementLine = document
+                                                       .getLineOfOffset(getOffset(fElement));
+                       } catch (BadLocationException e) {
+                               // should not happen
+                               PHPeclipsePlugin.log(e);
+                               clear();
+                       } catch (JavaModelException e) {
+                               // should not happen
+                               PHPeclipsePlugin.log(e.getStatus());
+                               clear();
+                       }
+               }
+
+               /**
+                * Return offset recomputed from stored visual properties.
+                * 
+                * @return Offset in the document
+                */
+               public int getOffset() {
+                       IJavaElement newElement = getElement();
+
+                       int offset = getRememberedOffset(newElement);
+
+                       if (offset != -1 && !containsOffset(newElement, offset)
+                                       && (offset == 0 || !containsOffset(newElement, offset - 1)))
+                               return -1;
+
+                       return offset;
+               }
+
+               /**
+                * Return offset recomputed from stored visual properties.
+                * 
+                * @param newElement
+                *            Enclosing element
+                * @return Offset in the document
+                */
+               public int getRememberedOffset(IJavaElement newElement) {
+                       try {
+                               if (newElement == null)
+                                       return -1;
+
+                               IDocument document = getSourceViewer().getDocument();
+                               int newElementLine = -1;
+                               if (newElement instanceof IMember) {
+                                       ISourceRange range = ((IMember) newElement).getNameRange();
+                                       if (range != null)
+                                               newElementLine = document.getLineOfOffset(range
+                                                               .getOffset());
+                               }
+                               if (newElementLine == -1)
+                                       newElementLine = document
+                                                       .getLineOfOffset(getOffset(newElement));
+                               if (newElementLine == -1)
+                                       return -1;
+
+                               int newLine = fLine + newElementLine - fElementLine;
+                               if (newLine < 0 || newLine >= document.getNumberOfLines())
+                                       return -1;
+                               int maxColumn = document.getLineLength(newLine);
+                               String lineDelimiter = document.getLineDelimiter(newLine);
+                               if (lineDelimiter != null)
+                                       maxColumn = maxColumn - lineDelimiter.length();
+                               int offset;
+                               if (fColumn > maxColumn)
+                                       offset = document.getLineOffset(newLine) + maxColumn;
+                               else
+                                       offset = document.getLineOffset(newLine) + fColumn;
+
+                               return offset;
+                       } catch (BadLocationException e) {
+                               // should not happen
+                               PHPeclipsePlugin.log(e);
+                               return -1;
+                       } catch (JavaModelException e) {
+                               // should not happen
+                               PHPeclipsePlugin.log(e.getStatus());
+                               return -1;
+                       }
+               }
+
+               /**
+                * Returns the offset used to reveal the given element based on the
+                * given selection offset.
+                * 
+                * @param element
+                *            the element
+                * @param offset
+                *            the selection offset
+                * @return the offset to reveal the given element based on the given
+                *         selection offset
+                */
+               public int getRevealOffset(IJavaElement element, int offset) {
+                       if (element == null || offset == -1)
+                               return -1;
+
+                       if (containsOffset(element, offset)) {
+                               if (offset > 0) {
+                                       IJavaElement alternateElement = getElementAt(offset, false);
+                                       if (element.getHandleIdentifier().equals(
+                                                       alternateElement.getParent().getHandleIdentifier()))
+                                               return offset - 1; // Solves test case 2 from
+                                                                                       // https://bugs.eclipse.org/bugs/show_bug.cgi?id=47727#c3
+                               }
+                               return offset;
+                       } else if (offset > 0 && containsOffset(element, offset - 1))
+                               return offset - 1; // Solves test case 1 from
+                                                                       // https://bugs.eclipse.org/bugs/show_bug.cgi?id=47727#c3
+
+                       return -1;
+               }
+
+               /**
+                * Return Java element recomputed from stored visual properties.
+                * 
+                * @return Java element
+                */
+               public IJavaElement getElement() {
+                       if (fElement == null)
+                               return null;
+
+                       return findElement(fElement);
+               }
+
+               /**
+                * Clears the stored position
+                */
+               public void clear() {
+                       fLine = -1;
+                       fColumn = -1;
+                       fElement = null;
+                       fElementLine = -1;
+               }
+
+               /**
+                * Does the given Java element contain the given offset?
+                * 
+                * @param element
+                *            Java element
+                * @param offset
+                *            Offset
+                * @return <code>true</code> iff the Java element contains the offset
+                */
+               private boolean containsOffset(IJavaElement element, int offset) {
+                       int elementOffset = getOffset(element);
+                       int elementLength = getLength(element);
+                       return (elementOffset > -1 && elementLength > -1) ? (offset >= elementOffset && offset < elementOffset
+                                       + elementLength)
+                                       : false;
+               }
+
+               /**
+                * Returns the offset of the given Java element.
+                * 
+                * @param element
+                *            Java element
+                * @return Offset of the given Java element
+                */
+               private int getOffset(IJavaElement element) {
+                       if (element instanceof ISourceReference) {
+                               ISourceReference sr = (ISourceReference) element;
+                               try {
+                                       ISourceRange srcRange = sr.getSourceRange();
+                                       if (srcRange != null)
+                                               return srcRange.getOffset();
+                               } catch (JavaModelException e) {
+                               }
+                       }
+                       return -1;
+               }
+
+               /**
+                * Returns the length of the given Java element.
+                * 
+                * @param element
+                *            Java element
+                * @return Length of the given Java element
+                */
+               private int getLength(IJavaElement element) {
+                       if (element instanceof ISourceReference) {
+                               ISourceReference sr = (ISourceReference) element;
+                               try {
+                                       ISourceRange srcRange = sr.getSourceRange();
+                                       if (srcRange != null)
+                                               return srcRange.getLength();
+                               } catch (JavaModelException e) {
+                               }
+                       }
+                       return -1;
+               }
+
+               /**
+                * Returns the updated java element for the old java element.
+                * 
+                * @param element
+                *            Old Java element
+                * @return Updated Java element
+                */
+               private IJavaElement findElement(IJavaElement element) {
+
+                       if (element == null)
+                               return null;
+
+                       IWorkingCopyManager manager = PHPeclipsePlugin.getDefault()
+                                       .getWorkingCopyManager();
+                       ICompilationUnit unit = manager.getWorkingCopy(getEditorInput());
+
+                       if (unit != null) {
+                               try {
+
+                                       synchronized (unit) {
+                                               // unit.reconcile(ICompilationUnit.NO_AST, false, null,
+                                               // null);
+                                               unit.reconcile();
+                                       }
+                                       IJavaElement[] findings = unit.findElements(element);
+                                       if (findings != null && findings.length > 0)
+                                               return findings[0];
+
+                               } catch (JavaModelException x) {
+                                       PHPeclipsePlugin.log(x.getStatus());
+                                       // nothing found, be tolerant and go on
+                               }
+                       }
+
+                       return null;
+               }
+
+       }
+
        static class TabConverter implements ITextConverter {
                private int fTabRatio;
+
                private ILineTracker fLineTracker;
+
                public TabConverter() {
                }
+
                public void setNumberOfSpacesPerTab(int ratio) {
                        fTabRatio = ratio;
                }
+
                public void setLineTracker(ILineTracker lineTracker) {
                        fLineTracker = lineTracker;
                }
+
                private int insertTabString(StringBuffer buffer, int offsetInLine) {
                        if (fTabRatio == 0)
                                return 0;
@@ -518,6 +885,7 @@ public class PHPUnitEditor extends PHPEditor{ //implements IJavaReconcilingListe
                                buffer.append(' ');
                        return remainder;
                }
+
                public void customizeDocumentCommand(IDocument document,
                                DocumentCommand command) {
                        String text = command.text;
@@ -556,11 +924,14 @@ public class PHPUnitEditor extends PHPEditor{ //implements IJavaReconcilingListe
                        }
                }
        };
+
        private static class ExitPolicy implements LinkedPositionUI.ExitPolicy {
                final char fExitCharacter;
+
                public ExitPolicy(char exitCharacter) {
                        fExitCharacter = exitCharacter;
                }
+
                /*
                 * @see org.phpeclipse.phpdt.internal.ui.text.link.LinkedPositionUI.ExitPolicy#doExit(org.phpeclipse.phpdt.internal.ui.text.link.LinkedPositionManager,
                 *      org.eclipse.swt.events.VerifyEvent, int, int)
@@ -574,48 +945,67 @@ public class PHPUnitEditor extends PHPEditor{ //implements IJavaReconcilingListe
                                else
                                        return new ExitFlags(LinkedPositionUI.COMMIT, true);
                        }
+                       // Fix for #1380415 (toshihiro) start 
+                   switch (event.keyCode) {
+                   case SWT.ARROW_UP:
+                   case SWT.ARROW_DOWN:
+                     return new ExitFlags(LinkedPositionUI.COMMIT, true);
+                   case SWT.ARROW_LEFT:
+                   case SWT.ARROW_RIGHT:
+                      if (!manager.anyPositionIncludes(offset, length))
+                        return new ExitFlags(LinkedPositionUI.COMMIT, true);
+                      break;
+                   }
+                   // #1380415 end 
                        switch (event.character) {
-                               case '\b' :
-                                       if (manager.getFirstPosition().length == 0)
-                                               return new ExitFlags(0, false);
-                                       else
-                                               return null;
-                               case '\n' :
-                               case '\r' :
-                                       return new ExitFlags(LinkedPositionUI.COMMIT, true);
-                               default :
+                       case '\b':
+                               if (manager.getFirstPosition().length == 0)
+                                       return new ExitFlags(0, false);
+                               else
                                        return null;
+                       case '\n':
+                       case '\r':
+                               return new ExitFlags(LinkedPositionUI.COMMIT, true);
+                       default:
+                               return null;
                        }
                }
        }
+
        private static class BracketLevel {
                int fOffset;
+
                int fLength;
+
                LinkedPositionManager fManager;
+
                LinkedPositionUI fEditor;
        };
-       private class BracketInserter
-                       implements
-                               VerifyKeyListener,
-                               LinkedPositionUI.ExitListener {
+
+       private class BracketInserter implements VerifyKeyListener,
+                       LinkedPositionUI.ExitListener {
                private boolean fCloseBracketsPHP = true;
-               private boolean fCloseStringsPHP = true;
-               private boolean fCloseBracketsHTML = true;
-               private boolean fCloseStringsHTML = true;
+
+               private boolean fCloseStringsPHPDQ = true;
+
+               private boolean fCloseStringsPHPSQ = true;
+
                private int fOffset;
+
                private int fLength;
+
                public void setCloseBracketsPHPEnabled(boolean enabled) {
                        fCloseBracketsPHP = enabled;
                }
-               public void setCloseStringsPHPEnabled(boolean enabled) {
-                       fCloseStringsPHP = enabled;
-               }
-               public void setCloseBracketsHTMLEnabled(boolean enabled) {
-                       fCloseBracketsHTML = enabled;
+
+               public void setCloseStringsPHPDQEnabled(boolean enabled) {
+                       fCloseStringsPHPDQ = enabled;
                }
-               public void setCloseStringsHTMLEnabled(boolean enabled) {
-                       fCloseStringsHTML = enabled;
+
+               public void setCloseStringsPHPSQEnabled(boolean enabled) {
+                       fCloseStringsPHPSQ = enabled;
                }
+
                private boolean hasIdentifierToTheRight(IDocument document, int offset) {
                        try {
                                int end = offset;
@@ -631,6 +1021,7 @@ public class PHPUnitEditor extends PHPEditor{ //implements IJavaReconcilingListe
                                return true;
                        }
                }
+
                private boolean hasIdentifierToTheLeft(IDocument document, int offset) {
                        try {
                                int start = offset;
@@ -646,6 +1037,23 @@ public class PHPUnitEditor extends PHPEditor{ //implements IJavaReconcilingListe
                                return true;
                        }
                }
+
+               private boolean hasCharacterToTheLeft(IDocument document, int offset,
+                               char character) {
+                       try {
+                               int start = offset;
+                               IRegion startLine = document.getLineInformationOfOffset(start);
+                               int minStart = startLine.getOffset();
+                               while (start != minStart
+                                               && Character.isWhitespace(document.getChar(start - 1)))
+                                       --start;
+                               return start != minStart
+                                               && document.getChar(start - 1) == character;
+                       } catch (BadLocationException e) {
+                               return false;
+                       }
+               }
+
                private boolean hasCharacterToTheRight(IDocument document, int offset,
                                char character) {
                        try {
@@ -661,6 +1069,7 @@ public class PHPUnitEditor extends PHPEditor{ //implements IJavaReconcilingListe
                                return true;
                        }
                }
+
                /*
                 * @see org.eclipse.swt.custom.VerifyKeyListener#verifyKey(org.eclipse.swt.events.VerifyEvent)
                 */
@@ -675,121 +1084,161 @@ public class PHPUnitEditor extends PHPEditor{ //implements IJavaReconcilingListe
                        try {
                                ITypedRegion partition = document.getPartition(offset);
                                String type = partition.getType();
-                               if (type.equals(IPHPPartitions.PHP_PARTITIONING)) {
+                               if (type.equals(IPHPPartitions.PHP_PARTITIONING)
+                                               || type.equals(IDocument.DEFAULT_CONTENT_TYPE)) {
+                                       // you will get IDocument.DEFAULT_CONTENT_TYPE for both PHP
+                                       // and HTML area
                                        switch (event.character) {
-                                               case '(' :
-                                                       if (hasCharacterToTheRight(document, offset
-                                                                       + length, '('))
-                                                               return;
+                                       case '(':
+                                               if (hasCharacterToTheRight(document, offset + length,
+                                                               '('))
+                                                       return;
+                                               // fall through
+                                       case '[':
+                                               if (!fCloseBracketsPHP)
+                                                       return;
+                                               if (hasIdentifierToTheRight(document, offset + length))
+                                                       return;
+                                               // fall through
+                                       case '{':
+                                               if (!fCloseBracketsPHP)
+                                                       return;
+                                               if (hasIdentifierToTheRight(document, offset + length))
+                                                       return;
                                                // fall through
-                                               case '[' :
-                                                       if (!fCloseBracketsPHP)
+                                       case '"':
+                                               if (event.character == '"') {
+                                                       if (!fCloseStringsPHPDQ)
                                                                return;
+                                                       // changed for statements like echo "" print ""
+                                                       // if (hasIdentifierToTheLeft(document, offset)
+                                                       // ||
+                                                       // hasIdentifierToTheRight(document, offset +
+                                                       // length))
                                                        if (hasIdentifierToTheRight(document, offset
                                                                        + length))
                                                                return;
-                                               // fall through
-                                               case '"' :
-                                                       if (event.character == '"') {
-                                                               if (!fCloseStringsPHP)
-                                                                       return;
-                                                               // changed for statements like echo "" print ""
-                                                               //    if (hasIdentifierToTheLeft(document, offset)
-                                                               // ||
-                                                               // hasIdentifierToTheRight(document, offset +
-                                                               // length))
-                                                               if (hasIdentifierToTheRight(document, offset
-                                                                               + length))
-                                                                       return;
-                                                       }
-                                                       //     ITypedRegion partition=
-                                                       // document.getPartition(offset);
-                                                       //       if (!
-                                                       // IDocument.DEFAULT_CONTENT_TYPE.equals(partition.getType())
-                                                       // &&
-                                                       // (partition.getOffset() != offset))
-                                                       //         return;
-                                                       final char character = event.character;
-                                                       final char closingCharacter = getPeerCharacter(character);
-                                                       final StringBuffer buffer = new StringBuffer();
-                                                       buffer.append(character);
-                                                       buffer.append(closingCharacter);
-                                                       document.replace(offset, length, buffer.toString());
-                                                       LinkedPositionManager manager = new LinkedPositionManager(
-                                                                       document);
-                                                       manager.addPosition(offset + 1, 0);
-                                                       fOffset = offset;
-                                                       fLength = 2;
-                                                       LinkedPositionUI editor = new LinkedPositionUI(
-                                                                       sourceViewer, manager);
-                                                       editor.setCancelListener(this);
-                                                       editor.setExitPolicy(new ExitPolicy(
-                                                                       closingCharacter));
-                                                       editor.setFinalCaretOffset(offset + 2);
-                                                       editor.enter();
-                                                       IRegion newSelection = editor.getSelectedRegion();
-                                                       sourceViewer.setSelectedRange(newSelection
-                                                                       .getOffset(), newSelection.getLength());
-                                                       event.doit = false;
-                                       }
-                               } else if (type.equals(IPHPPartitions.HTML)
-                                               || type.equals(IDocument.DEFAULT_CONTENT_TYPE)) {
-                                       switch (event.character) {
-                                               case '(' :
-                                                       if (hasCharacterToTheRight(document, offset
-                                                                       + length, '('))
-                                                               return;
-                                               // fall through
-                                               case '[' :
-                                                       if (!fCloseBracketsHTML)
+                                               }
+                                               // ITypedRegion partition=
+                                               // document.getPartition(offset);
+                                               // if (!
+                                               // IDocument.DEFAULT_CONTENT_TYPE.equals(partition.getType())
+                                               // &&
+                                               // (partition.getOffset() != offset))
+                                               // return;
+                                               final char characterDQ = event.character;
+                                               final char closingCharacterDQ = getPeerCharacter(characterDQ);
+                                               final StringBuffer bufferDQ = new StringBuffer();
+                                               bufferDQ.append(characterDQ);
+                                               bufferDQ.append(closingCharacterDQ);
+                                               document.replace(offset, length, bufferDQ.toString());
+                                               LinkedPositionManager managerDQ = new LinkedPositionManager(
+                                                               document);
+                                               managerDQ.addPosition(offset + 1, 0);
+                                               fOffset = offset;
+                                               fLength = 2;
+                                               LinkedPositionUI editorDQ = new LinkedPositionUI(
+                                                               sourceViewer, managerDQ);
+                                               editorDQ.setCancelListener(this);
+                                               editorDQ.setExitPolicy(new ExitPolicy(
+                                                               closingCharacterDQ));
+                                               editorDQ.setFinalCaretOffset(offset + 2);
+                                               editorDQ.enter();
+                                               IRegion newSelectionDQ = editorDQ.getSelectedRegion();
+                                               sourceViewer.setSelectedRange(newSelectionDQ
+                                                               .getOffset(), newSelectionDQ.getLength());
+                                               event.doit = false;
+                                               break;
+                                       case '\'':
+                                               if (event.character == '\'') {
+                                                       if (!fCloseStringsPHPSQ)
                                                                return;
+                                                       // changed for statements like echo "" print ""
+                                                       // if (hasIdentifierToTheLeft(document, offset)
+                                                       // ||
+                                                       // hasIdentifierToTheRight(document, offset +
+                                                       // length))
                                                        if (hasIdentifierToTheRight(document, offset
                                                                        + length))
                                                                return;
-                                               // fall through
-                                               case '"' :
-                                                       if (event.character == '"') {
-                                                               if (!fCloseStringsHTML)
-                                                                       return;
-                                                               if (hasIdentifierToTheLeft(document, offset)
-                                                                               || hasIdentifierToTheRight(document,
-                                                                                               offset + length))
-                                                                       return;
+                                               }
+                                               // ITypedRegion partition=
+                                               // document.getPartition(offset);
+                                               // if (!
+                                               // IDocument.DEFAULT_CONTENT_TYPE.equals(partition.getType())
+                                               // &&
+                                               // (partition.getOffset() != offset))
+                                               // return;
+                                               final char characterSQ = event.character;
+                                               final char closingCharacterSQ = getPeerCharacter(characterSQ);
+                                               final StringBuffer bufferSQ = new StringBuffer();
+                                               bufferSQ.append(characterSQ);
+                                               bufferSQ.append(closingCharacterSQ);
+                                               document.replace(offset, length, bufferSQ.toString());
+                                               LinkedPositionManager managerSQ = new LinkedPositionManager(
+                                                               document);
+                                               managerSQ.addPosition(offset + 1, 0);
+                                               fOffset = offset;
+                                               fLength = 2;
+                                               LinkedPositionUI editorSQ = new LinkedPositionUI(
+                                                               sourceViewer, managerSQ);
+                                               editorSQ.setCancelListener(this);
+                                               editorSQ.setExitPolicy(new ExitPolicy(
+                                                               closingCharacterSQ));
+                                               editorSQ.setFinalCaretOffset(offset + 2);
+                                               editorSQ.enter();
+                                               IRegion newSelectionSQ = editorSQ.getSelectedRegion();
+                                               sourceViewer.setSelectedRange(newSelectionSQ
+                                                               .getOffset(), newSelectionSQ.getLength());
+                                               event.doit = false;
+                                       case '\r': { // insert linebreaks and new closing brace
+                                                                       // after brace and return
+                                               if (!fCloseBracketsPHP) {
+                                                       return;
+                                               }
+                                               if (hasCharacterToTheLeft(document, offset, '{')
+                                                               && hasCharacterToTheRight(document, offset, '}')) {
+                                                       String lineDelimiter = StubUtility
+                                                                       .getLineDelimiterFor(document);
+                                                       int caretPos = sourceViewer.getTextWidget()
+                                                                       .getCaretOffset();
+                                                       final StringBuffer buffer = new StringBuffer(
+                                                                       lineDelimiter);
+                                                       // get indentation
+                                                       IRegion line = document
+                                                                       .getLineInformationOfOffset(offset);
+                                                       String currentLine = document.get(line.getOffset(),
+                                                                       line.getLength());
+                                                       int index = 0;
+                                                       int max = currentLine.length();
+                                                       StringBuffer indent = new StringBuffer();
+                                                       while (index < max
+                                                                       && Character.isWhitespace(currentLine
+                                                                                       .charAt(index))) {
+                                                               indent.append(currentLine.charAt(index));
+                                                               index++;
                                                        }
-                                                       //     ITypedRegion partition=
-                                                       // document.getPartition(offset);
-                                                       //       if (!
-                                                       // IDocument.DEFAULT_CONTENT_TYPE.equals(partition.getType())
-                                                       // &&
-                                                       // (partition.getOffset() != offset))
-                                                       //         return;
-                                                       final char character = event.character;
-                                                       final char closingCharacter = getPeerCharacter(character);
-                                                       final StringBuffer buffer = new StringBuffer();
-                                                       buffer.append(character);
-                                                       buffer.append(closingCharacter);
-                                                       document.replace(offset, length, buffer.toString());
-                                                       LinkedPositionManager manager = new LinkedPositionManager(
+                                                       buffer.append(indent);
+                                                       JavaHeuristicScanner scanner = new JavaHeuristicScanner(
                                                                        document);
-                                                       manager.addPosition(offset + 1, 0);
-                                                       fOffset = offset;
-                                                       fLength = 2;
-                                                       LinkedPositionUI editor = new LinkedPositionUI(
-                                                                       sourceViewer, manager);
-                                                       editor.setCancelListener(this);
-                                                       editor.setExitPolicy(new ExitPolicy(
-                                                                       closingCharacter));
-                                                       editor.setFinalCaretOffset(offset + 2);
-                                                       editor.enter();
-                                                       IRegion newSelection = editor.getSelectedRegion();
-                                                       sourceViewer.setSelectedRange(newSelection
-                                                                       .getOffset(), newSelection.getLength());
+                                                       JavaIndenter indenter = new JavaIndenter(document,
+                                                                       scanner);
+                                                       buffer.append(indenter.createIndent(1));
+                                                       int cursorPos = buffer.length();
+                                                       buffer.append(lineDelimiter);
+                                                       buffer.append(indent);
+                                                       document.replace(offset, length, buffer.toString());
+                                                       sourceViewer.getTextWidget().setCaretOffset(
+                                                                       caretPos + cursorPos);
                                                        event.doit = false;
+                                               }
+                                       }
                                        }
                                }
                        } catch (BadLocationException e) {
                        }
                }
+
                /*
                 * @see org.phpeclipse.phpdt.internal.ui.text.link.LinkedPositionUI.ExitListener#exit(boolean)
                 */
@@ -805,194 +1254,263 @@ public class PHPUnitEditor extends PHPEditor{ //implements IJavaReconcilingListe
                        }
                }
        }
+
        /** The editor's save policy */
        protected ISavePolicy fSavePolicy;
+
        /**
         * Listener to annotation model changes that updates the error tick in the
         * tab image
         */
        private JavaEditorErrorTickUpdater fJavaEditorErrorTickUpdater;
+
        /** The editor's paint manager */
-       //  private PaintManager fPaintManager;
+       // private PaintManager fPaintManager;
        /** The editor's bracket painter */
-       private BracketPainter fBracketPainter;
+       // private BracketPainter fBracketPainter;
        /** The editor's bracket matcher */
        private PHPPairMatcher fBracketMatcher;
+
        /** The editor's line painter */
-       private LinePainter fLinePainter;
+       // private LinePainter fLinePainter;
        /** The editor's print margin ruler painter */
-       private PrintMarginPainter fPrintMarginPainter;
+       // private PrintMarginPainter fPrintMarginPainter;
        /** The editor's problem painter */
-       //  private ProblemPainter fProblemPainter;
+       // private ProblemPainter fProblemPainter;
        /** The editor's tab converter */
        private TabConverter fTabConverter;
+
        /** History for structure select action */
-       //private SelectionHistory fSelectionHistory;
+       // private SelectionHistory fSelectionHistory;
        /** The preference property change listener for php core. */
-       //  private IPropertyChangeListener fPropertyChangeListener = new
+       // private IPropertyChangeListener fPropertyChangeListener = new
        // PropertyChangeListener();
        /** The remembered java element */
        private IJavaElement fRememberedElement;
-       /** The remembered selection */
-       private ITextSelection fRememberedSelection;
+
+       /**
+        * The remembered selection.
+        * 
+        * @since 3.0
+        */
+       private RememberedSelection fRememberedSelection = new RememberedSelection();
+
        /** The remembered php element offset */
        private int fRememberedElementOffset;
+
        /** The bracket inserter. */
        private BracketInserter fBracketInserter = new BracketInserter();
 
        /** The standard action groups added to the menu */
        private GenerateActionGroup fGenerateActionGroup;
+
        private CompositeActionGroup fContextMenuGroup;
-       //  private class PropertyChangeListener implements IPropertyChangeListener {
-       //    /*
-       //     * @see IPropertyChangeListener#propertyChange(PropertyChangeEvent)
-       //     */
-       //    public void
+
+       // private class PropertyChangeListener implements IPropertyChangeListener {
+       // /*
+       // * @see IPropertyChangeListener#propertyChange(PropertyChangeEvent)
+       // */
+       // public void
        // propertyChange(org.eclipse.core.runtime.Preferences.PropertyChangeEvent
        // event) {
-       //      handlePreferencePropertyChanged(event);
-       //    }
-       //  }
+       // handlePreferencePropertyChanged(event);
+       // }
+       // }
        /* Preference key for code formatter tab size */
        private final static String CODE_FORMATTER_TAB_SIZE = JavaCore.FORMATTER_TAB_SIZE;
+
        /** Preference key for matching brackets */
-       private final static String MATCHING_BRACKETS = PreferenceConstants.EDITOR_MATCHING_BRACKETS;
+       // private final static String MATCHING_BRACKETS =
+       // PreferenceConstants.EDITOR_MATCHING_BRACKETS;
        /** Preference key for matching brackets color */
-       private final static String MATCHING_BRACKETS_COLOR = PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR;
+       // private final static String MATCHING_BRACKETS_COLOR =
+       // PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR;
        /** Preference key for highlighting current line */
-       private final static String CURRENT_LINE = PreferenceConstants.EDITOR_CURRENT_LINE;
+       // private final static String CURRENT_LINE =
+       // PreferenceConstants.EDITOR_CURRENT_LINE;
        /** Preference key for highlight color of current line */
-       private final static String CURRENT_LINE_COLOR = PreferenceConstants.EDITOR_CURRENT_LINE_COLOR;
+       // private final static String CURRENT_LINE_COLOR =
+       // PreferenceConstants.EDITOR_CURRENT_LINE_COLOR;
        /** Preference key for showing print marging ruler */
-       private final static String PRINT_MARGIN = PreferenceConstants.EDITOR_PRINT_MARGIN;
+       // private final static String PRINT_MARGIN =
+       // PreferenceConstants.EDITOR_PRINT_MARGIN;
        /** Preference key for print margin ruler color */
-       private final static String PRINT_MARGIN_COLOR = PreferenceConstants.EDITOR_PRINT_MARGIN_COLOR;
+       // private final static String PRINT_MARGIN_COLOR =
+       // PreferenceConstants.EDITOR_PRINT_MARGIN_COLOR;
        /** Preference key for print margin ruler column */
-       private final static String PRINT_MARGIN_COLUMN = PreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN;
+       // private final static String PRINT_MARGIN_COLUMN =
+       // PreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN;
        /** Preference key for inserting spaces rather than tabs */
        private final static String SPACES_FOR_TABS = PreferenceConstants.EDITOR_SPACES_FOR_TABS;
+
        /** Preference key for error indication */
-       //  private final static String ERROR_INDICATION =
+       // private final static String ERROR_INDICATION =
        // PreferenceConstants.EDITOR_PROBLEM_INDICATION;
        /** Preference key for error color */
-       //  private final static String ERROR_INDICATION_COLOR =
+       // private final static String ERROR_INDICATION_COLOR =
        // PreferenceConstants.EDITOR_PROBLEM_INDICATION_COLOR;
        /** Preference key for warning indication */
-       //  private final static String WARNING_INDICATION =
+       // private final static String WARNING_INDICATION =
        // PreferenceConstants.EDITOR_WARNING_INDICATION;
        /** Preference key for warning color */
-       //  private final static String WARNING_INDICATION_COLOR =
+       // private final static String WARNING_INDICATION_COLOR =
        // PreferenceConstants.EDITOR_WARNING_INDICATION_COLOR;
        /** Preference key for task indication */
        private final static String TASK_INDICATION = PreferenceConstants.EDITOR_TASK_INDICATION;
+
        /** Preference key for task color */
        private final static String TASK_INDICATION_COLOR = PreferenceConstants.EDITOR_TASK_INDICATION_COLOR;
+
        /** Preference key for bookmark indication */
        private final static String BOOKMARK_INDICATION = PreferenceConstants.EDITOR_BOOKMARK_INDICATION;
+
        /** Preference key for bookmark color */
        private final static String BOOKMARK_INDICATION_COLOR = PreferenceConstants.EDITOR_BOOKMARK_INDICATION_COLOR;
+
        /** Preference key for search result indication */
        private final static String SEARCH_RESULT_INDICATION = PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION;
+
        /** Preference key for search result color */
        private final static String SEARCH_RESULT_INDICATION_COLOR = PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION_COLOR;
+
        /** Preference key for unknown annotation indication */
        private final static String UNKNOWN_INDICATION = PreferenceConstants.EDITOR_UNKNOWN_INDICATION;
+
        /** Preference key for unknown annotation color */
        private final static String UNKNOWN_INDICATION_COLOR = PreferenceConstants.EDITOR_UNKNOWN_INDICATION_COLOR;
+
        /** Preference key for linked position color */
        private final static String LINKED_POSITION_COLOR = PreferenceConstants.EDITOR_LINKED_POSITION_COLOR;
+
        /** Preference key for shwoing the overview ruler */
        private final static String OVERVIEW_RULER = PreferenceConstants.EDITOR_OVERVIEW_RULER;
+
        /** Preference key for error indication in overview ruler */
        private final static String ERROR_INDICATION_IN_OVERVIEW_RULER = PreferenceConstants.EDITOR_ERROR_INDICATION_IN_OVERVIEW_RULER;
+
        /** Preference key for warning indication in overview ruler */
        private final static String WARNING_INDICATION_IN_OVERVIEW_RULER = PreferenceConstants.EDITOR_WARNING_INDICATION_IN_OVERVIEW_RULER;
+
        /** Preference key for task indication in overview ruler */
        private final static String TASK_INDICATION_IN_OVERVIEW_RULER = PreferenceConstants.EDITOR_TASK_INDICATION_IN_OVERVIEW_RULER;
+
        /** Preference key for bookmark indication in overview ruler */
        private final static String BOOKMARK_INDICATION_IN_OVERVIEW_RULER = PreferenceConstants.EDITOR_BOOKMARK_INDICATION_IN_OVERVIEW_RULER;
+
        /** Preference key for search result indication in overview ruler */
        private final static String SEARCH_RESULT_INDICATION_IN_OVERVIEW_RULER = PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION_IN_OVERVIEW_RULER;
+
        /** Preference key for unknown annotation indication in overview ruler */
        private final static String UNKNOWN_INDICATION_IN_OVERVIEW_RULER = PreferenceConstants.EDITOR_UNKNOWN_INDICATION_IN_OVERVIEW_RULER;
-       /** Preference key for automatically closing strings */
-       private final static String CLOSE_STRINGS_PHP = PreferenceConstants.EDITOR_CLOSE_STRINGS_PHP;
+
+       /** Preference key for automatically closing double quoted strings */
+       private final static String CLOSE_STRINGS_DQ_PHP = PreferenceConstants.EDITOR_CLOSE_STRINGS_DQ_PHP;
+
+       /** Preference key for automatically closing single quoted strings */
+       private final static String CLOSE_STRINGS_SQ_PHP = PreferenceConstants.EDITOR_CLOSE_STRINGS_SQ_PHP;
+
        /** Preference key for automatically wrapping Java strings */
-       private final static String WRAP_STRINGS = PreferenceConstants.EDITOR_WRAP_STRINGS;
+       // private final static String WRAP_STRINGS =
+       // PreferenceConstants.EDITOR_WRAP_STRINGS_DQ;
        /** Preference key for automatically closing brackets and parenthesis */
        private final static String CLOSE_BRACKETS_PHP = PreferenceConstants.EDITOR_CLOSE_BRACKETS_PHP;
+
        /** Preference key for automatically closing phpdocs and comments */
        private final static String CLOSE_JAVADOCS = PreferenceConstants.EDITOR_CLOSE_JAVADOCS;
+
        /** Preference key for automatically adding phpdoc tags */
        private final static String ADD_JAVADOC_TAGS = PreferenceConstants.EDITOR_ADD_JAVADOC_TAGS;
+
        /** Preference key for automatically formatting phpdocs */
-       private final static String FORMAT_JAVADOCS = PreferenceConstants.EDITOR_FORMAT_JAVADOCS;
+       // private final static String FORMAT_JAVADOCS =
+       // PreferenceConstants.EDITOR_FORMAT_JAVADOCS;
        /** Preference key for automatically closing strings */
        private final static String CLOSE_STRINGS_HTML = PreferenceConstants.EDITOR_CLOSE_STRINGS_HTML;
+
        /** Preference key for automatically closing brackets and parenthesis */
        private final static String CLOSE_BRACKETS_HTML = PreferenceConstants.EDITOR_CLOSE_BRACKETS_HTML;
+
        /** Preference key for smart paste */
        private final static String SMART_PASTE = PreferenceConstants.EDITOR_SMART_PASTE;
-       //  private final static class AnnotationInfo {
-       //    public String fColorPreference;
-       //    public String fOverviewRulerPreference;
-       //    public String fEditorPreference;
-       //  };
-       //  private final static Map ANNOTATION_MAP;
-       //  static {
+
+       // private final static class AnnotationInfo {
+       // public String fColorPreference;
+       // public String fOverviewRulerPreference;
+       // public String fEditorPreference;
+       // };
+       // private final static Map ANNOTATION_MAP;
+       // static {
        //
-       //    AnnotationInfo info;
-       //    ANNOTATION_MAP = new HashMap();
+       // AnnotationInfo info;
+       // ANNOTATION_MAP = new HashMap();
        //
-       //    info = new AnnotationInfo();
-       //    info.fColorPreference = TASK_INDICATION_COLOR;
-       //    info.fOverviewRulerPreference = TASK_INDICATION_IN_OVERVIEW_RULER;
-       //    info.fEditorPreference = TASK_INDICATION;
-       //    ANNOTATION_MAP.put(AnnotationType.TASK, info);
+       // info = new AnnotationInfo();
+       // info.fColorPreference = TASK_INDICATION_COLOR;
+       // info.fOverviewRulerPreference = TASK_INDICATION_IN_OVERVIEW_RULER;
+       // info.fEditorPreference = TASK_INDICATION;
+       // ANNOTATION_MAP.put(AnnotationType.TASK, info);
        //
-       //    info = new AnnotationInfo();
-       //    info.fColorPreference = ERROR_INDICATION_COLOR;
-       //    info.fOverviewRulerPreference = ERROR_INDICATION_IN_OVERVIEW_RULER;
-       //    info.fEditorPreference = ERROR_INDICATION;
-       //    ANNOTATION_MAP.put(AnnotationType.ERROR, info);
+       // info = new AnnotationInfo();
+       // info.fColorPreference = ERROR_INDICATION_COLOR;
+       // info.fOverviewRulerPreference = ERROR_INDICATION_IN_OVERVIEW_RULER;
+       // info.fEditorPreference = ERROR_INDICATION;
+       // ANNOTATION_MAP.put(AnnotationType.ERROR, info);
        //
-       //    info = new AnnotationInfo();
-       //    info.fColorPreference = WARNING_INDICATION_COLOR;
-       //    info.fOverviewRulerPreference = WARNING_INDICATION_IN_OVERVIEW_RULER;
-       //    info.fEditorPreference = WARNING_INDICATION;
-       //    ANNOTATION_MAP.put(AnnotationType.WARNING, info);
+       // info = new AnnotationInfo();
+       // info.fColorPreference = WARNING_INDICATION_COLOR;
+       // info.fOverviewRulerPreference = WARNING_INDICATION_IN_OVERVIEW_RULER;
+       // info.fEditorPreference = WARNING_INDICATION;
+       // ANNOTATION_MAP.put(AnnotationType.WARNING, info);
        //
-       //    info = new AnnotationInfo();
-       //    info.fColorPreference = BOOKMARK_INDICATION_COLOR;
-       //    info.fOverviewRulerPreference = BOOKMARK_INDICATION_IN_OVERVIEW_RULER;
-       //    info.fEditorPreference = BOOKMARK_INDICATION;
-       //    ANNOTATION_MAP.put(AnnotationType.BOOKMARK, info);
+       // info = new AnnotationInfo();
+       // info.fColorPreference = BOOKMARK_INDICATION_COLOR;
+       // info.fOverviewRulerPreference = BOOKMARK_INDICATION_IN_OVERVIEW_RULER;
+       // info.fEditorPreference = BOOKMARK_INDICATION;
+       // ANNOTATION_MAP.put(AnnotationType.BOOKMARK, info);
        //
-       //    info = new AnnotationInfo();
-       //    info.fColorPreference = SEARCH_RESULT_INDICATION_COLOR;
-       //    info.fOverviewRulerPreference =
+       // info = new AnnotationInfo();
+       // info.fColorPreference = SEARCH_RESULT_INDICATION_COLOR;
+       // info.fOverviewRulerPreference =
        // SEARCH_RESULT_INDICATION_IN_OVERVIEW_RULER;
-       //    info.fEditorPreference = SEARCH_RESULT_INDICATION;
-       //    ANNOTATION_MAP.put(AnnotationType.SEARCH, info);
+       // info.fEditorPreference = SEARCH_RESULT_INDICATION;
+       // ANNOTATION_MAP.put(AnnotationType.SEARCH, info);
        //
-       //    info = new AnnotationInfo();
-       //    info.fColorPreference = UNKNOWN_INDICATION_COLOR;
-       //    info.fOverviewRulerPreference = UNKNOWN_INDICATION_IN_OVERVIEW_RULER;
-       //    info.fEditorPreference = UNKNOWN_INDICATION;
-       //    ANNOTATION_MAP.put(AnnotationType.UNKNOWN, info);
-       //  };
+       // info = new AnnotationInfo();
+       // info.fColorPreference = UNKNOWN_INDICATION_COLOR;
+       // info.fOverviewRulerPreference = UNKNOWN_INDICATION_IN_OVERVIEW_RULER;
+       // info.fEditorPreference = UNKNOWN_INDICATION;
+       // ANNOTATION_MAP.put(AnnotationType.UNKNOWN, info);
+       // };
        //
-       //  private final static AnnotationType[] ANNOTATION_LAYERS =
-       //    new AnnotationType[] {
-       //      AnnotationType.UNKNOWN,
-       //      AnnotationType.BOOKMARK,
-       //      AnnotationType.TASK,
-       //      AnnotationType.SEARCH,
-       //      AnnotationType.WARNING,
-       //      AnnotationType.ERROR };
+       // private final static AnnotationType[] ANNOTATION_LAYERS =
+       // new AnnotationType[] {
+       // AnnotationType.UNKNOWN,
+       // AnnotationType.BOOKMARK,
+       // AnnotationType.TASK,
+       // AnnotationType.SEARCH,
+       // AnnotationType.WARNING,
+       // AnnotationType.ERROR };
        /**
         * Creates a new php unit editor.
         */
+
+       /**
+        * Reconciling listeners.
+        * 
+        * @since 3.0
+        */
+       private ListenerList fReconcilingListeners = new ListenerList();
+
+       /**
+        * Mutex for the reconciler. See
+        * https://bugs.eclipse.org/bugs/show_bug.cgi?id=63898 for a description of
+        * the problem.
+        * <p>
+        * TODO remove once the underlying problem is solved.
+        * </p>
+        */
+       private final Object fReconcilerLock = new Object();
+
        public PHPUnitEditor() {
                super();
                setDocumentProvider(PHPeclipsePlugin.getDefault()
@@ -1004,21 +1522,22 @@ public class PHPUnitEditor extends PHPEditor{ //implements IJavaReconcilingListe
                fSavePolicy = null;
                fJavaEditorErrorTickUpdater = new JavaEditorErrorTickUpdater(this);
        }
+
        /*
         * @see AbstractTextEditor#createActions()
         */
        protected void createActions() {
                super.createActions();
                Action action;
-               //              Action action= new
+               // Action action= new
                // TextOperationAction(PHPEditorMessages.getResourceBundle(),
                // "CorrectionAssistProposal.", this, CORRECTIONASSIST_PROPOSALS);
                // //$NON-NLS-1$
-               //              action.setActionDefinitionId(PHPEditorActionDefinitionIds.CORRECTION_ASSIST_PROPOSALS);
-               //              setAction("CorrectionAssistProposal", action); //$NON-NLS-1$
-               //              markAsStateDependentAction("CorrectionAssistProposal", true);
+               // action.setActionDefinitionId(PHPEditorActionDefinitionIds.CORRECTION_ASSIST_PROPOSALS);
+               // setAction("CorrectionAssistProposal", action); //$NON-NLS-1$
+               // markAsStateDependentAction("CorrectionAssistProposal", true);
                // //$NON-NLS-1$
-               //// WorkbenchHelp.setHelp(action,
+               // // WorkbenchHelp.setHelp(action,
                // IJavaHelpContextIds.QUICK_FIX_ACTION);
                action = new ContentAssistAction(PHPEditorMessages.getResourceBundle(),
                                "ContentAssistProposal.", this); //$NON-NLS-1$
@@ -1026,39 +1545,41 @@ public class PHPUnitEditor extends PHPEditor{ //implements IJavaReconcilingListe
                                .setActionDefinitionId(PHPEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
                setAction("ContentAssistProposal", action); //$NON-NLS-1$
                markAsStateDependentAction("ContentAssistProposal", true); //$NON-NLS-1$
-               //              WorkbenchHelp.setHelp(action,
+               // WorkbenchHelp.setHelp(action,
                // IJavaHelpContextIds.CONTENT_ASSIST_ACTION);
-               action = new TextOperationAction(PHPEditorMessages.getResourceBundle(),
-                               "ContentAssistContextInformation.", this,
-                               ISourceViewer.CONTENTASSIST_CONTEXT_INFORMATION); //$NON-NLS-1$
-               action
-                               .setActionDefinitionId(PHPEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION);
-               setAction("ContentAssistContextInformation", action); //$NON-NLS-1$
-               markAsStateDependentAction("ContentAssistContextInformation", true); //$NON-NLS-1$
-               //              WorkbenchHelp.setHelp(action,
+               // action = new
+               // TextOperationAction(PHPEditorMessages.getResourceBundle(),
+               // "ContentAssistContextInformation.", this,
+               // ISourceViewer.CONTENTASSIST_CONTEXT_INFORMATION); //$NON-NLS-1$
+               // action
+               // .setActionDefinitionId(PHPEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION);
+               // setAction("ContentAssistContextInformation", action); //$NON-NLS-1$
+               // markAsStateDependentAction("ContentAssistContextInformation", true);
+               // //$NON-NLS-1$
+               // WorkbenchHelp.setHelp(action,
                // IJavaHelpContextIds.PARAMETER_HINTS_ACTION);
-               //              action= new
+               // action= new
                // TextOperationAction(PHPEditorMessages.getResourceBundle(),
                // "ContentAssistCompletePrefix.", this, CONTENTASSIST_COMPLETE_PREFIX);
                // //$NON-NLS-1$
-               //              action.setActionDefinitionId(PHPEditorActionDefinitionIds.CONTENT_ASSIST_COMPLETE_PREFIX);
-               //              setAction("ContentAssistCompletePrefix", action); //$NON-NLS-1$
-               //              markAsStateDependentAction("ContentAssistCompletePrefix", true);
+               // action.setActionDefinitionId(PHPEditorActionDefinitionIds.CONTENT_ASSIST_COMPLETE_PREFIX);
+               // setAction("ContentAssistCompletePrefix", action); //$NON-NLS-1$
+               // markAsStateDependentAction("ContentAssistCompletePrefix", true);
                // //$NON-NLS-1$
-               //// WorkbenchHelp.setHelp(action,
+               // // WorkbenchHelp.setHelp(action,
                // IJavaHelpContextIds.PARAMETER_HINTS_ACTION);
                action = new TextOperationAction(PHPEditorMessages.getResourceBundle(),
                                "Comment.", this, ITextOperationTarget.PREFIX); //$NON-NLS-1$
                action.setActionDefinitionId(PHPEditorActionDefinitionIds.COMMENT);
                setAction("Comment", action); //$NON-NLS-1$
                markAsStateDependentAction("Comment", true); //$NON-NLS-1$
-               //              WorkbenchHelp.setHelp(action, IJavaHelpContextIds.COMMENT_ACTION);
+               // WorkbenchHelp.setHelp(action, IJavaHelpContextIds.COMMENT_ACTION);
                action = new TextOperationAction(PHPEditorMessages.getResourceBundle(),
                                "Uncomment.", this, ITextOperationTarget.STRIP_PREFIX); //$NON-NLS-1$
                action.setActionDefinitionId(PHPEditorActionDefinitionIds.UNCOMMENT);
                setAction("Uncomment", action); //$NON-NLS-1$
                markAsStateDependentAction("Uncomment", true); //$NON-NLS-1$
-               //              WorkbenchHelp.setHelp(action, IJavaHelpContextIds.UNCOMMENT_ACTION);
+               // WorkbenchHelp.setHelp(action, IJavaHelpContextIds.UNCOMMENT_ACTION);
 
                action = new ToggleCommentAction(PHPEditorMessages.getResourceBundle(),
                                "ToggleComment.", this); //$NON-NLS-1$
@@ -1066,28 +1587,54 @@ public class PHPUnitEditor extends PHPEditor{ //implements IJavaReconcilingListe
                                .setActionDefinitionId(PHPEditorActionDefinitionIds.TOGGLE_COMMENT);
                setAction("ToggleComment", action); //$NON-NLS-1$
                markAsStateDependentAction("ToggleComment", true); //$NON-NLS-1$
-               //WorkbenchHelp.setHelp(action,
+               // WorkbenchHelp.setHelp(action,
                // IJavaHelpContextIds.TOGGLE_COMMENT_ACTION);
                configureToggleCommentAction();
 
-               //    action = new
-               // ToggleCommentAction(PHPEditorMessages.getResourceBundle(),
-               //        "ToggleComment.", this, getSourceViewerConfiguration()
-               //            .getDefaultPrefixes(getSourceViewer(), "")); //$NON-NLS-1$
-               // //$NON-NLS-2$
-               //    action.setActionDefinitionId(PHPEditorActionDefinitionIds.TOGGLE_COMMENT);
-               //    setAction("ToggleComment", action); //$NON-NLS-1$
-               //    markAsStateDependentAction("ToggleComment", true); //$NON-NLS-1$
-               //    // WorkbenchHelp.setHelp(action,
-               //    // IJavaHelpContextIds.TOGGLE_COMMENT_ACTION);
-
                action = new TextOperationAction(PHPEditorMessages.getResourceBundle(),
                                "Format.", this, ISourceViewer.FORMAT); //$NON-NLS-1$
                action.setActionDefinitionId(PHPEditorActionDefinitionIds.FORMAT);
                setAction("Format", action); //$NON-NLS-1$
                markAsStateDependentAction("Format", true); //$NON-NLS-1$
-               markAsSelectionDependentAction("Format", true); //$NON-NLS-1$           
-               //              WorkbenchHelp.setHelp(action, IJavaHelpContextIds.FORMAT_ACTION);
+               markAsSelectionDependentAction("Format", true); //$NON-NLS-1$
+               // WorkbenchHelp.setHelp(action, IJavaHelpContextIds.FORMAT_ACTION);
+
+               // 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$
+               // // 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$
+               // WorkbenchHelp.setHelp(action,
+               // IJavaHelpContextIds.ADD_BLOCK_COMMENT_ACTION);
+               action = new IndentAction(PHPEditorMessages.getResourceBundle(),
+                               "Indent.", this, false); //$NON-NLS-1$
+               action.setActionDefinitionId(PHPEditorActionDefinitionIds.INDENT);
+               setAction("Indent", action); //$NON-NLS-1$
+               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$
@@ -1095,59 +1642,67 @@ public class PHPUnitEditor extends PHPEditor{ //implements IJavaReconcilingListe
                                .setActionDefinitionId(PHPEditorActionDefinitionIds.ADD_BLOCK_COMMENT);
                setAction("AddBlockComment", action); //$NON-NLS-1$
                markAsStateDependentAction("AddBlockComment", true); //$NON-NLS-1$
-               markAsSelectionDependentAction("AddBlockComment", true); //$NON-NLS-1$          
-               //              WorkbenchHelp.setHelp(action,
+               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$               
-               //              WorkbenchHelp.setHelp(action,
-               // IJavaHelpContextIds.ADD_BLOCK_COMMENT_ACTION);
-               //              action= new IndentAction(PHPEditorMessages.getResourceBundle(),
+               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$
-               //              action.setActionDefinitionId(PHPEditorActionDefinitionIds.INDENT);
-               //              setAction("Indent", action); //$NON-NLS-1$
-               //              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.setActionDefinitionId(PHPEditorActionDefinitionIds.INDENT);
+               // setAction("Indent", action); //$NON-NLS-1$
+               // 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$
+
                if (getPreferenceStore().getBoolean(
                                PreferenceConstants.EDITOR_SMART_TAB)) {
                        // don't replace Shift Right - have to make sure their enablement is
                        // mutually exclusive
-                       //                      removeActionActivationCode(ITextEditorActionConstants.SHIFT_RIGHT);
+                       // removeActionActivationCode(ITextEditorActionConstants.SHIFT_RIGHT);
                        setActionActivationCode("IndentOnTab", '\t', -1, SWT.NONE); //$NON-NLS-1$
                }
                fGenerateActionGroup = new GenerateActionGroup(this,
                                ITextEditorActionConstants.GROUP_EDIT);
-               fActionGroups = new CompositeActionGroup(
-                               new ActionGroup[]{fGenerateActionGroup});
-               //        We have to keep the context menu group separate to have better
-               // control
-               // over positioning
+               // ActionGroup rg= new RefactorActionGroup(this,
+               // ITextEditorActionConstants.GROUP_EDIT);
+
+               // fActionGroups.addGroup(rg);
+               fActionGroups.addGroup(fGenerateActionGroup);
+
+               // We have to keep the context menu group separate to have better
+               // control over positioning
                fContextMenuGroup = new CompositeActionGroup(
-                               new ActionGroup[]{fGenerateActionGroup});
-               //      rg,
-               //      new LocalHistoryActionGroup(this,
-               // ITextEditorActionConstants.GROUP_EDIT)});
+                               new ActionGroup[] { fGenerateActionGroup
+                               // rg,
+                               // new LocalHistoryActionGroup(this,
+                               // ITextEditorActionConstants.GROUP_EDIT)
+                               });
 
        }
+
        /*
         * @see JavaEditor#getElementAt(int)
         */
        protected IJavaElement getElementAt(int offset) {
                return getElementAt(offset, true);
        }
+
        /**
         * Returns the most narrow element including the given offset. If
         * <code>reconcile</code> is <code>true</code> the editor's input
@@ -1180,6 +1735,7 @@ public class PHPUnitEditor extends PHPEditor{ //implements IJavaReconcilingListe
                }
                return null;
        }
+
        /*
         * @see JavaEditor#getCorrespondingElement(IJavaElement)
         */
@@ -1192,203 +1748,140 @@ public class PHPUnitEditor extends PHPEditor{ //implements IJavaReconcilingListe
                }
                return null;
        }
+
        public void createPartControl(Composite parent) {
                super.createPartControl(parent);
-               //    fPaintManager = new PaintManager(getSourceViewer());
+               // fPaintManager = new PaintManager(getSourceViewer());
                LinePainter linePainter;
                linePainter = new LinePainter(getSourceViewer());
                linePainter.setHighlightColor(new Color(Display.getCurrent(), 225, 235,
                                224));
-               //    fPaintManager.addPainter(linePainter);
-               if (isBracketHighlightingEnabled())
-                       startBracketHighlighting();
-               if (isLineHighlightingEnabled())
-                       startLineHighlighting();
-               if (isPrintMarginVisible())
-                       showPrintMargin();
-               //    Iterator e = ANNOTATION_MAP.keySet().iterator();
-               //    while (e.hasNext()) {
-               //      AnnotationType type = (AnnotationType) e.next();
-               //      if (isAnnotationIndicationEnabled(type))
-               //        startAnnotationIndication(type);
-               //    }
+               // fPaintManager.addPainter(linePainter);
+               // if (isBracketHighlightingEnabled())
+               // startBracketHighlighting();
+               // if (isLineHighlightingEnabled())
+               // startLineHighlighting();
+               // if (isPrintMarginVisible())
+               // showPrintMargin();
+               // Iterator e = ANNOTATION_MAP.keySet().iterator();
+               // while (e.hasNext()) {
+               // AnnotationType type = (AnnotationType) e.next();
+               // if (isAnnotationIndicationEnabled(type))
+               // startAnnotationIndication(type);
+               // }
                if (isTabConversionEnabled())
                        startTabConversion();
-               //    if (isOverviewRulerVisible())
-               //      showOverviewRuler();
+               // if (isOverviewRulerVisible())
+               // showOverviewRuler();
                //
-               //    Preferences preferences =
+               // Preferences preferences =
                // PHPeclipsePlugin.getDefault().getPluginPreferences();
-               //    preferences.addPropertyChangeListener(fPropertyChangeListener);
+               // preferences.addPropertyChangeListener(fPropertyChangeListener);
                IPreferenceStore preferenceStore = getPreferenceStore();
                boolean closeBracketsPHP = preferenceStore
                                .getBoolean(CLOSE_BRACKETS_PHP);
-               boolean closeStringsPHP = preferenceStore.getBoolean(CLOSE_STRINGS_PHP);
-               boolean closeBracketsHTML = preferenceStore
-                               .getBoolean(CLOSE_BRACKETS_HTML);
-               boolean closeStringsHTML = preferenceStore
-                               .getBoolean(CLOSE_STRINGS_HTML);
+               boolean closeStringsPHPDQ = preferenceStore
+                               .getBoolean(CLOSE_STRINGS_DQ_PHP);
+               boolean closeStringsPHPSQ = preferenceStore
+                               .getBoolean(CLOSE_STRINGS_SQ_PHP);
                fBracketInserter.setCloseBracketsPHPEnabled(closeBracketsPHP);
-               fBracketInserter.setCloseStringsPHPEnabled(closeStringsPHP);
-               fBracketInserter.setCloseBracketsHTMLEnabled(closeBracketsHTML);
-               fBracketInserter.setCloseStringsHTMLEnabled(closeStringsHTML);
+               fBracketInserter.setCloseStringsPHPDQEnabled(closeStringsPHPDQ);
+               fBracketInserter.setCloseStringsPHPSQEnabled(closeStringsPHPSQ);
                ISourceViewer sourceViewer = getSourceViewer();
                if (sourceViewer instanceof ITextViewerExtension)
                        ((ITextViewerExtension) sourceViewer)
                                        .prependVerifyKeyListener(fBracketInserter);
        }
+
        private static char getPeerCharacter(char character) {
                switch (character) {
-                       case '(' :
-                               return ')';
-                       case ')' :
-                               return '(';
-                       case '[' :
-                               return ']';
-                       case ']' :
-                               return '[';
-                       case '"' :
-                               return character;
-                       default :
-                               throw new IllegalArgumentException();
+               case '(':
+                       return ')';
+               case ')':
+                       return '(';
+               case '[':
+                       return ']';
+               case ']':
+                       return '[';
+               case '"':
+                       return character;
+               case '\'':
+                       return character;
+               case '{':
+                       return '}';
+               default:
+                       throw new IllegalArgumentException();
                }
        }
 
-       private void startBracketHighlighting() {
-               if (fBracketPainter == null) {
-                       ISourceViewer sourceViewer = getSourceViewer();
-                       fBracketPainter = new BracketPainter(sourceViewer);
-                       fBracketPainter
-                                       .setHighlightColor(getColor(MATCHING_BRACKETS_COLOR));
-                       //      fPaintManager.addPainter(fBracketPainter);
-               }
-       }
-       private void stopBracketHighlighting() {
-               if (fBracketPainter != null) {
-                       //      fPaintManager.removePainter(fBracketPainter);
-                       fBracketPainter.deactivate(true);
-                       fBracketPainter.dispose();
-                       fBracketPainter = null;
-               }
-       }
-       private boolean isBracketHighlightingEnabled() {
-               IPreferenceStore store = getPreferenceStore();
-               return store.getBoolean(MATCHING_BRACKETS);
-       }
-       private void startLineHighlighting() {
-               if (fLinePainter == null) {
-                       ISourceViewer sourceViewer = getSourceViewer();
-                       fLinePainter = new LinePainter(sourceViewer);
-                       fLinePainter.setHighlightColor(getColor(CURRENT_LINE_COLOR));
-                       //      fPaintManager.addPainter(fLinePainter);
-               }
-       }
-       private void stopLineHighlighting() {
-               if (fLinePainter != null) {
-                       //      fPaintManager.removePainter(fLinePainter);
-                       fLinePainter.deactivate(true);
-                       fLinePainter.dispose();
-                       fLinePainter = null;
-               }
-       }
-       private boolean isLineHighlightingEnabled() {
-               IPreferenceStore store = getPreferenceStore();
-               return store.getBoolean(CURRENT_LINE);
-       }
-       private void showPrintMargin() {
-               if (fPrintMarginPainter == null) {
-                       fPrintMarginPainter = new PrintMarginPainter(getSourceViewer());
-                       fPrintMarginPainter
-                                       .setMarginRulerColor(getColor(PRINT_MARGIN_COLOR));
-                       fPrintMarginPainter.setMarginRulerColumn(getPreferenceStore()
-                                       .getInt(PRINT_MARGIN_COLUMN));
-                       //      fPaintManager.addPainter(fPrintMarginPainter);
-               }
-       }
-       private void hidePrintMargin() {
-               if (fPrintMarginPainter != null) {
-                       //      fPaintManager.removePainter(fPrintMarginPainter);
-                       fPrintMarginPainter.deactivate(true);
-                       fPrintMarginPainter.dispose();
-                       fPrintMarginPainter = null;
-               }
-       }
-       private boolean isPrintMarginVisible() {
-               IPreferenceStore store = getPreferenceStore();
-               return store.getBoolean(PRINT_MARGIN);
-       }
-       //  private void startAnnotationIndication(AnnotationType annotationType) {
-       //    if (fProblemPainter == null) {
-       //      fProblemPainter = new ProblemPainter(this, getSourceViewer());
-       //// fPaintManager.addPainter(fProblemPainter);
-       //    }
-       //    fProblemPainter.setColor(annotationType, getColor(annotationType));
-       //    fProblemPainter.paintAnnotations(annotationType, true);
-       //    fProblemPainter.paint(IPainter.CONFIGURATION);
-       //  }
-       //
-       //  private void shutdownAnnotationIndication() {
-       //    if (fProblemPainter != null) {
-       //
-       //      if (!fProblemPainter.isPaintingAnnotations()) {
-       //// fPaintManager.removePainter(fProblemPainter);
-       //        fProblemPainter.deactivate(true);
-       //        fProblemPainter.dispose();
-       //        fProblemPainter = null;
-       //      } else {
-       //        fProblemPainter.paint(IPainter.CONFIGURATION);
-       //      }
-       //    }
-       //  }
+       // private void startBracketHighlighting() {
+       // if (fBracketPainter == null) {
+       // ISourceViewer sourceViewer = getSourceViewer();
+       // fBracketPainter = new BracketPainter(sourceViewer);
+       // fBracketPainter.setHighlightColor(getColor(MATCHING_BRACKETS_COLOR));
+       // // fPaintManager.addPainter(fBracketPainter);
+       // }
+       // }
        //
-       //  private void stopAnnotationIndication(AnnotationType annotationType) {
-       //    if (fProblemPainter != null) {
-       //      fProblemPainter.paintAnnotations(annotationType, false);
-       //      shutdownAnnotationIndication();
-       //    }
-       //  }
-       //
-       //  private boolean isAnnotationIndicationEnabled(AnnotationType
-       // annotationType) {
-       //    IPreferenceStore store = getPreferenceStore();
-       //    AnnotationInfo info = (AnnotationInfo)
-       // ANNOTATION_MAP.get(annotationType);
-       //    if (info != null)
-       //      return store.getBoolean(info.fEditorPreference);
-       //    return false;
-       //  }
-       //
-       //  private boolean
-       // isAnnotationIndicationInOverviewRulerEnabled(AnnotationType
-       // annotationType) {
-       //    IPreferenceStore store = getPreferenceStore();
-       //    AnnotationInfo info = (AnnotationInfo)
-       // ANNOTATION_MAP.get(annotationType);
-       //    if (info != null)
-       //      return store.getBoolean(info.fOverviewRulerPreference);
-       //    return false;
-       //  }
-       //
-       //  private void showAnnotationIndicationInOverviewRuler(AnnotationType
-       // annotationType, boolean show) {
-       //    AdaptedSourceViewer asv = (AdaptedSourceViewer) getSourceViewer();
-       //    OverviewRuler ruler = asv.getOverviewRuler();
-       //    if (ruler != null) {
-       //      ruler.setColor(annotationType, getColor(annotationType));
-       //      ruler.showAnnotation(annotationType, show);
-       //      ruler.update();
-       //    }
-       //  }
-       //
-       //  private void setColorInOverviewRuler(AnnotationType annotationType, Color
-       // color) {
-       //    AdaptedSourceViewer asv = (AdaptedSourceViewer) getSourceViewer();
-       //    OverviewRuler ruler = asv.getOverviewRuler();
-       //    if (ruler != null) {
-       //      ruler.setColor(annotationType, color);
-       //      ruler.update();
-       //    }
-       //  }
+       // private void stopBracketHighlighting() {
+       // if (fBracketPainter != null) {
+       // // fPaintManager.removePainter(fBracketPainter);
+       // fBracketPainter.deactivate(true);
+       // fBracketPainter.dispose();
+       // fBracketPainter = null;
+       // }
+       // }
+
+       // private boolean isBracketHighlightingEnabled() {
+       // IPreferenceStore store = getPreferenceStore();
+       // return store.getBoolean(MATCHING_BRACKETS);
+       // }
+
+       // private void startLineHighlighting() {
+       // if (fLinePainter == null) {
+       // ISourceViewer sourceViewer = getSourceViewer();
+       // fLinePainter = new LinePainter(sourceViewer);
+       // fLinePainter.setHighlightColor(getColor(CURRENT_LINE_COLOR));
+       // // fPaintManager.addPainter(fLinePainter);
+       // }
+       // }
+
+       // private void stopLineHighlighting() {
+       // if (fLinePainter != null) {
+       // // fPaintManager.removePainter(fLinePainter);
+       // fLinePainter.deactivate(true);
+       // fLinePainter.dispose();
+       // fLinePainter = null;
+       // }
+       // }
+
+       // private boolean isLineHighlightingEnabled() {
+       // IPreferenceStore store = getPreferenceStore();
+       // return store.getBoolean(CURRENT_LINE);
+       // }
+
+       // private void showPrintMargin() {
+       // if (fPrintMarginPainter == null) {
+       // fPrintMarginPainter = new PrintMarginPainter(getSourceViewer());
+       // fPrintMarginPainter.setMarginRulerColor(getColor(PRINT_MARGIN_COLOR));
+       // fPrintMarginPainter.setMarginRulerColumn(getPreferenceStore().getInt(PRINT_MARGIN_COLUMN));
+       // // fPaintManager.addPainter(fPrintMarginPainter);
+       // }
+       // }
+
+       // private void hidePrintMargin() {
+       // if (fPrintMarginPainter != null) {
+       // // fPaintManager.removePainter(fPrintMarginPainter);
+       // fPrintMarginPainter.deactivate(true);
+       // fPrintMarginPainter.dispose();
+       // fPrintMarginPainter = null;
+       // }
+       // }
+
+       // private boolean isPrintMarginVisible() {
+       // IPreferenceStore store = getPreferenceStore();
+       // return store.getBoolean(PRINT_MARGIN);
+       // }
 
        private int getTabSize() {
                Preferences preferences = PHPeclipsePlugin.getDefault()
@@ -1400,87 +1893,67 @@ public class PHPUnitEditor extends PHPEditor{ //implements IJavaReconcilingListe
                IPreferenceStore store = getPreferenceStore();
                return store.getBoolean(SPACES_FOR_TABS);
        }
-       //  private void showOverviewRuler() {
-       //    AdaptedSourceViewer asv = (AdaptedSourceViewer) getSourceViewer();
-       //    asv.showOverviewRuler();
-       //
-       //    OverviewRuler overviewRuler = asv.getOverviewRuler();
-       //    if (overviewRuler != null) {
-       //      for (int i = 0; i < ANNOTATION_LAYERS.length; i++) {
-       //        AnnotationType type = ANNOTATION_LAYERS[i];
-       //        overviewRuler.setLayer(type, i);
-       //        if (isAnnotationIndicationInOverviewRulerEnabled(type))
-       //          showAnnotationIndicationInOverviewRuler(type, true);
-       //      }
-       //    }
-       //  }
-       //
-       //  private void hideOverviewRuler() {
-       //    AdaptedSourceViewer asv = (AdaptedSourceViewer) getSourceViewer();
-       //    asv.hideOverviewRuler();
-       //  }
-       //
-       //  private boolean isOverviewRulerVisible() {
-       //    IPreferenceStore store = getPreferenceStore();
-       //    return store.getBoolean(OVERVIEW_RULER);
-       //  }
+
        private Color getColor(String key) {
                RGB rgb = PreferenceConverter.getColor(getPreferenceStore(), key);
                return getColor(rgb);
        }
+
        private Color getColor(RGB rgb) {
                JavaTextTools textTools = PHPeclipsePlugin.getDefault()
                                .getJavaTextTools();
                return textTools.getColorManager().getColor(rgb);
        }
-       //  private Color getColor(AnnotationType annotationType) {
-       //    AnnotationInfo info = (AnnotationInfo)
+
+       // private Color getColor(AnnotationType annotationType) {
+       // AnnotationInfo info = (AnnotationInfo)
        // ANNOTATION_MAP.get(annotationType);
-       //    if (info != null)
-       //      return getColor(info.fColorPreference);
-       //    return null;
-       //  }
+       // if (info != null)
+       // return getColor(info.fColorPreference);
+       // return null;
+       // }
        public void dispose() {
                ISourceViewer sourceViewer = getSourceViewer();
                if (sourceViewer instanceof ITextViewerExtension)
                        ((ITextViewerExtension) sourceViewer)
                                        .removeVerifyKeyListener(fBracketInserter);
-               //    if (fPropertyChangeListener != null) {
-               //      Preferences preferences =
+               // if (fPropertyChangeListener != null) {
+               // Preferences preferences =
                // PHPeclipsePlugin.getDefault().getPluginPreferences();
-               //      preferences.removePropertyChangeListener(fPropertyChangeListener);
-               //      fPropertyChangeListener = null;
-               //    }
+               // preferences.removePropertyChangeListener(fPropertyChangeListener);
+               // fPropertyChangeListener = null;
+               // }
                if (fJavaEditorErrorTickUpdater != null) {
                        fJavaEditorErrorTickUpdater.dispose();
                        fJavaEditorErrorTickUpdater = null;
                }
-               //    if (fSelectionHistory != null)
-               //      fSelectionHistory.dispose();
-               //    if (fPaintManager != null) {
-               //      fPaintManager.dispose();
-               //      fPaintManager = null;
-               //    }
+               // if (fSelectionHistory != null)
+               // fSelectionHistory.dispose();
+               // if (fPaintManager != null) {
+               // fPaintManager.dispose();
+               // fPaintManager = null;
+               // }
                if (fActionGroups != null) {
                        fActionGroups.dispose();
                        fActionGroups = null;
                }
                super.dispose();
        }
-       //  protected AnnotationType getAnnotationType(String preferenceKey) {
-       //    Iterator e = ANNOTATION_MAP.keySet().iterator();
-       //    while (e.hasNext()) {
-       //      AnnotationType type = (AnnotationType) e.next();
-       //      AnnotationInfo info = (AnnotationInfo) ANNOTATION_MAP.get(type);
-       //      if (info != null) {
-       //        if (preferenceKey.equals(info.fColorPreference)
-       //          || preferenceKey.equals(info.fEditorPreference)
-       //          || preferenceKey.equals(info.fOverviewRulerPreference))
-       //          return type;
-       //      }
-       //    }
-       //    return null;
-       //  }
+
+       // protected AnnotationType getAnnotationType(String preferenceKey) {
+       // Iterator e = ANNOTATION_MAP.keySet().iterator();
+       // while (e.hasNext()) {
+       // AnnotationType type = (AnnotationType) e.next();
+       // AnnotationInfo info = (AnnotationInfo) ANNOTATION_MAP.get(type);
+       // if (info != null) {
+       // if (preferenceKey.equals(info.fColorPreference)
+       // || preferenceKey.equals(info.fEditorPreference)
+       // || preferenceKey.equals(info.fOverviewRulerPreference))
+       // return type;
+       // }
+       // }
+       // return null;
+       // }
        /*
         * @see AbstractTextEditor#handlePreferenceStoreChanged(PropertyChangeEvent)
         */
@@ -1495,21 +1968,15 @@ public class PHPUnitEditor extends PHPEditor{ //implements IJavaReconcilingListe
                                                                        .getBoolean(p));
                                        return;
                                }
-                               if (CLOSE_STRINGS_PHP.equals(p)) {
-                                       fBracketInserter
-                                                       .setCloseStringsPHPEnabled(getPreferenceStore()
-                                                                       .getBoolean(p));
-                                       return;
-                               }
-                               if (CLOSE_BRACKETS_HTML.equals(p)) {
+                               if (CLOSE_STRINGS_DQ_PHP.equals(p)) {
                                        fBracketInserter
-                                                       .setCloseBracketsHTMLEnabled(getPreferenceStore()
+                                                       .setCloseStringsPHPDQEnabled(getPreferenceStore()
                                                                        .getBoolean(p));
                                        return;
                                }
-                               if (CLOSE_STRINGS_HTML.equals(p)) {
+                               if (CLOSE_STRINGS_SQ_PHP.equals(p)) {
                                        fBracketInserter
-                                                       .setCloseStringsHTMLEnabled(getPreferenceStore()
+                                                       .setCloseStringsPHPSQEnabled(getPreferenceStore()
                                                                        .getBoolean(p));
                                        return;
                                }
@@ -1520,91 +1987,87 @@ public class PHPUnitEditor extends PHPEditor{ //implements IJavaReconcilingListe
                                                stopTabConversion();
                                        return;
                                }
-                               if (MATCHING_BRACKETS.equals(p)) {
-                                       if (isBracketHighlightingEnabled())
-                                               startBracketHighlighting();
-                                       else
-                                               stopBracketHighlighting();
-                                       return;
-                               }
-                               if (MATCHING_BRACKETS_COLOR.equals(p)) {
-                                       if (fBracketPainter != null)
-                                               fBracketPainter
-                                                               .setHighlightColor(getColor(MATCHING_BRACKETS_COLOR));
-                                       return;
-                               }
-                               if (CURRENT_LINE.equals(p)) {
-                                       if (isLineHighlightingEnabled())
-                                               startLineHighlighting();
-                                       else
-                                               stopLineHighlighting();
-                                       return;
-                               }
-                               if (CURRENT_LINE_COLOR.equals(p)) {
-                                       if (fLinePainter != null) {
-                                               stopLineHighlighting();
-                                               startLineHighlighting();
-                                       }
-                                       return;
-                               }
-                               if (PRINT_MARGIN.equals(p)) {
-                                       if (isPrintMarginVisible())
-                                               showPrintMargin();
-                                       else
-                                               hidePrintMargin();
-                                       return;
-                               }
-                               if (PRINT_MARGIN_COLOR.equals(p)) {
-                                       if (fPrintMarginPainter != null)
-                                               fPrintMarginPainter
-                                                               .setMarginRulerColor(getColor(PRINT_MARGIN_COLOR));
-                                       return;
-                               }
-                               if (PRINT_MARGIN_COLUMN.equals(p)) {
-                                       if (fPrintMarginPainter != null)
-                                               fPrintMarginPainter
-                                                               .setMarginRulerColumn(getPreferenceStore()
-                                                                               .getInt(PRINT_MARGIN_COLUMN));
-                                       return;
-                               }
-                               //        if (OVERVIEW_RULER.equals(p)) {
-                               //          if (isOverviewRulerVisible())
-                               //            showOverviewRuler();
-                               //          else
-                               //            hideOverviewRuler();
-                               //          return;
-                               //        }
-                               //        AnnotationType type = getAnnotationType(p);
-                               //        if (type != null) {
+                               // if (MATCHING_BRACKETS.equals(p)) {
+                               // if (isBracketHighlightingEnabled())
+                               // startBracketHighlighting();
+                               // else
+                               // stopBracketHighlighting();
+                               // return;
+                               // }
+                               // if (MATCHING_BRACKETS_COLOR.equals(p)) {
+                               // if (fBracketPainter != null)
+                               // fBracketPainter.setHighlightColor(getColor(MATCHING_BRACKETS_COLOR));
+                               // return;
+                               // }
+                               // if (CURRENT_LINE.equals(p)) {
+                               // if (isLineHighlightingEnabled())
+                               // startLineHighlighting();
+                               // else
+                               // stopLineHighlighting();
+                               // return;
+                               // }
+                               // if (CURRENT_LINE_COLOR.equals(p)) {
+                               // if (fLinePainter != null) {
+                               // stopLineHighlighting();
+                               // startLineHighlighting();
+                               // }
+                               // return;
+                               // }
+                               // if (PRINT_MARGIN.equals(p)) {
+                               // if (isPrintMarginVisible())
+                               // showPrintMargin();
+                               // else
+                               // hidePrintMargin();
+                               // return;
+                               // }
+                               // if (PRINT_MARGIN_COLOR.equals(p)) {
+                               // if (fPrintMarginPainter != null)
+                               // fPrintMarginPainter.setMarginRulerColor(getColor(PRINT_MARGIN_COLOR));
+                               // return;
+                               // }
+                               // if (PRINT_MARGIN_COLUMN.equals(p)) {
+                               // if (fPrintMarginPainter != null)
+                               // fPrintMarginPainter.setMarginRulerColumn(getPreferenceStore().getInt(PRINT_MARGIN_COLUMN));
+                               // return;
+                               // }
+                               // if (OVERVIEW_RULER.equals(p)) {
+                               // if (isOverviewRulerVisible())
+                               // showOverviewRuler();
+                               // else
+                               // hideOverviewRuler();
+                               // return;
+                               // }
+                               // AnnotationType type = getAnnotationType(p);
+                               // if (type != null) {
                                //
-                               //          AnnotationInfo info = (AnnotationInfo)
+                               // AnnotationInfo info = (AnnotationInfo)
                                // ANNOTATION_MAP.get(type);
-                               //          if (info.fColorPreference.equals(p)) {
-                               //            Color color = getColor(type);
-                               //            if (fProblemPainter != null) {
-                               //              fProblemPainter.setColor(type, color);
-                               //              fProblemPainter.paint(IPainter.CONFIGURATION);
-                               //            }
-                               //            setColorInOverviewRuler(type, color);
-                               //            return;
-                               //          }
+                               // if (info.fColorPreference.equals(p)) {
+                               // Color color = getColor(type);
+                               // if (fProblemPainter != null) {
+                               // fProblemPainter.setColor(type, color);
+                               // fProblemPainter.paint(IPainter.CONFIGURATION);
+                               // }
+                               // setColorInOverviewRuler(type, color);
+                               // return;
+                               // }
                                //
-                               //          if (info.fEditorPreference.equals(p)) {
-                               //            if (isAnnotationIndicationEnabled(type))
-                               //              startAnnotationIndication(type);
-                               //            else
-                               //              stopAnnotationIndication(type);
-                               //            return;
-                               //          }
+                               // if (info.fEditorPreference.equals(p)) {
+                               // if (isAnnotationIndicationEnabled(type))
+                               // startAnnotationIndication(type);
+                               // else
+                               // stopAnnotationIndication(type);
+                               // return;
+                               // }
                                //
-                               //          if (info.fOverviewRulerPreference.equals(p)) {
-                               //            if (isAnnotationIndicationInOverviewRulerEnabled(type))
-                               //              showAnnotationIndicationInOverviewRuler(type, true);
-                               //            else
-                               //              showAnnotationIndicationInOverviewRuler(type, false);
-                               //            return;
-                               //          }
-                               //        }
+                               // if (info.fOverviewRulerPreference.equals(p)) {
+                               // if (isAnnotationIndicationInOverviewRulerEnabled(type))
+                               // showAnnotationIndicationInOverviewRuler(type, true);
+                               // else
+                               // showAnnotationIndicationInOverviewRuler(type, false);
+                               // return;
+                               // }
+                               // }
                                IContentAssistant c = asv.getContentAssistant();
                                if (c instanceof ContentAssistant)
                                        ContentAssistPreference.changeConfiguration(
@@ -1614,8 +2077,9 @@ public class PHPUnitEditor extends PHPEditor{ //implements IJavaReconcilingListe
                        super.handlePreferenceStoreChanged(event);
                }
        }
+
        /*
-        * @see org.eclipse.jdt.internal.ui.javaeditor.JavaEditor#handlePreferencePropertyChanged(org.eclipse.core.runtime.Preferences.PropertyChangeEvent)
+        * @see net.sourceforge.phpdt.internal.ui.javaeditor.JavaEditor#handlePreferencePropertyChanged(org.eclipse.core.runtime.Preferences.PropertyChangeEvent)
         */
        protected void handlePreferencePropertyChanged(
                        org.eclipse.core.runtime.Preferences.PropertyChangeEvent event) {
@@ -1630,6 +2094,7 @@ public class PHPUnitEditor extends PHPEditor{ //implements IJavaReconcilingListe
                }
                super.handlePreferencePropertyChanged(event);
        }
+
        /**
         * Handles a property change event describing a change of the php core's
         * preferences and updates the preference related editor properties.
@@ -1637,30 +2102,35 @@ public class PHPUnitEditor extends PHPEditor{ //implements IJavaReconcilingListe
         * @param event
         *            the property change event
         */
-       //  protected void
+       // protected void
        // handlePreferencePropertyChanged(org.eclipse.core.runtime.Preferences.PropertyChangeEvent
        // event) {
-       //    AdaptedSourceViewer asv = (AdaptedSourceViewer) getSourceViewer();
-       //    if (asv != null) {
-       //      String p = event.getProperty();
-       //      if (CODE_FORMATTER_TAB_SIZE.equals(p)) {
-       //        asv.updateIndentationPrefixes();
-       //        if (fTabConverter != null)
-       //          fTabConverter.setNumberOfSpacesPerTab(getTabSize());
-       //      }
-       //    }
-       //  }
-
+       // AdaptedSourceViewer asv = (AdaptedSourceViewer) getSourceViewer();
+       // if (asv != null) {
+       // String p = event.getProperty();
+       // if (CODE_FORMATTER_TAB_SIZE.equals(p)) {
+       // asv.updateIndentationPrefixes();
+       // if (fTabConverter != null)
+       // fTabConverter.setNumberOfSpacesPerTab(getTabSize());
+       // }
+       // }
+       // }
        /*
-        * @see org.eclipse.jdt.internal.ui.javaeditor.JavaEditor#createJavaSourceViewer(org.eclipse.swt.widgets.Composite, org.eclipse.jface.text.source.IVerticalRuler, org.eclipse.jface.text.source.IOverviewRuler, boolean, int)
+        * @see net.sourceforge.phpdt.internal.ui.javaeditor.JavaEditor#createJavaSourceViewer(org.eclipse.swt.widgets.Composite,
+        *      org.eclipse.jface.text.source.IVerticalRuler,
+        *      org.eclipse.jface.text.source.IOverviewRuler, boolean, int)
         */
-       protected ISourceViewer createJavaSourceViewer(Composite parent, IVerticalRuler verticalRuler, IOverviewRuler overviewRuler, boolean isOverviewRulerVisible, int styles, IPreferenceStore store) {
-               return new AdaptedSourceViewer(parent, verticalRuler, overviewRuler, isOverviewRulerVisible, styles, store);
+       protected ISourceViewer createJavaSourceViewer(Composite parent,
+                       IVerticalRuler verticalRuler, IOverviewRuler overviewRuler,
+                       boolean isOverviewRulerVisible, int styles, IPreferenceStore store) {
+               return new AdaptedSourceViewer(parent, verticalRuler, overviewRuler,
+                               isOverviewRulerVisible, styles, store);
        }
-       //  protected ISourceViewer createJavaSourceViewer(Composite parent,
+
+       // protected ISourceViewer createJavaSourceViewer(Composite parent,
        // IVerticalRuler ruler, int styles) {
-       //    return new AdaptedSourceViewer(parent, ruler, styles);
-       //  }
+       // return new AdaptedSourceViewer(parent, ruler, styles);
+       // }
        private boolean isValidSelection(int offset, int length) {
                IDocumentProvider provider = getDocumentProvider();
                if (provider != null) {
@@ -1674,28 +2144,15 @@ public class PHPUnitEditor extends PHPEditor{ //implements IJavaReconcilingListe
                }
                return false;
        }
+
        /*
-        * @see AbstractTextEditor#canHandleMove(IEditorInput, IEditorInput)
+        * @see net.sourceforge.phpdt.internal.ui.javaeditor.JavaEditor#getInputElement()
         */
-       protected boolean canHandleMove(IEditorInput originalElement,
-                       IEditorInput movedElement) {
-               String oldExtension = ""; //$NON-NLS-1$
-               if (originalElement instanceof IFileEditorInput) {
-                       IFile file = ((IFileEditorInput) originalElement).getFile();
-                       if (file != null) {
-                               String ext = file.getFileExtension();
-                               if (ext != null)
-                                       oldExtension = ext;
-                       }
-               }
-               String newExtension = ""; //$NON-NLS-1$
-               if (movedElement instanceof IFileEditorInput) {
-                       IFile file = ((IFileEditorInput) movedElement).getFile();
-                       if (file != null)
-                               newExtension = file.getFileExtension();
-               }
-               return oldExtension.equals(newExtension);
+       protected IJavaElement getInputJavaElement() {
+               return PHPeclipsePlugin.getDefault().getWorkingCopyManager()
+                               .getWorkingCopy(getEditorInput());
        }
+
        /*
         * @see AbstractTextEditor#editorContextMenuAboutToShow(IMenuManager)
         */
@@ -1707,6 +2164,7 @@ public class PHPUnitEditor extends PHPEditor{ //implements IJavaReconcilingListe
                fContextMenuGroup.fillContextMenu(menu);
                fContextMenuGroup.setContext(null);
        }
+
        /*
         * @see JavaEditor#setOutlinePageInput(JavaOutlinePage, IEditorInput)
         */
@@ -1717,27 +2175,28 @@ public class PHPUnitEditor extends PHPEditor{ //implements IJavaReconcilingListe
                        page.setInput(manager.getWorkingCopy(input));
                }
        }
+
        /*
         * @see AbstractTextEditor#performSaveOperation(WorkspaceModifyOperation,
         *      IProgressMonitor)
         */
-       //  protected void performSaveOperation(WorkspaceModifyOperation operation,
+       // protected void performSaveOperation(WorkspaceModifyOperation operation,
        // IProgressMonitor progressMonitor) {
-       //    IDocumentProvider p = getDocumentProvider();
-       //    if (p instanceof PHPDocumentProvider) {
-       //      PHPDocumentProvider cp = (PHPDocumentProvider) p;
-       //      cp.setSavePolicy(fSavePolicy);
-       //    }
+       // IDocumentProvider p = getDocumentProvider();
+       // if (p instanceof PHPDocumentProvider) {
+       // PHPDocumentProvider cp = (PHPDocumentProvider) p;
+       // cp.setSavePolicy(fSavePolicy);
+       // }
        //
-       //    try {
-       //      super.performSaveOperation(operation, progressMonitor);
-       //    } finally {
-       //      if (p instanceof PHPDocumentProvider) {
-       //        PHPDocumentProvider cp = (PHPDocumentProvider) p;
-       //        cp.setSavePolicy(null);
-       //      }
-       //    }
-       //  }
+       // try {
+       // super.performSaveOperation(operation, progressMonitor);
+       // } finally {
+       // if (p instanceof PHPDocumentProvider) {
+       // PHPDocumentProvider cp = (PHPDocumentProvider) p;
+       // cp.setSavePolicy(null);
+       // }
+       // }
+       // }
        /*
         * @see AbstractTextEditor#doSave(IProgressMonitor)
         */
@@ -1776,9 +2235,19 @@ public class PHPUnitEditor extends PHPEditor{ //implements IJavaReconcilingListe
                        }
 
                } else {
+                       if (getPreferenceStore().getBoolean(
+                                       PreferenceConstants.EDITOR_P_RTRIM_ON_SAVE)) {
+                               RTrimAction trimAction = new RTrimAction();
+                               trimAction.setActiveEditor(null, getSite().getPage()
+                                               .getActiveEditor());
+                               trimAction.run(null);
+                       }
 
                        setStatusLineErrorMessage(null);
 
+                       updateState(getEditorInput());
+                       validateState(getEditorInput());
+
                        IWorkingCopyManager manager = PHPeclipsePlugin.getDefault()
                                        .getWorkingCopyManager();
                        ICompilationUnit unit = manager.getWorkingCopy(getEditorInput());
@@ -1812,8 +2281,8 @@ public class PHPUnitEditor extends PHPEditor{ //implements IJavaReconcilingListe
 
                SaveAsDialog dialog = new SaveAsDialog(shell);
 
-               IFile original = (input instanceof IFileEditorInput)
-                               ? ((IFileEditorInput) input).getFile()
+               IFile original = (input instanceof IFileEditorInput) ? ((IFileEditorInput) input)
+                               .getFile()
                                : null;
                if (original != null)
                        dialog.setOriginalFile(original);
@@ -1829,7 +2298,7 @@ public class PHPUnitEditor extends PHPEditor{ //implements IJavaReconcilingListe
                if (provider.isDeleted(input) && original != null) {
                        String message = PHPEditorMessages
                                        .getFormattedString(
-                                                       "CompilationUnitEditor.warning.save.delete", new Object[]{original.getName()}); //$NON-NLS-1$
+                                                       "CompilationUnitEditor.warning.save.delete", new Object[] { original.getName() }); //$NON-NLS-1$
                        dialog.setErrorMessage(null);
                        dialog.setMessage(message, IMessageProvider.WARNING);
                }
@@ -1886,38 +2355,38 @@ public class PHPUnitEditor extends PHPEditor{ //implements IJavaReconcilingListe
                configureToggleCommentAction();
        }
 
-       //      /*
-       //       * @see
-       // org.eclipse.jdt.internal.ui.javaeditor.JavaEditor#installOverrideIndicator(boolean)
-       //       * @since 3.0
-       //       */
-       //      protected void installOverrideIndicator(boolean waitForReconcilation) {
-       //              IAnnotationModel model=
+       // /*
+       // * @see
+       // net.sourceforge.phpdt.internal.ui.javaeditor.JavaEditor#installOverrideIndicator(boolean)
+       // * @since 3.0
+       // */
+       // protected void installOverrideIndicator(boolean waitForReconcilation) {
+       // IAnnotationModel model=
        // getDocumentProvider().getAnnotationModel(getEditorInput());
-       //              if (!waitForReconcilation)
-       //                      super.installOverrideIndicator(false);
-       //              else {
-       //                      uninstallOverrideIndicator();
-       //                      IJavaElement inputElement= getInputJavaElement();
-       //                      if (model == null || inputElement == null)
-       //                              return;
-       //                      
-       //                      fOverrideIndicatorManager= new OverrideIndicatorManager(model,
+       // if (!waitForReconcilation)
+       // super.installOverrideIndicator(false);
+       // else {
+       // uninstallOverrideIndicator();
+       // IJavaElement inputElement= getInputJavaElement();
+       // if (model == null || inputElement == null)
+       // return;
+       //
+       // fOverrideIndicatorManager= new OverrideIndicatorManager(model,
        // inputElement, null);
-       //                      addReconcileListener(fOverrideIndicatorManager);
-       //              }
-       //      }
-       //      
-       //      /*
-       //       * @see
-       // org.eclipse.jdt.internal.ui.javaeditor.JavaEditor#uninstallOverrideIndicator()
-       //       * @since 3.0
-       //       */
-       //      protected void uninstallOverrideIndicator() {
-       //              if (fOverrideIndicatorManager != null)
-       //                      removeReconcileListener(fOverrideIndicatorManager);
-       //              super.uninstallOverrideIndicator();
-       //      }
+       // addReconcileListener(fOverrideIndicatorManager);
+       // }
+       // }
+       //
+       // /*
+       // * @see
+       // net.sourceforge.phpdt.internal.ui.javaeditor.JavaEditor#uninstallOverrideIndicator()
+       // * @since 3.0
+       // */
+       // protected void uninstallOverrideIndicator() {
+       // if (fOverrideIndicatorManager != null)
+       // removeReconcileListener(fOverrideIndicatorManager);
+       // super.uninstallOverrideIndicator();
+       // }
 
        /**
         * Configures the toggle comment action
@@ -1934,11 +2403,20 @@ public class PHPUnitEditor extends PHPEditor{ //implements IJavaReconcilingListe
                }
        }
 
+       // private void configureTabConverter() {
+       // if (fTabConverter != null) {
+       // IDocumentProvider provider = getDocumentProvider();
+       // if (provider instanceof PHPDocumentProvider) {
+       // PHPDocumentProvider cup = (PHPDocumentProvider) provider;
+       // fTabConverter.setLineTracker(cup.createLineTracker(getEditorInput()));
+       // }
+       // }
+       // }
        private void configureTabConverter() {
                if (fTabConverter != null) {
                        IDocumentProvider provider = getDocumentProvider();
-                       if (provider instanceof PHPDocumentProvider) {
-                               PHPDocumentProvider cup = (PHPDocumentProvider) provider;
+                       if (provider instanceof ICompilationUnitDocumentProvider) {
+                               ICompilationUnitDocumentProvider cup = (ICompilationUnitDocumentProvider) provider;
                                fTabConverter.setLineTracker(cup
                                                .createLineTracker(getEditorInput()));
                        }
@@ -1973,20 +2451,35 @@ public class PHPUnitEditor extends PHPEditor{ //implements IJavaReconcilingListe
         */
        protected void performSave(boolean overwrite,
                        IProgressMonitor progressMonitor) {
+               // IDocumentProvider p = getDocumentProvider();
+               // if (p instanceof PHPDocumentProvider) {
+               // PHPDocumentProvider cp = (PHPDocumentProvider) p;
+               // cp.setSavePolicy(fSavePolicy);
+               // }
+               // try {
+               // super.performSave(overwrite, progressMonitor);
+               // } finally {
+               // if (p instanceof PHPDocumentProvider) {
+               // PHPDocumentProvider cp = (PHPDocumentProvider) p;
+               // cp.setSavePolicy(null);
+               // }
+               // }
+
                IDocumentProvider p = getDocumentProvider();
-               if (p instanceof PHPDocumentProvider) {
-                       PHPDocumentProvider cp = (PHPDocumentProvider) p;
+               if (p instanceof ICompilationUnitDocumentProvider) {
+                       ICompilationUnitDocumentProvider cp = (ICompilationUnitDocumentProvider) p;
                        cp.setSavePolicy(fSavePolicy);
                }
                try {
                        super.performSave(overwrite, progressMonitor);
                } finally {
-                       if (p instanceof PHPDocumentProvider) {
-                               PHPDocumentProvider cp = (PHPDocumentProvider) p;
+                       if (p instanceof ICompilationUnitDocumentProvider) {
+                               ICompilationUnitDocumentProvider cp = (ICompilationUnitDocumentProvider) p;
                                cp.setSavePolicy(null);
                        }
                }
        }
+
        /*
         * @see AbstractTextEditor#doSaveAs
         */
@@ -2018,44 +2511,65 @@ public class PHPUnitEditor extends PHPEditor{ //implements IJavaReconcilingListe
                                                        .format(
                                                                        PHPEditorMessages
                                                                                        .getString("PHPUnitEditor.warning.save.nonWorkbenchEncoding.message1"),
-                                                                       new String[]{input.getName(), encoding}); //$NON-NLS-1$
+                                                                       new String[] { input.getName(), encoding }); //$NON-NLS-1$
                                else
                                        msg = MessageFormat
                                                        .format(
                                                                        PHPEditorMessages
                                                                                        .getString("PHPUnitEditor.warning.save.nonWorkbenchEncoding.message2"),
-                                                                       new String[]{encoding}); //$NON-NLS-1$
+                                                                       new String[] { encoding }); //$NON-NLS-1$
                                return MessageDialog.openQuestion(shell, title, msg);
                        }
                }
                return true;
        }
+
+       /*
+        * @see net.sourceforge.phpdt.internal.ui.text.java.IJavaReconcilingListener#aboutToBeReconciled()
+        * @since 3.0
+        */
+       public void aboutToBeReconciled() {
+
+               // Notify AST provider
+               // PHPeclipsePlugin.getDefault().getASTProvider().aboutToBeReconciled(getInputJavaElement());
+
+               // Notify listeners
+               Object[] listeners = fReconcilingListeners.getListeners();
+               for (int i = 0, length = listeners.length; i < length; ++i)
+                       ((IJavaReconcilingListener) listeners[i]).aboutToBeReconciled();
+       }
+
        /*
-        * @see IReconcilingParticipant#reconciled()
+        * @see net.sourceforge.phpdt.internal.ui.text.java.IJavaReconcilingListener#reconciled(CompilationUnit,
+        *      boolean, IProgressMonitor)
+        * @since 3.0
         */
-       public void reconciled() {
-               if (synchronizeOutlineOnCursorMove()) {
+       public void reconciled(CompilationUnit ast, boolean forced,
+                       IProgressMonitor progressMonitor) {
+
+               // Always notify AST provider
+               // PHPeclipsePlugin.getDefault().getASTProvider().reconciled(ast,
+               // getInputJavaElement());
+
+               // Notify listeners
+               // Object[] listeners = fReconcilingListeners.getListeners();
+               // for (int i = 0, length= listeners.length; i < length; ++i)
+               // ((IJavaReconcilingListener)listeners[i]).reconciled(ast, forced,
+               // progressMonitor);
+
+               // Update Java Outline page selection
+               if (!forced && !progressMonitor.isCanceled()) {
                        Shell shell = getSite().getShell();
                        if (shell != null && !shell.isDisposed()) {
                                shell.getDisplay().asyncExec(new Runnable() {
                                        public void run() {
-                                               synchronizeOutlinePageSelection();
+                                               selectionChanged();
                                        }
                                });
                        }
                }
        }
 
-       protected void updateStateDependentActions() {
-               super.updateStateDependentActions();
-               fGenerateActionGroup.editorStateChanged();
-       }
-
-       private boolean synchronizeOutlineOnCursorMove() {
-               return PreferenceConstants.getPreferenceStore().getBoolean(
-                               PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE);
-       }
-
        /**
         * Returns the updated java element for the old java element.
         */
@@ -2080,6 +2594,7 @@ public class PHPUnitEditor extends PHPEditor{ //implements IJavaReconcilingListe
                }
                return null;
        }
+
        /**
         * Returns the offset of the given Java element.
         */
@@ -2095,81 +2610,169 @@ public class PHPUnitEditor extends PHPEditor{ //implements IJavaReconcilingListe
                }
                return -1;
        }
+
+       /*
+        * @see AbstractTextEditor#restoreSelection()
+        */
+       // protected void restoreSelection() {
+       // try {
+       // if (getSourceViewer() == null || fRememberedSelection == null)
+       // return;
+       // IJavaElement newElement = findElement(fRememberedElement);
+       // int newOffset = getOffset(newElement);
+       // int delta = (newOffset > -1 && fRememberedElementOffset > -1) ? newOffset
+       // - fRememberedElementOffset : 0;
+       // if (isValidSelection(delta + fRememberedSelection.getOffset(),
+       // fRememberedSelection.getLength()))
+       // selectAndReveal(delta + fRememberedSelection.getOffset(),
+       // fRememberedSelection.getLength());
+       // } finally {
+       // fRememberedSelection = null;
+       // fRememberedElement = null;
+       // fRememberedElementOffset = -1;
+       // }
+       // }
+       /**
+        * Tells whether this is the active editor in the active page.
+        * 
+        * @return <code>true</code> if this is the active editor in the active
+        *         page
+        * @see IWorkbenchPage#getActiveEditor();
+        */
+       protected final boolean isActiveEditor() {
+               IWorkbenchWindow window = getSite().getWorkbenchWindow();
+               IWorkbenchPage page = window.getActivePage();
+               if (page == null)
+                       return false;
+               IEditorPart activeEditor = page.getActiveEditor();
+               return activeEditor != null && activeEditor.equals(this);
+       }
+
+       /**
+        * 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
+        */
+       final void addReconcileListener(IJavaReconcilingListener listener) {
+               synchronized (fReconcilingListeners) {
+                       fReconcilingListeners.add(listener);
+               }
+       }
+
+       /**
+        * 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
+        */
+       final void removeReconcileListener(IJavaReconcilingListener listener) {
+               synchronized (fReconcilingListeners) {
+                       fReconcilingListeners.remove(listener);
+               }
+       }
+
+       protected void updateStateDependentActions() {
+               super.updateStateDependentActions();
+               fGenerateActionGroup.editorStateChanged();
+       }
+
        /*
         * @see AbstractTextEditor#rememberSelection()
         */
        protected void rememberSelection() {
-               ISelectionProvider sp = getSelectionProvider();
-               fRememberedSelection = (sp == null ? null : (ITextSelection) sp
-                               .getSelection());
-               if (fRememberedSelection != null) {
-                       fRememberedElement = getElementAt(fRememberedSelection.getOffset(),
-                                       true);
-                       fRememberedElementOffset = getOffset(fRememberedElement);
-               }
+               fRememberedSelection.remember();
        }
+
        /*
         * @see AbstractTextEditor#restoreSelection()
         */
        protected void restoreSelection() {
-               try {
-                       if (getSourceViewer() == null || fRememberedSelection == null)
-                               return;
-                       IJavaElement newElement = findElement(fRememberedElement);
-                       int newOffset = getOffset(newElement);
-                       int delta = (newOffset > -1 && fRememberedElementOffset > -1)
-                                       ? newOffset - fRememberedElementOffset
-                                       : 0;
-                       if (isValidSelection(delta + fRememberedSelection.getOffset(),
-                                       fRememberedSelection.getLength()))
-                               selectAndReveal(delta + fRememberedSelection.getOffset(),
-                                               fRememberedSelection.getLength());
-               } finally {
-                       fRememberedSelection = null;
-                       fRememberedElement = null;
-                       fRememberedElementOffset = -1;
+               fRememberedSelection.restore();
+       }
+
+       /*
+        * @see AbstractTextEditor#canHandleMove(IEditorInput, IEditorInput)
+        */
+       protected boolean canHandleMove(IEditorInput originalElement,
+                       IEditorInput movedElement) {
+
+               String oldExtension = ""; //$NON-NLS-1$
+               if (originalElement instanceof IFileEditorInput) {
+                       IFile file = ((IFileEditorInput) originalElement).getFile();
+                       if (file != null) {
+                               String ext = file.getFileExtension();
+                               if (ext != null)
+                                       oldExtension = ext;
+                       }
+               }
+
+               String newExtension = ""; //$NON-NLS-1$
+               if (movedElement instanceof IFileEditorInput) {
+                       IFile file = ((IFileEditorInput) movedElement).getFile();
+                       if (file != null)
+                               newExtension = file.getFileExtension();
+               }
+
+               return oldExtension.equals(newExtension);
+       }
+
+       /*
+        * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#isPrefQuickDiffAlwaysOn()
+        */
+       protected boolean isPrefQuickDiffAlwaysOn() {
+               // reestablishes the behaviour from AbstractDecoratedTextEditor which
+               // was hacked by JavaEditor
+               // to disable the change bar for the class file (attached source) java
+               // editor.
+               IPreferenceStore store = getPreferenceStore();
+               return store
+                               .getBoolean(AbstractDecoratedTextEditorPreferenceConstants.QUICK_DIFF_ALWAYS_ON);
+       }
+
+       /*
+        * @see net.sourceforge.phpdt.internal.ui.javaeditor.JavaEditor#getAdapter(java.lang.Class)
+        */
+       public Object getAdapter(Class required) {
+               if (SmartBackspaceManager.class.equals(required)) {
+                       if (getSourceViewer() instanceof JavaSourceViewer) {
+                               return ((JavaSourceViewer) getSourceViewer())
+                                               .getBackspaceManager();
+                       }
+               }
+
+               return super.getAdapter(required);
+       }
+
+       /**
+        * Returns the mutex for the reconciler. See
+        * https://bugs.eclipse.org/bugs/show_bug.cgi?id=63898 for a description of
+        * the problem.
+        * <p>
+        * TODO remove once the underlying problem is solved.
+        * </p>
+        * 
+        * @return the lock reconcilers may use to synchronize on
+        */
+       public Object getReconcilerLock() {
+               return fReconcilerLock;
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.eclipse.ui.texteditor.AbstractTextEditor#editorSaved()
+        */
+       protected void editorSaved() {
+               super.editorSaved();
+               ShowExternalPreviewAction a = ShowExternalPreviewAction.getInstance();
+               if (a != null) {
+                       //a.refresh(ShowExternalPreviewAction.PHP_TYPE);
+                       a.doRun(ShowExternalPreviewAction.PHP_TYPE);
                }
        }
-       
-//     /*
-//      * @see org.eclipse.jdt.internal.ui.text.java.IJavaReconcilingListener#aboutToBeReconciled()
-//      * @since 3.0
-//      */
-//     public void aboutToBeReconciled() {
-//
-//             // Notify AST provider
-//             PHPeclipsePlugin.getDefault().getASTProvider().aboutToBeReconciled(getInputJavaElement());
-//             
-//             // Notify listeners
-//             Object[] listeners = fReconcilingListeners.getListeners();
-//             for (int i = 0, length= listeners.length; i < length; ++i)
-//                     ((IJavaReconcilingListener)listeners[i]).aboutToBeReconciled();
-//     }
-//     
-//     /*
-//      * @see org.eclipse.jdt.internal.ui.text.java.IJavaReconcilingListener#reconciled(CompilationUnit, boolean, IProgressMonitor)
-//      * @since 3.0
-//      */
-//     public void reconciled(net.sourceforge.phpdt.core.dom.CompilationUnit ast, boolean forced, IProgressMonitor progressMonitor) {
-//
-//             // Always notify AST provider
-//             PHPeclipsePlugin.getDefault().getASTProvider().reconciled(ast, getInputJavaElement());
-//             
-//             // Notify listeners
-//             Object[] listeners = fReconcilingListeners.getListeners();
-//             for (int i = 0, length= listeners.length; i < length; ++i)
-//                     ((IJavaReconcilingListener)listeners[i]).reconciled(ast, forced, progressMonitor);
-//
-//             // Update Java Outline page selection
-//             if (!forced && !progressMonitor.isCanceled()) {
-//                     Shell shell= getSite().getShell();
-//                     if (shell != null && !shell.isDisposed()) {
-//                             shell.getDisplay().asyncExec(new Runnable() {
-//                                     public void run() {
-//                                             selectionChanged();
-//                                     }
-//                             });
-//                     }
-//             }
-//     }
 }
\ No newline at end of file