different syntax highlighting for single and double quoted strings
authoraxelcl <axelcl>
Sun, 15 May 2005 23:28:28 +0000 (23:28 +0000)
committeraxelcl <axelcl>
Sun, 15 May 2005 23:28:28 +0000 (23:28 +0000)
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/JavaEditorPreferencePage.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/PreferencesMessages.properties
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/FastJavaPartitionScanner.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/PreferenceConstants.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/preferences/PHPPreferencesMessages.properties

index 61abec9..23ce056 100644 (file)
@@ -113,7 +113,8 @@ public class JavaEditorPreferencePage extends PreferencePage implements IWorkben
       //$NON-NLS-1$
       { PreferencesMessages.getString("JavaEditorPreferencePage.types"), PreferenceConstants.EDITOR_PHP_TYPE_COLOR },
       //$NON-NLS-1$
-      { PreferencesMessages.getString("JavaEditorPreferencePage.strings"), PreferenceConstants.EDITOR_STRING_COLOR },
+      { PreferencesMessages.getString("JavaEditorPreferencePage.strings_dq"), PreferenceConstants.EDITOR_STRING_COLOR_DQ },
+      { PreferencesMessages.getString("JavaEditorPreferencePage.strings_sq"), PreferenceConstants.EDITOR_STRING_COLOR_SQ },
       //$NON-NLS-1$
       { PreferencesMessages.getString("JavaEditorPreferencePage.others"), PreferenceConstants.EDITOR_JAVA_DEFAULT_COLOR }, //$NON-NLS-1$
       { PreferencesMessages.getString("JavaEditorPreferencePage.operators"), PreferenceConstants.EDITOR_PHP_OPERATOR_COLOR },
@@ -338,8 +339,10 @@ public class JavaEditorPreferencePage extends PreferencePage implements IWorkben
     overlayKeys
         .add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_PHP_TYPE_BOLD));
 
-    overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_STRING_COLOR));
-    overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_STRING_BOLD));
+    overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_STRING_COLOR_DQ));
+    overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_STRING_BOLD_DQ));
+    overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_STRING_COLOR_SQ));
+    overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_STRING_BOLD_SQ));
     overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
         PreferenceConstants.EDITOR_JAVA_DEFAULT_COLOR));
     overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
@@ -349,7 +352,7 @@ public class JavaEditorPreferencePage extends PreferencePage implements IWorkben
     overlayKeys
         .add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_TASK_TAG_BOLD));
     //         overlayKeys.add(new
-    // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+    // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING_DQ,
     // PreferenceConstants.EDITOR_JAVA_METHOD_NAME_COLOR));
     //         overlayKeys.add(new
     // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
index 16cd94b..2d4aa0e 100644 (file)
@@ -105,7 +105,8 @@ JavaEditorPreferencePage.functionNames=Predefined function names
 JavaEditorPreferencePage.variables=Variables
 JavaEditorPreferencePage.constants=Constants
 JavaEditorPreferencePage.types=Types
-JavaEditorPreferencePage.strings=Strings
+JavaEditorPreferencePage.strings_dq=Double Quoted Strings
+JavaEditorPreferencePage.strings_sq=Single Quoted Strings
 JavaEditorPreferencePage.others=Others
 JavaEditorPreferencePage.methodNames=Method names
 JavaEditorPreferencePage.operators=Operators, brackets excluding '{}'
index ec8321f..663757f 100644 (file)
@@ -42,7 +42,7 @@ public class FastJavaPartitionScanner implements IPartitionTokenScanner, IPHPPar
   // beginning of prefixes and postfixes
   private static final int NONE = 0;
 
-  private static final int BACKSLASH = 1; // postfix for STRING and CHARACTER
+  private static final int BACKSLASH = 1; // postfix for STRING_DQ and CHARACTER
 
   private static final int SLASH = 2; // prefix for SINGLE_LINE or MULTI_LINE or JAVADOC
 
@@ -52,7 +52,7 @@ public class FastJavaPartitionScanner implements IPartitionTokenScanner, IPHPPar
 
   private static final int STAR = 5; // postfix for MULTI_LINE_COMMENT or JAVADOC
 
-  private static final int CARRIAGE_RETURN = 6; // postfix for STRING, CHARACTER and SINGLE_LINE_COMMENT
+  private static final int CARRIAGE_RETURN = 6; // postfix for STRING_DQ, CHARACTER and SINGLE_LINE_COMMENT
 
   /** The scanner. */
   private final BufferedDocumentScanner fScanner = new BufferedDocumentScanner(1000); // faster implementation
index 15796fe..a66dd95 100644 (file)
@@ -15,6 +15,7 @@ import net.sourceforge.phpdt.internal.ui.text.spelling.SpellCheckEngine;
 import net.sourceforge.phpdt.internal.ui.text.spelling.engine.ISpellCheckPreferenceKeys;
 import net.sourceforge.phpeclipse.IPreferenceConstants;
 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
+import net.sourceforge.phpeclipse.phpeditor.util.PHPColorProvider;
 
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.preference.IPreferenceStore;
@@ -1316,7 +1317,7 @@ public class PreferenceConstants {
    * @see org.eclipse.jface.resource.StringConverter
    * @see org.eclipse.jface.preference.PreferenceConverter
    */
-  public final static String EDITOR_STRING_COLOR = IPreferenceConstants.PHP_STRING;
+  public final static String EDITOR_STRING_COLOR_DQ = IPreferenceConstants.PHP_STRING_DQ;
 
   /**
    * A named preference that controls whether string constants are rendered in bold.
@@ -1324,7 +1325,17 @@ public class PreferenceConstants {
    * Value is of type <code>Boolean</code>.
    * </p>
    */
-  public final static String EDITOR_STRING_BOLD = IPreferenceConstants.PHP_STRING + EDITOR_BOLD_SUFFIX;
+  public final static String EDITOR_STRING_BOLD_DQ = IPreferenceConstants.PHP_STRING_DQ + EDITOR_BOLD_SUFFIX;
+
+  public final static String EDITOR_STRING_COLOR_SQ = IPreferenceConstants.PHP_STRING_SQ;
+
+  /**
+   * 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_SQ = IPreferenceConstants.PHP_STRING_SQ + EDITOR_BOLD_SUFFIX;
 
   /**
    * A named preference that holds the color used to render php default text.
@@ -2397,9 +2408,12 @@ public class PreferenceConstants {
     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_STRING_COLOR_DQ, PHPColorProvider.STRING_DQ);
+    store.setDefault(PreferenceConstants.EDITOR_STRING_BOLD_DQ, true);
 
+    PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_STRING_COLOR_SQ, PHPColorProvider.STRING_SQ);
+    store.setDefault(PreferenceConstants.EDITOR_STRING_BOLD_SQ, false);
+    
     PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_JAVA_DEFAULT_COLOR, new RGB(0, 0, 0));
     store.setDefault(PreferenceConstants.EDITOR_JAVA_DEFAULT_BOLD, false);
 
index 7706c8c..e9278cf 100644 (file)
@@ -250,14 +250,22 @@ public interface IPreferenceConstants {
 
   public static final String PHP_FUNCTIONNAME_UNDERLINE = "_php_functionname_underline";//$NON-NLS-1$
 
-  public static final String PHP_STRING = "_php_string";//$NON-NLS-1$
+  public static final String PHP_STRING_DQ = "_php_string";//$NON-NLS-1$
 
-  public static final String PHP_STRING_BOLD = "_php_string_bold";
+  public static final String PHP_STRING_BOLD_DQ = "_php_string_bold";
 
-  public static final String PHP_STRING_ITALIC = "_php_string_italic";
+  public static final String PHP_STRING_ITALIC_DQ = "_php_string_italic";
 
-  public static final String PHP_STRING_UNDERLINE = "_php_string_underline";
+  public static final String PHP_STRING_UNDERLINE_DQ = "_php_string_underline";
 
+  public static final String PHP_STRING_SQ = "_php_string_sq";//$NON-NLS-1$
+
+  public static final String PHP_STRING_BOLD_SQ = "_php_string_sq_bold";
+
+  public static final String PHP_STRING_ITALIC_SQ = "_php_string_sq_italic";
+
+  public static final String PHP_STRING_UNDERLINE_SQ = "_php_string_sq_underline";
+  
   public static final String PHP_DEFAULT = "_php_default";
 
   public static final String PHP_DEFAULT_BOLD = "_php_default_bold";
index 63c5c41..2a8f746 100644 (file)
@@ -67,10 +67,14 @@ public class PHPSyntaxEditorPreferencePage extends PreferencePage implements IWo
       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_FUNCTIONNAME_BOLD),
       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_FUNCTIONNAME_ITALIC),
       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_FUNCTIONNAME_UNDERLINE),
-      new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, IPreferenceConstants.PHP_STRING),
-      new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_STRING_BOLD),
-      new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_STRING_ITALIC),
-      new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_STRING_UNDERLINE),
+      new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, IPreferenceConstants.PHP_STRING_DQ),
+      new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_STRING_BOLD_DQ),
+      new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_STRING_ITALIC_DQ),
+      new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_STRING_UNDERLINE_DQ),
+      new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, IPreferenceConstants.PHP_STRING_SQ),
+      new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_STRING_BOLD_SQ),
+      new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_STRING_ITALIC_SQ),
+      new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_STRING_UNDERLINE_SQ),
       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, IPreferenceConstants.PHP_DEFAULT),
       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_DEFAULT_BOLD),
       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_DEFAULT_ITALIC),
@@ -94,7 +98,7 @@ public class PHPSyntaxEditorPreferencePage extends PreferencePage implements IWo
                        new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHPDOC_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_DQ, IPreferenceConstants.PHP_EDITOR_BACKGROUND)
   };
 
   private final String[][] SyntaxColorListModel =
@@ -110,8 +114,9 @@ public class PHPSyntaxEditorPreferencePage extends PreferencePage implements IWo
       PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.variables"), IPreferenceConstants.PHP_VARIABLE }, {
       PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.types"), IPreferenceConstants.PHP_TYPE }, {
       PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.constants"), IPreferenceConstants.PHP_CONSTANT }, {
-        PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.functions"), IPreferenceConstants.PHP_FUNCTIONNAME }, {
-      PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.strings"), IPreferenceConstants.PHP_STRING }, {
+      PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.functions"), IPreferenceConstants.PHP_FUNCTIONNAME }, {
+      PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.strings_dq"), IPreferenceConstants.PHP_STRING_DQ }, {
+      PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.strings_sq"), IPreferenceConstants.PHP_STRING_SQ }, {
       PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.others"), IPreferenceConstants.PHP_DEFAULT }, {
          PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.phpdoc_keywords"), IPreferenceConstants.PHPDOC_KEYWORD }, {
          PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.phpdoc_tags"), IPreferenceConstants.PHPDOC_TAG }, {
index 92cf76f..495d57d 100644 (file)
@@ -769,15 +769,17 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon
     // php syntax highlighting
     store.setDefault(PHP_USERDEF_XMLFILE, "");
     //assume there is none chooA
-    PreferenceConverter.setDefault(store, PHP_MULTILINE_COMMENT, PHPColorProvider.MULTI_LINE_COMMENT);
-    PreferenceConverter.setDefault(store, PHP_SINGLELINE_COMMENT, PHPColorProvider.SINGLE_LINE_COMMENT);
+//    PreferenceConverter.setDefault(store, PHP_MULTILINE_COMMENT, PHPColorProvider.MULTI_LINE_COMMENT);
+//    PreferenceConverter.setDefault(store, PHP_SINGLELINE_COMMENT, PHPColorProvider.SINGLE_LINE_COMMENT);
     PreferenceConverter.setDefault(store, PHP_TAG, PHPColorProvider.TAG);
     PreferenceConverter.setDefault(store, PHP_KEYWORD, PHPColorProvider.KEYWORD);
     PreferenceConverter.setDefault(store, PHP_VARIABLE, PHPColorProvider.VARIABLE);
     PreferenceConverter.setDefault(store, PHP_FUNCTIONNAME, PHPColorProvider.FUNCTION_NAME);
     PreferenceConverter.setDefault(store, PHP_CONSTANT, PHPColorProvider.CONSTANT);
     PreferenceConverter.setDefault(store, PHP_TYPE, PHPColorProvider.TYPE);
-    PreferenceConverter.setDefault(store, PHP_STRING, PHPColorProvider.STRING);
+//    PreferenceConverter.setDefault(store, PHP_STRING_DQ, PHPColorProvider.STRING_DQ);
+//    store.setDefault(PHP_STRING_BOLD_DQ, true); 
+//    PreferenceConverter.setDefault(store, PHP_STRING_SQ, PHPColorProvider.STRING_SQ); 
     PreferenceConverter.setDefault(store, PHP_DEFAULT, PHPColorProvider.DEFAULT);
     PreferenceConverter.setDefault(store, PHPDOC_KEYWORD, PHPColorProvider.PHPDOC_KEYWORD);
     PreferenceConverter.setDefault(store, PHPDOC_TAG, PHPColorProvider.PHPDOC_TAG);
index 68cb473..7db8fcf 100644 (file)
@@ -74,7 +74,8 @@ PHPEditorSyntaxPreferencePage.variables=Variables
 PHPEditorSyntaxPreferencePage.types=Types
 PHPEditorSyntaxPreferencePage.functions=Functions
 PHPEditorSyntaxPreferencePage.constants=Constants
-PHPEditorSyntaxPreferencePage.strings=Strings
+PHPEditorSyntaxPreferencePage.strings_dq=Double Quoted Strings
+PHPEditorSyntaxPreferencePage.strings_sq=Single Quoted Strings
 PHPEditorSyntaxPreferencePage.others=Others
 PHPEditorSyntaxPreferencePage.syntaxdialog=Custom PHP Syntax File:
 PHPEditorSyntaxPreferencePage.browse=Browse..