diff --git a/memory/org.eclipse.cdt.debug.ui.memory.search/plugin.xml b/memory/org.eclipse.cdt.debug.ui.memory.search/plugin.xml index 7114869a804..fa52bcdcce5 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.search/plugin.xml +++ b/memory/org.eclipse.cdt.debug.ui.memory.search/plugin.xml @@ -14,6 +14,7 @@ menubarPath="additions"> + @@ -39,6 +40,7 @@ menubarPath="additions"> + @@ -55,13 +57,30 @@ - - + + + + + + + + + + + + + + + + + diff --git a/memory/org.eclipse.cdt.debug.ui.memory.search/src/org/eclipse/cdt/debug/ui/memory/search/FindAction.java b/memory/org.eclipse.cdt.debug.ui.memory.search/src/org/eclipse/cdt/debug/ui/memory/search/FindAction.java index 913f1aad4a7..2a768914926 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.search/src/org/eclipse/cdt/debug/ui/memory/search/FindAction.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.search/src/org/eclipse/cdt/debug/ui/memory/search/FindAction.java @@ -33,6 +33,8 @@ public class FindAction implements IViewActionDelegate { private static Properties fSearchDialogProperties = new Properties(); + public static Properties getProperties() { return fSearchDialogProperties; } + public void init(IViewPart view) { if (view instanceof IMemoryRenderingSite) fView = (IMemoryRenderingSite) view; diff --git a/memory/org.eclipse.cdt.debug.ui.memory.search/src/org/eclipse/cdt/debug/ui/memory/search/FindReplaceDialog.java b/memory/org.eclipse.cdt.debug.ui.memory.search/src/org/eclipse/cdt/debug/ui/memory/search/FindReplaceDialog.java index b44a93ff497..3b68bb47714 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.search/src/org/eclipse/cdt/debug/ui/memory/search/FindReplaceDialog.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.search/src/org/eclipse/cdt/debug/ui/memory/search/FindReplaceDialog.java @@ -707,6 +707,7 @@ public class FindReplaceDialog extends SelectionDialog fCaseInSensitiveCheckbox = new Button(optionsGroup, SWT.CHECK); fCaseInSensitiveCheckbox.setText(Messages.getString("FindReplaceDialog.ButtonCaseInsensitive")); //$NON-NLS-1$ fCaseInSensitiveCheckbox.setEnabled(format.equals(SEARCH_FORMAT_ASCII)); + fCaseInSensitiveCheckbox.setSelection(Boolean.parseBoolean(fProperties.getProperty(SEARCH_FORMAT_CASEINSENSTIVE, Boolean.FALSE.toString()))); fFormatAsciiButton.addSelectionListener(new SelectionListener() { diff --git a/memory/org.eclipse.cdt.debug.ui.memory.search/src/org/eclipse/cdt/debug/ui/memory/search/FindReplaceHandler.java b/memory/org.eclipse.cdt.debug.ui.memory.search/src/org/eclipse/cdt/debug/ui/memory/search/FindReplaceHandler.java new file mode 100644 index 00000000000..04fdee5f259 --- /dev/null +++ b/memory/org.eclipse.cdt.debug.ui.memory.search/src/org/eclipse/cdt/debug/ui/memory/search/FindReplaceHandler.java @@ -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; + } +}