Added error log to the debug perspective
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / PHPeclipsePlugin.java
index b094bc7..75709ed 100644 (file)
@@ -58,6 +58,7 @@ import net.sourceforge.phpeclipse.phpeditor.PHPSyntaxRdr;
 import net.sourceforge.phpeclipse.phpeditor.WorkingCopyManager;
 import net.sourceforge.phpeclipse.phpeditor.util.PHPColorProvider;
 
+import org.eclipse.core.internal.runtime.InternalPlatform;
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
@@ -606,9 +607,15 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements
     return fProblemMarkerManager;
   }
 
+  //  public synchronized JavaTextTools getJavaTextTools() {
+  //    if (fJavaTextTools == null)
+  //      fJavaTextTools = new JavaTextTools(getPreferenceStore());
+  //    return fJavaTextTools;
+  //  }
   public synchronized JavaTextTools getJavaTextTools() {
     if (fJavaTextTools == null)
-      fJavaTextTools = new JavaTextTools(getPreferenceStore());
+      fJavaTextTools = new JavaTextTools(getPreferenceStore(), JavaCore
+          .getPlugin().getPluginPreferences());
     return fJavaTextTools;
   }
 
@@ -636,15 +643,22 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements
   //  }
   protected void initializeDefaultPreferences(IPreferenceStore store) {
     // windows preferences:
-    store.setDefault(LOCALHOST_PREF, "http://localhost");
+    //    store.setDefault(LOCALHOST_PREF, "http://localhost");
+    //    store.setDefault(DOCUMENTROOT_PREF,
+    // getWorkspace().getRoot().getLocation().toString());
+//    store.setDefault(PHP_LOCALHOST_PREF, "http://localhost");
+//    store.setDefault(PHP_DOCUMENTROOT_PREF, getWorkspace().getRoot()
+//        .getLocation().toString());
+
     //    store.setDefault(SHOW_EXTERNAL_PREVIEW_PREF, "true");
     store.setDefault(USE_EXTERNAL_BROWSER_PREF, "false");
     store.setDefault(SHOW_OUTPUT_IN_CONSOLE, "true");
     store.setDefault(PHP_OBFUSCATOR_DEFAULT, "c:\\temp");
-    store.setDefault(PHP_BOOKMARK_DEFAULT, "");
-
-    store.setDefault(PHP_AUTO_PREVIEW_DEFAULT, "true");
-    store.setDefault(PHP_BRING_TO_TOP_PREVIEW_DEFAULT, "true");
+//    store.setDefault(PHP_BOOKMARK_DEFAULT, "");
+//
+//    store.setDefault(PHP_AUTO_PREVIEW_DEFAULT, "true");
+//    store.setDefault(PHP_BRING_TO_TOP_PREVIEW_DEFAULT, "true");
+//    store.setDefault(PHP_SHOW_HTML_FILES_LOCAL, "true");
 
     String windowsSystem = Platform.getWS();
     if (jvm == WINDOWS_9x) {
@@ -660,8 +674,6 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements
       store.setDefault(PHP_OBFUSCATOR_DEFAULT, "/tmp");
       store.setDefault(EXTERNAL_BROWSER_PREF, "netscape {0}");
     }
-    store.setDefault(DOCUMENTROOT_PREF, getWorkspace().getRoot().getLocation()
-        .toString());
     //  if ((jvm == WINDOWS_9x) || (jvm == WINDOWS_NT)) {
     // 
     if (windowsSystem.equals(Platform.WS_WIN32)) {
@@ -683,9 +695,9 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements
     store.setDefault(APACHE_START_BACKGROUND, "true");
     store.setDefault(APACHE_STOP_BACKGROUND, "true");
     store.setDefault(APACHE_RESTART_BACKGROUND, "true");
-    store.setDefault(PHP_PARSER_DEFAULT, PHP_EXTERNAL_PARSER);
-    store.setDefault(PHP_INTERNAL_PARSER, "false");
-    store.setDefault(PHP_EXTERNAL_PARSER, "true");
+    //    store.setDefault(PHP_PARSER_DEFAULT, PHP_EXTERNAL_PARSER);
+    //    store.setDefault(PHP_INTERNAL_PARSER, "false");
+    //    store.setDefault(PHP_EXTERNAL_PARSER, "true");
     //    store.setDefault(PHP_PARSE_ON_SAVE, "true");
     // show line numbers:
     //   store.setDefault(LINE_NUMBER_RULER, "false");
@@ -1110,7 +1122,7 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements
    */
   public void start(BundleContext context) throws Exception {
     super.start(context);
-
+    
     //         JavaCore.start(this, context);
     final JavaModelManager manager = JavaModelManager.getJavaModelManager();
     try {
@@ -1125,46 +1137,46 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements
       //                       manager.loadVariablesAndContainers();
 
       final IWorkspace workspace = ResourcesPlugin.getWorkspace();
-      workspace.addResourceChangeListener(manager.deltaState,
-          IResourceChangeEvent.PRE_BUILD | IResourceChangeEvent.POST_BUILD
-              | IResourceChangeEvent.POST_CHANGE
-              | IResourceChangeEvent.PRE_DELETE
-              | IResourceChangeEvent.PRE_CLOSE);
-
-      //                       startIndexing();
-
-      //  process deltas since last activated in indexer thread so that indexes
-      // are up-to-date.
-      // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=38658
-      Job processSavedState = new Job(Util.bind("savedState.jobName")) { //$NON-NLS-1$
-        protected IStatus run(IProgressMonitor monitor) {
-          try {
-            // add save participant and process delta atomically
-            // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=59937
-            workspace.run(new IWorkspaceRunnable() {
-              public void run(IProgressMonitor progress) throws CoreException {
-                ISavedState savedState = workspace.addSaveParticipant(
-                    PHPeclipsePlugin.this, manager);
-                if (savedState != null) {
-                  // the event type coming from the saved state is always
-                  // POST_AUTO_BUILD
-                  // force it to be POST_CHANGE so that the delta processor can
-                  // handle it
-                  manager.deltaState.getDeltaProcessor().overridenEventType = IResourceChangeEvent.POST_CHANGE;
-                  savedState.processResourceChangeEvents(manager.deltaState);
-                }
-              }
-            }, monitor);
-          } catch (CoreException e) {
-            return e.getStatus();
-          }
-          return Status.OK_STATUS;
-        }
-      };
-      processSavedState.setSystem(true);
-      processSavedState.setPriority(Job.SHORT); // process asap
-      processSavedState.schedule();
-
+               workspace.addResourceChangeListener(
+                       manager.deltaState,
+                       IResourceChangeEvent.PRE_BUILD
+                               | IResourceChangeEvent.POST_BUILD
+                               | IResourceChangeEvent.POST_CHANGE
+                               | IResourceChangeEvent.PRE_DELETE
+                               | IResourceChangeEvent.PRE_CLOSE);
+
+//             startIndexing();
+               ISavedState savedState = workspace.addSaveParticipant(PHPeclipsePlugin.this, manager);
+
+               // process deltas since last activated in indexer thread so that indexes are up-to-date.
+               // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=38658
+//             Job processSavedState = new Job(Util.bind("savedState.jobName")) { //$NON-NLS-1$
+//                     protected IStatus run(IProgressMonitor monitor) {
+//                             try {
+//                                     // add save participant and process delta atomically
+//                                     // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=59937
+//                                     workspace.run(
+//                                             new IWorkspaceRunnable() {
+//                                                     public void run(IProgressMonitor progress) throws CoreException {
+//                                                             ISavedState savedState = workspace.addSaveParticipant(PHPeclipsePlugin.this, manager);
+//                                                             if (savedState != null) {
+//                                                                     // the event type coming from the saved state is always POST_AUTO_BUILD
+//                                                                     // force it to be POST_CHANGE so that the delta processor can handle it
+//                                                                     manager.deltaState.getDeltaProcessor().overridenEventType = IResourceChangeEvent.POST_CHANGE;
+//                                                                     savedState.processResourceChangeEvents(manager.deltaState);
+//                                                             }
+//                                                     }
+//                                             },
+//                                             monitor);
+//                             } catch (CoreException e) {
+//                                     return e.getStatus();
+//                             }
+//                             return Status.OK_STATUS;
+//                     }
+//             };
+//             processSavedState.setSystem(true);
+//             processSavedState.setPriority(Job.SHORT); // process asap
+//             processSavedState.schedule();
     } catch (RuntimeException e) {
       manager.shutdown();
       throw e;