first PHP parser version (doesn't work actually)
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / phpeditor / PHPEditor.java
index df0c4cc..11cf34f 100644 (file)
@@ -11,7 +11,7 @@ Contributors:
     IBM Corporation - Initial implementation
     Klaus Hartlage - www.eclipseproject.de
 **********************************************************************/
-import net.sourceforge.phpeclipse.phpeditor.php.PHPWordDetector;
+import net.sourceforge.phpeclipse.phpeditor.php.PHPWordExtractor;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.help.IHelp;
@@ -29,12 +29,12 @@ import org.eclipse.ui.help.WorkbenchHelp;
 import org.eclipse.ui.texteditor.DefaultRangeIndicator;
 import org.eclipse.ui.texteditor.TextOperationAction;
 import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
-
+import org.eclipse.jface.action.IAction;
 /**
  * Java specific text editor.
  */
 public class PHPEditor extends TextEditor {
-  
+
   /** The outline page */
   private PHPContentOutlinePage fOutlinePage;
 
@@ -94,6 +94,10 @@ public class PHPEditor extends TextEditor {
    */
   public void doSave(IProgressMonitor monitor) {
     super.doSave(monitor);
+    // compile or not, according to the user preferences
+    IAction a = PHPParserAction.getInstance();
+    if (a != null)
+      a.run();
     if (fOutlinePage != null)
       fOutlinePage.update();
   }
@@ -166,9 +170,9 @@ public class PHPEditor extends TextEditor {
       //   showMessage(shell, dialogTitle, ActionMessages.getString("Open help not available"), false); //$NON-NLS-1$
     }
   }
-  
+
   private String getFunctionName(IDocument doc, int pos) {
-    Point word = PHPWordDetector.findWord(doc, pos);
+    Point word = PHPWordExtractor.findWord(doc, pos);
     if (word != null) {
       try {
         return doc.get(word.x, word.y).replace('_', '-');