From 68f1d0ae005469a9c3bf2e09cb415e1ad4e0e4dc Mon Sep 17 00:00:00 2001 From: khartlage Date: Sat, 13 Sep 2003 17:33:51 +0000 Subject: [PATCH] Fixed some bugs in the syntax editor preference page --- .../ui/preferences/PHPEditorPreferencePage.java | 9 +-- .../internal/ui/text/phpdoc/PHPDocCodeScanner.java | 20 +++--- .../sourceforge/phpdt/ui/PreferenceConstants.java | 58 ++++++++--------- .../phpdt/ui/text/IJavaColorConstants.java | 56 ++++++++-------- .../sourceforge/phpdt/ui/text/JavaTextTools.java | 7 +- .../phpeclipse/IPreferenceConstants.java | 66 +++++++++++++------- .../phpeclipse/PHPSyntaxEditorPreferencePage.java | 24 +++++++- .../sourceforge/phpeclipse/PHPeclipsePlugin.java | 6 ++ .../phpeclipse/builder/IdentifierIndexManager.java | 2 + .../phpeditor/PHPSourceViewerConfiguration.java | 9 ++- .../phpeclipse/phpeditor/PHPTextHover.java | 3 + .../phpeclipse/phpeditor/php/PHPCodeScanner.java | 47 ++++++++------ .../phpeditor/util/PHPColorProvider.java | 8 +- 13 files changed, 189 insertions(+), 126 deletions(-) diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/PHPEditorPreferencePage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/PHPEditorPreferencePage.java index e60205c..3393159 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/PHPEditorPreferencePage.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/PHPEditorPreferencePage.java @@ -29,10 +29,8 @@ import net.sourceforge.phpeclipse.IPreferenceConstants; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import net.sourceforge.phpeclipse.phpeditor.PHPSourceViewerConfiguration; import net.sourceforge.phpeclipse.preferences.ColorEditor; -import net.sourceforge.phpeclipse.preferences.PHPPreferencesMessages; import org.eclipse.core.runtime.IStatus; -import org.eclipse.jface.preference.FileFieldEditor; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.preference.PreferenceConverter; import org.eclipse.jface.preference.PreferencePage; @@ -68,7 +66,6 @@ import org.eclipse.swt.widgets.TabItem; import org.eclipse.swt.widgets.Text; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; -import org.eclipse.ui.texteditor.AbstractTextEditor; import org.eclipse.ui.texteditor.WorkbenchChainedTextFontFieldEditor; /* @@ -105,7 +102,7 @@ public class PHPEditorPreferencePage extends PreferencePage implements IWorkbenc 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.STRING, PreferenceConstants.EDITOR_JAVADOC_TAG_COLOR), 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), @@ -228,7 +225,7 @@ public class PHPEditorPreferencePage extends PreferencePage implements IWorkbenc { 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.phpDocHtmlTags"), PreferenceConstants.EDITOR_JAVADOC_TAG_COLOR }, //$NON-NLS-1$ { PHPUIMessages.getString("PHPEditorPreferencePage.phpDocLinks"), PreferenceConstants.EDITOR_JAVADOC_LINKS_COLOR }, //$NON-NLS-1$ { @@ -639,7 +636,7 @@ public class PHPEditorPreferencePage extends PreferencePage implements IWorkbenc appearanceComposite.setLayout(layout); String label = PHPUIMessages.getString("PHPEditorPreferencePage.textFont"); //$NON-NLS-1$ - addTextFontEditor(appearanceComposite, label, AbstractTextEditor.PREFERENCE_FONT); + addTextFontEditor(appearanceComposite, label, JFaceResources.TEXT_FONT); label = PHPUIMessages.getString("PHPEditorPreferencePage.displayedTabWidth"); //$NON-NLS-1$ addTextField(appearanceComposite, label, PreferenceConstants.EDITOR_TAB_WIDTH, 3, 0, true); diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/phpdoc/PHPDocCodeScanner.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/phpdoc/PHPDocCodeScanner.java index 5820ca6..1d17285 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/phpdoc/PHPDocCodeScanner.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/phpdoc/PHPDocCodeScanner.java @@ -16,7 +16,7 @@ import java.util.List; 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.IPreferenceConstants; import net.sourceforge.phpeclipse.phpeditor.util.PHPWhitespaceDetector; import org.eclipse.jface.preference.IPreferenceStore; @@ -125,10 +125,10 @@ public final class PHPDocCodeScanner extends AbstractJavaScanner { 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.PHPDOC_KEYWORD, - IJavaColorConstants.PHPDOC_TAG, - IJavaColorConstants.PHPDOC_LINK, - IJavaColorConstants.PHPDOC_DEFAULT + IPreferenceConstants.PHPDOC_KEYWORD, + IPreferenceConstants.PHPDOC_TAG, + IPreferenceConstants.PHPDOC_LINK, + IPreferenceConstants.PHPDOC_DEFAULT }; @@ -156,7 +156,7 @@ public final class PHPDocCodeScanner extends AbstractJavaScanner { List list= new ArrayList(); // Add rule for tags. - Token token= getToken(IJavaColorConstants.PHPDOC_TAG); + Token token= getToken(IPreferenceConstants.PHPDOC_TAG); list.add(new TagRule(token)); @@ -168,7 +168,7 @@ public final class PHPDocCodeScanner extends AbstractJavaScanner { // Add rule for links. - token= getToken(IJavaColorConstants.PHPDOC_LINK); + token= getToken(IPreferenceConstants.PHPDOC_LINK); list.add(new SingleLineRule("{@link", "}", token)); //$NON-NLS-2$ //$NON-NLS-1$ @@ -177,15 +177,15 @@ public final class PHPDocCodeScanner extends AbstractJavaScanner { // Add word rule for keywords. - token= getToken(IJavaColorConstants.PHPDOC_DEFAULT); + token= getToken(IPreferenceConstants.PHPDOC_DEFAULT); wordRule= new WordRule(new JavaDocKeywordDetector(), token); - token= getToken(IJavaColorConstants.PHPDOC_KEYWORD); + token= getToken(IPreferenceConstants.PHPDOC_KEYWORD); for (int i= 0; i < fgKeywords.length; i++) wordRule.addWord(fgKeywords[i], token); list.add(wordRule); - setDefaultReturnToken(getToken(IJavaColorConstants.PHPDOC_DEFAULT)); + setDefaultReturnToken(getToken(IPreferenceConstants.PHPDOC_DEFAULT)); return list; } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/PreferenceConstants.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/PreferenceConstants.java index 4c02619..6a43c31 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/PreferenceConstants.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/PreferenceConstants.java @@ -10,6 +10,8 @@ ******************************************************************************/ package net.sourceforge.phpdt.ui; +import net.sourceforge.phpdt.ui.text.IJavaColorConstants; +import net.sourceforge.phpeclipse.IPreferenceConstants; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import org.eclipse.jface.preference.IPreferenceStore; @@ -21,10 +23,6 @@ import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.texteditor.AbstractTextEditor; import org.eclipse.ui.texteditor.WorkbenchChainedTextFontFieldEditor; - -//import org.phpeclipse.phpdt.core.IClasspathEntry; -// -import net.sourceforge.phpdt.ui.text.IJavaColorConstants; // //import org.phpeclipse.phpdt.internal.ui.JavaPlugin; //import org.phpeclipse.phpdt.internal.ui.preferences.NewJavaProjectPreferencePage; @@ -913,7 +911,7 @@ public class PreferenceConstants { * @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; + public final static String EDITOR_MULTI_LINE_COMMENT_COLOR = IPreferenceConstants.PHP_MULTILINE_COMMENT; /** * A named preference that controls whether multi line comments are rendered in bold. @@ -922,7 +920,7 @@ public class PreferenceConstants { * in bold. If false the are rendered using no font style attribute. *

*/ - public final static String EDITOR_MULTI_LINE_COMMENT_BOLD = IJavaColorConstants.PHP_MULTI_LINE_COMMENT + EDITOR_BOLD_SUFFIX; + public final static String EDITOR_MULTI_LINE_COMMENT_BOLD = IPreferenceConstants.PHP_MULTILINE_COMMENT + EDITOR_BOLD_SUFFIX; /** * A named preference that holds the color used to render single line comments. @@ -934,7 +932,7 @@ public class PreferenceConstants { * @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; + public final static String EDITOR_SINGLE_LINE_COMMENT_COLOR = IPreferenceConstants.PHP_SINGLELINE_COMMENT; /** * A named preference that controls whether sinle line comments are rendered in bold. @@ -943,7 +941,7 @@ public class PreferenceConstants { * in bold. If false the are rendered using no font style attribute. *

*/ - public final static String EDITOR_SINGLE_LINE_COMMENT_BOLD = IJavaColorConstants.PHP_SINGLE_LINE_COMMENT + EDITOR_BOLD_SUFFIX; + public final static String EDITOR_SINGLE_LINE_COMMENT_BOLD = IPreferenceConstants.PHP_SINGLELINE_COMMENT + EDITOR_BOLD_SUFFIX; /** * A named preference that holds the color used to render php keywords. @@ -955,7 +953,7 @@ public class PreferenceConstants { * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter */ - public final static String EDITOR_JAVA_KEYWORD_COLOR = IJavaColorConstants.PHP_KEYWORD; + public final static String EDITOR_JAVA_KEYWORD_COLOR = IPreferenceConstants.PHP_KEYWORD; /** * A named preference that controls whether keywords are rendered in bold. @@ -963,7 +961,7 @@ public class PreferenceConstants { * Value is of type Boolean. *

*/ - public final static String EDITOR_JAVA_KEYWORD_BOLD = IJavaColorConstants.PHP_KEYWORD + EDITOR_BOLD_SUFFIX; + public final static String EDITOR_JAVA_KEYWORD_BOLD = IPreferenceConstants.PHP_KEYWORD + EDITOR_BOLD_SUFFIX; /** * A named preference that holds the color used to render predefined php @@ -976,7 +974,7 @@ public class PreferenceConstants { * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter */ - public final static String EDITOR_PHP_FUNCTIONNAME_COLOR = IJavaColorConstants.PHP_FUNCTIONNAME; + public final static String EDITOR_PHP_FUNCTIONNAME_COLOR = IPreferenceConstants.PHP_FUNCTIONNAME; /** * A named preference that controls whether function names are rendered in @@ -985,7 +983,7 @@ public class PreferenceConstants { * Value is of type Boolean. *

*/ - public final static String EDITOR_PHP_FUNCTIONNAME_BOLD = IJavaColorConstants.PHP_FUNCTIONNAME + EDITOR_BOLD_SUFFIX; + public final static String EDITOR_PHP_FUNCTIONNAME_BOLD = IPreferenceConstants.PHP_FUNCTIONNAME + EDITOR_BOLD_SUFFIX; /** * A named preference that holds the color used to render php @@ -998,7 +996,7 @@ public class PreferenceConstants { * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter */ - public final static String EDITOR_PHP_VARIABLE_COLOR = IJavaColorConstants.PHP_VARIABLE; + public final static String EDITOR_PHP_VARIABLE_COLOR = IPreferenceConstants.PHP_VARIABLE; /** * A named preference that controls whether variables are rendered in bold. @@ -1006,7 +1004,7 @@ public class PreferenceConstants { * Value is of type Boolean. *

*/ - public final static String EDITOR_PHP_VARIABLE_BOLD = IJavaColorConstants.PHP_VARIABLE + EDITOR_BOLD_SUFFIX; + public final static String EDITOR_PHP_VARIABLE_BOLD = IPreferenceConstants.PHP_VARIABLE + EDITOR_BOLD_SUFFIX; /** * A named preference that holds the color used to render php constants. @@ -1018,7 +1016,7 @@ public class PreferenceConstants { * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter */ - public final static String EDITOR_PHP_CONSTANT_COLOR = IJavaColorConstants.PHP_CONSTANT; + public final static String EDITOR_PHP_CONSTANT_COLOR = IPreferenceConstants.PHP_CONSTANT; /** * A named preference that controls whether constants are rendered in bold. @@ -1026,7 +1024,7 @@ public class PreferenceConstants { * Value is of type Boolean. *

*/ - public final static String EDITOR_PHP_CONSTANT_BOLD = IJavaColorConstants.PHP_CONSTANT + EDITOR_BOLD_SUFFIX; + public final static String EDITOR_PHP_CONSTANT_BOLD = IPreferenceConstants.PHP_CONSTANT + EDITOR_BOLD_SUFFIX; /** * A named preference that holds the color used to render php types. @@ -1038,7 +1036,7 @@ public class PreferenceConstants { * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter */ - public final static String EDITOR_PHP_TYPE_COLOR = IJavaColorConstants.PHP_TYPE; + public final static String EDITOR_PHP_TYPE_COLOR = IPreferenceConstants.PHP_TYPE; /** * A named preference that controls whether types are rendered in bold. @@ -1046,7 +1044,7 @@ public class PreferenceConstants { * Value is of type Boolean. *

*/ - public final static String EDITOR_PHP_TYPE_BOLD = IJavaColorConstants.PHP_TYPE + EDITOR_BOLD_SUFFIX; + public final static String EDITOR_PHP_TYPE_BOLD = IPreferenceConstants.PHP_TYPE + EDITOR_BOLD_SUFFIX; /** * A named preference that holds the color used to render string constants. @@ -1058,7 +1056,7 @@ public class PreferenceConstants { * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter */ - public final static String EDITOR_STRING_COLOR = IJavaColorConstants.PHP_STRING; + public final static String EDITOR_STRING_COLOR = IPreferenceConstants.PHP_STRING; /** * A named preference that controls whether string constants are rendered in bold. @@ -1066,7 +1064,7 @@ public class PreferenceConstants { * Value is of type Boolean. *

*/ - public final static String EDITOR_STRING_BOLD = IJavaColorConstants.PHP_STRING + EDITOR_BOLD_SUFFIX; + public final static String EDITOR_STRING_BOLD = IPreferenceConstants.PHP_STRING + EDITOR_BOLD_SUFFIX; /** * A named preference that holds the color used to render php default text. @@ -1078,7 +1076,7 @@ public class PreferenceConstants { * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter */ - public final static String EDITOR_JAVA_DEFAULT_COLOR = IJavaColorConstants.PHP_DEFAULT; + public final static String EDITOR_JAVA_DEFAULT_COLOR = IPreferenceConstants.PHP_DEFAULT; /** * A named preference that controls whether Java default text is rendered in bold. @@ -1086,7 +1084,7 @@ public class PreferenceConstants { * Value is of type Boolean. *

*/ - public final static String EDITOR_JAVA_DEFAULT_BOLD = IJavaColorConstants.PHP_DEFAULT + EDITOR_BOLD_SUFFIX; + public final static String EDITOR_JAVA_DEFAULT_BOLD = IPreferenceConstants.PHP_DEFAULT + EDITOR_BOLD_SUFFIX; /** * A named preference that holds the color used to render phpdoc keywords. @@ -1098,7 +1096,7 @@ public class PreferenceConstants { * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter */ - public final static String EDITOR_JAVADOC_KEYWORD_COLOR = IJavaColorConstants.PHPDOC_KEYWORD; + public final static String EDITOR_JAVADOC_KEYWORD_COLOR = IPreferenceConstants.PHPDOC_KEYWORD; /** * A named preference that controls whether phpdoc keywords are rendered in bold. @@ -1106,7 +1104,7 @@ public class PreferenceConstants { * Value is of type Boolean. *

*/ - public final static String EDITOR_JAVADOC_KEYWORD_BOLD = IJavaColorConstants.PHPDOC_KEYWORD + EDITOR_BOLD_SUFFIX; + public final static String EDITOR_JAVADOC_KEYWORD_BOLD = IPreferenceConstants.PHPDOC_KEYWORD + EDITOR_BOLD_SUFFIX; /** * A named preference that holds the color used to render phpdoc tags. @@ -1118,7 +1116,7 @@ public class PreferenceConstants { * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter */ - public final static String EDITOR_JAVADOC_TAG_COLOR = IJavaColorConstants.PHPDOC_TAG; + public final static String EDITOR_JAVADOC_TAG_COLOR = IPreferenceConstants.PHPDOC_TAG; /** * A named preference that controls whether phpdoc tags are rendered in bold. @@ -1126,7 +1124,7 @@ public class PreferenceConstants { * Value is of type Boolean. *

*/ - public final static String EDITOR_JAVADOC_TAG_BOLD = IJavaColorConstants.PHPDOC_TAG + EDITOR_BOLD_SUFFIX; + public final static String EDITOR_JAVADOC_TAG_BOLD = IPreferenceConstants.PHPDOC_TAG + EDITOR_BOLD_SUFFIX; /** * A named preference that holds the color used to render phpdoc links. @@ -1138,7 +1136,7 @@ public class PreferenceConstants { * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter */ - public final static String EDITOR_JAVADOC_LINKS_COLOR = IJavaColorConstants.PHPDOC_LINK; + public final static String EDITOR_JAVADOC_LINKS_COLOR = IPreferenceConstants.PHPDOC_LINK; /** * A named preference that controls whether phpdoc links are rendered in bold. @@ -1146,7 +1144,7 @@ public class PreferenceConstants { * Value is of type Boolean. *

*/ - public final static String EDITOR_JAVADOC_LINKS_BOLD = IJavaColorConstants.PHPDOC_LINK + EDITOR_BOLD_SUFFIX; + public final static String EDITOR_JAVADOC_LINKS_BOLD = IPreferenceConstants.PHPDOC_LINK + EDITOR_BOLD_SUFFIX; /** * A named preference that holds the color used to render phpdoc default text. @@ -1158,7 +1156,7 @@ public class PreferenceConstants { * @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.preference.PreferenceConverter */ - public final static String EDITOR_JAVADOC_DEFAULT_COLOR = IJavaColorConstants.PHPDOC_DEFAULT; + public final static String EDITOR_JAVADOC_DEFAULT_COLOR = IPreferenceConstants.PHPDOC_DEFAULT; /** * A named preference that controls whether phpdoc default text is rendered in bold. @@ -1166,7 +1164,7 @@ public class PreferenceConstants { * Value is of type Boolean. *

*/ - public final static String EDITOR_JAVADOC_DEFAULT_BOLD = IJavaColorConstants.PHPDOC_DEFAULT + EDITOR_BOLD_SUFFIX; + public final static String EDITOR_JAVADOC_DEFAULT_BOLD = IPreferenceConstants.PHPDOC_DEFAULT + EDITOR_BOLD_SUFFIX; /** * A named preference that holds the color used for 'linked-mode' underline. diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/IJavaColorConstants.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/IJavaColorConstants.java index d6de39e..be9ad3a 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/IJavaColorConstants.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/IJavaColorConstants.java @@ -28,34 +28,34 @@ public interface IJavaColorConstants { * Note: This constant is for internal use only. Clients should not use this constant. * The prefix all color constants start with. */ - String PREFIX= "php_"; //$NON-NLS-1$ +// String PREFIX= "php_"; //$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 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 PHPDoc keywords (@foo) in PHPDoc comments. */ - String PHPDOC_KEYWORD= "php_doc_keyword"; //$NON-NLS-1$ - /** The color key for HTML tags (<foo>) in PHPDoc comments. */ - String PHPDOC_TAG= "php_doc_tag"; //$NON-NLS-1$ - /** The color key for PHPDoc links ({foo}) 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$ +// /** The color key for PHPDoc keywords (@foo) in PHPDoc comments. */ +// String PHPDOC_KEYWORD= "php_doc_keyword"; //$NON-NLS-1$ +// /** The color key for HTML tags (<foo>) in PHPDoc comments. */ +// String PHPDOC_TAG= "php_doc_tag"; //$NON-NLS-1$ +// /** The color key for PHPDoc links ({foo}) 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 diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/JavaTextTools.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/JavaTextTools.java index 4b5d76d..e920473 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/JavaTextTools.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/JavaTextTools.java @@ -8,6 +8,7 @@ package net.sourceforge.phpdt.ui.text; import net.sourceforge.phpdt.internal.ui.text.FastJavaPartitionScanner; import net.sourceforge.phpdt.internal.ui.text.JavaColorManager; import net.sourceforge.phpdt.internal.ui.text.phpdoc.PHPDocCodeScanner; +import net.sourceforge.phpeclipse.IPreferenceConstants; import net.sourceforge.phpeclipse.phpeditor.php.HTMLCodeScanner; import net.sourceforge.phpeclipse.phpeditor.php.PHPCodeScanner; @@ -84,9 +85,9 @@ public class JavaTextTools { fColorManager= new JavaColorManager(); fCodeScanner= new PHPCodeScanner(fColorManager, store); - 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); + fMultilineCommentScanner= new SingleTokenPHPScanner(fColorManager, store, IPreferenceConstants.PHP_MULTILINE_COMMENT); + fSinglelineCommentScanner= new SingleTokenPHPScanner(fColorManager, store, IPreferenceConstants.PHP_SINGLELINE_COMMENT); + fStringScanner= new SingleTokenPHPScanner(fColorManager, store, IPreferenceConstants.PHP_STRING); fJavaDocScanner= new PHPDocCodeScanner(fColorManager, store); fHTMLScanner= new HTMLCodeScanner(fColorManager, store); fPartitionScanner= new FastJavaPartitionScanner(); diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/IPreferenceConstants.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/IPreferenceConstants.java index 833cb2b..3e9e8ad 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/IPreferenceConstants.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/IPreferenceConstants.java @@ -12,7 +12,7 @@ Contributors: package net.sourceforge.phpeclipse; /** - * The main plugin class to be used in the desktop. + * Predefined prference constants */ public interface IPreferenceConstants { public static final String LOCALHOST_PREF = "_localhost"; @@ -20,15 +20,15 @@ public interface IPreferenceConstants { public static final String USE_EXTERNAL_BROWSER_PREF = "_use_external_browser"; public static final String SHOW_EXTERNAL_PREVIEW_PREF = "_show_external_preview"; public static final String EXTERNAL_BROWSER_PREF = "_external_browser"; - public static final String MYSQL_RUN_PREF = "_mysql_run_pref"; - public static final String MYSQL_START_BACKGROUND = "_mysql_start_background"; + public static final String MYSQL_RUN_PREF = "_mysql_run_pref"; + public static final String MYSQL_START_BACKGROUND = "_mysql_start_background"; public static final String MYSQL_PREF = "__mysql_start"; - public static final String APACHE_RUN_PREF = "_apache_run_pref"; - public static final String APACHE_START_BACKGROUND = "_apache_start_background"; + public static final String APACHE_RUN_PREF = "_apache_run_pref"; + public static final String APACHE_START_BACKGROUND = "_apache_start_background"; public static final String APACHE_START_PREF = "__apache_start"; - public static final String APACHE_STOP_BACKGROUND = "_apache_stop_background"; + public static final String APACHE_STOP_BACKGROUND = "_apache_stop_background"; public static final String APACHE_STOP_PREF = "__apache_stop"; - public static final String APACHE_RESTART_BACKGROUND = "_apache_restart_background"; + public static final String APACHE_RESTART_BACKGROUND = "_apache_restart_background"; public static final String APACHE_RESTART_PREF = "__apache_restart"; public static final String SHOW_OUTPUT_IN_CONSOLE = "_show_output_in_console"; public static final String PHP_RUN_PREF = "_php_run_pref"; @@ -73,19 +73,41 @@ 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"; + + /** The color key for PHPDoc keywords (@foo) in PHPDoc comments. */ + public static final String PHPDOC_KEYWORD = "_php_doc_keyword"; //$NON-NLS-1$ + public static final String PHPDOC_KEYWORD_BOLD = "_php_doc_keyword_bold"; + public static final String PHPDOC_KEYWORD_ITALIC = "_php_doc_keyword_italic"; + public static final String PHPDOC_KEYWORD_UNDERLINE = "_php_doc_keyword_underline"; + /** The color key for HTML tags (<foo>) in PHPDoc comments. */ + public static final String PHPDOC_TAG = "_php_doc_tag"; //$NON-NLS-1$ + public static final String PHPDOC_TAG_BOLD = "_php_doc_tag_bold"; + public static final String PHPDOC_TAG_ITALIC = "_php_doc_tag_italic"; + public static final String PHPDOC_TAG_UNDERLINE = "_php_doc_tag_underline"; + /** The color key for PHPDoc links ({foo}) in PHPDoc comments. */ + public static final String PHPDOC_LINK = "_php_doc_link"; //$NON-NLS-1$ + public static final String PHPDOC_LINK_BOLD = "_php_doc_link_bold"; + public static final String PHPDOC_LINK_ITALIC = "_php_doc_link_italic"; + public static final String PHPDOC_LINK_UNDERLINE = "_php_doc_link_underline"; + /** 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$ + public static final String PHPDOC_DEFAULT_BOLD = "_php_doc_default_bold"; + public static final String PHPDOC_DEFAULT_ITALIC = "_php_doc_default_italic"; + public static final String PHPDOC_DEFAULT_UNDERLINE = "_php_doc_default_underline"; + + // 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 (@foo) in PHPDoc comments. */ -// public static final String PHPDOC_KEYWORD= "_php_doc_keyword"; //$NON-NLS-1$ -// /** The color key for HTML tags (<foo>) in PHPDoc comments. */ -// public static final String PHPDOC_TAG= "_php_doc_tag"; //$NON-NLS-1$ -// /** The color key for PHPDoc links ({foo}) 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 (@foo) in PHPDoc comments. */ + // public static final String PHPDOC_KEYWORD= "_php_doc_keyword"; //$NON-NLS-1$ + // /** The color key for HTML tags (<foo>) in PHPDoc comments. */ + // public static final String PHPDOC_TAG= "_php_doc_tag"; //$NON-NLS-1$ + // /** The color key for PHPDoc links ({foo}) 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$ public static final String LANGUAGE_DEFAULT = "net.sourceforge.phpeclipse.newPHPPreferencesMessages_en_GB"; @@ -99,12 +121,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$ diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPSyntaxEditorPreferencePage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPSyntaxEditorPreferencePage.java index dda227b..5574982 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPSyntaxEditorPreferencePage.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPSyntaxEditorPreferencePage.java @@ -77,6 +77,24 @@ public class PHPSyntaxEditorPreferencePage extends PreferencePage implements IWo new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_DEFAULT_BOLD), new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_DEFAULT_ITALIC), new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_DEFAULT_UNDERLINE), + + new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, IPreferenceConstants.PHPDOC_KEYWORD), + new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHPDOC_KEYWORD_BOLD), + new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHPDOC_KEYWORD_ITALIC), + new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHPDOC_KEYWORD_UNDERLINE), + new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, IPreferenceConstants.PHPDOC_TAG), + new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHPDOC_TAG_BOLD), + new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHPDOC_TAG_ITALIC), + new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHPDOC_TAG_UNDERLINE), + new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, IPreferenceConstants.PHPDOC_LINK), + new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHPDOC_LINK_BOLD), + new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHPDOC_LINK_ITALIC), + new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHPDOC_LINK_UNDERLINE), + new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, IPreferenceConstants.PHPDOC_DEFAULT), + new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHPDOC_DEFAULT_BOLD), + new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHPDOC_DEFAULT_ITALIC), + 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) }; @@ -96,7 +114,11 @@ public class PHPSyntaxEditorPreferencePage extends PreferencePage implements IWo PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.functions"), IPreferenceConstants.PHP_FUNCTIONNAME }, { PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.constants"), IPreferenceConstants.PHP_CONSTANT }, { PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.strings"), IPreferenceConstants.PHP_STRING }, { - PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.others"), IPreferenceConstants.PHP_DEFAULT } + PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.others"), IPreferenceConstants.PHP_DEFAULT }, { + PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.phpdoc_keywords"), IPreferenceConstants.PHPDOC_KEYWORD }, { + PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.phpdoc_tags"), IPreferenceConstants.PHPDOC_TAG }, { + PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.phpdoc_links"), IPreferenceConstants.PHPDOC_LINK }, { + PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.phpdoc_others"), IPreferenceConstants.PHPDOC_DEFAULT } }; private OverlayPreferenceStore OverlayStore; diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java index 70785ae..8ab0b94 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java @@ -396,6 +396,12 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon PreferenceConverter.setDefault(store, PHP_TYPE, PHPColorProvider.TYPE); PreferenceConverter.setDefault(store, PHP_STRING, PHPColorProvider.STRING); PreferenceConverter.setDefault(store, PHP_DEFAULT, PHPColorProvider.DEFAULT); + + PreferenceConverter.setDefault(store, PHPDOC_KEYWORD, PHPColorProvider.PHPDOC_KEYWORD); + PreferenceConverter.setDefault(store, PHPDOC_TAG, PHPColorProvider.PHPDOC_TAG); + PreferenceConverter.setDefault(store, PHPDOC_LINK, PHPColorProvider.PHPDOC_LINK); + PreferenceConverter.setDefault(store, PHPDOC_DEFAULT, PHPColorProvider.PHPDOC_DEFAULT); + // PreferenceConverter.setDefault( // store, // PHP_EDITOR_BACKGROUND, diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/builder/IdentifierIndexManager.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/builder/IdentifierIndexManager.java index 6567e7f..1b0be9e 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/builder/IdentifierIndexManager.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/builder/IdentifierIndexManager.java @@ -536,6 +536,8 @@ public class IdentifierIndexManager { fileWriter.write(line + '\n'); } fileWriter.close(); + } catch (FileNotFoundException e) { + // ignore exception; project is deleted by user } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPSourceViewerConfiguration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPSourceViewerConfiguration.java index 7da54c2..1156dee 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPSourceViewerConfiguration.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPSourceViewerConfiguration.java @@ -371,7 +371,12 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration { * Method declared on SourceViewerConfiguration */ public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) { - IFile f = ((IFileEditorInput) fEditor.getEditorInput()).getFile(); - return new PHPTextHover(f.getProject()); + try { + IFile f = ((IFileEditorInput) fEditor.getEditorInput()).getFile(); + return new PHPTextHover(f.getProject()); + } catch (NullPointerException e) { + // this exception occurs, if getTextHover is called by preference pages ! + } + return new PHPTextHover(null); } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPTextHover.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPTextHover.java index c947cf6..032adf0 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPTextHover.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPTextHover.java @@ -38,6 +38,9 @@ public class PHPTextHover implements ITextHover { public static HashMap functionDescriptions = null; private static PHPWordExtractor phpWordDetector = new PHPWordExtractor(); + /** + * The current project; maybe null for preference pages + */ private IProject fProject; public PHPTextHover(IProject project) { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPCodeScanner.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPCodeScanner.java index 446c745..b45cfb3 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPCodeScanner.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPCodeScanner.java @@ -17,13 +17,20 @@ import java.util.Vector; 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.IPreferenceConstants; import net.sourceforge.phpeclipse.phpeditor.PHPSyntaxRdr; import net.sourceforge.phpeclipse.phpeditor.util.PHPWhitespaceDetector; import net.sourceforge.phpeclipse.phpeditor.util.PHPWordDetector; import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.text.rules.*; +import org.eclipse.jface.text.rules.EndOfLineRule; +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.MultiLineRule; +import org.eclipse.jface.text.rules.Token; +import org.eclipse.jface.text.rules.WhitespaceRule; +import org.eclipse.jface.text.rules.WordRule; /** * PHP Code Scanner @@ -70,7 +77,7 @@ public class PHPCodeScanner scanner.unread(); if (isVariable) { - return getToken(IJavaColorConstants.PHP_VARIABLE); + return getToken(IPreferenceConstants.PHP_VARIABLE); } IToken token = (IToken) fWords.get(fBuffer.toString()); if (token != null) @@ -91,15 +98,15 @@ public class PHPCodeScanner //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 }; + IPreferenceConstants.PHP_MULTILINE_COMMENT, + IPreferenceConstants.PHP_SINGLELINE_COMMENT, + IPreferenceConstants.PHP_KEYWORD, + IPreferenceConstants.PHP_FUNCTIONNAME, + IPreferenceConstants.PHP_VARIABLE, + IPreferenceConstants.PHP_STRING, + IPreferenceConstants.PHP_TYPE, + IPreferenceConstants.PHP_CONSTANT, + IPreferenceConstants.PHP_DEFAULT }; /** * Creates a PHP code scanner */ @@ -242,12 +249,12 @@ public class PHPCodeScanner */ protected List createRules() { List rules = new ArrayList(); - Token token= getToken(IJavaColorConstants.PHP_SINGLE_LINE_COMMENT); + Token token= getToken(IPreferenceConstants.PHP_SINGLELINE_COMMENT); // Add rule for single line comments. rules.add(new EndOfLineRule("//", token)); //$NON-NLS-1$ rules.add(new EndOfLineRule("#", token)); //$NON-NLS-1$ // Add rule for strings and character constants. - token= getToken(IJavaColorConstants.PHP_STRING); + token= getToken(IPreferenceConstants.PHP_STRING); rules.add(new MultiLineRule("\"", "\"", token, '\\')); //$NON-NLS-2$ //$NON-NLS-1$ rules.add(new MultiLineRule("`", "`", token, '\\')); //$NON-NLS-2$ //$NON-NLS-1$ rules.add(new MultiLineRule("'", "'", token, '\\')); //$NON-NLS-2$ //$NON-NLS-1$ @@ -256,18 +263,18 @@ public class PHPCodeScanner //rules.add(new SingleLineRule("'", "'", token, '\\')); //$NON-NLS-2$ //$NON-NLS-1$ - token= getToken(IJavaColorConstants.PHP_MULTI_LINE_COMMENT); + token= getToken(IPreferenceConstants.PHP_MULTILINE_COMMENT); rules.add(new MultiLineRule("/*", "*/", token)); //$NON-NLS-2$ //$NON-NLS-1$ // Add generic whitespace rule. rules.add(new WhitespaceRule(new PHPWhitespaceDetector())); // Add word rule for keywords, types, and constants. - token= getToken(IJavaColorConstants.PHP_DEFAULT); + token= getToken(IPreferenceConstants.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); + Token keyword= getToken(IPreferenceConstants.PHP_KEYWORD); + Token functionName= getToken(IPreferenceConstants.PHP_FUNCTIONNAME); + Token type= getToken(IPreferenceConstants.PHP_TYPE); + Token constant= getToken(IPreferenceConstants.PHP_CONSTANT); PHPSyntaxRdr.readInSyntax(); Vector buffer = PHPSyntaxRdr.getsyntaxdata(); // String strbuffer = null; unused diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/util/PHPColorProvider.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/util/PHPColorProvider.java index 3439c15..daeab8c 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/util/PHPColorProvider.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/util/PHPColorProvider.java @@ -39,10 +39,10 @@ public class PHPColorProvider { // 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); -- 1.7.1