diff --git a/core/org.eclipse.cdt.ui/plugin.properties b/core/org.eclipse.cdt.ui/plugin.properties
index 28ee4b937db..abe99c4098d 100644
--- a/core/org.eclipse.cdt.ui/plugin.properties
+++ b/core/org.eclipse.cdt.ui/plugin.properties
@@ -117,6 +117,12 @@ ActionDefinition.format.description=Format Source Code
ActionDefinition.gotoMatchingBracket.name= Go to Matching Bracket
ActionDefinition.gotoMatchingBracket.description= Moves the cursor to the matching bracket
+ActionDefinition.gotoNextBookmark.name= Next Bookmark
+ActionDefinition.gotoNextBookmark.description= Goto next bookmark of the selected file
+
+ActionDefinition.FindWord.name= Find Word
+ActionDefinition.FindWord.description= Select a word and find the next occurrence
+
ActionDefinition.toggleSourceHeader.name= Toggle Source/Header
ActionDefinition.toggleSourceHeader.description= Toggles between corresponding source and header files
@@ -480,3 +486,5 @@ indexedFilesDecorator.label = C/C++ Indexed Files
# Hyperlinking
cEditorHyperlinkTarget= C/C++ Editor
cElementHyperlinkDetector= C/C++ Elements
+
+keybinding.MSVS= Microsoft Visual Studio
diff --git a/core/org.eclipse.cdt.ui/plugin.xml b/core/org.eclipse.cdt.ui/plugin.xml
index e2ebd4df889..d9c4e83d501 100644
--- a/core/org.eclipse.cdt.ui/plugin.xml
+++ b/core/org.eclipse.cdt.ui/plugin.xml
@@ -1411,6 +1411,7 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1746,6 +1914,18 @@
categoryId="org.eclipse.cdt.ui.category.source"
id="org.eclipse.cdt.ui.edit.text.c.goto.matching.bracket">
+
+
+
+
l2) return 1;
+ if (l1 < l2) return -1;
+ return 0;
+ }
+ }
+
+ /**
+ * Creates new action.
+ */
+ public GotoNextBookmarkAction(ResourceBundle bundle, String prefix, ITextEditor editor) {
+ super(bundle, prefix, editor);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @SuppressWarnings("unchecked")
+ public void run() {
+ ITextEditor editor = getTextEditor();
+ if (editor == null )
+ return;
+
+ ISelectionProvider provider = editor.getSelectionProvider();
+ if (provider == null)
+ return;
+
+ ITextSelection selection = (ITextSelection) provider.getSelection();
+ if (selection == null || selection.isEmpty())
+ return;
+
+ IEditorInput input= editor.getEditorInput();
+ if (input == null)
+ return;
+
+ IResource resource = (IResource)(input).getAdapter(IResource.class);
+ if (resource == null || !(resource instanceof IFile))
+ return;
+
+ try {
+ IMarker[] bookmarks = resource.findMarkers(IMarker.BOOKMARK, true, IResource.DEPTH_ONE);
+ if (bookmarks.length == 0)
+ return;
+
+ // sort bookmarks by line number
+ CompareMarker comparator = new CompareMarker();
+ Arrays.sort(bookmarks, comparator);
+
+ // marker line numbers are 1-based
+ int line = selection.getStartLine() + 1;
+ IMarker lastBookmark = bookmarks[bookmarks.length - 1];
+
+ // start from the beginning of file if reached or went beyond last bookmark
+ if (line >= MarkerUtilities.getLineNumber(lastBookmark)) {
+ line = 1;
+ }
+
+ // find the next bookmark and goto it
+ for (int i = 0; i < bookmarks.length; i++) {
+ IMarker bookmark = bookmarks[i];
+ if (MarkerUtilities.getLineNumber(bookmark) > line) {
+ IDE.openEditor(getTextEditor().getSite().getPage(), bookmark, OpenStrategy.activateOnOpen());
+ break;
+ }
+ }
+ }
+ catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java
index 90095640f7a..fd0c767fc1d 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java
@@ -190,8 +190,10 @@ import org.eclipse.cdt.internal.ui.IContextMenuConstants;
import org.eclipse.cdt.internal.ui.actions.AddBlockCommentAction;
import org.eclipse.cdt.internal.ui.actions.FoldingActionGroup;
import org.eclipse.cdt.internal.ui.actions.GoToNextPreviousMemberAction;
+import org.eclipse.cdt.internal.ui.actions.GotoNextBookmarkAction;
import org.eclipse.cdt.internal.ui.actions.IndentAction;
import org.eclipse.cdt.internal.ui.actions.RemoveBlockCommentAction;
+import org.eclipse.cdt.internal.ui.actions.FindWordAction;
import org.eclipse.cdt.internal.ui.actions.SelectionConverter;
import org.eclipse.cdt.internal.ui.dnd.TextEditorDropAdapter;
import org.eclipse.cdt.internal.ui.dnd.TextViewerDragAdapter;
@@ -2012,6 +2014,16 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
IAction action= new GotoMatchingBracketAction(this);
action.setActionDefinitionId(ICEditorActionDefinitionIds.GOTO_MATCHING_BRACKET);
setAction(GotoMatchingBracketAction.GOTO_MATCHING_BRACKET, action);
+
+ action = new GotoNextBookmarkAction(CEditorMessages.getResourceBundle(), "GotoNextBookmark.", this); //$NON-NLS-1$
+ action.setActionDefinitionId(ICEditorActionDefinitionIds.GOTO_NEXT_BOOKMARK);
+ setAction(GotoNextBookmarkAction.NEXT_BOOKMARK, action);
+
+ action = new FindWordAction(CEditorMessages.getResourceBundle(), "FindWord.", this, getSourceViewer()); //$NON-NLS-1$
+ action.setActionDefinitionId(ICEditorActionDefinitionIds.FIND_WORD);
+ setAction(FindWordAction.FIND_WORD, action);
+ markAsStateDependentAction(FindWordAction.FIND_WORD, true);
+ markAsSelectionDependentAction(FindWordAction.FIND_WORD, true);
action = new ToggleCommentAction(CEditorMessages.getResourceBundle(), "ToggleComment.", this); //$NON-NLS-1$
action.setActionDefinitionId(ICEditorActionDefinitionIds.TOGGLE_COMMENT);
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditorActionContributor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditorActionContributor.java
index 288f322e0c4..c785041f86b 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditorActionContributor.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditorActionContributor.java
@@ -30,7 +30,9 @@ import org.eclipse.ui.texteditor.RetargetTextEditorAction;
import org.eclipse.cdt.internal.ui.CPluginImages;
import org.eclipse.cdt.internal.ui.IContextMenuConstants;
+import org.eclipse.cdt.internal.ui.actions.FindWordAction;
import org.eclipse.cdt.internal.ui.actions.GoToNextPreviousMemberAction;
+import org.eclipse.cdt.internal.ui.actions.GotoNextBookmarkAction;
public class CEditorActionContributor extends TextEditorActionContributor {
@@ -44,12 +46,14 @@ public class CEditorActionContributor extends TextEditorActionContributor {
private GotoAnnotationAction fPreviousAnnotation;
private GotoAnnotationAction fNextAnnotation;
private RetargetTextEditorAction fGotoMatchingBracket;
+ private RetargetTextEditorAction fGotoNextBookmark;
private RetargetTextEditorAction fGotoNextMemberAction;
private RetargetTextEditorAction fGotoPreviousMemberAction;
private RetargetTextEditorAction fToggleInsertModeAction;
private RetargetTextEditorAction fShowOutline;
private RetargetTextEditorAction fToggleSourceHeader;
private ToggleMarkOccurrencesAction fToggleMarkOccurrencesAction;
+ private RetargetTextEditorAction fFindWord;
public CEditorActionContributor() {
super();
@@ -87,6 +91,9 @@ public class CEditorActionContributor extends TextEditorActionContributor {
fGotoMatchingBracket= new RetargetTextEditorAction(bundle, "GotoMatchingBracket."); //$NON-NLS-1$
fGotoMatchingBracket.setActionDefinitionId(ICEditorActionDefinitionIds.GOTO_MATCHING_BRACKET);
+ fGotoNextBookmark = new RetargetTextEditorAction(bundle, "GotoNextBookmark."); //$NON-NLS-1$
+ fGotoNextBookmark.setActionDefinitionId(ICEditorActionDefinitionIds.GOTO_NEXT_BOOKMARK);
+
fGotoNextMemberAction= new RetargetTextEditorAction(bundle, "GotoNextMember."); //$NON-NLS-1$
fGotoNextMemberAction.setActionDefinitionId(ICEditorActionDefinitionIds.GOTO_NEXT_MEMBER);
fGotoPreviousMemberAction= new RetargetTextEditorAction(bundle, "GotoPreviousMember."); //$NON-NLS-1$
@@ -101,7 +108,9 @@ public class CEditorActionContributor extends TextEditorActionContributor {
fToggleSourceHeader= new RetargetTextEditorAction(bundle, "ToggleSourceHeader."); //$NON-NLS-1$
fToggleSourceHeader.setActionDefinitionId(ICEditorActionDefinitionIds.TOGGLE_SOURCE_HEADER);
- }
+ fFindWord = new RetargetTextEditorAction(bundle, "FindWord."); //$NON-NLS-1$
+ fFindWord.setActionDefinitionId(ICEditorActionDefinitionIds.FIND_WORD);
+ }
/*
* @see org.eclipse.ui.texteditor.BasicTextEditorActionContributor#contributeToMenu(org.eclipse.jface.action.IMenuManager)
@@ -116,6 +125,8 @@ public class CEditorActionContributor extends TextEditorActionContributor {
editMenu.appendToGroup(ITextEditorActionConstants.GROUP_ASSIST, fContentAssist);
editMenu.appendToGroup(ITextEditorActionConstants.GROUP_ASSIST, fContextInformation);
+ editMenu.prependToGroup(IWorkbenchActionConstants.FIND_EXT, fFindWord);
+
editMenu.appendToGroup(ITextEditorActionConstants.GROUP_GENERATE, fShiftRight);
editMenu.appendToGroup(ITextEditorActionConstants.GROUP_GENERATE, fShiftLeft);
editMenu.appendToGroup(ITextEditorActionConstants.GROUP_GENERATE, fFormatter);
@@ -138,6 +149,7 @@ public class CEditorActionContributor extends TextEditorActionContributor {
gotoMenu.appendToGroup("additions2", fGotoPreviousMemberAction); //$NON-NLS-1$
gotoMenu.appendToGroup("additions2", fGotoNextMemberAction); //$NON-NLS-1$
gotoMenu.appendToGroup("additions2", fGotoMatchingBracket); //$NON-NLS-1$
+ gotoMenu.appendToGroup("additions2", fGotoNextBookmark); //$NON-NLS-1$
}
}
@@ -185,12 +197,14 @@ public class CEditorActionContributor extends TextEditorActionContributor {
fFormatter.setAction(getAction(textEditor, "Format")); //$NON-NLS-1$
fGotoMatchingBracket.setAction(getAction(textEditor, GotoMatchingBracketAction.GOTO_MATCHING_BRACKET));
+ fGotoNextBookmark.setAction(getAction(textEditor, GotoNextBookmarkAction.NEXT_BOOKMARK));
fGotoNextMemberAction.setAction(getAction(textEditor, GoToNextPreviousMemberAction.NEXT_MEMBER));
fGotoPreviousMemberAction.setAction(getAction(textEditor, GoToNextPreviousMemberAction.PREVIOUS_MEMBER));
fShowOutline.setAction(getAction(textEditor, "OpenOutline")); //$NON-NLS-1$
fToggleSourceHeader.setAction(getAction(textEditor, "ToggleSourceHeader")); //$NON-NLS-1$
fToggleInsertModeAction.setAction(getAction(textEditor, ITextEditorActionConstants.TOGGLE_INSERT_MODE));
+ fFindWord.setAction(getAction(textEditor, FindWordAction.FIND_WORD));
if (part instanceof CEditor) {
CEditor cEditor= (CEditor) part;
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditorMessages.properties b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditorMessages.properties
index 9f4e40c32bb..c45aea72a4b 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditorMessages.properties
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditorMessages.properties
@@ -118,6 +118,14 @@ GotoMatchingBracket.description=Go to Matching Bracket
GotoMatchingBracket.error.invalidSelection=No bracket selected
GotoMatchingBracket.error.noMatchingBracket=No matching bracket found
+GotoNextBookmark.description=Goto next bookmark of the selected file
+GotoNextBookmark.label=Next Bookmark
+GotoNextBookmark.tooltip=Goto Next Bookmark of the Selected File
+
+FindWord.description=Select a word and find the next occurrence
+FindWord.label=Find Word
+FindWord.tooltip=Select a Word and Find the Next Occurrence
+
ToggleComment_error_title=Comment/Uncomment
ToggleComment_error_message=An error occurred while commenting/uncommenting.
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/ICEditorActionDefinitionIds.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/ICEditorActionDefinitionIds.java
index 31975edd089..0dfeca9dc11 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/ICEditorActionDefinitionIds.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/ICEditorActionDefinitionIds.java
@@ -178,6 +178,18 @@ public interface ICEditorActionDefinitionIds extends ITextEditorActionDefinition
*/
public static final String GOTO_MATCHING_BRACKET= "org.eclipse.cdt.ui.edit.text.c.goto.matching.bracket"; //$NON-NLS-1$
+ /**
+ * Action definition ID for goto next bookmark action
+ * (value "org.eclipse.cdt.ui.edit.text.c.goto.next.bookmark"
).
+ */
+ public static final String GOTO_NEXT_BOOKMARK = "org.eclipse.cdt.ui.edit.text.c.goto.next.bookmark"; //$NON-NLS-1$
+
+ /**
+ * Action definition ID for find word action
+ * (value "org.eclipse.cdt.ui.edit.text.c.find.word"
).
+ */
+ public static final String FIND_WORD = "org.eclipse.cdt.ui.edit.text.c.find.word"; //$NON-NLS-1$
+
/**
* Action definition ID for toggle source/header action.
* (value "org.eclipse.cdt.ui.edit.text.c.toggle.source.header"
)