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
@@ -1590,12 +1612,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();
@@ -1645,148 +1667,75 @@ 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 startAnnotationIndication(AnnotationType annotationType) {
- // if (fProblemPainter == null) {
- // fProblemPainter = new ProblemPainter(this, getSourceViewer());
- //// fPaintManager.addPainter(fProblemPainter);
+ // private void startBracketHighlighting() {
+ // if (fBracketPainter == null) {
+ // ISourceViewer sourceViewer = getSourceViewer();
+ // fBracketPainter = new BracketPainter(sourceViewer);
+ // fBracketPainter.setHighlightColor(getColor(MATCHING_BRACKETS_COLOR));
+ // // fPaintManager.addPainter(fBracketPainter);
// }
- // fProblemPainter.setColor(annotationType, getColor(annotationType));
- // fProblemPainter.paintAnnotations(annotationType, true);
- // fProblemPainter.paint(IPainter.CONFIGURATION);
// }
//
- // private void shutdownAnnotationIndication() {
- // if (fProblemPainter != null) {
- //
- // if (!fProblemPainter.isPaintingAnnotations()) {
- //// fPaintManager.removePainter(fProblemPainter);
- // fProblemPainter.deactivate(true);
- // fProblemPainter.dispose();
- // fProblemPainter = null;
- // } else {
- // fProblemPainter.paint(IPainter.CONFIGURATION);
- // }
+ // private void stopBracketHighlighting() {
+ // if (fBracketPainter != null) {
+ // // fPaintManager.removePainter(fBracketPainter);
+ // fBracketPainter.deactivate(true);
+ // fBracketPainter.dispose();
+ // fBracketPainter = null;
// }
// }
- //
- // private void stopAnnotationIndication(AnnotationType annotationType) {
- // if (fProblemPainter != null) {
- // fProblemPainter.paintAnnotations(annotationType, false);
- // shutdownAnnotationIndication();
+
+ // 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 boolean isAnnotationIndicationEnabled(AnnotationType
- // annotationType) {
- // IPreferenceStore store = getPreferenceStore();
- // AnnotationInfo info = (AnnotationInfo)
- // ANNOTATION_MAP.get(annotationType);
- // if (info != null)
- // return store.getBoolean(info.fEditorPreference);
- // return false;
+
+ // private void stopLineHighlighting() {
+ // if (fLinePainter != null) {
+ // // fPaintManager.removePainter(fLinePainter);
+ // fLinePainter.deactivate(true);
+ // fLinePainter.dispose();
+ // fLinePainter = null;
+ // }
// }
- //
- // private boolean
- // isAnnotationIndicationInOverviewRulerEnabled(AnnotationType
- // annotationType) {
+
+ // private boolean isLineHighlightingEnabled() {
// IPreferenceStore store = getPreferenceStore();
- // AnnotationInfo info = (AnnotationInfo)
- // ANNOTATION_MAP.get(annotationType);
- // if (info != null)
- // return store.getBoolean(info.fOverviewRulerPreference);
- // return false;
+ // return store.getBoolean(CURRENT_LINE);
// }
- //
- // private void showAnnotationIndicationInOverviewRuler(AnnotationType
- // annotationType, boolean show) {
- // AdaptedSourceViewer asv = (AdaptedSourceViewer) getSourceViewer();
- // OverviewRuler ruler = asv.getOverviewRuler();
- // if (ruler != null) {
- // ruler.setColor(annotationType, getColor(annotationType));
- // ruler.showAnnotation(annotationType, show);
- // ruler.update();
+
+ // 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 setColorInOverviewRuler(AnnotationType annotationType, Color
- // color) {
- // AdaptedSourceViewer asv = (AdaptedSourceViewer) getSourceViewer();
- // OverviewRuler ruler = asv.getOverviewRuler();
- // if (ruler != null) {
- // ruler.setColor(annotationType, color);
- // ruler.update();
+
+ // 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();
return preferences.getInt(CODE_FORMATTER_TAB_SIZE);
@@ -1797,30 +1746,6 @@ public class PHPUnitEditor extends PHPEditor { //implements
return store.getBoolean(SPACES_FOR_TABS);
}
- // private void showOverviewRuler() {
- // AdaptedSourceViewer asv = (AdaptedSourceViewer) getSourceViewer();
- // asv.showOverviewRuler();
- //
- // OverviewRuler overviewRuler = asv.getOverviewRuler();
- // if (overviewRuler != null) {
- // for (int i = 0; i < ANNOTATION_LAYERS.length; i++) {
- // AnnotationType type = ANNOTATION_LAYERS[i];
- // overviewRuler.setLayer(type, i);
- // if (isAnnotationIndicationInOverviewRulerEnabled(type))
- // showAnnotationIndicationInOverviewRuler(type, true);
- // }
- // }
- // }
- //
- // private void hideOverviewRuler() {
- // AdaptedSourceViewer asv = (AdaptedSourceViewer) getSourceViewer();
- // asv.hideOverviewRuler();
- // }
- //
- // private boolean isOverviewRulerVisible() {
- // IPreferenceStore store = getPreferenceStore();
- // return store.getBoolean(OVERVIEW_RULER);
- // }
private Color getColor(String key) {
RGB rgb = PreferenceConverter.getColor(getPreferenceStore(), key);
return getColor(rgb);
@@ -1914,49 +1839,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();
@@ -2005,7 +1930,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();
@@ -2023,7 +1948,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
*/
@@ -2041,7 +1966,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,
@@ -2067,7 +1992,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());
@@ -2148,6 +2073,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);
@@ -2173,7 +2103,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
*/
@@ -2255,7 +2185,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) {
@@ -2268,16 +2198,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() {
@@ -2288,7 +2218,7 @@ public class PHPUnitEditor extends PHPEditor { //implements
/**
* Configures the toggle comment action
- *
+ *
* @since 3.0
*/
private void configureToggleCommentAction() {
@@ -2300,11 +2230,20 @@ public class PHPUnitEditor extends PHPEditor { //implements
}
}
+ // private void configureTabConverter() {
+ // if (fTabConverter != null) {
+ // IDocumentProvider provider = getDocumentProvider();
+ // if (provider instanceof PHPDocumentProvider) {
+ // PHPDocumentProvider cup = (PHPDocumentProvider) provider;
+ // fTabConverter.setLineTracker(cup.createLineTracker(getEditorInput()));
+ // }
+ // }
+ // }
private void configureTabConverter() {
if (fTabConverter != null) {
IDocumentProvider provider = getDocumentProvider();
- if (provider instanceof PHPDocumentProvider) {
- PHPDocumentProvider cup = (PHPDocumentProvider) provider;
+ if (provider instanceof ICompilationUnitDocumentProvider) {
+ ICompilationUnitDocumentProvider cup = (ICompilationUnitDocumentProvider) provider;
fTabConverter.setLineTracker(cup.createLineTracker(getEditorInput()));
}
}
@@ -2336,16 +2275,30 @@ 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 PHPDocumentProvider) {
- PHPDocumentProvider cp = (PHPDocumentProvider) p;
+ if (p instanceof ICompilationUnitDocumentProvider) {
+ ICompilationUnitDocumentProvider cp = (ICompilationUnitDocumentProvider) p;
cp.setSavePolicy(fSavePolicy);
}
try {
super.performSave(overwrite, progressMonitor);
} finally {
- if (p instanceof PHPDocumentProvider) {
- PHPDocumentProvider cp = (PHPDocumentProvider) p;
+ if (p instanceof ICompilationUnitDocumentProvider) {
+ ICompilationUnitDocumentProvider cp = (ICompilationUnitDocumentProvider) p;
cp.setSavePolicy(null);
}
}
@@ -2362,7 +2315,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();
*/
@@ -2512,7 +2462,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
@@ -2525,7 +2475,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
@@ -2591,7 +2541,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)) {
@@ -2608,7 +2558,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() { @@ -2617,7 +2567,7 @@ public class PHPUnitEditor extends PHPEditor { //implements /* * (non-Javadoc) - * + * * @see org.eclipse.ui.texteditor.AbstractTextEditor#editorSaved() */ protected void editorSaved() {