Delete association of htmledit.gif for the PHPUnitEditor
authoraxelcl <axelcl>
Mon, 4 Apr 2005 20:25:38 +0000 (20:25 +0000)
committeraxelcl <axelcl>
Mon, 4 Apr 2005 20:25:38 +0000 (20:25 +0000)
net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPLaunchShortcut.java
net.sourceforge.phpeclipse/build.xml
net.sourceforge.phpeclipse/plugin.properties
net.sourceforge.phpeclipse/plugin.xml
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaConventions.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/util/Util.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/Util.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/PHPFileUtil.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPEclipseBasePreferencePage.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPParserAction.java

index 5a3cafb..53b337f 100644 (file)
@@ -7,6 +7,7 @@ import net.sourceforge.phpdt.debug.ui.PHPDebugUiConstants;
 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;
@@ -26,17 +27,12 @@ import org.eclipse.ui.IEditorPart;
 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)
index 33ee802..981ed8e 100644 (file)
@@ -27,7 +27,7 @@
        </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.">
index 50d4a2f..97a008a 100644 (file)
@@ -8,6 +8,7 @@ elementFiltersName=PHPElement Filters
 phpProblemName=PHP Problem
 transientPHPProblemName=Transient PHP Problem
 phpTaskName=PHP Task
+phpSourceName=PHP Source File
 
 viewCategoryName = PHPeclipse Web Development
 phpEditorTextHoversName=PHP Editor Text Hovers
index 5f7ce85..709ac8f 100644 (file)
                        </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"
index d82a30c..3e6575f 100644 (file)
@@ -169,30 +169,30 @@ public final class JavaConventions {
         *              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.
index 8739ba6..85f7fad 100644 (file)
@@ -30,12 +30,12 @@ public class Util {
 
        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$
                
@@ -329,46 +329,46 @@ public class Util {
         * 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")
index 39b4d39..0cf32b2 100644 (file)
@@ -558,8 +558,8 @@ public class Util {
         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) {
index 7d0e19f..32db3b0 100644 (file)
@@ -99,7 +99,7 @@ public class PHPFileUtil {
    * @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;
   }
 
index 51b3a3c..3262fb0 100644 (file)
@@ -73,7 +73,7 @@ public class PHPEclipseBasePreferencePage extends PreferencePage implements IWor
   }
 
   public boolean performOk() {
-    PHPFileUtil.setExtensins(null); 
+    PHPFileUtil.setExtensions(null); 
     phpParserExtensionsSFE.store();
     xamppStartSFE.store();
     xamppStopSFE.store();
index 02ca163..6197bae 100644 (file)
@@ -1,16 +1,16 @@
 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;
@@ -41,6 +41,7 @@ public class PHPParserAction extends TextEditorAction {
   private static PHPParserAction instance = new PHPParserAction();
 
   protected IFile fileToParse;
+
   protected List fVariables = new ArrayList(100);
 
   /**
@@ -68,35 +69,23 @@ public class PHPParserAction extends TextEditorAction {
 
   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
    */
@@ -115,9 +104,6 @@ public class PHPParserAction extends TextEditorAction {
     return null;
   }
 
-  
-
-  
   protected static void parse(IFile fileToParse) {
     InputStream stream = null;
     char[] charArray;
@@ -130,9 +116,9 @@ public class PHPParserAction extends TextEditorAction {
     } catch (IOException e) {
     } finally {
       try {
-       if (stream!=null) {
+        if (stream != null) {
           stream.close();
-       }
+        }
       } catch (IOException e) {
       }
     }