*/
public boolean createNonJavadocComments= true;
- public String[] importOrder= new String[0];
+// public String[] importOrder= new String[0];
public int importThreshold= 99;
public int tabWidth;
public void setSettings(CodeGenerationSettings settings) {
settings.createComments= createComments;
settings.useKeywordThis= useKeywordThis;
- settings.importOrder= importOrder;
+// settings.importOrder= importOrder;
settings.importThreshold= importThreshold;
settings.tabWidth= tabWidth;
}
CodeGenerationSettings res= new CodeGenerationSettings();
res.createComments= store.getBoolean(PreferenceConstants.CODEGEN_ADD_COMMENTS);
res.useKeywordThis= store.getBoolean(PreferenceConstants.CODEGEN_KEYWORD_THIS);
- res.importOrder= getImportOrderPreference(store);
+// res.importOrder= getImportOrderPreference(store);
res.importThreshold= getImportNumberThreshold(store);
res.tabWidth= CodeFormatterUtil.getTabWidth();
return res;
}
- public static String[] getImportOrderPreference(IPreferenceStore prefs) {
- String str= prefs.getString(PreferenceConstants.ORGIMPORTS_IMPORTORDER);
- if (str != null) {
- return unpackList(str, ";"); //$NON-NLS-1$
- }
- return new String[0];
- }
+// public static String[] getImportOrderPreference(IPreferenceStore prefs) {
+// String str= prefs.getString(PreferenceConstants.ORGIMPORTS_IMPORTORDER);
+// if (str != null) {
+// return unpackList(str, ";"); //$NON-NLS-1$
+// }
+// return new String[0];
+// }
private static String[] unpackList(String str, String separator) {
StringTokenizer tok= new StringTokenizer(str, separator); //$NON-NLS-1$
* Value is of type <code>String</code>: semicolon separated list of package names
* </p>
*/
- public static final String ORGIMPORTS_IMPORTORDER = "net.sourceforge.phpdt.ui.importorder"; //$NON-NLS-1$
+// public static final String ORGIMPORTS_IMPORTORDER = "net.sourceforge.phpdt.ui.importorder"; //$NON-NLS-1$
/**
* A named preference that specifies the number of imports added before a star-import declaration is used.
store.setDefault(PreferenceConstants.APPEARANCE_FOLD_PACKAGES_IN_PACKAGE_EXPLORER, true);
// ImportOrganizePreferencePage
- store.setDefault(PreferenceConstants.ORGIMPORTS_IMPORTORDER, "php;phpx;org;com"); //$NON-NLS-1$
+// store.setDefault(PreferenceConstants.ORGIMPORTS_IMPORTORDER, "php;phpx;org;com"); //$NON-NLS-1$
store.setDefault(PreferenceConstants.ORGIMPORTS_ONDEMANDTHRESHOLD, 99);
store.setDefault(PreferenceConstants.ORGIMPORTS_IGNORELOWERCASE, true);
store.setDefault(PreferenceConstants.EDITOR_PHP_TYPE_BOLD, false);
PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_STRING_COLOR_DQ, PHPColorProvider.STRING_DQ);
- store.setDefault(PreferenceConstants.EDITOR_STRING_BOLD_DQ, true);
+ store.setDefault(PreferenceConstants.EDITOR_STRING_BOLD_DQ, false);
PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_STRING_COLOR_SQ, PHPColorProvider.STRING_SQ);
- store.setDefault(PreferenceConstants.EDITOR_STRING_BOLD_SQ, false);
+ store.setDefault(PreferenceConstants.EDITOR_STRING_BOLD_SQ, true);
PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_JAVA_DEFAULT_COLOR, new RGB(0, 0, 0));
store.setDefault(PreferenceConstants.EDITOR_JAVA_DEFAULT_BOLD, false);
IPreferenceConstants.PHP_MULTILINE_COMMENT);
fSinglelineCommentScanner = new SingleTokenPHPScanner(getColorManager(), fPreferenceStore,
IPreferenceConstants.PHP_SINGLELINE_COMMENT);
- fStringDQScanner = new SingleTokenPHPScanner(getColorManager(), fPreferenceStore, IPreferenceConstants.PHP_STRING_DQ);
+// fStringDQScanner = new SingleTokenPHPScanner(getColorManager(), fPreferenceStore, IPreferenceConstants.PHP_STRING_DQ);
+ fStringDQScanner = new PHPStringDQCodeScanner(getColorManager(), fPreferenceStore);
fStringSQScanner = new SingleTokenPHPScanner(getColorManager(), fPreferenceStore, IPreferenceConstants.PHP_STRING_SQ);
fJavaDocScanner = new PHPDocCodeScanner(getColorManager(), fPreferenceStore);
}
--- /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
+ **********************************************************************/
+package net.sourceforge.phpdt.ui.text;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import net.sourceforge.phpdt.internal.ui.text.AbstractJavaScanner;
+import net.sourceforge.phpeclipse.IPreferenceConstants;
+import net.sourceforge.phpeclipse.phpeditor.util.PHPVariableDetector;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.text.IDocument;
+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.Token;
+import org.eclipse.jface.text.rules.WordRule;
+
+/**
+ * A rule based PHPDoc scanner.
+ */
+public final class PHPStringDQCodeScanner extends AbstractJavaScanner {
+
+ private static String[] fgTokenProperties = { IPreferenceConstants.PHP_STRING_DQ, IPreferenceConstants.PHP_VARIABLE };
+
+ private class PHPWordRule extends WordRule {
+ private StringBuffer fBuffer = new StringBuffer();
+
+ public PHPWordRule(IWordDetector detector) {
+ super(detector, Token.UNDEFINED);
+ }
+
+ public PHPWordRule(IWordDetector detector, IToken defaultToken) {
+ super(detector, defaultToken);
+ }
+
+ public IToken evaluate(ICharacterScanner scanner) {
+ int c = scanner.read();
+
+ if (fDetector.isWordStart((char) c)) {
+ if (fColumn == UNDEFINED || (fColumn == scanner.getColumn() - 1)) {
+
+ fBuffer.setLength(0);
+ do {
+ fBuffer.append((char) c);
+ c = scanner.read();
+ } while (c != ICharacterScanner.EOF && fDetector.isWordPart((char) c));
+ scanner.unread();
+
+ return getToken(IPreferenceConstants.PHP_VARIABLE);
+ }
+ }
+
+ scanner.unread();
+ return Token.UNDEFINED;
+ }
+ }
+
+ public PHPStringDQCodeScanner(IColorManager manager, IPreferenceStore store) {
+ super(manager, store);
+ initialize();
+ }
+
+ public IDocument getDocument() {
+ return fDocument;
+ }
+
+ /*
+ * @see AbstractJavaScanner#getTokenProperties()
+ */
+ protected String[] getTokenProperties() {
+ return fgTokenProperties;
+ }
+
+ /*
+ * @see AbstractJavaScanner#createRules()
+ */
+ protected List createRules() {
+
+ List list = new ArrayList();
+
+ // Add rule for tags.
+ Token token = getToken(IPreferenceConstants.PHP_STRING_DQ);
+ PHPWordRule wordRule = new PHPWordRule(new PHPVariableDetector(), token);
+
+ list.add(wordRule);
+
+ setDefaultReturnToken(getToken(IPreferenceConstants.PHP_STRING_DQ));
+ return list;
+ }
+}
+
--- /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
+ www.phpeclipse.de
+**********************************************************************/
+package net.sourceforge.phpeclipse.phpeditor.util;
+
+import net.sourceforge.phpdt.internal.compiler.parser.Scanner;
+
+import org.eclipse.jface.text.rules.IWordDetector;
+
+/**
+ * A PHP aware variable detector (i.e. a PHP identifier starting with a '$' character).
+ */
+public class PHPVariableDetector implements IWordDetector {
+
+ /* (non-Javadoc)
+ * Method declared on IWordDetector.
+ */
+ public boolean isWordPart(char character) {
+ return Scanner.isPHPIdentifierPart(character);
+ }
+
+ /* (non-Javadoc)
+ * Method declared on IWordDetector.
+ */
+ public boolean isWordStart(char character) {
+ return character=='$';
+ }
+}
import org.eclipse.jface.text.rules.IWordDetector;
/**
- * A Java aware word detector.
+ * A PHP aware word detector.
*/
public class PHPWordDetector implements IWordDetector {