bug 1274348, superfluous newline at file end on formatting source
[phpeclipse.git] / net.sourceforge.phpeclipse.phphelp / src / net / sourceforge / phpdt / phphelp / PHPHelpPlugin.java
index 9ddc55a..0790305 100644 (file)
@@ -7,26 +7,14 @@ http://www.eclipse.org/legal/cpl-v10.html
 
 Contributors:
     IBM Corporation - Initial implementation
-    Klaus Hartlage - www.eclipseproject.de
+    www.phpeclipse.de
 **********************************************************************/
 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;
-import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.Platform;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.jface.preference.IPreferenceStore;
@@ -34,7 +22,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 +45,7 @@ public class PHPHelpPlugin extends AbstractUIPlugin {
    * The constructor.
    */
   public PHPHelpPlugin(IPluginDescriptor descriptor) {
-    super(descriptor);
+    super();
     plugin = this;
   }
 
@@ -77,23 +67,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 +101,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 +134,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