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;
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;
/*
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),
{
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$
{
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);
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;
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
};
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));
// 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$
// 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;
}
}
******************************************************************************/
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;
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;
* @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.
* 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;
+ 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.
* @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.
* 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;
+ 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.
* @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.
* Value is of type <code>Boolean</code>.
* </p>
*/
- 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
* @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
* Value is of type <code>Boolean</code>.
* </p>
*/
- 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
* @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.
* Value is of type <code>Boolean</code>.
* </p>
*/
- 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.
* @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.
* Value is of type <code>Boolean</code>.
* </p>
*/
- 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.
* @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.
* Value is of type <code>Boolean</code>.
* </p>
*/
- 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.
* @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.
* Value is of type <code>Boolean</code>.
* </p>
*/
- 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.
* @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.
* Value is of type <code>Boolean</code>.
* </p>
*/
- 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.
* @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.
* Value is of type <code>Boolean</code>.
* </p>
*/
- 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.
* @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.
* Value is of type <code>Boolean</code>.
* </p>
*/
- 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.
* @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.
* Value is of type <code>Boolean</code>.
* </p>
*/
- 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.
* @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.
* Value is of type <code>Boolean</code>.
* </p>
*/
- 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.
* 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 (<code>@foo</code>) in PHPDoc comments. */
- String PHPDOC_KEYWORD= "php_doc_keyword"; //$NON-NLS-1$
- /** The color key for HTML tags (<code><foo></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$
+// /** 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><foo></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
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;
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();
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";
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";
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 (<code>@foo</code>) 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 (<code><foo></code>) 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 (<code>{foo}</code>) 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 (<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><foo></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><foo></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$
public static final String LANGUAGE_DEFAULT = "net.sourceforge.phpeclipse.newPHPPreferencesMessages_en_GB";
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$
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)
};
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;
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,
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();
* 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);
}
}
public static HashMap functionDescriptions = null;
private static PHPWordExtractor phpWordDetector = new PHPWordExtractor();
+ /**
+ * The current project; maybe <code>null</code> for preference pages
+ */
private IProject fProject;
public PHPTextHover(IProject project) {
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
scanner.unread();
if (isVariable) {
- return getToken(IJavaColorConstants.PHP_VARIABLE);
+ return getToken(IPreferenceConstants.PHP_VARIABLE);
}
IToken token = (IToken) fWords.get(fBuffer.toString());
if (token != null)
//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
*/
*/
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$
//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
// 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);