1) Added missing strings for italic, underline and strike through.
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / phpeditor / PHPEditor.java
index e692e83..cc75aed 100644 (file)
@@ -34,6 +34,7 @@ import net.sourceforge.phpdt.core.ISourceReference;
 import net.sourceforge.phpdt.core.JavaCore;
 import net.sourceforge.phpdt.core.JavaModelException;
 import net.sourceforge.phpdt.core.compiler.ITerminalSymbols;
+import net.sourceforge.phpdt.core.compiler.ITerminalSymbols.TokenName;
 import net.sourceforge.phpdt.core.compiler.InvalidInputException;
 import net.sourceforge.phpdt.internal.compiler.parser.Scanner;
 import net.sourceforge.phpdt.internal.compiler.parser.SyntaxError;
@@ -48,7 +49,7 @@ import net.sourceforge.phpdt.internal.ui.text.JavaWordFinder;
 import net.sourceforge.phpdt.internal.ui.text.JavaWordIterator;
 import net.sourceforge.phpdt.internal.ui.text.PHPPairMatcher;
 import net.sourceforge.phpdt.internal.ui.text.PreferencesAdapter;
-import net.sourceforge.phpdt.internal.ui.text.java.JavaExpandHover;
+import net.sourceforge.phpdt.internal.ui.text.java.hover.JavaExpandHover;
 import net.sourceforge.phpdt.internal.ui.viewsupport.ISelectionListenerWithAST;
 import net.sourceforge.phpdt.internal.ui.viewsupport.IViewPartInputProvider;
 import net.sourceforge.phpdt.internal.ui.viewsupport.SelectionListenerWithASTManager;
@@ -61,15 +62,19 @@ import net.sourceforge.phpdt.ui.text.JavaTextTools;
 import net.sourceforge.phpdt.ui.text.PHPSourceViewerConfiguration;
 import net.sourceforge.phpdt.ui.text.folding.IJavaFoldingStructureProvider;
 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
+import net.sourceforge.phpeclipse.builder.ExternalEditorInput;
 import net.sourceforge.phpeclipse.ui.editor.BrowserUtil;
 import net.sourceforge.phpeclipse.webbrowser.views.BrowserView;
 
+import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IMarker;
 import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.Preferences;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.core.runtime.jobs.Job;
@@ -118,12 +123,15 @@ import org.eclipse.jface.text.source.IOverviewRuler;
 import org.eclipse.jface.text.source.ISourceViewer;
 import org.eclipse.jface.text.source.ISourceViewerExtension2;
 import org.eclipse.jface.text.source.IVerticalRuler;
+import org.eclipse.jface.text.source.IVerticalRulerColumn;
 import org.eclipse.jface.text.source.OverviewRuler;
 import org.eclipse.jface.text.source.SourceViewerConfiguration;
 import org.eclipse.jface.text.source.projection.ProjectionSupport;
 import org.eclipse.jface.text.source.projection.ProjectionViewer;
 import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.ListenerList;
+//incastrix
+//import org.eclipse.jface.util.ListenerList;
+import org.eclipse.core.runtime.ListenerList;
 import org.eclipse.jface.util.PropertyChangeEvent;
 import org.eclipse.jface.viewers.DoubleClickEvent;
 import org.eclipse.jface.viewers.IDoubleClickListener;
@@ -175,6 +183,7 @@ import org.eclipse.ui.actions.ActionGroup;
 import org.eclipse.ui.editors.text.DefaultEncodingSupport;
 import org.eclipse.ui.editors.text.EditorsUI;
 import org.eclipse.ui.editors.text.IEncodingSupport;
+import org.eclipse.ui.ide.FileStoreEditorInput;
 import org.eclipse.ui.part.FileEditorInput;
 import org.eclipse.ui.part.IShowInSource;
 import org.eclipse.ui.part.IShowInTargetList;
@@ -199,24 +208,25 @@ import org.eclipse.ui.views.tasklist.TaskList;
 /**
  * PHP specific text editor.
  */
-public abstract class PHPEditor extends AbstractDecoratedTextEditor implements IViewPartInputProvider, IShowInTargetList,
-               IShowInSource {
+public abstract class PHPEditor extends AbstractDecoratedTextEditor implements
+               IViewPartInputProvider, IShowInTargetList, IShowInSource {
        // extends StatusTextEditor implements IViewPartInputProvider { // extends
        // TextEditor {
 
        /**
         * Internal implementation class for a change listener.
-        *
+        * 
         * @since 3.0
         */
-       protected abstract class AbstractSelectionChangedListener implements ISelectionChangedListener {
+       protected abstract class AbstractSelectionChangedListener implements
+                       ISelectionChangedListener {
 
                /**
                 * Installs this selection changed listener with the given selection
-                * provider. If the selection provider is a post selection provider, post
-                * selection changed events are the preferred choice, otherwise normal
-                * selection changed events are requested.
-                *
+                * provider. If the selection provider is a post selection provider,
+                * post selection changed events are the preferred choice, otherwise
+                * normal selection changed events are requested.
+                * 
                 * @param selectionProvider
                 */
                public void install(ISelectionProvider selectionProvider) {
@@ -234,9 +244,9 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                /**
                 * Removes this selection changed listener from the given selection
                 * provider.
-                *
+                * 
                 * @param selectionProvider
-                *          the selection provider
+                *            the selection provider
                 */
                public void uninstall(ISelectionProvider selectionProvider) {
                        if (selectionProvider == null)
@@ -252,11 +262,13 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
        }
 
        /**
-        * Updates the Java outline page selection and this editor's range indicator.
-        *
+        * Updates the Java outline page selection and this editor's range
+        * indicator.
+        * 
         * @since 3.0
         */
-       private class EditorSelectionChangedListener extends AbstractSelectionChangedListener {
+       private class EditorSelectionChangedListener extends
+                       AbstractSelectionChangedListener {
 
                /*
                 * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
@@ -313,7 +325,7 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
         * This preference store is read-only i.e. write access throws an
         * {@link java.lang.UnsupportedOperationException}.
         * </p>
-        *
+        * 
         * @since 3.0
         */
        private static class OptionsAdapter implements IPreferenceStore {
@@ -325,19 +337,20 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
                        /**
                         * Should the given event be filtered?
-                        *
+                        * 
                         * @param event
-                        *          The property change event.
-                        * @return <code>true</code> iff the given event should be filtered.
+                        *            The property change event.
+                        * @return <code>true</code> iff the given event should be
+                        *         filtered.
                         */
                        public boolean isFiltered(PropertyChangeEvent event);
 
                }
 
                /**
-                * Property change listener. Listens for events in the options Map and fires
-                * a {@link org.eclipse.jface.util.PropertyChangeEvent}on this adapter with
-                * arguments from the received event.
+                * Property change listener. Listens for events in the options Map and
+                * fires a {@link org.eclipse.jface.util.PropertyChangeEvent}on this
+                * adapter with arguments from the received event.
                 */
                private class PropertyChangeListener implements IPropertyChangeListener {
 
@@ -353,7 +366,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                                else
                                        fOptions.put(event.getProperty(), event.getNewValue());
 
-                               firePropertyChangeEvent(event.getProperty(), event.getOldValue(), event.getNewValue());
+                               firePropertyChangeEvent(event.getProperty(), event
+                                               .getOldValue(), event.getNewValue());
                        }
                }
 
@@ -374,15 +388,17 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
                /**
                 * Initialize with the given options.
-                *
+                * 
                 * @param options
-                *          The options to wrap
+                *            The options to wrap
                 * @param mockupPreferenceStore
-                *          the mock-up preference store
+                *            the mock-up preference store
                 * @param filter
-                *          the property change filter
+                *            the property change filter
                 */
-               public OptionsAdapter(Map options, IPreferenceStore mockupPreferenceStore, IPropertyChangeEventFilter filter) {
+               public OptionsAdapter(Map options,
+                               IPreferenceStore mockupPreferenceStore,
+                               IPropertyChangeEventFilter filter) {
                        fMockupPreferenceStore = mockupPreferenceStore;
                        fOptions = options;
                        setFilter(filter);
@@ -400,7 +416,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                /**
                 * {@inheritDoc}
                 */
-               public void removePropertyChangeListener(IPropertyChangeListener listener) {
+               public void removePropertyChangeListener(
+                               IPropertyChangeListener listener) {
                        fListeners.remove(listener);
                        if (fListeners.size() == 0)
                                fMockupPreferenceStore.removePropertyChangeListener(fListener);
@@ -416,8 +433,10 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                /**
                 * {@inheritDoc}
                 */
-               public void firePropertyChangeEvent(String name, Object oldValue, Object newValue) {
-                       PropertyChangeEvent event = new PropertyChangeEvent(this, name, oldValue, newValue);
+               public void firePropertyChangeEvent(String name, Object oldValue,
+                               Object newValue) {
+                       PropertyChangeEvent event = new PropertyChangeEvent(this, name,
+                                       oldValue, newValue);
                        Object[] listeners = fListeners.getListeners();
                        for (int i = 0; i < listeners.length; i++)
                                ((IPropertyChangeListener) listeners[i]).propertyChange(event);
@@ -660,7 +679,7 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
                /**
                 * Returns the adapted options Map.
-                *
+                * 
                 * @return Returns the adapted options Map.
                 */
                public Map getOptions() {
@@ -668,9 +687,9 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                }
 
                /**
-                * Returns the mock-up preference store, events are received through this
-                * preference store.
-                *
+                * Returns the mock-up preference store, events are received through
+                * this preference store.
+                * 
                 * @return Returns the mock-up preference store.
                 */
                public IPreferenceStore getMockupPreferenceStore() {
@@ -679,9 +698,9 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
                /**
                 * Set the event filter to the given filter.
-                *
+                * 
                 * @param filter
-                *          The new filter.
+                *            The new filter.
                 */
                public void setFilter(IPropertyChangeEventFilter filter) {
                        fFilter = filter;
@@ -689,7 +708,7 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
                /**
                 * Returns the event filter.
-                *
+                * 
                 * @return The event filter.
                 */
                public IPropertyChangeEventFilter getFilter() {
@@ -784,7 +803,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
        // return SWT.NONE;
        //
        // int stateMask = 0;
-       // StringTokenizer modifierTokenizer = new StringTokenizer(modifiers, ",;.:+-*
+       // StringTokenizer modifierTokenizer = new StringTokenizer(modifiers,
+       // ",;.:+-*
        // "); //$NON-NLS-1$
        // while (modifierTokenizer.hasMoreTokens()) {
        // int modifier =
@@ -855,7 +875,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
        // return;
        //
        // Display display = text.getDisplay();
-       // fColor = createColor(getPreferenceStore(), PHPEditor.LINK_COLOR, display);
+       // fColor = createColor(getPreferenceStore(), PHPEditor.LINK_COLOR,
+       // display);
        // }
        //
        // /**
@@ -1205,7 +1226,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
        // return;
        // }
        //
-       // if ((event.stateMask & SWT.BUTTON1) != 0 && text.getSelectionCount() != 0)
+       // if ((event.stateMask & SWT.BUTTON1) != 0 && text.getSelectionCount() !=
+       // 0)
        // {
        // deactivate();
        // return;
@@ -1295,7 +1317,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
        // org.eclipse.jface.text.ITextInputListener#inputDocumentChanged(org.eclipse.jface.text.IDocument,
        // * org.eclipse.jface.text.IDocument)
        // */
-       // public void inputDocumentChanged(IDocument oldInput, IDocument newInput) {
+       // public void inputDocumentChanged(IDocument oldInput, IDocument newInput)
+       // {
        // if (newInput == null)
        // return;
        // newInput.addDocumentListener(this);
@@ -1360,7 +1383,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
        // region.getLength();
        // }
        //
-       // private Point getMinimumLocation(StyledText text, int offset, int length) {
+       // private Point getMinimumLocation(StyledText text, int offset, int length)
+       // {
        // Point minLocation = new Point(Integer.MAX_VALUE, Integer.MAX_VALUE);
        //
        // for (int i = 0; i <= length; i++) {
@@ -1375,7 +1399,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
        // return minLocation;
        // }
        //
-       // private Point getMaximumLocation(StyledText text, int offset, int length) {
+       // private Point getMaximumLocation(StyledText text, int offset, int length)
+       // {
        // Point maxLocation = new Point(Integer.MIN_VALUE, Integer.MIN_VALUE);
        //
        // for (int i = 0; i <= length; i++) {
@@ -1393,8 +1418,10 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
        /*
         * Link mode.
         */
-       class MouseClickListener implements KeyListener, MouseListener, MouseMoveListener, FocusListener, PaintListener,
-                       IPropertyChangeListener, IDocumentListener, ITextInputListener, ITextPresentationListener {
+       class MouseClickListener implements KeyListener, MouseListener,
+                       MouseMoveListener, FocusListener, PaintListener,
+                       IPropertyChangeListener, IDocumentListener, ITextInputListener,
+                       ITextPresentationListener {
 
                /** The session is active. */
                private boolean fActive;
@@ -1449,7 +1476,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                        text.addFocusListener(this);
                        text.addPaintListener(this);
 
-                       ((ITextViewerExtension4) sourceViewer).addTextPresentationListener(this);
+                       ((ITextViewerExtension4) sourceViewer)
+                                       .addTextPresentationListener(this);
 
                        updateKeyModifierMask();
 
@@ -1458,11 +1486,13 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                }
 
                private void updateKeyModifierMask() {
-                       String modifiers = getPreferenceStore().getString(BROWSER_LIKE_LINKS_KEY_MODIFIER);
+                       String modifiers = getPreferenceStore().getString(
+                                       BROWSER_LIKE_LINKS_KEY_MODIFIER);
                        fKeyModifierMask = computeStateMask(modifiers);
                        if (fKeyModifierMask == -1) {
                                // Fall back to stored state mask
-                               fKeyModifierMask = getPreferenceStore().getInt(BROWSER_LIKE_LINKS_KEY_MODIFIER_MASK);
+                               fKeyModifierMask = getPreferenceStore().getInt(
+                                               BROWSER_LIKE_LINKS_KEY_MODIFIER_MASK);
                        }
                }
 
@@ -1474,9 +1504,11 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                                return SWT.NONE;
 
                        int stateMask = 0;
-                       StringTokenizer modifierTokenizer = new StringTokenizer(modifiers, ",;.:+-* "); //$NON-NLS-1$
+                       StringTokenizer modifierTokenizer = new StringTokenizer(modifiers,
+                                       ",;.:+-* "); //$NON-NLS-1$
                        while (modifierTokenizer.hasMoreTokens()) {
-                               int modifier = EditorUtility.findLocalizedModifier(modifierTokenizer.nextToken());
+                               int modifier = EditorUtility
+                                               .findLocalizedModifier(modifierTokenizer.nextToken());
                                if (modifier == 0 || (stateMask & modifier) == modifier)
                                        return -1;
                                stateMask = stateMask | modifier;
@@ -1502,7 +1534,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
                        IDocumentProvider documentProvider = getDocumentProvider();
                        if (documentProvider != null) {
-                               IDocument document = documentProvider.getDocument(getEditorInput());
+                               IDocument document = documentProvider
+                                               .getDocument(getEditorInput());
                                if (document != null)
                                        document.removeDocumentListener(this);
                        }
@@ -1524,7 +1557,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                        text.removeFocusListener(this);
                        text.removePaintListener(this);
 
-                       ((ITextViewerExtension4) sourceViewer).removeTextPresentationListener(this);
+                       ((ITextViewerExtension4) sourceViewer)
+                                       .removeTextPresentationListener(this);
                }
 
                /*
@@ -1535,7 +1569,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                                ISourceViewer viewer = getSourceViewer();
                                if (viewer != null)
                                        updateColor(viewer);
-                       } else if (event.getProperty().equals(BROWSER_LIKE_LINKS_KEY_MODIFIER)) {
+                       } else if (event.getProperty().equals(
+                                       BROWSER_LIKE_LINKS_KEY_MODIFIER)) {
                                updateKeyModifierMask();
                        }
                }
@@ -1549,23 +1584,25 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                                return;
 
                        Display display = text.getDisplay();
-                       fColor = createColor(getPreferenceStore(), PHPEditor.LINK_COLOR, display);
+                       fColor = createColor(getPreferenceStore(), PHPEditor.LINK_COLOR,
+                                       display);
                }
 
                /**
                 * Creates a color from the information stored in the given preference
                 * store.
-                *
+                * 
                 * @param store
-                *          the preference store
+                *            the preference store
                 * @param key
-                *          the key
+                *            the key
                 * @param display
-                *          the display
-                * @return the color or <code>null</code> if there is no such information
-                *         available
+                *            the display
+                * @return the color or <code>null</code> if there is no such
+                *         information available
                 */
-               private Color createColor(IPreferenceStore store, String key, Display display) {
+               private Color createColor(IPreferenceStore store, String key,
+                               Display display) {
 
                        RGB rgb = null;
 
@@ -1603,7 +1640,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
                                // Invalidate ==> remove applied text presentation
                                if (!redrawAll && viewer instanceof ITextViewerExtension2)
-                                       ((ITextViewerExtension2) viewer).invalidateTextPresentation(offset, length);
+                                       ((ITextViewerExtension2) viewer)
+                                                       .invalidateTextPresentation(offset, length);
                                else
                                        viewer.invalidateTextPresentation();
 
@@ -1717,9 +1755,12 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                        if (fActiveRegion == null)
                                return;
                        IRegion region = textPresentation.getExtent();
-                       if (fActiveRegion.getOffset() + fActiveRegion.getLength() >= region.getOffset()
-                                       && region.getOffset() + region.getLength() > fActiveRegion.getOffset())
-                               textPresentation.mergeStyleRange(new StyleRange(fActiveRegion.getOffset(), fActiveRegion.getLength(), fColor, null));
+                       if (fActiveRegion.getOffset() + fActiveRegion.getLength() >= region
+                                       .getOffset()
+                                       && region.getOffset() + region.getLength() > fActiveRegion
+                                                       .getOffset())
+                               textPresentation.mergeStyleRange(new StyleRange(fActiveRegion
+                                               .getOffset(), fActiveRegion.getLength(), fColor, null));
                }
 
                private void highlightRegion(ISourceViewer viewer, IRegion region) {
@@ -1746,7 +1787,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                                length = widgetRange.getLength();
 
                        } else {
-                               offset = region.getOffset() - viewer.getVisibleRegion().getOffset();
+                               offset = region.getOffset()
+                                               - viewer.getVisibleRegion().getOffset();
                                length = region.getLength();
                        }
                        text.redrawRange(offset, length, false);
@@ -1754,7 +1796,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                        // Invalidate region ==> apply text presentation
                        fActiveRegion = region;
                        if (viewer instanceof ITextViewerExtension2)
-                               ((ITextViewerExtension2) viewer).invalidateTextPresentation(region.getOffset(), region.getLength());
+                               ((ITextViewerExtension2) viewer).invalidateTextPresentation(
+                                               region.getOffset(), region.getLength());
                        else
                                viewer.invalidateTextPresentation();
                }
@@ -1876,7 +1919,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                 */
                public void mouseMove(MouseEvent event) {
 
-                       if (event.widget instanceof Control && !((Control) event.widget).isFocusControl()) {
+                       if (event.widget instanceof Control
+                                       && !((Control) event.widget).isFocusControl()) {
                                deactivate();
                                return;
                        }
@@ -1900,7 +1944,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                                return;
                        }
 
-                       if ((event.stateMask & SWT.BUTTON1) != 0 && text.getSelectionCount() != 0) {
+                       if ((event.stateMask & SWT.BUTTON1) != 0
+                                       && text.getSelectionCount() != 0) {
                                deactivate();
                                return;
                        }
@@ -1933,7 +1978,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                 */
                public void documentAboutToBeChanged(DocumentEvent event) {
                        if (fActive && fActiveRegion != null) {
-                               fRememberedPosition = new Position(fActiveRegion.getOffset(), fActiveRegion.getLength());
+                               fRememberedPosition = new Position(fActiveRegion.getOffset(),
+                                               fActiveRegion.getLength());
                                try {
                                        event.getDocument().addPosition(fRememberedPosition);
                                } catch (BadLocationException x) {
@@ -1950,7 +1996,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                                if (!fRememberedPosition.isDeleted()) {
 
                                        event.getDocument().removePosition(fRememberedPosition);
-                                       fActiveRegion = new Region(fRememberedPosition.getOffset(), fRememberedPosition.getLength());
+                                       fActiveRegion = new Region(fRememberedPosition.getOffset(),
+                                                       fRememberedPosition.getLength());
                                        fRememberedPosition = null;
 
                                        ISourceViewer viewer = getSourceViewer();
@@ -1977,7 +2024,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                 * @see org.eclipse.jface.text.ITextInputListener#inputDocumentAboutToBeChanged(org.eclipse.jface.text.IDocument,
                 *      org.eclipse.jface.text.IDocument)
                 */
-               public void inputDocumentAboutToBeChanged(IDocument oldInput, IDocument newInput) {
+               public void inputDocumentAboutToBeChanged(IDocument oldInput,
+                               IDocument newInput) {
                        if (oldInput == null)
                                return;
                        deactivate();
@@ -2015,7 +2063,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                        if (viewer instanceof ITextViewerExtension5) {
 
                                ITextViewerExtension5 extension = (ITextViewerExtension5) viewer;
-                               IRegion widgetRange = extension.modelRange2WidgetRange(fActiveRegion);
+                               IRegion widgetRange = extension
+                                               .modelRange2WidgetRange(fActiveRegion);
                                if (widgetRange == null)
                                        return;
 
@@ -2048,7 +2097,9 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
                private boolean includes(IRegion region, IRegion position) {
                        return position.getOffset() >= region.getOffset()
-                                       && position.getOffset() + position.getLength() <= region.getOffset() + region.getLength();
+                                       && position.getOffset() + position.getLength() <= region
+                                                       .getOffset()
+                                                       + region.getLength();
                }
 
                private Point getMinimumLocation(StyledText text, int offset, int length) {
@@ -2084,9 +2135,9 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
        /**
         * This action dispatches into two behaviours: If there is no current text
-        * hover, the javadoc is displayed using information presenter. If there is a
-        * current text hover, it is converted into a information presenter in order
-        * to make it sticky.
+        * hover, the javadoc is displayed using information presenter. If there is
+        * a current text hover, it is converted into a information presenter in
+        * order to make it sticky.
         */
        class InformationDispatchAction extends TextEditorAction {
 
@@ -2096,7 +2147,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                /**
                 * Creates a dispatch action.
                 */
-               public InformationDispatchAction(ResourceBundle resourceBundle, String prefix, final TextOperationAction textOperationAction) {
+               public InformationDispatchAction(ResourceBundle resourceBundle,
+                               String prefix, final TextOperationAction textOperationAction) {
                        super(resourceBundle, prefix, PHPEditor.this);
                        if (textOperationAction == null)
                                throw new IllegalArgumentException();
@@ -2128,8 +2180,10 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                                return;
                        }
 
-                       Point hoverEventLocation = textViewerExtension2.getHoverEventLocation();
-                       int offset = computeOffsetAtLocation(sourceViewer, hoverEventLocation.x, hoverEventLocation.y);
+                       Point hoverEventLocation = textViewerExtension2
+                                       .getHoverEventLocation();
+                       int offset = computeOffsetAtLocation(sourceViewer,
+                                       hoverEventLocation.x, hoverEventLocation.y);
                        if (offset == -1) {
                                fTextOperationAction.run();
                                return;
@@ -2140,11 +2194,13 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                                IDocument document = sourceViewer.getDocument();
                                String contentType = document.getContentType(offset);
 
-                               final IRegion hoverRegion = textHover.getHoverRegion(sourceViewer, offset);
+                               final IRegion hoverRegion = textHover.getHoverRegion(
+                                               sourceViewer, offset);
                                if (hoverRegion == null)
                                        return;
 
-                               final String hoverInfo = textHover.getHoverInfo(sourceViewer, hoverRegion);
+                               final String hoverInfo = textHover.getHoverInfo(sourceViewer,
+                                               hoverRegion);
 
                                // with information provider
                                IInformationProvider informationProvider = new IInformationProvider() {
@@ -2160,13 +2216,15 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                                         * @see org.eclipse.jface.text.information.IInformationProvider#getInformation(org.eclipse.jface.text.ITextViewer,
                                         *      org.eclipse.jface.text.IRegion)
                                         */
-                                       public String getInformation(ITextViewer textViewer, IRegion subject) {
+                                       public String getInformation(ITextViewer textViewer,
+                                                       IRegion subject) {
                                                return hoverInfo;
                                        }
                                };
 
                                fInformationPresenter.setOffset(offset);
-                               fInformationPresenter.setInformationProvider(informationProvider, contentType);
+                               fInformationPresenter.setInformationProvider(
+                                               informationProvider, contentType);
                                fInformationPresenter.showInformation();
 
                        } catch (BadLocationException e) {
@@ -2183,7 +2241,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                                return -1;
 
                        try {
-                               int widgetLocation = styledText.getOffsetAtLocation(new Point(x, y));
+                               int widgetLocation = styledText.getOffsetAtLocation(new Point(
+                                               x, y));
                                if (textViewer instanceof ITextViewerExtension5) {
                                        ITextViewerExtension5 extension = (ITextViewerExtension5) textViewer;
                                        return extension.widgetOffset2ModelOffset(widgetLocation);
@@ -2200,28 +2259,29 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
        /**
         * This action implements smart home.
-        *
+        * 
         * Instead of going to the start of a line it does the following: - if smart
-        * home/end is enabled and the caret is after the line's first non-whitespace
-        * then the caret is moved directly before it, taking JavaDoc and multi-line
-        * comments into account. - if the caret is before the line's first
-        * non-whitespace the caret is moved to the beginning of the line - if the
-        * caret is at the beginning of the line see first case.
-        *
+        * home/end is enabled and the caret is after the line's first
+        * non-whitespace then the caret is moved directly before it, taking JavaDoc
+        * and multi-line comments into account. - if the caret is before the line's
+        * first non-whitespace the caret is moved to the beginning of the line - if
+        * the caret is at the beginning of the line see first case.
+        * 
         * @since 3.0
         */
        protected class SmartLineStartAction extends LineStartAction {
 
                /**
                 * Creates a new smart line start action
-                *
+                * 
                 * @param textWidget
-                *          the styled text widget
+                *            the styled text widget
                 * @param doSelect
-                *          a boolean flag which tells if the text up to the beginning of
-                *          the line should be selected
+                *            a boolean flag which tells if the text up to the beginning
+                *            of the line should be selected
                 */
-               public SmartLineStartAction(final StyledText textWidget, final boolean doSelect) {
+               public SmartLineStartAction(final StyledText textWidget,
+                               final boolean doSelect) {
                        super(textWidget, doSelect);
                }
 
@@ -2229,28 +2289,36 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                 * @see org.eclipse.ui.texteditor.AbstractTextEditor.LineStartAction#getLineStartPosition(java.lang.String,
                 *      int, java.lang.String)
                 */
-               protected int getLineStartPosition(final IDocument document, final String line, final int length, final int offset) {
+               protected int getLineStartPosition(final IDocument document,
+                               final String line, final int length, final int offset) {
 
                        String type = IDocument.DEFAULT_CONTENT_TYPE;
                        try {
-                               type = TextUtilities.getContentType(document, IPHPPartitions.PHP_PARTITIONING, offset, true);
+                               type = TextUtilities.getContentType(document,
+                                               IPHPPartitions.PHP_PARTITIONING, offset, true);
                        } catch (BadLocationException exception) {
                                // Should not happen
                        }
 
-                       int index = super.getLineStartPosition(document, line, length, offset);
-                       if (type.equals(IPHPPartitions.PHP_PHPDOC_COMMENT) || type.equals(IPHPPartitions.PHP_MULTILINE_COMMENT)) {
-                               if (index < length - 1 && line.charAt(index) == '*' && line.charAt(index + 1) != '/') {
+                       int index = super.getLineStartPosition(document, line, length,
+                                       offset);
+                       if (type.equals(IPHPPartitions.PHP_PHPDOC_COMMENT)
+                                       || type.equals(IPHPPartitions.PHP_MULTILINE_COMMENT)) {
+                               if (index < length - 1 && line.charAt(index) == '*'
+                                               && line.charAt(index + 1) != '/') {
                                        do {
                                                ++index;
-                                       } while (index < length && Character.isWhitespace(line.charAt(index)));
+                                       } while (index < length
+                                                       && Character.isWhitespace(line.charAt(index)));
                                }
                        } else {
-                               if (index < length - 1 && line.charAt(index) == '/' && line.charAt(index + 1) == '/') {
+                               if (index < length - 1 && line.charAt(index) == '/'
+                                               && line.charAt(index + 1) == '/') {
                                        index++;
                                        do {
                                                ++index;
-                                       } while (index < length && Character.isWhitespace(line.charAt(index)));
+                                       } while (index < length
+                                                       && Character.isWhitespace(line.charAt(index)));
                                }
                        }
                        return index;
@@ -2259,7 +2327,7 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
        /**
         * Text navigation action to navigate to the next sub-word.
-        *
+        * 
         * @since 3.0
         */
        protected abstract class NextSubWordAction extends TextNavigationAction {
@@ -2268,10 +2336,10 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
                /**
                 * Creates a new next sub-word action.
-                *
+                * 
                 * @param code
-                *          Action code for the default operation. Must be an action code
-                *          from
+                *            Action code for the default operation. Must be an action
+                *            code from
                 * @see org.eclipse.swt.custom.ST.
                 */
                protected NextSubWordAction(int code) {
@@ -2282,18 +2350,23 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                 * @see org.eclipse.jface.action.IAction#run()
                 */
                public void run() {
-                       // Check whether we are in a java code partition and the preference is
+                       // Check whether we are in a java code partition and the preference
+                       // is
                        // enabled
                        final IPreferenceStore store = getPreferenceStore();
-                       if (!store.getBoolean(PreferenceConstants.EDITOR_SUB_WORD_NAVIGATION)) {
+                       if (!store
+                                       .getBoolean(PreferenceConstants.EDITOR_SUB_WORD_NAVIGATION)) {
                                super.run();
                                return;
                        }
 
                        final ISourceViewer viewer = getSourceViewer();
                        final IDocument document = viewer.getDocument();
-                       fIterator.setText((CharacterIterator) new DocumentCharacterIterator(document));
-                       int position = widgetOffset2ModelOffset(viewer, viewer.getTextWidget().getCaretOffset());
+                       fIterator
+                                       .setText((CharacterIterator) new DocumentCharacterIterator(
+                                                       document));
+                       int position = widgetOffset2ModelOffset(viewer, viewer
+                                       .getTextWidget().getCaretOffset());
                        if (position == -1)
                                return;
 
@@ -2305,12 +2378,12 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                        }
 
                }
-
+               
                /**
                 * Finds the next position after the given position.
-                *
+                * 
                 * @param position
-                *          the current position
+                *            the current position
                 * @return the next position
                 */
                protected int findNextPosition(int position) {
@@ -2328,16 +2401,16 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                /**
                 * Sets the caret position to the sub-word boundary given with
                 * <code>position</code>.
-                *
+                * 
                 * @param position
-                *          Position where the action should move the caret
+                *            Position where the action should move the caret
                 */
                protected abstract void setCaretPosition(int position);
        }
 
        /**
         * Text navigation action to navigate to the next sub-word.
-        *
+        * 
         * @since 3.0
         */
        protected class NavigateNextSubWordAction extends NextSubWordAction {
@@ -2353,16 +2426,18 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                 * @see net.sourceforge.phpdt.internal.ui.javaeditor.JavaEditor.NextSubWordAction#setCaretPosition(int)
                 */
                protected void setCaretPosition(final int position) {
-                       getTextWidget().setCaretOffset(modelOffset2WidgetOffset(getSourceViewer(), position));
+                       getTextWidget().setCaretOffset(
+                                       modelOffset2WidgetOffset(getSourceViewer(), position));
                }
        }
 
        /**
         * Text operation action to delete the next sub-word.
-        *
+        * 
         * @since 3.0
         */
-       protected class DeleteNextSubWordAction extends NextSubWordAction implements IUpdate {
+       protected class DeleteNextSubWordAction extends NextSubWordAction implements
+                       IUpdate {
 
                /**
                 * Creates a new delete next sub-word action.
@@ -2379,7 +2454,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                                return;
 
                        final ISourceViewer viewer = getSourceViewer();
-                       final int caret = widgetOffset2ModelOffset(viewer, viewer.getTextWidget().getCaretOffset());
+                       final int caret = widgetOffset2ModelOffset(viewer, viewer
+                                       .getTextWidget().getCaretOffset());
 
                        try {
                                viewer.getDocument().replace(caret, position - caret, ""); //$NON-NLS-1$
@@ -2405,7 +2481,7 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
        /**
         * Text operation action to select the next sub-word.
-        *
+        * 
         * @since 3.0
         */
        protected class SelectNextSubWordAction extends NextSubWordAction {
@@ -2440,7 +2516,7 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
        /**
         * Text navigation action to navigate to the previous sub-word.
-        *
+        * 
         * @since 3.0
         */
        protected abstract class PreviousSubWordAction extends TextNavigationAction {
@@ -2449,10 +2525,10 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
                /**
                 * Creates a new previous sub-word action.
-                *
+                * 
                 * @param code
-                *          Action code for the default operation. Must be an action code
-                *          from
+                *            Action code for the default operation. Must be an action
+                *            code from
                 * @see org.eclipse.swt.custom.ST.
                 */
                protected PreviousSubWordAction(final int code) {
@@ -2463,18 +2539,23 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                 * @see org.eclipse.jface.action.IAction#run()
                 */
                public void run() {
-                       // Check whether we are in a java code partition and the preference is
+                       // Check whether we are in a java code partition and the preference
+                       // is
                        // enabled
                        final IPreferenceStore store = getPreferenceStore();
-                       if (!store.getBoolean(PreferenceConstants.EDITOR_SUB_WORD_NAVIGATION)) {
+                       if (!store
+                                       .getBoolean(PreferenceConstants.EDITOR_SUB_WORD_NAVIGATION)) {
                                super.run();
                                return;
                        }
 
                        final ISourceViewer viewer = getSourceViewer();
                        final IDocument document = viewer.getDocument();
-                       fIterator.setText((CharacterIterator) new DocumentCharacterIterator(document));
-                       int position = widgetOffset2ModelOffset(viewer, viewer.getTextWidget().getCaretOffset());
+                       fIterator
+                                       .setText((CharacterIterator) new DocumentCharacterIterator(
+                                                       document));
+                       int position = widgetOffset2ModelOffset(viewer, viewer
+                                       .getTextWidget().getCaretOffset());
                        if (position == -1)
                                return;
 
@@ -2489,9 +2570,9 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
                /**
                 * Finds the previous position before the given position.
-                *
+                * 
                 * @param position
-                *          the current position
+                *            the current position
                 * @return the previous position
                 */
                protected int findPreviousPosition(int position) {
@@ -2509,16 +2590,16 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                /**
                 * Sets the caret position to the sub-word boundary given with
                 * <code>position</code>.
-                *
+                * 
                 * @param position
-                *          Position where the action should move the caret
+                *            Position where the action should move the caret
                 */
                protected abstract void setCaretPosition(int position);
        }
 
        /**
         * Text navigation action to navigate to the previous sub-word.
-        *
+        * 
         * @since 3.0
         */
        protected class NavigatePreviousSubWordAction extends PreviousSubWordAction {
@@ -2534,16 +2615,18 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                 * @see net.sourceforge.phpdt.internal.ui.javaeditor.JavaEditor.PreviousSubWordAction#setCaretPosition(int)
                 */
                protected void setCaretPosition(final int position) {
-                       getTextWidget().setCaretOffset(modelOffset2WidgetOffset(getSourceViewer(), position));
+                       getTextWidget().setCaretOffset(
+                                       modelOffset2WidgetOffset(getSourceViewer(), position));
                }
        }
 
        /**
         * Text operation action to delete the previous sub-word.
-        *
+        * 
         * @since 3.0
         */
-       protected class DeletePreviousSubWordAction extends PreviousSubWordAction implements IUpdate {
+       protected class DeletePreviousSubWordAction extends PreviousSubWordAction
+                       implements IUpdate {
 
                /**
                 * Creates a new delete previous sub-word action.
@@ -2560,7 +2643,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                                return;
 
                        final ISourceViewer viewer = getSourceViewer();
-                       final int caret = widgetOffset2ModelOffset(viewer, viewer.getTextWidget().getCaretOffset());
+                       final int caret = widgetOffset2ModelOffset(viewer, viewer
+                                       .getTextWidget().getCaretOffset());
 
                        try {
                                viewer.getDocument().replace(position, caret - position, ""); //$NON-NLS-1$
@@ -2586,7 +2670,7 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
        /**
         * Text operation action to select the previous sub-word.
-        *
+        * 
         * @since 3.0
         */
        protected class SelectPreviousSubWordAction extends PreviousSubWordAction {
@@ -2655,18 +2739,20 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
        // }
        // };
 
-       private class PropertyChangeListener implements org.eclipse.core.runtime.Preferences.IPropertyChangeListener {
+       private class PropertyChangeListener implements
+                       org.eclipse.core.runtime.Preferences.IPropertyChangeListener {
                /*
                 * @see IPropertyChangeListener#propertyChange(PropertyChangeEvent)
                 */
-               public void propertyChange(org.eclipse.core.runtime.Preferences.PropertyChangeEvent event) {
+               public void propertyChange(
+                               org.eclipse.core.runtime.Preferences.PropertyChangeEvent event) {
                        handlePreferencePropertyChanged(event);
                }
        };
 
        /**
         * Finds and marks occurrence annotations.
-        *
+        * 
         * @since 3.0
         */
        class OccurrencesFinderJob extends Job {
@@ -2683,7 +2769,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
                private Position[] fPositions;
 
-               public OccurrencesFinderJob(IDocument document, Position[] positions, ISelection selection) {
+               public OccurrencesFinderJob(IDocument document, Position[] positions,
+                               ISelection selection) {
                        super(PHPEditorMessages.JavaEditor_markOccurrences_job_name);
                        fDocument = document;
                        fSelection = selection;
@@ -2700,7 +2787,9 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                }
 
                private boolean isCanceled() {
-                       return fCanceled || fProgressMonitor.isCanceled() || fPostSelectionValidator != null
+                       return fCanceled
+                                       || fProgressMonitor.isCanceled()
+                                       || fPostSelectionValidator != null
                                        && !(fPostSelectionValidator.isValid(fSelection) || fForcedMarkOccurrencesSelection == fSelection)
                                        || LinkedModeModel.hasInstalledModel(fDocument);
                }
@@ -2727,7 +2816,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                        if (documentProvider == null)
                                return Status.CANCEL_STATUS;
 
-                       IAnnotationModel annotationModel = documentProvider.getAnnotationModel(getEditorInput());
+                       IAnnotationModel annotationModel = documentProvider
+                                       .getAnnotationModel(getEditorInput());
                        if (annotationModel == null)
                                return Status.CANCEL_STATUS;
 
@@ -2749,8 +2839,11 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                                        // Skip this match
                                        continue;
                                }
-                               annotationMap.put(new Annotation("net.sourceforge.phpdt.ui.occurrences", false, message), //$NON-NLS-1$
-                                               position);
+                               annotationMap
+                                               .put(
+                                                               new Annotation(
+                                                                               "net.sourceforge.phpdt.ui.occurrences", false, message), //$NON-NLS-1$
+                                                               position);
                        }
 
                        if (isCanceled())
@@ -2758,16 +2851,20 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
                        synchronized (getLockObject(annotationModel)) {
                                if (annotationModel instanceof IAnnotationModelExtension) {
-                                       ((IAnnotationModelExtension) annotationModel).replaceAnnotations(fOccurrenceAnnotations, annotationMap);
+                                       ((IAnnotationModelExtension) annotationModel)
+                                                       .replaceAnnotations(fOccurrenceAnnotations,
+                                                                       annotationMap);
                                } else {
                                        removeOccurrenceAnnotations();
                                        Iterator iter = annotationMap.entrySet().iterator();
                                        while (iter.hasNext()) {
                                                Map.Entry mapEntry = (Map.Entry) iter.next();
-                                               annotationModel.addAnnotation((Annotation) mapEntry.getKey(), (Position) mapEntry.getValue());
+                                               annotationModel.addAnnotation((Annotation) mapEntry
+                                                               .getKey(), (Position) mapEntry.getValue());
                                        }
                                }
-                               fOccurrenceAnnotations = (Annotation[]) annotationMap.keySet().toArray(new Annotation[annotationMap.keySet().size()]);
+                               fOccurrenceAnnotations = (Annotation[]) annotationMap.keySet()
+                                               .toArray(new Annotation[annotationMap.keySet().size()]);
                        }
 
                        return Status.OK_STATUS;
@@ -2776,10 +2873,11 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
        /**
         * Cancels the occurrences finder job upon document changes.
-        *
+        * 
         * @since 3.0
         */
-       class OccurrencesFinderJobCanceler implements IDocumentListener, ITextInputListener {
+       class OccurrencesFinderJobCanceler implements IDocumentListener,
+                       ITextInputListener {
 
                public void install() {
                        ISourceViewer sourceViewer = getSourceViewer();
@@ -2804,7 +2902,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
                        IDocumentProvider documentProvider = getDocumentProvider();
                        if (documentProvider != null) {
-                               IDocument document = documentProvider.getDocument(getEditorInput());
+                               IDocument document = documentProvider
+                                               .getDocument(getEditorInput());
                                if (document != null)
                                        document.removeDocumentListener(this);
                        }
@@ -2828,7 +2927,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                 * @see org.eclipse.jface.text.ITextInputListener#inputDocumentAboutToBeChanged(org.eclipse.jface.text.IDocument,
                 *      org.eclipse.jface.text.IDocument)
                 */
-               public void inputDocumentAboutToBeChanged(IDocument oldInput, IDocument newInput) {
+               public void inputDocumentAboutToBeChanged(IDocument oldInput,
+                               IDocument newInput) {
                        if (oldInput == null)
                                return;
 
@@ -2848,7 +2948,7 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
        /**
         * Internal activation listener.
-        *
+        * 
         * @since 3.0
         */
        private class ActivationListener implements IWindowListener {
@@ -2858,10 +2958,15 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                 * @since 3.1
                 */
                public void windowActivated(IWorkbenchWindow window) {
-                       if (window == getEditorSite().getWorkbenchWindow() && fMarkOccurrenceAnnotations && isActivePart()) {
-                               fForcedMarkOccurrencesSelection = getSelectionProvider().getSelection();
-                               SelectionListenerWithASTManager.getDefault().forceSelectionChange(PHPEditor.this,
-                                               (ITextSelection) fForcedMarkOccurrencesSelection);
+                       if (window == getEditorSite().getWorkbenchWindow()
+                                       && fMarkOccurrenceAnnotations && isActivePart()) {
+                               fForcedMarkOccurrencesSelection = getSelectionProvider()
+                                               .getSelection();
+                               SelectionListenerWithASTManager
+                                               .getDefault()
+                                               .forceSelectionChange(
+                                                               PHPEditor.this,
+                                                               (ITextSelection) fForcedMarkOccurrencesSelection);
                        }
                }
 
@@ -2870,7 +2975,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                 * @since 3.1
                 */
                public void windowDeactivated(IWorkbenchWindow window) {
-                       if (window == getEditorSite().getWorkbenchWindow() && fMarkOccurrenceAnnotations && isActivePart())
+                       if (window == getEditorSite().getWorkbenchWindow()
+                                       && fMarkOccurrenceAnnotations && isActivePart())
                                removeOccurrenceAnnotations();
                }
 
@@ -2893,7 +2999,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
         * Updates the selection in the editor's widget with the selection of the
         * outline page.
         */
-       class OutlineSelectionChangedListener extends AbstractSelectionChangedListener {
+       class OutlineSelectionChangedListener extends
+                       AbstractSelectionChangedListener {
                public void selectionChanged(SelectionChangedEvent event) {
                        doSelectionChanged(event);
                }
@@ -2901,7 +3008,7 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
        /**
         * The internal shell activation listener for updating occurrences.
-        *
+        * 
         * @since 3.0
         */
        private ActivationListener fActivationListener = new ActivationListener();
@@ -2915,22 +3022,22 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
        /**
         * Holds the current occurrence annotations.
-        *
+        * 
         * @since 3.0
         */
        private Annotation[] fOccurrenceAnnotations = null;
 
        /**
-        * Tells whether all occurrences of the element at the current caret location
-        * are automatically marked in this editor.
-        *
+        * Tells whether all occurrences of the element at the current caret
+        * location are automatically marked in this editor.
+        * 
         * @since 3.0
         */
        private boolean fMarkOccurrenceAnnotations;
 
        /**
         * The selection used when forcing occurrence marking through code.
-        *
+        * 
         * @since 3.0
         */
        private ISelection fForcedMarkOccurrencesSelection;
@@ -2938,7 +3045,7 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
        /**
         * The document modification stamp at the time when the last occurrence
         * marking took place.
-        *
+        * 
         * @since 3.1
         */
        private long fMarkOccurrenceModificationStamp = IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP;
@@ -2946,26 +3053,20 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
        /**
         * The region of the word under the caret used to when computing the current
         * occurrence markings.
-        *
+        * 
         * @since 3.1
         */
        private IRegion fMarkOccurrenceTargetRegion;
 
        /**
-        * Tells whether the occurrence annotations are sticky i.e. whether they stay
-        * even if there's no valid Java element at the current caret position. Only
-        * valid if {@link #fMarkOccurrenceAnnotations} is <code>true</code>.
-        *
+        * Tells whether the occurrence annotations are sticky i.e. whether they
+        * stay even if there's no valid Java element at the current caret position.
+        * Only valid if {@link #fMarkOccurrenceAnnotations} is <code>true</code>.
+        * 
         * @since 3.0
         */
        private boolean fStickyOccurrenceAnnotations;
 
-       /** Preference key for showing the line number ruler */
-       // private final static String LINE_NUMBER_RULER =
-       // PreferenceConstants.EDITOR_LINE_NUMBER_RULER;
-       /** Preference key for the foreground color of the line numbers */
-       // private final static String LINE_NUMBER_COLOR =
-       // PreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR;
        /** Preference key for the link color */
        private final static String LINK_COLOR = PreferenceConstants.EDITOR_LINK_COLOR;
 
@@ -2996,7 +3097,7 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
        // SelectionChangedListener();
        /**
         * The editor selection changed listener.
-        *
+        * 
         * @since 3.0
         */
        private EditorSelectionChangedListener fEditorSelectionChangedListener;
@@ -3017,14 +3118,14 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
        /**
         * Indicates whether this editor is about to update any annotation views.
-        *
+        * 
         * @since 3.0
         */
        private boolean fIsUpdatingAnnotationViews = false;
 
        /**
         * The marker that served as last target for a goto marker request.
-        *
+        * 
         * @since 3.0
         */
        private IMarker fLastMarkerTarget = null;
@@ -3035,27 +3136,27 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
        /**
         * This editor's projection support
-        *
+        * 
         * @since 3.0
         */
        private ProjectionSupport fProjectionSupport;
 
        /**
         * This editor's projection model updater
-        *
+        * 
         * @since 3.0
         */
        private IJavaFoldingStructureProvider fProjectionModelUpdater;
 
        /**
         * The override and implements indicator manager for this editor.
-        *
+        * 
         * @since 3.0
         */
        // protected OverrideIndicatorManager fOverrideIndicatorManager;
        /**
         * The action group for folding.
-        *
+        * 
         * @since 3.0
         */
        private FoldingActionGroup fFoldingGroup;
@@ -3077,28 +3178,29 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
        /**
         * Returns the most narrow java element including the given offset
-        *
+        * 
         * @param offset
-        *          the offset inside of the requested element
+        *            the offset inside of the requested element
         */
        abstract protected IJavaElement getElementAt(int offset);
 
        /**
-        * Returns the java element of this editor's input corresponding to the given
-        * IJavaElement
+        * Returns the java element of this editor's input corresponding to the
+        * given IJavaElement
         */
        abstract protected IJavaElement getCorrespondingElement(IJavaElement element);
 
        /**
         * Sets the input of the editor's outline page.
         */
-       abstract protected void setOutlinePageInput(JavaOutlinePage page, IEditorInput input);
+       abstract protected void setOutlinePageInput(JavaOutlinePage page,
+                       IEditorInput input);
 
        /**
         * Default constructor.
         */
        public PHPEditor() {
-               super();
+               super();                
        }
 
        /*
@@ -3115,15 +3217,18 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                // jsurfer old code
                // JavaTextTools textTools =
                // PHPeclipsePlugin.getDefault().getJavaTextTools();
-               // setSourceViewerConfiguration(new PHPSourceViewerConfiguration(textTools,
+               // setSourceViewerConfiguration(new
+               // PHPSourceViewerConfiguration(textTools,
                // this, IPHPPartitions.PHP_PARTITIONING)); //,
                // IJavaPartitions.JAVA_PARTITIONING));
                IPreferenceStore store = createCombinedPreferenceStore(null);
                setPreferenceStore(store);
-               JavaTextTools textTools = PHPeclipsePlugin.getDefault().getJavaTextTools();
-               setSourceViewerConfiguration(new PHPSourceViewerConfiguration(textTools.getColorManager(), store, this,
+               JavaTextTools textTools = PHPeclipsePlugin.getDefault()
+                               .getJavaTextTools();
+               setSourceViewerConfiguration(new PHPSourceViewerConfiguration(textTools
+                               .getColorManager(), store, this,
                                IPHPPartitions.PHP_PARTITIONING));
-
+               
                // TODO changed in 3.x ?
                // setRangeIndicator(new DefaultRangeIndicator());
                // if
@@ -3138,8 +3243,10 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                // setSourceViewerConfiguration(new
                // JavaSourceViewerConfiguration(textTools.getColorManager(), store,
                // this, IJavaPartitions.JAVA_PARTITIONING));
-               fMarkOccurrenceAnnotations = store.getBoolean(PreferenceConstants.EDITOR_MARK_OCCURRENCES);
-               fStickyOccurrenceAnnotations = store.getBoolean(PreferenceConstants.EDITOR_STICKY_OCCURRENCES);
+               fMarkOccurrenceAnnotations = store
+                               .getBoolean(PreferenceConstants.EDITOR_MARK_OCCURRENCES);
+               fStickyOccurrenceAnnotations = store
+                               .getBoolean(PreferenceConstants.EDITOR_STICKY_OCCURRENCES);
                // fMarkTypeOccurrences=
                // store.getBoolean(PreferenceConstants.EDITOR_MARK_TYPE_OCCURRENCES);
                // fMarkMethodOccurrences=
@@ -3173,28 +3280,36 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
         */
        private void updateHoverBehavior() {
                SourceViewerConfiguration configuration = getSourceViewerConfiguration();
-               String[] types = configuration.getConfiguredContentTypes(getSourceViewer());
+               String[] types = configuration
+                               .getConfiguredContentTypes(getSourceViewer());
 
                for (int i = 0; i < types.length; i++) {
 
                        String t = types[i];
 
-                       int[] stateMasks = configuration.getConfiguredTextHoverStateMasks(getSourceViewer(), t);
+                       int[] stateMasks = configuration.getConfiguredTextHoverStateMasks(
+                                       getSourceViewer(), t);
 
                        ISourceViewer sourceViewer = getSourceViewer();
                        if (sourceViewer instanceof ITextViewerExtension2) {
                                if (stateMasks != null) {
                                        for (int j = 0; j < stateMasks.length; j++) {
                                                int stateMask = stateMasks[j];
-                                               ITextHover textHover = configuration.getTextHover(sourceViewer, t, stateMask);
-                                               ((ITextViewerExtension2) sourceViewer).setTextHover(textHover, t, stateMask);
+                                               ITextHover textHover = configuration.getTextHover(
+                                                               sourceViewer, t, stateMask);
+                                               ((ITextViewerExtension2) sourceViewer).setTextHover(
+                                                               textHover, t, stateMask);
                                        }
                                } else {
-                                       ITextHover textHover = configuration.getTextHover(sourceViewer, t);
-                                       ((ITextViewerExtension2) sourceViewer).setTextHover(textHover, t, ITextViewerExtension2.DEFAULT_HOVER_STATE_MASK);
+                                       ITextHover textHover = configuration.getTextHover(
+                                                       sourceViewer, t);
+                                       ((ITextViewerExtension2) sourceViewer).setTextHover(
+                                                       textHover, t,
+                                                       ITextViewerExtension2.DEFAULT_HOVER_STATE_MASK);
                                }
                        } else
-                               sourceViewer.setTextHover(configuration.getTextHover(sourceViewer, t), t);
+                               sourceViewer.setTextHover(configuration.getTextHover(
+                                               sourceViewer, t), t);
                }
        }
 
@@ -3218,7 +3333,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
        }
 
        boolean isFoldingEnabled() {
-               return PHPeclipsePlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_FOLDING_ENABLED);
+               return PHPeclipsePlugin.getDefault().getPreferenceStore().getBoolean(
+                               PreferenceConstants.EDITOR_FOLDING_ENABLED);
        }
 
        /*
@@ -3232,34 +3348,44 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
                ProjectionViewer projectionViewer = (ProjectionViewer) getSourceViewer();
 
-               fProjectionSupport = new ProjectionSupport(projectionViewer, getAnnotationAccess(), getSharedColors());
-               fProjectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.error"); //$NON-NLS-1$
-               fProjectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.warning"); //$NON-NLS-1$
-               fProjectionSupport.setHoverControlCreator(new IInformationControlCreator() {
-                       public IInformationControl createInformationControl(Shell shell) {
-                               return new CustomSourceInformationControl(shell, IDocument.DEFAULT_CONTENT_TYPE);
-                       }
-               });
+               fProjectionSupport = new ProjectionSupport(projectionViewer,
+                               getAnnotationAccess(), getSharedColors());
+               fProjectionSupport
+                               .addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.error"); //$NON-NLS-1$
+               fProjectionSupport
+                               .addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.warning"); //$NON-NLS-1$
+               fProjectionSupport
+                               .setHoverControlCreator(new IInformationControlCreator() {
+                                       public IInformationControl createInformationControl(
+                                                       Shell shell) {
+                                               return new CustomSourceInformationControl(shell,
+                                                               IDocument.DEFAULT_CONTENT_TYPE);
+                                       }
+                               });
                fProjectionSupport.install();
 
-               fProjectionModelUpdater = PHPeclipsePlugin.getDefault().getFoldingStructureProviderRegistry().getCurrentFoldingProvider();
+               fProjectionModelUpdater = PHPeclipsePlugin.getDefault()
+                               .getFoldingStructureProviderRegistry()
+                               .getCurrentFoldingProvider();
                if (fProjectionModelUpdater != null)
                        fProjectionModelUpdater.install(this, projectionViewer);
 
                if (isFoldingEnabled())
                        projectionViewer.doOperation(ProjectionViewer.TOGGLE);
-               Preferences preferences = PHPeclipsePlugin.getDefault().getPluginPreferences();
+               Preferences preferences = PHPeclipsePlugin.getDefault()
+                               .getPluginPreferences();
                preferences.addPropertyChangeListener(fPropertyChangeListener);
-
                IInformationControlCreator informationControlCreator = new IInformationControlCreator() {
                        public IInformationControl createInformationControl(Shell parent) {
                                boolean cutDown = false;
                                int style = cutDown ? SWT.NONE : (SWT.V_SCROLL | SWT.H_SCROLL);
-                               return new DefaultInformationControl(parent, SWT.RESIZE, style, new HTMLTextPresenter(cutDown));
+                               return new DefaultInformationControl(parent, SWT.RESIZE, style,
+                                               new HTMLTextPresenter(cutDown));
                        }
                };
 
-               fInformationPresenter = new InformationPresenter(informationControlCreator);
+               fInformationPresenter = new InformationPresenter(
+                               informationControlCreator);
                fInformationPresenter.setSizeConstraints(60, 10, true, true);
                fInformationPresenter.install(getSourceViewer());
 
@@ -3269,28 +3395,57 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                if (isBrowserLikeLinks())
                        enableBrowserLikeLinks();
 
-               if (PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_DISABLE_OVERWRITE_MODE))
+               if (PreferenceConstants.getPreferenceStore().getBoolean(
+                               PreferenceConstants.EDITOR_DISABLE_OVERWRITE_MODE))
                        enableOverwriteMode(false);
 
                if (fMarkOccurrenceAnnotations)
                        installOccurrencesFinder();
 
                PlatformUI.getWorkbench().addWindowListener(fActivationListener);
-
+               
+               /*
+                * start of EDITOR_SAVE_ON_BLUR
+                * ed_mann
+                */
+               final PHPEditor editor = this;
+               FocusListener focusListener = new FocusListener() {
+                       
+                     public void focusGained(FocusEvent e) {
+                         return;
+                       }
+
+                       public void focusLost(FocusEvent e) {
+                               //viewer.get
+                               if(editor.isDirty() && PHPeclipsePlugin.getDefault().getPreferenceStore()
+                                                       .getBoolean(PreferenceConstants.EDITOR_SAVE_ON_BLUR)){
+                                       editor.doSave(null);
+                               }
+                       }
+                     };
+                 projectionViewer.getTextWidget().addFocusListener(focusListener);
+                       /*
+                        * end of EDITOR_SAVE_ON_BLUR
+                        * ed_mann
+                        */
+                 
                setWordWrap();
        }
 
        private void setWordWrap() {
                if (getSourceViewer() != null) {
                        getSourceViewer().getTextWidget().setWordWrap(
-                                       PHPeclipsePlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_WRAP_WORDS));
+                                       PHPeclipsePlugin.getDefault().getPreferenceStore()
+                                                       .getBoolean(PreferenceConstants.EDITOR_WRAP_WORDS));
                }
        }
 
-       protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
+       protected void configureSourceViewerDecorationSupport(
+                       SourceViewerDecorationSupport support) {
 
                support.setCharacterPairMatcher(fBracketMatcher);
-               support.setMatchingCharacterPainterPreferenceKeys(MATCHING_BRACKETS, MATCHING_BRACKETS_COLOR);
+               support.setMatchingCharacterPainterPreferenceKeys(MATCHING_BRACKETS,
+                               MATCHING_BRACKETS_COLOR);
 
                super.configureSourceViewerDecorationSupport(support);
        }
@@ -3309,20 +3464,23 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
         * Jumps to the next enabled annotation according to the given direction. An
         * annotation type is enabled if it is configured to be in the Next/Previous
         * tool bar drop down menu and if it is checked.
-        *
+        * 
         * @param forward
-        *          <code>true</code> if search direction is forward,
-        *          <code>false</code> if backward
+        *            <code>true</code> if search direction is forward,
+        *            <code>false</code> if backward
         */
        public Annotation gotoAnnotation(boolean forward) {
-               ITextSelection selection = (ITextSelection) getSelectionProvider().getSelection();
+               ITextSelection selection = (ITextSelection) getSelectionProvider()
+                               .getSelection();
                Position position = new Position(0, 0);
-               Annotation annotation=null;
+               Annotation annotation = null;
                if (false /* delayed - see bug 18316 */) {
-                       annotation=getNextAnnotation(selection.getOffset(), selection.getLength(), forward, position);
+                       annotation = getNextAnnotation(selection.getOffset(), selection
+                                       .getLength(), forward, position);
                        selectAndReveal(position.getOffset(), position.getLength());
                } else /* no delay - see bug 18316 */{
-                       annotation = getNextAnnotation(selection.getOffset(), selection.getLength(), forward, position);
+                       annotation = getNextAnnotation(selection.getOffset(), selection
+                                       .getLength(), forward, position);
                        setStatusLineErrorMessage(null);
                        setStatusLineMessage(null);
                        if (annotation != null) {
@@ -3336,9 +3494,9 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
        /**
         * Returns the lock object for the given annotation model.
-        *
+        * 
         * @param annotationModel
-        *          the annotation model
+        *            the annotation model
         * @return the annotation model's lock object
         * @since 3.0
         */
@@ -3351,9 +3509,9 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
        /**
         * Updates the annotation views that show the given annotation.
-        *
+        * 
         * @param annotation
-        *          the annotation
+        *            the annotation
         */
        private void updateAnnotationViews(Annotation annotation) {
                IMarker marker = null;
@@ -3376,27 +3534,35 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                        try {
                                boolean isProblem = marker.isSubtypeOf(IMarker.PROBLEM);
                                IWorkbenchPage page = getSite().getPage();
-                               IViewPart view = page.findView(isProblem ? IPageLayout.ID_PROBLEM_VIEW : IPageLayout.ID_TASK_LIST); //$NON-NLS-1$  //$NON-NLS-2$
+                               IViewPart view = page
+                                               .findView(isProblem ? IPageLayout.ID_PROBLEM_VIEW
+                                                               : IPageLayout.ID_TASK_LIST); //$NON-NLS-1$  //$NON-NLS-2$
                                if (view != null) {
-                                       Method method = view.getClass().getMethod("setSelection", new Class[] { IStructuredSelection.class, boolean.class }); //$NON-NLS-1$
-                                       method.invoke(view, new Object[] { new StructuredSelection(marker), Boolean.TRUE });
+                                       Method method = view
+                                                       .getClass()
+                                                       .getMethod(
+                                                                       "setSelection", new Class[] { IStructuredSelection.class, boolean.class }); //$NON-NLS-1$
+                                       method.invoke(view, new Object[] {
+                                                       new StructuredSelection(marker), Boolean.TRUE });
                                }
                        } catch (CoreException x) {
                        } catch (NoSuchMethodException x) {
                        } catch (IllegalAccessException x) {
                        } catch (InvocationTargetException x) {
                        }
-                       // ignore exceptions, don't update any of the lists, just set status line
+                       // ignore exceptions, don't update any of the lists, just set status
+                       // line
                }
        }
 
        /**
         * Returns this document's complete text.
-        *
+        * 
         * @return the document's complete text
         */
        public String get() {
-               IDocument doc = this.getDocumentProvider().getDocument(this.getEditorInput());
+               IDocument doc = this.getDocumentProvider().getDocument(
+                               this.getEditorInput());
                return doc.get();
        }
 
@@ -3426,9 +3592,10 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
        protected void createActions() {
                super.createActions();
 
-               ActionGroup oeg, ovg, jsg, sg;
-               fActionGroups = new CompositeActionGroup(new ActionGroup[] { oeg = new OpenEditorActionGroup(this),
-               // sg= new ShowActionGroup(this),
+               ActionGroup oeg/*, ovg, jsg, sg*/;
+               fActionGroups = new CompositeActionGroup(
+                               new ActionGroup[] { oeg = new OpenEditorActionGroup(this),
+                               // sg= new ShowActionGroup(this),
                                // ovg= new OpenViewActionGroup(this),
                                // jsg= new JavaSearchActionGroup(this)
                                });
@@ -3450,7 +3617,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                // IJavaHelpContextIds.SHOW_JAVADOC_ACTION);
 
                Action action = new GotoMatchingBracketAction(this);
-               action.setActionDefinitionId(PHPEditorActionDefinitionIds.GOTO_MATCHING_BRACKET);
+               action
+                               .setActionDefinitionId(PHPEditorActionDefinitionIds.GOTO_MATCHING_BRACKET);
                setAction(GotoMatchingBracketAction.GOTO_MATCHING_BRACKET, action);
 
                // action= new
@@ -3520,7 +3688,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                // setAction("RemoveOccurrenceAnnotations", action); //$NON-NLS-1$
 
                // add annotation actions
-               action = new JavaSelectMarkerRulerAction2(PHPEditorMessages.getResourceBundle(), "Editor.RulerAnnotationSelection.", this); //$NON-NLS-1$
+               action = new JavaSelectMarkerRulerAction2(PHPEditorMessages
+                               .getResourceBundle(), "Editor.RulerAnnotationSelection.", this); //$NON-NLS-1$
                setAction("AnnotationAction", action); //$NON-NLS-1$
        }
 
@@ -3530,7 +3699,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                if (getSourceViewer() instanceof JavaSourceViewer) {
                        JavaSourceViewer viewer = (JavaSourceViewer) getSourceViewer();
                        if (viewer.getReconciler() == null) {
-                               IReconciler reconciler = getSourceViewerConfiguration().getReconciler(viewer);
+                               IReconciler reconciler = getSourceViewerConfiguration()
+                                               .getReconciler(viewer);
                                if (reconciler != null) {
                                        reconciler.install(viewer);
                                        viewer.setReconciler(reconciler);
@@ -3557,8 +3727,10 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
        protected void setPreferenceStore(IPreferenceStore store) {
                super.setPreferenceStore(store);
                if (getSourceViewerConfiguration() instanceof PHPSourceViewerConfiguration) {
-                       JavaTextTools textTools = PHPeclipsePlugin.getDefault().getJavaTextTools();
-                       setSourceViewerConfiguration(new PHPSourceViewerConfiguration(textTools.getColorManager(), store, this,
+                       JavaTextTools textTools = PHPeclipsePlugin.getDefault()
+                                       .getJavaTextTools();
+                       setSourceViewerConfiguration(new PHPSourceViewerConfiguration(
+                                       textTools.getColorManager(), store, this,
                                        IPHPPartitions.PHP_PARTITIONING));
                }
                if (getSourceViewer() instanceof JavaSourceViewer)
@@ -3607,7 +3779,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                }
 
                if (fPropertyChangeListener != null) {
-                       Preferences preferences = PHPeclipsePlugin.getDefault().getPluginPreferences();
+                       Preferences preferences = PHPeclipsePlugin.getDefault()
+                                       .getPluginPreferences();
                        preferences.removePropertyChangeListener(fPropertyChangeListener);
                        fPropertyChangeListener = null;
                }
@@ -3632,8 +3805,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
        /**
         * The <code>PHPEditor</code> implementation of this
-        * <code>AbstractTextEditor</code> method performs any extra revert behavior
-        * required by the php editor.
+        * <code>AbstractTextEditor</code> method performs any extra revert
+        * behavior required by the php editor.
         */
        // public void doRevertToSaved() {
        // super.doRevertToSaved();
@@ -3741,7 +3914,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
                // install & register preference store listener
                sourceViewer.configure(getSourceViewerConfiguration());
-               getSourceViewerDecorationSupport(sourceViewer).install(getPreferenceStore());
+               getSourceViewerDecorationSupport(sourceViewer).install(
+                               getPreferenceStore());
                if (isBrowserLikeLinks())
                        enableBrowserLikeLinks();
 
@@ -3761,10 +3935,13 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
         */
        public void editorContextMenuAboutToShow(MenuManager menu) {
                super.editorContextMenuAboutToShow(menu);
-               menu.appendToGroup(ITextEditorActionConstants.GROUP_UNDO, new Separator(IContextMenuConstants.GROUP_OPEN));
-               menu.insertAfter(IContextMenuConstants.GROUP_OPEN, new GroupMarker(IContextMenuConstants.GROUP_SHOW));
+               menu.appendToGroup(ITextEditorActionConstants.GROUP_UNDO,
+                               new Separator(IContextMenuConstants.GROUP_OPEN));
+               menu.insertAfter(IContextMenuConstants.GROUP_OPEN, new GroupMarker(
+                               IContextMenuConstants.GROUP_SHOW));
 
-               ActionContext context = new ActionContext(getSelectionProvider().getSelection());
+               ActionContext context = new ActionContext(getSelectionProvider()
+                               .getSelection());
                fContextMenuGroup.setContext(context);
                fContextMenuGroup.fillContextMenu(menu);
                fContextMenuGroup.setContext(null);
@@ -3800,28 +3977,30 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
        }
 
        /**
-        * Synchronizes the outliner selection with the given element position in the
-        * editor.
-        *
+        * Synchronizes the outliner selection with the given element position in
+        * the editor.
+        * 
         * @param element
-        *          the java element to select
+        *            the java element to select
         */
        protected void synchronizeOutlinePage(ISourceReference element) {
                synchronizeOutlinePage(element, true);
        }
 
        /**
-        * Synchronizes the outliner selection with the given element position in the
-        * editor.
-        *
+        * Synchronizes the outliner selection with the given element position in
+        * the editor.
+        * 
         * @param element
-        *          the java element to select
+        *            the java element to select
         * @param checkIfOutlinePageActive
-        *          <code>true</code> if check for active outline page needs to be
-        *          done
+        *            <code>true</code> if check for active outline page needs to
+        *            be done
         */
-       protected void synchronizeOutlinePage(ISourceReference element, boolean checkIfOutlinePageActive) {
-               if (fOutlinePage != null && element != null && !(checkIfOutlinePageActive && isJavaOutlinePageActive())) {
+       protected void synchronizeOutlinePage(ISourceReference element,
+                       boolean checkIfOutlinePageActive) {
+               if (fOutlinePage != null && element != null
+                               && !(checkIfOutlinePageActive && isJavaOutlinePageActive())) {
                        fOutlineSelectionChangedListener.uninstall(fOutlinePage);
                        fOutlinePage.select(element);
                        fOutlineSelectionChangedListener.install(fOutlinePage);
@@ -3829,8 +4008,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
        }
 
        /**
-        * Synchronizes the outliner selection with the actual cursor position in the
-        * editor.
+        * Synchronizes the outliner selection with the actual cursor position in
+        * the editor.
         */
        public void synchronizeOutlinePageSelection() {
                synchronizeOutlinePage(computeHighlightRangeSourceReference());
@@ -3867,7 +4046,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                ISelection selection = getSelectionProvider().getSelection();
                if (selection instanceof TextSelection) {
                        TextSelection textSelection = (TextSelection) selection;
-                       if (textSelection.getOffset() != 0 || textSelection.getLength() != 0)
+                       if (textSelection.getOffset() != 0
+                                       || textSelection.getLength() != 0)
                                markInNavigationHistory();
                }
 
@@ -3959,9 +4139,10 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                        // IClassFile)
                        // {
                        /*
-                        * If the element is an ICompilationUnit this unit is either the input of
-                        * this editor or not being displayed. In both cases, nothing should
-                        * happened. (http://dev.eclipse.org/bugs/show_bug.cgi?id=5128)
+                        * If the element is an ICompilationUnit this unit is either the
+                        * input of this editor or not being displayed. In both cases,
+                        * nothing should happened.
+                        * (http://dev.eclipse.org/bugs/show_bug.cgi?id=5128)
                         */
                        return;
                }
@@ -4011,13 +4192,15 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                if (required == IShowInTargetList.class) {
                        return new IShowInTargetList() {
                                public String[] getShowInTargetIds() {
-                                       return new String[] { JavaUI.ID_PACKAGES, IPageLayout.ID_OUTLINE, IPageLayout.ID_RES_NAV };
+                                       return new String[] { JavaUI.ID_PACKAGES,
+                                                       IPageLayout.ID_OUTLINE, IPageLayout.ID_RES_NAV };
                                }
 
                        };
                }
                if (fProjectionSupport != null) {
-                       Object adapter = fProjectionSupport.getAdapter(getSourceViewer(), required);
+                       Object adapter = fProjectionSupport.getAdapter(getSourceViewer(),
+                                       required);
                        if (adapter != null)
                                return adapter;
                }
@@ -4074,18 +4257,23 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
                        IJavaElement element = getElementAt(offset);
                        while (element instanceof ISourceReference) {
-                               ISourceRange range = ((ISourceReference) element).getSourceRange();
-                               if (offset < range.getOffset() + range.getLength() && range.getOffset() < offset + length) {
+                               ISourceRange range = ((ISourceReference) element)
+                                               .getSourceRange();
+                               if (offset < range.getOffset() + range.getLength()
+                                               && range.getOffset() < offset + length) {
 
                                        ISourceViewer viewer = getSourceViewer();
                                        if (viewer instanceof ITextViewerExtension5) {
                                                ITextViewerExtension5 extension = (ITextViewerExtension5) viewer;
-                                               extension.exposeModelRange(new Region(range.getOffset(), range.getLength()));
+                                               extension.exposeModelRange(new Region(
+                                                               range.getOffset(), range.getLength()));
                                        }
 
-                                       setHighlightRange(range.getOffset(), range.getLength(), true);
+                                       setHighlightRange(range.getOffset(), range.getLength(),
+                                                       true);
                                        if (fOutlinePage != null) {
-                                               fOutlineSelectionChangedListener.uninstall(fOutlinePage);
+                                               fOutlineSelectionChangedListener
+                                                               .uninstall(fOutlinePage);
                                                fOutlinePage.select((ISourceReference) element);
                                                fOutlineSelectionChangedListener.install(fOutlinePage);
                                        }
@@ -4168,10 +4356,12 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                        if (PreferenceConstants.EDITOR_TAB_WIDTH.equals(property)) {
                                Object value = event.getNewValue();
                                if (value instanceof Integer) {
-                                       sourceViewer.getTextWidget().setTabs(((Integer) value).intValue());
+                                       sourceViewer.getTextWidget().setTabs(
+                                                       ((Integer) value).intValue());
                                } else if (value instanceof String) {
                                        try {
-                                               sourceViewer.getTextWidget().setTabs(Integer.parseInt((String) value));
+                                               sourceViewer.getTextWidget().setTabs(
+                                                               Integer.parseInt((String) value));
                                        } catch (NumberFormatException e) {
                                                // bug #1038071 - set default tab:
                                                sourceViewer.getTextWidget().setTabs(80);
@@ -4215,7 +4405,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                                return;
                        }
 
-                       if (PreferenceConstants.EDITOR_DISABLE_OVERWRITE_MODE.equals(property)) {
+                       if (PreferenceConstants.EDITOR_DISABLE_OVERWRITE_MODE
+                                       .equals(property)) {
                                if (event.getNewValue() instanceof Boolean) {
                                        Boolean disable = (Boolean) event.getNewValue();
                                        enableOverwriteMode(!disable.booleanValue());
@@ -4226,9 +4417,11 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                        boolean newBooleanValue = false;
                        Object newValue = event.getNewValue();
                        if (newValue != null)
-                               newBooleanValue = Boolean.valueOf(newValue.toString()).booleanValue();
+                               newBooleanValue = Boolean.valueOf(newValue.toString())
+                                               .booleanValue();
 
-                       if (PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE.equals(property)) {
+                       if (PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE
+                                       .equals(property)) {
                                if (newBooleanValue)
                                        selectionChanged();
                                return;
@@ -4260,7 +4453,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                        // if (stickyOccurrenceAnnotations != fStickyOccurrenceAnnotations)
                        // {
 
-                       ((PHPSourceViewerConfiguration) getSourceViewerConfiguration()).handlePropertyChangeEvent(event);
+                       ((PHPSourceViewerConfiguration) getSourceViewerConfiguration())
+                                       .handlePropertyChangeEvent(event);
 
                        // if (affectsOverrideIndicatorAnnotations(event)) {
                        // if (isShowingOverrideIndicators()) {
@@ -4279,7 +4473,9 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                                        if (fProjectionModelUpdater != null)
                                                fProjectionModelUpdater.uninstall();
                                        // either freshly enabled or provider changed
-                                       fProjectionModelUpdater = PHPeclipsePlugin.getDefault().getFoldingStructureProviderRegistry().getCurrentFoldingProvider();
+                                       fProjectionModelUpdater = PHPeclipsePlugin.getDefault()
+                                                       .getFoldingStructureProviderRegistry()
+                                                       .getCurrentFoldingProvider();
                                        if (fProjectionModelUpdater != null) {
                                                fProjectionModelUpdater.install(this, projectionViewer);
                                        }
@@ -4366,7 +4562,7 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
        /**
         * Return whether the browser like links should be enabled according to the
         * preference store settings.
-        *
+        * 
         * @return <code>true</code> if the browser like links should be enabled
         */
        private boolean isBrowserLikeLinks() {
@@ -4397,16 +4593,18 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
        /**
         * Handles a property change event describing a change of the java core's
         * preferences and updates the preference related editor properties.
-        *
+        * 
         * @param event
-        *          the property change event
+        *            the property change event
         */
-       protected void handlePreferencePropertyChanged(org.eclipse.core.runtime.Preferences.PropertyChangeEvent event) {
+       protected void handlePreferencePropertyChanged(
+                       org.eclipse.core.runtime.Preferences.PropertyChangeEvent event) {
                if (COMPILER_TASK_TAGS.equals(event.getProperty())) {
                        ISourceViewer sourceViewer = getSourceViewer();
                        if (sourceViewer != null
-                                       && affectsTextPresentation(new PropertyChangeEvent(event.getSource(), event.getProperty(), event.getOldValue(), event
-                                                       .getNewValue())))
+                                       && affectsTextPresentation(new PropertyChangeEvent(event
+                                                       .getSource(), event.getProperty(), event
+                                                       .getOldValue(), event.getNewValue())))
                                sourceViewer.invalidateTextPresentation();
                }
                if (PreferenceConstants.EDITOR_WRAP_WORDS.equals(event.getProperty())) {
@@ -4415,9 +4613,9 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
        }
 
        /**
-        * Return whether the line number ruler column should be visible according to
-        * the preference store settings.
-        *
+        * Return whether the line number ruler column should be visible according
+        * to the preference store settings.
+        * 
         * @return <code>true</code> if the line numbers should be visible
         */
        // protected boolean isLineNumberRulerVisible() {
@@ -4456,9 +4654,9 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
        /**
         * Initializes the given line number ruler column from the preference store.
-        *
+        * 
         * @param rulerColumn
-        *          the ruler column to be initialized
+        *            the ruler column to be initialized
         */
        // protected void initializeLineNumberRulerColumn(LineNumberRulerColumn
        // rulerColumn) {
@@ -4636,7 +4834,7 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
         * Preference key for key modifier mask of browser like links. The value is
         * only used if the value of <code>EDITOR_BROWSER_LIKE_LINKS</code> cannot
         * be resolved to valid SWT modifier bits.
-        *
+        * 
         * @since 2.1.1
         */
        private final static String BROWSER_LIKE_LINKS_KEY_MODIFIER_MASK = PreferenceConstants.EDITOR_BROWSER_LIKE_LINKS_KEY_MODIFIER_MASK;
@@ -4655,7 +4853,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                        return false;
 
                try {
-                       return isBracket(document.getChar(offset - 1)) && isBracket(document.getChar(offset));
+                       return isBracket(document.getChar(offset - 1))
+                                       && isBracket(document.getChar(offset));
 
                } catch (BadLocationException e) {
                        return false;
@@ -4715,15 +4914,17 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
        // }
        /**
         * Returns the Java element wrapped by this editors input.
-        *
+        * 
         * @return the Java element wrapped by this editors input.
         * @since 3.0
         */
        abstract protected IJavaElement getInputJavaElement();
 
        protected void updateStatusLine() {
-               ITextSelection selection = (ITextSelection) getSelectionProvider().getSelection();
-               Annotation annotation = getAnnotation(selection.getOffset(), selection.getLength());
+               ITextSelection selection = (ITextSelection) getSelectionProvider()
+                               .getSelection();
+               Annotation annotation = getAnnotation(selection.getOffset(), selection
+                               .getLength());
                setStatusLineErrorMessage(null);
                setStatusLineMessage(null);
                if (annotation != null) {
@@ -4733,7 +4934,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                        } finally {
                                fIsUpdatingAnnotationViews = false;
                        }
-                       if (annotation instanceof IJavaAnnotation && ((IJavaAnnotation) annotation).isProblem())
+                       if (annotation instanceof IJavaAnnotation
+                                       && ((IJavaAnnotation) annotation).isProblem())
                                setStatusLineMessage(annotation.getText());
                }
        }
@@ -4752,7 +4954,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
                int selectionLength = Math.abs(selection.getLength());
                if (selectionLength > 1) {
-                       setStatusLineErrorMessage(PHPEditorMessages.getString("GotoMatchingBracket.error.invalidSelection")); //$NON-NLS-1$
+                       setStatusLineErrorMessage(PHPEditorMessages
+                                       .getString("GotoMatchingBracket.error.invalidSelection")); //$NON-NLS-1$
                        sourceViewer.getTextWidget().getDisplay().beep();
                        return;
                }
@@ -4764,7 +4967,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
                IRegion region = fBracketMatcher.match(document, sourceCaretOffset);
                if (region == null) {
-                       setStatusLineErrorMessage(PHPEditorMessages.getString("GotoMatchingBracket.error.noMatchingBracket")); //$NON-NLS-1$
+                       setStatusLineErrorMessage(PHPEditorMessages
+                                       .getString("GotoMatchingBracket.error.noMatchingBracket")); //$NON-NLS-1$
                        sourceViewer.getTextWidget().getDisplay().beep();
                        return;
                }
@@ -4776,7 +4980,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                        return;
 
                int anchor = fBracketMatcher.getAnchor();
-               int targetOffset = (PHPPairMatcher.RIGHT == anchor) ? offset : offset + length - 1;
+               int targetOffset = (PHPPairMatcher.RIGHT == anchor) ? offset : offset
+                               + length - 1;
 
                boolean visible = false;
                if (sourceViewer instanceof ITextViewerExtension5) {
@@ -4784,11 +4989,14 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                        visible = (extension.modelOffset2WidgetOffset(targetOffset) > -1);
                } else {
                        IRegion visibleRegion = sourceViewer.getVisibleRegion();
-                       visible = (targetOffset >= visibleRegion.getOffset() && targetOffset < visibleRegion.getOffset() + visibleRegion.getLength());
+                       visible = (targetOffset >= visibleRegion.getOffset() && targetOffset < visibleRegion
+                                       .getOffset()
+                                       + visibleRegion.getLength());
                }
 
                if (!visible) {
-                       setStatusLineErrorMessage(PHPEditorMessages.getString("GotoMatchingBracket.error.bracketOutsideSelectedElement")); //$NON-NLS-1$
+                       setStatusLineErrorMessage(PHPEditorMessages
+                                       .getString("GotoMatchingBracket.error.bracketOutsideSelectedElement")); //$NON-NLS-1$
                        sourceViewer.getTextWidget().getDisplay().beep();
                        return;
                }
@@ -4802,9 +5010,9 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
        /**
         * Ses the given message as error message to this editor's status line.
-        *
+        * 
         * @param msg
-        *          message to be set
+        *            message to be set
         */
        protected void setStatusLineErrorMessage(String msg) {
                IEditorStatusLine statusLine = (IEditorStatusLine) getAdapter(IEditorStatusLine.class);
@@ -4814,9 +5022,9 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
        /**
         * Sets the given message as message to this editor's status line.
-        *
+        * 
         * @param msg
-        *          message to be set
+        *            message to be set
         * @since 3.0
         */
        protected void setStatusLineMessage(String msg) {
@@ -4829,19 +5037,20 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
         * Returns the annotation closest to the given range respecting the given
         * direction. If an annotation is found, the annotations current position is
         * copied into the provided annotation position.
-        *
+        * 
         * @param offset
-        *          the region offset
+        *            the region offset
         * @param length
-        *          the region length
+        *            the region length
         * @param forward
-        *          <code>true</code> for forwards, <code>false</code> for
-        *          backward
+        *            <code>true</code> for forwards, <code>false</code> for
+        *            backward
         * @param annotationPosition
-        *          the position of the found annotation
+        *            the position of the found annotation
         * @return the found annotation
         */
-       private Annotation getNextAnnotation(final int offset, final int length, boolean forward, Position annotationPosition) {
+       private Annotation getNextAnnotation(final int offset, final int length,
+                       boolean forward, Position annotationPosition) {
 
                Annotation nextAnnotation = null;
                Position nextAnnotationPosition = null;
@@ -4849,26 +5058,32 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                Position containingAnnotationPosition = null;
                boolean currentAnnotation = false;
 
-               IDocument document = getDocumentProvider().getDocument(getEditorInput());
+               IDocument document = getDocumentProvider()
+                               .getDocument(getEditorInput());
                int endOfDocument = document.getLength();
                int distance = Integer.MAX_VALUE;
 
-               IAnnotationModel model = getDocumentProvider().getAnnotationModel(getEditorInput());
+               IAnnotationModel model = getDocumentProvider().getAnnotationModel(
+                               getEditorInput());
                Iterator e = new JavaAnnotationIterator(model, true, true);
                while (e.hasNext()) {
                        Annotation a = (Annotation) e.next();
-                       if ((a instanceof IJavaAnnotation) && ((IJavaAnnotation) a).hasOverlay() || !isNavigationTarget(a))
+                       if ((a instanceof IJavaAnnotation)
+                                       && ((IJavaAnnotation) a).hasOverlay()
+                                       || !isNavigationTarget(a))
                                continue;
 
                        Position p = model.getPosition(a);
                        if (p == null)
                                continue;
 
-                       if (forward && p.offset == offset || !forward && p.offset + p.getLength() == offset + length) {// ||
+                       if (forward && p.offset == offset || !forward
+                                       && p.offset + p.getLength() == offset + length) {// ||
                                // p.includes(offset))
                                // {
                                if (containingAnnotation == null
-                                               || (forward && p.length >= containingAnnotationPosition.length || !forward
+                                               || (forward
+                                                               && p.length >= containingAnnotationPosition.length || !forward
                                                                && p.length >= containingAnnotationPosition.length)) {
                                        containingAnnotation = a;
                                        containingAnnotationPosition = p;
@@ -4882,17 +5097,22 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                                        if (currentDistance < 0)
                                                currentDistance = endOfDocument + currentDistance;
 
-                                       if (currentDistance < distance || currentDistance == distance && p.length < nextAnnotationPosition.length) {
+                                       if (currentDistance < distance
+                                                       || currentDistance == distance
+                                                       && p.length < nextAnnotationPosition.length) {
                                                distance = currentDistance;
                                                nextAnnotation = a;
                                                nextAnnotationPosition = p;
                                        }
                                } else {
-                                       currentDistance = offset + length - (p.getOffset() + p.length);
+                                       currentDistance = offset + length
+                                                       - (p.getOffset() + p.length);
                                        if (currentDistance < 0)
                                                currentDistance = endOfDocument + currentDistance;
 
-                                       if (currentDistance < distance || currentDistance == distance && p.length < nextAnnotationPosition.length) {
+                                       if (currentDistance < distance
+                                                       || currentDistance == distance
+                                                       && p.length < nextAnnotationPosition.length) {
                                                distance = currentDistance;
                                                nextAnnotation = a;
                                                nextAnnotationPosition = p;
@@ -4900,9 +5120,12 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                                }
                        }
                }
-               if (containingAnnotationPosition != null && (!currentAnnotation || nextAnnotation == null)) {
-                       annotationPosition.setOffset(containingAnnotationPosition.getOffset());
-                       annotationPosition.setLength(containingAnnotationPosition.getLength());
+               if (containingAnnotationPosition != null
+                               && (!currentAnnotation || nextAnnotation == null)) {
+                       annotationPosition.setOffset(containingAnnotationPosition
+                                       .getOffset());
+                       annotationPosition.setLength(containingAnnotationPosition
+                                       .getLength());
                        return containingAnnotation;
                }
                if (nextAnnotationPosition != null) {
@@ -4916,16 +5139,17 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
        /**
         * Returns the annotation overlapping with the given range or
         * <code>null</code>.
-        *
+        * 
         * @param offset
-        *          the region offset
+        *            the region offset
         * @param length
-        *          the region length
+        *            the region length
         * @return the found annotation or <code>null</code>
         * @since 3.0
         */
        private Annotation getAnnotation(int offset, int length) {
-               IAnnotationModel model = getDocumentProvider().getAnnotationModel(getEditorInput());
+               IAnnotationModel model = getDocumentProvider().getAnnotationModel(
+                               getEditorInput());
                Iterator e = new JavaAnnotationIterator(model, true, true);
                while (e.hasNext()) {
                        Annotation a = (Annotation) e.next();
@@ -4941,49 +5165,54 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
        }
 
        /**
-        * Returns whether the given annotation is configured as a target for the "Go
-        * to Next/Previous Annotation" actions
-        *
+        * Returns whether the given annotation is configured as a target for the
+        * "Go to Next/Previous Annotation" actions
+        * 
         * @param annotation
-        *          the annotation
+        *            the annotation
         * @return <code>true</code> if this is a target, <code>false</code>
         *         otherwise
         * @since 3.0
         */
        protected boolean isNavigationTarget(Annotation annotation) {
                Preferences preferences = EditorsUI.getPluginPreferences();
-               AnnotationPreference preference = getAnnotationPreferenceLookup().getAnnotationPreference(annotation);
+               AnnotationPreference preference = getAnnotationPreferenceLookup()
+                               .getAnnotationPreference(annotation);
                // See bug 41689
                // String key= forward ? preference.getIsGoToNextNavigationTargetKey() :
                // preference.getIsGoToPreviousNavigationTargetKey();
-               String key = preference == null ? null : preference.getIsGoToNextNavigationTargetKey();
+               String key = preference == null ? null : preference
+                               .getIsGoToNextNavigationTargetKey();
                return (key != null && preferences.getBoolean(key));
        }
 
        /**
         * Returns a segmentation of the line of the given document appropriate for
-        * bidi rendering. The default implementation returns only the string literals
-        * of a php code line as segments.
-        *
+        * bidi rendering. The default implementation returns only the string
+        * literals of a php code line as segments.
+        * 
         * @param document
-        *          the document
+        *            the document
         * @param lineOffset
-        *          the offset of the line
+        *            the offset of the line
         * @return the line's bidi segmentation
         * @throws BadLocationException
-        *           in case lineOffset is not valid in document
+        *             in case lineOffset is not valid in document
         */
-       public static int[] getBidiLineSegments(IDocument document, int lineOffset) throws BadLocationException {
+       public static int[] getBidiLineSegments(IDocument document, int lineOffset)
+                       throws BadLocationException {
 
                IRegion line = document.getLineInformationOfOffset(lineOffset);
-               ITypedRegion[] linePartitioning = document.computePartitioning(lineOffset, line.getLength());
+               ITypedRegion[] linePartitioning = document.computePartitioning (lineOffset, line.getLength());
 
                List segmentation = new ArrayList();
+               
                for (int i = 0; i < linePartitioning.length; i++) {
-                       if (IPHPPartitions.PHP_STRING_DQ.equals(linePartitioning[i].getType())) {
-                               segmentation.add(linePartitioning[i]);
-                       } else if (IPHPPartitions.PHP_STRING_HEREDOC.equals(linePartitioning[i].getType())) {
-                               segmentation.add(linePartitioning[i]);
+                       if (IPHPPartitions.PHP_STRING_DQ.equals (linePartitioning[i].getType())) {
+                               segmentation.add (linePartitioning[i]);
+                       } 
+                       else if (IPHPPartitions.PHP_STRING_HEREDOC.equals (linePartitioning[i].getType())) {
+                               segmentation.add (linePartitioning[i]);
                        }
                }
 
@@ -5023,11 +5252,11 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
         * Returns a segmentation of the given line appropriate for bidi rendering.
         * The default implementation returns only the string literals of a php code
         * line as segments.
-        *
+        * 
         * @param lineOffset
-        *          the offset of the line
+        *            the offset of the line
         * @param line
-        *          the content of the line
+        *            the content of the line
         * @return the line's bidi segmentation
         */
        protected int[] getBidiLineSegments(int lineOffset, String line) {
@@ -5045,7 +5274,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
        }
 
        /*
-        * @see AbstractTextEditor#createSourceViewer(Composite, IVerticalRuler, int)
+        * @see AbstractTextEditor#createSourceViewer(Composite, IVerticalRuler,
+        *      int)
         */
        // protected final ISourceViewer createSourceViewer(
        // Composite parent,
@@ -5088,7 +5318,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
        // return store.getBoolean(OVERVIEW_RULER);
        // }
        /*
-        * @see AbstractTextEditor#createSourceViewer(Composite, IVerticalRuler, int)
+        * @see AbstractTextEditor#createSourceViewer(Composite, IVerticalRuler,
+        *      int)
         */
        // protected ISourceViewer createJavaSourceViewer(
        // Composite parent,
@@ -5100,25 +5331,32 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
        // isOverviewRulerVisible(), styles);
        // }
        /*
-        * @see AbstractTextEditor#createSourceViewer(Composite, IVerticalRuler, int)
+        * @see AbstractTextEditor#createSourceViewer(Composite, IVerticalRuler,
+        *      int)
         */
-       protected ISourceViewer createJavaSourceViewer(Composite parent, IVerticalRuler verticalRuler, IOverviewRuler overviewRuler,
+       protected ISourceViewer createJavaSourceViewer(Composite parent,
+                       IVerticalRuler verticalRuler, IOverviewRuler overviewRuler,
                        boolean isOverviewRulerVisible, int styles, IPreferenceStore store) {
-               return new JavaSourceViewer(parent, verticalRuler, getOverviewRuler(), isOverviewRulerVisible(), styles, store);
+               return new JavaSourceViewer(parent, verticalRuler, getOverviewRuler(),
+                               isOverviewRulerVisible(), styles, store);
        }
 
        /*
-        * @see AbstractTextEditor#createSourceViewer(Composite, IVerticalRuler, int)
+        * @see AbstractTextEditor#createSourceViewer(Composite, IVerticalRuler,
+        *      int)
         */
-       protected final ISourceViewer createSourceViewer(Composite parent, IVerticalRuler verticalRuler, int styles) {
+       protected final ISourceViewer createSourceViewer(Composite parent,
+                       IVerticalRuler verticalRuler, int styles) {
 
-               ISourceViewer viewer = createJavaSourceViewer(parent, verticalRuler, getOverviewRuler(), isOverviewRulerVisible(), styles,
+               ISourceViewer viewer = createJavaSourceViewer(parent, verticalRuler,
+                               getOverviewRuler(), isOverviewRulerVisible(), styles,
                                getPreferenceStore());
 
                StyledText text = viewer.getTextWidget();
                text.addBidiSegmentListener(new BidiSegmentListener() {
                        public void lineGetSegments(BidiSegmentEvent event) {
-                               event.segments = getBidiLineSegments(event.lineOffset, event.lineText);
+                               event.segments = getBidiLineSegments(event.lineOffset,
+                                               event.lineText);
                        }
                });
 
@@ -5135,23 +5373,25 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
         * @see AbstractTextEditor#affectsTextPresentation(PropertyChangeEvent)
         */
        protected boolean affectsTextPresentation(PropertyChangeEvent event) {
-               return ((PHPSourceViewerConfiguration) getSourceViewerConfiguration()).affectsTextPresentation(event)
+               return ((PHPSourceViewerConfiguration) getSourceViewerConfiguration())
+                               .affectsTextPresentation(event)
                                || super.affectsTextPresentation(event);
        }
 
        //
        // protected boolean affectsTextPresentation(PropertyChangeEvent event) {
-       // JavaTextTools textTools = PHPeclipsePlugin.getDefault().getJavaTextTools();
+       // JavaTextTools textTools =
+       // PHPeclipsePlugin.getDefault().getJavaTextTools();
        // return textTools.affectsBehavior(event);
        // }
        /**
         * Creates and returns the preference store for this Java editor with the
         * given input.
-        *
+        * 
         * @param input
-        *          The editor input for which to create the preference store
+        *            The editor input for which to create the preference store
         * @return the preference store for this editor
-        *
+        * 
         * @since 3.0
         */
        private IPreferenceStore createCombinedPreferenceStore(IEditorInput input) {
@@ -5159,25 +5399,31 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
                IJavaProject project = EditorUtility.getJavaProject(input);
                if (project != null)
-                       stores.add(new OptionsAdapter(project.getOptions(false), PHPeclipsePlugin.getDefault().getMockupPreferenceStore(),
+                       stores.add(new OptionsAdapter(project.getOptions(false),
+                                       PHPeclipsePlugin.getDefault().getMockupPreferenceStore(),
                                        new OptionsAdapter.IPropertyChangeEventFilter() {
 
                                                public boolean isFiltered(PropertyChangeEvent event) {
                                                        IJavaElement inputJavaElement = getInputJavaElement();
-                                                       IJavaProject javaProject = inputJavaElement != null ? inputJavaElement.getJavaProject() : null;
+                                                       IJavaProject javaProject = inputJavaElement != null ? inputJavaElement
+                                                                       .getJavaProject()
+                                                                       : null;
                                                        if (javaProject == null)
                                                                return true;
 
-                                                       return !javaProject.getProject().equals(event.getSource());
+                                                       return !javaProject.getProject().equals(
+                                                                       event.getSource());
                                                }
 
                                        }));
 
                stores.add(PHPeclipsePlugin.getDefault().getPreferenceStore());
-               stores.add(new PreferencesAdapter(JavaCore.getPlugin().getPluginPreferences()));
+               stores.add(new PreferencesAdapter(JavaCore.getPlugin()
+                               .getPluginPreferences()));
                stores.add(EditorsUI.getPreferenceStore());
 
-               return new ChainedPreferenceStore((IPreferenceStore[]) stores.toArray(new IPreferenceStore[stores.size()]));
+               return new ChainedPreferenceStore((IPreferenceStore[]) stores
+                               .toArray(new IPreferenceStore[stores.size()]));
        }
 
        /**
@@ -5189,7 +5435,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
                ITextSelection s = (ITextSelection) provider.getSelection();
                Position errorPosition = new Position(0, 0);
-               IJavaAnnotation nextError = getNextError(s.getOffset(), forward, errorPosition);
+               IJavaAnnotation nextError = getNextError(s.getOffset(), forward,
+                               errorPosition);
 
                if (nextError != null) {
 
@@ -5211,14 +5458,16 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
                        if (marker != null) {
                                IWorkbenchPage page = getSite().getPage();
-                               IViewPart view = view = page.findView("org.eclipse.ui.views.TaskList"); //$NON-NLS-1$
+                               IViewPart view = view = page
+                                               .findView("org.eclipse.ui.views.TaskList"); //$NON-NLS-1$
                                if (view instanceof TaskList) {
                                        StructuredSelection ss = new StructuredSelection(marker);
                                        ((TaskList) view).setSelection(ss, true);
                                }
                        }
 
-                       selectAndReveal(errorPosition.getOffset(), errorPosition.getLength());
+                       selectAndReveal(errorPosition.getOffset(), errorPosition
+                                       .getLength());
                        // setStatusLineErrorMessage(nextError.getMessage());
 
                } else {
@@ -5228,16 +5477,19 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                }
        }
 
-       private IJavaAnnotation getNextError(int offset, boolean forward, Position errorPosition) {
+       private IJavaAnnotation getNextError(int offset, boolean forward,
+                       Position errorPosition) {
 
                IJavaAnnotation nextError = null;
                Position nextErrorPosition = null;
 
-               IDocument document = getDocumentProvider().getDocument(getEditorInput());
+               IDocument document = getDocumentProvider()
+                               .getDocument(getEditorInput());
                int endOfDocument = document.getLength();
                int distance = 0;
 
-               IAnnotationModel model = getDocumentProvider().getAnnotationModel(getEditorInput());
+               IAnnotationModel model = getDocumentProvider().getAnnotationModel(
+                               getEditorInput());
                Iterator e = new JavaAnnotationIterator(model, false);
                while (e.hasNext()) {
 
@@ -5253,11 +5505,13 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                                if (forward) {
                                        currentDistance = p.getOffset() - offset;
                                        if (currentDistance < 0)
-                                               currentDistance = endOfDocument - offset + p.getOffset();
+                                               currentDistance = endOfDocument - offset
+                                                               + p.getOffset();
                                } else {
                                        currentDistance = offset - p.getOffset();
                                        if (currentDistance < 0)
-                                               currentDistance = offset + endOfDocument - p.getOffset();
+                                               currentDistance = offset + endOfDocument
+                                                               - p.getOffset();
                                }
 
                                if (nextError == null || currentDistance < distance) {
@@ -5285,7 +5539,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
        protected void installOverrideIndicator(boolean waitForReconcilation) {
                uninstallOverrideIndicator();
-               IAnnotationModel model = getDocumentProvider().getAnnotationModel(getEditorInput());
+               IAnnotationModel model = getDocumentProvider().getAnnotationModel(
+                               getEditorInput());
                final IJavaElement inputElement = getInputJavaElement();
 
                if (model == null || inputElement == null)
@@ -5296,7 +5551,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                //
                // if (provideAST) {
                // Job job= new
-               // Job(JavaEditorMessages.getString("OverrideIndicatorManager.intallJob")) {
+               // Job(JavaEditorMessages.getString("OverrideIndicatorManager.intallJob"))
+               // {
                // //$NON-NLS-1$
                // /*
                // * @see
@@ -5307,7 +5563,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                // CompilationUnit ast=
                // JavaPlugin.getDefault().getASTProvider().getAST(inputElement, true,
                // null);
-               // if (fOverrideIndicatorManager != null) // editor might have been closed
+               // if (fOverrideIndicatorManager != null) // editor might have been
+               // closed
                // in the meanwhile
                // fOverrideIndicatorManager.reconciled(ast, true, monitor);
                // return Status.OK_STATUS;
@@ -5321,7 +5578,7 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
        /**
         * Tells whether override indicators are shown.
-        *
+        * 
         * @return <code>true</code> if the override indicators are shown
         * @since 3.0
         */
@@ -5336,21 +5593,22 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
        // }
        /**
         * Returns the boolean preference for the given key.
-        *
+        * 
         * @param store
-        *          the preference store
+        *            the preference store
         * @param key
-        *          the preference key
-        * @return <code>true</code> if the key exists in the store and its value is
-        *         <code>true</code>
+        *            the preference key
+        * @return <code>true</code> if the key exists in the store and its value
+        *         is <code>true</code>
         * @since 3.0
         */
-       private boolean getBoolean(IPreferenceStore store, String key) {
-               return key != null && store.getBoolean(key);
-       }
+//     private boolean getBoolean(IPreferenceStore store, String key) {
+//             return key != null && store.getBoolean(key);
+//     }
 
        protected boolean isPrefQuickDiffAlwaysOn() {
-               return false; // never show change ruler for the non-editable java editor.
+               return false; // never show change ruler for the non-editable java
+                                               // editor.
                // Overridden in subclasses like PHPUnitEditor
        }
 
@@ -5367,11 +5625,13 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                setAction(ITextEditorActionDefinitionIds.LINE_START, action);
 
                action = new SmartLineStartAction(textWidget, true);
-               action.setActionDefinitionId(ITextEditorActionDefinitionIds.SELECT_LINE_START);
+               action
+                               .setActionDefinitionId(ITextEditorActionDefinitionIds.SELECT_LINE_START);
                setAction(ITextEditorActionDefinitionIds.SELECT_LINE_START, action);
 
                action = new NavigatePreviousSubWordAction();
-               action.setActionDefinitionId(ITextEditorActionDefinitionIds.WORD_PREVIOUS);
+               action
+                               .setActionDefinitionId(ITextEditorActionDefinitionIds.WORD_PREVIOUS);
                setAction(ITextEditorActionDefinitionIds.WORD_PREVIOUS, action);
                textWidget.setKeyBinding(SWT.CTRL | SWT.ARROW_LEFT, SWT.NULL);
 
@@ -5381,60 +5641,107 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                textWidget.setKeyBinding(SWT.CTRL | SWT.ARROW_RIGHT, SWT.NULL);
 
                action = new SelectPreviousSubWordAction();
-               action.setActionDefinitionId(ITextEditorActionDefinitionIds.SELECT_WORD_PREVIOUS);
+               action
+                               .setActionDefinitionId(ITextEditorActionDefinitionIds.SELECT_WORD_PREVIOUS);
                setAction(ITextEditorActionDefinitionIds.SELECT_WORD_PREVIOUS, action);
-               textWidget.setKeyBinding(SWT.CTRL | SWT.SHIFT | SWT.ARROW_LEFT, SWT.NULL);
+               textWidget.setKeyBinding(SWT.CTRL | SWT.SHIFT | SWT.ARROW_LEFT,
+                               SWT.NULL);
 
                action = new SelectNextSubWordAction();
-               action.setActionDefinitionId(ITextEditorActionDefinitionIds.SELECT_WORD_NEXT);
+               action
+                               .setActionDefinitionId(ITextEditorActionDefinitionIds.SELECT_WORD_NEXT);
                setAction(ITextEditorActionDefinitionIds.SELECT_WORD_NEXT, action);
-               textWidget.setKeyBinding(SWT.CTRL | SWT.SHIFT | SWT.ARROW_RIGHT, SWT.NULL);
+               textWidget.setKeyBinding(SWT.CTRL | SWT.SHIFT | SWT.ARROW_RIGHT,
+                               SWT.NULL);
        }
 
        /*
         * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#createCompositeRuler()
         */
-       protected CompositeRuler createCompositeRuler() {
-               if (!getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_ANNOTATION_ROLL_OVER))
-                       return super.createCompositeRuler();
-
-               CompositeRuler ruler = new CompositeRuler();
-               AnnotationRulerColumn column = new AnnotationRulerColumn(VERTICAL_RULER_WIDTH, getAnnotationAccess());
-               column.setHover(new JavaExpandHover(ruler, getAnnotationAccess(), new IDoubleClickListener() {
-
-                       public void doubleClick(DoubleClickEvent event) {
-                               // for now: just invoke ruler double click action
-                               triggerAction(ITextEditorActionConstants.RULER_DOUBLE_CLICK);
-                       }
-
-                       private void triggerAction(String actionID) {
-                               IAction action = getAction(actionID);
-                               if (action != null) {
-                                       if (action instanceof IUpdate)
-                                               ((IUpdate) action).update();
-                                       // hack to propagate line change
-                                       if (action instanceof ISelectionListener) {
-                                               ((ISelectionListener) action).selectionChanged(null, null);
+       // protected CompositeRuler createCompositeRuler() {
+       // if
+       // (!getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_ANNOTATION_ROLL_OVER))
+       // return super.createCompositeRuler();
+       //
+       // CompositeRuler ruler = new CompositeRuler();
+       // AnnotationRulerColumn column = new
+       // AnnotationRulerColumn(VERTICAL_RULER_WIDTH, getAnnotationAccess());
+       // column.setHover(new JavaExpandHover(ruler, getAnnotationAccess(), new
+       // IDoubleClickListener() {
+       //
+       // public void doubleClick(DoubleClickEvent event) {
+       // // for now: just invoke ruler double click action
+       // triggerAction(ITextEditorActionConstants.RULER_DOUBLE_CLICK);
+       // }
+       //
+       // private void triggerAction(String actionID) {
+       // IAction action = getAction(actionID);
+       // if (action != null) {
+       // if (action instanceof IUpdate)
+       // ((IUpdate) action).update();
+       // // hack to propagate line change
+       // if (action instanceof ISelectionListener) {
+       // ((ISelectionListener) action).selectionChanged(null, null);
+       // }
+       // if (action.isEnabled())
+       // action.run();
+       // }
+       // }
+       //
+       // }));
+       // ruler.addDecorator(0, column);
+       //
+       // if (isLineNumberRulerVisible())
+       // ruler.addDecorator(1, createLineNumberRulerColumn());
+       // else if (isPrefQuickDiffAlwaysOn())
+       // ruler.addDecorator(1, createChangeRulerColumn());
+       //
+       // return ruler;
+       // }
+       /*
+        * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#createAnnotationRulerColumn(org.eclipse.jface.text.source.CompositeRuler)
+        * @since 3.2
+        */
+       protected IVerticalRulerColumn createAnnotationRulerColumn(
+                       CompositeRuler ruler) {
+               if (!getPreferenceStore().getBoolean(
+                               PreferenceConstants.EDITOR_ANNOTATION_ROLL_OVER))
+                       return super.createAnnotationRulerColumn(ruler);
+
+               AnnotationRulerColumn column = new AnnotationRulerColumn(
+                               VERTICAL_RULER_WIDTH, getAnnotationAccess());
+               column.setHover(new JavaExpandHover(ruler, getAnnotationAccess(),
+                               new IDoubleClickListener() {
+
+                                       public void doubleClick(DoubleClickEvent event) {
+                                               // for now: just invoke ruler double click action
+                                               triggerAction(ITextEditorActionConstants.RULER_DOUBLE_CLICK);
                                        }
-                                       if (action.isEnabled())
-                                               action.run();
-                               }
-                       }
 
-               }));
-               ruler.addDecorator(0, column);
+                                       private void triggerAction(String actionID) {
+                                               IAction action = getAction(actionID);
+                                               if (action != null) {
+                                                       if (action instanceof IUpdate)
+                                                               ((IUpdate) action).update();
+                                                       // hack to propagate line change
+                                                       if (action instanceof ISelectionListener) {
+                                                               ((ISelectionListener) action).selectionChanged(
+                                                                               null, null);
+                                                       }
+                                                       if (action.isEnabled())
+                                                               action.run();
+                                               }
+                                       }
 
-               if (isLineNumberRulerVisible())
-                       ruler.addDecorator(1, createLineNumberRulerColumn());
-               else if (isPrefQuickDiffAlwaysOn())
-                       ruler.addDecorator(1, createChangeRulerColumn());
+                               }));
 
-               return ruler;
+               return column;
        }
 
        /**
-        * Returns the folding action group, or <code>null</code> if there is none.
-        *
+        * Returns the folding action group, or <code>null</code> if there is
+        * none.
+        * 
         * @return the folding action group, or <code>null</code> if there is none
         * @since 3.0
         */
@@ -5472,14 +5779,15 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
        /**
         * React to changed selection.
-        *
+        * 
         * @since 3.0
         */
        protected void selectionChanged() {
                if (getSelectionProvider() == null)
                        return;
                ISourceReference element = computeHighlightRangeSourceReference();
-               if (getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE))
+               if (getPreferenceStore().getBoolean(
+                               PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE))
                        synchronizeOutlinePage(element);
                setSelection(element, false);
                updateStatusLine();
@@ -5487,7 +5795,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
        private boolean isJavaOutlinePageActive() {
                IWorkbenchPart part = getActivePart();
-               return part instanceof ContentOutline && ((ContentOutline) part).getCurrentPage() == fOutlinePage;
+               return part instanceof ContentOutline
+                               && ((ContentOutline) part).getCurrentPage() == fOutlinePage;
        }
 
        private IWorkbenchPart getActivePart() {
@@ -5501,7 +5810,7 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
         * Computes and returns the source reference that includes the caret and
         * serves as provider for the outline page selection and the editor range
         * indication.
-        *
+        * 
         * @return the computed source reference
         * @since 3.0
         */
@@ -5517,7 +5826,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                int caret = 0;
                if (sourceViewer instanceof ITextViewerExtension5) {
                        ITextViewerExtension5 extension = (ITextViewerExtension5) sourceViewer;
-                       caret = extension.widgetOffset2ModelOffset(styledText.getCaretOffset());
+                       caret = extension.widgetOffset2ModelOffset(styledText
+                                       .getCaretOffset());
                } else {
                        int offset = sourceViewer.getVisibleRegion().getOffset();
                        caret = offset + styledText.getCaretOffset();
@@ -5531,7 +5841,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                if (element.getElementType() == IJavaElement.IMPORT_DECLARATION) {
 
                        IImportDeclaration declaration = (IImportDeclaration) element;
-                       IImportContainer container = (IImportContainer) declaration.getParent();
+                       IImportContainer container = (IImportContainer) declaration
+                                       .getParent();
                        ISourceRange srcRange = null;
 
                        try {
@@ -5548,12 +5859,12 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
        /**
         * Returns the most narrow java element including the given offset.
-        *
+        * 
         * @param offset
-        *          the offset inside of the requested element
+        *            the offset inside of the requested element
         * @param reconcile
-        *          <code>true</code> if editor input should be reconciled in
-        *          advance
+        *            <code>true</code> if editor input should be reconciled in
+        *            advance
         * @return the most narrow java element
         * @since 3.0
         */
@@ -5562,12 +5873,25 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
        }
 
        public ShowInContext getShowInContext() {
-               FileEditorInput fei = (FileEditorInput) getEditorInput();
-               ShowInContext context = BrowserUtil.getShowInContext(fei.getFile(), false, "");
+               IFile file = null;
+               if(getEditorInput() instanceof FileStoreEditorInput){
+                       FileStoreEditorInput fei = (FileStoreEditorInput) getEditorInput();
+                       file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(fei.getURI().getPath()));
+               } else if (getEditorInput() instanceof FileEditorInput) {
+                       FileEditorInput fei = (FileEditorInput) getEditorInput();
+                       // added to fix ticket 637
+                       file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(fei.getURI().getPath()));
+               } else if (getEditorInput() instanceof ExternalEditorInput) {
+                       ExternalEditorInput fei = (ExternalEditorInput) getEditorInput();
+                       file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(fei.getFullPath()/* .getURI().getPath()*/));
+               }
+
+               ShowInContext context = BrowserUtil.getShowInContext(file,
+                               false, "");
                if (context != null) {
                        return context;
                }
-               return new ShowInContext(fei.getFile(), null);
+               return new ShowInContext(file, null);
        }
 
        public String[] getShowInTargetIds() {
@@ -5576,11 +5900,11 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
        /**
         * Updates the occurrences annotations based on the current selection.
-        *
+        * 
         * @param selection
-        *          the text selection
+        *            the text selection
         * @param astRoot
-        *          the compilation unit AST
+        *            the compilation unit AST
         * @since 3.0
         */
        protected void updateOccurrenceAnnotations(ITextSelection selection) {// ,
@@ -5605,17 +5929,22 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                fMarkOccurrenceTargetRegion = null;
                if (document instanceof IDocumentExtension4) {
                        int offset = selection.getOffset();
-                       long currentModificationStamp = ((IDocumentExtension4) document).getModificationStamp();
-                       if (fMarkOccurrenceTargetRegion != null && currentModificationStamp == fMarkOccurrenceModificationStamp) {
+                       long currentModificationStamp = ((IDocumentExtension4) document)
+                                       .getModificationStamp();
+                       if (fMarkOccurrenceTargetRegion != null
+                                       && currentModificationStamp == fMarkOccurrenceModificationStamp) {
                                if (fMarkOccurrenceTargetRegion.getOffset() <= offset
-                                               && offset <= fMarkOccurrenceTargetRegion.getOffset() + fMarkOccurrenceTargetRegion.getLength())
+                                               && offset <= fMarkOccurrenceTargetRegion.getOffset()
+                                                               + fMarkOccurrenceTargetRegion.getLength())
                                        return;
                        }
-                       fMarkOccurrenceTargetRegion = JavaWordFinder.findWord(document, offset);
+                       fMarkOccurrenceTargetRegion = JavaWordFinder.findWord(document,
+                                       offset);
                        fMarkOccurrenceModificationStamp = currentModificationStamp;
                }
 
-               if (fMarkOccurrenceTargetRegion == null || fMarkOccurrenceTargetRegion.getLength() == 0) {
+               if (fMarkOccurrenceTargetRegion == null
+                               || fMarkOccurrenceTargetRegion.getLength() == 0) {
                        return;
                }
 
@@ -5631,19 +5960,30 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                                String wordStr;
                                char[] word;
 
-                               wordStr = document.get(fMarkOccurrenceTargetRegion.getOffset(), fMarkOccurrenceTargetRegion.getLength());
+                               wordStr = document.get(fMarkOccurrenceTargetRegion.getOffset(),
+                                               fMarkOccurrenceTargetRegion.getLength());
                                if (wordStr != null) {
                                        word = wordStr.toCharArray();
-                                       int fToken = ITerminalSymbols.TokenNameEOF;
+                                       TokenName fToken = ITerminalSymbols.TokenName.EOF;
                                        try {
                                                fToken = fScanner.getNextToken();
-                                               while (fToken != ITerminalSymbols.TokenNameEOF) { // && fToken !=
-                                                       // TokenNameERROR) {
-                                                       if (fToken == ITerminalSymbols.TokenNameVariable || fToken == ITerminalSymbols.TokenNameIdentifier) {
+                                               while (fToken != ITerminalSymbols.TokenName.EOF) { // &&
+                                                                                                                                                       // fToken
+                                                                                                                                                       // !=
+                                                       // TokenName.ERROR) {
+                                                       if (fToken == ITerminalSymbols.TokenName.VARIABLE
+                                                                       || fToken == ITerminalSymbols.TokenName.IDENTIFIER) {
                                                                // global variable
                                                                if (fScanner.equalsCurrentTokenSource(word)) {
-                                                                       matches.add(new Region(fScanner.getCurrentTokenStartPosition(), fScanner.getCurrentTokenEndPosition()
-                                                                                       - fScanner.getCurrentTokenStartPosition() + 1));
+                                                                       matches
+                                                                                       .add(new Region(
+                                                                                                       fScanner
+                                                                                                                       .getCurrentTokenStartPosition(),
+                                                                                                       fScanner
+                                                                                                                       .getCurrentTokenEndPosition()
+                                                                                                                       - fScanner
+                                                                                                                                       .getCurrentTokenStartPosition()
+                                                                                                                       + 1));
                                                                }
                                                        }
                                                        fToken = fScanner.getNextToken();
@@ -5673,10 +6013,12 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                int i = 0;
                for (Iterator each = matches.iterator(); each.hasNext();) {
                        IRegion currentNode = (IRegion) each.next();
-                       positions[i++] = new Position(currentNode.getOffset(), currentNode.getLength());
+                       positions[i++] = new Position(currentNode.getOffset(), currentNode
+                                       .getLength());
                }
 
-               fOccurrencesFinderJob = new OccurrencesFinderJob(document, positions, selection);
+               fOccurrencesFinderJob = new OccurrencesFinderJob(document, positions,
+                               selection);
                // fOccurrencesFinderJob.setPriority(Job.DECORATE);
                // fOccurrencesFinderJob.setSystem(true);
                // fOccurrencesFinderJob.schedule();
@@ -5687,17 +6029,21 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                fMarkOccurrenceAnnotations = true;
 
                fPostSelectionListenerWithAST = new ISelectionListenerWithAST() {
-                       public void selectionChanged(IEditorPart part, ITextSelection selection) { // ,
+                       public void selectionChanged(IEditorPart part,
+                                       ITextSelection selection) { // ,
                                // CompilationUnit
                                // astRoot)
                                // {
                                updateOccurrenceAnnotations(selection);// , astRoot);
                        }
                };
-               SelectionListenerWithASTManager.getDefault().addListener(this, fPostSelectionListenerWithAST);
+               SelectionListenerWithASTManager.getDefault().addListener(this,
+                               fPostSelectionListenerWithAST);
                if (getSelectionProvider() != null) {
-                       fForcedMarkOccurrencesSelection = getSelectionProvider().getSelection();
-                       SelectionListenerWithASTManager.getDefault().forceSelectionChange(this, (ITextSelection) fForcedMarkOccurrencesSelection);
+                       fForcedMarkOccurrencesSelection = getSelectionProvider()
+                                       .getSelection();
+                       SelectionListenerWithASTManager.getDefault().forceSelectionChange(
+                                       this, (ITextSelection) fForcedMarkOccurrencesSelection);
                }
 
                if (fOccurrencesFinderJobCanceler == null) {
@@ -5720,7 +6066,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                }
 
                if (fPostSelectionListenerWithAST != null) {
-                       SelectionListenerWithASTManager.getDefault().removeListener(this, fPostSelectionListenerWithAST);
+                       SelectionListenerWithASTManager.getDefault().removeListener(this,
+                                       fPostSelectionListenerWithAST);
                        fPostSelectionListenerWithAST = null;
                }
 
@@ -5739,13 +6086,15 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
                if (documentProvider == null)
                        return;
 
-               IAnnotationModel annotationModel = documentProvider.getAnnotationModel(getEditorInput());
+               IAnnotationModel annotationModel = documentProvider
+                               .getAnnotationModel(getEditorInput());
                if (annotationModel == null || fOccurrenceAnnotations == null)
                        return;
 
                synchronized (getLockObject(annotationModel)) {
                        if (annotationModel instanceof IAnnotationModelExtension) {
-                               ((IAnnotationModelExtension) annotationModel).replaceAnnotations(fOccurrenceAnnotations, null);
+                               ((IAnnotationModelExtension) annotationModel)
+                                               .replaceAnnotations(fOccurrenceAnnotations, null);
                        } else {
                                for (int i = 0, length = fOccurrenceAnnotations.length; i < length; i++)
                                        annotationModel.removeAnnotation(fOccurrenceAnnotations[i]);