1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-09-10 03:53:21 +02:00

[202656] - [update policy] Obsolete values (dirty cache entries) should be indicated in views with a gray font color.

This commit is contained in:
Pawel Piech 2009-03-31 21:25:24 +00:00
parent d43a85761a
commit 05578093af
30 changed files with 598 additions and 202 deletions

View file

@ -48,3 +48,8 @@ action.refresh.label=Refresh
debugCallStack = Debug Call Stack debugCallStack = Debug Call Stack
debugCurrentInstructionPointer = Debug Current Instruction Pointer debugCurrentInstructionPointer = Debug Current Instruction Pointer
StaleData.foreground.label=Stale data foreground color
StaleData.foreground.description=This color is used to indicate that a given element of data in a view is stale. User should refresh the view to see current data. The foreground color is used only when the view is showing data in columns.
StaleData.background.label=Stale data background color
StaleData.background.description=This color is used to indicate that a given element of data in a view is stale. User should refresh the view to see current data. The background color is used only when the view is in no-columns mode.

View file

@ -607,5 +607,50 @@
</perspectiveExtension> </perspectiveExtension>
</extension> </extension>
<!-- Color preferences -->
<extension
point="org.eclipse.ui.themes">
<colorDefinition
categoryId="org.eclipse.debug.ui.presentation"
id="org.eclipse.cdt.dsf.ui.staledata.foreground"
isEditable="true"
label="%StaleData.foreground.label">
<colorFactory
class="org.eclipse.ui.themes.RGBBlendColorFactory">
<parameter
name="color1"
value="COLOR_LIST_FOREGROUND">
</parameter>
<parameter
name="color2"
value="COLOR_LIST_BACKGROUND">
</parameter>
</colorFactory>
<description>
%StaleData.foreground.description
</description>
</colorDefinition>
<colorDefinition
categoryId="org.eclipse.debug.ui.presentation"
id="org.eclipse.cdt.dsf.ui.staledata.background"
isEditable="true"
label="%StaleData.background.label">
<colorFactory
class="org.eclipse.ui.themes.RGBBlendColorFactory">
<parameter
name="color1"
value="128,128,128">
</parameter>
<parameter
name="color2"
value="COLOR_LIST_BACKGROUND">
</parameter>
</colorFactory>
<description>
%StaleData.background.description
</description>
</colorDefinition>
</extension>
</plugin> </plugin>

View file

@ -0,0 +1,32 @@
/*******************************************************************************
* Copyright (c) 2008 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.dsf.debug.internal.ui;
import org.eclipse.debug.ui.IDebugUIConstants;
/**
* @since 2.0
*/
public interface IDsfDebugHelpContextIds {
public static final String PREFIX = IDebugUIConstants.PLUGIN_ID + "."; //$NON-NLS-1$
public static final String DETAIL_PANE = PREFIX + "detail_pane_context"; //$NON-NLS-1$
public static final String DETAIL_PANE_ASSIGN_VALUE_ACTION = PREFIX + "detail_pane_assign_value_action_context"; //$NON-NLS-1$
public static final String DETAIL_PANE_CONTENT_ASSIST_ACTION = PREFIX + "detail_pane_content_assist_action_context"; //$NON-NLS-1$
public static final String DETAIL_PANE_CUT_ACTION = PREFIX + "detail_pane_cut_action_context"; //$NON-NLS-1$
public static final String DETAIL_PANE_COPY_ACTION = PREFIX + "detail_pane_copy_action_context"; //$NON-NLS-1$
public static final String DETAIL_PANE_PASTE_ACTION = PREFIX + "detail_pane_paste_action_context"; //$NON-NLS-1$
public static final String DETAIL_PANE_SELECT_ALL_ACTION = PREFIX + "detail_pane_select_all_action_context"; //$NON-NLS-1$
public static final String DETAIL_PANE_FIND_REPLACE_ACTION = PREFIX + "detail_pane_find_replace_action_context"; //$NON-NLS-1$
public static final String DETAIL_PANE_WORD_WRAP_ACTION = PREFIX + "detail_pane_word_wrap_action_context"; //$NON-NLS-1$
public static final String DETAIL_PANE_MAX_LENGTH_ACTION = PREFIX + "detail_pane_max_length_action_context"; //$NON-NLS-1$
}

View file

@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright (c) 2008 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.dsf.debug.internal.ui;
import org.eclipse.cdt.dsf.debug.ui.IDsfDebugUIConstants;
/**
* @since 2.0
*/
public interface IInternalDsfDebugUIConstants {
/**
* Boolean preference controlling whether the text in the detail panes is
* wrapped. When <code>true</code> the text in the detail panes will be
* wrapped in new variable view.
*/
public static final String PREF_DETAIL_PANE_WORD_WRAP = IDsfDebugUIConstants.PLUGIN_ID + ".detail_pane_word_wrap"; //$NON-NLS-1$
}

View file

@ -13,10 +13,7 @@ package org.eclipse.cdt.dsf.debug.internal.ui;
import org.eclipse.cdt.dsf.debug.ui.IDsfDebugUIConstants; import org.eclipse.cdt.dsf.debug.ui.IDsfDebugUIConstants;
import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin; import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.swt.graphics.RGB;
public class PreferenceInitializer extends AbstractPreferenceInitializer { public class PreferenceInitializer extends AbstractPreferenceInitializer {
@ -32,28 +29,6 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer {
IPreferenceStore prefs = DsfUIPlugin.getDefault().getPreferenceStore(); IPreferenceStore prefs = DsfUIPlugin.getDefault().getPreferenceStore();
/*
* Common to all views.
*/
PreferenceConverter.setDefault(prefs, IDebugUIConstants.PREF_CHANGED_DEBUG_ELEMENT_COLOR, new RGB(255, 0, 0));
prefs.setDefault(IDsfDebugUIConstants.PREF_DETAIL_PANE_WORD_WRAP, false);
prefs.setDefault(IDsfDebugUIConstants.PREF_MAX_DETAIL_LENGTH, 10000);
/*
* Variables view
*/
prefs.setDefault(IDsfDebugUIConstants.VARIABLES_DETAIL_PANE_ORIENTATION, IDsfDebugUIConstants.VARIABLES_DETAIL_PANE_UNDERNEATH);
/*
* Registers View
*/
prefs.setDefault(IDsfDebugUIConstants.REGISTERS_DETAIL_PANE_ORIENTATION, IDsfDebugUIConstants.VARIABLES_DETAIL_PANE_UNDERNEATH);
/*
* Expressions View
*/
prefs.setDefault(IDsfDebugUIConstants.EXPRESSIONS_DETAIL_PANE_ORIENTATION, IDsfDebugUIConstants.VARIABLES_DETAIL_PANE_UNDERNEATH);
/* /*
* Debug View * Debug View
*/ */

View file

@ -11,7 +11,7 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.detailsupport; package org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.detailsupport;
import org.eclipse.cdt.dsf.debug.ui.IDsfDebugUIConstants; import org.eclipse.cdt.dsf.debug.internal.ui.IDsfDebugHelpContextIds;
import org.eclipse.jface.action.Action; import org.eclipse.jface.action.Action;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI; import org.eclipse.ui.PlatformUI;
@ -31,7 +31,7 @@ public class DetailPaneMaxLengthAction extends Action {
super(MessagesForDetailPane.PaneMaxLengthAction_MaxLength); super(MessagesForDetailPane.PaneMaxLengthAction_MaxLength);
fDialogShell = dialogShell; fDialogShell = dialogShell;
PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDsfDebugUIConstants.DETAIL_PANE_MAX_LENGTH_ACTION); PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDsfDebugHelpContextIds.DETAIL_PANE_MAX_LENGTH_ACTION);
} }

View file

@ -11,8 +11,9 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.detailsupport; package org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.detailsupport;
import org.eclipse.cdt.dsf.debug.ui.IDsfDebugUIConstants; import org.eclipse.cdt.dsf.debug.internal.ui.IDsfDebugHelpContextIds;
import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin; import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IDialogSettings; import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.dialogs.IInputValidator; import org.eclipse.jface.dialogs.IInputValidator;
@ -51,7 +52,7 @@ public class DetailPaneMaxLengthDialog extends TrayDialog {
public DetailPaneMaxLengthDialog(Shell parent) { public DetailPaneMaxLengthDialog(Shell parent) {
super(parent); super(parent);
setShellStyle(getShellStyle() | SWT.RESIZE); setShellStyle(getShellStyle() | SWT.RESIZE);
fValue = Integer.toString(DsfUIPlugin.getDefault().getPreferenceStore().getInt(IDsfDebugUIConstants.PREF_MAX_DETAIL_LENGTH)); fValue = Integer.toString(DsfUIPlugin.getDefault().getPreferenceStore().getInt(IDebugUIConstants.PREF_MAX_DETAIL_LENGTH));
fValidator = new IInputValidator() { fValidator = new IInputValidator() {
public String isValid(String newText) { public String isValid(String newText) {
try { try {
@ -88,7 +89,7 @@ public class DetailPaneMaxLengthDialog extends TrayDialog {
protected Control createContents(Composite parent) { protected Control createContents(Composite parent) {
getShell().setText(MessagesForDetailPane.PaneMaxLengthDialog_ConfigureDetails); getShell().setText(MessagesForDetailPane.PaneMaxLengthDialog_ConfigureDetails);
Control contents = super.createContents(parent); Control contents = super.createContents(parent);
PlatformUI.getWorkbench().getHelpSystem().setHelp(getDialogArea(), IDsfDebugUIConstants.DETAIL_PANE_MAX_LENGTH_ACTION); PlatformUI.getWorkbench().getHelpSystem().setHelp(getDialogArea(), IDsfDebugHelpContextIds.DETAIL_PANE_MAX_LENGTH_ACTION);
return contents; return contents;
} }
@ -129,7 +130,7 @@ public class DetailPaneMaxLengthDialog extends TrayDialog {
protected void okPressed() { protected void okPressed() {
String text = getValue(); String text = getValue();
try { try {
DsfUIPlugin.getDefault().getPreferenceStore().setValue(IDsfDebugUIConstants.PREF_MAX_DETAIL_LENGTH, Integer.parseInt(text)); DsfUIPlugin.getDefault().getPreferenceStore().setValue(IDebugUIConstants.PREF_MAX_DETAIL_LENGTH, Integer.parseInt(text));
} }
catch (NumberFormatException e) { catch (NumberFormatException e) {
DsfUIPlugin.log(e); DsfUIPlugin.log(e);

View file

@ -11,7 +11,8 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.detailsupport; package org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.detailsupport;
import org.eclipse.cdt.dsf.debug.ui.IDsfDebugUIConstants; import org.eclipse.cdt.dsf.debug.internal.ui.IDsfDebugHelpContextIds;
import org.eclipse.cdt.dsf.debug.internal.ui.IInternalDsfDebugUIConstants;
import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin; import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
import org.eclipse.jface.action.Action; import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IAction;
@ -29,12 +30,12 @@ public class DetailPaneWordWrapAction extends Action {
public DetailPaneWordWrapAction(ITextViewer textViewer) { public DetailPaneWordWrapAction(ITextViewer textViewer) {
super(MessagesForDetailPane.PaneWordWrapAction_WrapText,IAction.AS_CHECK_BOX); super(MessagesForDetailPane.PaneWordWrapAction_WrapText,IAction.AS_CHECK_BOX);
PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDsfDebugUIConstants.DETAIL_PANE_WORD_WRAP_ACTION); PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDsfDebugHelpContextIds.DETAIL_PANE_WORD_WRAP_ACTION);
fTextViewer = textViewer; fTextViewer = textViewer;
setEnabled(true); setEnabled(true);
boolean prefSetting = DsfUIPlugin.getDefault().getPreferenceStore().getBoolean(IDsfDebugUIConstants.PREF_DETAIL_PANE_WORD_WRAP); boolean prefSetting = DsfUIPlugin.getDefault().getPreferenceStore().getBoolean(IInternalDsfDebugUIConstants.PREF_DETAIL_PANE_WORD_WRAP);
fTextViewer.getTextWidget().setWordWrap(prefSetting); fTextViewer.getTextWidget().setWordWrap(prefSetting);
setChecked(prefSetting); setChecked(prefSetting);
@ -47,7 +48,7 @@ public class DetailPaneWordWrapAction extends Action {
@Override @Override
public void run() { public void run() {
fTextViewer.getTextWidget().setWordWrap(isChecked()); fTextViewer.getTextWidget().setWordWrap(isChecked());
DsfUIPlugin.getDefault().getPreferenceStore().setValue(IDsfDebugUIConstants.PREF_DETAIL_PANE_WORD_WRAP,isChecked()); DsfUIPlugin.getDefault().getPreferenceStore().setValue(IInternalDsfDebugUIConstants.PREF_DETAIL_PANE_WORD_WRAP,isChecked());
DsfUIPlugin.getDefault().savePluginPreferences(); DsfUIPlugin.getDefault().savePluginPreferences();
} }

View file

@ -23,11 +23,12 @@ import java.util.Set;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor; import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
import org.eclipse.cdt.dsf.debug.internal.ui.IDsfDebugHelpContextIds;
import org.eclipse.cdt.dsf.debug.internal.ui.IInternalDsfDebugUIConstants;
import org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.detailsupport.DetailPaneMaxLengthAction; import org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.detailsupport.DetailPaneMaxLengthAction;
import org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.detailsupport.DetailPaneWordWrapAction; import org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.detailsupport.DetailPaneWordWrapAction;
import org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.detailsupport.MessagesForDetailPane; import org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.detailsupport.MessagesForDetailPane;
import org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.detailsupport.TextViewerAction; import org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.detailsupport.TextViewerAction;
import org.eclipse.cdt.dsf.debug.ui.IDsfDebugUIConstants;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.IDebugVMConstants; import org.eclipse.cdt.dsf.debug.ui.viewmodel.IDebugVMConstants;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.numberformat.FormattedValueVMUtil; import org.eclipse.cdt.dsf.debug.ui.viewmodel.numberformat.FormattedValueVMUtil;
import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin; import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
@ -379,7 +380,7 @@ public class NumberFormatDetailPane implements IDetailPane, IAdaptable, IPropert
insert = CRLF + result; insert = CRLF + result;
} }
try { try {
int max = DsfUIPlugin.getDefault().getPreferenceStore().getInt(IDsfDebugUIConstants.PREF_MAX_DETAIL_LENGTH); int max = DsfUIPlugin.getDefault().getPreferenceStore().getInt(IDebugUIConstants.PREF_MAX_DETAIL_LENGTH);
if (max > 0 && insert.length() > max) { if (max > 0 && insert.length() > max) {
insert = insert.substring(0, max) + DOTS; insert = insert.substring(0, max) + DOTS;
} }
@ -455,10 +456,10 @@ public class NumberFormatDetailPane implements IDetailPane, IAdaptable, IPropert
// Create & configure a TextViewer // Create & configure a TextViewer
fTextViewer = new TextViewer(parent, SWT.V_SCROLL | SWT.H_SCROLL); fTextViewer = new TextViewer(parent, SWT.V_SCROLL | SWT.H_SCROLL);
fTextViewer.setDocument(getDetailDocument()); fTextViewer.setDocument(getDetailDocument());
fTextViewer.getTextWidget().setFont(JFaceResources.getFont(IDsfDebugUIConstants.DETAIL_PANE_FONT)); fTextViewer.getTextWidget().setFont(JFaceResources.getFont(IDebugUIConstants.PREF_DETAIL_PANE_FONT));
fTextViewer.getTextWidget().setWordWrap(DsfUIPlugin.getDefault().getPreferenceStore().getBoolean(IDsfDebugUIConstants.PREF_DETAIL_PANE_WORD_WRAP)); fTextViewer.getTextWidget().setWordWrap(DsfUIPlugin.getDefault().getPreferenceStore().getBoolean(IInternalDsfDebugUIConstants.PREF_DETAIL_PANE_WORD_WRAP));
fTextViewer.setEditable(false); fTextViewer.setEditable(false);
PlatformUI.getWorkbench().getHelpSystem().setHelp(fTextViewer.getTextWidget(), IDsfDebugUIConstants.DETAIL_PANE); PlatformUI.getWorkbench().getHelpSystem().setHelp(fTextViewer.getTextWidget(), IDsfDebugHelpContextIds.DETAIL_PANE);
Control control = fTextViewer.getControl(); Control control = fTextViewer.getControl();
GridData gd = new GridData(GridData.FILL_BOTH); GridData gd = new GridData(GridData.FILL_BOTH);
control.setLayoutData(gd); control.setLayoutData(gd);
@ -522,13 +523,13 @@ public class NumberFormatDetailPane implements IDetailPane, IAdaptable, IPropert
TextViewerAction textAction= new TextViewerAction(fTextViewer, ITextOperationTarget.SELECT_ALL); TextViewerAction textAction= new TextViewerAction(fTextViewer, ITextOperationTarget.SELECT_ALL);
textAction.configureAction(MessagesForDetailPane.DetailPane_Select_All, "", ""); //$NON-NLS-1$ //$NON-NLS-2$ textAction.configureAction(MessagesForDetailPane.DetailPane_Select_All, "", ""); //$NON-NLS-1$ //$NON-NLS-2$
textAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.SELECT_ALL); textAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.SELECT_ALL);
PlatformUI.getWorkbench().getHelpSystem().setHelp(textAction, IDsfDebugUIConstants.DETAIL_PANE_SELECT_ALL_ACTION); PlatformUI.getWorkbench().getHelpSystem().setHelp(textAction, IDsfDebugHelpContextIds.DETAIL_PANE_SELECT_ALL_ACTION);
setAction(DETAIL_SELECT_ALL_ACTION, textAction); setAction(DETAIL_SELECT_ALL_ACTION, textAction);
textAction= new TextViewerAction(fTextViewer, ITextOperationTarget.COPY); textAction= new TextViewerAction(fTextViewer, ITextOperationTarget.COPY);
textAction.configureAction(MessagesForDetailPane.DetailPane_Copy, "", ""); //$NON-NLS-1$ //$NON-NLS-2$ textAction.configureAction(MessagesForDetailPane.DetailPane_Copy, "", ""); //$NON-NLS-1$ //$NON-NLS-2$
textAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.COPY); textAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.COPY);
PlatformUI.getWorkbench().getHelpSystem().setHelp(textAction, IDsfDebugUIConstants.DETAIL_PANE_COPY_ACTION); PlatformUI.getWorkbench().getHelpSystem().setHelp(textAction, IDsfDebugHelpContextIds.DETAIL_PANE_COPY_ACTION);
setAction(DETAIL_COPY_ACTION, textAction); setAction(DETAIL_COPY_ACTION, textAction);
setSelectionDependantAction(DETAIL_COPY_ACTION); setSelectionDependantAction(DETAIL_COPY_ACTION);
@ -749,13 +750,13 @@ public class NumberFormatDetailPane implements IDetailPane, IAdaptable, IPropert
*/ */
public void propertyChange(PropertyChangeEvent event) { public void propertyChange(PropertyChangeEvent event) {
String propertyName= event.getProperty(); String propertyName= event.getProperty();
if (propertyName.equals(IDsfDebugUIConstants.DETAIL_PANE_FONT)) { if (propertyName.equals(IDebugUIConstants.PREF_DETAIL_PANE_FONT)) {
fTextViewer.getTextWidget().setFont(JFaceResources.getFont(IDsfDebugUIConstants.DETAIL_PANE_FONT)); fTextViewer.getTextWidget().setFont(JFaceResources.getFont(IDebugUIConstants.PREF_DETAIL_PANE_FONT));
} else if (propertyName.equals(IDsfDebugUIConstants.PREF_MAX_DETAIL_LENGTH)) { } else if (propertyName.equals(IDebugUIConstants.PREF_MAX_DETAIL_LENGTH)) {
display(fLastDisplayed); display(fLastDisplayed);
} else if (propertyName.equals(IDsfDebugUIConstants.PREF_DETAIL_PANE_WORD_WRAP)) { } else if (propertyName.equals(IInternalDsfDebugUIConstants.PREF_DETAIL_PANE_WORD_WRAP)) {
fTextViewer.getTextWidget().setWordWrap(DsfUIPlugin.getDefault().getPreferenceStore().getBoolean(IDsfDebugUIConstants.PREF_DETAIL_PANE_WORD_WRAP)); fTextViewer.getTextWidget().setWordWrap(DsfUIPlugin.getDefault().getPreferenceStore().getBoolean(IInternalDsfDebugUIConstants.PREF_DETAIL_PANE_WORD_WRAP));
getAction(DETAIL_WORD_WRAP_ACTION).setChecked(DsfUIPlugin.getDefault().getPreferenceStore().getBoolean(IDsfDebugUIConstants.PREF_DETAIL_PANE_WORD_WRAP)); getAction(DETAIL_WORD_WRAP_ACTION).setChecked(DsfUIPlugin.getDefault().getPreferenceStore().getBoolean(IInternalDsfDebugUIConstants.PREF_DETAIL_PANE_WORD_WRAP));
} }
} }
} }

View file

@ -10,7 +10,7 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.debug.ui; package org.eclipse.cdt.dsf.debug.ui;
import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
/** /**
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
@ -20,9 +20,9 @@ import org.eclipse.debug.ui.IDebugUIConstants;
public interface IDsfDebugUIConstants { public interface IDsfDebugUIConstants {
/** /**
* Debug UI plug-in identifier (value <code>"org.eclipse.cdt.dsf.debug.ui"</code>). * Debug UI plug-in identifier (value <code>"org.eclipse.cdt.dsf.ui"</code>).
*/ */
public static final String PLUGIN_ID = "org.eclipse.cdt.dsf.debug.ui"; //$NON-NLS-1$; public static final String PLUGIN_ID = DsfUIPlugin.PLUGIN_ID;
/** Loaded shared library symbols image identifier. */ /** Loaded shared library symbols image identifier. */
public static final String IMG_OBJS_SHARED_LIBRARY_SYMBOLS_LOADED = "icons/library_syms_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_SHARED_LIBRARY_SYMBOLS_LOADED = "icons/library_syms_obj.gif"; //$NON-NLS-1$
@ -30,37 +30,6 @@ public interface IDsfDebugUIConstants {
/** Unloaded Shared library symbols image identifier. */ /** Unloaded Shared library symbols image identifier. */
public static final String IMG_OBJS_SHARED_LIBRARY_SYMBOLS_UNLOADED = "icons/library_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_SHARED_LIBRARY_SYMBOLS_UNLOADED = "icons/library_obj.gif"; //$NON-NLS-1$
/*
* The orientation of the detail view in the VariablesView
* Note: these constants should be removed from API. See bug 246005.
*/
public static final String VARIABLES_DETAIL_PANE_ORIENTATION = "Variables.detail.orientation"; //$NON-NLS-1$
public static final String EXPRESSIONS_DETAIL_PANE_ORIENTATION = "Expressions.detail.orientation"; //$NON-NLS-1$
public static final String REGISTERS_DETAIL_PANE_ORIENTATION = "Registers.detail.orientation"; //$NON-NLS-1$
public static final String MODULES_DETAIL_PANE_ORIENTATION = "Modules.detail.orientation"; //$NON-NLS-1$
public static final String VARIABLES_DETAIL_PANE_RIGHT = "Variables.detail.orientation.right"; //$NON-NLS-1$
public static final String VARIABLES_DETAIL_PANE_UNDERNEATH = "Variables.detail.orientation.underneath"; //$NON-NLS-1$
public static final String VARIABLES_DETAIL_PANE_HIDDEN = "Variables.detail.orientation.hidden"; //$NON-NLS-1$
/**
* Boolean preference controlling whether the text in the detail panes is
* wrapped. When <code>true</code> the text in the detail panes will be
* wrapped in new variable view.
*/
public static final String PREF_DETAIL_PANE_WORD_WRAP = PLUGIN_ID + ".detail_pane_word_wrap"; //$NON-NLS-1$
/**
* Maximum number of characters to display in the details area of the variables
* view, or 0 if unlimited.
*/
public static final String PREF_MAX_DETAIL_LENGTH = PLUGIN_ID + ".max_detail_length"; //$NON-NLS-1$
/**
* The name of the font to use for detail panes. This font is managed via
* the workbench font preference page.
*/
public static final String DETAIL_PANE_FONT= PLUGIN_ID + "DetailPaneFont"; //$NON-NLS-1$
/** /**
* Integer preference to control the maximum amount of stack frames to * Integer preference to control the maximum amount of stack frames to
* retrieve from the backend. Default value is <code>10</code>. * retrieve from the backend. Default value is <code>10</code>.
@ -92,24 +61,22 @@ public interface IDsfDebugUIConstants {
*/ */
public static final String PREF_MIN_STEP_INTERVAL= "minStepInterval"; //$NON-NLS-1$ public static final String PREF_MIN_STEP_INTERVAL= "minStepInterval"; //$NON-NLS-1$
/**
* Help prefixes.
*/
public static final String PREFIX = IDebugUIConstants.PLUGIN_ID + "."; //$NON-NLS-1$
public static final String DETAIL_PANE = PREFIX + "detail_pane_context"; //$NON-NLS-1$
public static final String DETAIL_PANE_ASSIGN_VALUE_ACTION = PREFIX + "detail_pane_assign_value_action_context"; //$NON-NLS-1$
public static final String DETAIL_PANE_CONTENT_ASSIST_ACTION = PREFIX + "detail_pane_content_assist_action_context"; //$NON-NLS-1$
public static final String DETAIL_PANE_CUT_ACTION = PREFIX + "detail_pane_cut_action_context"; //$NON-NLS-1$
public static final String DETAIL_PANE_COPY_ACTION = PREFIX + "detail_pane_copy_action_context"; //$NON-NLS-1$
public static final String DETAIL_PANE_PASTE_ACTION = PREFIX + "detail_pane_paste_action_context"; //$NON-NLS-1$
public static final String DETAIL_PANE_SELECT_ALL_ACTION = PREFIX + "detail_pane_select_all_action_context"; //$NON-NLS-1$
public static final String DETAIL_PANE_FIND_REPLACE_ACTION = PREFIX + "detail_pane_find_replace_action_context"; //$NON-NLS-1$
public static final String DETAIL_PANE_WORD_WRAP_ACTION = PREFIX + "detail_pane_word_wrap_action_context"; //$NON-NLS-1$
public static final String DETAIL_PANE_MAX_LENGTH_ACTION = PREFIX + "detail_pane_max_length_action_context"; //$NON-NLS-1$
/** /**
* @since 1.1 * @since 1.1
*/ */
public static final String PREFERENCE_PAGE= PREFIX + "preference_page_context"; //$NON-NLS-1$ public static final String PREFERENCE_PAGE= PLUGIN_ID + ".preference_page_context"; //$NON-NLS-1$
/**
* Stale data foreground color preference key.
*
* @since 2.0
*/
public static final String PREF_COLOR_STALE_DATA_FOREGROUND= PLUGIN_ID + ".staledata.foreground"; //$NON-NLS-1$
/**
* Stale data foreground color preference key.
*
* @since 2.0
*/
public static final String PREF_COLOR_STALE_DATA_BACKGROUND= PLUGIN_ID + ".staledata.background"; //$NON-NLS-1$
} }

View file

@ -10,6 +10,8 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.debug.ui.viewmodel.launch; package org.eclipse.cdt.dsf.debug.ui.viewmodel.launch;
import java.util.Map;
import org.eclipse.cdt.dsf.datamodel.IDMContext; import org.eclipse.cdt.dsf.datamodel.IDMContext;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext; import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext; import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
@ -172,4 +174,11 @@ public class DelayedStackRefreshUpdatePolicy extends UpdatePolicyDecorator {
} }
} }
public Object[] getInitialRootElementChildren(Object rootElement) {
return null;
}
public Map<String, Object> getInitialRootElementProperties(Object rootElement) {
return null;
}
} }

View file

@ -38,6 +38,7 @@ import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelColumnInfo;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelFont; import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelFont;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelText; import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelText;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.PropertiesBasedLabelProvider; import org.eclipse.cdt.dsf.ui.viewmodel.properties.PropertiesBasedLabelProvider;
import org.eclipse.cdt.dsf.ui.viewmodel.update.StaleDataLabelBackground;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate; import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider; import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider;
@ -103,6 +104,7 @@ public class ModulesVMNode extends AbstractDMVMNode
}; };
}, },
new DsfUILabelImage(IDsfDebugUIConstants.IMG_OBJS_SHARED_LIBRARY_SYMBOLS_UNLOADED), new DsfUILabelImage(IDsfDebugUIConstants.IMG_OBJS_SHARED_LIBRARY_SYMBOLS_UNLOADED),
new StaleDataLabelBackground(),
new LabelFont(JFaceResources.getFontDescriptor(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT).getFontData()[0]) new LabelFont(JFaceResources.getFontDescriptor(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT).getFontData()[0])
})); }));

View file

@ -22,12 +22,13 @@ import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
import org.eclipse.cdt.dsf.concurrent.Query; import org.eclipse.cdt.dsf.concurrent.Query;
import org.eclipse.cdt.dsf.datamodel.DMContexts; import org.eclipse.cdt.dsf.datamodel.DMContexts;
import org.eclipse.cdt.dsf.datamodel.IDMContext; import org.eclipse.cdt.dsf.datamodel.IDMContext;
import org.eclipse.cdt.dsf.debug.internal.ui.IDsfDebugHelpContextIds;
import org.eclipse.cdt.dsf.debug.internal.ui.IInternalDsfDebugUIConstants;
import org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.detailsupport.MessagesForDetailPane; import org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.detailsupport.MessagesForDetailPane;
import org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.detailsupport.TextViewerAction; import org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.detailsupport.TextViewerAction;
import org.eclipse.cdt.dsf.debug.service.IModules; import org.eclipse.cdt.dsf.debug.service.IModules;
import org.eclipse.cdt.dsf.debug.service.IModules.IModuleDMContext; import org.eclipse.cdt.dsf.debug.service.IModules.IModuleDMContext;
import org.eclipse.cdt.dsf.debug.service.IModules.IModuleDMData; import org.eclipse.cdt.dsf.debug.service.IModules.IModuleDMData;
import org.eclipse.cdt.dsf.debug.ui.IDsfDebugUIConstants;
import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin; import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
import org.eclipse.cdt.dsf.service.DsfServicesTracker; import org.eclipse.cdt.dsf.service.DsfServicesTracker;
import org.eclipse.cdt.dsf.service.DsfSession; import org.eclipse.cdt.dsf.service.DsfSession;
@ -37,6 +38,7 @@ 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.core.runtime.jobs.Job; import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.IDebugView; import org.eclipse.debug.ui.IDebugView;
import org.eclipse.jface.action.IMenuListener; import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.IMenuManager;
@ -183,8 +185,8 @@ public class ModuleDetailPane extends ModulesAbstractDetailPane implements IAdap
public void propertyChange(PropertyChangeEvent event) { public void propertyChange(PropertyChangeEvent event) {
String propertyName= event.getProperty(); String propertyName= event.getProperty();
if (propertyName.equals(IDsfDebugUIConstants.DETAIL_PANE_FONT)) { if (propertyName.equals(IDebugUIConstants.PREF_DETAIL_PANE_FONT)) {
fSourceViewer.getTextWidget().setFont(JFaceResources.getFont(IDsfDebugUIConstants.DETAIL_PANE_FONT)); fSourceViewer.getTextWidget().setFont(JFaceResources.getFont(IDebugUIConstants.PREF_DETAIL_PANE_FONT));
} }
} }
@ -199,10 +201,10 @@ public class ModuleDetailPane extends ModulesAbstractDetailPane implements IAdap
// Create & configure a SourceViewer // Create & configure a SourceViewer
fSourceViewer = new SourceViewer(parent, null, SWT.V_SCROLL | SWT.H_SCROLL); fSourceViewer = new SourceViewer(parent, null, SWT.V_SCROLL | SWT.H_SCROLL);
fSourceViewer.setDocument(getDetailDocument()); fSourceViewer.setDocument(getDetailDocument());
fSourceViewer.getTextWidget().setFont(JFaceResources.getFont(IDsfDebugUIConstants.DETAIL_PANE_FONT)); fSourceViewer.getTextWidget().setFont(JFaceResources.getFont(IDebugUIConstants.PREF_DETAIL_PANE_FONT));
fSourceViewer.getTextWidget().setWordWrap(DsfUIPlugin.getDefault().getPreferenceStore().getBoolean(IDsfDebugUIConstants.PREF_DETAIL_PANE_WORD_WRAP)); fSourceViewer.getTextWidget().setWordWrap(DsfUIPlugin.getDefault().getPreferenceStore().getBoolean(IInternalDsfDebugUIConstants.PREF_DETAIL_PANE_WORD_WRAP));
fSourceViewer.setEditable(false); fSourceViewer.setEditable(false);
PlatformUI.getWorkbench().getHelpSystem().setHelp(fSourceViewer.getTextWidget(), IDsfDebugUIConstants.DETAIL_PANE); PlatformUI.getWorkbench().getHelpSystem().setHelp(fSourceViewer.getTextWidget(), IDsfDebugHelpContextIds.DETAIL_PANE);
Control control = fSourceViewer.getControl(); Control control = fSourceViewer.getControl();
GridData gd = new GridData(GridData.FILL_BOTH); GridData gd = new GridData(GridData.FILL_BOTH);
control.setLayoutData(gd); control.setLayoutData(gd);
@ -316,13 +318,13 @@ public class ModuleDetailPane extends ModulesAbstractDetailPane implements IAdap
TextViewerAction textAction= new TextViewerAction(fSourceViewer, ITextOperationTarget.SELECT_ALL); TextViewerAction textAction= new TextViewerAction(fSourceViewer, ITextOperationTarget.SELECT_ALL);
textAction.configureAction(MessagesForDetailPane.DetailPane_Select_All, "", ""); //$NON-NLS-1$ //$NON-NLS-2$ textAction.configureAction(MessagesForDetailPane.DetailPane_Select_All, "", ""); //$NON-NLS-1$ //$NON-NLS-2$
textAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.SELECT_ALL); textAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.SELECT_ALL);
PlatformUI.getWorkbench().getHelpSystem().setHelp(textAction, IDsfDebugUIConstants.DETAIL_PANE_SELECT_ALL_ACTION); PlatformUI.getWorkbench().getHelpSystem().setHelp(textAction, IDsfDebugHelpContextIds.DETAIL_PANE_SELECT_ALL_ACTION);
setAction(DETAIL_SELECT_ALL_ACTION, textAction); setAction(DETAIL_SELECT_ALL_ACTION, textAction);
textAction= new TextViewerAction(fSourceViewer, ITextOperationTarget.COPY); textAction= new TextViewerAction(fSourceViewer, ITextOperationTarget.COPY);
textAction.configureAction(MessagesForDetailPane.DetailPane_Copy, "", ""); //$NON-NLS-1$ //$NON-NLS-2$ textAction.configureAction(MessagesForDetailPane.DetailPane_Copy, "", ""); //$NON-NLS-1$ //$NON-NLS-2$
textAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.COPY); textAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.COPY);
PlatformUI.getWorkbench().getHelpSystem().setHelp(textAction, IDsfDebugUIConstants.DETAIL_PANE_COPY_ACTION); PlatformUI.getWorkbench().getHelpSystem().setHelp(textAction, IDsfDebugHelpContextIds.DETAIL_PANE_COPY_ACTION);
setAction(DETAIL_COPY_ACTION, textAction); setAction(DETAIL_COPY_ACTION, textAction);
setSelectionDependantAction(DETAIL_COPY_ACTION); setSelectionDependantAction(DETAIL_COPY_ACTION);

View file

@ -40,6 +40,7 @@ import org.eclipse.cdt.dsf.debug.ui.viewmodel.numberformat.FormattedValueLabelTe
import org.eclipse.cdt.dsf.debug.ui.viewmodel.numberformat.FormattedValueVMUtil; import org.eclipse.cdt.dsf.debug.ui.viewmodel.numberformat.FormattedValueVMUtil;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.numberformat.IFormattedValueVMContext; import org.eclipse.cdt.dsf.debug.ui.viewmodel.numberformat.IFormattedValueVMContext;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.register.RegisterBitFieldCellModifier.BitFieldEditorStyle; import org.eclipse.cdt.dsf.debug.ui.viewmodel.register.RegisterBitFieldCellModifier.BitFieldEditorStyle;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.variable.VariableLabelFont;
import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin; import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
import org.eclipse.cdt.dsf.service.DsfSession; import org.eclipse.cdt.dsf.service.DsfSession;
import org.eclipse.cdt.dsf.ui.concurrent.ViewerDataRequestMonitor; import org.eclipse.cdt.dsf.ui.concurrent.ViewerDataRequestMonitor;
@ -49,13 +50,15 @@ import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.IElementPropertiesProvider; import org.eclipse.cdt.dsf.ui.viewmodel.properties.IElementPropertiesProvider;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.IPropertiesUpdate; import org.eclipse.cdt.dsf.ui.viewmodel.properties.IPropertiesUpdate;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelAttribute; import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelAttribute;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelColor; import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelBackground;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelColumnInfo; import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelColumnInfo;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelFont; import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelForeground;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelImage; import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelImage;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelText; import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelText;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.PropertiesBasedLabelProvider; import org.eclipse.cdt.dsf.ui.viewmodel.properties.PropertiesBasedLabelProvider;
import org.eclipse.cdt.dsf.ui.viewmodel.update.ICachingVMProvider; import org.eclipse.cdt.dsf.ui.viewmodel.update.ICachingVMProvider;
import org.eclipse.cdt.dsf.ui.viewmodel.update.StaleDataLabelBackground;
import org.eclipse.cdt.dsf.ui.viewmodel.update.StaleDataLabelForeground;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
@ -73,7 +76,6 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationCont
import org.eclipse.debug.ui.DebugUITools; import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.actions.IWatchExpressionFactoryAdapter2; import org.eclipse.debug.ui.actions.IWatchExpressionFactoryAdapter2;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.CellEditor; import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ComboBoxCellEditor; import org.eclipse.jface.viewers.ComboBoxCellEditor;
@ -196,7 +198,8 @@ public class RegisterBitFieldVMNode extends AbstractExpressionVMNode
MessagesForRegisterVM.RegisterBitFieldVMNode_Name_column__text_format, MessagesForRegisterVM.RegisterBitFieldVMNode_Name_column__text_format,
new String[] { PROP_NAME }), new String[] { PROP_NAME }),
new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_REGISTER)), new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_REGISTER)),
new LabelFont(JFaceResources.getFontDescriptor(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT).getFontData()[0]) new StaleDataLabelForeground(),
new VariableLabelFont(),
})); }));
// The description column contains a brief description of the bit field. // The description column contains a brief description of the bit field.
@ -206,7 +209,8 @@ public class RegisterBitFieldVMNode extends AbstractExpressionVMNode
new LabelText( new LabelText(
MessagesForRegisterVM.RegisterBitFieldVMNode_Description_column__text_format, MessagesForRegisterVM.RegisterBitFieldVMNode_Description_column__text_format,
new String[] { IRegisterVMConstants.PROP_DESCRIPTION }), new String[] { IRegisterVMConstants.PROP_DESCRIPTION }),
new LabelFont(JFaceResources.getFontDescriptor(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT).getFontData()[0]) new StaleDataLabelForeground(),
new VariableLabelFont(),
})); }));
// In the type column add information about bit field read/write/fload flags. // In the type column add information about bit field read/write/fload flags.
@ -245,7 +249,8 @@ public class RegisterBitFieldVMNode extends AbstractExpressionVMNode
} }
} }
}, },
new LabelFont(JFaceResources.getFontDescriptor(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT).getFontData()[0]) new StaleDataLabelForeground(),
new VariableLabelFont(),
})); }));
// Value column shows the value in the active value format, followed by the active mnemonic if one is // Value column shows the value in the active value format, followed by the active mnemonic if one is
@ -266,7 +271,7 @@ public class RegisterBitFieldVMNode extends AbstractExpressionVMNode
IRegisterVMConstants.PROP_CURRENT_MNEMONIC_LONG_NAME}), IRegisterVMConstants.PROP_CURRENT_MNEMONIC_LONG_NAME}),
new FormattedValueLabelText(), new FormattedValueLabelText(),
new ErrorLabelText(), new ErrorLabelText(),
new LabelColor(new RGB(255, 0, 0), null) // TODO: replace with preference error color new LabelForeground(new RGB(255, 0, 0)) // TODO: replace with preference error color
{ {
{ setPropertyNames(new String[] { PROP_NAME }); } { setPropertyNames(new String[] { PROP_NAME }); }
@ -275,8 +280,7 @@ public class RegisterBitFieldVMNode extends AbstractExpressionVMNode
return !status.isOK(); return !status.isOK();
} }
}, },
new LabelColor( new LabelBackground(
null,
DebugUITools.getPreferenceColor(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND).getRGB()) DebugUITools.getPreferenceColor(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND).getRGB())
{ {
{ {
@ -296,7 +300,8 @@ public class RegisterBitFieldVMNode extends AbstractExpressionVMNode
return Boolean.TRUE.equals(activeChanged) && !Boolean.TRUE.equals(activeFormatChanged); return Boolean.TRUE.equals(activeChanged) && !Boolean.TRUE.equals(activeFormatChanged);
} }
}, },
new LabelFont(JFaceResources.getFontDescriptor(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT).getFontData()[0]) new StaleDataLabelForeground(),
new VariableLabelFont(),
})); }));
// Expression column is visible only in the expressions view. It shows the expression string that the user // Expression column is visible only in the expressions view. It shows the expression string that the user
@ -308,7 +313,8 @@ public class RegisterBitFieldVMNode extends AbstractExpressionVMNode
MessagesForRegisterVM.RegisterBitFieldVMNode_Expression_column__text_format, MessagesForRegisterVM.RegisterBitFieldVMNode_Expression_column__text_format,
new String[] { PROP_ELEMENT_EXPRESSION }), new String[] { PROP_ELEMENT_EXPRESSION }),
new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_REGISTER)), new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_REGISTER)),
new LabelFont(JFaceResources.getFontDescriptor(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT).getFontData()[0]) new StaleDataLabelForeground(),
new VariableLabelFont(),
})); }));
provider.setColumnInfo( provider.setColumnInfo(
@ -329,9 +335,8 @@ public class RegisterBitFieldVMNode extends AbstractExpressionVMNode
MessagesForRegisterVM.RegisterBitFieldVMNode_No_columns__Error__text_format, MessagesForRegisterVM.RegisterBitFieldVMNode_No_columns__Error__text_format,
new String[] { PROP_NAME }), new String[] { PROP_NAME }),
new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_REGISTER)), new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_REGISTER)),
new LabelColor( new LabelForeground(
DebugUITools.getPreferenceColor(IDebugUIConstants.PREF_CHANGED_DEBUG_ELEMENT_COLOR).getRGB(), DebugUITools.getPreferenceColor(IDebugUIConstants.PREF_CHANGED_DEBUG_ELEMENT_COLOR).getRGB())
null)
{ {
{ {
setPropertyNames(new String[] { setPropertyNames(new String[] {
@ -350,7 +355,8 @@ public class RegisterBitFieldVMNode extends AbstractExpressionVMNode
return Boolean.TRUE.equals(activeChanged) && !Boolean.TRUE.equals(activeFormatChanged); return Boolean.TRUE.equals(activeChanged) && !Boolean.TRUE.equals(activeFormatChanged);
} }
}, },
new LabelFont(JFaceResources.getFontDescriptor(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT).getFontData()[0]) new StaleDataLabelBackground(),
new VariableLabelFont(),
})); }));
return provider; return provider;

View file

@ -29,6 +29,7 @@ import org.eclipse.cdt.dsf.debug.service.IRunControl.ISuspendedDMEvent;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.IDebugVMConstants; import org.eclipse.cdt.dsf.debug.ui.viewmodel.IDebugVMConstants;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.expression.AbstractExpressionVMNode; import org.eclipse.cdt.dsf.debug.ui.viewmodel.expression.AbstractExpressionVMNode;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.expression.WatchExpressionCellModifier; import org.eclipse.cdt.dsf.debug.ui.viewmodel.expression.WatchExpressionCellModifier;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.variable.VariableLabelFont;
import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin; import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
import org.eclipse.cdt.dsf.service.DsfSession; import org.eclipse.cdt.dsf.service.DsfSession;
import org.eclipse.cdt.dsf.ui.concurrent.ViewerDataRequestMonitor; import org.eclipse.cdt.dsf.ui.concurrent.ViewerDataRequestMonitor;
@ -39,10 +40,11 @@ import org.eclipse.cdt.dsf.ui.viewmodel.properties.IElementPropertiesProvider;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.IPropertiesUpdate; import org.eclipse.cdt.dsf.ui.viewmodel.properties.IPropertiesUpdate;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelAttribute; import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelAttribute;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelColumnInfo; import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelColumnInfo;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelFont;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelImage; import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelImage;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelText; import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelText;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.PropertiesBasedLabelProvider; import org.eclipse.cdt.dsf.ui.viewmodel.properties.PropertiesBasedLabelProvider;
import org.eclipse.cdt.dsf.ui.viewmodel.update.StaleDataLabelBackground;
import org.eclipse.cdt.dsf.ui.viewmodel.update.StaleDataLabelForeground;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
@ -60,7 +62,6 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationCont
import org.eclipse.debug.ui.DebugUITools; import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.actions.IWatchExpressionFactoryAdapter2; import org.eclipse.debug.ui.actions.IWatchExpressionFactoryAdapter2;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.viewers.CellEditor; import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ICellModifier; import org.eclipse.jface.viewers.ICellModifier;
import org.eclipse.jface.viewers.TextCellEditor; import org.eclipse.jface.viewers.TextCellEditor;
@ -222,7 +223,8 @@ public class RegisterGroupVMNode extends AbstractExpressionVMNode
MessagesForRegisterVM.RegisterGroupVMNode_Name_column__text_format, MessagesForRegisterVM.RegisterGroupVMNode_Name_column__text_format,
new String[] { PROP_NAME }), new String[] { PROP_NAME }),
new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_REGISTER_GROUP)), new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_REGISTER_GROUP)),
new LabelFont(JFaceResources.getFontDescriptor(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT).getFontData()[0]) new StaleDataLabelForeground(),
new VariableLabelFont(),
})); }));
// The description column contains a brief description of the register group. // The description column contains a brief description of the register group.
@ -231,7 +233,8 @@ public class RegisterGroupVMNode extends AbstractExpressionVMNode
new LabelColumnInfo(new LabelAttribute[] { new LabelColumnInfo(new LabelAttribute[] {
new LabelText(MessagesForRegisterVM.RegisterGroupVMNode_Description_column__text_format, new LabelText(MessagesForRegisterVM.RegisterGroupVMNode_Description_column__text_format,
new String[] { PROP_REGISTER_GROUP_DESCRIPTION }), new String[] { PROP_REGISTER_GROUP_DESCRIPTION }),
new LabelFont(JFaceResources.getFontDescriptor(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT).getFontData()[0]) new StaleDataLabelForeground(),
new VariableLabelFont(),
})); }));
// Expression column is visible only in the expressions view. It shows the expression string that the user // Expression column is visible only in the expressions view. It shows the expression string that the user
@ -243,7 +246,8 @@ public class RegisterGroupVMNode extends AbstractExpressionVMNode
MessagesForRegisterVM.RegisterGroupVMNode_Expression_column__text_format, MessagesForRegisterVM.RegisterGroupVMNode_Expression_column__text_format,
new String[] { PROP_ELEMENT_EXPRESSION }), new String[] { PROP_ELEMENT_EXPRESSION }),
new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_REGISTER_GROUP)), new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_REGISTER_GROUP)),
new LabelFont(JFaceResources.getFontDescriptor(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT).getFontData()[0]) new StaleDataLabelForeground(),
new VariableLabelFont(),
})); }));
provider.setColumnInfo( provider.setColumnInfo(
@ -252,7 +256,8 @@ public class RegisterGroupVMNode extends AbstractExpressionVMNode
new LabelText(MessagesForRegisterVM.RegisterGroupVMNode_No_columns__text_format, new LabelText(MessagesForRegisterVM.RegisterGroupVMNode_No_columns__text_format,
new String[] { PROP_NAME, PROP_REGISTER_GROUP_DESCRIPTION}), new String[] { PROP_NAME, PROP_REGISTER_GROUP_DESCRIPTION}),
new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_REGISTER_GROUP)), new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_REGISTER_GROUP)),
new LabelFont(JFaceResources.getFontDescriptor(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT).getFontData()[0]) new StaleDataLabelBackground(),
new VariableLabelFont(),
})); }));
return provider; return provider;

View file

@ -36,6 +36,7 @@ import org.eclipse.cdt.dsf.debug.ui.viewmodel.expression.AbstractExpressionVMNod
import org.eclipse.cdt.dsf.debug.ui.viewmodel.numberformat.FormattedValueLabelText; import org.eclipse.cdt.dsf.debug.ui.viewmodel.numberformat.FormattedValueLabelText;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.numberformat.FormattedValueVMUtil; import org.eclipse.cdt.dsf.debug.ui.viewmodel.numberformat.FormattedValueVMUtil;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.numberformat.IFormattedValueVMContext; import org.eclipse.cdt.dsf.debug.ui.viewmodel.numberformat.IFormattedValueVMContext;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.variable.VariableLabelFont;
import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin; import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
import org.eclipse.cdt.dsf.service.DsfSession; import org.eclipse.cdt.dsf.service.DsfSession;
import org.eclipse.cdt.dsf.ui.concurrent.ViewerDataRequestMonitor; import org.eclipse.cdt.dsf.ui.concurrent.ViewerDataRequestMonitor;
@ -45,13 +46,15 @@ import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.IElementPropertiesProvider; import org.eclipse.cdt.dsf.ui.viewmodel.properties.IElementPropertiesProvider;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.IPropertiesUpdate; import org.eclipse.cdt.dsf.ui.viewmodel.properties.IPropertiesUpdate;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelAttribute; import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelAttribute;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelColor; import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelBackground;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelColumnInfo; import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelColumnInfo;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelFont; import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelForeground;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelImage; import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelImage;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelText; import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelText;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.PropertiesBasedLabelProvider; import org.eclipse.cdt.dsf.ui.viewmodel.properties.PropertiesBasedLabelProvider;
import org.eclipse.cdt.dsf.ui.viewmodel.update.ICachingVMProvider; import org.eclipse.cdt.dsf.ui.viewmodel.update.ICachingVMProvider;
import org.eclipse.cdt.dsf.ui.viewmodel.update.StaleDataLabelBackground;
import org.eclipse.cdt.dsf.ui.viewmodel.update.StaleDataLabelForeground;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
@ -70,7 +73,6 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationCont
import org.eclipse.debug.ui.DebugUITools; import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.actions.IWatchExpressionFactoryAdapter2; import org.eclipse.debug.ui.actions.IWatchExpressionFactoryAdapter2;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.CellEditor; import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ICellModifier; import org.eclipse.jface.viewers.ICellModifier;
@ -187,7 +189,8 @@ public class RegisterVMNode extends AbstractExpressionVMNode
MessagesForRegisterVM.RegisterVMNode_Name_column__text_format, MessagesForRegisterVM.RegisterVMNode_Name_column__text_format,
new String[] { PROP_NAME }), new String[] { PROP_NAME }),
new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_REGISTER)), new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_REGISTER)),
new LabelFont(JFaceResources.getFontDescriptor(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT).getFontData()[0]) new StaleDataLabelForeground(),
new VariableLabelFont(),
})); }));
// The description column contains a brief description of the register. // The description column contains a brief description of the register.
@ -197,7 +200,8 @@ public class RegisterVMNode extends AbstractExpressionVMNode
new LabelText( new LabelText(
MessagesForRegisterVM.RegisterVMNode_Description_column__text_format, MessagesForRegisterVM.RegisterVMNode_Description_column__text_format,
new String[] { IRegisterVMConstants.PROP_DESCRIPTION }), new String[] { IRegisterVMConstants.PROP_DESCRIPTION }),
new LabelFont(JFaceResources.getFontDescriptor(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT).getFontData()[0]) new StaleDataLabelForeground(),
new VariableLabelFont(),
})); }));
// In the type column add information about register read/write/fload flags. // In the type column add information about register read/write/fload flags.
@ -241,7 +245,8 @@ public class RegisterVMNode extends AbstractExpressionVMNode
} }
} }
}, },
new LabelFont(JFaceResources.getFontDescriptor(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT).getFontData()[0]) new StaleDataLabelForeground(),
new VariableLabelFont(),
})); }));
// Value column shows the value in the active value format. // Value column shows the value in the active value format.
@ -256,7 +261,7 @@ public class RegisterVMNode extends AbstractExpressionVMNode
new LabelColumnInfo(new LabelAttribute[] { new LabelColumnInfo(new LabelAttribute[] {
new FormattedValueLabelText(), new FormattedValueLabelText(),
new ErrorLabelText(), new ErrorLabelText(),
new LabelColor(new RGB(255, 0, 0), null) // TODO: replace with preference error color new LabelForeground(new RGB(255, 0, 0)) // TODO: replace with preference error color
{ {
{ setPropertyNames(new String[] { PROP_NAME }); } { setPropertyNames(new String[] { PROP_NAME }); }
@ -265,8 +270,7 @@ public class RegisterVMNode extends AbstractExpressionVMNode
return !status.isOK(); return !status.isOK();
} }
}, },
new LabelColor( new LabelBackground(
null,
DebugUITools.getPreferenceColor(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND).getRGB()) DebugUITools.getPreferenceColor(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND).getRGB())
{ {
{ {
@ -286,7 +290,8 @@ public class RegisterVMNode extends AbstractExpressionVMNode
return Boolean.TRUE.equals(activeChanged) && !Boolean.TRUE.equals(activeFormatChanged); return Boolean.TRUE.equals(activeChanged) && !Boolean.TRUE.equals(activeFormatChanged);
} }
}, },
new LabelFont(JFaceResources.getFontDescriptor(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT).getFontData()[0]) new StaleDataLabelForeground(),
new VariableLabelFont(),
})); }));
// Expression column is visible only in the expressions view. It shows the expression string that the user // Expression column is visible only in the expressions view. It shows the expression string that the user
@ -298,7 +303,8 @@ public class RegisterVMNode extends AbstractExpressionVMNode
MessagesForRegisterVM.RegisterVMNode_Expression_column__text_format, MessagesForRegisterVM.RegisterVMNode_Expression_column__text_format,
new String[] { PROP_ELEMENT_EXPRESSION }), new String[] { PROP_ELEMENT_EXPRESSION }),
new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_REGISTER)), new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_REGISTER)),
new LabelFont(JFaceResources.getFontDescriptor(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT).getFontData()[0]) new StaleDataLabelForeground(),
new VariableLabelFont(),
})); }));
provider.setColumnInfo( provider.setColumnInfo(
@ -311,9 +317,8 @@ public class RegisterVMNode extends AbstractExpressionVMNode
MessagesForRegisterVM.RegisterVMNode_No_columns__Error__text_format, MessagesForRegisterVM.RegisterVMNode_No_columns__Error__text_format,
new String[] { PROP_NAME }), new String[] { PROP_NAME }),
new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_REGISTER)), new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_REGISTER)),
new LabelColor( new LabelForeground(
DebugUITools.getPreferenceColor(IDebugUIConstants.PREF_CHANGED_DEBUG_ELEMENT_COLOR).getRGB(), DebugUITools.getPreferenceColor(IDebugUIConstants.PREF_CHANGED_DEBUG_ELEMENT_COLOR).getRGB())
null)
{ {
{ {
setPropertyNames(new String[] { setPropertyNames(new String[] {
@ -332,7 +337,8 @@ public class RegisterVMNode extends AbstractExpressionVMNode
return Boolean.TRUE.equals(activeChanged) && !Boolean.TRUE.equals(activeFormatChanged); return Boolean.TRUE.equals(activeChanged) && !Boolean.TRUE.equals(activeFormatChanged);
} }
}, },
new LabelFont(JFaceResources.getFontDescriptor(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT).getFontData()[0]) new StaleDataLabelBackground(),
new VariableLabelFont(),
})); }));
return provider; return provider;

View file

@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright (c) 2008 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.dsf.debug.ui.viewmodel.variable;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelFont;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.resource.JFaceResources;
/**
* @since 2.0
*/
public class VariableLabelFont extends LabelFont {
public VariableLabelFont() {
super(JFaceResources.getFontDescriptor(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT).getFontData()[0]);
}
}

View file

@ -58,13 +58,15 @@ import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.IElementPropertiesProvider; import org.eclipse.cdt.dsf.ui.viewmodel.properties.IElementPropertiesProvider;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.IPropertiesUpdate; import org.eclipse.cdt.dsf.ui.viewmodel.properties.IPropertiesUpdate;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelAttribute; import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelAttribute;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelColor; import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelBackground;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelColumnInfo; import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelColumnInfo;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelFont; import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelForeground;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelImage; import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelImage;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelText; import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelText;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.PropertiesBasedLabelProvider; import org.eclipse.cdt.dsf.ui.viewmodel.properties.PropertiesBasedLabelProvider;
import org.eclipse.cdt.dsf.ui.viewmodel.update.ICachingVMProvider; import org.eclipse.cdt.dsf.ui.viewmodel.update.ICachingVMProvider;
import org.eclipse.cdt.dsf.ui.viewmodel.update.StaleDataLabelBackground;
import org.eclipse.cdt.dsf.ui.viewmodel.update.StaleDataLabelForeground;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
@ -83,7 +85,6 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate;
import org.eclipse.debug.ui.DebugUITools; import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.actions.IWatchExpressionFactoryAdapter2; import org.eclipse.debug.ui.actions.IWatchExpressionFactoryAdapter2;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.CellEditor; import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ICellModifier; import org.eclipse.jface.viewers.ICellModifier;
@ -255,7 +256,8 @@ public class VariableVMNode extends AbstractExpressionVMNode
pointerLabelImage, pointerLabelImage,
aggregateLabelImage, aggregateLabelImage,
simpleLabelImage, simpleLabelImage,
new LabelFont(JFaceResources.getFontDescriptor(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT).getFontData()[0]) new StaleDataLabelForeground(),
new VariableLabelFont(),
})); }));
// Expression column is visible only in the expressions view. It shows the expression string that the user // Expression column is visible only in the expressions view. It shows the expression string that the user
@ -269,7 +271,8 @@ public class VariableVMNode extends AbstractExpressionVMNode
pointerLabelImage, pointerLabelImage,
aggregateLabelImage, aggregateLabelImage,
simpleLabelImage, simpleLabelImage,
new LabelFont(JFaceResources.getFontDescriptor(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT).getFontData()[0]) new StaleDataLabelForeground(),
new VariableLabelFont(),
})); }));
// Type column only contains the type name. // Type column only contains the type name.
@ -280,7 +283,8 @@ public class VariableVMNode extends AbstractExpressionVMNode
MessagesForVariablesVM.VariableVMNode_Type_column__text_format, MessagesForVariablesVM.VariableVMNode_Type_column__text_format,
new String[] { PROP_VARIABLE_TYPE_NAME }), new String[] { PROP_VARIABLE_TYPE_NAME }),
new LabelText( MessagesForVariablesVM.VariableVMNode_Type_column__Error__text_format, new String[] {}), new LabelText( MessagesForVariablesVM.VariableVMNode_Type_column__Error__text_format, new String[] {}),
new LabelFont(JFaceResources.getFontDescriptor(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT).getFontData()[0]) new StaleDataLabelForeground(),
new VariableLabelFont(),
})); }));
// Value column is more complicated: // Value column is more complicated:
@ -319,7 +323,7 @@ public class VariableVMNode extends AbstractExpressionVMNode
}, },
new FormattedValueLabelText(), new FormattedValueLabelText(),
new ErrorLabelText(), new ErrorLabelText(),
new LabelColor(new RGB(255, 0, 0), null) // TODO: replace with preference error color new LabelForeground(new RGB(255, 0, 0)) // TODO: replace with preference error color
{ {
{ setPropertyNames(new String[] { PROP_NAME }); } { setPropertyNames(new String[] { PROP_NAME }); }
@ -329,8 +333,7 @@ public class VariableVMNode extends AbstractExpressionVMNode
} }
}, },
// //
new LabelColor( new LabelBackground(
null,
DebugUITools.getPreferenceColor(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND).getRGB()) DebugUITools.getPreferenceColor(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND).getRGB())
{ {
{ {
@ -355,7 +358,8 @@ public class VariableVMNode extends AbstractExpressionVMNode
( Boolean.TRUE.equals(activeChanged) && !Boolean.TRUE.equals(activeFormatChanged)); ( Boolean.TRUE.equals(activeChanged) && !Boolean.TRUE.equals(activeFormatChanged));
}; };
}, },
new LabelFont(JFaceResources.getFontDescriptor(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT).getFontData()[0]) new StaleDataLabelForeground(),
new VariableLabelFont(),
})); }));
// Address column shows the variable's address. It is highlighted with the change background color when the // Address column shows the variable's address. It is highlighted with the change background color when the
@ -367,8 +371,7 @@ public class VariableVMNode extends AbstractExpressionVMNode
MessagesForVariablesVM.VariableVMNode_Address_column__text_format, MessagesForVariablesVM.VariableVMNode_Address_column__text_format,
new String[] { PROP_VARIABLE_ADDRESS }), new String[] { PROP_VARIABLE_ADDRESS }),
new LabelText(MessagesForVariablesVM.VariableVMNode_Address_column__Error__text_format, new String[] {}), new LabelText(MessagesForVariablesVM.VariableVMNode_Address_column__Error__text_format, new String[] {}),
new LabelColor( new LabelBackground(
null,
DebugUITools.getPreferenceColor(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND).getRGB()) DebugUITools.getPreferenceColor(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND).getRGB())
{ {
{ setPropertyNames(new String[] { PROP_VARIABLE_ADDRESS, PROP_VARIABLE_ADDRESS_CHANGED}); } { setPropertyNames(new String[] { PROP_VARIABLE_ADDRESS, PROP_VARIABLE_ADDRESS_CHANGED}); }
@ -379,7 +382,8 @@ public class VariableVMNode extends AbstractExpressionVMNode
return Boolean.TRUE.equals(changed); return Boolean.TRUE.equals(changed);
}; };
}, },
new LabelFont(JFaceResources.getFontDescriptor(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT).getFontData()[0]), new StaleDataLabelForeground(),
new VariableLabelFont(),
})); }));
// Description column is shown in the expression view, but is not supported for variables. // Description column is shown in the expression view, but is not supported for variables.
@ -387,9 +391,8 @@ public class VariableVMNode extends AbstractExpressionVMNode
IDebugVMConstants.COLUMN_ID__DESCRIPTION, IDebugVMConstants.COLUMN_ID__DESCRIPTION,
new LabelColumnInfo(new LabelAttribute[] { new LabelColumnInfo(new LabelAttribute[] {
new LabelText(MessagesForVariablesVM.VariableVMNode_Description_column__text_format, new String[] {}) { new LabelText(MessagesForVariablesVM.VariableVMNode_Description_column__text_format, new String[] {}),
}, new VariableLabelFont(),
new LabelFont(JFaceResources.getFontDescriptor(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT).getFontData()[0])
})); }));
// Configure the case where there are no columns visible. It basically combines the name and the value columns only. // Configure the case where there are no columns visible. It basically combines the name and the value columns only.
@ -433,7 +436,7 @@ public class VariableVMNode extends AbstractExpressionVMNode
pointerLabelImage, pointerLabelImage,
aggregateLabelImage, aggregateLabelImage,
simpleLabelImage, simpleLabelImage,
new LabelColor(new RGB(255, 0, 0), null) // TODO: replace with preference error color new LabelForeground(new RGB(255, 0, 0)) // TODO: replace with preference error color
{ {
{ setPropertyNames(new String[] { PROP_NAME }); } { setPropertyNames(new String[] { PROP_NAME }); }
@ -442,9 +445,8 @@ public class VariableVMNode extends AbstractExpressionVMNode
return !status.isOK(); return !status.isOK();
} }
}, },
new LabelColor( new LabelForeground(
DebugUITools.getPreferenceColor(IDebugUIConstants.PREF_CHANGED_DEBUG_ELEMENT_COLOR).getRGB(), DebugUITools.getPreferenceColor(IDebugUIConstants.PREF_CHANGED_DEBUG_ELEMENT_COLOR).getRGB())
null)
{ {
{ {
setPropertyNames(new String[] { setPropertyNames(new String[] {
@ -462,7 +464,8 @@ public class VariableVMNode extends AbstractExpressionVMNode
return Boolean.TRUE.equals(stringChanged) || Boolean.TRUE.equals(activeChanged); return Boolean.TRUE.equals(stringChanged) || Boolean.TRUE.equals(activeChanged);
}; };
}, },
new LabelFont(JFaceResources.getFontDescriptor(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT).getFontData()[0]) new StaleDataLabelBackground(),
new VariableLabelFont(),
})); }));
return provider; return provider;
@ -573,7 +576,9 @@ public class VariableVMNode extends AbstractExpressionVMNode
protected void handleCompleted() { protected void handleCompleted() {
if (isSuccess()) { if (isSuccess()) {
fillAddressDataProperties(update, getData()); fillAddressDataProperties(update, getData());
} else { } else if (getStatus().getCode() != IDsfStatusConstants.NOT_SUPPORTED &&
getStatus().getCode() != IDsfStatusConstants.INVALID_STATE)
{
update.setStatus(getStatus()); update.setStatus(getStatus());
} }
countingRm.done(); countingRm.done();

View file

@ -31,10 +31,10 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate;
*/ */
abstract public class AbstractVMNode implements IVMNode { abstract public class AbstractVMNode implements IVMNode {
private final AbstractVMProvider fProvider; private final IVMProvider fProvider;
private boolean fDisposed = false; private boolean fDisposed = false;
public AbstractVMNode(AbstractVMProvider provider) { public AbstractVMNode(IVMProvider provider) {
fProvider = provider; fProvider = provider;
} }

View file

@ -0,0 +1,52 @@
/*******************************************************************************
* Copyright (c) 2007 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.dsf.ui.viewmodel.properties;
import java.util.Map;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.debug.internal.ui.viewers.model.provisional.ILabelUpdate;
import org.eclipse.swt.graphics.RGB;
/**
* The color attribute of a label. It determines what background color to use
* for the given label.
*
* @see LabelAttribute
* @see LabelColumnInfo
* @see PropertiesBasedLabelProvider
*
* @since 2.0
*/
public class LabelBackground extends LabelAttribute {
private RGB fBackground;
public LabelBackground(RGB background) {
fBackground = background;
}
public RGB getBackground() {
return fBackground;
}
public void setBackground(RGB background) {
fBackground = background;
}
@Override
public void updateAttribute(ILabelUpdate update, int columnIndex, IStatus status, Map<String, Object> properties) {
RGB background = getBackground();
if (background != null) {
update.setBackground(background, columnIndex);
}
}
}

View file

@ -98,7 +98,8 @@ public class LabelColumnInfo {
boolean textSet = false; boolean textSet = false;
boolean imageSet = false; boolean imageSet = false;
boolean fontSet = false; boolean fontSet = false;
boolean colorSet = false; boolean foregroundSet = false;
boolean backgroundSet = false;
LabelAttribute[] labelAttributes = getLabelAttributes(); LabelAttribute[] labelAttributes = getLabelAttributes();
for (LabelAttribute info : labelAttributes) { for (LabelAttribute info : labelAttributes) {
@ -106,14 +107,16 @@ public class LabelColumnInfo {
if (!(info instanceof LabelText && textSet) && if (!(info instanceof LabelText && textSet) &&
!(info instanceof LabelImage && imageSet) && !(info instanceof LabelImage && imageSet) &&
!(info instanceof LabelFont && fontSet) && !(info instanceof LabelFont && fontSet) &&
!(info instanceof LabelColor && colorSet) && !(info instanceof LabelForeground && foregroundSet) &&
!(info instanceof LabelBackground && backgroundSet) &&
info.isEnabled(status, properties)) info.isEnabled(status, properties))
{ {
info.updateAttribute(update, columnIndex, status, properties); info.updateAttribute(update, columnIndex, status, properties);
textSet = textSet || info instanceof LabelText; textSet = textSet || info instanceof LabelText;
imageSet = imageSet || info instanceof LabelImage; imageSet = imageSet || info instanceof LabelImage;
fontSet = fontSet || info instanceof LabelFont; fontSet = fontSet || info instanceof LabelFont;
colorSet = colorSet || info instanceof LabelColor; foregroundSet = foregroundSet || info instanceof LabelForeground;
backgroundSet = backgroundSet || info instanceof LabelBackground;
} }
} }
} }

View file

@ -17,55 +17,36 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.ILabelUpdate;
import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.graphics.RGB;
/** /**
* The color attribute of a label. It determines what foreground and * The color attribute of a label. It determines what foreground color to use
* background color to use for the given label. * for the given label.
* *
* @see LabelAttribute * @see LabelAttribute
* @see LabelColumnInfo * @see LabelColumnInfo
* @see PropertiesBasedLabelProvider * @see PropertiesBasedLabelProvider
* *
* @since 1.0 * @since 2.0
*/ */
public class LabelColor extends LabelAttribute { public class LabelForeground extends LabelAttribute {
private RGB fForeground; private RGB fForeground;
private RGB fBackground;
public LabelColor() { public LabelForeground(RGB foreground) {
this(null, null);
}
public LabelColor(RGB foreground, RGB background) {
fForeground = foreground; fForeground = foreground;
fBackground = background;
} }
public RGB getForeground() { public RGB getForeground() {
return fForeground; return fForeground;
} }
public RGB getBackground() {
return fBackground;
}
public void setForeground(RGB foreground) { public void setForeground(RGB foreground) {
fForeground = foreground; fForeground = foreground;
} }
public void setBackground(RGB background) {
fBackground = background;
}
@Override @Override
public void updateAttribute(ILabelUpdate update, int columnIndex, IStatus status, Map<String, Object> properties) { public void updateAttribute(ILabelUpdate update, int columnIndex, IStatus status, Map<String, Object> properties) {
RGB foreground = getForeground(); RGB foreground = getForeground();
if (foreground != null) { if (foreground != null) {
update.setForeground(foreground, columnIndex); update.setForeground(foreground, columnIndex);
} }
RGB background = getBackground();
if (background != null) {
update.setBackground(background, columnIndex);
}
} }
} }

View file

@ -426,7 +426,9 @@ public class AbstractCachingVMProvider extends AbstractVMProvider
// Find or create the cache entry for the element of this update. // Find or create the cache entry for the element of this update.
ElementDataKey key = makeEntryKey(node, update); ElementDataKey key = makeEntryKey(node, update);
final ElementDataEntry entry = getElementDataEntry(key); final ElementDataEntry entry = getElementDataEntry(key);
updateRootElementMarker(key.fRootElement, node, update);
// Check if the cache entry has this request result cached.
if (entry.fHasChildren != null) { if (entry.fHasChildren != null) {
// Cache Hit! Just return the value. // Cache Hit! Just return the value.
if (DEBUG_CACHE && (DEBUG_PRESENTATION_ID == null || getPresentationContext().getId().equals(DEBUG_PRESENTATION_ID))) { if (DEBUG_CACHE && (DEBUG_PRESENTATION_ID == null || getPresentationContext().getId().equals(DEBUG_PRESENTATION_ID))) {
@ -473,7 +475,9 @@ public class AbstractCachingVMProvider extends AbstractVMProvider
// Find or create the cache entry for the element of this update. // Find or create the cache entry for the element of this update.
ElementDataKey key = makeEntryKey(node, update); ElementDataKey key = makeEntryKey(node, update);
final ElementDataEntry entry = getElementDataEntry(key); final ElementDataEntry entry = getElementDataEntry(key);
updateRootElementMarker(key.fRootElement, node, update);
// Check if the cache entry has this request result cached.
if(entry.fChildrenCount != null) { if(entry.fChildrenCount != null) {
// Cache Hit! Just return the value. // Cache Hit! Just return the value.
if (DEBUG_CACHE && (DEBUG_PRESENTATION_ID == null || getPresentationContext().getId().equals(DEBUG_PRESENTATION_ID))) { if (DEBUG_CACHE && (DEBUG_PRESENTATION_ID == null || getPresentationContext().getId().equals(DEBUG_PRESENTATION_ID))) {
@ -489,7 +493,7 @@ public class AbstractCachingVMProvider extends AbstractVMProvider
new ViewerDataRequestMonitor<Integer>(getExecutor(), update) { new ViewerDataRequestMonitor<Integer>(getExecutor(), update) {
@Override @Override
protected void handleCompleted() { protected void handleCompleted() {
// Update completed. Write value to cache only if update successed // Update completed. Write value to cache only if update succeeded
// and the cache entry wasn't flushed in the mean time. // and the cache entry wasn't flushed in the mean time.
if(isSuccess()) { if(isSuccess()) {
if (flushCounter == entry.fFlushCounter) { if (flushCounter == entry.fFlushCounter) {
@ -514,6 +518,7 @@ public class AbstractCachingVMProvider extends AbstractVMProvider
// Find or create the cache entry for the element of this update. // Find or create the cache entry for the element of this update.
ElementDataKey key = makeEntryKey(node, update); ElementDataKey key = makeEntryKey(node, update);
final ElementDataEntry entry = getElementDataEntry(key); final ElementDataEntry entry = getElementDataEntry(key);
updateRootElementMarker(key.fRootElement, node, update);
final int flushCounter = entry.fFlushCounter; final int flushCounter = entry.fFlushCounter;
if (entry.fChildren == null || (update.getOffset() < 0 && !entry.fAllChildrenKnown)) { if (entry.fChildren == null || (update.getOffset() < 0 && !entry.fAllChildrenKnown)) {
@ -732,6 +737,9 @@ public class AbstractCachingVMProvider extends AbstractVMProvider
elementDataEntry.fDirty = false; elementDataEntry.fDirty = false;
} else if ((updateFlags & IVMUpdatePolicy.DIRTY) != 0) { } else if ((updateFlags & IVMUpdatePolicy.DIRTY) != 0) {
elementDataEntry.fDirty = true; elementDataEntry.fDirty = true;
if (elementDataEntry.fProperties != null) {
elementDataEntry.fProperties.put(PROP_CACHE_ENTRY_DIRTY, Boolean.TRUE);
}
} }
} }
entry = entry.fPrevious; entry = entry.fPrevious;
@ -853,6 +861,7 @@ public class AbstractCachingVMProvider extends AbstractVMProvider
// See bug 241024. // See bug 241024.
proxy.init(context); proxy.init(context);
} }
return proxy; return proxy;
} }
@ -916,14 +925,21 @@ public class AbstractCachingVMProvider extends AbstractVMProvider
entry.reinsert(fCacheListHead); entry.reinsert(fCacheListHead);
} }
return entry;
}
private void updateRootElementMarker(Object rootElement, IVMNode node, IViewerUpdate update) {
boolean created = false;
// Update the root element marker: // Update the root element marker:
// - ensure that the root marker is root markers' map, // - ensure that the root marker is root markers' map,
// - ensure that the root marker is in the cache map, // - ensure that the root marker is in the cache map,
// - and ensure that it's at the end of the cache. // - and ensure that it's at the end of the cache.
RootElementMarkerKey rootMarker = fRootMarkers.get(key.fRootElement); RootElementMarkerKey rootMarker = fRootMarkers.get(rootElement);
if (rootMarker == null) { if (rootMarker == null) {
rootMarker = new RootElementMarkerKey(key.fRootElement); rootMarker = new RootElementMarkerKey(rootElement);
fRootMarkers.put(key.fRootElement, rootMarker); fRootMarkers.put(rootElement, rootMarker);
created = true;
} }
Entry rootMarkerEntry = fCacheData.get(rootMarker); Entry rootMarkerEntry = fCacheData.get(rootMarker);
if (rootMarkerEntry == null) { if (rootMarkerEntry == null) {
@ -933,7 +949,32 @@ public class AbstractCachingVMProvider extends AbstractVMProvider
rootMarkerEntry.reinsert(fCacheListHead); rootMarkerEntry.reinsert(fCacheListHead);
} }
return entry; if (created) {
ElementDataKey rootElementDataKey =
new ElementDataKey(rootElement, node, update.getViewerInput(), update.getElementPath());
ElementDataEntry entry = getElementDataEntry(rootElementDataKey);
Object[] rootElementChildren = getActiveUpdatePolicy().getInitialRootElementChildren(rootElement);
if (rootElementChildren != null) {
entry.fHasChildren = rootElementChildren.length > 0;
entry.fChildrenCount = rootElementChildren.length;
entry.fChildren = new HashMap<Integer, Object>(entry.fChildrenCount * 4/3);
for (int i = 0; i < rootElementChildren.length; i++) {
entry.fChildren.put(i, rootElementChildren[i]);
}
entry.fAllChildrenKnown = true;
entry.fDirty = true;
}
Map<String, Object> rootElementProperties = getActiveUpdatePolicy().getInitialRootElementProperties(rootElement);
if (rootElementProperties != null) {
entry.fProperties = new HashMap<String, Object>((rootElementProperties.size() + 1) * 4/3);
entry.fProperties.putAll(rootElementProperties);
entry.fProperties.put(PROP_CACHE_ENTRY_DIRTY, true);
entry.fDirty = true;
}
}
} }
/** /**
@ -1025,17 +1066,27 @@ public class AbstractCachingVMProvider extends AbstractVMProvider
// Find or create the cache entry for the element of this update. // Find or create the cache entry for the element of this update.
ElementDataKey key = makeEntryKey(node, update); ElementDataKey key = makeEntryKey(node, update);
final ElementDataEntry entry = getElementDataEntry(key); final ElementDataEntry entry = getElementDataEntry(key);
updateRootElementMarker(key.fRootElement, node, update);
// The request can be retrieved from cache if all the properties that were requested in the update are // The request can be retrieved from cache if all the properties that were requested in the update are
// found in the map. // found in the map.
if (entry.fProperties != null && entry.fProperties.keySet().containsAll(update.getProperties())) { if (entry.fProperties != null && entry.fProperties.keySet().containsAll(update.getProperties())) {
// Cache Hit! Just return the value. // Cache Hit! Just return the value.
if (DEBUG_CACHE && (DEBUG_PRESENTATION_ID == null || getPresentationContext().getId().equals(DEBUG_PRESENTATION_ID))) { if (DEBUG_CACHE && (DEBUG_PRESENTATION_ID == null || getPresentationContext().getId().equals(DEBUG_PRESENTATION_ID))) {
DsfUIPlugin.debug("cacheHitHasChildren(node = " + node + ", update = " + update + ", " + entry.fHasChildren + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ DsfUIPlugin.debug("cacheHitProperties(node = " + node + ", update = " + update + ", " + entry.fProperties + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
} }
update.setAllProperties(entry.fProperties); update.setAllProperties(entry.fProperties);
update.setStatus((IStatus)entry.fProperties.get(PROP_UPDATE_STATUS)); update.setStatus((IStatus)entry.fProperties.get(PROP_UPDATE_STATUS));
update.done(); update.done();
} else if (entry.fProperties != null && entry.fDirty) {
// Cache miss, BUT the entry is dirty already. Rather then fetch new data from model, return
// incomplete data to user. User can refresh the view to get the complete data set.
if (DEBUG_CACHE && (DEBUG_PRESENTATION_ID == null || getPresentationContext().getId().equals(DEBUG_PRESENTATION_ID))) {
DsfUIPlugin.debug("cacheHitPropertiesPartialStaleData(node = " + node + ", update = " + update + ", " + entry.fProperties + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
update.setAllProperties(entry.fProperties);
update.setStatus(DsfUIPlugin.newErrorStatus(IDsfStatusConstants.INVALID_STATE, "Cache contains partial stale data for this request.", null)); //$NON-NLS-1$
update.done();
} else { } else {
// Cache miss! Save the flush counter of the entry and create a proxy update. // Cache miss! Save the flush counter of the entry and create a proxy update.
final int flushCounter = entry.fFlushCounter; final int flushCounter = entry.fFlushCounter;

View file

@ -10,6 +10,8 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.ui.viewmodel.update; package org.eclipse.cdt.dsf.ui.viewmodel.update;
import java.util.Map;
import org.eclipse.jface.viewers.TreePath; import org.eclipse.jface.viewers.TreePath;
/** /**
@ -49,4 +51,12 @@ public class AutomaticUpdatePolicy implements IVMUpdatePolicy {
public IElementUpdateTester getElementUpdateTester(Object event) { public IElementUpdateTester getElementUpdateTester(Object event) {
return fgUpdateTester; return fgUpdateTester;
} }
public Object[] getInitialRootElementChildren(Object rootElement) {
return null;
}
public Map<String, Object> getInitialRootElementProperties(Object rootElement) {
return null;
}
} }

View file

@ -10,6 +10,9 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.ui.viewmodel.update; package org.eclipse.cdt.dsf.ui.viewmodel.update;
import java.util.Map;
/** /**
* Interface for an update policy. The main function of an update policy is * Interface for an update policy. The main function of an update policy is
@ -52,4 +55,38 @@ public interface IVMUpdatePolicy {
* Creates an element tester for the given event. * Creates an element tester for the given event.
*/ */
public IElementUpdateTester getElementUpdateTester(Object event); public IElementUpdateTester getElementUpdateTester(Object event);
/**
* Returns the array of elements that should be used to initially populate
* the cache, or <code>null</code> if this update policy does not need to
* pre-populate the cache. These elements will be shown as children
* of the root element in the view.
* <p/>
* This method allows an update policy to prevent the UI from reading the
* model when the UI first appears and the cache has not been populated yet.
*
* @param rootElement The rootElement for which the cache is being
* pre-populated.
*
* @since 2.0
*/
public Object[] getInitialRootElementChildren(Object rootElement);
/**
* Returns the properties that should be used to initially populate
* the cache, or <code>null</code> if the cache should not be pre-populated
* for this update policy. These properties may be used by the
* view model to generate the label for the root element.
* <p/>
* This method allows an update policy to prevent the UI from reading the
* model when the UI first appears and the cache has not been populated
* yet. Note however that if the root element is the view input it is
* not shown in the view.
*
* @param rootElement The rootElement for which the cache is being
* pre-populated.
*
* @since 2.0
*/
public Map<String, Object> getInitialRootElementProperties(Object rootElement);
} }

View file

@ -10,9 +10,20 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.ui.viewmodel.update; package org.eclipse.cdt.dsf.ui.viewmodel.update;
import java.util.Collections;
import java.util.Map;
import java.util.Set; import java.util.Set;
import org.eclipse.cdt.dsf.debug.ui.IDsfDebugUIConstants;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenCountUpdate;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IHasChildrenUpdate;
import org.eclipse.debug.internal.ui.viewers.model.provisional.ILabelUpdate;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.viewers.TreePath; import org.eclipse.jface.viewers.TreePath;
import org.eclipse.swt.graphics.RGB;
/** /**
@ -27,6 +38,47 @@ public class ManualUpdatePolicy implements IVMUpdatePolicy {
public static Object REFRESH_EVENT = new Object(); public static Object REFRESH_EVENT = new Object();
private static class BlankDataElement implements IElementContentProvider, IElementLabelProvider {
public void update(IHasChildrenUpdate[] updates) {
for (IHasChildrenUpdate update : updates) {
update.setHasChilren(false);
update.done();
}
}
public void update(IChildrenCountUpdate[] updates) {
for (IChildrenCountUpdate update : updates) {
update.setChildCount(0);
update.done();
}
}
public void update(IChildrenUpdate[] updates) {
for (IChildrenUpdate update : updates) {
update.done();
}
}
public void update(ILabelUpdate[] updates) {
RGB staleDataForeground = JFaceResources.getColorRegistry().getRGB(
IDsfDebugUIConstants.PREF_COLOR_STALE_DATA_FOREGROUND);
RGB staleDataBackground = JFaceResources.getColorRegistry().getRGB(
IDsfDebugUIConstants.PREF_COLOR_STALE_DATA_BACKGROUND);
for (ILabelUpdate update : updates) {
update.setLabel(ViewModelUpdateMessages.ManualUpdatePolicy_InitialDataElement__label, 0);
// Set the stale data color to the label. Use foreground color if column modes are enabled, and
// background color when there are no columns.
if (update.getColumnIds() != null) {
update.setForeground(staleDataForeground, 0);
} else {
update.setBackground(staleDataBackground, 0);
}
update.done();
}
}
}
private static class UserEditEventUpdateTester implements IElementUpdateTester { private static class UserEditEventUpdateTester implements IElementUpdateTester {
private final Set<Object> fElements; private final Set<Object> fElements;
@ -105,4 +157,15 @@ public class ManualUpdatePolicy implements IVMUpdatePolicy {
return fgUpdateTester; return fgUpdateTester;
} }
public Object[] getInitialRootElementChildren(Object rootElement) {
// Return an dummy element to show in the view. The user will
// need to refresh the view to retrieve this data from the model.
return new Object[] { new BlankDataElement() };
}
public Map<String, Object> getInitialRootElementProperties(Object rootElement) {
// Return an empty set of properties for the root element. The user will
// need to refresh the view to retrieve this data from the model.
return Collections.emptyMap();
}
} }

View file

@ -0,0 +1,42 @@
/*******************************************************************************
* Copyright (c) 2008 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.dsf.ui.viewmodel.update;
import org.eclipse.cdt.dsf.debug.ui.IDsfDebugUIConstants;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelBackground;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.swt.graphics.RGB;
/**
* Stale data backgroun color label attribute to use with the
* PropertyBasedLabelProvider. The background color should only be
* used when the view is in no-columns mode.
*
* @since 2.0
*/
public class StaleDataLabelBackground extends LabelBackground {
public StaleDataLabelBackground() {
super(null);
}
@Override
public RGB getBackground() {
return JFaceResources.getColorRegistry().getRGB(
IDsfDebugUIConstants.PREF_COLOR_STALE_DATA_BACKGROUND);
}
@Override
public boolean isEnabled(IStatus status, java.util.Map<String,Object> properties) {
return Boolean.TRUE.equals(properties.get(ICachingVMProvider.PROP_CACHE_ENTRY_DIRTY));
}
}

View file

@ -0,0 +1,42 @@
/*******************************************************************************
* Copyright (c) 2008 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.dsf.ui.viewmodel.update;
import org.eclipse.cdt.dsf.debug.ui.IDsfDebugUIConstants;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelForeground;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.swt.graphics.RGB;
/**
* Stale data foreground color label attribute to use with the
* PropertyBasedLabelProvider. The foreground color should only be
* used when the view is in column mode.
*
* @since 2.0
*/
public class StaleDataLabelForeground extends LabelForeground {
public StaleDataLabelForeground() {
super(null);
}
@Override
public RGB getForeground() {
return JFaceResources.getColorRegistry().getRGB(
IDsfDebugUIConstants.PREF_COLOR_STALE_DATA_FOREGROUND);
}
@Override
public boolean isEnabled(IStatus status, java.util.Map<String,Object> properties) {
return Boolean.TRUE.equals(properties.get(ICachingVMProvider.PROP_CACHE_ENTRY_DIRTY));
}
}

View file

@ -17,6 +17,8 @@ public class ViewModelUpdateMessages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.cdt.dsf.ui.viewmodel.update.ViewModelUpdateMessages";//$NON-NLS-1$ private static final String BUNDLE_NAME = "org.eclipse.cdt.dsf.ui.viewmodel.update.ViewModelUpdateMessages";//$NON-NLS-1$
public static String AutomaticUpdatePolicy_name; public static String AutomaticUpdatePolicy_name;
public static String ManualUpdatePolicy_InitialDataElement__label;
public static String ManualUpdatePolicy_name; public static String ManualUpdatePolicy_name;
/** /**
* @since 1.1 * @since 1.1

View file

@ -9,6 +9,7 @@
# Wind River Systems - initial API and implementation # Wind River Systems - initial API and implementation
############################################################################### ###############################################################################
AutomaticUpdatePolicy_name=Automatic AutomaticUpdatePolicy_name=Automatic
ManualUpdatePolicy_InitialDataElement__label=Refresh to see view data
ManualUpdatePolicy_name=Manual ManualUpdatePolicy_name=Manual
AllUpdateScope_name=All Elements AllUpdateScope_name=All Elements
VisibleUpdateScope_name=Visible Elements VisibleUpdateScope_name=Visible Elements