import net.sourceforge.phpdt.internal.debug.ui.PHPDebugUiMessages;
import net.sourceforge.phpdt.internal.debug.ui.PHPDebugUiPlugin;
import net.sourceforge.phpdt.internal.launching.PHPLaunchConfigurationAttribute;
+import net.sourceforge.phpdt.internal.ui.util.PHPFileUtil;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
public class PHPLaunchShortcut implements ILaunchShortcut {
public PHPLaunchShortcut() {
}
-
+
public void launch(ISelection selection, String mode) {
- if (selection instanceof IStructuredSelection) {
+ if (selection instanceof IStructuredSelection) {
Object firstSelection = ((IStructuredSelection)selection).getFirstElement();
- if (firstSelection instanceof IFile) {
- if (
- ((IFile) firstSelection).getFileExtension().equals("php") ||
- ((IFile) firstSelection).getFileExtension().equals("php3") ||
- ((IFile) firstSelection).getFileExtension().equals("php4") ||
- ((IFile) firstSelection).getFileExtension().equals("php5")
- ) {
+ if (firstSelection instanceof IFile) {
+ if (PHPFileUtil.isPHPFile((IFile) firstSelection)) {
ILaunchConfiguration config = findLaunchConfiguration((IFile)firstSelection, mode);
try {
if (config != null)
</target>
<target name="properties" if="eclipse.running">
- <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
+ <property name="build.compiler" value="net.sourceforge.phpdt.core.JDTCompilerAdapter"/>
</target>
<target name="build.update.jar" depends="init" description="Build the plug-in: net.sourceforge.phpeclipse for an update site.">
phpProblemName=PHP Problem
transientPHPProblemName=Transient PHP Problem
phpTaskName=PHP Task
+phpSourceName=PHP Source File
viewCategoryName = PHPeclipse Web Development
phpEditorTextHoversName=PHP Editor Text Hovers
</objectClass>
</enablement>
</decorator>
-</extension>
+ </extension>
<extension
point="org.eclipse.team.core.fileTypes">
</fileTypes> -->
</extension>
+ <extension point="org.eclipse.core.runtime.contentTypes">
+ <!-- declares a content type for PHP Source files -->
+ <content-type id="phpSource" name="%phpSourceName"
+ base-type="org.eclipse.core.runtime.text"
+ priority="high"
+ file-extensions="php,php3,php4,php5,phtml,inc,module,htm,html,xhtml"/>
+ </extension>
+
<extension
point="net.sourceforge.phpeclipse.phpEditorTextHovers">
<hover
name="%phpEditorName"
default="true"
icon="icons/obj16/phpedit.gif"
- extensions="php,php3,php4,php5,phtml,inc,module"
+ extensions="php,php3,php4,php5,phtml,inc,module,htm,html,xhtml"
contributorClass="net.sourceforge.phpeclipse.phpeditor.CompilationUnitEditorActionContributor"
class="net.sourceforge.phpeclipse.phpeditor.PHPUnitEditor"
symbolicFontName="net.sourceforge.phpdt.ui.editors.textfont"
<!-- <editor
name="%phpEditorName"
default="true"
- icon="icons/obj16/phpedit.gif"
- extensions="php3"
- contributorClass="net.sourceforge.phpeclipse.phpeditor.CompilationUnitEditorActionContributor"
- class="net.sourceforge.phpeclipse.phpeditor.PHPUnitEditor"
- symbolicFontName="net.sourceforge.phpdt.ui.editors.textfont"
- id="net.sourceforge.phpeclipse.PHPUnitEditor">
- </editor>
- <editor
- name="%phpEditorName"
- default="true"
- icon="icons/obj16/phpedit.gif"
- extensions="php4"
- contributorClass="net.sourceforge.phpeclipse.phpeditor.CompilationUnitEditorActionContributor"
- class="net.sourceforge.phpeclipse.phpeditor.PHPUnitEditor"
- symbolicFontName="net.sourceforge.phpdt.ui.editors.textfont"
- id="net.sourceforge.phpeclipse.PHPUnitEditor">
- </editor>
- <editor
- name="%phpEditorName"
- default="true"
- icon="icons/obj16/phpedit.gif"
- extensions="module"
- contributorClass="net.sourceforge.phpeclipse.phpeditor.CompilationUnitEditorActionContributor"
- class="net.sourceforge.phpeclipse.phpeditor.PHPUnitEditor"
- symbolicFontName="net.sourceforge.phpdt.ui.editors.textfont"
- id="net.sourceforge.phpeclipse.PHPUnitEditor">
- </editor>
- <editor
- name="%phpEditorName"
- default="true"
- icon="icons/obj16/phpedit.gif"
- extensions="php5"
- contributorClass="net.sourceforge.phpeclipse.phpeditor.CompilationUnitEditorActionContributor"
- class="net.sourceforge.phpeclipse.phpeditor.PHPUnitEditor"
- symbolicFontName="net.sourceforge.phpdt.ui.editors.textfont"
- id="net.sourceforge.phpeclipse.PHPUnitEditor">
- </editor>
- <editor
- name="%phpEditorName"
- default="true"
- icon="icons/obj16/phpedit.gif"
- extensions="inc"
- contributorClass="net.sourceforge.phpeclipse.phpeditor.CompilationUnitEditorActionContributor"
- class="net.sourceforge.phpeclipse.phpeditor.PHPUnitEditor"
- symbolicFontName="net.sourceforge.phpdt.ui.editors.textfont"
- id="net.sourceforge.phpeclipse.PHPUnitEditor">
- </editor>
- <editor
- name="%phpEditorName"
- default="true"
- icon="icons/obj16/phpedit.gif"
- extensions="phtml"
- contributorClass="net.sourceforge.phpeclipse.phpeditor.CompilationUnitEditorActionContributor"
- class="net.sourceforge.phpeclipse.phpeditor.PHPUnitEditor"
- symbolicFontName="net.sourceforge.phpdt.ui.editors.textfont"
- id="net.sourceforge.phpeclipse.PHPUnitEditor">
- </editor> -->
- <editor
- name="%phpEditorName"
- default="true"
icon="icons/obj16/htmledit.gif"
extensions="htm,html,xhtml"
contributorClass="net.sourceforge.phpeclipse.phpeditor.CompilationUnitEditorActionContributor"
class="net.sourceforge.phpeclipse.phpeditor.PHPUnitEditor"
symbolicFontName="net.sourceforge.phpdt.ui.editors.textfont"
id="net.sourceforge.phpeclipse.PHPUnitEditor">
- </editor>
- <!-- <editor
- name="%phpEditorName"
- default="true"
- icon="icons/obj16/htmledit.gif"
- extensions="html"
- contributorClass="net.sourceforge.phpeclipse.phpeditor.CompilationUnitEditorActionContributor"
- class="net.sourceforge.phpeclipse.phpeditor.PHPUnitEditor"
- symbolicFontName="net.sourceforge.phpdt.ui.editors.textfont"
- id="net.sourceforge.phpeclipse.PHPUnitEditor">
- </editor>
- <editor
- name="%phpEditorName"
- default="true"
- icon="icons/obj16/htmledit.gif"
- extensions="xhtml"
- contributorClass="net.sourceforge.phpeclipse.phpeditor.CompilationUnitEditorActionContributor"
- class="net.sourceforge.phpeclipse.phpeditor.PHPUnitEditor"
- symbolicFontName="net.sourceforge.phpdt.ui.editors.textfont"
- id="net.sourceforge.phpeclipse.PHPUnitEditor">
</editor> -->
<!-- <editor
name="%phpEditorName"
name="%javaDocumentFactory"
point="org.eclipse.core.filebuffers.documentCreation">
<factory
- extensions="php"
+ extensions="php,php3,php4,php5,phtml,inc,module,htm,html,xhtml"
class="net.sourceforge.phpeclipse.phpeditor.JavaDocumentFactory">
</factory>
</extension>
id = "net.sourceforge.phpdt.internal.ui.preferences.SpellingPreferencePage">
</page>
</extension>
- <extension
+ <!-- <extension
point="org.eclipse.ui.editors.documentProviders">
<provider
extensions="php,php3,php4,php5,phtml,inc,module,html,htm,xhtml"
id="net.sourceforge.phpeclipse.phpeditor.PHPDocumentProvider">
</provider>
</extension>
-<!-- <extension
+ <extension
point="org.eclipse.ui.editors.documentProviders">
<provider
extensions="%php3FileExtension"
* object indicating what is wrong with the name
* @since 2.0
*/
- public static IStatus validateClassFileName(String name) {
- if (name == null) {
- return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.classFile.nullName"), null); //$NON-NLS-1$
- }
- if (!net.sourceforge.phpdt.internal.compiler.util.Util.isClassFileName(name)) {
- return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.classFile.notClassFileName"), null); //$NON-NLS-1$
- }
- String identifier;
- int index;
- index = name.lastIndexOf('.');
- if (index == -1) {
- return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.classFile.notClassFileName"), null); //$NON-NLS-1$
- }
- identifier = name.substring(0, index);
- IStatus status = validateIdentifier(identifier);
- if (!status.isOK()) {
- return status;
- }
- status = ResourcesPlugin.getWorkspace().validateName(name, IResource.FILE);
- if (!status.isOK()) {
- return status;
- }
- return JavaModelStatus.VERIFIED_OK;
- }
+// public static IStatus validateClassFileName(String name) {
+// if (name == null) {
+// return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.classFile.nullName"), null); //$NON-NLS-1$
+// }
+// if (!net.sourceforge.phpdt.internal.compiler.util.Util.isClassFileName(name)) {
+// return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.classFile.notClassFileName"), null); //$NON-NLS-1$
+// }
+// String identifier;
+// int index;
+// index = name.lastIndexOf('.');
+// if (index == -1) {
+// return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.classFile.notClassFileName"), null); //$NON-NLS-1$
+// }
+// identifier = name.substring(0, index);
+// IStatus status = validateIdentifier(identifier);
+// if (!status.isOK()) {
+// return status;
+// }
+// status = ResourcesPlugin.getWorkspace().validateName(name, IResource.FILE);
+// if (!status.isOK()) {
+// return status;
+// }
+// return JavaModelStatus.VERIFIED_OK;
+// }
/**
* Validate the given field name.
public static String LINE_SEPARATOR = System.getProperty("line.separator"); //$NON-NLS-1$
public static char[] LINE_SEPARATOR_CHARS = LINE_SEPARATOR.toCharArray();
- public final static char[] SUFFIX_class = ".class".toCharArray(); //$NON-NLS-1$
- public final static char[] SUFFIX_CLASS = ".CLASS".toCharArray(); //$NON-NLS-1$
+// public final static char[] SUFFIX_class = ".class".toCharArray(); //$NON-NLS-1$
+// public final static char[] SUFFIX_CLASS = ".CLASS".toCharArray(); //$NON-NLS-1$
public final static char[] SUFFIX_java = ".java".toCharArray(); //$NON-NLS-1$
public final static char[] SUFFIX_JAVA = ".JAVA".toCharArray(); //$NON-NLS-1$
- public final static char[] SUFFIX_jar = ".jar".toCharArray(); //$NON-NLS-1$
- public final static char[] SUFFIX_JAR = ".JAR".toCharArray(); //$NON-NLS-1$
+// public final static char[] SUFFIX_jar = ".jar".toCharArray(); //$NON-NLS-1$
+// public final static char[] SUFFIX_JAR = ".JAR".toCharArray(); //$NON-NLS-1$
public final static char[] SUFFIX_zip = ".zip".toCharArray(); //$NON-NLS-1$
public final static char[] SUFFIX_ZIP = ".ZIP".toCharArray(); //$NON-NLS-1$
* Returns true iff str.toLowerCase().endsWith(".jar") || str.toLowerCase().endsWith(".zip")
* implementation is not creating extra strings.
*/
- public final static boolean isArchiveFileName(String name) {
- int nameLength = name == null ? 0 : name.length();
- int suffixLength = SUFFIX_JAR.length;
- if (nameLength < suffixLength) return false;
-
- // try to match as JAR file
- for (int i = 0; i < suffixLength; i++) {
- char c = name.charAt(nameLength - i - 1);
- int suffixIndex = suffixLength - i - 1;
- if (c != SUFFIX_jar[suffixIndex] && c != SUFFIX_JAR[suffixIndex]) {
-
- // try to match as ZIP file
- suffixLength = SUFFIX_ZIP.length;
- if (nameLength < suffixLength) return false;
- for (int j = 0; j < suffixLength; j++) {
- c = name.charAt(nameLength - j - 1);
- suffixIndex = suffixLength - j - 1;
- if (c != SUFFIX_zip[suffixIndex] && c != SUFFIX_ZIP[suffixIndex]) return false;
- }
- return true;
- }
- }
- return true;
- }
+// public final static boolean isArchiveFileName(String name) {
+// int nameLength = name == null ? 0 : name.length();
+// int suffixLength = SUFFIX_JAR.length;
+// if (nameLength < suffixLength) return false;
+//
+// // try to match as JAR file
+// for (int i = 0; i < suffixLength; i++) {
+// char c = name.charAt(nameLength - i - 1);
+// int suffixIndex = suffixLength - i - 1;
+// if (c != SUFFIX_jar[suffixIndex] && c != SUFFIX_JAR[suffixIndex]) {
+//
+// // try to match as ZIP file
+// suffixLength = SUFFIX_ZIP.length;
+// if (nameLength < suffixLength) return false;
+// for (int j = 0; j < suffixLength; j++) {
+// c = name.charAt(nameLength - j - 1);
+// suffixIndex = suffixLength - j - 1;
+// if (c != SUFFIX_zip[suffixIndex] && c != SUFFIX_ZIP[suffixIndex]) return false;
+// }
+// return true;
+// }
+// }
+// return true;
+// }
/**
* Returns true iff str.toLowerCase().endsWith(".class")
* implementation is not creating extra strings.
*/
- public final static boolean isClassFileName(String name) {
- int nameLength = name == null ? 0 : name.length();
- int suffixLength = SUFFIX_CLASS.length;
- if (nameLength < suffixLength) return false;
-
- for (int i = 0; i < suffixLength; i++) {
- char c = name.charAt(nameLength - i - 1);
- int suffixIndex = suffixLength - i - 1;
- if (c != SUFFIX_class[suffixIndex] && c != SUFFIX_CLASS[suffixIndex]) return false;
- }
- return true;
- }
+// public final static boolean isClassFileName(String name) {
+// int nameLength = name == null ? 0 : name.length();
+// int suffixLength = SUFFIX_CLASS.length;
+// if (nameLength < suffixLength) return false;
+//
+// for (int i = 0; i < suffixLength; i++) {
+// char c = name.charAt(nameLength - i - 1);
+// int suffixIndex = suffixLength - i - 1;
+// if (c != SUFFIX_class[suffixIndex] && c != SUFFIX_CLASS[suffixIndex]) return false;
+// }
+// return true;
+// }
/**
* Returns true iff str.toLowerCase().endsWith(".java")
IResource member = members[i];
if (member.getType() == IResource.FOLDER) {
return findFirstClassFile((IFolder) member);
- } else if (net.sourceforge.phpdt.internal.compiler.util.Util.isClassFileName(member.getName())) {
- return (IFile) member;
+// } else if (net.sourceforge.phpdt.internal.compiler.util.Util.isClassFileName(member.getName())) {
+// return (IFile) member;
}
}
} catch (CoreException e) {
* @param php_extensions
* The PHP extensions to set.
*/
- public static void setExtensins(String[] php_extensions) {
+ public static void setExtensions(String[] php_extensions) {
PHP_EXTENSIONS = php_extensions;
}
}
public boolean performOk() {
- PHPFileUtil.setExtensins(null);
+ PHPFileUtil.setExtensions(null);
phpParserExtensionsSFE.store();
xamppStartSFE.store();
xamppStopSFE.store();
package net.sourceforge.phpeclipse.phpeditor;
/**********************************************************************
-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
+ **********************************************************************/
import java.io.BufferedInputStream;
import java.io.IOException;
private static PHPParserAction instance = new PHPParserAction();
protected IFile fileToParse;
+
protected List fVariables = new ArrayList(100);
/**
public static void parseFile(IFile fileToParse) {
boolean phpFlag = false;
-// try {
+ // try {
- if (fileToParse == null) {
- // TODO should never happen => should throw an exception
- System.err.println("Error : no file in the editor");
+ if (fileToParse == null) {
+ // TODO should never happen => should throw an exception
+ System.err.println("Error : no file in the editor");
- return;
- }
- // TODO use isPHPFile()
- String name = fileToParse.getName(); //.toLowerCase();
-// for (int i = 0; i < EXTENSIONS.length; i++) {
-// if (name.endsWith(EXTENSIONS[i])) {
-// if (PHPFileUtil.isPHPFileName(name)) {
-// phpFlag = true; // php file extension
-// break;
-// }
-// }
-// if (phpFlag) {
- if (PHPFileUtil.isPHPFileName(name)) {
- IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
-// if (store.getString(PHPeclipsePlugin.PHP_PARSER_DEFAULT).equals(PHPeclipsePlugin.PHP_INTERNAL_PARSER)) {
-// PHPBuilder.removeProblemsAndTasksFor(fileToParse);
-// parse(fileToParse); //, iStream);
-// } else {
- ExternalPHPParser parser = new ExternalPHPParser(fileToParse);
- parser.phpExternalParse();
-// }
- }
+ return;
+ }
+ String name = fileToParse.getName(); //.toLowerCase();
+
+ if (PHPFileUtil.isPHPFileName(name)) {
+ IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
+ ExternalPHPParser parser = new ExternalPHPParser(fileToParse);
+ parser.phpExternalParse();
+ }
}
+
/**
* Finds the file that's currently opened in the PHP Text Editor
*/
return null;
}
-
-
-
protected static void parse(IFile fileToParse) {
InputStream stream = null;
char[] charArray;
} catch (IOException e) {
} finally {
try {
- if (stream!=null) {
+ if (stream != null) {
stream.close();
- }
+ }
} catch (IOException e) {
}
}