misc
[phpeclipse.git] / net.sourceforge.phpeclipse.phphelp / src / net / sourceforge / phpdt / phphelp / PHPHelpPlugin.java
index 9ddc55a..c7dd57d 100644 (file)
@@ -11,18 +11,8 @@ Contributors:
 **********************************************************************/
 package net.sourceforge.phpdt.phphelp;
 
-import net.sourceforge.phpdt.externaltools.internal.model.ColorManager;
-import net.sourceforge.phpdt.externaltools.internal.model.VariableContextManager;
-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.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;
@@ -34,7 +24,9 @@ import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.IWorkbenchPage;
 import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
 
 /**
  * The main plugin class to be used in the desktop.
@@ -55,7 +47,7 @@ public class PHPHelpPlugin extends AbstractUIPlugin {
    * The constructor.
    */
   public PHPHelpPlugin(IPluginDescriptor descriptor) {
-    super(descriptor);
+    super();
     plugin = this;
   }
 
@@ -77,23 +69,23 @@ public class PHPHelpPlugin extends AbstractUIPlugin {
   }
 
   private IWorkbenchPage internalGetActivePage() {
-    IWorkbenchWindow window = getWorkbench().getActiveWorkbenchWindow();
+    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
     if (window != null)
       return window.getActivePage();
     return null;
   }
 
   public static IWorkbenchWindow getActiveWorkbenchWindow() {
-    return getDefault().getWorkbench().getActiveWorkbenchWindow();
+    return PlatformUI.getWorkbench().getActiveWorkbenchWindow();
   }
 
   public static Shell getActiveWorkbenchShell() {
     return getActiveWorkbenchWindow().getShell();
   }
 
-  public static String getPluginId() {
-    return getDefault().getDescriptor().getUniqueIdentifier();
-  }
+//  public static String getPluginId() {
+//    return getDefault().getDescriptor().getUniqueIdentifier();
+//  }
 
   public static void log(IStatus status) {
     getDefault().getLog().log(status);
@@ -111,15 +103,15 @@ public class PHPHelpPlugin extends AbstractUIPlugin {
     return getDefault().isDebugging();
   }
 
-  static IPath getInstallLocation() {
-    return new Path(getDefault().getDescriptor().getInstallURL().getFile());
-  }
+//  static IPath getInstallLocation() {
+//    return new Path(getDefault().getDescriptor().getInstallURL().getFile());
+//  }
 
   protected void initializeDefaultPreferences(IPreferenceStore store) {
     // windows preferences:
-    String windowsSystem = BootLoader.getWS();
+    String windowsSystem = Platform.getWS();
 
-    if (windowsSystem.equals(BootLoader.WS_WIN32)) {
+    if (windowsSystem.equals(Platform.WS_WIN32)) {
       store.setDefault(PHP_CHM_ENABLED, "false");
       store.setDefault(PHP_CHM_FILE, "c:\\wampp2\\php\\php_manual_en.chm");
       store.setDefault(PHP_CHM_COMMAND, "hh.exe \"mk:@MSITStore:{0}::/en/function.{1}.html\"");
@@ -144,26 +136,49 @@ public class PHPHelpPlugin extends AbstractUIPlugin {
     return display;
   }
 
-  public void startup() throws CoreException {
-    super.startup();
-    IAdapterManager manager = Platform.getAdapterManager();
-    manager.registerAdapters(new PHPElementAdapterFactory(), PHPElement.class);
-    manager.registerAdapters(new ResourceAdapterFactory(), IResource.class);
-    //  externalTools.startUp(); 
-    getStandardDisplay().asyncExec(new Runnable() {
-      public void run() {
-        //initialize the variable context manager
-        VariableContextManager.getDefault();
-      }
-    });
-  }
-
-  /**
-   * @see org.eclipse.core.runtime.Plugin#shutdown()
-   */
-  public void shutdown() throws CoreException {
-    //  externalTools.shutDown();
-    ColorManager.getDefault().dispose();
-  }
-
+//  public void startup() throws CoreException {
+//    super.startup();
+//    IAdapterManager manager = Platform.getAdapterManager();
+//    manager.registerAdapters(new PHPElementAdapterFactory(), PHPElement.class);
+//    manager.registerAdapters(new ResourceAdapterFactory(), IResource.class);
+//    //  externalTools.startUp(); 
+//    getStandardDisplay().asyncExec(new Runnable() {
+//      public void run() {
+//        //initialize the variable context manager
+//        VariableContextManager.getDefault();
+//      }
+//    });
+//  }
+
+//  /**
+//   * @see org.eclipse.core.runtime.Plugin#shutdown()
+//   */
+//  public void shutdown() throws CoreException {
+//    //  externalTools.shutDown();
+//    ColorManager.getDefault().dispose();
+//  }
+
+       /* (non-Javadoc)
+        * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+        */
+       public void start(BundleContext context) throws Exception {
+               super.start(context);
+//             IAdapterManager manager = Platform.getAdapterManager();
+//         manager.registerAdapters(new PHPElementAdapterFactory(), PHPElement.class);
+//         manager.registerAdapters(new ResourceAdapterFactory(), IResource.class);
+//         //  externalTools.startUp(); 
+//         getStandardDisplay().asyncExec(new Runnable() {
+//           public void run() {
+//             //initialize the variable context manager
+//             VariableContextManager.getDefault();
+//           }
+//         });
+       }
+       /* (non-Javadoc)
+        * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+        */
+       public void stop(BundleContext context) throws Exception {
+//             ColorManager.getDefault().dispose();
+               super.stop(context);
+       }
 }
\ No newline at end of file