From 0dc2f3182087c3bcee380e31dee0b0455c787f3b Mon Sep 17 00:00:00 2001 From: toshihiro Date: Wed, 11 Jul 2007 23:40:57 +0000 Subject: [PATCH] Got back Next/Previous Annotation functionality. (using standard class now. net.sourceforge.phpeclipse.phpeditor.GotoAnnotationAction.java is unnecessary anymore.) --- .../BasicJavaEditorActionContributor.java | 31 +++++++++----------- .../phpeclipse/phpeditor/JavaOutlinePage.java | 12 +++++-- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/BasicJavaEditorActionContributor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/BasicJavaEditorActionContributor.java index 5048803..ebbc553 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/BasicJavaEditorActionContributor.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/BasicJavaEditorActionContributor.java @@ -28,7 +28,9 @@ import org.eclipse.ui.IWorkbenchActionConstants; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.actions.RetargetAction; import org.eclipse.ui.texteditor.BasicTextEditorActionContributor; +import org.eclipse.ui.texteditor.GotoAnnotationAction; import org.eclipse.ui.texteditor.ITextEditor; +import org.eclipse.ui.texteditor.ITextEditorActionConstants; import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds; import org.eclipse.ui.texteditor.RetargetTextEditorAction; @@ -42,8 +44,8 @@ public class BasicJavaEditorActionContributor extends private TogglePresentationAction fTogglePresentation; - // private GotoAnnotationAction fPreviousAnnotation; - // private GotoAnnotationAction fNextAnnotation; + private GotoAnnotationAction fPreviousAnnotation; + private GotoAnnotationAction fNextAnnotation; private RetargetTextEditorAction fGotoMatchingBracket; @@ -81,11 +83,10 @@ public class BasicJavaEditorActionContributor extends // belonging to the active editor fTogglePresentation = new TogglePresentationAction(); - // fPreviousAnnotation= new GotoAnnotationAction("PreviousAnnotation.", - // false); //$NON-NLS-1$ - // - // fNextAnnotation= new GotoAnnotationAction("NextAnnotation.", true); - // //$NON-NLS-1$ + fPreviousAnnotation = new GotoAnnotationAction(b, + "PreviousAnnotation.", null, false); //$NON-NLS-1$ + fNextAnnotation = new GotoAnnotationAction(b, + "NextAnnotation.", null, true); //$NON-NLS-1$ fGotoMatchingBracket = new RetargetTextEditorAction(b, "GotoMatchingBracket."); //$NON-NLS-1$ @@ -153,14 +154,10 @@ public class BasicJavaEditorActionContributor extends super.init(bars, page); // register actions that have a dynamic editor. - // bars.setGlobalActionHandler(ITextEditorActionDefinitionIds.GOTO_NEXT_ANNOTATION, - // fNextAnnotation); - // bars.setGlobalActionHandler(ITextEditorActionDefinitionIds.GOTO_PREVIOUS_ANNOTATION, - // fPreviousAnnotation); - // bars.setGlobalActionHandler(ITextEditorActionConstants.NEXT, - // fNextAnnotation); - // bars.setGlobalActionHandler(ITextEditorActionConstants.PREVIOUS, - // fPreviousAnnotation); + bars.setGlobalActionHandler(ITextEditorActionDefinitionIds.GOTO_NEXT_ANNOTATION, fNextAnnotation); + bars.setGlobalActionHandler(ITextEditorActionDefinitionIds.GOTO_PREVIOUS_ANNOTATION, fPreviousAnnotation); + bars.setGlobalActionHandler(ITextEditorActionConstants.NEXT, fNextAnnotation); + bars.setGlobalActionHandler(ITextEditorActionConstants.PREVIOUS, fPreviousAnnotation); bars .setGlobalActionHandler( ITextEditorActionDefinitionIds.TOGGLE_SHOW_SELECTED_ELEMENT_ONLY, @@ -234,8 +231,8 @@ public class BasicJavaEditorActionContributor extends textEditor = (ITextEditor) part; fTogglePresentation.setEditor(textEditor); - // fPreviousAnnotation.setEditor(textEditor); - // fNextAnnotation.setEditor(textEditor); + fPreviousAnnotation.setEditor(textEditor); + fNextAnnotation.setEditor(textEditor); fGotoMatchingBracket.setAction(getAction(textEditor, GotoMatchingBracketAction.GOTO_MATCHING_BRACKET)); diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaOutlinePage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaOutlinePage.java index f3a1eae..983e395 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaOutlinePage.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaOutlinePage.java @@ -13,6 +13,7 @@ package net.sourceforge.phpeclipse.phpeditor; import java.util.Enumeration; import java.util.Hashtable; import java.util.List; +import java.util.ResourceBundle; import java.util.Vector; import net.sourceforge.phpdt.core.ElementChangedEvent; @@ -51,6 +52,7 @@ import net.sourceforge.phpeclipse.PHPeclipsePlugin; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.ListenerList; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IMenuListener; @@ -63,7 +65,6 @@ import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.text.Assert; import org.eclipse.jface.text.ITextSelection; import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.ListenerList; import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.jface.viewers.IBaseLabelProvider; import org.eclipse.jface.viewers.IPostSelectionProvider; @@ -101,6 +102,7 @@ import org.eclipse.ui.part.IShowInTarget; import org.eclipse.ui.part.IShowInTargetList; import org.eclipse.ui.part.Page; import org.eclipse.ui.part.ShowInContext; +import org.eclipse.ui.texteditor.GotoAnnotationAction; import org.eclipse.ui.texteditor.ITextEditorActionConstants; import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds; import org.eclipse.ui.texteditor.IUpdate; @@ -931,9 +933,11 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, fContextMenuID = contextMenuID; fEditor = editor; fTogglePresentation = new TogglePresentationAction(); - fPreviousAnnotation = new GotoAnnotationAction( - "PreviousAnnotation.", false); //$NON-NLS-1$ - fNextAnnotation = new GotoAnnotationAction("NextAnnotation.", true); //$NON-NLS-1$ + ResourceBundle bundle = PHPEditorMessages.getResourceBundle(); + fPreviousAnnotation = new GotoAnnotationAction(bundle, + "PreviousAnnotation.", null, false); //$NON-NLS-1$ + fNextAnnotation = new GotoAnnotationAction(bundle, + "NextAnnotation.", null, true); //$NON-NLS-1$ fShowJavadoc = (TextEditorAction) fEditor.getAction("ShowJavaDoc"); //$NON-NLS-1$ fUndo = fEditor.getAction(ITextEditorActionConstants.UNDO); fRedo = fEditor.getAction(ITextEditorActionConstants.REDO); -- 1.7.1