1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

[247559] [traditional memory] Padding preference should be respected

This commit is contained in:
Ted Williams 2008-09-16 20:33:07 +00:00
parent 2ad6225eb4
commit d099bf7482
2 changed files with 46 additions and 6 deletions

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006-2007 Wind River Systems, Inc. and others. * Copyright (c) 2006-2008 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -140,6 +140,8 @@ public class Rendering extends Composite implements IDebugEventSetListener
private int fPaneSpacing = 16; private int fPaneSpacing = 16;
private String fPaddingString = "?"; //$NON-NLS-1$
// flag whether the memory cache is dirty // flag whether the memory cache is dirty
private boolean fCacheDirty = false; private boolean fCacheDirty = false;
@ -514,6 +516,18 @@ public class Rendering extends Composite implements IDebugEventSetListener
layout(true); layout(true);
} }
public void setPaddingString(String padding)
{
fPaddingString = padding;
refresh();
}
public char getPaddingCharacter()
{
return fPaddingString.charAt(0); // use only the first character
}
static int suspendCount = 0; static int suspendCount = 0;
public void handleDebugEvents(DebugEvent[] events) public void handleDebugEvents(DebugEvent[] events)
@ -1933,7 +1947,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
StringBuffer errorText = new StringBuffer(); StringBuffer errorText = new StringBuffer();
for(int i = getRadixCharacterCount(radix, bytes.length); i > 0; i--) for(int i = getRadixCharacterCount(radix, bytes.length); i > 0; i--)
errorText.append('?'); errorText.append(getPaddingCharacter());
return errorText.toString(); return errorText.toString();
} }
@ -2015,7 +2029,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
{ {
StringBuffer errorText = new StringBuffer(); StringBuffer errorText = new StringBuffer();
for(int i = memoryBytes.length; i > 0; i--) for(int i = memoryBytes.length; i > 0; i--)
errorText.append('?'); errorText.append(getPaddingCharacter());
return errorText.toString(); return errorText.toString();
} }
@ -2077,7 +2091,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
// return ?s the length of byte count // return ?s the length of byte count
StringBuffer buf = new StringBuffer(); StringBuffer buf = new StringBuffer();
for(int i = 0; i < memoryBytes.length - buf.length(); i++) for(int i = 0; i < memoryBytes.length - buf.length(); i++)
buf.append('?'); buf.append(getPaddingCharacter());
return buf.toString(); return buf.toString();
} }
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006 Wind River Systems, Inc. and others. * Copyright (c) 2006-2008 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -20,7 +20,6 @@ import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
import org.eclipse.dd.debug.memory.renderings.traditional.Rendering.Selection;
import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IMemoryBlock; import org.eclipse.debug.core.model.IMemoryBlock;
import org.eclipse.debug.core.model.IMemoryBlockExtension; import org.eclipse.debug.core.model.IMemoryBlockExtension;
@ -31,6 +30,7 @@ import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
import org.eclipse.debug.internal.ui.memory.IMemoryBlockConnection; import org.eclipse.debug.internal.ui.memory.IMemoryBlockConnection;
import org.eclipse.debug.internal.ui.views.memory.renderings.GoToAddressAction; import org.eclipse.debug.internal.ui.views.memory.renderings.GoToAddressAction;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.memory.AbstractMemoryRendering; import org.eclipse.debug.ui.memory.AbstractMemoryRendering;
import org.eclipse.debug.ui.memory.AbstractTableRendering; import org.eclipse.debug.ui.memory.AbstractTableRendering;
import org.eclipse.debug.ui.memory.IMemoryRendering; import org.eclipse.debug.ui.memory.IMemoryRendering;
@ -156,6 +156,30 @@ public class TraditionalRendering extends AbstractMemoryRendering implements IRe
} }
}); });
DebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(
new IPropertyChangeListener()
{
public void propertyChange(PropertyChangeEvent event)
{
if(event.getProperty().equals(IDebugUIConstants.PREF_PADDED_STR))
{
if(TraditionalRendering.this.fRendering != null)
{
setRenderingPadding((String) event.getNewValue());
TraditionalRendering.this.fRendering.redrawPanes();
}
}
}
});
}
private void setRenderingPadding(String padding)
{
if(padding == null || padding.length() == 0)
padding = "?";
TraditionalRendering.this.fRendering.setPaddingString(padding);
} }
protected void logError(String message, Exception e) protected void logError(String message, Exception e)
@ -442,6 +466,8 @@ public class TraditionalRendering extends AbstractMemoryRendering implements IRe
for(int i = 0; i < panes.length; i++) for(int i = 0; i < panes.length; i++)
panes[i].setBackground(getColorBackground()); panes[i].setBackground(getColorBackground());
setRenderingPadding(DebugUIPlugin.getDefault().getPreferenceStore().getString(IDebugUIConstants.PREF_PADDED_STR));
fRendering.redrawPanes(); fRendering.redrawPanes();
} }
} }