Added patch from #1437426: error in assign template
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / phpeditor / JavaSourceViewer.java
index 2c2f4f4..030c7d5 100644 (file)
@@ -15,12 +15,14 @@ import java.util.ArrayList;
 
 import net.sourceforge.phpdt.internal.ui.text.SmartBackspaceManager;
 import net.sourceforge.phpdt.ui.PreferenceConstants;
+import net.sourceforge.phpdt.ui.text.PHPSourceViewerConfiguration;
 
 import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.jface.preference.PreferenceConverter;
 import org.eclipse.jface.text.Assert;
 import org.eclipse.jface.text.ITextPresentationListener;
 import org.eclipse.jface.text.information.IInformationPresenter;
+import org.eclipse.jface.text.reconciler.IReconciler;
 import org.eclipse.jface.text.source.IOverviewRuler;
 import org.eclipse.jface.text.source.IVerticalRuler;
 import org.eclipse.jface.text.source.SourceViewerConfiguration;
@@ -38,7 +40,7 @@ import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
 
 
 public class JavaSourceViewer extends ProjectionViewer implements IPropertyChangeListener {
-
+    
        /** 
         * Text operation code for requesting the outline for the current input.
         */
@@ -134,6 +136,13 @@ public class JavaSourceViewer extends ProjectionViewer implements IPropertyChang
                        case SHOW_HIERARCHY:
 //                             fHierarchyPresenter.showInformation();
                                return; 
+                   case FORMAT:
+                     Point point = getSelectedRange();
+                     if (point.y==0) {
+//                     setSelectedRange(0, getDocument().getLength());
+                       revealRange(0, getDocument().getLength());
+                     }
+                     break;
                }
                
                super.doOperation(operation);
@@ -372,7 +381,7 @@ public class JavaSourceViewer extends ProjectionViewer implements IPropertyChang
                        fBackspaceManager.uninstall();
                        fBackspaceManager= null;
                }
-
+        
                super.handleDispose();
        }
        
@@ -395,4 +404,23 @@ public class JavaSourceViewer extends ProjectionViewer implements IPropertyChang
                fTextPresentationListeners.remove(listener);
                fTextPresentationListeners.add(0, listener);
        }
+       /**
+        * Sets the given reconciler.
+        *  
+        * @param reconciler the reconciler
+        * @since 3.0
+        */
+       void setReconciler(IReconciler reconciler) {
+               fReconciler= reconciler;
+       }
+
+       /**
+        * Returns the reconciler.
+        * 
+        * @return the reconciler or <code>null</code> if not set
+        * @since 3.0
+        */
+       Object getReconciler() {
+               return fReconciler;
+       }
 }