PHP highlighting colors could now be managed by the new PreferencePage
authorkhartlage <khartlage>
Sun, 6 Apr 2003 20:39:22 +0000 (20:39 +0000)
committerkhartlage <khartlage>
Sun, 6 Apr 2003 20:39:22 +0000 (20:39 +0000)
18 files changed:
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/PHPUIMessages.properties
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/EditTemplateDialog.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/PHPEditorPreferencePage.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/AbstractJavaScanner.java [moved from net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/AbstractJavaScanner.java with 99% similarity]
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/phpdoc/PHPDocCodeScanner.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/PreferenceConstants.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/IJavaColorConstants.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/JavaTextTools.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/SingleTokenPHPScanner.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/IPreferenceConstants.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPSyntaxEditorPreferencePage.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPEditor.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPUnitEditor.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPCodeScanner.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPType.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/util/HTMLColorProvider.java [deleted file]
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/util/PHPColorProvider.java

index 7167fc6..71fee91 100644 (file)
@@ -243,6 +243,10 @@ PHPEditorPreferencePage.font=Text Font:
 PHPEditorPreferencePage.multiLineComment=Multi-line comment
 PHPEditorPreferencePage.singleLineComment=Single-line comment
 PHPEditorPreferencePage.keywords=Keywords
+PHPEditorPreferencePage.functionNames=Predefined function names
+PHPEditorPreferencePage.variables=Variables
+PHPEditorPreferencePage.constants=Constants
+PHPEditorPreferencePage.types=Types
 PHPEditorPreferencePage.strings=Strings
 PHPEditorPreferencePage.others=Others
 PHPEditorPreferencePage.phpDocKeywords=PHPDoc keywords
index cf43406..cf895cd 100644 (file)
@@ -102,7 +102,7 @@ public class EditTemplateDialog extends StatusDialog {
                        ContentAssistant assistant= new ContentAssistant();
                        assistant.setContentAssistProcessor(fProcessor, IDocument.DEFAULT_CONTENT_TYPE);
                                // Register the same processor for strings and single line comments to get code completion at the start of those partitions.
-//                     assistant.setContentAssistProcessor(fProcessor, JavaPartitionScanner.JAVA_STRING);
+//                     assistant.setContentAssistProcessor(fProcessor, JavaPartitionScanner.PHP_STRING);
 //                     assistant.setContentAssistProcessor(fProcessor, JavaPartitionScanner.JAVA_SINGLE_LINE_COMMENT);
 //                     
 //                     assistant.setContentAssistProcessor(fProcessor, JavaPartitionScanner.JAVA_DOC);
index 191f4d3..d76acf9 100644 (file)
@@ -87,32 +87,44 @@ public class PHPEditorPreferencePage extends PreferencePage implements IWorkbenc
 
                new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, PreferenceConstants.EDITOR_TAB_WIDTH),
                
-//             new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_COLOR),
-//             new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_BOLD),
-//             
-//             new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_COLOR),
-//             new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_BOLD),
-//             
-//             new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVA_KEYWORD_COLOR),
-//             new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVA_KEYWORD_BOLD),
-//                             
-//             new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_STRING_COLOR),
-//             new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_STRING_BOLD),
-//             
-//             new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVA_DEFAULT_COLOR),
-//             new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVA_DEFAULT_BOLD),
-//
-//             new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVADOC_KEYWORD_COLOR),
-//             new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVADOC_KEYWORD_BOLD),
-//             
-//             new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVADOC_TAG_BOLD),
-//             new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVADOC_TAG_BOLD),
-//
-//             new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVADOC_LINKS_COLOR),
-//             new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVADOC_LINKS_BOLD),
-//             
-//             new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVADOC_DEFAULT_COLOR),
-//             new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVADOC_DEFAULT_BOLD),
+               new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_COLOR),
+               new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_BOLD),
+               
+               new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_COLOR),
+               new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_BOLD),
+               
+               new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVA_KEYWORD_COLOR),
+               new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVA_KEYWORD_BOLD),
+
+    new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_PHP_FUNCTIONNAME_COLOR),
+    new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_PHP_FUNCTIONNAME_BOLD),
+
+    new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_PHP_VARIABLE_COLOR),
+    new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_PHP_VARIABLE_BOLD),
+
+    new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_PHP_CONSTANT_COLOR),
+    new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_PHP_CONSTANT_BOLD),
+
+    new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_PHP_TYPE_COLOR),
+    new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_PHP_TYPE_BOLD),
+                               
+               new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_STRING_COLOR),
+               new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_STRING_BOLD),
+               
+               new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVA_DEFAULT_COLOR),
+               new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVA_DEFAULT_BOLD),
+
+               new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVADOC_KEYWORD_COLOR),
+               new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVADOC_KEYWORD_BOLD),
+               
+               new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVADOC_TAG_BOLD),
+               new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVADOC_TAG_BOLD),
+
+               new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVADOC_LINKS_COLOR),
+               new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVADOC_LINKS_BOLD),
+               
+               new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVADOC_DEFAULT_COLOR),
+               new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVADOC_DEFAULT_BOLD),
                                
                new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR),
                new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_MATCHING_BRACKETS),
@@ -207,17 +219,21 @@ public class PHPEditorPreferencePage extends PreferencePage implements IWorkbenc
                new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_ALT_SHIFT_HOVER),
        };
        
-//     private final String[][] fSyntaxColorListModel= new String[][] {
-//             { PHPUIMessages.getString("PHPEditorPreferencePage.multiLineComment"), PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_COLOR }, //$NON-NLS-1$
-//             { PHPUIMessages.getString("PHPEditorPreferencePage.singleLineComment"), PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_COLOR }, //$NON-NLS-1$
-//             { PHPUIMessages.getString("PHPEditorPreferencePage.keywords"), PreferenceConstants.EDITOR_JAVA_KEYWORD_COLOR }, //$NON-NLS-1$
-//             { PHPUIMessages.getString("PHPEditorPreferencePage.strings"), PreferenceConstants.EDITOR_STRING_COLOR }, //$NON-NLS-1$
-//             { PHPUIMessages.getString("PHPEditorPreferencePage.others"), PreferenceConstants.EDITOR_JAVA_DEFAULT_COLOR }, //$NON-NLS-1$
-//             { PHPUIMessages.getString("PHPEditorPreferencePage.phpDocKeywords"), PreferenceConstants.EDITOR_JAVADOC_KEYWORD_COLOR }, //$NON-NLS-1$
-//             { PHPUIMessages.getString("PHPEditorPreferencePage.phpDocHtmlTags"), PreferenceConstants.EDITOR_JAVADOC_TAG_BOLD }, //$NON-NLS-1$
-//             { PHPUIMessages.getString("PHPEditorPreferencePage.phpDocLinks"), PreferenceConstants.EDITOR_JAVADOC_LINKS_COLOR }, //$NON-NLS-1$
-//             { PHPUIMessages.getString("PHPEditorPreferencePage.phpDocOthers"), PreferenceConstants.EDITOR_JAVADOC_DEFAULT_COLOR } //$NON-NLS-1$
-//     };
+       private final String[][] fSyntaxColorListModel= new String[][] {
+               { PHPUIMessages.getString("PHPEditorPreferencePage.multiLineComment"), PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_COLOR }, //$NON-NLS-1$
+               { PHPUIMessages.getString("PHPEditorPreferencePage.singleLineComment"), PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_COLOR }, //$NON-NLS-1$
+               { PHPUIMessages.getString("PHPEditorPreferencePage.keywords"), PreferenceConstants.EDITOR_JAVA_KEYWORD_COLOR }, //$NON-NLS-1$
+    { PHPUIMessages.getString("PHPEditorPreferencePage.functionNames"), PreferenceConstants.EDITOR_PHP_FUNCTIONNAME_COLOR }, //$NON-NLS-1$
+    { PHPUIMessages.getString("PHPEditorPreferencePage.variables"), PreferenceConstants.EDITOR_PHP_VARIABLE_COLOR }, //$NON-NLS-1$
+    { PHPUIMessages.getString("PHPEditorPreferencePage.constants"), PreferenceConstants.EDITOR_PHP_CONSTANT_COLOR }, //$NON-NLS-1$
+    { PHPUIMessages.getString("PHPEditorPreferencePage.types"), PreferenceConstants.EDITOR_PHP_TYPE_COLOR }, //$NON-NLS-1$
+               { PHPUIMessages.getString("PHPEditorPreferencePage.strings"), PreferenceConstants.EDITOR_STRING_COLOR }, //$NON-NLS-1$
+               { PHPUIMessages.getString("PHPEditorPreferencePage.others"), PreferenceConstants.EDITOR_JAVA_DEFAULT_COLOR }, //$NON-NLS-1$
+               { PHPUIMessages.getString("PHPEditorPreferencePage.phpDocKeywords"), PreferenceConstants.EDITOR_JAVADOC_KEYWORD_COLOR }, //$NON-NLS-1$
+               { PHPUIMessages.getString("PHPEditorPreferencePage.phpDocHtmlTags"), PreferenceConstants.EDITOR_JAVADOC_TAG_BOLD }, //$NON-NLS-1$
+               { PHPUIMessages.getString("PHPEditorPreferencePage.phpDocLinks"), PreferenceConstants.EDITOR_JAVADOC_LINKS_COLOR }, //$NON-NLS-1$
+               { PHPUIMessages.getString("PHPEditorPreferencePage.phpDocOthers"), PreferenceConstants.EDITOR_JAVADOC_DEFAULT_COLOR } //$NON-NLS-1$
+       };
        
        private final String[][] fAppearanceColorListModel= new String[][] {
                {PHPUIMessages.getString("PHPEditorPreferencePage.lineNumberForegroundColor"), PreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR}, //$NON-NLS-1$
@@ -321,10 +337,10 @@ public class PHPEditorPreferencePage extends PreferencePage implements IWorkbenc
 
        private void handleSyntaxColorListSelection() { 
                int i= fSyntaxColorList.getSelectionIndex();
-//             String key= fSyntaxColorListModel[i][1];
-//             RGB rgb= PreferenceConverter.getColor(fOverlayStore, key);
-//             fSyntaxForegroundColorEditor.setColorValue(rgb);                
-//             fBoldCheckBox.setSelection(fOverlayStore.getBoolean(key + BOLD));
+               String key= fSyntaxColorListModel[i][1];
+               RGB rgb= PreferenceConverter.getColor(fOverlayStore, key);
+               fSyntaxForegroundColorEditor.setColorValue(rgb);                
+               fBoldCheckBox.setSelection(fOverlayStore.getBoolean(key + BOLD));
        }
 
        private void handleAppearanceColorListSelection() {     
@@ -448,9 +464,9 @@ public class PHPEditorPreferencePage extends PreferencePage implements IWorkbenc
                        }
                        public void widgetSelected(SelectionEvent e) {
                                int i= fSyntaxColorList.getSelectionIndex();
-//                             String key= fSyntaxColorListModel[i][1];
-//                             
-//                             PreferenceConverter.setValue(fOverlayStore, key, fSyntaxForegroundColorEditor.getColorValue());
+                               String key= fSyntaxColorListModel[i][1];
+                               
+                               PreferenceConverter.setValue(fOverlayStore, key, fSyntaxForegroundColorEditor.getColorValue());
                        }
                });
 
@@ -469,8 +485,8 @@ public class PHPEditorPreferencePage extends PreferencePage implements IWorkbenc
                        }
                        public void widgetSelected(SelectionEvent e) {
                                int i= fSyntaxColorList.getSelectionIndex();
-//                             String key= fSyntaxColorListModel[i][1];
-//                             fOverlayStore.setValue(key + BOLD, fBoldCheckBox.getSelection());
+                               String key= fSyntaxColorListModel[i][1];
+                               fOverlayStore.setValue(key + BOLD, fBoldCheckBox.getSelection());
                        }
                });
                                
@@ -968,8 +984,8 @@ public class PHPEditorPreferencePage extends PreferencePage implements IWorkbenc
                
                initializeFields();
                
-//             for (int i= 0; i < fSyntaxColorListModel.length; i++)
-//                     fSyntaxColorList.add(fSyntaxColorListModel[i][0]);
+               for (int i= 0; i < fSyntaxColorListModel.length; i++)
+                       fSyntaxColorList.add(fSyntaxColorListModel[i][0]);
                        
                fSyntaxColorList.getDisplay().asyncExec(new Runnable() {
                        public void run() {
index 9b0ec7f..5820ca6 100644 (file)
@@ -14,18 +14,17 @@ package net.sourceforge.phpdt.internal.ui.text.phpdoc;
 import java.util.ArrayList;
 import java.util.List;
 
-import net.sourceforge.phpdt.internal.ui.text.JavaColorManager;
-import net.sourceforge.phpeclipse.phpeditor.util.PHPColorProvider;
+import net.sourceforge.phpdt.internal.ui.text.AbstractJavaScanner;
+import net.sourceforge.phpdt.ui.text.IColorManager;
+import net.sourceforge.phpdt.ui.text.IJavaColorConstants;
 import net.sourceforge.phpeclipse.phpeditor.util.PHPWhitespaceDetector;
 
 import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.jface.text.BadLocationException;
 import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.TextAttribute;
 import org.eclipse.jface.text.rules.ICharacterScanner;
 import org.eclipse.jface.text.rules.IToken;
 import org.eclipse.jface.text.rules.IWordDetector;
-import org.eclipse.jface.text.rules.RuleBasedScanner;
 import org.eclipse.jface.text.rules.SingleLineRule;
 import org.eclipse.jface.text.rules.Token;
 import org.eclipse.jface.text.rules.WhitespaceRule;
@@ -37,166 +36,158 @@ import org.eclipse.jface.text.rules.WordRule;
 /**
  * A rule based PHPDoc scanner.
  */
-public final class PHPDocCodeScanner extends RuleBasedScanner {
-               
-               
-       /**
-        * A key word detector.
-        */
-       static class PHPDocKeywordDetector implements IWordDetector {
-
-               /**
-                * @see IWordDetector#isWordStart
-                */
-               public boolean isWordStart(char c) {
-                       return (c == '@');
-               }
-
-               /**
-                * @see IWordDetector#isWordPart
-                */
-               public boolean isWordPart(char c) {
-                       return Character.isLetter(c);
-               }
-       };
+public final class PHPDocCodeScanner extends AbstractJavaScanner {
+               
+               
+  /**
+   * A key word detector.
+   */
+  static class JavaDocKeywordDetector implements IWordDetector {
+
+    /**
+     * @see IWordDetector#isWordStart
+     */
+    public boolean isWordStart(char c) {
+      return (c == '@');
+    }
+
+    /**
+     * @see IWordDetector#isWordPart
+     */
+    public boolean isWordPart(char c) {
+      return Character.isLetter(c);
+    }
+  };
        
        
-       /**
-        * Detector for HTML comment delimiters.
-        */
-       static class HTMLCommentDetector implements IWordDetector {
-
-               /**
-                * @see IWordDetector#isWordStart
-                */
-               public boolean isWordStart(char c) {
-                       return (c == '<' || c == '-');
-               }
-
-               /**
-                * @see IWordDetector#isWordPart
-                */
-               public boolean isWordPart(char c) {
-                       return (c == '-' || c == '!' || c == '>');
-               }
-       };
+  /**
+   * Detector for HTML comment delimiters.
+   */
+  static class HTMLCommentDetector implements IWordDetector {
+
+    /**
+     * @see IWordDetector#isWordStart
+     */
+    public boolean isWordStart(char c) {
+      return (c == '<' || c == '-');
+    }
+
+    /**
+     * @see IWordDetector#isWordPart
+     */
+    public boolean isWordPart(char c) {
+      return (c == '-' || c == '!' || c == '>');
+    }
+  };
        
-       class TagRule extends SingleLineRule {
-               
-               /*
-                * @see SingleLineRule
-                */
-               public TagRule(IToken token) {
-                       super("<", ">", token, (char) 0); //$NON-NLS-2$ //$NON-NLS-1$
-               }
-               
-               /*
-                * @see SingleLineRule 
-                */
-               public TagRule(IToken token, char escapeCharacter) {
-                       super("<", ">", token, escapeCharacter); //$NON-NLS-2$ //$NON-NLS-1$
-               }
-               
-               private IToken checkForWhitespace(ICharacterScanner scanner) {
+  class TagRule extends SingleLineRule {
+               
+    /*
+     * @see SingleLineRule
+     */
+    public TagRule(IToken token) {
+      super("<", ">", token, (char) 0); //$NON-NLS-2$ //$NON-NLS-1$
+    }
+               
+    /*
+     * @see SingleLineRule 
+     */
+    public TagRule(IToken token, char escapeCharacter) {
+      super("<", ">", token, escapeCharacter); //$NON-NLS-2$ //$NON-NLS-1$
+    }
+               
+    private IToken checkForWhitespace(ICharacterScanner scanner) {
                        
-                       try {
+      try {
                                
-                               char c= getDocument().getChar(getTokenOffset() + 1);
-                               if (!Character.isWhitespace(c)) 
-                                       return fToken;
+        char c= getDocument().getChar(getTokenOffset() + 1);
+        if (!Character.isWhitespace(c)) 
+          return fToken;
                                        
-                       } catch (BadLocationException x) {
-                       }
+      } catch (BadLocationException x) {
+      }
                        
-                       return Token.UNDEFINED;
-               }
+      return Token.UNDEFINED;
+    }
                                
-               /*
-                * @see PatternRule#evaluate(ICharacterScanner)
-                */
-               public IToken evaluate(ICharacterScanner scanner) {
-                       IToken result= super.evaluate(scanner);
-                       if (result == fToken)
-                               return checkForWhitespace(scanner);
-                       return result;
-               }
-       };
+    /*
+     * @see PatternRule#evaluate(ICharacterScanner)
+     */
+    public IToken evaluate(ICharacterScanner scanner) {
+      IToken result= super.evaluate(scanner);
+      if (result == fToken)
+        return checkForWhitespace(scanner);
+      return result;
+    }
+  };
        
        
-       private static String[] fgKeywords= {"@author", "@deprecated", "@exception", "@param", "@return", "@see", "@serial", "@serialData", "@serialField", "@since", "@throws", "@version"}; //$NON-NLS-12$ //$NON-NLS-11$ //$NON-NLS-10$ //$NON-NLS-7$ //$NON-NLS-9$ //$NON-NLS-8$ //$NON-NLS-6$ //$NON-NLS-5$ //$NON-NLS-4$ //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$
+  private static String[] fgKeywords= {"@author", "@deprecated", "@exception", "@param", "@return", "@see", "@serial", "@serialData", "@serialField", "@since", "@throws", "@version"}; //$NON-NLS-12$ //$NON-NLS-11$ //$NON-NLS-10$ //$NON-NLS-7$ //$NON-NLS-9$ //$NON-NLS-8$ //$NON-NLS-6$ //$NON-NLS-5$ //$NON-NLS-4$ //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$
        
-//     private static String[] fgTokenProperties= {
-//             IJavaColorConstants.JAVADOC_KEYWORD,
-//             IJavaColorConstants.JAVADOC_TAG,
-//             IJavaColorConstants.JAVADOC_LINK,
-//             IJavaColorConstants.JAVADOC_DEFAULT
-//     };                      
+  private static String[] fgTokenProperties= {
+    IJavaColorConstants.PHPDOC_KEYWORD,
+    IJavaColorConstants.PHPDOC_TAG,
+    IJavaColorConstants.PHPDOC_LINK,
+    IJavaColorConstants.PHPDOC_DEFAULT
+  };                   
        
        
-       public PHPDocCodeScanner(JavaColorManager provider, IPreferenceStore store) {
-       //      super(manager, store);
-       //      initialize();  
-      createRules(provider);
-       }
+  public PHPDocCodeScanner(IColorManager manager, IPreferenceStore store) {
+    super(manager, store);
+    initialize();
+  }
        
-       public IDocument getDocument() {
-               return fDocument;
-       }
+  public IDocument getDocument() {
+    return fDocument;
+  }
        
-       /*
-        * @see AbstractJavaScanner#getTokenProperties()
-        */
-//     protected String[] getTokenProperties() {
-//             return fgTokenProperties;
-//     }
+  /*
+   * @see AbstractJavaScanner#getTokenProperties()
+   */
+  protected String[] getTokenProperties() {
+    return fgTokenProperties;
+  }
 
-       /* create the rules for PHPDoc
-        */
-       protected List createRules(JavaColorManager provider) {
+  /*
+   * @see AbstractJavaScanner#createRules()
+   */
+  protected List createRules() {
                
-               List list= new ArrayList();
+    List list= new ArrayList();
                
+    // Add rule for tags.
+    Token token= getToken(IJavaColorConstants.PHPDOC_TAG);
+    list.add(new TagRule(token));
                
-//    IToken type = new Token(new TextAttribute(provider.getColor(PHPColorProvider.FUNCTION_NAME)));
-//    IToken string = new Token(new TextAttribute(provider.getColor(PHPColorProvider.STRING)));
-//    IToken comment = new Token(new TextAttribute(provider.getColor(PHPColorProvider.SINGLE_LINE_COMMENT)));
-//    IToken multi_comment = new Token(new TextAttribute(provider.getColor(PHPColorProvider.MULTI_LINE_COMMENT)));
-//    IToken other = new Token(new TextAttribute(provider.getColor(PHPColorProvider.DEFAULT)));
-    
-               // Add rule for tags.
-       //      Token token= getToken(IJavaColorConstants.JAVADOC_TAG);
-    Token token = new Token(new TextAttribute(provider.getColor(PHPColorProvider.PHPDOC_TAG)));
-               list.add(new TagRule(token));
                
+    // Add rule for HTML comments
+    WordRule wordRule= new WordRule(new HTMLCommentDetector(), token);
+    wordRule.addWord("<!--", token); //$NON-NLS-1$
+    wordRule.addWord("--!>", token); //$NON-NLS-1$
+    list.add(wordRule);
                
-               // Add rule for HTML comments
-               WordRule wordRule= new WordRule(new HTMLCommentDetector(), token);
-               wordRule.addWord("<!--", token); //$NON-NLS-1$
-               wordRule.addWord("--!>", token); //$NON-NLS-1$
-               list.add(wordRule);
                
+    // Add rule for links.
+    token= getToken(IJavaColorConstants.PHPDOC_LINK);
+    list.add(new SingleLineRule("{@link", "}", token)); //$NON-NLS-2$ //$NON-NLS-1$
                
-               // Add rule for links.
-               token= new Token(new TextAttribute(provider.getColor(PHPColorProvider.PHPDOC_LINK)));
-               list.add(new SingleLineRule("{@link", "}", token)); //$NON-NLS-2$ //$NON-NLS-1$
                
+    // Add generic whitespace rule.
+    list.add(new WhitespaceRule(new PHPWhitespaceDetector()));
                
-               // Add generic whitespace rule.
-               list.add(new WhitespaceRule(new PHPWhitespaceDetector()));
                
+    // Add word rule for keywords.
+    token= getToken(IJavaColorConstants.PHPDOC_DEFAULT);
+    wordRule= new WordRule(new JavaDocKeywordDetector(), token);
                
-               // Add word rule for keywords.
-               token= new Token(new TextAttribute(provider.getColor(PHPColorProvider.PHPDOC_DEFAULT)));
-               wordRule= new WordRule(new PHPDocKeywordDetector(), token);
+    token= getToken(IJavaColorConstants.PHPDOC_KEYWORD);
+    for (int i= 0; i < fgKeywords.length; i++)
+      wordRule.addWord(fgKeywords[i], token);
+    list.add(wordRule);
                
-               token= new Token(new TextAttribute(provider.getColor(PHPColorProvider.PHPDOC_KEYWORD)));
-               for (int i= 0; i < fgKeywords.length; i++)
-                       wordRule.addWord(fgKeywords[i], token);
-               list.add(wordRule);
-               
-               setDefaultReturnToken( new Token(new TextAttribute(provider.getColor(PHPColorProvider.PHPDOC_DEFAULT))) );
-               return list;
-       }
+    setDefaultReturnToken(getToken(IJavaColorConstants.PHPDOC_DEFAULT));
+    return list;
+  }
 }
 
 
index f978141..e5c035f 100644 (file)
@@ -24,7 +24,7 @@ import org.eclipse.ui.texteditor.WorkbenchChainedTextFontFieldEditor;
 
 //import org.phpeclipse.phpdt.core.IClasspathEntry;
 //
-//import org.phpeclipse.phpdt.ui.text.IJavaColorConstants;
+import net.sourceforge.phpdt.ui.text.IJavaColorConstants;
 //
 //import org.phpeclipse.phpdt.internal.ui.JavaPlugin;
 //import org.phpeclipse.phpdt.internal.ui.preferences.NewJavaProjectPreferencePage;
@@ -883,187 +883,271 @@ public class PreferenceConstants {
         */
        public static final String EDITOR_BOLD_SUFFIX= "_bold"; //$NON-NLS-1$
 
-//     /**
-//      * A named preference that holds the color used to render multi line comments.
-//      * <p>
-//      * Value is of type <code>String</code>. A RGB color value encoded as a string
-//      * using class <code>PreferenceConverter</code>
-//      * </p>
-//      * 
-//      * @see org.eclipse.jface.resource.StringConverter
-//      * @see org.eclipse.jface.preference.PreferenceConverter
-//      */
-//     public final static String EDITOR_MULTI_LINE_COMMENT_COLOR= IJavaColorConstants.JAVA_MULTI_LINE_COMMENT;
-//
-//     /**
-//      * A named preference that controls whether multi line comments are rendered in bold.
-//      * <p>
-//      * Value is of type <code>Boolean</code>. If <code>true</code> multi line comments are rendered
-//      * in bold. If <code>false</code> the are rendered using no font style attribute.
-//      * </p>
-//      */
-//     public final static String EDITOR_MULTI_LINE_COMMENT_BOLD= IJavaColorConstants.JAVA_MULTI_LINE_COMMENT + EDITOR_BOLD_SUFFIX; 
-//
-//     /**
-//      * A named preference that holds the color used to render single line comments.
-//      * <p>
-//      * Value is of type <code>String</code>. A RGB color value encoded as a string
-//      * using class <code>PreferenceConverter</code>
-//      * </p>
-//      * 
-//      * @see org.eclipse.jface.resource.StringConverter
-//      * @see org.eclipse.jface.preference.PreferenceConverter
-//      */
-//     public final static String EDITOR_SINGLE_LINE_COMMENT_COLOR= IJavaColorConstants.JAVA_SINGLE_LINE_COMMENT;
-//
-//     /**
-//      * A named preference that controls whether sinle line comments are rendered in bold.
-//      * <p>
-//      * Value is of type <code>Boolean</code>. If <code>true</code> single line comments are rendered
-//      * in bold. If <code>false</code> the are rendered using no font style attribute.
-//      * </p>
-//      */
-//     public final static String EDITOR_SINGLE_LINE_COMMENT_BOLD= IJavaColorConstants.JAVA_SINGLE_LINE_COMMENT + EDITOR_BOLD_SUFFIX; 
-//
-//     /**
-//      * A named preference that holds the color used to render php keywords.
-//      * <p>
-//      * Value is of type <code>String</code>. A RGB color value encoded as a string
-//      * using class <code>PreferenceConverter</code>
-//      * </p>
-//      * 
-//      * @see org.eclipse.jface.resource.StringConverter
-//      * @see org.eclipse.jface.preference.PreferenceConverter
-//      */
-//     public final static String EDITOR_JAVA_KEYWORD_COLOR= IJavaColorConstants.JAVA_KEYWORD;
-//
-//     /**
-//      * A named preference that controls whether keywords are rendered in bold.
-//      * <p>
-//      * Value is of type <code>Boolean</code>.
-//      * </p>
-//      */
-//     public final static String EDITOR_JAVA_KEYWORD_BOLD= IJavaColorConstants.JAVA_KEYWORD + EDITOR_BOLD_SUFFIX;
-//
-//     /**
-//      * A named preference that holds the color used to render string constants.
-//      * <p>
-//      * Value is of type <code>String</code>. A RGB color value encoded as a string
-//      * using class <code>PreferenceConverter</code>
-//      * </p>
-//      * 
-//      * @see org.eclipse.jface.resource.StringConverter
-//      * @see org.eclipse.jface.preference.PreferenceConverter
-//      */
-//     public final static String EDITOR_STRING_COLOR= IJavaColorConstants.JAVA_STRING;
-//
-//     /**
-//      * A named preference that controls whether string constants are rendered in bold.
-//      * <p>
-//      * Value is of type <code>Boolean</code>.
-//      * </p>
-//      */
-//     public final static String EDITOR_STRING_BOLD= IJavaColorConstants.JAVA_STRING + EDITOR_BOLD_SUFFIX;
-//
-//     /**
-//      * A named preference that holds the color used to render php default text.
-//      * <p>
-//      * Value is of type <code>String</code>. A RGB color value encoded as a string
-//      * using class <code>PreferenceConverter</code>
-//      * </p>
-//      * 
-//      * @see org.eclipse.jface.resource.StringConverter
-//      * @see org.eclipse.jface.preference.PreferenceConverter
-//      */
-//     public final static String EDITOR_JAVA_DEFAULT_COLOR= IJavaColorConstants.JAVA_DEFAULT;
-//
-//     /**
-//      * A named preference that controls whether Java default text is rendered in bold.
-//      * <p>
-//      * Value is of type <code>Boolean</code>.
-//      * </p>
-//      */
-//     public final static String EDITOR_JAVA_DEFAULT_BOLD= IJavaColorConstants.JAVA_DEFAULT + EDITOR_BOLD_SUFFIX;
-//
-//     /**
-//      * A named preference that holds the color used to render phpdoc keywords.
-//      * <p>
-//      * Value is of type <code>String</code>. A RGB color value encoded as a string
-//      * using class <code>PreferenceConverter</code>
-//      * </p>
-//      * 
-//      * @see org.eclipse.jface.resource.StringConverter
-//      * @see org.eclipse.jface.preference.PreferenceConverter
-//      */
-//     public final static String EDITOR_JAVADOC_KEYWORD_COLOR= IJavaColorConstants.JAVADOC_KEYWORD;
-//
-//     /**
-//      * A named preference that controls whether phpdoc keywords are rendered in bold.
-//      * <p>
-//      * Value is of type <code>Boolean</code>.
-//      * </p>
-//      */
-//     public final static String EDITOR_JAVADOC_KEYWORD_BOLD= IJavaColorConstants.JAVADOC_KEYWORD + EDITOR_BOLD_SUFFIX;
-//
-//     /**
-//      * A named preference that holds the color used to render phpdoc tags.
-//      * <p>
-//      * Value is of type <code>String</code>. A RGB color value encoded as a string
-//      * using class <code>PreferenceConverter</code>
-//      * </p>
-//      * 
-//      * @see org.eclipse.jface.resource.StringConverter
-//      * @see org.eclipse.jface.preference.PreferenceConverter
-//      */
-//     public final static String EDITOR_JAVADOC_TAG_COLOR= IJavaColorConstants.JAVADOC_TAG;
-//
-//     /**
-//      * A named preference that controls whether phpdoc tags are rendered in bold.
-//      * <p>
-//      * Value is of type <code>Boolean</code>.
-//      * </p>
-//      */
-//     public final static String EDITOR_JAVADOC_TAG_BOLD= IJavaColorConstants.JAVADOC_TAG + EDITOR_BOLD_SUFFIX;
-//
-//     /**
-//      * A named preference that holds the color used to render phpdoc links.
-//      * <p>
-//      * Value is of type <code>String</code>. A RGB color value encoded as a string
-//      * using class <code>PreferenceConverter</code>
-//      * </p>
-//      * 
-//      * @see org.eclipse.jface.resource.StringConverter
-//      * @see org.eclipse.jface.preference.PreferenceConverter
-//      */
-//     public final static String EDITOR_JAVADOC_LINKS_COLOR= IJavaColorConstants.JAVADOC_LINK;
-//
-//     /**
-//      * A named preference that controls whether phpdoc links are rendered in bold.
-//      * <p>
-//      * Value is of type <code>Boolean</code>.
-//      * </p>
-//      */
-//     public final static String EDITOR_JAVADOC_LINKS_BOLD= IJavaColorConstants.JAVADOC_LINK + EDITOR_BOLD_SUFFIX;
-//             
-//     /**
-//      * A named preference that holds the color used to render phpdoc default text.
-//      * <p>
-//      * Value is of type <code>String</code>. A RGB color value encoded as a string
-//      * using class <code>PreferenceConverter</code>
-//      * </p>
-//      * 
-//      * @see org.eclipse.jface.resource.StringConverter
-//      * @see org.eclipse.jface.preference.PreferenceConverter
-//      */
-//     public final static String EDITOR_JAVADOC_DEFAULT_COLOR= IJavaColorConstants.JAVADOC_DEFAULT;
-//
-//     /**
-//      * A named preference that controls whether phpdoc default text is rendered in bold.
-//      * <p>
-//      * Value is of type <code>Boolean</code>.
-//      * </p>
-//      */
-//     public final static String EDITOR_JAVADOC_DEFAULT_BOLD= IJavaColorConstants.JAVADOC_DEFAULT + EDITOR_BOLD_SUFFIX;
+       /**
+        * A named preference that holds the color used to render multi line comments.
+        * <p>
+        * Value is of type <code>String</code>. A RGB color value encoded as a string
+        * using class <code>PreferenceConverter</code>
+        * </p>
+        * 
+        * @see org.eclipse.jface.resource.StringConverter
+        * @see org.eclipse.jface.preference.PreferenceConverter
+        */
+       public final static String EDITOR_MULTI_LINE_COMMENT_COLOR= IJavaColorConstants.PHP_MULTI_LINE_COMMENT;
+
+       /**
+        * A named preference that controls whether multi line comments are rendered in bold.
+        * <p>
+        * Value is of type <code>Boolean</code>. If <code>true</code> multi line comments are rendered
+        * in bold. If <code>false</code> the are rendered using no font style attribute.
+        * </p>
+        */
+       public final static String EDITOR_MULTI_LINE_COMMENT_BOLD= IJavaColorConstants.PHP_MULTI_LINE_COMMENT + EDITOR_BOLD_SUFFIX; 
+
+       /**
+        * A named preference that holds the color used to render single line comments.
+        * <p>
+        * Value is of type <code>String</code>. A RGB color value encoded as a string
+        * using class <code>PreferenceConverter</code>
+        * </p>
+        * 
+        * @see org.eclipse.jface.resource.StringConverter
+        * @see org.eclipse.jface.preference.PreferenceConverter
+        */
+       public final static String EDITOR_SINGLE_LINE_COMMENT_COLOR= IJavaColorConstants.PHP_SINGLE_LINE_COMMENT;
+
+       /**
+        * A named preference that controls whether sinle line comments are rendered in bold.
+        * <p>
+        * Value is of type <code>Boolean</code>. If <code>true</code> single line comments are rendered
+        * in bold. If <code>false</code> the are rendered using no font style attribute.
+        * </p>
+        */
+       public final static String EDITOR_SINGLE_LINE_COMMENT_BOLD= IJavaColorConstants.PHP_SINGLE_LINE_COMMENT + EDITOR_BOLD_SUFFIX; 
+
+       /**
+        * A named preference that holds the color used to render php keywords.
+        * <p>
+        * Value is of type <code>String</code>. A RGB color value encoded as a string
+        * using class <code>PreferenceConverter</code>
+        * </p>
+        * 
+        * @see org.eclipse.jface.resource.StringConverter
+        * @see org.eclipse.jface.preference.PreferenceConverter
+        */
+       public final static String EDITOR_JAVA_KEYWORD_COLOR= IJavaColorConstants.PHP_KEYWORD;
+
+       /**
+        * A named preference that controls whether keywords are rendered in bold.
+        * <p>
+        * Value is of type <code>Boolean</code>.
+        * </p>
+        */
+       public final static String EDITOR_JAVA_KEYWORD_BOLD= IJavaColorConstants.PHP_KEYWORD + EDITOR_BOLD_SUFFIX;
+
+  /**
+   * A named preference that holds the color used to render predefined php
+   * function names.
+   * <p>
+   * Value is of type <code>String</code>. A RGB color value encoded as a string
+   * using class <code>PreferenceConverter</code>
+   * </p>
+   * 
+   * @see org.eclipse.jface.resource.StringConverter
+   * @see org.eclipse.jface.preference.PreferenceConverter
+   */
+  public final static String EDITOR_PHP_FUNCTIONNAME_COLOR= IJavaColorConstants.PHP_FUNCTIONNAME;
+
+  /**
+   * A named preference that controls whether function names are rendered in
+   * bold.
+   * <p>
+   * Value is of type <code>Boolean</code>.
+   * </p>
+   */
+  public final static String EDITOR_PHP_FUNCTIONNAME_BOLD= IJavaColorConstants.PHP_FUNCTIONNAME + EDITOR_BOLD_SUFFIX;
+
+  /**
+   * A named preference that holds the color used to render php
+   * variables.
+   * <p>
+   * Value is of type <code>String</code>. A RGB color value encoded as a string
+   * using class <code>PreferenceConverter</code>
+   * </p>
+   * 
+   * @see org.eclipse.jface.resource.StringConverter
+   * @see org.eclipse.jface.preference.PreferenceConverter
+   */
+  public final static String EDITOR_PHP_VARIABLE_COLOR= IJavaColorConstants.PHP_VARIABLE;
+
+  /**
+   * A named preference that controls whether variables are rendered in bold.
+   * <p>
+   * Value is of type <code>Boolean</code>.
+   * </p>
+   */
+  public final static String EDITOR_PHP_VARIABLE_BOLD= IJavaColorConstants.PHP_VARIABLE + EDITOR_BOLD_SUFFIX;
+
+  /**
+   * A named preference that holds the color used to render php constants.
+   * <p>
+   * Value is of type <code>String</code>. A RGB color value encoded as a string
+   * using class <code>PreferenceConverter</code>
+   * </p>
+   * 
+   * @see org.eclipse.jface.resource.StringConverter
+   * @see org.eclipse.jface.preference.PreferenceConverter
+   */
+  public final static String EDITOR_PHP_CONSTANT_COLOR= IJavaColorConstants.PHP_CONSTANT;
+
+  /**
+   * A named preference that controls whether constants are rendered in bold.
+   * <p>
+   * Value is of type <code>Boolean</code>.
+   * </p>
+   */
+  public final static String EDITOR_PHP_CONSTANT_BOLD= IJavaColorConstants.PHP_CONSTANT + EDITOR_BOLD_SUFFIX;
+
+  /**
+   * A named preference that holds the color used to render php types.
+   * <p>
+   * Value is of type <code>String</code>. A RGB color value encoded as a string
+   * using class <code>PreferenceConverter</code>
+   * </p>
+   * 
+   * @see org.eclipse.jface.resource.StringConverter
+   * @see org.eclipse.jface.preference.PreferenceConverter
+   */
+  public final static String EDITOR_PHP_TYPE_COLOR= IJavaColorConstants.PHP_TYPE;
+
+  /**
+   * A named preference that controls whether types are rendered in bold.
+   * <p>
+   * Value is of type <code>Boolean</code>.
+   * </p>
+   */
+  public final static String EDITOR_PHP_TYPE_BOLD= IJavaColorConstants.PHP_TYPE + EDITOR_BOLD_SUFFIX;
+
+
+       /**
+        * A named preference that holds the color used to render string constants.
+        * <p>
+        * Value is of type <code>String</code>. A RGB color value encoded as a string
+        * using class <code>PreferenceConverter</code>
+        * </p>
+        * 
+        * @see org.eclipse.jface.resource.StringConverter
+        * @see org.eclipse.jface.preference.PreferenceConverter
+        */
+       public final static String EDITOR_STRING_COLOR= IJavaColorConstants.PHP_STRING;
+
+       /**
+        * A named preference that controls whether string constants are rendered in bold.
+        * <p>
+        * Value is of type <code>Boolean</code>.
+        * </p>
+        */
+       public final static String EDITOR_STRING_BOLD= IJavaColorConstants.PHP_STRING + EDITOR_BOLD_SUFFIX;
+
+       /**
+        * A named preference that holds the color used to render php default text.
+        * <p>
+        * Value is of type <code>String</code>. A RGB color value encoded as a string
+        * using class <code>PreferenceConverter</code>
+        * </p>
+        * 
+        * @see org.eclipse.jface.resource.StringConverter
+        * @see org.eclipse.jface.preference.PreferenceConverter
+        */
+       public final static String EDITOR_JAVA_DEFAULT_COLOR= IJavaColorConstants.PHP_DEFAULT;
+
+       /**
+        * A named preference that controls whether Java default text is rendered in bold.
+        * <p>
+        * Value is of type <code>Boolean</code>.
+        * </p>
+        */
+       public final static String EDITOR_JAVA_DEFAULT_BOLD= IJavaColorConstants.PHP_DEFAULT + EDITOR_BOLD_SUFFIX;
+
+       /**
+        * A named preference that holds the color used to render phpdoc keywords.
+        * <p>
+        * Value is of type <code>String</code>. A RGB color value encoded as a string
+        * using class <code>PreferenceConverter</code>
+        * </p>
+        * 
+        * @see org.eclipse.jface.resource.StringConverter
+        * @see org.eclipse.jface.preference.PreferenceConverter
+        */
+       public final static String EDITOR_JAVADOC_KEYWORD_COLOR= IJavaColorConstants.PHPDOC_KEYWORD;
+
+       /**
+        * A named preference that controls whether phpdoc keywords are rendered in bold.
+        * <p>
+        * Value is of type <code>Boolean</code>.
+        * </p>
+        */
+       public final static String EDITOR_JAVADOC_KEYWORD_BOLD= IJavaColorConstants.PHPDOC_KEYWORD + EDITOR_BOLD_SUFFIX;
+
+       /**
+        * A named preference that holds the color used to render phpdoc tags.
+        * <p>
+        * Value is of type <code>String</code>. A RGB color value encoded as a string
+        * using class <code>PreferenceConverter</code>
+        * </p>
+        * 
+        * @see org.eclipse.jface.resource.StringConverter
+        * @see org.eclipse.jface.preference.PreferenceConverter
+        */
+       public final static String EDITOR_JAVADOC_TAG_COLOR= IJavaColorConstants.PHPDOC_TAG;
+
+       /**
+        * A named preference that controls whether phpdoc tags are rendered in bold.
+        * <p>
+        * Value is of type <code>Boolean</code>.
+        * </p>
+        */
+       public final static String EDITOR_JAVADOC_TAG_BOLD= IJavaColorConstants.PHPDOC_TAG + EDITOR_BOLD_SUFFIX;
+
+       /**
+        * A named preference that holds the color used to render phpdoc links.
+        * <p>
+        * Value is of type <code>String</code>. A RGB color value encoded as a string
+        * using class <code>PreferenceConverter</code>
+        * </p>
+        * 
+        * @see org.eclipse.jface.resource.StringConverter
+        * @see org.eclipse.jface.preference.PreferenceConverter
+        */
+       public final static String EDITOR_JAVADOC_LINKS_COLOR= IJavaColorConstants.PHPDOC_LINK;
+
+       /**
+        * A named preference that controls whether phpdoc links are rendered in bold.
+        * <p>
+        * Value is of type <code>Boolean</code>.
+        * </p>
+        */
+       public final static String EDITOR_JAVADOC_LINKS_BOLD= IJavaColorConstants.PHPDOC_LINK + EDITOR_BOLD_SUFFIX;
+               
+       /**
+        * A named preference that holds the color used to render phpdoc default text.
+        * <p>
+        * Value is of type <code>String</code>. A RGB color value encoded as a string
+        * using class <code>PreferenceConverter</code>
+        * </p>
+        * 
+        * @see org.eclipse.jface.resource.StringConverter
+        * @see org.eclipse.jface.preference.PreferenceConverter
+        */
+       public final static String EDITOR_JAVADOC_DEFAULT_COLOR= IJavaColorConstants.PHPDOC_DEFAULT;
+
+       /**
+        * A named preference that controls whether phpdoc default text is rendered in bold.
+        * <p>
+        * Value is of type <code>Boolean</code>.
+        * </p>
+        */
+       public final static String EDITOR_JAVADOC_DEFAULT_BOLD= IJavaColorConstants.PHPDOC_DEFAULT + EDITOR_BOLD_SUFFIX;
 
        /**
         * A named preference that holds the color used for 'linked-mode' underline.
@@ -1635,32 +1719,44 @@ public class PreferenceConstants {
                store.setDefault(PreferenceConstants.EDITOR_TAB_WIDTH, 4);
                store.setDefault(PreferenceConstants.EDITOR_SPACES_FOR_TABS, false);
 
-//             PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_COLOR, new RGB(63, 127, 95));
-//             store.setDefault(PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_BOLD, false);
-//
-//             PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_COLOR, new RGB(63, 127, 95));
-//             store.setDefault(PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_BOLD, false);
-//
-//             PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_JAVA_KEYWORD_COLOR, new RGB(127, 0, 85));
-//             store.setDefault(PreferenceConstants.EDITOR_JAVA_KEYWORD_BOLD, true);
-//
-//             PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_STRING_COLOR, new RGB(42, 0, 255));
-//             store.setDefault(PreferenceConstants.EDITOR_STRING_BOLD, false);
-//
-//             PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_JAVA_DEFAULT_COLOR, new RGB(0, 0, 0));
-//             store.setDefault(PreferenceConstants.EDITOR_JAVA_DEFAULT_BOLD, false);
-//
-//             PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_JAVADOC_KEYWORD_COLOR, new RGB(127, 159, 191));
-//             store.setDefault(PreferenceConstants.EDITOR_JAVADOC_KEYWORD_BOLD, true);
-//
-//             PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_JAVADOC_TAG_COLOR, new RGB(127, 127, 159));
-//             store.setDefault(PreferenceConstants.EDITOR_JAVADOC_TAG_BOLD, false);
-//
-//             PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_JAVADOC_LINKS_COLOR, new RGB(63, 63, 191));
-//             store.setDefault(PreferenceConstants.EDITOR_JAVADOC_LINKS_BOLD, false);
-//
-//             PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_JAVADOC_DEFAULT_COLOR, new RGB(63, 95, 191));
-//             store.setDefault(PreferenceConstants.EDITOR_JAVADOC_DEFAULT_BOLD, false);
+               PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_COLOR, new RGB(63, 127, 95));
+               store.setDefault(PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_BOLD, false);
+
+               PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_COLOR, new RGB(63, 127, 95));
+               store.setDefault(PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_BOLD, false);
+
+               PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_JAVA_KEYWORD_COLOR, new RGB(127, 0, 85));
+               store.setDefault(PreferenceConstants.EDITOR_JAVA_KEYWORD_BOLD, true);
+
+    PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_PHP_FUNCTIONNAME_COLOR, new RGB(127, 127, 159));
+    store.setDefault(PreferenceConstants.EDITOR_PHP_FUNCTIONNAME_BOLD, false);
+
+    PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_PHP_VARIABLE_COLOR, new RGB(127, 159, 191));
+    store.setDefault(PreferenceConstants.EDITOR_PHP_VARIABLE_BOLD, false);
+    
+    PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_PHP_CONSTANT_COLOR, new RGB(127, 0, 85));
+    store.setDefault(PreferenceConstants.EDITOR_PHP_CONSTANT_BOLD, false);
+
+    PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_PHP_TYPE_COLOR, new RGB(127, 0, 85));
+    store.setDefault(PreferenceConstants.EDITOR_PHP_TYPE_BOLD, false);
+        
+               PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_STRING_COLOR, new RGB(42, 0, 255));
+               store.setDefault(PreferenceConstants.EDITOR_STRING_BOLD, false);
+
+               PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_JAVA_DEFAULT_COLOR, new RGB(0, 0, 0));
+               store.setDefault(PreferenceConstants.EDITOR_JAVA_DEFAULT_BOLD, false);
+
+               PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_JAVADOC_KEYWORD_COLOR, new RGB(127, 159, 191));
+               store.setDefault(PreferenceConstants.EDITOR_JAVADOC_KEYWORD_BOLD, true);
+
+               PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_JAVADOC_TAG_COLOR, new RGB(127, 127, 159));
+               store.setDefault(PreferenceConstants.EDITOR_JAVADOC_TAG_BOLD, false);
+
+               PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_JAVADOC_LINKS_COLOR, new RGB(63, 63, 191));
+               store.setDefault(PreferenceConstants.EDITOR_JAVADOC_LINKS_BOLD, false);
+
+               PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_JAVADOC_DEFAULT_COLOR, new RGB(63, 95, 191));
+               store.setDefault(PreferenceConstants.EDITOR_JAVADOC_DEFAULT_BOLD, false);
 
                store.setDefault(PreferenceConstants.CODEASSIST_AUTOACTIVATION, true);
                store.setDefault(PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY, 500);
index 6e2a6cf..d6de39e 100644 (file)
@@ -11,8 +11,8 @@
 package net.sourceforge.phpdt.ui.text;
 
 /**
- * Color keys used for syntax highlighting Java 
- * code and JavaDoc compliant comments. 
+ * Color keys used for syntax highlighting PHP 
+ * code and PHPDoc compliant comments. 
  * A <code>IColorManager</code> is responsible for mapping 
  * concrete colors to these keys.
  * <p>
@@ -30,29 +30,32 @@ public interface IJavaColorConstants {
         */
        String PREFIX= "php_"; //$NON-NLS-1$
        
-       /** The color key for multi-line comments in Java code. */
-       String JAVA_MULTI_LINE_COMMENT= "php_multi_line_comment"; //$NON-NLS-1$
-       /** The color key for single-line comments in Java code. */
-       String JAVA_SINGLE_LINE_COMMENT= "php_single_line_comment"; //$NON-NLS-1$
-       /** The color key for Java keywords in Java code. */
-       String JAVA_KEYWORD= "php_keyword"; //$NON-NLS-1$
-       /** The color key for string and character literals in Java code. */
-       String JAVA_STRING= "php_string"; //$NON-NLS-1$
-       /** The color key for everthing in Java code for which no other color is specified. */
-       String JAVA_DEFAULT= "php_default"; //$NON-NLS-1$
-       /** 
-        * The color key for the Java built-in types such as int and char in Java code.
-        * @deprecated no longer used, use <code>JAVA_KEYWORD</code> instead
-        */
-       String JAVA_TYPE= "php_type"; //$NON-NLS-1$
+       /** The color key for multi-line comments in PHP code. */
+       String PHP_MULTI_LINE_COMMENT= "php_multi_line_comment"; //$NON-NLS-1$
+       /** The color key for single-line comments in PHP code. */
+       String PHP_SINGLE_LINE_COMMENT= "php_single_line_comment"; //$NON-NLS-1$
+       /** The color key for PHP keywords in PHP code. */
+       String PHP_KEYWORD= "php_keyword"; //$NON-NLS-1$
+       /** The color key for string and character literals in PHP code. */
+       String PHP_STRING= "php_string"; //$NON-NLS-1$
+       /** The color key for everthing in PHP code for which no other color is specified. */
+       String PHP_DEFAULT= "php_default"; //$NON-NLS-1$
+  /** The color key for predefined PHP function namesin PHP code. */
+  String PHP_FUNCTIONNAME= "php_functionname"; //$NON-NLS-1$
+  /** The color key for ($-)variables in PHP code. */
+  String PHP_VARIABLE= "php_variable"; //$NON-NLS-1$
+  /** The color key for constants in PHP code */
+  String PHP_CONSTANT= "php_constant"; //$NON-NLS-1$
+       /** The color key for the PHP built-in types in PHP code. */
+       String PHP_TYPE= "php_type"; //$NON-NLS-1$
        
        
-       /** The color key for JavaDoc keywords (<code>@foo</code>) in JavaDoc comments. */
-       String JAVADOC_KEYWORD= "php_doc_keyword"; //$NON-NLS-1$
-       /** The color key for HTML tags (<code>&lt;foo&gt;</code>) in JavaDoc comments. */
-       String JAVADOC_TAG= "php_doc_tag"; //$NON-NLS-1$
-       /** The color key for JavaDoc links (<code>{foo}</code>) in JavaDoc comments. */
-       String JAVADOC_LINK= "php_doc_link"; //$NON-NLS-1$
-       /** The color key for everthing in JavaDoc comments for which no other color is specified. */
-       String JAVADOC_DEFAULT= "php_doc_default"; //$NON-NLS-1$
+       /** The color key for PHPDoc keywords (<code>@foo</code>) in PHPDoc comments. */
+       String PHPDOC_KEYWORD= "php_doc_keyword"; //$NON-NLS-1$
+       /** The color key for HTML tags (<code>&lt;foo&gt;</code>) in PHPDoc comments. */
+       String PHPDOC_TAG= "php_doc_tag"; //$NON-NLS-1$
+       /** The color key for PHPDoc links (<code>{foo}</code>) in PHPDoc comments. */
+       String PHPDOC_LINK= "php_doc_link"; //$NON-NLS-1$
+       /** The color key for everthing in PHPDoc comments for which no other color is specified. */
+       String PHPDOC_DEFAULT= "php_doc_default"; //$NON-NLS-1$
 }
\ No newline at end of file
index b3073f1..3409576 100644 (file)
@@ -81,9 +81,9 @@ public class JavaTextTools {
                
                fColorManager= new JavaColorManager();
                fCodeScanner= new PHPCodeScanner(fColorManager, store);
-               fMultilineCommentScanner= new SingleTokenPHPScanner(fColorManager, store, IJavaColorConstants.JAVA_MULTI_LINE_COMMENT);
-               fSinglelineCommentScanner= new SingleTokenPHPScanner(fColorManager, store, IJavaColorConstants.JAVA_SINGLE_LINE_COMMENT);
-               fStringScanner= new SingleTokenPHPScanner(fColorManager, store, IJavaColorConstants.JAVA_STRING);
+               fMultilineCommentScanner= new SingleTokenPHPScanner(fColorManager, store, IJavaColorConstants.PHP_MULTI_LINE_COMMENT);
+               fSinglelineCommentScanner= new SingleTokenPHPScanner(fColorManager, store, IJavaColorConstants.PHP_SINGLE_LINE_COMMENT);
+               fStringScanner= new SingleTokenPHPScanner(fColorManager, store, IJavaColorConstants.PHP_STRING);
                fJavaDocScanner= new PHPDocCodeScanner(fColorManager, store);
                fPartitionScanner= new FastJavaPartitionScanner();
        }
index 3966235..ec10e41 100644 (file)
@@ -7,8 +7,10 @@ package net.sourceforge.phpdt.ui.text;
 
 
 import java.util.List;
+
+import net.sourceforge.phpdt.internal.ui.text.AbstractJavaScanner;
+
 import org.eclipse.jface.preference.IPreferenceStore;
-import net.sourceforge.phpdt.ui.text.IColorManager;
 
 
 /**
index 06d2c17..b2396d4 100644 (file)
@@ -65,18 +65,18 @@ public interface IPreferenceConstants {
   public static final String PHP_DEFAULT_BOLD = "_php_default_bold";
   public static final String PHP_DEFAULT_ITALIC = "_php_default_italic";
   public static final String PHP_DEFAULT_UNDERLINE = "_php_default_underline";
-  public static final String LINKED_POSITION_COLOR = "_linkedPositionColor";
-  public static final String PHP_EDITOR_BACKGROUND = "_php_editor_background";
+//  public static final String LINKED_POSITION_COLOR = "_linkedPositionColor";
+//  public static final String PHP_EDITOR_BACKGROUND = "_php_editor_background";
   public static final String PHP_USERDEF_XMLFILE = "_userdef_xmlfile";
 
-  /** The color key for PHPDoc keywords (<code>@foo</code>) in PHPDoc comments. */
-  public static final String PHPDOC_KEYWORD= "_php_doc_keyword"; //$NON-NLS-1$
-  /** The color key for HTML tags (<code>&lt;foo&gt;</code>) in PHPDoc comments. */
-  public static final String PHPDOC_TAG= "_php_doc_tag"; //$NON-NLS-1$
-  /** The color key for PHPDoc links (<code>{foo}</code>) in PHPDoc comments. */
-  public static final String PHPDOC_LINK= "_php_doc_link"; //$NON-NLS-1$
-  /** The color key for everthing in PHPDoc comments for which no other color is specified. */
-  public static final String PHPDOC_DEFAULT= "_php_doc_default"; //$NON-NLS-1$
+//  /** The color key for PHPDoc keywords (<code>@foo</code>) in PHPDoc comments. */
+//  public static final String PHPDOC_KEYWORD= "_php_doc_keyword"; //$NON-NLS-1$
+//  /** The color key for HTML tags (<code>&lt;foo&gt;</code>) in PHPDoc comments. */
+//  public static final String PHPDOC_TAG= "_php_doc_tag"; //$NON-NLS-1$
+//  /** The color key for PHPDoc links (<code>{foo}</code>) in PHPDoc comments. */
+//  public static final String PHPDOC_LINK= "_php_doc_link"; //$NON-NLS-1$
+//  /** The color key for everthing in PHPDoc comments for which no other color is specified. */
+//  public static final String PHPDOC_DEFAULT= "_php_doc_default"; //$NON-NLS-1$
   
   /*Language stuff  - under dev*/
   public static final String RESOURCE_BUNDLE = "_php_editor_res_bundle"; //$NON-NLS-1$
@@ -91,12 +91,12 @@ public interface IPreferenceConstants {
 
   public static final String EDITOR_BOLD_SUFFIX = "_editor_bold_suffix";
   /** Preference key for showing the line number ruler */
-  public final static String LINE_NUMBER_RULER = "_lineNumberRuler"; //$NON-NLS-1$
+ // public final static String LINE_NUMBER_RULER = "_lineNumberRuler"; //$NON-NLS-1$
   /** Preference key for the foreground color of the line numbers */
-  public final static String LINE_NUMBER_COLOR = "_lineNumberColor"; //$NON-NLS-1$
+ // public final static String LINE_NUMBER_COLOR = "_lineNumberColor"; //$NON-NLS-1$
 
-  public final static String PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT = "_defaultBackgroundColor"; //$NON-NLS-1$
-  public final static String PREFERENCE_COLOR_BACKGROUND = "backgroundColor"; //$NON-NLS-1$
+//  public final static String PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT = "_defaultBackgroundColor"; //$NON-NLS-1$
+//  public final static String PREFERENCE_COLOR_BACKGROUND = "backgroundColor"; //$NON-NLS-1$
 
   /** Preference key for content assist proposal color */
   public final static String PROPOSALS_FOREGROUND = "content_assist_proposals_foreground"; //$NON-NLS-1$
index ecf3654..7e2ebf9 100644 (file)
@@ -78,7 +78,8 @@ public class PHPSyntaxEditorPreferencePage extends PreferencePage implements IWo
       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_DEFAULT_ITALIC),
       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_DEFAULT_UNDERLINE),
       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, IPreferenceConstants.PHP_USERDEF_XMLFILE),
-      new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, IPreferenceConstants.PHP_EDITOR_BACKGROUND)};
+  //    new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, IPreferenceConstants.PHP_EDITOR_BACKGROUND)
+  };
 
   private final String[][] SyntaxColorListModel =
     new String[][] {
@@ -127,7 +128,7 @@ public class PHPSyntaxEditorPreferencePage extends PreferencePage implements IWo
   private Button ItalicCheckBox;
   private Button UnderlineCheckBox;
   private FileFieldEditor userdefPHPSyntaxFileFFE;
-  private BooleanFieldEditor showLineNumber;
+  // private BooleanFieldEditor showLineNumber;
   private IntegerFieldEditor formatterTabSize;
   private BooleanFieldEditor spacesForTabs;
 
@@ -164,21 +165,21 @@ public class PHPSyntaxEditorPreferencePage extends PreferencePage implements IWo
     GridData gd = new GridData();
     gd.horizontalAlignment = GridData.BEGINNING;
     label.setLayoutData(gd);
-    final ColorEditor syntaxBackgroundColorEditor = new ColorEditor(parent);
-    RGB rgb = PreferenceConverter.getColor(OverlayStore, IPreferenceConstants.PHP_EDITOR_BACKGROUND);
-    syntaxBackgroundColorEditor.setColorValue(rgb);
-    Button backgroundColorButton = syntaxBackgroundColorEditor.getButton();
-    gd = new GridData(GridData.FILL_HORIZONTAL);
-    gd.horizontalAlignment = GridData.BEGINNING;
-    backgroundColorButton.setLayoutData(gd);
-    backgroundColorButton.addSelectionListener(new SelectionListener() {
-      public void widgetDefaultSelected(SelectionEvent e) {
-        // do nothing
-      }
-      public void widgetSelected(SelectionEvent e) {
-        PreferenceConverter.setValue(OverlayStore, IPreferenceConstants.PHP_EDITOR_BACKGROUND, syntaxBackgroundColorEditor.getColorValue());
-      }
-    });
+//    final ColorEditor syntaxBackgroundColorEditor = new ColorEditor(parent);
+//    RGB rgb = PreferenceConverter.getColor(OverlayStore, IPreferenceConstants.PHP_EDITOR_BACKGROUND);
+//    syntaxBackgroundColorEditor.setColorValue(rgb);
+//    Button backgroundColorButton = syntaxBackgroundColorEditor.getButton();
+//    gd = new GridData(GridData.FILL_HORIZONTAL);
+//    gd.horizontalAlignment = GridData.BEGINNING;
+//    backgroundColorButton.setLayoutData(gd);
+//    backgroundColorButton.addSelectionListener(new SelectionListener() {
+//      public void widgetDefaultSelected(SelectionEvent e) {
+//        // do nothing
+//      }
+//      public void widgetSelected(SelectionEvent e) {
+//        PreferenceConverter.setValue(OverlayStore, IPreferenceConstants.PHP_EDITOR_BACKGROUND, syntaxBackgroundColorEditor.getColorValue());
+//      }
+//    });
   }
 
   /**
@@ -406,11 +407,11 @@ public class PHPSyntaxEditorPreferencePage extends PreferencePage implements IWo
     initialize();
     
    
-    showLineNumber = new BooleanFieldEditor(PHPeclipsePlugin.LINE_NUMBER_RULER, 
-    "Show line numbers", composite);
-    showLineNumber.setPreferencePage(this);
-    showLineNumber.setPreferenceStore(getPreferenceStore());
-    showLineNumber.load();
+//    showLineNumber = new BooleanFieldEditor(PHPeclipsePlugin.LINE_NUMBER_RULER, 
+//    "Show line numbers", composite);
+//    showLineNumber.setPreferencePage(this);
+//    showLineNumber.setPreferenceStore(getPreferenceStore());
+//    showLineNumber.load();
     
 //    formatterTabSize = new IntegerFieldEditor(PHPeclipsePlugin.FORMATTER_TAB_SIZE, 
 //    "Displayed tab width", composite, 3);
@@ -463,7 +464,7 @@ public class PHPSyntaxEditorPreferencePage extends PreferencePage implements IWo
     IPreferenceStore store = getPreferenceStore();
     PHPeclipsePlugin.getDefault().savePluginPreferences();
     userdefPHPSyntaxFileFFE.store();
-    showLineNumber.store();
+   // showLineNumber.store();
     spacesForTabs.store();
     formatterTabSize.store();
     return true;
@@ -474,9 +475,9 @@ public class PHPSyntaxEditorPreferencePage extends PreferencePage implements IWo
     initializeFields();
     handleSyntaxColorListSelection();
     userdefPHPSyntaxFileFFE.loadDefault();
-    showLineNumber.loadDefault();
+  //  showLineNumber.loadDefault();
     spacesForTabs.loadDefault();
-    showLineNumber.loadDefault();
+  //  showLineNumber.loadDefault();
     formatterTabSize.loadDefault();
     super.performDefaults();
   }
index 9384fc1..99c2a80 100644 (file)
@@ -135,12 +135,12 @@ public class PHPeclipsePlugin
     return fImageDescriptorRegistry;
   }
   // @TODO: refactor this into a better method name !
-  public PHPDocumentProvider getCompilationUnitDocumentProvider() {
+  public synchronized PHPDocumentProvider getCompilationUnitDocumentProvider() {
     if (fCompilationUnitDocumentProvider == null)
-      fCompilationUnitDocumentProvider = new PHPDocumentProvider();
+      fCompilationUnitDocumentProvider= new PHPDocumentProvider();
     return fCompilationUnitDocumentProvider;
   }
-
+  
   private static void setJVM() {
     String osName = System.getProperty("os.name");
 
@@ -325,7 +325,7 @@ public class PHPeclipsePlugin
     store.setDefault(PHP_PARSE_ON_SAVE, "true");
 
     // show line numbers:
-    store.setDefault(LINE_NUMBER_RULER, "false");
+ //   store.setDefault(LINE_NUMBER_RULER, "false");
     store.setDefault(FORMATTER_TAB_SIZE, "4");
 
     // php syntax highlighting
@@ -361,42 +361,42 @@ public class PHPeclipsePlugin
       store,
       PHP_DEFAULT,
       PHPColorProvider.DEFAULT);
-    PreferenceConverter.setDefault(
-      store,
-      PHP_EDITOR_BACKGROUND,
-      PHPColorProvider.BACKGROUND);
-    PreferenceConverter.setDefault(
-      store,
-      LINKED_POSITION_COLOR,
-      PHPColorProvider.LINKED_POSITION_COLOR);
-    PreferenceConverter.setDefault(
-      store,
-      LINE_NUMBER_COLOR,
-      PHPColorProvider.LINE_NUMBER_COLOR);
-
-    // set default PHPDoc colors:
-    PreferenceConverter.setDefault(
-      store,
-      PHPDOC_KEYWORD, 
-      PHPColorProvider.PHPDOC_KEYWORD);
-    PreferenceConverter.setDefault(
-      store,
-      PHPDOC_LINK, 
-      PHPColorProvider.PHPDOC_LINK);      
-    PreferenceConverter.setDefault(
-      store,
-      PHPDOC_DEFAULT, 
-      PHPColorProvider.PHPDOC_DEFAULT);
-    PreferenceConverter.setDefault(
-      store,
-      PHPDOC_TAG, 
-      PHPColorProvider.PHPDOC_TAG);
+//    PreferenceConverter.setDefault(
+//      store,
+//      PHP_EDITOR_BACKGROUND,
+//      PHPColorProvider.BACKGROUND);
+//    PreferenceConverter.setDefault(
+//      store,
+//      LINKED_POSITION_COLOR,
+//      PHPColorProvider.LINKED_POSITION_COLOR);
+//    PreferenceConverter.setDefault(
+//      store,
+//      LINE_NUMBER_COLOR,
+//      PHPColorProvider.LINE_NUMBER_COLOR);
+
+//    // set default PHPDoc colors:
+//    PreferenceConverter.setDefault(
+//      store,
+//      PHPDOC_KEYWORD, 
+//      PHPColorProvider.PHPDOC_KEYWORD);
+//    PreferenceConverter.setDefault(
+//      store,
+//      PHPDOC_LINK, 
+//      PHPColorProvider.PHPDOC_LINK);      
+//    PreferenceConverter.setDefault(
+//      store,
+//      PHPDOC_DEFAULT, 
+//      PHPColorProvider.PHPDOC_DEFAULT);
+//    PreferenceConverter.setDefault(
+//      store,
+//      PHPDOC_TAG, 
+//      PHPColorProvider.PHPDOC_TAG);
       
-    store.setDefault(PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT, "true");
-    PreferenceConverter.setDefault(
-      store,
-      PREFERENCE_COLOR_BACKGROUND,
-      PHPColorProvider.BACKGROUND_COLOR);
+//    store.setDefault(PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT, "true");
+//    PreferenceConverter.setDefault(
+//      store,
+//      PREFERENCE_COLOR_BACKGROUND,
+//      PHPColorProvider.BACKGROUND_COLOR);
 
     //language stuff
     store.setDefault(RESOURCE_BUNDLE, LANGUAGE_DEFAULT);
index c86919b..fc5da20 100644 (file)
@@ -16,16 +16,15 @@ import java.util.List;
 
 import net.sourceforge.phpdt.internal.ui.actions.CompositeActionGroup;
 import net.sourceforge.phpdt.internal.ui.text.HTMLTextPresenter;
-import net.sourceforge.phpdt.internal.ui.text.JavaColorManager;
 import net.sourceforge.phpdt.internal.ui.text.PHPPairMatcher;
 import net.sourceforge.phpdt.internal.ui.viewsupport.IViewPartInputProvider;
+import net.sourceforge.phpdt.ui.PreferenceConstants;
 import net.sourceforge.phpdt.ui.actions.GenerateActionGroup;
 import net.sourceforge.phpdt.ui.actions.GotoMatchingBracketAction;
+import net.sourceforge.phpdt.ui.text.IColorManager;
 import net.sourceforge.phpdt.ui.text.JavaTextTools;
-import net.sourceforge.phpeclipse.IPreferenceConstants;
 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
 import net.sourceforge.phpeclipse.phpeditor.php.IPHPPartitionScannerConstants;
-import net.sourceforge.phpeclipse.phpeditor.php.PHPCodeScanner;
 
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.CoreException;
@@ -41,8 +40,10 @@ import org.eclipse.jface.text.IDocument;
 import org.eclipse.jface.text.IInformationControl;
 import org.eclipse.jface.text.IInformationControlCreator;
 import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITextHover;
 import org.eclipse.jface.text.ITextOperationTarget;
 import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.ITextViewerExtension2;
 import org.eclipse.jface.text.ITextViewerExtension3;
 import org.eclipse.jface.text.ITypedRegion;
 import org.eclipse.jface.text.Region;
@@ -53,7 +54,7 @@ import org.eclipse.jface.text.source.ISourceViewer;
 import org.eclipse.jface.text.source.IVerticalRuler;
 import org.eclipse.jface.text.source.IVerticalRulerColumn;
 import org.eclipse.jface.text.source.LineNumberRulerColumn;
-import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.text.source.SourceViewerConfiguration;
 import org.eclipse.jface.util.PropertyChangeEvent;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.BidiSegmentEvent;
@@ -81,6 +82,16 @@ public class PHPEditor
   extends StatusTextEditor
   implements IViewPartInputProvider { // extends TextEditor {
 
+  /** Preference key for showing the line number ruler */
+  private final static String LINE_NUMBER_RULER =
+    PreferenceConstants.EDITOR_LINE_NUMBER_RULER;
+  /** Preference key for the foreground color of the line numbers */
+  private final static String LINE_NUMBER_COLOR =
+    PreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR;
+  /** Preference key for the link color */
+  private final static String LINK_COLOR =
+    PreferenceConstants.EDITOR_LINK_COLOR;
+
   // protected PHPActionGroup fActionGroups;
   /** The outline page */
   private PHPContentOutlinePage fOutlinePage;
@@ -135,6 +146,36 @@ public class PHPEditor
   //   }
 
   /*
+   * Update the hovering behavior depending on the preferences.
+   */
+  private void updateHoverBehavior() {
+    SourceViewerConfiguration configuration= getSourceViewerConfiguration();
+    String[] types= configuration.getConfiguredContentTypes(getSourceViewer());
+
+    for (int i= 0; i < types.length; i++) {
+                       
+      String t= types[i];
+                               
+      int[] stateMasks= configuration.getConfiguredTextHoverStateMasks(getSourceViewer(), t);
+
+      ISourceViewer sourceViewer= getSourceViewer();
+      if (sourceViewer instanceof ITextViewerExtension2) {
+        if (stateMasks != null) {
+          for (int j= 0; j < stateMasks.length; j++)   {
+            int stateMask= stateMasks[j];
+            ITextHover textHover= configuration.getTextHover(sourceViewer, t, stateMask);
+            ((ITextViewerExtension2)sourceViewer).setTextHover(textHover, t, stateMask);
+          }
+        } else {
+          ITextHover textHover= configuration.getTextHover(sourceViewer, t);
+          ((ITextViewerExtension2)sourceViewer).setTextHover(textHover, t, ITextViewerExtension2.DEFAULT_HOVER_STATE_MASK);
+        }
+      } else
+        sourceViewer.setTextHover(configuration.getTextHover(sourceViewer, t), t);
+    }
+  }
+  
+  /*
    * @see net.sourceforge.phpdt.internal.ui.viewsupport.IViewPartInputProvider#getViewPartInput()
    */
   public Object getViewPartInput() {
@@ -412,8 +453,8 @@ public class PHPEditor
   //   }
 
   /*
-     * @see AbstractTextEditor#handlePreferenceStoreChanged(PropertyChangeEvent)
-     */
+   * @see AbstractTextEditor#handlePreferenceStoreChanged(PropertyChangeEvent)
+   */
   protected void handlePreferenceStoreChanged(PropertyChangeEvent event) {
 
     try {
@@ -424,17 +465,18 @@ public class PHPEditor
 
       String property = event.getProperty();
 
-      //      if (JavaSourceViewerConfiguration.PREFERENCE_TAB_WIDTH.equals(property)) {
-      //        Object value= event.getNewValue();
-      //        if (value instanceof Integer) {
-      //          sourceViewer.getTextWidget().setTabs(((Integer) value).intValue());
-      //        } else if (value instanceof String) {
-      //          sourceViewer.getTextWidget().setTabs(Integer.parseInt((String) value));
-      //        }
-      //        return;
-      //      }
-
-      if (IPreferenceConstants.LINE_NUMBER_RULER.equals(property)) {
+      if (PreferenceConstants.EDITOR_TAB_WIDTH.equals(property)) {
+        Object value = event.getNewValue();
+        if (value instanceof Integer) {
+          sourceViewer.getTextWidget().setTabs(((Integer) value).intValue());
+        } else if (value instanceof String) {
+          sourceViewer.getTextWidget().setTabs(
+            Integer.parseInt((String) value));
+        }
+        return;
+      }
+
+      if (LINE_NUMBER_RULER.equals(property)) {
         if (isLineNumberRulerVisible())
           showLineNumberRuler();
         else
@@ -443,17 +485,77 @@ public class PHPEditor
       }
 
       if (fLineNumberRulerColumn != null
-        && (IPreferenceConstants.LINE_NUMBER_COLOR.equals(property)
+        && (LINE_NUMBER_COLOR.equals(property)
           || PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT.equals(property)
           || PREFERENCE_COLOR_BACKGROUND.equals(property))) {
 
         initializeLineNumberRulerColumn(fLineNumberRulerColumn);
       }
 
+      if (isJavaEditorHoverProperty(property)) {
+        updateHoverBehavior();
+      }
+
     } finally {
       super.handlePreferenceStoreChanged(event);
     }
   }
+
+  //  /*
+  //     * @see AbstractTextEditor#handlePreferenceStoreChanged(PropertyChangeEvent)
+  //     */
+  //  protected void handlePreferenceStoreChanged(PropertyChangeEvent event) {
+  //
+  //    try {
+  //
+  //      ISourceViewer sourceViewer = getSourceViewer();
+  //      if (sourceViewer == null)
+  //        return;
+  //
+  //      String property = event.getProperty();
+  //
+  //      //      if (JavaSourceViewerConfiguration.PREFERENCE_TAB_WIDTH.equals(property)) {
+  //      //        Object value= event.getNewValue();
+  //      //        if (value instanceof Integer) {
+  //      //          sourceViewer.getTextWidget().setTabs(((Integer) value).intValue());
+  //      //        } else if (value instanceof String) {
+  //      //          sourceViewer.getTextWidget().setTabs(Integer.parseInt((String) value));
+  //      //        }
+  //      //        return;
+  //      //      }
+  //
+  //      if (IPreferenceConstants.LINE_NUMBER_RULER.equals(property)) {
+  //        if (isLineNumberRulerVisible())
+  //          showLineNumberRuler();
+  //        else
+  //          hideLineNumberRuler();
+  //        return;
+  //      }
+  //
+  //      if (fLineNumberRulerColumn != null
+  //        && (IPreferenceConstants.LINE_NUMBER_COLOR.equals(property)
+  //          || PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT.equals(property)
+  //          || PREFERENCE_COLOR_BACKGROUND.equals(property))) {
+  //
+  //        initializeLineNumberRulerColumn(fLineNumberRulerColumn);
+  //      }
+  //
+  //    } finally {
+  //      super.handlePreferenceStoreChanged(event);
+  //    }
+  //  }
+
+  private boolean isJavaEditorHoverProperty(String property) {
+    return PreferenceConstants.EDITOR_DEFAULT_HOVER.equals(property)
+      || PreferenceConstants.EDITOR_NONE_HOVER.equals(property)
+      || PreferenceConstants.EDITOR_CTRL_HOVER.equals(property)
+      || PreferenceConstants.EDITOR_SHIFT_HOVER.equals(property)
+      || PreferenceConstants.EDITOR_CTRL_ALT_HOVER.equals(property)
+      || PreferenceConstants.EDITOR_CTRL_SHIFT_HOVER.equals(property)
+      || PreferenceConstants.EDITOR_CTRL_ALT_SHIFT_HOVER.equals(property)
+      || PreferenceConstants.EDITOR_ALT_SHIFT_HOVER.equals(property);
+  }
+
   /**
    * Shows the line number ruler column.
    */
@@ -466,14 +568,13 @@ public class PHPEditor
   }
 
   /**
-  * Return whether the line number ruler column should be 
-  * visible according to the preference store settings.
-  * @return <code>true</code> if the line numbers should be visible
-  */
+   * Return whether the line number ruler column should be 
+   * visible according to the preference store settings.
+   * @return <code>true</code> if the line numbers should be visible
+   */
   private boolean isLineNumberRulerVisible() {
-    // IPreferenceStore store= getPreferenceStore();
-    return getPreferenceStore().getBoolean(
-      IPreferenceConstants.LINE_NUMBER_RULER);
+    IPreferenceStore store = getPreferenceStore();
+    return store.getBoolean(LINE_NUMBER_RULER);
   }
   /**
    * Hides the line number ruler column.
@@ -490,54 +591,41 @@ public class PHPEditor
   }
 
   /**
-  * Initializes the given line number ruler column from the preference store.
-  * @param rulerColumn the ruler column to be initialized
-  */
+   * Initializes the given line number ruler column from the preference store.
+   * @param rulerColumn the ruler column to be initialized
+   */
   protected void initializeLineNumberRulerColumn(LineNumberRulerColumn rulerColumn) {
     JavaTextTools textTools = PHPeclipsePlugin.getDefault().getJavaTextTools();
-    // PHPColorProvider manager = PHPEditorEnvironment.getPHPColorProvider();
-    JavaColorManager manager = textTools.getColorManager();
+    IColorManager manager = textTools.getColorManager();
 
     IPreferenceStore store = getPreferenceStore();
     if (store != null) {
 
       RGB rgb = null;
       // foreground color
-      if (store.contains(IPreferenceConstants.LINE_NUMBER_COLOR)) {
-        if (store.isDefault(IPreferenceConstants.LINE_NUMBER_COLOR))
-          rgb =
-            PreferenceConverter.getDefaultColor(
-              store,
-              IPreferenceConstants.LINE_NUMBER_COLOR);
+      if (store.contains(LINE_NUMBER_COLOR)) {
+        if (store.isDefault(LINE_NUMBER_COLOR))
+          rgb = PreferenceConverter.getDefaultColor(store, LINE_NUMBER_COLOR);
         else
-          rgb =
-            PreferenceConverter.getColor(
-              store,
-              IPreferenceConstants.LINE_NUMBER_COLOR);
+          rgb = PreferenceConverter.getColor(store, LINE_NUMBER_COLOR);
       }
       rulerColumn.setForeground(manager.getColor(rgb));
 
       rgb = null;
       // background color
-      if (!store
-        .getBoolean(
-          IPreferenceConstants.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT)) {
-        if (store.contains(IPreferenceConstants.PREFERENCE_COLOR_BACKGROUND)) {
-          if (store
-            .isDefault(IPreferenceConstants.PREFERENCE_COLOR_BACKGROUND))
+      if (!store.getBoolean(PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT)) {
+        if (store.contains(PREFERENCE_COLOR_BACKGROUND)) {
+          if (store.isDefault(PREFERENCE_COLOR_BACKGROUND))
             rgb =
               PreferenceConverter.getDefaultColor(
                 store,
-                IPreferenceConstants.PREFERENCE_COLOR_BACKGROUND);
+                PREFERENCE_COLOR_BACKGROUND);
           else
             rgb =
-              PreferenceConverter.getColor(
-                store,
-                IPreferenceConstants.PREFERENCE_COLOR_BACKGROUND);
+              PreferenceConverter.getColor(store, PREFERENCE_COLOR_BACKGROUND);
         }
-        rulerColumn.setBackground(manager.getColor(rgb));
       }
-
+      rulerColumn.setBackground(manager.getColor(rgb));
     }
   }
 
@@ -568,30 +656,26 @@ public class PHPEditor
     IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
     PHPEditorEnvironment.connect(this);
 
-    setEditorContextMenuId("#PHPEditorContext"); //$NON-NLS-1$
-    setRulerContextMenuId("#PHPRulerContext"); //$NON-NLS-1$
-    // setDocumentProvider(PHPeclipsePlugin.getCompilationUnitDocumentProvider());
-
-    store.addPropertyChangeListener(new IPropertyChangeListener() {
-      public void propertyChange(PropertyChangeEvent event) {
-        PHPCodeScanner scanner = PHPEditorEnvironment.getPHPCodeScanner();
-        if (scanner != null) {
-          scanner.updateToken(PHPEditorEnvironment.getPHPColorProvider());
-        }
-        if (getSourceViewer() != null) {
-          getSourceViewer().invalidateTextPresentation();
-        }
-
-        String property = event.getProperty();
-        if (IPreferenceConstants.LINE_NUMBER_RULER.equals(property)) {
-          if (isLineNumberRulerVisible())
-            showLineNumberRuler();
-          else
-            hideLineNumberRuler();
-          return;
-        }
-      }
-    });
+    //    store.addPropertyChangeListener(new IPropertyChangeListener() {
+    //      public void propertyChange(PropertyChangeEvent event) {
+    //        PHPCodeScanner scanner = PHPEditorEnvironment.getPHPCodeScanner();
+    //        if (scanner != null) {
+    //          scanner.updateToken(PHPEditorEnvironment.getPHPColorProvider());
+    //        }
+    //        if (getSourceViewer() != null) {
+    //          getSourceViewer().invalidateTextPresentation();
+    //        }
+    //
+    //        String property = event.getProperty();
+    //        if (IPreferenceConstants.LINE_NUMBER_RULER.equals(property)) {
+    //          if (isLineNumberRulerVisible())
+    //            showLineNumberRuler();
+    //          else
+    //            hideLineNumberRuler();
+    //          return;
+    //        }
+    //      }
+    //    });
   }
 
   private static IRegion getSignedSelection(ITextViewer viewer) {
@@ -725,49 +809,52 @@ public class PHPEditor
      * @return the line's bidi segmentation
      * @throws BadLocationException in case lineOffset is not valid in document
      */
-    public static int[] getBidiLineSegments(IDocument document, int lineOffset) throws BadLocationException {
-       
-      IRegion line= document.getLineInformationOfOffset(lineOffset);
-      ITypedRegion[] linePartitioning= document.computePartitioning(lineOffset, line.getLength());
-               
-      List segmentation= new ArrayList();
-      for (int i= 0; i < linePartitioning.length; i++) {
-        if (IPHPPartitionScannerConstants.PHP_STRING.equals(linePartitioning[i].getType()))
-          segmentation.add(linePartitioning[i]);
-      }
-               
-               
-      if (segmentation.size() == 0) 
-        return null;
-                       
-      int size= segmentation.size();
-      int[] segments= new int[size * 2 + 1];
-               
-      int j= 0;
-      for (int i= 0; i < size; i++) {
-        ITypedRegion segment= (ITypedRegion) segmentation.get(i);
-                       
-        if (i == 0)
-          segments[j++]= 0;
-                               
-        int offset= segment.getOffset() - lineOffset;
-        if (offset > segments[j - 1])
-          segments[j++]= offset;
-                               
-        if (offset + segment.getLength() >= line.getLength())
-          break;
-                               
-        segments[j++]= offset + segment.getLength();
-      }
-               
-      if (j < segments.length) {
-        int[] result= new int[j];
-        System.arraycopy(segments, 0, result, 0, j);
-        segments= result;
-      }
-               
-      return segments;
+  public static int[] getBidiLineSegments(IDocument document, int lineOffset)
+    throws BadLocationException {
+
+    IRegion line = document.getLineInformationOfOffset(lineOffset);
+    ITypedRegion[] linePartitioning =
+      document.computePartitioning(lineOffset, line.getLength());
+
+    List segmentation = new ArrayList();
+    for (int i = 0; i < linePartitioning.length; i++) {
+      if (IPHPPartitionScannerConstants
+        .PHP_STRING
+        .equals(linePartitioning[i].getType()))
+        segmentation.add(linePartitioning[i]);
+    }
+
+    if (segmentation.size() == 0)
+      return null;
+
+    int size = segmentation.size();
+    int[] segments = new int[size * 2 + 1];
+
+    int j = 0;
+    for (int i = 0; i < size; i++) {
+      ITypedRegion segment = (ITypedRegion) segmentation.get(i);
+
+      if (i == 0)
+        segments[j++] = 0;
+
+      int offset = segment.getOffset() - lineOffset;
+      if (offset > segments[j - 1])
+        segments[j++] = offset;
+
+      if (offset + segment.getLength() >= line.getLength())
+        break;
+
+      segments[j++] = offset + segment.getLength();
     }
+
+    if (j < segments.length) {
+      int[] result = new int[j];
+      System.arraycopy(segments, 0, result, 0, j);
+      segments = result;
+    }
+
+    return segments;
+  }
   /**
      * Returns a segmentation of the given line appropriate for bidi rendering. The default
      * implementation returns only the string literals of a php code line as segments.
index 8eca420..f049dc2 100644 (file)
@@ -834,6 +834,10 @@ public class PHPUnitEditor extends PHPEditor {
    */
   public PHPUnitEditor() {
     super();
+    setDocumentProvider(PHPeclipsePlugin.getDefault().getCompilationUnitDocumentProvider());
+    setEditorContextMenuId("#PHPEditorContext"); //$NON-NLS-1$
+    setRulerContextMenuId("#PHPRulerContext"); //$NON-NLS-1$
+    
   }
   
   public void createPartControl(Composite parent) {
index d7c77f6..41cbee2 100644 (file)
@@ -15,11 +15,13 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Vector;
 
+import net.sourceforge.phpdt.internal.ui.text.AbstractJavaScanner;
 import net.sourceforge.phpdt.internal.ui.text.JavaColorManager;
+import net.sourceforge.phpdt.ui.text.IColorManager;
+import net.sourceforge.phpdt.ui.text.IJavaColorConstants;
 import net.sourceforge.phpeclipse.IPreferenceConstants;
 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
 import net.sourceforge.phpeclipse.phpeditor.PHPSyntaxRdr;
-import net.sourceforge.phpeclipse.phpeditor.util.PHPColorProvider;
 import net.sourceforge.phpeclipse.phpeditor.util.PHPWhitespaceDetector;
 import net.sourceforge.phpeclipse.phpeditor.util.PHPWordDetector;
 
@@ -32,7 +34,6 @@ import org.eclipse.jface.text.rules.IRule;
 import org.eclipse.jface.text.rules.IToken;
 import org.eclipse.jface.text.rules.IWordDetector;
 import org.eclipse.jface.text.rules.MultiLineRule;
-import org.eclipse.jface.text.rules.RuleBasedScanner;
 import org.eclipse.jface.text.rules.SingleLineRule;
 import org.eclipse.jface.text.rules.Token;
 import org.eclipse.jface.text.rules.WhitespaceRule;
@@ -43,17 +44,18 @@ import org.eclipse.swt.graphics.Color;
 /**
  * PHP Code Scanner
  */
-public class PHPCodeScanner extends RuleBasedScanner implements IPreferenceConstants {
+public class PHPCodeScanner
+  extends AbstractJavaScanner {
 
-  private static Token variable;
-  private static Token keyword;
-  private static Token type;
-  private static Token constant;
-  private static Token functionName;
-  private static Token string;
-  private static Token comment;
-  private static Token multi_comment;
-  private static Token other;
+//  private static Token variable;
+//  private static Token keyword;
+//  private static Token type;
+//  private static Token constant;
+//  private static Token functionName;
+//  private static Token string;
+//  private static Token comment;
+//  private static Token multi_comment;
+//  private static Token other;
 
   private class PHPWordRule extends WordRule {
     private StringBuffer fBuffer = new StringBuffer();
@@ -79,11 +81,12 @@ public class PHPCodeScanner extends RuleBasedScanner implements IPreferenceConst
           do {
             fBuffer.append((char) c);
             c = scanner.read();
-          } while (c != ICharacterScanner.EOF && fDetector.isWordPart((char) c));
+          } while (
+            c != ICharacterScanner.EOF && fDetector.isWordPart((char) c));
           scanner.unread();
 
           if (isVariable) {
-            return variable;
+            return getToken(IJavaColorConstants.PHP_VARIABLE);
           }
           IToken token = (IToken) fWords.get(fBuffer.toString());
           if (token != null)
@@ -101,154 +104,187 @@ public class PHPCodeScanner extends RuleBasedScanner implements IPreferenceConst
     }
   }
 
-  private PHPColorProvider fColorProvider;
+  //private PHPColorProvider fColorProvider;
 
+  private static String[] fgTokenProperties = {
+    IJavaColorConstants.PHP_MULTI_LINE_COMMENT,
+    IJavaColorConstants.PHP_SINGLE_LINE_COMMENT,
+    IJavaColorConstants.PHP_KEYWORD,
+    IJavaColorConstants.PHP_FUNCTIONNAME,
+    IJavaColorConstants.PHP_VARIABLE,
+    IJavaColorConstants.PHP_STRING,
+    IJavaColorConstants.PHP_TYPE,
+    IJavaColorConstants.PHP_CONSTANT,
+    IJavaColorConstants.PHP_DEFAULT };
   /**
        * Creates a PHP code scanner
        */
-  public PHPCodeScanner(JavaColorManager provider, IPreferenceStore store) {
-  //  final IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
-    Color BackgroundColor = provider.getColor(PreferenceConverter.getColor(store, PHP_EDITOR_BACKGROUND));
-    variable =
-      new Token(
-        new TextAttribute(
-          provider.getColor(PreferenceConverter.getColor(store, PHP_VARIABLE)),
-          BackgroundColor,
-          (store.getBoolean(PHP_VARIABLE_BOLD) ? SWT.BOLD : SWT.NONE)
-            + (store.getBoolean(PHP_VARIABLE_ITALIC) ? SWT.ITALIC : SWT.NONE)));
-      keyword =
-        new Token(new TextAttribute(
-          provider.getColor(PreferenceConverter.getColor(store, PHP_KEYWORD)),
-          BackgroundColor,
-    //SWT.NONE));
-   (store.getBoolean(PHP_KEYWORD_BOLD) ? SWT.BOLD : SWT.NONE) + (store.getBoolean(PHP_KEYWORD_ITALIC) ? SWT.ITALIC : SWT.NONE)));
-      type =
-        new Token(new TextAttribute(
-          provider.getColor(PreferenceConverter.getColor(store, PHP_TYPE)),
-          BackgroundColor,
-    //SWT.NONE));
-   (store.getBoolean(PHP_TYPE_BOLD) ? SWT.BOLD : SWT.NONE) + (store.getBoolean(PHP_TYPE_ITALIC) ? SWT.ITALIC : SWT.NONE)));
-      functionName =
-        new Token(new TextAttribute(
-          provider.getColor(PreferenceConverter.getColor(store, PHP_FUNCTIONNAME)),
-          BackgroundColor,
-    //SWT.NONE));
-  (store.getBoolean(PHP_FUNCTIONNAME_BOLD) ? SWT.BOLD : SWT.NONE)
-    + (store.getBoolean(PHP_FUNCTIONNAME_ITALIC) ? SWT.ITALIC : SWT.NONE)));
-      constant =
-        new Token(new TextAttribute(
-          provider.getColor(PreferenceConverter.getColor(store, PHP_CONSTANT)),
-          BackgroundColor,
-    //SWT.NONE));
-   (store.getBoolean(PHP_CONSTANT_BOLD) ? SWT.BOLD : SWT.NONE) + (store.getBoolean(PHP_CONSTANT_ITALIC) ? SWT.ITALIC : SWT.NONE)));
-      string =
-        new Token(new TextAttribute(
-          provider.getColor(PreferenceConverter.getColor(store, PHP_STRING)),
-          BackgroundColor,
-    //SWT.NONE));
-   (store.getBoolean(PHP_STRING_BOLD) ? SWT.BOLD : SWT.NONE ) + (store.getBoolean(PHP_STRING_ITALIC) ? SWT.ITALIC : SWT.NONE)));
-      comment =
-        new Token(new TextAttribute(
-          provider.getColor(PreferenceConverter.getColor(store, PHP_SINGLELINE_COMMENT)),
-          BackgroundColor,
-    //SWT.NONE));
-  (store.getBoolean(PHP_SINGLELINE_COMMENT_BOLD) ? SWT.BOLD : SWT.NONE )
-    + (store.getBoolean(PHP_SINGLELINE_COMMENT_ITALIC) ? SWT.ITALIC : SWT.NONE)));
-      multi_comment =
-        new Token(new TextAttribute(
-          provider.getColor(PreferenceConverter.getColor(store, PHP_MULTILINE_COMMENT)),
-          BackgroundColor,
-    //SWT.NONE));
-  (store.getBoolean(PHP_MULTILINE_COMMENT_BOLD) ? SWT.BOLD : SWT.NONE)
-    + (store.getBoolean(PHP_MULTILINE_COMMENT_ITALIC) ? SWT.ITALIC : SWT.NONE)));
-      other =
-        new Token(new TextAttribute(
-          provider.getColor(PreferenceConverter.getColor(store, PHP_DEFAULT)),
-          BackgroundColor,
-    //SWT.NONE));
-   (store.getBoolean(PHP_DEFAULT_BOLD) ? SWT.BOLD : SWT.NONE) + (store.getBoolean(PHP_DEFAULT_ITALIC) ? SWT.ITALIC : SWT.NONE)));
-    updateWordRules();
+  // public PHPCodeScanner(JavaColorManager provider, IPreferenceStore store) {
+  public PHPCodeScanner(IColorManager manager, IPreferenceStore store) {
+    super(manager, store);
+    initialize();
+    //  //  final IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
+    //   Color BackgroundColor = provider.getColor(PreferenceConverter.getColor(store, PHP_EDITOR_BACKGROUND));
+    //    variable =
+    //      new Token(
+    //        new TextAttribute(
+    //          provider.getColor(PreferenceConverter.getColor(store, PHP_VARIABLE)),
+    //          BackgroundColor,
+    //          (store.getBoolean(PHP_VARIABLE_BOLD) ? SWT.BOLD : SWT.NONE)
+    //            + (store.getBoolean(PHP_VARIABLE_ITALIC) ? SWT.ITALIC : SWT.NONE)));
+    //      keyword =
+    //        new Token(new TextAttribute(
+    //          provider.getColor(PreferenceConverter.getColor(store, PHP_KEYWORD)),
+    //          BackgroundColor,
+    //    //SWT.NONE));
+    //   (store.getBoolean(PHP_KEYWORD_BOLD) ? SWT.BOLD : SWT.NONE) + (store.getBoolean(PHP_KEYWORD_ITALIC) ? SWT.ITALIC : SWT.NONE)));
+    //      type =
+    //        new Token(new TextAttribute(
+    //          provider.getColor(PreferenceConverter.getColor(store, PHP_TYPE)),
+    //          BackgroundColor,
+    //    //SWT.NONE));
+    //   (store.getBoolean(PHP_TYPE_BOLD) ? SWT.BOLD : SWT.NONE) + (store.getBoolean(PHP_TYPE_ITALIC) ? SWT.ITALIC : SWT.NONE)));
+    //      functionName =
+    //        new Token(new TextAttribute(
+    //          provider.getColor(PreferenceConverter.getColor(store, PHP_FUNCTIONNAME)),
+    //          BackgroundColor,
+    //    //SWT.NONE));
+    //  (store.getBoolean(PHP_FUNCTIONNAME_BOLD) ? SWT.BOLD : SWT.NONE)
+    //    + (store.getBoolean(PHP_FUNCTIONNAME_ITALIC) ? SWT.ITALIC : SWT.NONE)));
+    //      constant =
+    //        new Token(new TextAttribute(
+    //          provider.getColor(PreferenceConverter.getColor(store, PHP_CONSTANT)),
+    //          BackgroundColor,
+    //    //SWT.NONE));
+    //   (store.getBoolean(PHP_CONSTANT_BOLD) ? SWT.BOLD : SWT.NONE) + (store.getBoolean(PHP_CONSTANT_ITALIC) ? SWT.ITALIC : SWT.NONE)));
+    //      string =
+    //        new Token(new TextAttribute(
+    //          provider.getColor(PreferenceConverter.getColor(store, PHP_STRING)),
+    //          BackgroundColor,
+    //    //SWT.NONE));
+    //   (store.getBoolean(PHP_STRING_BOLD) ? SWT.BOLD : SWT.NONE ) + (store.getBoolean(PHP_STRING_ITALIC) ? SWT.ITALIC : SWT.NONE)));
+    //      comment =
+    //        new Token(new TextAttribute(
+    //          provider.getColor(PreferenceConverter.getColor(store, PHP_SINGLELINE_COMMENT)),
+    //          BackgroundColor,
+    //    //SWT.NONE));
+    //  (store.getBoolean(PHP_SINGLELINE_COMMENT_BOLD) ? SWT.BOLD : SWT.NONE )
+    //    + (store.getBoolean(PHP_SINGLELINE_COMMENT_ITALIC) ? SWT.ITALIC : SWT.NONE)));
+    //      multi_comment =
+    //        new Token(new TextAttribute(
+    //          provider.getColor(PreferenceConverter.getColor(store, PHP_MULTILINE_COMMENT)),
+    //          BackgroundColor,
+    //    //SWT.NONE));
+    //  (store.getBoolean(PHP_MULTILINE_COMMENT_BOLD) ? SWT.BOLD : SWT.NONE)
+    //    + (store.getBoolean(PHP_MULTILINE_COMMENT_ITALIC) ? SWT.ITALIC : SWT.NONE)));
+    //      other =
+    //        new Token(new TextAttribute(
+    //          provider.getColor(PreferenceConverter.getColor(store, PHP_DEFAULT)),
+    //          BackgroundColor,
+    //    //SWT.NONE));
+    //   (store.getBoolean(PHP_DEFAULT_BOLD) ? SWT.BOLD : SWT.NONE) + (store.getBoolean(PHP_DEFAULT_ITALIC) ? SWT.ITALIC : SWT.NONE)));
+    //    updateWordRules();
   }
 
-  public void updateToken(JavaColorManager provider) {
-    final IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
+  //  public void updateToken(JavaColorManager provider) {
+  //    final IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
+  //
+  //    Color BackgroundColor = provider.getColor(PreferenceConverter.getColor(store, PHP_EDITOR_BACKGROUND));
+  //
+  //    variable.setData(
+  //      new TextAttribute(
+  //        provider.getColor(PreferenceConverter.getColor(store, PHP_VARIABLE)),
+  //        BackgroundColor,
+  //        (store.getBoolean(PHP_VARIABLE_BOLD) ? SWT.BOLD : SWT.NONE)
+  //          + (store.getBoolean(PHP_VARIABLE_ITALIC) ? SWT.ITALIC : SWT.NONE)));
+  //    keyword.setData(
+  //      new TextAttribute(
+  //        provider.getColor(PreferenceConverter.getColor(store, PHP_KEYWORD)),
+  //        BackgroundColor,
+  //        (store.getBoolean(PHP_KEYWORD_BOLD) ? SWT.BOLD : SWT.NONE)
+  //          + (store.getBoolean(PHP_KEYWORD_ITALIC) ? SWT.ITALIC : SWT.NONE)));
+  //    type.setData(
+  //      new TextAttribute(
+  //        provider.getColor(PreferenceConverter.getColor(store, PHP_TYPE)),
+  //        BackgroundColor,
+  //        (store.getBoolean(PHP_TYPE_BOLD) ? SWT.BOLD : SWT.NONE) + (store.getBoolean(PHP_TYPE_ITALIC) ? SWT.ITALIC : SWT.NONE)));
+  //    functionName.setData(
+  //      new TextAttribute(
+  //        provider.getColor(PreferenceConverter.getColor(store, PHP_FUNCTIONNAME)),
+  //        BackgroundColor,
+  //        (store.getBoolean(PHP_FUNCTIONNAME_BOLD) ? SWT.BOLD : SWT.NONE)
+  //          + (store.getBoolean(PHP_FUNCTIONNAME_ITALIC) ? SWT.ITALIC : SWT.NONE)));
+  //    constant.setData(
+  //      new TextAttribute(
+  //        provider.getColor(PreferenceConverter.getColor(store, PHP_CONSTANT)),
+  //        BackgroundColor,
+  //        (store.getBoolean(PHP_CONSTANT_BOLD) ? SWT.BOLD : SWT.NONE)
+  //          + (store.getBoolean(PHP_CONSTANT_ITALIC) ? SWT.ITALIC : SWT.NONE)));
+  //    string.setData(
+  //      new TextAttribute(
+  //        provider.getColor(PreferenceConverter.getColor(store, PHP_STRING)),
+  //        BackgroundColor,
+  //        (store.getBoolean(PHP_STRING_BOLD) ? SWT.BOLD : SWT.NONE) + (store.getBoolean(PHP_STRING_ITALIC) ? SWT.ITALIC : SWT.NONE)));
+  //    comment.setData(
+  //      new TextAttribute(
+  //        provider.getColor(PreferenceConverter.getColor(store, PHP_SINGLELINE_COMMENT)),
+  //        BackgroundColor,
+  //        (store.getBoolean(PHP_SINGLELINE_COMMENT_BOLD) ? SWT.BOLD : SWT.NONE)
+  //          + (store.getBoolean(PHP_SINGLELINE_COMMENT_ITALIC) ? SWT.ITALIC : SWT.NONE)));
+  //    multi_comment.setData(
+  //      new TextAttribute(
+  //        provider.getColor(PreferenceConverter.getColor(store, PHP_MULTILINE_COMMENT)),
+  //        BackgroundColor,
+  //        (store.getBoolean(PHP_MULTILINE_COMMENT_BOLD) ? SWT.BOLD : SWT.NONE)
+  //          + (store.getBoolean(PHP_MULTILINE_COMMENT_ITALIC) ? SWT.ITALIC : SWT.NONE)));
+  //    other.setData(
+  //      new TextAttribute(
+  //        provider.getColor(PreferenceConverter.getColor(store, PHP_DEFAULT)),
+  //        BackgroundColor,
+  //        (store.getBoolean(PHP_DEFAULT_BOLD) ? SWT.BOLD : SWT.NONE)
+  //          + (store.getBoolean(PHP_DEFAULT_ITALIC) ? SWT.ITALIC : SWT.NONE)));
+  //  }
 
-    Color BackgroundColor = provider.getColor(PreferenceConverter.getColor(store, PHP_EDITOR_BACKGROUND));
+  // public void updateWordRules() {
 
-    variable.setData(
-      new TextAttribute(
-        provider.getColor(PreferenceConverter.getColor(store, PHP_VARIABLE)),
-        BackgroundColor,
-        (store.getBoolean(PHP_VARIABLE_BOLD) ? SWT.BOLD : SWT.NONE)
-          + (store.getBoolean(PHP_VARIABLE_ITALIC) ? SWT.ITALIC : SWT.NONE)));
-    keyword.setData(
-      new TextAttribute(
-        provider.getColor(PreferenceConverter.getColor(store, PHP_KEYWORD)),
-        BackgroundColor,
-        (store.getBoolean(PHP_KEYWORD_BOLD) ? SWT.BOLD : SWT.NONE)
-          + (store.getBoolean(PHP_KEYWORD_ITALIC) ? SWT.ITALIC : SWT.NONE)));
-    type.setData(
-      new TextAttribute(
-        provider.getColor(PreferenceConverter.getColor(store, PHP_TYPE)),
-        BackgroundColor,
-        (store.getBoolean(PHP_TYPE_BOLD) ? SWT.BOLD : SWT.NONE) + (store.getBoolean(PHP_TYPE_ITALIC) ? SWT.ITALIC : SWT.NONE)));
-    functionName.setData(
-      new TextAttribute(
-        provider.getColor(PreferenceConverter.getColor(store, PHP_FUNCTIONNAME)),
-        BackgroundColor,
-        (store.getBoolean(PHP_FUNCTIONNAME_BOLD) ? SWT.BOLD : SWT.NONE)
-          + (store.getBoolean(PHP_FUNCTIONNAME_ITALIC) ? SWT.ITALIC : SWT.NONE)));
-    constant.setData(
-      new TextAttribute(
-        provider.getColor(PreferenceConverter.getColor(store, PHP_CONSTANT)),
-        BackgroundColor,
-        (store.getBoolean(PHP_CONSTANT_BOLD) ? SWT.BOLD : SWT.NONE)
-          + (store.getBoolean(PHP_CONSTANT_ITALIC) ? SWT.ITALIC : SWT.NONE)));
-    string.setData(
-      new TextAttribute(
-        provider.getColor(PreferenceConverter.getColor(store, PHP_STRING)),
-        BackgroundColor,
-        (store.getBoolean(PHP_STRING_BOLD) ? SWT.BOLD : SWT.NONE) + (store.getBoolean(PHP_STRING_ITALIC) ? SWT.ITALIC : SWT.NONE)));
-    comment.setData(
-      new TextAttribute(
-        provider.getColor(PreferenceConverter.getColor(store, PHP_SINGLELINE_COMMENT)),
-        BackgroundColor,
-        (store.getBoolean(PHP_SINGLELINE_COMMENT_BOLD) ? SWT.BOLD : SWT.NONE)
-          + (store.getBoolean(PHP_SINGLELINE_COMMENT_ITALIC) ? SWT.ITALIC : SWT.NONE)));
-    multi_comment.setData(
-      new TextAttribute(
-        provider.getColor(PreferenceConverter.getColor(store, PHP_MULTILINE_COMMENT)),
-        BackgroundColor,
-        (store.getBoolean(PHP_MULTILINE_COMMENT_BOLD) ? SWT.BOLD : SWT.NONE)
-          + (store.getBoolean(PHP_MULTILINE_COMMENT_ITALIC) ? SWT.ITALIC : SWT.NONE)));
-    other.setData(
-      new TextAttribute(
-        provider.getColor(PreferenceConverter.getColor(store, PHP_DEFAULT)),
-        BackgroundColor,
-        (store.getBoolean(PHP_DEFAULT_BOLD) ? SWT.BOLD : SWT.NONE)
-          + (store.getBoolean(PHP_DEFAULT_ITALIC) ? SWT.ITALIC : SWT.NONE)));
+  /*
+   * @see AbstractJavaScanner#getTokenProperties()
+   */
+  protected String[] getTokenProperties() {
+    return fgTokenProperties;
   }
-
-  public void updateWordRules() {
+  /*
+   * @see AbstractJavaScanner#createRules()
+   */
+  protected List createRules() {
     List rules = new ArrayList();
+    Token token= getToken(IJavaColorConstants.PHP_SINGLE_LINE_COMMENT);
     // Add rule for single line comments.
-    rules.add(new EndOfLineRule("//", comment)); //$NON-NLS-1$
-    rules.add(new EndOfLineRule("#", comment));
+    rules.add(new EndOfLineRule("//", token)); //$NON-NLS-1$
+    rules.add(new EndOfLineRule("#", token));
     // Add rule for strings and character constants.
-    rules.add(new MultiLineRule("\"", "\"", string, '\\')); //$NON-NLS-2$ //$NON-NLS-1$
-    rules.add(new SingleLineRule("'", "'", string, '\\')); //$NON-NLS-2$ //$NON-NLS-1$
-    // rules.add(new SingleLineRule("//", "//", php_comment));
-    rules.add(new MultiLineRule("/*", "*/", multi_comment));
+    token= getToken(IJavaColorConstants.PHP_STRING);
+    rules.add(new MultiLineRule("\"", "\"", token, '\\')); //$NON-NLS-2$ //$NON-NLS-1$
+    rules.add(new SingleLineRule("'", "'", token, '\\')); //$NON-NLS-2$ //$NON-NLS-1$
+    token= getToken(IJavaColorConstants.PHP_MULTI_LINE_COMMENT);
+    rules.add(new MultiLineRule("/*", "*/", token));
     // Add generic whitespace rule.
     rules.add(new WhitespaceRule(new PHPWhitespaceDetector()));
     // Add word rule for keywords, types, and constants.
-    PHPWordRule wordRule = new PHPWordRule(new PHPWordDetector(), other);
+    token= getToken(IJavaColorConstants.PHP_DEFAULT);
+    PHPWordRule wordRule = new PHPWordRule(new PHPWordDetector(), token);
 
+    Token keyword= getToken(IJavaColorConstants.PHP_KEYWORD);
+    Token functionName= getToken(IJavaColorConstants.PHP_FUNCTIONNAME);
+    Token type= getToken(IJavaColorConstants.PHP_TYPE);
+    Token constant= getToken(IJavaColorConstants.PHP_CONSTANT);
     PHPSyntaxRdr.readInSyntax();
     Vector buffer = PHPSyntaxRdr.getsyntaxdata();
     String strbuffer = null;
     PHPElement elbuffer = null;
-    while ((buffer != null) && (!buffer.isEmpty() && ((elbuffer = (PHPElement) buffer.remove(0)) != null))) {
+    while ((buffer != null)
+      && (!buffer.isEmpty()
+        && ((elbuffer = (PHPElement) buffer.remove(0)) != null))) {
       if (elbuffer instanceof PHPKeyword)
         wordRule.addWord(((PHPKeyword) elbuffer).getName(), keyword);
       if (elbuffer instanceof PHPFunction)
@@ -260,7 +296,8 @@ public class PHPCodeScanner extends RuleBasedScanner implements IPreferenceConst
     }
     rules.add(wordRule);
     IRule[] result = new IRule[rules.size()];
-    rules.toArray(result);
-    setRules(result);
+    //    rules.toArray(result);
+    //    setRules(result);
+    return rules;
   }
 }
index c4fb644..9880c6e 100644 (file)
@@ -8,8 +8,8 @@ package net.sourceforge.phpeclipse.phpeditor.php;
  * To enable and disable the creation of type comments go to
  * Window>Preferences>Java>Code Generation.
  */
-public class PHPType extends PHPElement{
-       public PHPType(String Name, String Description){
-       super(Name, Description);
-       }
+public class PHPType extends PHPElement {
+  public PHPType(String Name, String Description) {
+    super(Name, Description);
+  }
 }
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/util/HTMLColorProvider.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/util/HTMLColorProvider.java
deleted file mode 100644 (file)
index 57bf9dd..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/**********************************************************************
-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.phpeclipse.phpeditor.util;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.widgets.Display;
-/**
- * Manager for colors used in the Java editor
- */
-public class HTMLColorProvider {
-
-       public static final RGB MULTI_LINE_COMMENT= new RGB(128, 0, 0);
-       public static final RGB SINGLE_LINE_COMMENT= new RGB(128, 128, 0);
-       public static final RGB KEYWORD= new RGB(127, 0, 85);
-  public static final RGB VARIABLE= new RGB(127, 159, 191);
-       public static final RGB TYPE= new RGB(0, 0, 128);
-       public static final RGB STRING= new RGB(42, 0, 255);
-       public static final RGB DEFAULT= new RGB(0, 0, 0);
-  public static final RGB HTML_DEFAULT= new RGB(0, 128, 128);
-
-
-       protected Map fColorTable= new HashMap(10);
-
-       /**
-        * Release all of the color resources held onto by the receiver.
-        */     
-       public void dispose() {
-               Iterator e= fColorTable.values().iterator();
-               while (e.hasNext())
-                        ((Color) e.next()).dispose();
-       }
-       
-       /**
-        * Return the Color that is stored in the Color table as rgb.
-        */
-       public Color getColor(RGB rgb) {
-               Color color= (Color) fColorTable.get(rgb);
-               if (color == null) {
-                       color= new Color(Display.getCurrent(), rgb);
-                       fColorTable.put(rgb, color);
-               }
-               return color;
-       }
-}
index b4cc40c..3439c15 100644 (file)
@@ -34,15 +34,15 @@ public class PHPColorProvider {
   public static final RGB CONSTANT = new RGB(127, 0, 85);
   public static final RGB BACKGROUND = new RGB(255, 255, 255);
 
-  public static final RGB LINKED_POSITION_COLOR = new RGB(0, 0, 0);
+ // public static final RGB LINKED_POSITION_COLOR = new RGB(0, 0, 0);
 
-  public static final RGB LINE_NUMBER_COLOR = new RGB(0, 0, 0);
-  public static final RGB BACKGROUND_COLOR = new RGB(255, 255, 255);
+//  public static final RGB LINE_NUMBER_COLOR = new RGB(0, 0, 0);
+//  public static final RGB BACKGROUND_COLOR = new RGB(255, 255, 255);
   
-  public static final RGB PHPDOC_TAG = new RGB(63, 127, 95);
-  public static final RGB PHPDOC_LINK = new RGB(63, 63, 191);
-  public static final RGB PHPDOC_DEFAULT = new RGB(63, 95, 191);
-  public static final RGB PHPDOC_KEYWORD = new RGB(127, 159, 191);
+//  public static final RGB PHPDOC_TAG = new RGB(63, 127, 95);
+//  public static final RGB PHPDOC_LINK = new RGB(63, 63, 191);
+//  public static final RGB PHPDOC_DEFAULT = new RGB(63, 95, 191);
+//  public static final RGB PHPDOC_KEYWORD = new RGB(127, 159, 191);
   
   protected Map fColorTable = new HashMap(10);