X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPEditor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPEditor.java index 5dcf343..0ba1930 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPEditor.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPEditor.java @@ -37,7 +37,6 @@ import net.sourceforge.phpdt.core.compiler.ITerminalSymbols; import net.sourceforge.phpdt.core.compiler.InvalidInputException; import net.sourceforge.phpdt.internal.compiler.parser.Scanner; import net.sourceforge.phpdt.internal.compiler.parser.SyntaxError; -import net.sourceforge.phpdt.internal.core.CompilationUnit; import net.sourceforge.phpdt.internal.ui.actions.CompositeActionGroup; import net.sourceforge.phpdt.internal.ui.actions.FoldingActionGroup; import net.sourceforge.phpdt.internal.ui.actions.SelectionConverter; @@ -49,7 +48,7 @@ import net.sourceforge.phpdt.internal.ui.text.JavaWordFinder; import net.sourceforge.phpdt.internal.ui.text.JavaWordIterator; import net.sourceforge.phpdt.internal.ui.text.PHPPairMatcher; import net.sourceforge.phpdt.internal.ui.text.PreferencesAdapter; -import net.sourceforge.phpdt.internal.ui.text.java.JavaExpandHover; +import net.sourceforge.phpdt.internal.ui.text.java.hover.JavaExpandHover; import net.sourceforge.phpdt.internal.ui.viewsupport.ISelectionListenerWithAST; import net.sourceforge.phpdt.internal.ui.viewsupport.IViewPartInputProvider; import net.sourceforge.phpdt.internal.ui.viewsupport.SelectionListenerWithASTManager; @@ -98,7 +97,6 @@ import org.eclipse.jface.text.ITextPresentationListener; import org.eclipse.jface.text.ITextSelection; import org.eclipse.jface.text.ITextViewer; import org.eclipse.jface.text.ITextViewerExtension2; -import org.eclipse.jface.text.ITextViewerExtension3; import org.eclipse.jface.text.ITextViewerExtension4; import org.eclipse.jface.text.ITextViewerExtension5; import org.eclipse.jface.text.ITypedRegion; @@ -120,6 +118,7 @@ import org.eclipse.jface.text.source.IOverviewRuler; import org.eclipse.jface.text.source.ISourceViewer; import org.eclipse.jface.text.source.ISourceViewerExtension2; import org.eclipse.jface.text.source.IVerticalRuler; +import org.eclipse.jface.text.source.IVerticalRulerColumn; import org.eclipse.jface.text.source.OverviewRuler; import org.eclipse.jface.text.source.SourceViewerConfiguration; import org.eclipse.jface.text.source.projection.ProjectionSupport; @@ -2186,8 +2185,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I try { int widgetLocation = styledText.getOffsetAtLocation(new Point(x, y)); - if (textViewer instanceof ITextViewerExtension3) { - ITextViewerExtension3 extension = (ITextViewerExtension3) textViewer; + if (textViewer instanceof ITextViewerExtension5) { + ITextViewerExtension5 extension = (ITextViewerExtension5) textViewer; return extension.widgetOffset2ModelOffset(widgetLocation); } else { IRegion visibleRegion = textViewer.getVisibleRegion(); @@ -3316,14 +3315,15 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I * true if search direction is forward, * false if backward */ - public void gotoAnnotation(boolean forward) { + public Annotation gotoAnnotation(boolean forward) { ITextSelection selection = (ITextSelection) getSelectionProvider().getSelection(); Position position = new Position(0, 0); + Annotation annotation=null; if (false /* delayed - see bug 18316 */) { - getNextAnnotation(selection.getOffset(), selection.getLength(), forward, position); + annotation=getNextAnnotation(selection.getOffset(), selection.getLength(), forward, position); selectAndReveal(position.getOffset(), position.getLength()); } else /* no delay - see bug 18316 */{ - Annotation annotation = getNextAnnotation(selection.getOffset(), selection.getLength(), forward, position); + annotation = getNextAnnotation(selection.getOffset(), selection.getLength(), forward, position); setStatusLineErrorMessage(null); setStatusLineMessage(null); if (annotation != null) { @@ -3332,6 +3332,7 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I setStatusLineMessage(annotation.getText()); } } + return annotation; } /** @@ -4779,8 +4780,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I int targetOffset = (PHPPairMatcher.RIGHT == anchor) ? offset : offset + length - 1; boolean visible = false; - if (sourceViewer instanceof ITextViewerExtension3) { - ITextViewerExtension3 extension = (ITextViewerExtension3) sourceViewer; + if (sourceViewer instanceof ITextViewerExtension5) { + ITextViewerExtension5 extension = (ITextViewerExtension5) sourceViewer; visible = (extension.modelOffset2WidgetOffset(targetOffset) > -1); } else { IRegion visibleRegion = sourceViewer.getVisibleRegion(); @@ -4950,7 +4951,7 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I * otherwise * @since 3.0 */ - private boolean isNavigationTarget(Annotation annotation) { + protected boolean isNavigationTarget(Annotation annotation) { Preferences preferences = EditorsUI.getPluginPreferences(); AnnotationPreference preference = getAnnotationPreferenceLookup().getAnnotationPreference(annotation); // See bug 41689 @@ -5394,12 +5395,53 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I /* * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#createCompositeRuler() */ - protected CompositeRuler createCompositeRuler() { +// protected CompositeRuler createCompositeRuler() { +// if (!getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_ANNOTATION_ROLL_OVER)) +// return super.createCompositeRuler(); +// +// CompositeRuler ruler = new CompositeRuler(); +// AnnotationRulerColumn column = new AnnotationRulerColumn(VERTICAL_RULER_WIDTH, getAnnotationAccess()); +// column.setHover(new JavaExpandHover(ruler, getAnnotationAccess(), new IDoubleClickListener() { +// +// public void doubleClick(DoubleClickEvent event) { +// // for now: just invoke ruler double click action +// triggerAction(ITextEditorActionConstants.RULER_DOUBLE_CLICK); +// } +// +// private void triggerAction(String actionID) { +// IAction action = getAction(actionID); +// if (action != null) { +// if (action instanceof IUpdate) +// ((IUpdate) action).update(); +// // hack to propagate line change +// if (action instanceof ISelectionListener) { +// ((ISelectionListener) action).selectionChanged(null, null); +// } +// if (action.isEnabled()) +// action.run(); +// } +// } +// +// })); +// ruler.addDecorator(0, column); +// +// if (isLineNumberRulerVisible()) +// ruler.addDecorator(1, createLineNumberRulerColumn()); +// else if (isPrefQuickDiffAlwaysOn()) +// ruler.addDecorator(1, createChangeRulerColumn()); +// +// return ruler; +// } + + /* + * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#createAnnotationRulerColumn(org.eclipse.jface.text.source.CompositeRuler) + * @since 3.2 + */ + protected IVerticalRulerColumn createAnnotationRulerColumn(CompositeRuler ruler) { if (!getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_ANNOTATION_ROLL_OVER)) - return super.createCompositeRuler(); + return super.createAnnotationRulerColumn(ruler); - CompositeRuler ruler = new CompositeRuler(); - AnnotationRulerColumn column = new AnnotationRulerColumn(VERTICAL_RULER_WIDTH, getAnnotationAccess()); + AnnotationRulerColumn column= new AnnotationRulerColumn(VERTICAL_RULER_WIDTH, getAnnotationAccess()); column.setHover(new JavaExpandHover(ruler, getAnnotationAccess(), new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { @@ -5408,13 +5450,13 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I } private void triggerAction(String actionID) { - IAction action = getAction(actionID); + IAction action= getAction(actionID); if (action != null) { if (action instanceof IUpdate) ((IUpdate) action).update(); // hack to propagate line change if (action instanceof ISelectionListener) { - ((ISelectionListener) action).selectionChanged(null, null); + ((ISelectionListener)action).selectionChanged(null, null); } if (action.isEnabled()) action.run(); @@ -5422,16 +5464,9 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I } })); - ruler.addDecorator(0, column); - - if (isLineNumberRulerVisible()) - ruler.addDecorator(1, createLineNumberRulerColumn()); - else if (isPrefQuickDiffAlwaysOn()) - ruler.addDecorator(1, createChangeRulerColumn()); - - return ruler; + + return column; } - /** * Returns the folding action group, or null if there is none. *