added file extension php5
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / phpeditor / JavaSourceViewer.java
index d300642..e3e75ac 100644 (file)
 package net.sourceforge.phpeclipse.phpeditor;
 
 import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.Map;
 
-import net.sourceforge.phpdt.core.JavaCore;
 import net.sourceforge.phpdt.internal.ui.text.SmartBackspaceManager;
 import net.sourceforge.phpdt.ui.PreferenceConstants;
 
@@ -23,8 +20,6 @@ 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.formatter.FormattingContextProperties;
-import org.eclipse.jface.text.formatter.IFormattingContext;
 import org.eclipse.jface.text.information.IInformationPresenter;
 import org.eclipse.jface.text.source.IOverviewRuler;
 import org.eclipse.jface.text.source.IVerticalRuler;
@@ -43,8 +38,8 @@ import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
 
 
 public class JavaSourceViewer extends ProjectionViewer implements IPropertyChangeListener {
-
-       /**
+    
+       /** 
         * Text operation code for requesting the outline for the current input.
         */
        public static final int SHOW_OUTLINE= 51;
@@ -139,6 +134,12 @@ 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());
+                     }
+                     break;
                }
                
                super.doOperation(operation);