mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 06:02:11 +02:00
bug 488469 - [traditional memory rendering] add preference for coloring
background independently for different memory spaces Change-Id: If61d909ef66b9c11aebe0863b787af465121dd59
This commit is contained in:
parent
91f9730d27
commit
b28d8e45d1
11 changed files with 368 additions and 12 deletions
|
@ -130,6 +130,9 @@ public class DsfMemoryBlock extends PlatformObject implements IMemoryBlockExtens
|
||||||
if (adapter.isAssignableFrom(DsfMemoryBlockRetrieval.class)) {
|
if (adapter.isAssignableFrom(DsfMemoryBlockRetrieval.class)) {
|
||||||
return fRetrieval;
|
return fRetrieval;
|
||||||
}
|
}
|
||||||
|
if (adapter.isAssignableFrom(IMemoryDMContext.class)) {
|
||||||
|
return getContext();
|
||||||
|
}
|
||||||
return super.getAdapter(adapter);
|
return super.getAdapter(adapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: %pluginName
|
Bundle-Name: %pluginName
|
||||||
Bundle-SymbolicName: org.eclipse.cdt.debug.ui.memory.traditional;singleton:=true
|
Bundle-SymbolicName: org.eclipse.cdt.debug.ui.memory.traditional;singleton:=true
|
||||||
Bundle-Version: 1.3.0.qualifier
|
Bundle-Version: 1.4.0.qualifier
|
||||||
Bundle-Localization: plugin
|
Bundle-Localization: plugin
|
||||||
Require-Bundle: org.eclipse.debug.core,
|
Require-Bundle: org.eclipse.debug.core,
|
||||||
org.eclipse.debug.ui,
|
org.eclipse.debug.ui,
|
||||||
|
@ -16,4 +16,5 @@ Bundle-ActivationPolicy: lazy
|
||||||
Bundle-Activator: org.eclipse.cdt.debug.ui.memory.traditional.TraditionalRenderingPlugin
|
Bundle-Activator: org.eclipse.cdt.debug.ui.memory.traditional.TraditionalRenderingPlugin
|
||||||
Bundle-Vendor: %providerName
|
Bundle-Vendor: %providerName
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||||
Export-Package: org.eclipse.cdt.debug.ui.memory.traditional
|
Export-Package: org.eclipse.cdt.debug.ui.memory.traditional,
|
||||||
|
org.eclipse.cdt.debug.ui.internal
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<version>1.3.0-SNAPSHOT</version>
|
<version>1.4.0-SNAPSHOT</version>
|
||||||
<artifactId>org.eclipse.cdt.debug.ui.memory.traditional</artifactId>
|
<artifactId>org.eclipse.cdt.debug.ui.memory.traditional</artifactId>
|
||||||
<packaging>eclipse-plugin</packaging>
|
<packaging>eclipse-plugin</packaging>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -0,0 +1,177 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2016 Ericsson 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:
|
||||||
|
* Marc Dumais (Ericsson) - initial implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.cdt.debug.ui.internal;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.ui.memory.traditional.IMemorySpacePreferencesHelper;
|
||||||
|
import org.eclipse.cdt.debug.ui.memory.traditional.TraditionalRenderingMessages;
|
||||||
|
import org.eclipse.cdt.debug.ui.memory.traditional.TraditionalRenderingPlugin;
|
||||||
|
import org.eclipse.cdt.debug.ui.memory.traditional.TraditionalRenderingPreferenceConstants;
|
||||||
|
import org.eclipse.jface.preference.IPreferenceStore;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class encapsulates the messy details of dealing with preferences
|
||||||
|
* entries that have unpredictable key names. This is necessary because the
|
||||||
|
* preference store does not allow getting a list of the keys, just a lookup
|
||||||
|
* by exact key. So the work-around is to use one key to save a csv string,
|
||||||
|
* containing the information necessary to reconstruct the keys for the
|
||||||
|
* unpredictable entries.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class MemorySpacePreferencesHelper implements IMemorySpacePreferencesHelper {
|
||||||
|
/** Reference to the plugin's preference store */
|
||||||
|
private final IPreferenceStore fStore;
|
||||||
|
|
||||||
|
// List of RGB colors that we can use, by default, for memory space backgrounds
|
||||||
|
private static final String[] fColorPool = {
|
||||||
|
"238,192,192", "250,238,195", "255,179,0",
|
||||||
|
"122,245,0", "184,242,255", "166,189,215",
|
||||||
|
"206,162,98", "245,138,157", "244,200,0",
|
||||||
|
"255,136,56", "244,255,128"
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Constructor */
|
||||||
|
public MemorySpacePreferencesHelper() {
|
||||||
|
fStore = TraditionalRenderingPlugin.getDefault().getPreferenceStore();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return an array of the currently known memory spaces ids, for which
|
||||||
|
* a background color preference was created.
|
||||||
|
*/
|
||||||
|
private String[] getMemorySpaceIds() {
|
||||||
|
String csv = fStore.getString(TraditionalRenderingPreferenceConstants.MEM_KNOWN_MEMORY_SPACE_ID_LIST_CSV);
|
||||||
|
return csv.isEmpty() ? new String[0] : csv.split(",");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.debug.ui.internal.IMemorySpacesPreferencesUtil#updateMemorySpaces(java.lang.String[])
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void updateMemorySpaces(String[] ids) {
|
||||||
|
List<String> inputIdList = new ArrayList<String>(Arrays.asList(ids));
|
||||||
|
List<String> knownIdList = new ArrayList<String>(Arrays.asList(getMemorySpaceIds()));
|
||||||
|
int nextIdIndex = knownIdList.size();
|
||||||
|
boolean newIds;
|
||||||
|
|
||||||
|
// Remove ids already known
|
||||||
|
inputIdList.removeAll(knownIdList);
|
||||||
|
newIds = inputIdList.size() > 0 ? true : false;
|
||||||
|
|
||||||
|
// remaining ids are new
|
||||||
|
for (String id : inputIdList) {
|
||||||
|
knownIdList.add(id);
|
||||||
|
// set default color for this memory space id
|
||||||
|
setDefaultColorPreference(id, nextIdIndex);
|
||||||
|
nextIdIndex++;
|
||||||
|
}
|
||||||
|
// Save set of known memory space ids, if new ones were added
|
||||||
|
if (newIds) {
|
||||||
|
setMemorySpaceIds(knownIdList.toArray(new String[knownIdList.size()]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Saves a set of memory space ids, as a CSV string, into the
|
||||||
|
* preferences store
|
||||||
|
*/
|
||||||
|
private void setMemorySpaceIds(String[] memorySpaces) {
|
||||||
|
StringBuffer csv = new StringBuffer();
|
||||||
|
for (int i = 0; i < memorySpaces.length; i++) {
|
||||||
|
csv.append(memorySpaces[i]);
|
||||||
|
if (i < memorySpaces.length - 1) {
|
||||||
|
csv.append(",");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fStore.setValue(TraditionalRenderingPreferenceConstants.MEM_KNOWN_MEMORY_SPACE_ID_LIST_CSV,
|
||||||
|
csv.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.debug.ui.internal.IMemorySpacesPreferencesUtil#getMemorySpaceKey(java.lang.String)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getMemorySpaceKey(String id) {
|
||||||
|
return TraditionalRenderingPreferenceConstants.MEM_MEMORY_SPACE_ID_PREFIX + id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see org.eclipse.cdt.debug.ui.internal.IMemorySpacesPreferencesUtil#getMemorySpacesLabels()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Map<String, String> getMemorySpaceLabels() {
|
||||||
|
String prefix = TraditionalRenderingPreferenceConstants.MEM_MEMORY_SPACE_ID_PREFIX;
|
||||||
|
String labelPrefix = TraditionalRenderingMessages
|
||||||
|
.getString("TraditionalRenderingPreferencePage_BackgroundColorMemorySpacePrefix");
|
||||||
|
String[] ids = getMemorySpaceIds();
|
||||||
|
|
||||||
|
Map<String, String> keysToLabels = new HashMap<>();
|
||||||
|
String key, label;
|
||||||
|
for (int i = 0; i < ids.length; i++) {
|
||||||
|
key = prefix + ids[i];
|
||||||
|
label = labelPrefix + " " + ids[i];
|
||||||
|
keysToLabels.put(key, label);
|
||||||
|
}
|
||||||
|
return keysToLabels;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see org.eclipse.cdt.debug.ui.internal.IMemorySpacesPreferencesUtil#getMemorySpaceDefaultColors()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Map<String, String> getMemorySpaceDefaultColors() {
|
||||||
|
String prefix = TraditionalRenderingPreferenceConstants.MEM_MEMORY_SPACE_ID_PREFIX;
|
||||||
|
String[] ids = getMemorySpaceIds();
|
||||||
|
Map<String, String> mapKeyToColor = new HashMap<String, String>();
|
||||||
|
String key, color;
|
||||||
|
for (int i = 0; i < ids.length; i++) {
|
||||||
|
key = prefix + ids[i];
|
||||||
|
color = getColor(i);
|
||||||
|
mapKeyToColor.put(key, color);
|
||||||
|
}
|
||||||
|
return mapKeyToColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Adds a preference for a memory space id and assign it a unique color */
|
||||||
|
private void setDefaultColorPreference(String id, int index) {
|
||||||
|
String prefix = TraditionalRenderingPreferenceConstants.MEM_MEMORY_SPACE_ID_PREFIX;
|
||||||
|
String key = prefix + id;
|
||||||
|
fStore.setValue(key, getColor(index));
|
||||||
|
// Setting the default here prevents not having a default defined at first.
|
||||||
|
fStore.setDefault(key, getColor(index));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return a csv string representation of a color. A color array is defined
|
||||||
|
* in this class. The entry returned corresponds to the index parameter, and
|
||||||
|
* wraps around if the index is greater than the number of defined colors
|
||||||
|
*/
|
||||||
|
private String getColor(int index) {
|
||||||
|
// wrap-around if we have exhausted the pool
|
||||||
|
if (index >= fColorPool.length) {
|
||||||
|
index = index % (fColorPool.length);
|
||||||
|
}
|
||||||
|
return fColorPool[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2016 Ericsson AB 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:
|
||||||
|
* Alvaro Sanchez-Leon (Ericsson AB) - Initial API
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.cdt.debug.ui.memory.traditional;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 1.4
|
||||||
|
*/
|
||||||
|
public interface IMemorySpacePreferencesHelper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the list of known memory space ids. For each new memory space,
|
||||||
|
* a preference is set, assigning it a distinct background color, from
|
||||||
|
* a pool. Ids that are already known will be ignored.
|
||||||
|
* @param ids an array of memory spaces ids, for the current platform.
|
||||||
|
*/
|
||||||
|
void updateMemorySpaces(String[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the preference store key used to lookup the default color for a
|
||||||
|
* given memory space id
|
||||||
|
*/
|
||||||
|
String getMemorySpaceKey(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return a map of each known memory space key to corresponding label entries
|
||||||
|
*/
|
||||||
|
Map<String, String> getMemorySpaceLabels();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return a map of each known memory space key to corresponding csv representation of an RGB color
|
||||||
|
*/
|
||||||
|
Map<String, String> getMemorySpaceDefaultColors();
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2016 Ericsson AB 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:
|
||||||
|
* Alvaro Sanchez-Leon (Ericsson AB) - First Implementation and API
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.cdt.debug.ui.memory.traditional;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.ui.internal.MemorySpacePreferencesHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 1.4
|
||||||
|
*/
|
||||||
|
public class TraditionalMemoryRenderingFactory {
|
||||||
|
private static IMemorySpacePreferencesHelper fMemSpaceHelper = null;
|
||||||
|
private final static Object fLock = new Object();
|
||||||
|
|
||||||
|
public static IMemorySpacePreferencesHelper getMemorySpacesPreferencesHelper() {
|
||||||
|
synchronized (fLock) {
|
||||||
|
if (fMemSpaceHelper == null) {
|
||||||
|
fMemSpaceHelper = new MemorySpacePreferencesHelper();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return fMemSpaceHelper;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setMemorySpacesPreferencesHelper(IMemorySpacePreferencesHelper helper) {
|
||||||
|
synchronized (fLock) {
|
||||||
|
fMemSpaceHelper = helper;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2015 Wind River Systems, Inc. and others.
|
* Copyright (c) 2006, 2016 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
|
||||||
|
@ -18,6 +18,9 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.model.provisional.IMemoryRenderingViewportProvider;
|
import org.eclipse.cdt.debug.core.model.provisional.IMemoryRenderingViewportProvider;
|
||||||
|
import org.eclipse.cdt.debug.core.model.provisional.IMemorySpaceAwareMemoryBlock;
|
||||||
|
import org.eclipse.cdt.debug.core.model.provisional.IMemorySpaceAwareMemoryBlockRetrieval;
|
||||||
|
import org.eclipse.cdt.debug.internal.core.CRequest;
|
||||||
import org.eclipse.core.commands.AbstractHandler;
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
import org.eclipse.core.commands.Command;
|
import org.eclipse.core.commands.Command;
|
||||||
import org.eclipse.core.commands.ExecutionEvent;
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
|
@ -29,6 +32,7 @@ import org.eclipse.debug.core.DebugException;
|
||||||
import org.eclipse.debug.core.DebugPlugin;
|
import org.eclipse.debug.core.DebugPlugin;
|
||||||
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;
|
||||||
|
import org.eclipse.debug.core.model.IMemoryBlockRetrieval;
|
||||||
import org.eclipse.debug.core.model.MemoryByte;
|
import org.eclipse.debug.core.model.MemoryByte;
|
||||||
import org.eclipse.debug.internal.ui.DebugUIPlugin;
|
import org.eclipse.debug.internal.ui.DebugUIPlugin;
|
||||||
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
|
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
|
||||||
|
@ -108,8 +112,22 @@ public class TraditionalRendering extends AbstractMemoryRendering implements IRe
|
||||||
private IWorkbenchAdapter fWorkbenchAdapter;
|
private IWorkbenchAdapter fWorkbenchAdapter;
|
||||||
private IMemoryBlockConnection fConnection;
|
private IMemoryBlockConnection fConnection;
|
||||||
|
|
||||||
|
private String fMemorySpaceId;
|
||||||
|
|
||||||
private final static int MAX_MENU_COLUMN_COUNT = 8;
|
private final static int MAX_MENU_COLUMN_COUNT = 8;
|
||||||
|
|
||||||
|
private IMemorySpacePreferencesHelper fMemSpacePreferenceHelper;
|
||||||
|
|
||||||
|
private class GetMemorySpacesRequest extends CRequest implements IMemorySpaceAwareMemoryBlockRetrieval.GetMemorySpacesRequest {
|
||||||
|
String [] fMemorySpaces;
|
||||||
|
public String[] getMemorySpaces() {
|
||||||
|
return fMemorySpaces;
|
||||||
|
}
|
||||||
|
public void setMemorySpaces(String[] memorySpaceIds) {
|
||||||
|
fMemorySpaces = memorySpaceIds;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public TraditionalRendering(String id)
|
public TraditionalRendering(String id)
|
||||||
{
|
{
|
||||||
super(id);
|
super(id);
|
||||||
|
@ -255,6 +273,33 @@ public class TraditionalRendering extends AbstractMemoryRendering implements IRe
|
||||||
{
|
{
|
||||||
super.init(container, block);
|
super.init(container, block);
|
||||||
|
|
||||||
|
fMemSpacePreferenceHelper = TraditionalMemoryRenderingFactory.getMemorySpacesPreferencesHelper();
|
||||||
|
|
||||||
|
// resolve memory space, if any
|
||||||
|
if (block instanceof IMemorySpaceAwareMemoryBlock) {
|
||||||
|
IMemorySpaceAwareMemoryBlock memBlock = (IMemorySpaceAwareMemoryBlock) block;
|
||||||
|
String id = memBlock.getMemorySpaceID();
|
||||||
|
fMemorySpaceId = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
// extract memory space info, if applicable
|
||||||
|
if (block instanceof IMemorySpaceAwareMemoryBlock) {
|
||||||
|
IMemoryBlockRetrieval retrieval = ((IMemorySpaceAwareMemoryBlock) block).getMemoryBlockRetrieval();
|
||||||
|
((IMemorySpaceAwareMemoryBlockRetrieval)retrieval).getMemorySpaces(block, new GetMemorySpacesRequest(){
|
||||||
|
@Override
|
||||||
|
public void done() {
|
||||||
|
final String[] spaces = isSuccess() ? getMemorySpaces() : new String[0];
|
||||||
|
// remember memory spaces
|
||||||
|
Display.getDefault().asyncExec(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
fMemSpacePreferenceHelper.updateMemorySpaces(spaces);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Working with the model proxy must be done on the UI dispatch thread.
|
* Working with the model proxy must be done on the UI dispatch thread.
|
||||||
*/
|
*/
|
||||||
|
@ -505,11 +550,23 @@ public class TraditionalRendering extends AbstractMemoryRendering implements IRe
|
||||||
|
|
||||||
public void allocateColors()
|
public void allocateColors()
|
||||||
{
|
{
|
||||||
IPreferenceStore store = TraditionalRenderingPlugin.getDefault().getPreferenceStore();
|
|
||||||
|
|
||||||
|
IPreferenceStore store = TraditionalRenderingPlugin.getDefault().getPreferenceStore();
|
||||||
|
colorBackground = null;
|
||||||
|
// has a memory-space-specific background color been set for the associated memory space?
|
||||||
|
if (fMemorySpaceId != null)
|
||||||
|
{
|
||||||
|
String key = fMemSpacePreferenceHelper.getMemorySpaceKey(fMemorySpaceId);
|
||||||
|
if (store.getString(key) != "") {
|
||||||
|
colorBackground = new Color(Display.getDefault(),
|
||||||
|
PreferenceConverter.getColor(store, key));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// no - then use default
|
||||||
|
if (colorBackground == null) {
|
||||||
colorBackground = new Color(Display.getDefault(), PreferenceConverter.getColor(store,
|
colorBackground = new Color(Display.getDefault(), PreferenceConverter.getColor(store,
|
||||||
TraditionalRenderingPreferenceConstants.MEM_COLOR_BACKGROUND));
|
TraditionalRenderingPreferenceConstants.MEM_COLOR_BACKGROUND));
|
||||||
|
}
|
||||||
colorChanged = new Color(Display.getDefault(), PreferenceConverter.getColor(store,
|
colorChanged = new Color(Display.getDefault(), PreferenceConverter.getColor(store,
|
||||||
TraditionalRenderingPreferenceConstants.MEM_COLOR_CHANGED));
|
TraditionalRenderingPreferenceConstants.MEM_COLOR_CHANGED));
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006-2013 Wind River Systems, Inc. and others.
|
* Copyright (c) 2006-2016 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
|
||||||
|
@ -51,4 +51,15 @@ public class TraditionalRenderingPreferenceConstants {
|
||||||
|
|
||||||
public static final String MEM_DEFAULT_COPY_ACTION = "memoryDefaultCopyAction";
|
public static final String MEM_DEFAULT_COPY_ACTION = "memoryDefaultCopyAction";
|
||||||
|
|
||||||
|
// support for memory space - specific coloring
|
||||||
|
/**
|
||||||
|
* @since 1.4
|
||||||
|
*/
|
||||||
|
public static final String MEM_KNOWN_MEMORY_SPACE_ID_LIST_CSV = "memorySpaceIdList";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 1.4
|
||||||
|
*/
|
||||||
|
public static final String MEM_MEMORY_SPACE_ID_PREFIX = MEM_COLOR_BACKGROUND + "MemorySpace-";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006-2013 Wind River Systems, Inc. and others.
|
* Copyright (c) 2006-2016 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
|
||||||
|
@ -12,6 +12,8 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.debug.ui.memory.traditional;
|
package org.eclipse.cdt.debug.ui.memory.traditional;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
|
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
|
||||||
import org.eclipse.jface.preference.IPreferenceStore;
|
import org.eclipse.jface.preference.IPreferenceStore;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
|
@ -61,6 +63,18 @@ public class TraditionalRenderingPreferenceInitializer extends AbstractPreferenc
|
||||||
store.setDefault(TraditionalRenderingPreferenceConstants.MEM_COLOR_BACKGROUND, systemBackground.getRed()
|
store.setDefault(TraditionalRenderingPreferenceConstants.MEM_COLOR_BACKGROUND, systemBackground.getRed()
|
||||||
+ "," + systemBackground.getGreen() + "," + systemBackground.getBlue());
|
+ "," + systemBackground.getGreen() + "," + systemBackground.getBlue());
|
||||||
|
|
||||||
|
// Set the default background colors, for known memory spaces
|
||||||
|
IMemorySpacePreferencesHelper util = TraditionalMemoryRenderingFactory.getMemorySpacesPreferencesHelper();
|
||||||
|
Map<String, String> prefKeyToColor = util.getMemorySpaceDefaultColors();
|
||||||
|
|
||||||
|
if (prefKeyToColor.size() > 0) {
|
||||||
|
// If there are memory spaces present, set no global background as default
|
||||||
|
store.setDefault(TraditionalRenderingPreferenceConstants.MEM_USE_GLOBAL_BACKGROUND, false);
|
||||||
|
for (String key : prefKeyToColor.keySet()) {
|
||||||
|
store.setDefault(key, prefKeyToColor.get(key));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
store.setDefault(TraditionalRenderingPreferenceConstants.MEM_EDIT_BUFFER_SAVE,
|
store.setDefault(TraditionalRenderingPreferenceConstants.MEM_EDIT_BUFFER_SAVE,
|
||||||
TraditionalRenderingPreferenceConstants.MEM_EDIT_BUFFER_SAVE_ON_ENTER_ONLY);
|
TraditionalRenderingPreferenceConstants.MEM_EDIT_BUFFER_SAVE_ON_ENTER_ONLY);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2013 Wind River Systems, Inc. and others.
|
* Copyright (c) 2006, 2016 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
|
||||||
|
@ -12,6 +12,8 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.debug.ui.memory.traditional;
|
package org.eclipse.cdt.debug.ui.memory.traditional;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.jface.preference.BooleanFieldEditor;
|
import org.eclipse.jface.preference.BooleanFieldEditor;
|
||||||
import org.eclipse.jface.preference.ColorFieldEditor;
|
import org.eclipse.jface.preference.ColorFieldEditor;
|
||||||
import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
||||||
|
@ -77,6 +79,14 @@ public class TraditionalRenderingPreferencePage
|
||||||
addField(new ColorFieldEditor(TraditionalRenderingPreferenceConstants.MEM_COLOR_BACKGROUND,
|
addField(new ColorFieldEditor(TraditionalRenderingPreferenceConstants.MEM_COLOR_BACKGROUND,
|
||||||
TraditionalRenderingMessages.getString("TraditionalRenderingPreferencePage_BackgroundColor"), getFieldEditorParent())); //$NON-NLS-1$
|
TraditionalRenderingMessages.getString("TraditionalRenderingPreferencePage_BackgroundColor"), getFieldEditorParent())); //$NON-NLS-1$
|
||||||
|
|
||||||
|
// are there known memory spaces? If so make their background color configurable
|
||||||
|
IMemorySpacePreferencesHelper util = TraditionalMemoryRenderingFactory.getMemorySpacesPreferencesHelper();
|
||||||
|
|
||||||
|
Map<String, String> memSpacesLabels = util.getMemorySpaceLabels();
|
||||||
|
for (String key : memSpacesLabels.keySet()) {
|
||||||
|
addField(new ColorFieldEditor(key, memSpacesLabels.get(key), getFieldEditorParent()));
|
||||||
|
}
|
||||||
|
|
||||||
addField(new ColorAndEffectFieldEditor(TraditionalRenderingPreferenceConstants.MEM_COLOR_CHANGED,
|
addField(new ColorAndEffectFieldEditor(TraditionalRenderingPreferenceConstants.MEM_COLOR_CHANGED,
|
||||||
TraditionalRenderingPreferenceConstants.MEM_COLOR_CHANGED_BOLD,
|
TraditionalRenderingPreferenceConstants.MEM_COLOR_CHANGED_BOLD,
|
||||||
TraditionalRenderingPreferenceConstants.MEM_COLOR_CHANGED_ITALIC,
|
TraditionalRenderingPreferenceConstants.MEM_COLOR_CHANGED_ITALIC,
|
||||||
|
|
|
@ -70,6 +70,7 @@ TraditionalRendering.UPDATE_ALWAYS=Always
|
||||||
TraditionalRendering.UPDATE_ON_BREAKPOINT=On Breakpoint
|
TraditionalRendering.UPDATE_ON_BREAKPOINT=On Breakpoint
|
||||||
TraditionalRendering.UPDATE_MANUAL=Manual
|
TraditionalRendering.UPDATE_MANUAL=Manual
|
||||||
TraditionalRenderingPreferencePage_BackgroundColor=&Background Color:
|
TraditionalRenderingPreferencePage_BackgroundColor=&Background Color:
|
||||||
|
TraditionalRenderingPreferencePage_BackgroundColorMemorySpacePrefix=Background Color for Memory Space:
|
||||||
TraditionalRenderingPreferencePage_BrightenAlternateCells=Brighten Alternate Cells
|
TraditionalRenderingPreferencePage_BrightenAlternateCells=Brighten Alternate Cells
|
||||||
TraditionalRenderingPreferencePage_ChangedColor=&Changed Color:
|
TraditionalRenderingPreferencePage_ChangedColor=&Changed Color:
|
||||||
TraditionalRenderingPreferencePage_description=Traditional Memory Rendering
|
TraditionalRenderingPreferencePage_description=Traditional Memory Rendering
|
||||||
|
|
Loading…
Add table
Reference in a new issue