mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 326965 - Added Ctrl+F functionality to bring up the Find/Replace dialog. Also fixed persistence issue with Context Sensitive entry.
This commit is contained in:
parent
d5fbab8502
commit
8f8c163b4d
4 changed files with 92 additions and 7 deletions
|
@ -14,6 +14,7 @@
|
||||||
menubarPath="additions">
|
menubarPath="additions">
|
||||||
</action>
|
</action>
|
||||||
</viewContribution>
|
</viewContribution>
|
||||||
|
|
||||||
<viewContribution
|
<viewContribution
|
||||||
id="org.eclipse.debug.ui.MemoryView.findReplace"
|
id="org.eclipse.debug.ui.MemoryView.findReplace"
|
||||||
targetID="org.eclipse.debug.ui.MemoryView">
|
targetID="org.eclipse.debug.ui.MemoryView">
|
||||||
|
@ -39,6 +40,7 @@
|
||||||
menubarPath="additions">
|
menubarPath="additions">
|
||||||
</action>
|
</action>
|
||||||
</viewContribution>
|
</viewContribution>
|
||||||
|
|
||||||
<viewContribution
|
<viewContribution
|
||||||
id="org.eclipse.debug.ui.MemoryView.findReplace"
|
id="org.eclipse.debug.ui.MemoryView.findReplace"
|
||||||
targetID="org.eclipse.cdt.debug.ui.memory.memorybrowser.MemoryBrowser">
|
targetID="org.eclipse.cdt.debug.ui.memory.memorybrowser.MemoryBrowser">
|
||||||
|
@ -55,13 +57,30 @@
|
||||||
</extension>
|
</extension>
|
||||||
|
|
||||||
<extension point="org.eclipse.search.searchResultViewPages">
|
<extension point="org.eclipse.search.searchResultViewPages">
|
||||||
<viewPage
|
<viewPage
|
||||||
class="org.eclipse.cdt.debug.ui.memory.search.MemorySearchResultsPage"
|
class="org.eclipse.cdt.debug.ui.memory.search.MemorySearchResultsPage"
|
||||||
icon="icons/full/obj16/tsearch_dpdn_obj.gif"
|
icon="icons/full/obj16/tsearch_dpdn_obj.gif"
|
||||||
id="org.eclipse.cdt.debug.ui.memory.search.MemorySearchResultsPage"
|
id="org.eclipse.cdt.debug.ui.memory.search.MemorySearchResultsPage"
|
||||||
label="Memory Search Results"
|
label="Memory Search Results"
|
||||||
searchResultClass="org.eclipse.cdt.debug.ui.memory.search.MemorySearchResult">
|
searchResultClass="org.eclipse.cdt.debug.ui.memory.search.MemorySearchResult">
|
||||||
</viewPage>
|
</viewPage>
|
||||||
|
</extension>
|
||||||
|
|
||||||
|
<extension point="org.eclipse.ui.handlers">
|
||||||
|
<handler
|
||||||
|
commandId="org.eclipse.ui.edit.findReplace"
|
||||||
|
class="org.eclipse.cdt.debug.ui.memory.search.FindReplaceHandler">
|
||||||
|
<activeWhen>
|
||||||
|
<or>
|
||||||
|
<with variable="activePartId">
|
||||||
|
<equals value="org.eclipse.debug.ui.MemoryView"/>
|
||||||
|
</with>
|
||||||
|
<with variable="activePartId">
|
||||||
|
<equals value="org.eclipse.cdt.debug.ui.memory.memorybrowser.MemoryBrowser"/>
|
||||||
|
</with>
|
||||||
|
</or>
|
||||||
|
</activeWhen>
|
||||||
|
</handler>
|
||||||
</extension>
|
</extension>
|
||||||
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -33,6 +33,8 @@ public class FindAction implements IViewActionDelegate {
|
||||||
|
|
||||||
private static Properties fSearchDialogProperties = new Properties();
|
private static Properties fSearchDialogProperties = new Properties();
|
||||||
|
|
||||||
|
public static Properties getProperties() { return fSearchDialogProperties; }
|
||||||
|
|
||||||
public void init(IViewPart view) {
|
public void init(IViewPart view) {
|
||||||
if (view instanceof IMemoryRenderingSite)
|
if (view instanceof IMemoryRenderingSite)
|
||||||
fView = (IMemoryRenderingSite) view;
|
fView = (IMemoryRenderingSite) view;
|
||||||
|
|
|
@ -707,6 +707,7 @@ public class FindReplaceDialog extends SelectionDialog
|
||||||
fCaseInSensitiveCheckbox = new Button(optionsGroup, SWT.CHECK);
|
fCaseInSensitiveCheckbox = new Button(optionsGroup, SWT.CHECK);
|
||||||
fCaseInSensitiveCheckbox.setText(Messages.getString("FindReplaceDialog.ButtonCaseInsensitive")); //$NON-NLS-1$
|
fCaseInSensitiveCheckbox.setText(Messages.getString("FindReplaceDialog.ButtonCaseInsensitive")); //$NON-NLS-1$
|
||||||
fCaseInSensitiveCheckbox.setEnabled(format.equals(SEARCH_FORMAT_ASCII));
|
fCaseInSensitiveCheckbox.setEnabled(format.equals(SEARCH_FORMAT_ASCII));
|
||||||
|
fCaseInSensitiveCheckbox.setSelection(Boolean.parseBoolean(fProperties.getProperty(SEARCH_FORMAT_CASEINSENSTIVE, Boolean.FALSE.toString())));
|
||||||
|
|
||||||
fFormatAsciiButton.addSelectionListener(new SelectionListener()
|
fFormatAsciiButton.addSelectionListener(new SelectionListener()
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2010 Wind River Systems and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Wind River Systems - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.cdt.debug.ui.memory.search;
|
||||||
|
|
||||||
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
|
import org.eclipse.core.commands.ExecutionException;
|
||||||
|
import org.eclipse.core.commands.IHandler;
|
||||||
|
import org.eclipse.debug.core.model.IMemoryBlock;
|
||||||
|
import org.eclipse.debug.core.model.IMemoryBlockExtension;
|
||||||
|
import org.eclipse.debug.ui.memory.IMemoryRendering;
|
||||||
|
import org.eclipse.debug.ui.memory.IMemoryRenderingSite;
|
||||||
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
import org.eclipse.ui.IWorkbenchPart;
|
||||||
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
|
||||||
|
public class FindReplaceHandler extends AbstractHandler implements IHandler {
|
||||||
|
private static FindReplaceDialog dialog = null;
|
||||||
|
|
||||||
|
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||||
|
IWorkbenchPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart();
|
||||||
|
if (part instanceof IMemoryRenderingSite) {
|
||||||
|
IMemoryRenderingSite fView = (IMemoryRenderingSite) part;
|
||||||
|
ISelection selection = fView.getSite().getSelectionProvider().getSelection();
|
||||||
|
|
||||||
|
if (selection instanceof IStructuredSelection) {
|
||||||
|
IStructuredSelection strucSel = (IStructuredSelection) selection;
|
||||||
|
|
||||||
|
if (!strucSel.isEmpty()) {
|
||||||
|
IMemoryBlock memBlock = null;
|
||||||
|
Object obj = strucSel.getFirstElement();
|
||||||
|
|
||||||
|
if (obj instanceof IMemoryRendering) {
|
||||||
|
memBlock = ((IMemoryRendering) obj).getMemoryBlock();
|
||||||
|
}
|
||||||
|
else if (obj instanceof IMemoryBlock) {
|
||||||
|
memBlock = (IMemoryBlock) obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (memBlock instanceof IMemoryBlockExtension) {
|
||||||
|
if (dialog == null) {
|
||||||
|
dialog = new FindReplaceDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
|
||||||
|
(IMemoryBlockExtension) memBlock, fView, FindAction.getProperties(), null);
|
||||||
|
}
|
||||||
|
dialog.open();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue