From 957d0c60099a3a38b85a149b308c6df74a7404db Mon Sep 17 00:00:00 2001 From: Samantha Chan Date: Fri, 3 Mar 2006 18:20:59 +0000 Subject: Bug 129761 - [Memory View] memory view UI issues --- org.eclipse.debug.ui/plugin.properties | 8 +- org.eclipse.debug.ui/plugin.xml | 26 +-- .../eclipse/debug/internal/ui/DebugUIMessages.java | 2 + .../debug/internal/ui/DebugUIMessages.properties | 7 +- .../ui/views/memory/AddMemoryRenderingDialog.java | 2 +- .../ui/views/memory/CodePagesPrefDialog.java | 173 ------------------- .../ui/views/memory/CodePagesPreferencePage.java | 92 +++++++++++ .../views/memory/MemoryBlockNavigationModel.java | 67 ++++++++ .../ui/views/memory/MemoryBlocksTreeViewPane.java | 16 +- .../debug/internal/ui/views/memory/MemoryView.java | 4 +- .../ui/views/memory/MemoryViewPrefAction.java | 62 +++++++ .../views/memory/ResetMemoryBlockPrefAction.java | 54 ------ .../memory/ResetMemoryBlockPreferencePage.java | 11 +- .../ui/views/memory/SelectCodePagesAction.java | 49 ------ .../memory/SetPaddedStringPreferencePage.java | 56 +++++++ .../ui/views/memory/SwitchMemoryBlockAction.java | 184 ++++++++++++++++----- .../views/memory/renderings/CreateRendering.java | 2 +- .../renderings/FormatTableRenderingDialog.java | 2 +- .../memory/renderings/SetPaddedStringAction.java | 41 ----- .../memory/renderings/SetPaddedStringDialog.java | 86 ---------- 20 files changed, 461 insertions(+), 483 deletions(-) delete mode 100644 org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/CodePagesPrefDialog.java create mode 100644 org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/CodePagesPreferencePage.java create mode 100644 org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlockNavigationModel.java create mode 100644 org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewPrefAction.java delete mode 100644 org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ResetMemoryBlockPrefAction.java delete mode 100644 org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SelectCodePagesAction.java create mode 100644 org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SetPaddedStringPreferencePage.java delete mode 100644 org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/SetPaddedStringAction.java delete mode 100644 org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/SetPaddedStringDialog.java diff --git a/org.eclipse.debug.ui/plugin.properties b/org.eclipse.debug.ui/plugin.properties index 06a5d14c8..d1447eb2f 100644 --- a/org.eclipse.debug.ui/plugin.properties +++ b/org.eclipse.debug.ui/plugin.properties @@ -311,11 +311,9 @@ BreakpointWorkingSet.others=Others (no working set) BreakpointWorkingSet.name=Breakpoint memoryRenderingsExtensionPointName = Memory Renderings -SetPaddedStrActionName = Set Padded String ... -TableRenderingPrefActionName = Table Renderings Preferences... +TableRenderingPrefActionName = &Table Renderings Preferences... -SelectCodepagesAction.label=Select Codepages... NewMemoryViewAction.label=New Memory View PinMemoryBlockAction.label=Pin Memory Monitor TableRenderingInfo.label = Rendering Selection @@ -340,8 +338,8 @@ toggleMemoryMonitorsPane.label = Toggle Memory Monitors Pane toggleMemoryMonitorsPane.description = Toggle visibility of the Memory Monitors Pane nextMemoryBlockCommand.label = Next Memory Monitor nextMemoryBlockCommand.description = Show renderings from next memory monitor. -resetMemoryMonitorPrefAction.label = &Reset Memory Monitor... -resetMemoryMonitorAction.label = &Reset Monitor +memoryViewPrefAction.label = &Preferences... +resetMemoryMonitorAction.label = &Reset ConsolePreferencesAction.label = &Preferences... ConsolePreferencesAction.tooltip = Opens the console's Preferences Page diff --git a/org.eclipse.debug.ui/plugin.xml b/org.eclipse.debug.ui/plugin.xml index c6454d0de..37e8dbf47 100644 --- a/org.eclipse.debug.ui/plugin.xml +++ b/org.eclipse.debug.ui/plugin.xml @@ -802,22 +802,6 @@ class="org.eclipse.debug.internal.ui.views.memory.ToggleSplitPaneAction" style="toggle" id="org.eclipse.debug.ui.togglesplitpane"/> - - + style="push" + tooltip="%memoryViewPrefAction.label"/> - \ No newline at end of file + diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.java index 069a9e0de..9f25f4edd 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.java @@ -253,4 +253,6 @@ public class DebugUIMessages extends NLS { public static String AbstractAsyncTableRendering_1; public static String CreateRendering_2; + + public static String SetPaddedStringPreferencePage_0; } \ No newline at end of file diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.properties index db0eb232b..a2b8cda7b 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.properties +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.properties @@ -118,9 +118,9 @@ MonitorMemoryBlockDialog_NumberOfBytes = Number of bytes: GoToAddressDialog_Address = Address: GoToAddressDialog_GoToAddress = Go To Address... CodePagesPrefDialog_1=Select Codepages -CodePagesPrefDialog_2=Codepage for rendering memory to ASCII strings: +CodePagesPrefDialog_2=Memory to ASCII strings: CodePagesPrefDialog_3=Change... -CodePagesPrefDialog_4=Codepage for rendering memory to EBCDIC strings: +CodePagesPrefDialog_4=Memory to EBCDIC strings: CodePagesPrefDialog_5=Change... CodePagesPrefDialog_6=Invalid codepage CodePagesPrefDialog_7=ASCII codepage entered is invalid. @@ -194,9 +194,10 @@ AbstractTableRendering_18=Save these settings to avoid this problem in the futur AbstractAsyncTableRendering_0=Pending... AbstractAsyncTableRendering_1=Pending... SetPaddedStringDialog_0=Padded String -SetPaddedStringDialog_1=Enter string to represent memory that cannot be retrieved: +SetPaddedStringDialog_1=Enter string to show unretrievable memory. SetPaddedStringDialog_3=Error in Padded String SetPaddedStringDialog_4=The padded string cannot be empty. +SetPaddedStringPreferencePage_0=Padded String: TableRenderingPropertiesPage_1=Rendering: TableRenderingPropertiesPage_2=Selected Address: TableRenderingPropertiesPage_3=units diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingDialog.java index 496cb8c37..8e45ee48b 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingDialog.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingDialog.java @@ -525,7 +525,7 @@ public class AddMemoryRenderingDialog extends SelectionDialog { final IMemoryBlock selectedBlk = selectMB; WorkbenchJob wbJob = new WorkbenchJob("populate dialog"){ //$NON-NLS-1$ - public IStatus runInUIThread(IProgressMonitor monitor) { + public IStatus runInUIThread(IProgressMonitor wbMonitor) { doPopulateDialog(memoryBlock, fViewer, labels, idx, selectedBlk); return Status.OK_STATUS; }}; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/CodePagesPrefDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/CodePagesPrefDialog.java deleted file mode 100644 index 1dec7403e..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/CodePagesPrefDialog.java +++ /dev/null @@ -1,173 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.internal.ui.views.memory; - -import java.io.UnsupportedEncodingException; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.debug.internal.ui.DebugUIMessages; -import org.eclipse.debug.internal.ui.DebugUIPlugin; -import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants; -import org.eclipse.debug.ui.DebugUITools; -import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.PlatformUI; - - -/** - * Dialog to allow user to change code page preference - * @since 3.1 - */ -public class CodePagesPrefDialog extends Dialog { - - private Text fAsciiCodePage; - private Text fEbcdicCodePage; - - /** - * @param parentShell - */ - public CodePagesPrefDialog(Shell parentShell) { - super(parentShell); - setShellStyle(getShellStyle() | SWT.RESIZE); - PlatformUI.getWorkbench().getHelpSystem().setHelp(parentShell, DebugUIPlugin.getUniqueIdentifier() + ".CodePagesPrefDialog_context"); //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) - */ - protected Control createDialogArea(Composite parent) { - - getShell().setText(DebugUIMessages.CodePagesPrefDialog_1); - setShellStyle(SWT.RESIZE); - - Composite canvas = new Composite(parent, SWT.NONE); - canvas.setLayout(new GridLayout(2, false)); - GridData spec2= new GridData(); - spec2.grabExcessVerticalSpace= true; - spec2.grabExcessHorizontalSpace= true; - spec2.horizontalAlignment= GridData.FILL; - spec2.verticalAlignment= GridData.CENTER; - canvas.setLayoutData(spec2); - - Label textLabel = new Label(canvas, SWT.WRAP); - textLabel.setText(DebugUIMessages.CodePagesPrefDialog_2); - GridData textLayout = new GridData(); - textLayout.widthHint = 280; - textLayout.horizontalSpan = 2; - textLabel.setLayoutData(textLayout); - - fAsciiCodePage = new Text(canvas, SWT.BORDER); - GridData asciispec= new GridData(); - asciispec.grabExcessVerticalSpace= false; - asciispec.grabExcessHorizontalSpace= true; - asciispec.horizontalAlignment= GridData.FILL; - asciispec.verticalAlignment= GridData.BEGINNING; - asciispec.horizontalSpan = 1; - fAsciiCodePage.setLayoutData(asciispec); - - String codepage = DebugUITools.getPreferenceStore().getString(IDebugUIConstants.PREF_DEFAULT_ASCII_CODE_PAGE); - if (codepage == null || codepage.length() == 0) - codepage = IDebugPreferenceConstants.DEFAULT_ASCII_CP; - fAsciiCodePage.setText(codepage); - - Label ebcdicLabel = new Label(canvas, SWT.WRAP); - ebcdicLabel.setText(DebugUIMessages.CodePagesPrefDialog_4); - GridData ebcdicLayout = new GridData(); - ebcdicLayout.widthHint = 280; - ebcdicLayout.horizontalSpan = 2; - ebcdicLabel.setLayoutData(ebcdicLayout); - - fEbcdicCodePage = new Text(canvas, SWT.BORDER); - GridData ebcdicspec= new GridData(); - ebcdicspec.grabExcessVerticalSpace= false; - ebcdicspec.grabExcessHorizontalSpace= true; - ebcdicspec.horizontalAlignment= GridData.FILL; - ebcdicspec.verticalAlignment= GridData.BEGINNING; - ebcdicspec.horizontalSpan = 1; - fAsciiCodePage.setLayoutData(ebcdicspec); - fEbcdicCodePage.setLayoutData(asciispec); - - codepage = DebugUITools.getPreferenceStore().getString(IDebugUIConstants.PREF_DEFAULT_EBCDIC_CODE_PAGE); - fEbcdicCodePage.setText(codepage); - - if (codepage == null || codepage.length() == 0) - codepage = IDebugPreferenceConstants.DEFAULT_EBCDIC_CP; // - - return canvas; - } - protected void okPressed() { - - // check that the codepages are supported - String asciiCodePage = fAsciiCodePage.getText(); - asciiCodePage = asciiCodePage.trim(); - try { - new String(new byte[]{1}, asciiCodePage); - } catch (UnsupportedEncodingException e) { - Shell shell = DebugUIPlugin.getShell(); - if (shell != null) - { - IStatus status = DebugUIPlugin.newErrorStatus(DebugUIMessages.CodePagesPrefDialog_0, e); - ErrorDialog.openError(shell, DebugUIMessages.CodePagesPrefDialog_6, DebugUIMessages.CodePagesPrefDialog_7, status); // - } - return; - } - - String ebcdicCodePage = fEbcdicCodePage.getText(); - ebcdicCodePage = ebcdicCodePage.trim(); - try { - new String(new byte[]{1}, ebcdicCodePage); - } catch (UnsupportedEncodingException e) { - Shell shell = DebugUIPlugin.getShell(); - if (shell != null) - { - IStatus status = DebugUIPlugin.newErrorStatus(DebugUIMessages.CodePagesPrefDialog_0, e); - ErrorDialog.openError(shell, DebugUIMessages.CodePagesPrefDialog_8, DebugUIMessages.CodePagesPrefDialog_9, status); // - } - return; - } - - IPreferenceStore store = DebugUITools.getPreferenceStore(); - store.setValue(IDebugUIConstants.PREF_DEFAULT_ASCII_CODE_PAGE, asciiCodePage); - store.setValue(IDebugUIConstants.PREF_DEFAULT_EBCDIC_CODE_PAGE, ebcdicCodePage); - - super.okPressed(); - } - - /** - * @param shell - */ - - protected void createButtonsForButtonBar(Composite parent) { - Button defaultButton = createButton(parent, 3, DebugUIMessages.CodePagesPrefDialog_13, false); - defaultButton.addSelectionListener(new SelectionAdapter() { - - public void widgetSelected(SelectionEvent e) { - String defaultASCII = IDebugPreferenceConstants.DEFAULT_ASCII_CP; - fAsciiCodePage.setText(defaultASCII); - String defaulgEBCDIC = IDebugPreferenceConstants.DEFAULT_EBCDIC_CP; - fEbcdicCodePage.setText(defaulgEBCDIC); - }}); - super.createButtonsForButtonBar(parent); - } -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/CodePagesPreferencePage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/CodePagesPreferencePage.java new file mode 100644 index 000000000..0e9a10395 --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/CodePagesPreferencePage.java @@ -0,0 +1,92 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation 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: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + + +package org.eclipse.debug.internal.ui.views.memory; + +import java.io.UnsupportedEncodingException; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.debug.internal.ui.DebugUIMessages; +import org.eclipse.debug.internal.ui.DebugUIPlugin; +import org.eclipse.debug.ui.DebugUITools; +import org.eclipse.debug.ui.IDebugUIConstants; +import org.eclipse.jface.dialogs.ErrorDialog; +import org.eclipse.jface.preference.FieldEditorPreferencePage; +import org.eclipse.jface.preference.StringFieldEditor; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.PlatformUI; + +public class CodePagesPreferencePage extends FieldEditorPreferencePage { + + private StringFieldEditor fEbcdicCodePage; + private StringFieldEditor fAsciiCodePage; + + protected CodePagesPreferencePage() { + super(FieldEditorPreferencePage.GRID); + setPreferenceStore(DebugUITools.getPreferenceStore()); + setTitle(DebugUIMessages.CodePagesPrefDialog_1); + } + + protected void createFieldEditors() { + fAsciiCodePage = new StringFieldEditor(IDebugUIConstants.PREF_DEFAULT_ASCII_CODE_PAGE, DebugUIMessages.CodePagesPrefDialog_2, getFieldEditorParent()); + fAsciiCodePage.setEmptyStringAllowed(false); + addField(fAsciiCodePage); + + fEbcdicCodePage = new StringFieldEditor(IDebugUIConstants.PREF_DEFAULT_EBCDIC_CODE_PAGE, DebugUIMessages.CodePagesPrefDialog_4, getFieldEditorParent()); + fEbcdicCodePage.setEmptyStringAllowed(false); + addField(fEbcdicCodePage); + } + + public boolean performOk() { + + if (fAsciiCodePage == null || fEbcdicCodePage == null) + return super.performOk(); + + // check that the codepages are supported + String asciiCodePage = fAsciiCodePage.getStringValue(); + asciiCodePage = asciiCodePage.trim(); + try { + new String(new byte[]{1}, asciiCodePage); + } catch (UnsupportedEncodingException e) { + Shell shell = DebugUIPlugin.getShell(); + if (shell != null) + { + IStatus status = DebugUIPlugin.newErrorStatus(DebugUIMessages.CodePagesPrefDialog_0, e); + ErrorDialog.openError(shell, DebugUIMessages.CodePagesPrefDialog_6, DebugUIMessages.CodePagesPrefDialog_7, status); // + } + return false; + } + + String ebcdicCodePage = fEbcdicCodePage.getStringValue(); + ebcdicCodePage = ebcdicCodePage.trim(); + try { + new String(new byte[]{1}, ebcdicCodePage); + } catch (UnsupportedEncodingException e) { + Shell shell = DebugUIPlugin.getShell(); + if (shell != null) + { + IStatus status = DebugUIPlugin.newErrorStatus(DebugUIMessages.CodePagesPrefDialog_0, e); + ErrorDialog.openError(shell, DebugUIMessages.CodePagesPrefDialog_8, DebugUIMessages.CodePagesPrefDialog_9, status); // + } + return false; + } + return super.performOk(); + } + + protected Control createContents(Composite parent) { + PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, DebugUIPlugin.getUniqueIdentifier() + ".CodePagesPrefDialog_context"); //$NON-NLS-1$ + return super.createContents(parent); + } + +} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlockNavigationModel.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlockNavigationModel.java new file mode 100644 index 000000000..c27a912d0 --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlockNavigationModel.java @@ -0,0 +1,67 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation 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: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.debug.internal.ui.views.memory; + +import java.util.ArrayList; + +import org.eclipse.debug.internal.ui.viewers.AsynchronousTreeViewer; +import org.eclipse.swt.widgets.TreeItem; + +public class MemoryBlockNavigationModel { + + private ArrayList fElements; + private AsynchronousTreeViewer fViewer = null; + + public MemoryBlockNavigationModel(AsynchronousTreeViewer viewer) { + init(viewer); + } + + /** + * initialize cache of + * @param viewer + */ + private void init(AsynchronousTreeViewer viewer) { + fViewer = viewer; + fElements = new ArrayList(); + TreeItem[] items = viewer.getTree().getItems(); + traverse(items); + } + + private void traverse(TreeItem[] items) { + for (int i = 0; i < items.length; i++) { + TreeItem item = items[i]; + Object data = item.getData(); + if (data != null) { + fElements.add(data); + traverse(item.getItems()); + } + } + } + + /** + * Returns all the elements in the tree. + * + * @return + */ + public Object[] getElements() { + return fElements.toArray(); + } + + /** + * Returns the viewer this navigation model is for. + * + * @return + */ + AsynchronousTreeViewer getViewer() { + return fViewer; + } +} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlocksTreeViewPane.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlocksTreeViewPane.java index 05a3ad402..914910834 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlocksTreeViewPane.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlocksTreeViewPane.java @@ -56,7 +56,6 @@ import org.eclipse.jface.viewers.TreePath; import org.eclipse.jface.viewers.TreeSelection; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Menu; @@ -315,14 +314,8 @@ public class MemoryBlocksTreeViewPane implements ISelectionListener, ISelectionC public Control createViewPane(Composite parent, String paneId, String label) { - Composite composite = new Composite(parent, SWT.FILL); - GridLayout layout = new GridLayout(); - layout.numColumns = 1; - layout.makeColumnsEqualWidth = false; - composite.setLayout(layout); - fPaneId = paneId; - fTreeViewer = new AsynchronousTreeViewer(composite); + fTreeViewer = new AsynchronousTreeViewer(parent); MemoryViewPresentationContext presentationContext = new MemoryViewPresentationContext(fParent); presentationContext.setContainerId(getId()); @@ -363,7 +356,7 @@ public class MemoryBlocksTreeViewPane implements ISelectionListener, ISelectionC updateActionsEnablement(); - return composite; + return fTreeViewer.getControl(); } @@ -654,4 +647,9 @@ public class MemoryBlocksTreeViewPane implements ISelectionListener, ISelectionC MemoryBlocksTreeViewPane.this.selectionChanged(fParent, event.getSelection()); } } + + public AsynchronousTreeViewer getViewer() + { + return fTreeViewer; + } } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryView.java index dc5f710ea..b3a25ba90 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryView.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryView.java @@ -433,7 +433,7 @@ public class MemoryView extends ViewPart implements IMemoryRenderingSite { fMemBlkViewer = new MemoryBlocksTreeViewPane(this); fViewPanes.put(MemoryBlocksTreeViewPane.PANE_ID, fMemBlkViewer); - ViewForm viewerViewForm = new ViewForm(parent, SWT.FLAT); + ViewForm viewerViewForm = new ViewForm(parent, SWT.NONE); fViewPaneControls.put(MemoryBlocksTreeViewPane.PANE_ID, viewerViewForm); fWeights.add(new Integer(15)); @@ -466,7 +466,7 @@ public class MemoryView extends ViewPart implements IMemoryRenderingSite { public void createRenderingViewPane(String paneId) { RenderingViewPane renderingPane = new RenderingViewPane(this); fViewPanes.put(paneId, renderingPane); - ViewForm renderingViewForm = new ViewForm(fSashForm, SWT.FLAT); + ViewForm renderingViewForm = new ViewForm(fSashForm, SWT.NONE); fViewPaneControls.put(paneId, renderingViewForm); fWeights.add(new Integer(40)); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewPrefAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewPrefAction.java new file mode 100644 index 000000000..9b54d9fc2 --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewPrefAction.java @@ -0,0 +1,62 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation 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: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.debug.internal.ui.views.memory; + +import org.eclipse.debug.internal.ui.DebugUIPlugin; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.preference.IPreferenceNode; +import org.eclipse.jface.preference.PreferenceDialog; +import org.eclipse.jface.preference.PreferenceManager; +import org.eclipse.jface.preference.PreferenceNode; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.ui.IViewActionDelegate; +import org.eclipse.ui.IViewPart; + +public class MemoryViewPrefAction implements IViewActionDelegate { + + public void init(IViewPart view) { + + } + + public void run(IAction action) { + + PreferenceManager prefManager = new PreferenceManager(); + + ResetMemoryBlockPreferencePage page = new ResetMemoryBlockPreferencePage(); + IPreferenceNode node = new PreferenceNode("org.eclipse.debug.ui.memory.resetMemoryBlock", page); //$NON-NLS-1$ + prefManager.addToRoot(node); + + SetPaddedStringPreferencePage page2 = new SetPaddedStringPreferencePage(); + IPreferenceNode node2 = new PreferenceNode("org.eclipse.debug.ui.memory.setPaddedString", page2); //$NON-NLS-1$ + prefManager.addToRoot(node2); + + CodePagesPreferencePage page3 = new CodePagesPreferencePage(); + IPreferenceNode node3 = new PreferenceNode("org.eclipse.debug.ui.memory.codePages", page3); //$NON-NLS-1$ + prefManager.addToRoot(node3); + + final PreferenceDialog dialog = new PreferenceDialog(DebugUIPlugin.getShell(), prefManager); + + BusyIndicator.showWhile(DebugUIPlugin.getStandardDisplay(), new Runnable() { + public void run() { + dialog.create(); + dialog.open(); + } + }); + + } + + public void selectionChanged(IAction action, ISelection selection) { + + } + +} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ResetMemoryBlockPrefAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ResetMemoryBlockPrefAction.java deleted file mode 100644 index 9a483b0cb..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ResetMemoryBlockPrefAction.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.debug.internal.ui.views.memory; - -import org.eclipse.debug.internal.ui.DebugUIPlugin; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.preference.IPreferenceNode; -import org.eclipse.jface.preference.PreferenceDialog; -import org.eclipse.jface.preference.PreferenceManager; -import org.eclipse.jface.preference.PreferenceNode; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.swt.custom.BusyIndicator; -import org.eclipse.ui.IViewActionDelegate; -import org.eclipse.ui.IViewPart; - -public class ResetMemoryBlockPrefAction implements IViewActionDelegate { - - public void init(IViewPart view) { - - } - - public void run(IAction action) { - - PreferenceManager prefManager = new PreferenceManager(); - - ResetMemoryBlockPreferencePage page = new ResetMemoryBlockPreferencePage(); - IPreferenceNode node = new PreferenceNode("org.eclipse.debug.ui.memory.resetMemoryBlock", page); //$NON-NLS-1$ - prefManager.addToRoot(node); - - final PreferenceDialog dialog = new PreferenceDialog(DebugUIPlugin.getShell(), prefManager); - - BusyIndicator.showWhile(DebugUIPlugin.getStandardDisplay(), new Runnable() { - public void run() { - dialog.create(); - dialog.open(); - } - }); - - } - - public void selectionChanged(IAction action, ISelection selection) { - - } - -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ResetMemoryBlockPreferencePage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ResetMemoryBlockPreferencePage.java index 6d32c41e5..1aa89987e 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ResetMemoryBlockPreferencePage.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ResetMemoryBlockPreferencePage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. + * Copyright (c) 2005, 2006 IBM Corporation 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 @@ -14,8 +14,12 @@ package org.eclipse.debug.internal.ui.views.memory; import org.eclipse.debug.internal.ui.DebugUIMessages; import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants; import org.eclipse.debug.ui.DebugUITools; +import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.jface.preference.FieldEditorPreferencePage; import org.eclipse.jface.preference.RadioGroupFieldEditor; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.ui.PlatformUI; public class ResetMemoryBlockPreferencePage extends FieldEditorPreferencePage{ @@ -31,5 +35,10 @@ public class ResetMemoryBlockPreferencePage extends FieldEditorPreferencePage{ RadioGroupFieldEditor editor = new RadioGroupFieldEditor(IDebugPreferenceConstants.PREF_RESET_MEMORY_BLOCK, DebugUIMessages.ResetMemoryBlockPreferencePage_1, 1, new String[][] {{DebugUIMessages.ResetMemoryBlockPreferencePage_2, IDebugPreferenceConstants.RESET_VISIBLE},{DebugUIMessages.ResetMemoryBlockPreferencePage_3, IDebugPreferenceConstants.RESET_ALL}}, getFieldEditorParent()); addField(editor); } + + protected Control createContents(Composite parent) { + PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IDebugUIConstants.PLUGIN_ID + ".resetMemoryMonitor_preference_page_context"); //$NON-NLS-1$ + return super.createContents(parent); + } } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SelectCodePagesAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SelectCodePagesAction.java deleted file mode 100644 index 0e5b906a1..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SelectCodePagesAction.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.internal.ui.views.memory; - -import org.eclipse.debug.internal.ui.DebugUIPlugin; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IViewActionDelegate; -import org.eclipse.ui.IViewPart; - -/** - * Action to allow user to change code page preference. - * @since 3.1 - */ -public class SelectCodePagesAction implements IViewActionDelegate { - - /* (non-Javadoc) - * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart) - */ - public void init(IViewPart view) { - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) - */ - public void run(IAction action) { - Shell shell = DebugUIPlugin.getActiveWorkbenchWindow().getShell(); - - CodePagesPrefDialog dialog = new CodePagesPrefDialog(shell); - dialog.open(); - - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) - */ - public void selectionChanged(IAction action, ISelection selection) { - } - -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SetPaddedStringPreferencePage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SetPaddedStringPreferencePage.java new file mode 100644 index 000000000..559c20c63 --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SetPaddedStringPreferencePage.java @@ -0,0 +1,56 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation 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: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + + +package org.eclipse.debug.internal.ui.views.memory; + +import org.eclipse.debug.internal.ui.DebugUIMessages; +import org.eclipse.debug.ui.DebugUITools; +import org.eclipse.debug.ui.IDebugUIConstants; +import org.eclipse.jface.preference.FieldEditorPreferencePage; +import org.eclipse.jface.preference.StringFieldEditor; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.ui.PlatformUI; + +public class SetPaddedStringPreferencePage extends FieldEditorPreferencePage { + + private StringFieldEditor fPaddedString; + + public SetPaddedStringPreferencePage() + { + super(FieldEditorPreferencePage.GRID); + setPreferenceStore(DebugUITools.getPreferenceStore()); + setTitle(DebugUIMessages.SetPaddedStringDialog_0); + + } + + protected void createFieldEditors() { + fPaddedString = new StringFieldEditor(IDebugUIConstants.PREF_PADDED_STR, DebugUIMessages.SetPaddedStringPreferencePage_0, getFieldEditorParent()); + fPaddedString.setEmptyStringAllowed(false); + fPaddedString.setTextLimit(5); + addField(fPaddedString); + } + + protected Label createDescriptionLabel(Composite parent) { + Label label = new Label(parent, SWT.NONE); + label.setText(DebugUIMessages.SetPaddedStringDialog_1); + return label; + } + + protected Control createContents(Composite parent) { + PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IDebugUIConstants.PLUGIN_ID + ".SetPaddedStrDialog_context"); //$NON-NLS-1$ + return super.createContents(parent); + } + +} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SwitchMemoryBlockAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SwitchMemoryBlockAction.java index 70c5f02d3..12aa62edc 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SwitchMemoryBlockAction.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SwitchMemoryBlockAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. + * Copyright (c) 2005, 2006 IBM Corporation 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 @@ -11,17 +11,22 @@ package org.eclipse.debug.internal.ui.views.memory; +import java.util.ArrayList; + import org.eclipse.core.runtime.IAdaptable; import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.IMemoryBlockListener; import org.eclipse.debug.core.model.IDebugElement; import org.eclipse.debug.core.model.IMemoryBlock; import org.eclipse.debug.core.model.IMemoryBlockExtension; import org.eclipse.debug.core.model.IMemoryBlockRetrieval; import org.eclipse.debug.internal.ui.DebugUIMessages; import org.eclipse.debug.internal.ui.DebugUIPlugin; +import org.eclipse.debug.internal.ui.contexts.DebugContextManager; +import org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextListener; +import org.eclipse.debug.internal.ui.viewers.AsynchronousTreeViewer; import org.eclipse.debug.ui.DebugUITools; -import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.debug.ui.memory.IMemoryRendering; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.ActionContributionItem; @@ -37,12 +42,34 @@ import org.eclipse.swt.widgets.Menu; import org.eclipse.ui.IActionDelegate2; import org.eclipse.ui.IViewActionDelegate; import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.PlatformUI; public class SwitchMemoryBlockAction extends Action implements IViewActionDelegate, IActionDelegate2 { private IViewPart fView; private MenuCreator fMenuCreator; + private IAction fAction; + + private IMemoryBlockListener fListener = new IMemoryBlockListener() { + public void memoryBlocksAdded(IMemoryBlock[] memory) { + updateActionEnablement(); + } + + public void memoryBlocksRemoved(IMemoryBlock[] memory) { + updateActionEnablement(); + } + }; + + private IDebugContextListener fDebugContextListener = new IDebugContextListener() { + + public void contextActivated(ISelection selection, IWorkbenchPart part) { + updateActionEnablement(); + } + + public void contextChanged(ISelection selection, IWorkbenchPart part) { + updateActionEnablement(); + }}; /** * Switch tab folder for fMemoryBlock to the top in Memory Rendering View @@ -130,42 +157,22 @@ public class SwitchMemoryBlockAction extends Action implements IViewActionDelega if (dropdown == null) { dropdown = new Menu(parent); + + // get all memory blocks associated with selected debug target + IMemoryBlock[] allMemoryBlocks = getMemoryBlocksFromViewer(); - ISelection selection = DebugUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection(IDebugUIConstants.ID_DEBUG_VIEW); - - if (selection == null) - return dropdown; - - if (selection instanceof IStructuredSelection && !selection.isEmpty()) + // get selection from memory view + IMemoryBlock memoryBlock = getCurrentMemoryBlock(); + + for (int i=0; i 0); + return; + } + else if (getViewer() != null) + { + AsynchronousTreeViewer viewer = getViewer(); + if (viewer.getInput() != null && viewer.getInput() instanceof IMemoryBlockRetrieval) + { + retrieval = (IMemoryBlockRetrieval)viewer.getInput(); + IMemoryBlock[] memoryBlocks = DebugPlugin.getDefault().getMemoryBlockManager().getMemoryBlocks(retrieval); + fAction.setEnabled(memoryBlocks.length > 0); + return; + } + } + } + fAction.setEnabled(false); + } } public void run(IAction action) { @@ -204,7 +308,7 @@ public class SwitchMemoryBlockAction extends Action implements IViewActionDelega if (retrieval != null) { - IMemoryBlock[] memoryBlocks = DebugPlugin.getDefault().getMemoryBlockManager().getMemoryBlocks(retrieval); + IMemoryBlock[] memoryBlocks = getMemoryBlocksFromViewer(); // only run if there is more than one memory block if (memoryBlocks.length > 1) { @@ -234,11 +338,17 @@ public class SwitchMemoryBlockAction extends Action implements IViewActionDelega } public void init(IAction action) { + fAction = action; + updateActionEnablement(); fMenuCreator = new MenuCreator(); action.setMenuCreator(fMenuCreator); } public void dispose() { + fAction = null; + DebugPlugin.getDefault().getMemoryBlockManager().removeListener(fListener); + DebugContextManager.getDefault().removeDebugContextListener(fDebugContextListener, fView.getViewSite().getWorkbenchWindow()); + if (fMenuCreator != null) fMenuCreator.dispose(); } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/CreateRendering.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/CreateRendering.java index 91fa1a247..c14e2b156 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/CreateRendering.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/CreateRendering.java @@ -321,7 +321,7 @@ public class CreateRendering extends AbstractMemoryRendering implements IMemoryR WorkbenchJob wbJob = new WorkbenchJob("Create Rendering Update Label"){ //$NON-NLS-1$ - public IStatus runInUIThread(IProgressMonitor monitor) { + public IStatus runInUIThread(IProgressMonitor wbMonitor) { if (fMemoryBlockLabel != null) { fMemoryBlockLabel.setText(" " + DebugUIMessages.CreateRenderingTab_Memory_monitor + fLabel + " "); //$NON-NLS-1$//$NON-NLS-2$ diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/FormatTableRenderingDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/FormatTableRenderingDialog.java index 58e2914f1..bcf282acb 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/FormatTableRenderingDialog.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/FormatTableRenderingDialog.java @@ -72,7 +72,7 @@ public class FormatTableRenderingDialog extends Dialog protected Control createDialogArea(Composite parent) { getShell().setText(DebugUIMessages.FormatTableRenderingAction_0); - PlatformUI.getWorkbench().getHelpSystem().setHelp(getShell(), IDebugUIConstants.PLUGIN_ID + ".FormatTableRenderingDialog_context"); //$NON-NLS-1$ + PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IDebugUIConstants.PLUGIN_ID + ".FormatTableRenderingDialog_context"); //$NON-NLS-1$ Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/SetPaddedStringAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/SetPaddedStringAction.java deleted file mode 100644 index 993053a5d..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/SetPaddedStringAction.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.debug.internal.ui.views.memory.renderings; - -import org.eclipse.debug.internal.ui.DebugUIPlugin; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IViewActionDelegate; -import org.eclipse.ui.IViewPart; - -/** - * Action for setting the padded string preference - * @since 3.1 - */ -public class SetPaddedStringAction implements IViewActionDelegate { - - public void init(IViewPart view) { - - } - - public void run(IAction action) { - Shell shell = DebugUIPlugin.getShell(); - SetPaddedStringDialog dialog = new SetPaddedStringDialog(shell); - dialog.open(); - - } - - public void selectionChanged(IAction action, ISelection selection) { - } - -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/SetPaddedStringDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/SetPaddedStringDialog.java deleted file mode 100644 index a092c4ee6..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/SetPaddedStringDialog.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.debug.internal.ui.views.memory.renderings; - -import org.eclipse.debug.internal.ui.DebugUIMessages; -import org.eclipse.debug.internal.ui.DebugUIPlugin; -import org.eclipse.debug.internal.ui.views.memory.MemoryViewUtil; -import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.preference.StringFieldEditor; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.PlatformUI; - -/** - * Dialog for setting the padded string in renderings. - * @since 3.1 - * - */ -public class SetPaddedStringDialog extends Dialog { - - private StringFieldEditor fPaddedString; - - - protected SetPaddedStringDialog(Shell parentShell) { - super(parentShell); - setShellStyle(getShellStyle() | SWT.RESIZE); - } - - protected Control createDialogArea(Composite parent) { - PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IDebugUIConstants.PLUGIN_ID + ".SetPaddedStrDialog_context"); //$NON-NLS-1$ - - getShell().setText(DebugUIMessages.SetPaddedStringDialog_0); - - Composite content = (Composite) super.createDialogArea(parent); - GridLayout layout = new GridLayout(); - layout.numColumns = 1; - content.setLayout(layout); - - GridData contentData = new GridData(SWT.FILL); - content.setLayoutData(contentData); - - Label textLabel = new Label(content, SWT.NONE); - textLabel.setText(DebugUIMessages.SetPaddedStringDialog_1); - - GridData textLayout = new GridData(); - textLabel.setLayoutData(textLayout); - - fPaddedString = new StringFieldEditor(IDebugUIConstants.PREF_PADDED_STR, "",content ); //$NON-NLS-1$ - fPaddedString.fillIntoGrid(content, 2); - fPaddedString.setPreferenceStore(DebugUIPlugin.getDefault().getPreferenceStore()); - fPaddedString.load(); - - return content; - } - - protected void okPressed() { - String str = fPaddedString.getStringValue(); - - if (str == null || str.length() == 0) - { - MemoryViewUtil.openError(DebugUIMessages.SetPaddedStringDialog_3, DebugUIMessages.SetPaddedStringDialog_4, null); // - return; - } - - fPaddedString.store(); - - super.okPressed(); - - } - -} -- cgit v1.2.3