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