Made the help plugin 3.x compatible
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / PHPeclipsePlugin.java
index e748758..1ec421e 100644 (file)
@@ -18,6 +18,7 @@ import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
+
 import net.sourceforge.phpdt.core.JavaCore;
 import net.sourceforge.phpdt.externaltools.internal.model.ColorManager;
 import net.sourceforge.phpdt.externaltools.internal.model.ExternalToolsPlugin;
@@ -43,6 +44,7 @@ import net.sourceforge.phpeclipse.phpeditor.util.PHPColorProvider;
 import net.sourceforge.phpeclipse.resourcesview.PHPElement;
 import net.sourceforge.phpeclipse.resourcesview.PHPElementAdapterFactory;
 import net.sourceforge.phpeclipse.resourcesview.ResourceAdapterFactory;
+
 import org.eclipse.core.boot.BootLoader;
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IProject;
@@ -54,7 +56,6 @@ import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IAdapterManager;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.core.runtime.IConfigurationElement;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.Platform;
@@ -80,7 +81,7 @@ import org.eclipse.ui.ide.IDE;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 import org.eclipse.ui.texteditor.IDocumentProvider;
 import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.ConfigurationElementSorter;
+import org.eclipse.ui.texteditor.MarkerAnnotationPreferences;
 /**
  * The main plugin class to be used in the desktop.
  */
@@ -164,13 +165,8 @@ public class PHPeclipsePlugin extends AbstractUIPlugin
    */
   public JavaEditorTextHoverDescriptor[] getJavaEditorTextHoverDescriptors() {
     if (fJavaEditorTextHoverDescriptors == null)
-      fJavaEditorTextHoverDescriptors = JavaEditorTextHoverDescriptor.getContributedHovers();
-                       ConfigurationElementSorter sorter= new ConfigurationElementSorter() {
-                         public IConfigurationElement getConfigurationElement(Object object) {
-                           return ((JavaEditorTextHoverDescriptor)object).getConfigurationElement();
-                         }
-                       };
-                       sorter.sort(fJavaEditorTextHoverDescriptors);    
+      fJavaEditorTextHoverDescriptors = JavaEditorTextHoverDescriptor
+          .getContributedHovers();
     return fJavaEditorTextHoverDescriptors;
   }
   /**
@@ -412,9 +408,15 @@ public class PHPeclipsePlugin extends AbstractUIPlugin
   protected void initializeDefaultPreferences(IPreferenceStore store) {
     // windows preferences:
     store.setDefault(LOCALHOST_PREF, "http://localhost");
-    store.setDefault(SHOW_EXTERNAL_PREVIEW_PREF, "true");
+//    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");
+    
     String windowsSystem = BootLoader.getWS();
     if (jvm == WINDOWS_9x) {
       store.setDefault(EXTERNAL_BROWSER_PREF,
@@ -426,6 +428,7 @@ public class PHPeclipsePlugin extends AbstractUIPlugin
       // TODO How do we start Safari on Mac OS X ?
       store.setDefault(EXTERNAL_BROWSER_PREF, "netscape {0}");
     } else {
+      store.setDefault(PHP_OBFUSCATOR_DEFAULT, "/tmp");
       store.setDefault(EXTERNAL_BROWSER_PREF, "netscape {0}");
     }
     store.setDefault(DOCUMENTROOT_PREF, getWorkspace().getRoot().getLocation()
@@ -535,6 +538,7 @@ public class PHPeclipsePlugin extends AbstractUIPlugin
     JavaCore.initializeDefaultPluginPreferences();
     PreferenceConstants.initializeDefaultValues(store);
     externalTools.initializeDefaultPreferences(store);
+    MarkerAnnotationPreferences.initializeDefaultValues(store);        
   }
   private IWorkbenchPage internalGetActivePage() {
     IWorkbenchWindow window = getWorkbench().getActiveWorkbenchWindow();
@@ -577,7 +581,8 @@ public class PHPeclipsePlugin extends AbstractUIPlugin
       IEditorRegistry registry = getWorkbench().getEditorRegistry();
       IEditorDescriptor desc = registry.getDefaultEditor(filename);
       if (desc == null) {
-        desc = registry.getDefaultEditor();
+        desc = registry.findEditor(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID);
+     //   desc = registry.getDefaultEditor();
       }
       IEditorInput input = new ExternalEditorInput(storage);
       editor = page.openEditor(input, desc.getId());