-<?php
+<?php
/**
* This is about <code>ClassName</code>.
- * {@link com.yourCompany.aPackage.SuperClass}
+ *
* @author author
*/
class ClassName extends SuperClass {
/* This comment may span multiple lines. */
- $integer= 0;
+ private $integer = 0;
// This comment may span only this line
- $string= "zero";
+ private $string = "zero";
+
+ public function info() {
+ # call a predefined php function
+ phpinfo();
+ return "test";
+ }
}
?>
\ No newline at end of file
// private Button fAddJavaDocTagsButton;
- private Button fEscapeStringsButton;
+ private Button fEscapeStringsButtonDQ;
+
+ private Button fEscapeStringsButtonSQ;
// private Button fGuessMethodArgumentsButton;
private SourceViewer fPreviewViewer;
// overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
// OverlayPreferenceStore.BOOLEAN,
// PreferenceConstants.EDITOR_CLOSE_JAVADOCS));
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_WRAP_STRINGS));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_WRAP_STRINGS_DQ));
overlayKeys
- .add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_ESCAPE_STRINGS));
+ .add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_ESCAPE_STRINGS_DQ));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_WRAP_STRINGS_SQ));
+ overlayKeys
+ .add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_ESCAPE_STRINGS_SQ));
+
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
PreferenceConstants.EDITOR_ADD_JAVADOC_TAGS));
overlayKeys
group.setLayout(layout);
group.setText(PreferencesMessages.getString("JavaEditorPreferencePage.typing.description")); //$NON-NLS-1$
- label = PreferencesMessages.getString("JavaEditorPreferencePage.wrapStrings");
- //$NON-NLS-1$
- Button button = addCheckBox(group, label, PreferenceConstants.EDITOR_WRAP_STRINGS, 1);
+ label = PreferencesMessages.getString("JavaEditorPreferencePage.wrapStringsDQ");//$NON-NLS-1$
+ Button button = addCheckBox(group, label, PreferenceConstants.EDITOR_WRAP_STRINGS_DQ, 1);
- label = PreferencesMessages.getString("JavaEditorPreferencePage.escapeStrings");
- //$NON-NLS-1$
- fEscapeStringsButton = addCheckBox(group, label, PreferenceConstants.EDITOR_ESCAPE_STRINGS, 1);
- createDependency(button, fEscapeStringsButton);
+ label = PreferencesMessages.getString("JavaEditorPreferencePage.escapeStringsDQ");//$NON-NLS-1$
+ fEscapeStringsButtonDQ = addCheckBox(group, label, PreferenceConstants.EDITOR_ESCAPE_STRINGS_DQ, 1);
+ createDependency(button, fEscapeStringsButtonDQ);
+ label = PreferencesMessages.getString("JavaEditorPreferencePage.wrapStringsSQ");//$NON-NLS-1$
+ addCheckBox(group, label, PreferenceConstants.EDITOR_WRAP_STRINGS_SQ, 1);
+
+ label = PreferencesMessages.getString("JavaEditorPreferencePage.escapeStringsSQ");
+ //$NON-NLS-1$
+ fEscapeStringsButtonSQ = addCheckBox(group, label, PreferenceConstants.EDITOR_ESCAPE_STRINGS_SQ, 1);
+ createDependency(button, fEscapeStringsButtonSQ);
+
label = PreferencesMessages.getString("JavaEditorPreferencePage.smartPaste");
//$NON-NLS-1$
addCheckBox(group, label, PreferenceConstants.EDITOR_SMART_PASTE, 1);
// boolean closeJavaDocs = fOverlayStore
// .getBoolean(PreferenceConstants.EDITOR_CLOSE_JAVADOCS);
// fAddJavaDocTagsButton.setEnabled(closeJavaDocs);
- fEscapeStringsButton.setEnabled(fOverlayStore.getBoolean(PreferenceConstants.EDITOR_WRAP_STRINGS));
+ fEscapeStringsButtonDQ.setEnabled(fOverlayStore.getBoolean(PreferenceConstants.EDITOR_WRAP_STRINGS_DQ));
+ fEscapeStringsButtonSQ.setEnabled(fOverlayStore.getBoolean(PreferenceConstants.EDITOR_WRAP_STRINGS_SQ));
// boolean fillMethodArguments=
// fOverlayStore.getBoolean(PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES);
// fGuessMethodArgumentsButton.setEnabled(fillMethodArguments);
JavaEditorPreferencePage.closeBrackets= Close &brackets and parenthesis
JavaEditorPreferencePage.closeBraces= Cl&ose braces
JavaEditorPreferencePage.closeJavaDocs= Close PHP&docs and comments
-JavaEditorPreferencePage.wrapStrings= Wra&p PHP strings
-JavaEditorPreferencePage.escapeStrings= &Escape text when pasting into a string literal
+JavaEditorPreferencePage.wrapStringsDQ= Wra&p double quoted PHP strings
+JavaEditorPreferencePage.escapeStringsDQ= &Escape text when pasting into a double quoted PHP string
+JavaEditorPreferencePage.wrapStringsSQ= Wra&p single quoted PHP strings
+JavaEditorPreferencePage.escapeStringsSQ= &Escape text when pasting into a single quoted PHP string
JavaEditorPreferencePage.addJavaDocTags= Add PHPdoc &tags
JavaEditorPreferencePage.smartPaste= Pasting fo&r correct indentation
/**
* Auto indent strategy for java strings
*/
-public class JavaStringAutoIndentStrategy extends DefaultAutoIndentStrategy {
+public class JavaStringAutoIndentStrategyDQ extends DefaultAutoIndentStrategy {
private String fPartitioning;
*
* @param partitioning the document partitioning
*/
- public JavaStringAutoIndentStrategy(String partitioning) {
+ public JavaStringAutoIndentStrategyDQ(String partitioning) {
super();
fPartitioning= partitioning;
}
IPreferenceStore preferenceStore= PHPeclipsePlugin.getDefault().getPreferenceStore();
if (isLineDelimiter(document, command.text))
command.text= "\" ." + command.text + indentation + "\""; //$NON-NLS-1$//$NON-NLS-2$
- else if (command.text.length() > 1 && preferenceStore.getBoolean(PreferenceConstants.EDITOR_ESCAPE_STRINGS))
+ else if (command.text.length() > 1 && preferenceStore.getBoolean(PreferenceConstants.EDITOR_ESCAPE_STRINGS_DQ))
command.text= getModifiedText(command.text, indentation, delimiter);
}
IPreferenceStore preferenceStore= PHPeclipsePlugin.getDefault().getPreferenceStore();
- if (preferenceStore.getBoolean(PreferenceConstants.EDITOR_WRAP_STRINGS) && isSmartMode())
+ if (preferenceStore.getBoolean(PreferenceConstants.EDITOR_WRAP_STRINGS_DQ) && isSmartMode())
javaStringIndentAfterNewLine(document, command);
} catch (BadLocationException e) {
/**
* Auto indent strategy for java strings
*/
-public class JavaStringAutoIndentStrategy extends DefaultAutoIndentStrategy {
+public class JavaStringAutoIndentStrategySQ extends DefaultAutoIndentStrategy {
private String fPartitioning;
token = tokenizer.nextToken();
if (token.equals("\n")) { //$NON-NLS-1$
buffer.append("\\n"); //$NON-NLS-1$
- buffer.append("\" . " + delimiter); //$NON-NLS-1$
+ buffer.append("\' . " + delimiter); //$NON-NLS-1$
buffer.append(indentation);
- buffer.append("\""); //$NON-NLS-1$
+ buffer.append("\'"); //$NON-NLS-1$
continue;
} else {
- buffer.append("\" . " + delimiter); //$NON-NLS-1$
+ buffer.append("\' . " + delimiter); //$NON-NLS-1$
buffer.append(indentation);
- buffer.append("\""); //$NON-NLS-1$
+ buffer.append("\'"); //$NON-NLS-1$
}
} else {
continue;
}
} else if (token.equals("\n")) { //$NON-NLS-1$
buffer.append("\\n"); //$NON-NLS-1$
- buffer.append("\" . " + delimiter); //$NON-NLS-1$
+ buffer.append("\' . " + delimiter); //$NON-NLS-1$
buffer.append(indentation);
- buffer.append("\""); //$NON-NLS-1$
+ buffer.append("\'"); //$NON-NLS-1$
continue;
}
*
* @param partitioning the document partitioning
*/
- public JavaStringAutoIndentStrategy(String partitioning) {
+ public JavaStringAutoIndentStrategySQ(String partitioning) {
super();
fPartitioning= partitioning;
}
return;
}
- if (command.offset == offset + length && document.getChar(offset + length - 1) == '\"')
+ if (command.offset == offset + length && document.getChar(offset + length - 1) == '\'')
return;
String indentation= getLineIndentation(document, command.offset);
IPreferenceStore preferenceStore= PHPeclipsePlugin.getDefault().getPreferenceStore();
if (isLineDelimiter(document, command.text))
- command.text= "\" ." + command.text + indentation + "\""; //$NON-NLS-1$//$NON-NLS-2$
- else if (command.text.length() > 1 && preferenceStore.getBoolean(PreferenceConstants.EDITOR_ESCAPE_STRINGS))
+ command.text= "\' ." + command.text + indentation + "\'"; //$NON-NLS-1$//$NON-NLS-2$
+ else if (command.text.length() > 1 && preferenceStore.getBoolean(PreferenceConstants.EDITOR_ESCAPE_STRINGS_SQ))
command.text= getModifiedText(command.text, indentation, delimiter);
}
IPreferenceStore preferenceStore= PHPeclipsePlugin.getDefault().getPreferenceStore();
- if (preferenceStore.getBoolean(PreferenceConstants.EDITOR_WRAP_STRINGS) && isSmartMode())
+ if (preferenceStore.getBoolean(PreferenceConstants.EDITOR_WRAP_STRINGS_SQ) && isSmartMode())
javaStringIndentAfterNewLine(document, command);
} catch (BadLocationException e) {
* </p>
* @since 2.1
*/
- public final static String EDITOR_WRAP_STRINGS= "wrapStrings"; //$NON-NLS-1$
+ public final static String EDITOR_WRAP_STRINGS_DQ= "wrapStringsDQ"; //$NON-NLS-1$
/**
* A named preference that controls whether the 'escape strings' feature is
* </p>
* @since 3.0
*/
- public final static String EDITOR_ESCAPE_STRINGS= "escapeStrings"; //$NON-NLS-1$
+ public final static String EDITOR_ESCAPE_STRINGS_DQ= "escapeStringsDQ"; //$NON-NLS-1$
+ /**
+ * A named preference that controls whether the 'wrap strings' feature is
+ * enabled.
+ * <p>
+ * Value is of type <code>Boolean</code>.
+ * </p>
+ * @since 2.1
+ */
+ public final static String EDITOR_WRAP_STRINGS_SQ= "wrapStringsDQ"; //$NON-NLS-1$
+
+ /**
+ * A named preference that controls whether the 'escape strings' feature is
+ * enabled.
+ * <p>
+ * Value is of type <code>Boolean</code>.
+ * </p>
+ * @since 3.0
+ */
+ public final static String EDITOR_ESCAPE_STRINGS_SQ= "escapeStringsSQ"; //$NON-NLS-1$
+
/**
* A named preference that controls if content assist inserts the common
* prefix of all proposals before presenting choices.
store.setDefault(PreferenceConstants.EDITOR_CLOSE_BRACKETS_PHP, true);
store.setDefault(PreferenceConstants.EDITOR_CLOSE_BRACES, true);
store.setDefault(PreferenceConstants.EDITOR_CLOSE_JAVADOCS, true);
- store.setDefault(PreferenceConstants.EDITOR_WRAP_STRINGS, true);
- store.setDefault(PreferenceConstants.EDITOR_ESCAPE_STRINGS, false);
+ store.setDefault(PreferenceConstants.EDITOR_WRAP_STRINGS_DQ, true);
+ store.setDefault(PreferenceConstants.EDITOR_ESCAPE_STRINGS_DQ, false);
+ store.setDefault(PreferenceConstants.EDITOR_WRAP_STRINGS_SQ, true);
+ store.setDefault(PreferenceConstants.EDITOR_ESCAPE_STRINGS_SQ, false);
store.setDefault(PreferenceConstants.EDITOR_ADD_JAVADOC_TAGS, true);
store.setDefault(PreferenceConstants.EDITOR_FORMAT_JAVADOCS, true);
store.setDefault(PreferenceConstants.EDITOR_DISABLE_OVERWRITE_MODE, false);
import net.sourceforge.phpdt.internal.ui.text.HTMLTextPresenter;
import net.sourceforge.phpdt.internal.ui.text.IPHPPartitions;
import net.sourceforge.phpdt.internal.ui.text.JavaAnnotationHover;
-import net.sourceforge.phpdt.internal.ui.text.JavaColorManager;
import net.sourceforge.phpdt.internal.ui.text.JavaCompositeReconcilingStrategy;
import net.sourceforge.phpdt.internal.ui.text.JavaElementProvider;
import net.sourceforge.phpdt.internal.ui.text.JavaOutlineInformationControl;
import net.sourceforge.phpdt.internal.ui.text.JavaReconciler;
import net.sourceforge.phpdt.internal.ui.text.PreferencesAdapter;
import net.sourceforge.phpdt.internal.ui.text.java.JavaFormattingStrategy;
-import net.sourceforge.phpdt.internal.ui.text.java.JavaStringAutoIndentStrategy;
+import net.sourceforge.phpdt.internal.ui.text.java.JavaStringAutoIndentStrategyDQ;
+import net.sourceforge.phpdt.internal.ui.text.java.JavaStringAutoIndentStrategySQ;
import net.sourceforge.phpdt.internal.ui.text.java.hover.JavaEditorTextHoverDescriptor;
import net.sourceforge.phpdt.internal.ui.text.java.hover.JavaEditorTextHoverProxy;
import net.sourceforge.phpdt.internal.ui.text.java.hover.JavaInformationProvider;
import net.sourceforge.phpdt.ui.PreferenceConstants;
import net.sourceforge.phpeclipse.IPreferenceConstants;
import net.sourceforge.phpeclipse.PHPeclipsePlugin;
-import net.sourceforge.phpeclipse.phpeditor.PHPEditor;
import net.sourceforge.phpeclipse.phpeditor.html.HTMLFormattingStrategy;
import net.sourceforge.phpeclipse.phpeditor.php.HTMLCompletionProcessor;
import net.sourceforge.phpeclipse.phpeditor.php.PHPAutoIndentStrategy;
import net.sourceforge.phpeclipse.phpeditor.php.PHPDocumentPartitioner;
import net.sourceforge.phpeclipse.phpeditor.php.PHPDoubleClickSelector;
import net.sourceforge.phpeclipse.phpeditor.php.PHPPartitionScanner;
-import net.sourceforge.phpeclipse.phpeditor.php.SmartyCodeScanner;
-import net.sourceforge.phpeclipse.phpeditor.php.SmartyDocCodeScanner;
-import net.sourceforge.phpeclipse.phpeditor.util.PHPColorProvider;
import net.sourceforge.phpeclipse.xml.ui.XMLPlugin;
import net.sourceforge.phpeclipse.xml.ui.internal.text.XMLConfiguration;
import net.sourceforge.phpeclipse.xml.ui.internal.text.XMLPartitionScanner;
* (non-Javadoc) Method declared on SourceViewerConfiguration
*/
public IAutoIndentStrategy getAutoIndentStrategy(ISourceViewer sourceViewer, String contentType) {
- if (IPHPPartitions.PHP_STRING_DQ.equals(contentType) || IPHPPartitions.PHP_STRING_SQ.equals(contentType))
- return new JavaStringAutoIndentStrategy(getConfiguredDocumentPartitioning(sourceViewer));
+ if (IPHPPartitions.PHP_STRING_DQ.equals(contentType))
+ return new JavaStringAutoIndentStrategyDQ(getConfiguredDocumentPartitioning(sourceViewer));
+ if (IPHPPartitions.PHP_STRING_SQ.equals(contentType))
+ return new JavaStringAutoIndentStrategySQ(getConfiguredDocumentPartitioning(sourceViewer));
return (PHPDocumentPartitioner.PHP_TEMPLATE_DATA.equals(contentType)
|| PHPDocumentPartitioner.PHP_SCRIPT_CODE.equals(contentType) || IDocument.DEFAULT_CONTENT_TYPE.equals(contentType)
private final static String CLOSE_STRINGS_SQ_PHP = PreferenceConstants.EDITOR_CLOSE_STRINGS_SQ_PHP;
/** Preference key for automatically wrapping Java strings */
- private final static String WRAP_STRINGS = PreferenceConstants.EDITOR_WRAP_STRINGS;
+// private final static String WRAP_STRINGS = PreferenceConstants.EDITOR_WRAP_STRINGS_DQ;
/** Preference key for automatically closing brackets and parenthesis */
private final static String CLOSE_BRACKETS_PHP = PreferenceConstants.EDITOR_CLOSE_BRACKETS_PHP;