mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
Adds text-search to the context-menu. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=126749
This commit is contained in:
parent
256cdaa7a7
commit
6051a416ba
1 changed files with 10 additions and 1 deletions
|
@ -84,6 +84,7 @@ import org.eclipse.jface.viewers.ISelectionProvider;
|
|||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
import org.eclipse.search.ui.actions.TextSearchGroup;
|
||||
import org.eclipse.swt.custom.StyledText;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
|
@ -151,6 +152,7 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS
|
|||
|
||||
/** Search actions **/
|
||||
private ActionGroup fSelectionSearchGroup;
|
||||
private ActionGroup fTextSearchGroup;
|
||||
/** Action which shows selected element in CView. */
|
||||
private ShowInCViewAction fShowInCViewAction;
|
||||
|
||||
|
@ -600,6 +602,11 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS
|
|||
fSelectionSearchGroup = null;
|
||||
}
|
||||
|
||||
if (fTextSearchGroup != null) {
|
||||
fTextSearchGroup.dispose();
|
||||
fTextSearchGroup = null;
|
||||
}
|
||||
|
||||
if (fEditorSelectionChangedListener != null) {
|
||||
fEditorSelectionChangedListener.uninstall(getSelectionProvider());
|
||||
fEditorSelectionChangedListener= null;
|
||||
|
@ -734,6 +741,7 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS
|
|||
|
||||
//Assorted action groupings
|
||||
fSelectionSearchGroup = new SelectionSearchGroup(this);
|
||||
fTextSearchGroup= new TextSearchGroup(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -766,6 +774,7 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS
|
|||
addAction(menu, IContextMenuConstants.GROUP_GENERATE, "ShowInCView"); //$NON-NLS-1$
|
||||
|
||||
fSelectionSearchGroup.fillContextMenu(menu);
|
||||
fTextSearchGroup.fillContextMenu(menu);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1071,7 +1080,7 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS
|
|||
try {
|
||||
boolean isProblem= marker.isSubtypeOf(IMarker.PROBLEM);
|
||||
IWorkbenchPage page= getSite().getPage();
|
||||
IViewPart view= page.findView(isProblem ? IPageLayout.ID_PROBLEM_VIEW: IPageLayout.ID_TASK_LIST); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
IViewPart view= page.findView(isProblem ? IPageLayout.ID_PROBLEM_VIEW: IPageLayout.ID_TASK_LIST);
|
||||
if (view != null) {
|
||||
Method method= view.getClass().getMethod("setSelection", new Class[] { IStructuredSelection.class, boolean.class}); //$NON-NLS-1$
|
||||
method.invoke(view, new Object[] {new StructuredSelection(marker), Boolean.TRUE });
|
||||
|
|
Loading…
Add table
Reference in a new issue