reconcile
is true
the editor's
* input element is reconciled in advance. If it is false
this method only returns a result if the editor's input
* element does not need to be reconciled.
- *
+ *
* @param offset
* the offset included by the retrieved element
* @param reconcile
@@ -1623,12 +1616,12 @@ public class PHPUnitEditor extends PHPEditor { //implements
linePainter = new LinePainter(getSourceViewer());
linePainter.setHighlightColor(new Color(Display.getCurrent(), 225, 235, 224));
// fPaintManager.addPainter(linePainter);
-// if (isBracketHighlightingEnabled())
-// startBracketHighlighting();
-// if (isLineHighlightingEnabled())
-// startLineHighlighting();
-// if (isPrintMarginVisible())
-// showPrintMargin();
+ // if (isBracketHighlightingEnabled())
+ // startBracketHighlighting();
+ // if (isLineHighlightingEnabled())
+ // startLineHighlighting();
+ // if (isPrintMarginVisible())
+ // showPrintMargin();
// Iterator e = ANNOTATION_MAP.keySet().iterator();
// while (e.hasNext()) {
// AnnotationType type = (AnnotationType) e.next();
@@ -1678,75 +1671,74 @@ public class PHPUnitEditor extends PHPEditor { //implements
}
}
-// private void startBracketHighlighting() {
-// if (fBracketPainter == null) {
-// ISourceViewer sourceViewer = getSourceViewer();
-// fBracketPainter = new BracketPainter(sourceViewer);
-// fBracketPainter.setHighlightColor(getColor(MATCHING_BRACKETS_COLOR));
-// // fPaintManager.addPainter(fBracketPainter);
-// }
-// }
-//
-// private void stopBracketHighlighting() {
-// if (fBracketPainter != null) {
-// // fPaintManager.removePainter(fBracketPainter);
-// fBracketPainter.deactivate(true);
-// fBracketPainter.dispose();
-// fBracketPainter = null;
-// }
-// }
-
-// private boolean isBracketHighlightingEnabled() {
-// IPreferenceStore store = getPreferenceStore();
-// return store.getBoolean(MATCHING_BRACKETS);
-// }
-
-// private void startLineHighlighting() {
-// if (fLinePainter == null) {
-// ISourceViewer sourceViewer = getSourceViewer();
-// fLinePainter = new LinePainter(sourceViewer);
-// fLinePainter.setHighlightColor(getColor(CURRENT_LINE_COLOR));
-// // fPaintManager.addPainter(fLinePainter);
-// }
-// }
-
-// private void stopLineHighlighting() {
-// if (fLinePainter != null) {
-// // fPaintManager.removePainter(fLinePainter);
-// fLinePainter.deactivate(true);
-// fLinePainter.dispose();
-// fLinePainter = null;
-// }
-// }
-
-// private boolean isLineHighlightingEnabled() {
-// IPreferenceStore store = getPreferenceStore();
-// return store.getBoolean(CURRENT_LINE);
-// }
-
-// private void showPrintMargin() {
-// if (fPrintMarginPainter == null) {
-// fPrintMarginPainter = new PrintMarginPainter(getSourceViewer());
-// fPrintMarginPainter.setMarginRulerColor(getColor(PRINT_MARGIN_COLOR));
-// fPrintMarginPainter.setMarginRulerColumn(getPreferenceStore().getInt(PRINT_MARGIN_COLUMN));
-// // fPaintManager.addPainter(fPrintMarginPainter);
-// }
-// }
-
-// private void hidePrintMargin() {
-// if (fPrintMarginPainter != null) {
-// // fPaintManager.removePainter(fPrintMarginPainter);
-// fPrintMarginPainter.deactivate(true);
-// fPrintMarginPainter.dispose();
-// fPrintMarginPainter = null;
-// }
-// }
-
-// private boolean isPrintMarginVisible() {
-// IPreferenceStore store = getPreferenceStore();
-// return store.getBoolean(PRINT_MARGIN);
-// }
+ // private void startBracketHighlighting() {
+ // if (fBracketPainter == null) {
+ // ISourceViewer sourceViewer = getSourceViewer();
+ // fBracketPainter = new BracketPainter(sourceViewer);
+ // fBracketPainter.setHighlightColor(getColor(MATCHING_BRACKETS_COLOR));
+ // // fPaintManager.addPainter(fBracketPainter);
+ // }
+ // }
+ //
+ // private void stopBracketHighlighting() {
+ // if (fBracketPainter != null) {
+ // // fPaintManager.removePainter(fBracketPainter);
+ // fBracketPainter.deactivate(true);
+ // fBracketPainter.dispose();
+ // fBracketPainter = null;
+ // }
+ // }
+
+ // private boolean isBracketHighlightingEnabled() {
+ // IPreferenceStore store = getPreferenceStore();
+ // return store.getBoolean(MATCHING_BRACKETS);
+ // }
+
+ // private void startLineHighlighting() {
+ // if (fLinePainter == null) {
+ // ISourceViewer sourceViewer = getSourceViewer();
+ // fLinePainter = new LinePainter(sourceViewer);
+ // fLinePainter.setHighlightColor(getColor(CURRENT_LINE_COLOR));
+ // // fPaintManager.addPainter(fLinePainter);
+ // }
+ // }
+
+ // private void stopLineHighlighting() {
+ // if (fLinePainter != null) {
+ // // fPaintManager.removePainter(fLinePainter);
+ // fLinePainter.deactivate(true);
+ // fLinePainter.dispose();
+ // fLinePainter = null;
+ // }
+ // }
+
+ // private boolean isLineHighlightingEnabled() {
+ // IPreferenceStore store = getPreferenceStore();
+ // return store.getBoolean(CURRENT_LINE);
+ // }
+
+ // private void showPrintMargin() {
+ // if (fPrintMarginPainter == null) {
+ // fPrintMarginPainter = new PrintMarginPainter(getSourceViewer());
+ // fPrintMarginPainter.setMarginRulerColor(getColor(PRINT_MARGIN_COLOR));
+ // fPrintMarginPainter.setMarginRulerColumn(getPreferenceStore().getInt(PRINT_MARGIN_COLUMN));
+ // // fPaintManager.addPainter(fPrintMarginPainter);
+ // }
+ // }
+
+ // private void hidePrintMargin() {
+ // if (fPrintMarginPainter != null) {
+ // // fPaintManager.removePainter(fPrintMarginPainter);
+ // fPrintMarginPainter.deactivate(true);
+ // fPrintMarginPainter.dispose();
+ // fPrintMarginPainter = null;
+ // }
+ // }
+ // private boolean isPrintMarginVisible() {
+ // IPreferenceStore store = getPreferenceStore();
+ // return store.getBoolean(PRINT_MARGIN);
+ // }
private int getTabSize() {
Preferences preferences = PHPeclipsePlugin.getDefault().getPluginPreferences();
@@ -1851,49 +1843,49 @@ public class PHPUnitEditor extends PHPEditor { //implements
stopTabConversion();
return;
}
-// if (MATCHING_BRACKETS.equals(p)) {
-// if (isBracketHighlightingEnabled())
-// startBracketHighlighting();
-// else
-// stopBracketHighlighting();
-// return;
-// }
-// if (MATCHING_BRACKETS_COLOR.equals(p)) {
-// if (fBracketPainter != null)
-// fBracketPainter.setHighlightColor(getColor(MATCHING_BRACKETS_COLOR));
-// return;
-// }
-// if (CURRENT_LINE.equals(p)) {
-// if (isLineHighlightingEnabled())
-// startLineHighlighting();
-// else
-// stopLineHighlighting();
-// return;
-// }
-// if (CURRENT_LINE_COLOR.equals(p)) {
-// if (fLinePainter != null) {
-// stopLineHighlighting();
-// startLineHighlighting();
-// }
-// return;
-// }
-// if (PRINT_MARGIN.equals(p)) {
-// if (isPrintMarginVisible())
-// showPrintMargin();
-// else
-// hidePrintMargin();
-// return;
-// }
-// if (PRINT_MARGIN_COLOR.equals(p)) {
-// if (fPrintMarginPainter != null)
-// fPrintMarginPainter.setMarginRulerColor(getColor(PRINT_MARGIN_COLOR));
-// return;
-// }
-// if (PRINT_MARGIN_COLUMN.equals(p)) {
-// if (fPrintMarginPainter != null)
-// fPrintMarginPainter.setMarginRulerColumn(getPreferenceStore().getInt(PRINT_MARGIN_COLUMN));
-// return;
-// }
+ // if (MATCHING_BRACKETS.equals(p)) {
+ // if (isBracketHighlightingEnabled())
+ // startBracketHighlighting();
+ // else
+ // stopBracketHighlighting();
+ // return;
+ // }
+ // if (MATCHING_BRACKETS_COLOR.equals(p)) {
+ // if (fBracketPainter != null)
+ // fBracketPainter.setHighlightColor(getColor(MATCHING_BRACKETS_COLOR));
+ // return;
+ // }
+ // if (CURRENT_LINE.equals(p)) {
+ // if (isLineHighlightingEnabled())
+ // startLineHighlighting();
+ // else
+ // stopLineHighlighting();
+ // return;
+ // }
+ // if (CURRENT_LINE_COLOR.equals(p)) {
+ // if (fLinePainter != null) {
+ // stopLineHighlighting();
+ // startLineHighlighting();
+ // }
+ // return;
+ // }
+ // if (PRINT_MARGIN.equals(p)) {
+ // if (isPrintMarginVisible())
+ // showPrintMargin();
+ // else
+ // hidePrintMargin();
+ // return;
+ // }
+ // if (PRINT_MARGIN_COLOR.equals(p)) {
+ // if (fPrintMarginPainter != null)
+ // fPrintMarginPainter.setMarginRulerColor(getColor(PRINT_MARGIN_COLOR));
+ // return;
+ // }
+ // if (PRINT_MARGIN_COLUMN.equals(p)) {
+ // if (fPrintMarginPainter != null)
+ // fPrintMarginPainter.setMarginRulerColumn(getPreferenceStore().getInt(PRINT_MARGIN_COLUMN));
+ // return;
+ // }
// if (OVERVIEW_RULER.equals(p)) {
// if (isOverviewRulerVisible())
// showOverviewRuler();
@@ -1942,7 +1934,7 @@ public class PHPUnitEditor extends PHPEditor { //implements
}
/*
- * @see org.eclipse.jdt.internal.ui.javaeditor.JavaEditor#handlePreferencePropertyChanged(org.eclipse.core.runtime.Preferences.PropertyChangeEvent)
+ * @see net.sourceforge.phpdt.internal.ui.javaeditor.JavaEditor#handlePreferencePropertyChanged(org.eclipse.core.runtime.Preferences.PropertyChangeEvent)
*/
protected void handlePreferencePropertyChanged(org.eclipse.core.runtime.Preferences.PropertyChangeEvent event) {
AdaptedSourceViewer asv = (AdaptedSourceViewer) getSourceViewer();
@@ -1960,7 +1952,7 @@ public class PHPUnitEditor extends PHPEditor { //implements
/**
* Handles a property change event describing a change of the php core's preferences and updates the preference related editor
* properties.
- *
+ *
* @param event
* the property change event
*/
@@ -1978,7 +1970,7 @@ public class PHPUnitEditor extends PHPEditor { //implements
// }
// }
/*
- * @see org.eclipse.jdt.internal.ui.javaeditor.JavaEditor#createJavaSourceViewer(org.eclipse.swt.widgets.Composite,
+ * @see net.sourceforge.phpdt.internal.ui.javaeditor.JavaEditor#createJavaSourceViewer(org.eclipse.swt.widgets.Composite,
* org.eclipse.jface.text.source.IVerticalRuler, org.eclipse.jface.text.source.IOverviewRuler, boolean, int)
*/
protected ISourceViewer createJavaSourceViewer(Composite parent, IVerticalRuler verticalRuler, IOverviewRuler overviewRuler,
@@ -2004,7 +1996,7 @@ public class PHPUnitEditor extends PHPEditor { //implements
}
/*
- * @see org.eclipse.jdt.internal.ui.javaeditor.JavaEditor#getInputElement()
+ * @see net.sourceforge.phpdt.internal.ui.javaeditor.JavaEditor#getInputElement()
*/
protected IJavaElement getInputJavaElement() {
return PHPeclipsePlugin.getDefault().getWorkingCopyManager().getWorkingCopy(getEditorInput());
@@ -2085,6 +2077,11 @@ public class PHPUnitEditor extends PHPEditor { //implements
}
} else {
+ if (getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_P_RTRIM_ON_SAVE)) {
+ RTrimAction trimAction = new RTrimAction();
+ trimAction.setActiveEditor(null, getSite().getPage().getActiveEditor());
+ trimAction.run(null);
+ }
setStatusLineErrorMessage(null);
@@ -2110,7 +2107,7 @@ public class PHPUnitEditor extends PHPEditor { //implements
/**
* The compilation unit editor implementation of this AbstractTextEditor
method asks the user for the workspace
* path of a file resource and saves the document there. See http://dev.eclipse.org/bugs/show_bug.cgi?id=6295
- *
+ *
* @param progressMonitor
* the progress monitor
*/
@@ -2192,7 +2189,7 @@ public class PHPUnitEditor extends PHPEditor { //implements
// /*
// * @see
- // org.eclipse.jdt.internal.ui.javaeditor.JavaEditor#installOverrideIndicator(boolean)
+ // net.sourceforge.phpdt.internal.ui.javaeditor.JavaEditor#installOverrideIndicator(boolean)
// * @since 3.0
// */
// protected void installOverrideIndicator(boolean waitForReconcilation) {
@@ -2205,16 +2202,16 @@ public class PHPUnitEditor extends PHPEditor { //implements
// IJavaElement inputElement= getInputJavaElement();
// if (model == null || inputElement == null)
// return;
- //
+ //
// fOverrideIndicatorManager= new OverrideIndicatorManager(model,
// inputElement, null);
// addReconcileListener(fOverrideIndicatorManager);
// }
// }
- //
+ //
// /*
// * @see
- // org.eclipse.jdt.internal.ui.javaeditor.JavaEditor#uninstallOverrideIndicator()
+ // net.sourceforge.phpdt.internal.ui.javaeditor.JavaEditor#uninstallOverrideIndicator()
// * @since 3.0
// */
// protected void uninstallOverrideIndicator() {
@@ -2225,7 +2222,7 @@ public class PHPUnitEditor extends PHPEditor { //implements
/**
* Configures the toggle comment action
- *
+ *
* @since 3.0
*/
private void configureToggleCommentAction() {
@@ -2246,15 +2243,16 @@ public class PHPUnitEditor extends PHPEditor { //implements
// }
// }
// }
- private void configureTabConverter() {
- if (fTabConverter != null) {
- IDocumentProvider provider= getDocumentProvider();
- if (provider instanceof ICompilationUnitDocumentProvider) {
- ICompilationUnitDocumentProvider cup= (ICompilationUnitDocumentProvider) provider;
- fTabConverter.setLineTracker(cup.createLineTracker(getEditorInput()));
- }
- }
- }
+ private void configureTabConverter() {
+ if (fTabConverter != null) {
+ IDocumentProvider provider = getDocumentProvider();
+ if (provider instanceof ICompilationUnitDocumentProvider) {
+ ICompilationUnitDocumentProvider cup = (ICompilationUnitDocumentProvider) provider;
+ fTabConverter.setLineTracker(cup.createLineTracker(getEditorInput()));
+ }
+ }
+ }
+
private void startTabConversion() {
if (fTabConverter == null) {
fTabConverter = new TabConverter();
@@ -2281,33 +2279,33 @@ public class PHPUnitEditor extends PHPEditor { //implements
* @see org.eclipse.ui.texteditor.AbstractTextEditor#performSave(boolean, org.eclipse.core.runtime.IProgressMonitor)
*/
protected void performSave(boolean overwrite, IProgressMonitor progressMonitor) {
-// IDocumentProvider p = getDocumentProvider();
-// if (p instanceof PHPDocumentProvider) {
-// PHPDocumentProvider cp = (PHPDocumentProvider) p;
-// cp.setSavePolicy(fSavePolicy);
-// }
-// try {
-// super.performSave(overwrite, progressMonitor);
-// } finally {
-// if (p instanceof PHPDocumentProvider) {
-// PHPDocumentProvider cp = (PHPDocumentProvider) p;
-// cp.setSavePolicy(null);
-// }
-// }
-
- IDocumentProvider p= getDocumentProvider();
- if (p instanceof ICompilationUnitDocumentProvider) {
- ICompilationUnitDocumentProvider cp= (ICompilationUnitDocumentProvider) p;
- cp.setSavePolicy(fSavePolicy);
- }
- try {
- super.performSave(overwrite, progressMonitor);
- } finally {
- if (p instanceof ICompilationUnitDocumentProvider) {
- ICompilationUnitDocumentProvider cp= (ICompilationUnitDocumentProvider) p;
- cp.setSavePolicy(null);
- }
- }
+ // IDocumentProvider p = getDocumentProvider();
+ // if (p instanceof PHPDocumentProvider) {
+ // PHPDocumentProvider cp = (PHPDocumentProvider) p;
+ // cp.setSavePolicy(fSavePolicy);
+ // }
+ // try {
+ // super.performSave(overwrite, progressMonitor);
+ // } finally {
+ // if (p instanceof PHPDocumentProvider) {
+ // PHPDocumentProvider cp = (PHPDocumentProvider) p;
+ // cp.setSavePolicy(null);
+ // }
+ // }
+
+ IDocumentProvider p = getDocumentProvider();
+ if (p instanceof ICompilationUnitDocumentProvider) {
+ ICompilationUnitDocumentProvider cp = (ICompilationUnitDocumentProvider) p;
+ cp.setSavePolicy(fSavePolicy);
+ }
+ try {
+ super.performSave(overwrite, progressMonitor);
+ } finally {
+ if (p instanceof ICompilationUnitDocumentProvider) {
+ ICompilationUnitDocumentProvider cp = (ICompilationUnitDocumentProvider) p;
+ cp.setSavePolicy(null);
+ }
+ }
}
/*
@@ -2321,7 +2319,7 @@ public class PHPUnitEditor extends PHPEditor { //implements
/**
* Asks the user if it is ok to store in non-workbench encoding.
- *
+ *
* @return true
if this is the active editor in the active page
* @see IWorkbenchPage#getActiveEditor();
*/
@@ -2467,7 +2466,7 @@ public class PHPUnitEditor extends PHPEditor { //implements
/**
* Adds the given listener. Has no effect if an identical listener was not already registered.
- *
+ *
* @param listener
* The reconcile listener to be added
* @since 3.0
@@ -2480,7 +2479,7 @@ public class PHPUnitEditor extends PHPEditor { //implements
/**
* Removes the given listener. Has no effect if an identical listener was not already registered.
- *
+ *
* @param listener
* the reconcile listener to be removed
* @since 3.0
@@ -2546,7 +2545,7 @@ public class PHPUnitEditor extends PHPEditor { //implements
}
/*
- * @see org.eclipse.jdt.internal.ui.javaeditor.JavaEditor#getAdapter(java.lang.Class)
+ * @see net.sourceforge.phpdt.internal.ui.javaeditor.JavaEditor#getAdapter(java.lang.Class)
*/
public Object getAdapter(Class required) {
if (SmartBackspaceManager.class.equals(required)) {
@@ -2563,7 +2562,7 @@ public class PHPUnitEditor extends PHPEditor { //implements
* * TODO remove once the underlying problem is solved. *
- * + * * @return the lock reconcilers may use to synchronize on */ public Object getReconcilerLock() { @@ -2572,7 +2571,7 @@ public class PHPUnitEditor extends PHPEditor { //implements /* * (non-Javadoc) - * + * * @see org.eclipse.ui.texteditor.AbstractTextEditor#editorSaved() */ protected void editorSaved() {