From 0cc31483f2140e1e79bf6d919345ac1474e93ddb Mon Sep 17 00:00:00 2001 From: khartlage Date: Fri, 27 Dec 2002 23:16:07 +0000 Subject: [PATCH] This commit was generated by cvs2svn to compensate for changes in r55, which included commits to RCS files with non-trunk default branches. --- net.sourceforge.phpeclipse.phphelp/.classpath | 22 ++++ net.sourceforge.phpeclipse.phphelp/.project | 29 +++++ net.sourceforge.phpeclipse.phphelp/.template | 4 + .../build.properties | 1 + net.sourceforge.phpeclipse.phphelp/build.xml | 115 ++++++++++++++++++++ net.sourceforge.phpeclipse.phphelp/phphelp.xml | 10 ++ .../plugin.properties | 5 + net.sourceforge.phpeclipse.phphelp/plugin.xml | 39 +++++++ .../phphelp/actions/PHPEclipseShowContextHelp.java | 96 ++++++++++++++++ .../phphelp/actions/PHPFunctionHelpResource.java | 35 ++++++ 10 files changed, 356 insertions(+), 0 deletions(-) create mode 100644 net.sourceforge.phpeclipse.phphelp/.classpath create mode 100644 net.sourceforge.phpeclipse.phphelp/.project create mode 100644 net.sourceforge.phpeclipse.phphelp/.template create mode 100644 net.sourceforge.phpeclipse.phphelp/build.properties create mode 100644 net.sourceforge.phpeclipse.phphelp/build.xml create mode 100644 net.sourceforge.phpeclipse.phphelp/phphelp.xml create mode 100644 net.sourceforge.phpeclipse.phphelp/plugin.properties create mode 100644 net.sourceforge.phpeclipse.phphelp/plugin.xml create mode 100644 net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/phphelp/actions/PHPEclipseShowContextHelp.java create mode 100644 net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/phphelp/actions/PHPFunctionHelpResource.java diff --git a/net.sourceforge.phpeclipse.phphelp/.classpath b/net.sourceforge.phpeclipse.phphelp/.classpath new file mode 100644 index 0000000..8a77a77 --- /dev/null +++ b/net.sourceforge.phpeclipse.phphelp/.classpath @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + diff --git a/net.sourceforge.phpeclipse.phphelp/.project b/net.sourceforge.phpeclipse.phphelp/.project new file mode 100644 index 0000000..39448c4 --- /dev/null +++ b/net.sourceforge.phpeclipse.phphelp/.project @@ -0,0 +1,29 @@ + + + net.sourceforge.phpeclipse.phphelp + + + net.sourceforge.phpeclipse + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + diff --git a/net.sourceforge.phpeclipse.phphelp/.template b/net.sourceforge.phpeclipse.phphelp/.template new file mode 100644 index 0000000..d65e0f4 --- /dev/null +++ b/net.sourceforge.phpeclipse.phphelp/.template @@ -0,0 +1,4 @@ + +
+

Tips on working with this plug-in project

  • For the view of the new plug-in at a glance, go to the Overview.
  • You can test the contributions of this plug-in by launching another instance of the workbench. On the Run menu, click Run As and choose Run-time Workbench from the available choices.
  • You can add more functionality to this plug-in by adding extensions using the New Extension Wizard.
  • The plug-in project contains Java code that you can debug. Place breakpoints in Java classes. On the Run menu, select Debug As and choose Run-time Workbench from the available choices.
  • +
    diff --git a/net.sourceforge.phpeclipse.phphelp/build.properties b/net.sourceforge.phpeclipse.phphelp/build.properties new file mode 100644 index 0000000..ec21977 --- /dev/null +++ b/net.sourceforge.phpeclipse.phphelp/build.properties @@ -0,0 +1 @@ +source.phphelp.jar = src/ diff --git a/net.sourceforge.phpeclipse.phphelp/build.xml b/net.sourceforge.phpeclipse.phphelp/build.xml new file mode 100644 index 0000000..ee787e4 --- /dev/null +++ b/net.sourceforge.phpeclipse.phphelp/build.xml @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/net.sourceforge.phpeclipse.phphelp/phphelp.xml b/net.sourceforge.phpeclipse.phphelp/phphelp.xml new file mode 100644 index 0000000..8e19278 --- /dev/null +++ b/net.sourceforge.phpeclipse.phphelp/phphelp.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/net.sourceforge.phpeclipse.phphelp/plugin.properties b/net.sourceforge.phpeclipse.phphelp/plugin.properties new file mode 100644 index 0000000..0a31e89 --- /dev/null +++ b/net.sourceforge.phpeclipse.phphelp/plugin.properties @@ -0,0 +1,5 @@ +######################################### +# +######################################### +pluginName=PHP Plugin Help +providerName=EclipseProject.de diff --git a/net.sourceforge.phpeclipse.phphelp/plugin.xml b/net.sourceforge.phpeclipse.phphelp/plugin.xml new file mode 100644 index 0000000..6af417e --- /dev/null +++ b/net.sourceforge.phpeclipse.phphelp/plugin.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/phphelp/actions/PHPEclipseShowContextHelp.java b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/phphelp/actions/PHPEclipseShowContextHelp.java new file mode 100644 index 0000000..834d108 --- /dev/null +++ b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/phphelp/actions/PHPEclipseShowContextHelp.java @@ -0,0 +1,96 @@ +/********************************************************************** +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 + Klaus Hartlage - www.eclipseproject.de +**********************************************************************/ +package net.sourceforge.phpdt.phphelp.actions; + +import net.sourceforge.phpeclipse.phpeditor.PHPEditor; +import net.sourceforge.phpeclipse.phpeditor.php.PHPWordExtractor; +import org.eclipse.help.IHelp; +import org.eclipse.help.IHelpResource; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.text.BadLocationException; +import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.ITextSelection; +import org.eclipse.jface.text.TextSelection; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.swt.graphics.Point; +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 { + + private IWorkbenchWindow window; + private PHPEditor editor; + + public void dispose() { + } + + public void init(IWorkbenchWindow window) { + this.window = window; + } + + 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()); + 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 static void openContextHelp(String word) { + IHelp help = WorkbenchHelp.getHelpSupport(); + if (help != null) { + IHelpResource helpResource = new PHPFunctionHelpResource(word); + WorkbenchHelp.getHelpSupport().displayHelpResource(helpResource); + } else { + // showMessage(shell, dialogTitle, ActionMessages.getString("Open help not available"), false); //$NON-NLS-1$ + } + } + + 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 ""; + } +} diff --git a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/phphelp/actions/PHPFunctionHelpResource.java b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/phphelp/actions/PHPFunctionHelpResource.java new file mode 100644 index 0000000..7f0249f --- /dev/null +++ b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/phphelp/actions/PHPFunctionHelpResource.java @@ -0,0 +1,35 @@ +/********************************************************************** +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 + Klaus Hartlage - www.eclipseproject.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; + } + + 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 -- 1.7.1