removed unused dependencies, replaced deprecated code and declarations
authorbananeweizen <bananeweizen>
Sun, 8 Jan 2006 09:56:13 +0000 (09:56 +0000)
committerbananeweizen <bananeweizen>
Sun, 8 Jan 2006 09:56:13 +0000 (09:56 +0000)
net.sourceforge.phpeclipse.phphelp/plugin.properties
net.sourceforge.phpeclipse.phphelp/plugin.xml
net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/phphelp/PHPHelpPlugin.java
net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/phphelp/PHPHelpPreferenceMessages.java
net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/phphelp/PHPHelpPreferencePage.java
net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/phphelp/actions/PHPEclipseShowContextHelp.java
net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/phphelp/actions/PHPFunctionHelpResource.java

index 389e36f..f40a103 100644 (file)
@@ -1,7 +1,7 @@
 #########################################
 #
 #########################################
-pluginName=PHP Plugin Help 
+pluginName=PHP Help
 providerName=phpeclipse.de
 phphelpLabel=PHP Help
 phphelpFormat=Help (WIN_32 *.chm format)
index 8691566..cde80a0 100644 (file)
       </library>
    </runtime>
    <requires>
-      <import plugin="org.eclipse.core.runtime.compatibility"/>
-      <import plugin="org.eclipse.ui.ide"/>
-      <import plugin="org.eclipse.ui.views"/>
-      <import plugin="org.eclipse.jface.text"/>
-      <import plugin="org.eclipse.ui.workbench.texteditor"/>
-      <import plugin="org.eclipse.ui.editors"/>
+      <import plugin="org.eclipse.core.runtime"/>
       <import plugin="org.eclipse.core.resources"/>
       <import plugin="org.eclipse.ui"/>
       <import plugin="org.eclipse.help"/>
+      <import plugin="org.eclipse.jface.text"/>
       <import plugin="org.eclipse.swt"/>
       <import plugin="net.sourceforge.phpeclipse"/>
+      <import plugin="org.eclipse.ui.editors"/>
+      <import plugin="org.eclipse.ui.workbench.texteditor"/>
    </requires>
    <extension
-         point="org.eclipse.ui.popupMenus">   
+         point="org.eclipse.ui.popupMenus">
       <viewerContribution
             targetID="#PHPEditorContext"
             id="net.sourceforge.phpdt.phphelp.actions.popup.editor">
          </action>
       </viewerContribution>
    </extension>
-  
+
    <extension
          point="org.eclipse.ui.editorActions">
-      <editorContribution 
+      <editorContribution
             id="net.sourceforge.phpdt.phphelp.actions"
             targetID="net.sourceforge.phpeclipse.PHPUnitEditor">
          <action
                id="net.sourceforge.phpdt.phphelp.actions.PHPEclipseShowContextHelp">
          </action>
       </editorContribution>
-   </extension>   
-   
+   </extension>
+
    <extension point="org.eclipse.ui.contexts">
-      <context 
-        name="%context.editingPHPSource.name" 
-        description="%context.editingPHPSource.description" 
-        parentId="org.eclipse.ui.textEditorScope" 
-        id="net.sourceforge.phpdt.ui.phpEditorScope" /> 
+      <context
+        name="%context.editingPHPSource.name"
+        description="%context.editingPHPSource.description"
+        parentId="org.eclipse.ui.textEditorScope"
+        id="net.sourceforge.phpdt.ui.phpEditorScope" />
    </extension>
    <extension
          point="org.eclipse.ui.commands">
             description="%category.source.description"
             id="net.sourceforge.phpeclipse.ui.category.source">
       </category>
-    
+
       <command
             name="%ActionDefinition.contexthelp.name"
             description="%ActionDefinition.contexthelp.description"
-            category="net.sourceforge.phpeclipse.ui.category.source"
+            categoryId="net.sourceforge.phpeclipse.ui.category.source"
             id="net.sourceforge.phpdt.phphelp.actions.contexthelp">
       </command>
-     
-      <keyBinding
-            string="Ctrl+Shift+H"
-            scope="net.sourceforge.phpdt.ui.phpEditorScope"
-            command="net.sourceforge.phpdt.phphelp.actions.contexthelp"
-            configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
-      </keyBinding>
   </extension>
-  
+
   <extension
          point="org.eclipse.help.toc">
       <toc
             id="net.sourceforge.phpdt.phphelp.PHPHelpPreferencePage">
       </page>
    </extension>
+   <extension
+         point="org.eclipse.ui.bindings">
+      <key
+            sequence="Ctrl+Shift+H"
+            contextId="net.sourceforge.phpdt.ui.phpEditorScope"
+            commandId="net.sourceforge.phpdt.phphelp.actions.contexthelp"
+            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
+      </key>
+   </extension>
 </plugin>
index 0790305..f296936 100644 (file)
@@ -1,19 +1,18 @@
 /**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
-    IBM Corporation - Initial implementation
-    www.phpeclipse.de
-**********************************************************************/
+ Copyright (c) 2000, 2002 IBM Corp. and others.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Common Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/cpl-v10.html
+
+ Contributors:
+ IBM Corporation - Initial implementation
+ www.phpeclipse.de
+ **********************************************************************/
 package net.sourceforge.phpdt.phphelp;
 
 import org.eclipse.core.resources.IWorkspace;
 import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPluginDescriptor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Platform;
 import org.eclipse.core.runtime.Status;
@@ -30,153 +29,165 @@ import org.osgi.framework.BundleContext;
  * The main plugin class to be used in the desktop.
  */
 public class PHPHelpPlugin extends AbstractUIPlugin {
-  public static final String PHP_CHM_ENABLED = "_php_chm_enabled";
-  public static final String PHP_CHM_FILE = "_php_chm_file";
-  public static final String PHP_CHM_COMMAND = "_php_chm_command";
-
-  /**
-   * The id of the PHP plugin (value <code>"net.sourceforge.phpeclipse.phphelp"</code>).
-   */
-  public static final String PLUGIN_ID = "net.sourceforge.phpeclipse.phphelp"; //$NON-NLS-1$
-
-  //The shared instance.
-  private static PHPHelpPlugin plugin;
-  /**
-   * The constructor.
-   */
-  public PHPHelpPlugin(IPluginDescriptor descriptor) {
-    super();
-    plugin = this;
-  }
-
-  /**
-   * Returns the shared instance.
-   */
-  public static PHPHelpPlugin getDefault() {
-    return plugin;
-  }
-  /**
-   * Returns the workspace instance.
-   */
-  public static IWorkspace getWorkspace() {
-    return ResourcesPlugin.getWorkspace();
-  }
-
-  public static IWorkbenchPage getActivePage() {
-    return getDefault().internalGetActivePage();
-  }
-
-  private IWorkbenchPage internalGetActivePage() {
-    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
-    if (window != null)
-      return window.getActivePage();
-    return null;
-  }
-
-  public static IWorkbenchWindow getActiveWorkbenchWindow() {
-    return PlatformUI.getWorkbench().getActiveWorkbenchWindow();
-  }
-
-  public static Shell getActiveWorkbenchShell() {
-    return getActiveWorkbenchWindow().getShell();
-  }
-
-//  public static String getPluginId() {
-//    return getDefault().getDescriptor().getUniqueIdentifier();
-//  }
-
-  public static void log(IStatus status) {
-    getDefault().getLog().log(status);
-  }
-
-  public static void log(int severity, String message) {
-    Status status = new Status(severity, PLUGIN_ID, IStatus.OK, message, null);
-    log(status);
-  }
-  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();
-  }
-
-//  static IPath getInstallLocation() {
-//    return new Path(getDefault().getDescriptor().getInstallURL().getFile());
-//  }
-
-  protected void initializeDefaultPreferences(IPreferenceStore store) {
-    // windows preferences:
-    String windowsSystem = Platform.getWS();
-
-    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\"");
-    } else {
-      store.setDefault(PHP_CHM_ENABLED, "false");
-      store.setDefault(PHP_CHM_FILE, "");
-      store.setDefault(PHP_CHM_COMMAND, "");
-    }
-
-  }
-
-  /**
-   * Returns the standard display to be used. The method first checks, if
-   * the thread calling this method has an associated display. If so, this
-   * display is returned. Otherwise the method returns the default display.
-   */
-  public static Display getStandardDisplay() {
-    Display display = Display.getCurrent();
-    if (display == null) {
-      display = Display.getDefault();
-    }
-    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();
-//  }
-
-       /* (non-Javadoc)
+       public static final String PHP_CHM_ENABLED = "_php_chm_enabled";
+
+       public static final String PHP_CHM_FILE = "_php_chm_file";
+
+       public static final String PHP_CHM_COMMAND = "_php_chm_command";
+
+       /**
+        * The id of the PHP plugin (value
+        * <code>"net.sourceforge.phpeclipse.phphelp"</code>).
+        */
+       public static final String PLUGIN_ID = "net.sourceforge.phpeclipse.phphelp"; //$NON-NLS-1$
+
+       // The shared instance.
+       private static PHPHelpPlugin plugin;
+
+       /**
+        * The constructor.
+        */
+       public PHPHelpPlugin() {
+               super();
+               plugin = this;
+       }
+
+       /**
+        * Returns the shared instance.
+        */
+       public static PHPHelpPlugin getDefault() {
+               return plugin;
+       }
+
+       /**
+        * Returns the workspace instance.
+        */
+       public static IWorkspace getWorkspace() {
+               return ResourcesPlugin.getWorkspace();
+       }
+
+       public static IWorkbenchPage getActivePage() {
+               return getDefault().internalGetActivePage();
+       }
+
+       private IWorkbenchPage internalGetActivePage() {
+               IWorkbenchWindow window = PlatformUI.getWorkbench()
+                               .getActiveWorkbenchWindow();
+               if (window != null)
+                       return window.getActivePage();
+               return null;
+       }
+
+       public static IWorkbenchWindow getActiveWorkbenchWindow() {
+               return PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+       }
+
+       public static Shell getActiveWorkbenchShell() {
+               return getActiveWorkbenchWindow().getShell();
+       }
+
+       public static void log(IStatus status) {
+               getDefault().getLog().log(status);
+       }
+
+       public static void log(int severity, String message) {
+               Status status = new Status(severity, PLUGIN_ID, IStatus.OK, message,
+                               null);
+               log(status);
+       }
+
+       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();
+       }
+
+       protected void initializeDefaultPreferences(IPreferenceStore store) {
+               // windows preferences:
+               String windowsSystem = Platform.getWS();
+
+               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\"");
+               } else {
+                       store.setDefault(PHP_CHM_ENABLED, "false");
+                       store.setDefault(PHP_CHM_FILE, "");
+                       store.setDefault(PHP_CHM_COMMAND, "");
+               }
+
+       }
+
+       /**
+        * Returns the standard display to be used. The method first checks, if the
+        * thread calling this method has an associated display. If so, this display
+        * is returned. Otherwise the method returns the default display.
+        */
+       public static Display getStandardDisplay() {
+               Display display = Display.getCurrent();
+               if (display == null) {
+                       display = Display.getDefault();
+               }
+               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();
+       // }
+
+       /*
+        * (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();
-//           }
-//         });
+               // 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)
+
+       /*
+        * (non-Javadoc)
+        *
         * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
         */
        public void stop(BundleContext context) throws Exception {
-//             ColorManager.getDefault().dispose();
+               // ColorManager.getDefault().dispose();
                super.stop(context);
        }
 }
\ No newline at end of file
index 255ef1d..14374c3 100644 (file)
@@ -5,32 +5,34 @@ import java.util.ResourceBundle;
 
 /**
  * @author jsurfer
- *
+ * 
  * 
  */
 public class PHPHelpPreferenceMessages {
 
-  private static final String BUNDLE_NAME = "net.sourceforge.phpdt.phphelp.PHPHelpPreferenceMessages"; //$NON-NLS-1$
+       private static final String BUNDLE_NAME = "net.sourceforge.phpdt.phphelp.PHPHelpPreferenceMessages"; //$NON-NLS-1$
+
+       private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+                       .getBundle(BUNDLE_NAME);
 
-  private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
+       /**
+        * 
+        */
+       private PHPHelpPreferenceMessages() {
 
-  /**
-   * 
-   */
-  private PHPHelpPreferenceMessages() {
+               // TODO Auto-generated constructor stub
+       }
 
-    // TODO Auto-generated constructor stub
-  }
-  /**
-   * @param key
-   * @return
-   */
-  public static String getString(String key) {
-    // TODO Auto-generated method stub
-    try {
-      return RESOURCE_BUNDLE.getString(key);
-    } catch (MissingResourceException e) {
-      return '!' + key + '!';
-    }
-  }
+       /**
+        * @param key
+        * @return
+        */
+       public static String getString(String key) {
+               // TODO Auto-generated method stub
+               try {
+                       return RESOURCE_BUNDLE.getString(key);
+               } catch (MissingResourceException e) {
+                       return '!' + key + '!';
+               }
+       }
 }
index dbfac90..7eba32e 100644 (file)
@@ -2,7 +2,6 @@ package net.sourceforge.phpdt.phphelp;
 
 import org.eclipse.jface.preference.BooleanFieldEditor;
 import org.eclipse.jface.preference.FileFieldEditor;
-import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.jface.preference.PreferencePage;
 import org.eclipse.jface.preference.StringFieldEditor;
 import org.eclipse.swt.SWT;
@@ -14,82 +13,81 @@ import org.eclipse.swt.widgets.Label;
 import org.eclipse.ui.IWorkbench;
 import org.eclipse.ui.IWorkbenchPreferencePage;
 
-public class PHPHelpPreferencePage
-  extends PreferencePage
-  implements IWorkbenchPreferencePage {
+public class PHPHelpPreferencePage extends PreferencePage implements
+               IWorkbenchPreferencePage {
 
-  FileFieldEditor phpCHMHelpFile;
-  BooleanFieldEditor phpCHMHelpEnabled;
-  StringFieldEditor phpCHMHelpCommand;
+       FileFieldEditor phpCHMHelpFile;
 
-  public PHPHelpPreferencePage() {
-    super();
-    setPreferenceStore(PHPHelpPlugin.getDefault().getPreferenceStore());
-    setDescription(PHPHelpPreferenceMessages.getString("PHPHelpPreferencePage.PHPHelpSettings"));   //$NON-NLS-1$
-  }
+       BooleanFieldEditor phpCHMHelpEnabled;
 
-  public void init(IWorkbench workbench) {
-  }
+       StringFieldEditor phpCHMHelpCommand;
 
-  protected void performDefaults() {
-    phpCHMHelpFile.loadDefault();
-    phpCHMHelpEnabled.loadDefault();
-    phpCHMHelpCommand.loadDefault();
-    super.performDefaults();
-  }
+       public PHPHelpPreferencePage() {
+               super();
+               setPreferenceStore(PHPHelpPlugin.getDefault().getPreferenceStore());
+               setDescription(PHPHelpPreferenceMessages
+                               .getString("PHPHelpPreferencePage.PHPHelpSettings")); //$NON-NLS-1$
+       }
 
-  public boolean performOk() {
-    phpCHMHelpFile.store();
-    phpCHMHelpEnabled.store();
-    phpCHMHelpCommand.store();
-    return super.performOk();
-  }
+       public void init(IWorkbench workbench) {
+       }
 
-  protected Control createContents(Composite parent) {
-    initializeDialogUnits(parent);
-    final IPreferenceStore store =
-      PHPHelpPlugin.getDefault().getPreferenceStore();
-    Composite composite = new Composite(parent, SWT.LEFT);
-    composite.setLayout(new GridLayout());
-    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+       protected void performDefaults() {
+               phpCHMHelpFile.loadDefault();
+               phpCHMHelpEnabled.loadDefault();
+               phpCHMHelpCommand.loadDefault();
+               super.performDefaults();
+       }
 
-    //    Composite helpSettingsComposite = new Composite(composite, SWT.NONE);
-    //    helpSettingsComposite.setLayout(new GridLayout());
-    //    helpSettingsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-    //    Group helpSettingsGroup = new Group(helpSettingsComposite, SWT.NONE);
-    //    helpSettingsGroup.setText("Windows CHM settings");
-    //    helpSettingsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-    //    helpSettingsGroup.setLayout(new GridLayout());
+       public boolean performOk() {
+               phpCHMHelpFile.store();
+               phpCHMHelpEnabled.store();
+               phpCHMHelpCommand.store();
+               return super.performOk();
+       }
 
-    phpCHMHelpEnabled =
-      new BooleanFieldEditor(
-        PHPHelpPlugin.PHP_CHM_ENABLED,
-        PHPHelpPreferenceMessages.getString("PHPHelpPreferencePage.PHPHelp.format"), //$NON-NLS-1$
-        composite);
-    phpCHMHelpEnabled.setPreferencePage(this);
-    phpCHMHelpEnabled.setPreferenceStore(getPreferenceStore());
-    phpCHMHelpEnabled.load();
+       protected Control createContents(Composite parent) {
+               initializeDialogUnits(parent);
+               Composite composite = new Composite(parent, SWT.LEFT);
+               composite.setLayout(new GridLayout());
+               composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
 
-    new Label(composite, SWT.NONE);
-    phpCHMHelpFile =
-      new FileFieldEditor(
-        PHPHelpPlugin.PHP_CHM_FILE,
-        PHPHelpPreferenceMessages.getString("PHPHelpPreferencePage.PHPHelp.chm.file"), //$NON-NLS-1$
-        composite);
-    phpCHMHelpFile.setPreferencePage(this);
-    phpCHMHelpFile.setPreferenceStore(getPreferenceStore());
-    phpCHMHelpFile.load();
+               // Composite helpSettingsComposite = new Composite(composite, SWT.NONE);
+               // helpSettingsComposite.setLayout(new GridLayout());
+               // helpSettingsComposite.setLayoutData(new
+               // GridData(GridData.FILL_HORIZONTAL));
+               // Group helpSettingsGroup = new Group(helpSettingsComposite, SWT.NONE);
+               // helpSettingsGroup.setText("Windows CHM settings");
+               // helpSettingsGroup.setLayoutData(new
+               // GridData(GridData.FILL_HORIZONTAL));
+               // helpSettingsGroup.setLayout(new GridLayout());
 
-    new Label(composite, SWT.NONE);
-    phpCHMHelpCommand =
-      new StringFieldEditor(
-        PHPHelpPlugin.PHP_CHM_COMMAND,
-        PHPHelpPreferenceMessages.getString("PHPHelpPreferencePage.PHPHelp.command"), //$NON-NLS-1$
-        composite);
-    phpCHMHelpCommand.setPreferencePage(this);
-    phpCHMHelpCommand.setPreferenceStore(getPreferenceStore());
-    phpCHMHelpCommand.load();
+               phpCHMHelpEnabled = new BooleanFieldEditor(
+                               PHPHelpPlugin.PHP_CHM_ENABLED, PHPHelpPreferenceMessages
+                                               .getString("PHPHelpPreferencePage.PHPHelp.format"), //$NON-NLS-1$
+                               composite);
+               phpCHMHelpEnabled.setPage(this);
+               phpCHMHelpEnabled.setPreferenceStore(getPreferenceStore());
+               phpCHMHelpEnabled.load();
 
-    return composite;
-  }
+               new Label(composite, SWT.NONE);
+               phpCHMHelpFile = new FileFieldEditor(PHPHelpPlugin.PHP_CHM_FILE,
+                               PHPHelpPreferenceMessages
+                                               .getString("PHPHelpPreferencePage.PHPHelp.chm.file"), //$NON-NLS-1$
+                               composite);
+               phpCHMHelpFile.setPage(this);
+               phpCHMHelpFile.setPreferenceStore(getPreferenceStore());
+               phpCHMHelpFile.load();
+
+               new Label(composite, SWT.NONE);
+               phpCHMHelpCommand = new StringFieldEditor(
+                               PHPHelpPlugin.PHP_CHM_COMMAND, PHPHelpPreferenceMessages
+                                               .getString("PHPHelpPreferencePage.PHPHelp.command"), //$NON-NLS-1$
+                               composite);
+               phpCHMHelpCommand.setPage(this);
+               phpCHMHelpCommand.setPreferenceStore(getPreferenceStore());
+               phpCHMHelpCommand.load();
+
+               return composite;
+       }
 }
index c822bb1..a671d36 100644 (file)
@@ -1,14 +1,14 @@
 /**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
+ Copyright (c) 2000, 2002 IBM Corp. and others.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Common Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/cpl-v10.html
 
-Contributors:
-    IBM Corporation - Initial implementation
-    www.phpeclipse.de
-**********************************************************************/
+ Contributors:
+ IBM Corporation - Initial implementation
+ www.phpeclipse.de
+ **********************************************************************/
 package net.sourceforge.phpdt.phphelp.actions;
 
 import java.io.IOException;
@@ -30,85 +30,90 @@ import org.eclipse.ui.IEditorActionDelegate;
 import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.actions.ActionDelegate;
-import org.eclipse.ui.help.WorkbenchHelp;
 
-public class PHPEclipseShowContextHelp extends ActionDelegate implements IEditorActionDelegate {
+public class PHPEclipseShowContextHelp extends ActionDelegate implements
+               IEditorActionDelegate {
 
-  private IWorkbenchWindow window;
-  private PHPEditor editor;
+       private IWorkbenchWindow window;
 
-  public void dispose() {
-  }
+       private PHPEditor editor;
 
-  public void init(IWorkbenchWindow window) {
-    this.window = window;
-  }
+       public void dispose() {
+       }
 
-  public void selectionChanged(IAction action, ISelection selection) {
-    if (!selection.isEmpty()) {
-      if (selection instanceof TextSelection) {
-        action.setEnabled(true);
-      } else if (window.getActivePage() != null && window.getActivePage().getActivePart() != null) {
-        //
-      }
-    }
-  }
+       public void init(IWorkbenchWindow window) {
+               this.window = window;
+       }
 
-  public void run(IAction action) {
-    if (editor == null) {
-      IEditorPart targetEditor = window.getActivePage().getActiveEditor();
-      if (targetEditor != null && (targetEditor instanceof PHPEditor)) {
-        editor = (PHPEditor) targetEditor;
-      }
-    }
-    if (editor != null) {
-      ITextSelection selection = (ITextSelection) editor.getSelectionProvider().getSelection();
-      IDocument doc = editor.getDocumentProvider().getDocument(editor.getEditorInput());
-      int pos = selection.getOffset();
-      String word = getFunctionName(doc, pos);
-      openContextHelp(word);
+       public void selectionChanged(IAction action, ISelection selection) {
+               if (!selection.isEmpty()) {
+                       if (selection instanceof TextSelection) {
+                               action.setEnabled(true);
+                       } else if (window.getActivePage() != null
+                                       && window.getActivePage().getActivePart() != null) {
+                               //
+                       }
+               }
+       }
 
-    }
-  }
+       public void run(IAction action) {
+               if (editor == null) {
+                       IEditorPart targetEditor = window.getActivePage().getActiveEditor();
+                       if (targetEditor != null && (targetEditor instanceof PHPEditor)) {
+                               editor = (PHPEditor) targetEditor;
+                       }
+               }
+               if (editor != null) {
+                       ITextSelection selection = (ITextSelection) editor
+                                       .getSelectionProvider().getSelection();
+                       IDocument doc = editor.getDocumentProvider().getDocument(
+                                       editor.getEditorInput());
+                       if (null == window) {
+                               window = editor.getSite().getWorkbenchWindow();
+                       }
+                       int pos = selection.getOffset();
+                       String word = getFunctionName(doc, pos);
+                       openContextHelp(word);
+               }
+       }
 
-  public void setActiveEditor(IAction action, IEditorPart targetEditor) {
-    if (targetEditor != null && (targetEditor instanceof PHPEditor)) {
-      editor = (PHPEditor) targetEditor;
-    }
-  }
+       public void setActiveEditor(IAction action, IEditorPart targetEditor) {
+               if (targetEditor != null && (targetEditor instanceof PHPEditor)) {
+                       editor = (PHPEditor) targetEditor;
+               }
+       }
 
-  public static void openContextHelp(String word) {
-    IPreferenceStore store = PHPHelpPlugin.getDefault().getPreferenceStore();
-    if (store.getBoolean(PHPHelpPlugin.PHP_CHM_ENABLED)) {
-      String[] arguments = { store.getString(PHPHelpPlugin.PHP_CHM_FILE), word };
-      MessageFormat form = new MessageFormat(store.getString(PHPHelpPlugin.PHP_CHM_COMMAND));
-      try {
-        Runtime runtime = Runtime.getRuntime();
-        String command = form.format(arguments);
+       public void openContextHelp(String word) {
+               IPreferenceStore store = PHPHelpPlugin.getDefault()
+                               .getPreferenceStore();
+               if (store.getBoolean(PHPHelpPlugin.PHP_CHM_ENABLED)) {
+                       String[] arguments = { store.getString(PHPHelpPlugin.PHP_CHM_FILE),
+                                       word };
+                       MessageFormat form = new MessageFormat(store
+                                       .getString(PHPHelpPlugin.PHP_CHM_COMMAND));
+                       try {
+                               Runtime runtime = Runtime.getRuntime();
+                               String command = form.format(arguments);
 
-        runtime.exec(command);
-      } catch (IOException e) {
-      }
-    } else {
-//      IHelp help = WorkbenchHelp.getHelpSupport();
-//      if (help != null) {
-        PHPFunctionHelpResource helpResource = new PHPFunctionHelpResource(word);
-        WorkbenchHelp.displayHelpResource(helpResource.getHref());
-        //getHelpSupport().displayHelpResource(helpResource);
-//      } else {
-        //   showMessage(shell, dialogTitle, ActionMessages.getString("Open help not available"), false); //$NON-NLS-1$
-//      }
-    }
-  }
+                               runtime.exec(command);
+                       } catch (IOException e) {
+                       }
+               } else {
+                       PHPFunctionHelpResource helpResource = new PHPFunctionHelpResource(
+                                       word);
+                       window.getWorkbench().getHelpSystem().displayHelpResource(
+                                       helpResource.getHref());
+               }
+       }
 
-  private String getFunctionName(IDocument doc, int pos) {
-    Point word = PHPWordExtractor.findWord(doc, pos);
-    if (word != null) {
-      try {
-        return doc.get(word.x, word.y).replace('_', '-');
-      } catch (BadLocationException e) {
-      }
-    }
-    return "";
-  }
+       private String getFunctionName(IDocument doc, int pos) {
+               Point word = PHPWordExtractor.findWord(doc, pos);
+               if (word != null) {
+                       try {
+                               return doc.get(word.x, word.y).replace('_', '-');
+                       } catch (BadLocationException e) {
+                       }
+               }
+               return "";
+       }
 }
index f33ad0d..d07bfc7 100644 (file)
@@ -1,40 +1,41 @@
 /**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
-    IBM Corporation - Initial implementation
-    www.phpeclipse.de
-**********************************************************************/
+ Copyright (c) 2000, 2002 IBM Corp. and others.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Common Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/cpl-v10.html
+
+ Contributors:
+ IBM Corporation - Initial implementation
+ www.phpeclipse.de
+ **********************************************************************/
 package net.sourceforge.phpdt.phphelp.actions;
 
 import org.eclipse.help.IHelpResource;
 
 /**
- * 
+ *
  */
 public class PHPFunctionHelpResource implements IHelpResource {
 
-  private String word;
-
-  public PHPFunctionHelpResource(String word) {
-    this.word = word;
-  }
-
-  /**
-    * Get standard PHPEclipse html help URL 
-    * @return String
-    */
-  public String getHref() {
-    return "/net.sourceforge.phpeclipse.phphelp/doc/function." + word + ".html";
-  }
-
-  public String getLabel() {
-    return "PHP Context Help";
-  }
+       private String word;
+
+       public PHPFunctionHelpResource(String word) {
+               this.word = word;
+       }
+
+       /**
+        * Get standard PHPEclipse html help URL
+        *
+        * @return String
+        */
+       public String getHref() {
+               return "/net.sourceforge.phpeclipse.phphelp/doc/function." + word
+                               + ".html";
+       }
+
+       public String getLabel() {
+               return "PHP Context Help";
+       }
 
 }
\ No newline at end of file