PHP perspective and new Project Wizard
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / PHPeclipsePlugin.java
index f3a86d2..7c46c83 100644 (file)
@@ -16,12 +16,19 @@ import java.util.ResourceBundle;
 
 import net.sourceforge.phpeclipse.phpeditor.PHPDocumentProvider;
 import net.sourceforge.phpeclipse.phpeditor.util.PHPColorProvider;
+import net.sourceforge.phpeclipse.resourcesview.*;
+
+import org.eclipse.core.resources.IResource;
 import org.eclipse.core.resources.IWorkspace;
 import org.eclipse.core.resources.ResourcesPlugin;
+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.IStatus;
 import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
 import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.jface.preference.PreferenceConverter;
 import org.eclipse.swt.widgets.Shell;
@@ -47,8 +54,10 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon
   /**
    * The id of the PHP plugin (value <code>"net.sourceforge.phpeclipse"</code>).
    */
-  public static final String ID_PLUGIN = "net.sourceforge.phpeclipse"; //$NON-NLS-1$
-
+  public static final String PLUGIN_ID = "net.sourceforge.phpeclipse"; //$NON-NLS-1$
+  public final static String PHP_NATURE_ID = PLUGIN_ID + ".phpnature";
+  public static final String PHP_RESOURCES_VIEW_ID = PLUGIN_ID + ".resourcesview.ViewPHPResources"; //$NON-NLS-1$
   //The shared instance.
   private static PHPeclipsePlugin plugin;
   //Resource bundle.
@@ -188,7 +197,10 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon
   //  public static void log(Throwable e) {
   //    log(new Status(IStatus.ERROR, getPluginId(), JavaStatusConstants.INTERNAL_ERROR, JavaUIMessages.getString("JavaPlugin.internal_error"), e)); //$NON-NLS-1$
   //  }
-
+  
+  public static void log(Throwable e) {
+    log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, "PHPeclipsePlugin.internalErrorOccurred", e)); //$NON-NLS-1$
+  }
   public static boolean isDebug() {
     return getDefault().isDebugging();
   }
@@ -247,7 +259,7 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon
  
     }
 
-    store.setDefault(PHP_PARSER_DEFAULT, "true");
+    store.setDefault(PHP_PARSER_DEFAULT, PHP_INTERNAL_PARSER);
     store.setDefault(PHP_INTERNAL_PARSER, "true");
     store.setDefault(PHP_EXTERNAL_PARSER, "false");
     
@@ -262,4 +274,11 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon
     PreferenceConverter.setDefault(store, PHP_DEFAULT, PHPColorProvider.DEFAULT);
 
   }
+  
+    public void startup() throws CoreException {
+    super.startup();
+    IAdapterManager manager= Platform.getAdapterManager();
+    manager.registerAdapters(new PHPElementAdapterFactory(), PHPElement.class);
+    manager.registerAdapters(new ResourceAdapterFactory(), IResource.class);
+  }
 }
\ No newline at end of file