[255026] Use inspector debug hover in DSF-GDB, based on a preference

This commit is contained in:
Marc Khouzam 2010-02-21 15:42:02 +00:00
parent 9792eb18f1
commit bece9d323f
8 changed files with 92 additions and 46 deletions

View file

@ -72,6 +72,7 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentati
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelSelectionPolicyFactory;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerInputProvider;
import org.eclipse.debug.ui.contexts.ISuspendTrigger;
import org.eclipse.debug.ui.sourcelookup.ISourceDisplay;
@ -123,7 +124,8 @@ public class GdbAdapterFactory
session.registerModelAdapter(SteppingController.class, fSteppingController);
fViewModelAdapter = new GdbViewModelAdapter(session, fSteppingController);
session.registerModelAdapter(IViewerInputProvider.class, fViewModelAdapter);
if (launch.getSourceLocator() instanceof ISourceLookupDirector) {
fSourceDisplayAdapter = new DsfSourceDisplayAdapter(session, (ISourceLookupDirector)launch.getSourceLocator(), fSteppingController);
} else {

View file

@ -12,8 +12,10 @@
package org.eclipse.cdt.dsf.gdb.internal.ui;
import org.eclipse.cdt.dsf.debug.ui.AbstractDsfDebugTextHover;
import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants;
import org.eclipse.cdt.dsf.gdb.launching.GdbLaunchDelegate;
import org.eclipse.cdt.dsf.mi.service.MIExpressions;
import org.eclipse.core.runtime.Platform;
/**
* Debug editor text hover for GDB.
@ -31,4 +33,14 @@ public class GdbDebugTextHover extends AbstractDsfDebugTextHover {
protected String getHoverFormat() {
return MIExpressions.DETAILS_FORMAT;
}
@Override
protected boolean useExpressionExplorer() {
if (Platform.getPreferencesService().getBoolean(GdbUIPlugin.PLUGIN_ID,
IGdbDebugPreferenceConstants.PREF_USE_INSPECTOR_HOVER,
true, null)) {
return true;
}
return false;
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2009 Ericsson and others.
* Copyright (c) 2009, 2010 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -84,6 +84,22 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements
// need to set layout again
group.setLayout(groupLayout);
group= new Group(parent, SWT.NONE);
group.setText(MessagesForPreferences.GdbDebugPreferencePage_hover_label);
groupLayout= new GridLayout(3, false);
group.setLayout(groupLayout);
group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
boolField= new BooleanFieldEditor(
IGdbDebugPreferenceConstants.PREF_USE_INSPECTOR_HOVER,
MessagesForPreferences.GdbDebugPreferencePage_useInspectorHover_label,
group);
boolField.fillIntoGrid(group, 3);
addField(boolField);
// need to set layout again
group.setLayout(groupLayout);
}
@Override

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2009 Ericsson and others.
* Copyright (c) 2009, 2010 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -24,5 +24,6 @@ public class GdbPreferenceInitializer extends AbstractPreferenceInitializer {
IPreferenceStore store = GdbUIPlugin.getDefault().getPreferenceStore();
store.setDefault(IGdbDebugPreferenceConstants.PREF_TRACES_ENABLE, true);
store.setDefault(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, true);
store.setDefault(IGdbDebugPreferenceConstants.PREF_USE_INSPECTOR_HOVER, true);
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2009 Ericsson and others.
* Copyright (c) 2009, 2010 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -23,6 +23,8 @@ class MessagesForPreferences extends NLS {
public static String GdbDebugPreferencePage_enableTraces_label;
public static String GdbDebugPreferencePage_termination_label;
public static String GdbDebugPreferencePage_autoTerminateGdb_label;
public static String GdbDebugPreferencePage_hover_label;
public static String GdbDebugPreferencePage_useInspectorHover_label;
static {
// initialize resource bundle

View file

@ -1,5 +1,5 @@
###############################################################################
# Copyright (c) 2009 Ericsson and others.
# Copyright (c) 2009, 2010 Ericsson and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@ -16,3 +16,6 @@ GdbDebugPreferencePage_enableTraces_label=Enable GDB traces
GdbDebugPreferencePage_termination_label=Termination
GdbDebugPreferencePage_autoTerminateGdb_label=Terminate GDB when last process exits
GdbDebugPreferencePage_hover_label=Debug Text Hover
GdbDebugPreferencePage_useInspectorHover_label=Use Inspector Debug Hover

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2008 Wind River Systems and others.
* Copyright (c) 2006, 2010 Wind River Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -11,8 +11,10 @@
package org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel;
import org.eclipse.cdt.dsf.concurrent.ThreadSafe;
import org.eclipse.cdt.dsf.debug.ui.IDsfDebugUIConstants;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.AbstractDebugVMAdapter;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.SteppingController;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.expression.ExpressionVMProvider;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.modules.ModulesVMProvider;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.register.RegisterVMProvider;
import org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.breakpoints.GdbBreakpointVMProvider;
@ -50,6 +52,8 @@ public class GdbViewModelAdapter extends AbstractDebugVMAdapter
return new RegisterVMProvider(this, context, getSession());
} else if (IDebugUIConstants.ID_EXPRESSION_VIEW.equals(context.getId()) ) {
return new GdbExpressionVMProvider(this, context, getSession());
} else if (IDsfDebugUIConstants.ID_EXPRESSION_HOVER.equals(context.getId()) ) {
return new ExpressionVMProvider(this, context, getSession());
} else if (IDebugUIConstants.ID_MODULE_VIEW.equals(context.getId()) ) {
return new ModulesVMProvider(this, context, getSession());
} else if (IDebugUIConstants.ID_BREAKPOINT_VIEW.equals(context.getId()) ) {

View file

@ -1,40 +1,46 @@
/*******************************************************************************
* Copyright (c) 2009 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Ericsson - initial implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb;
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
/**
* @noimplement This interface is not intended to be implemented by clients.
* @since 2.0
*/
public interface IGdbDebugPreferenceConstants {
/**
* Boolean preference whether to enable GDB traces. Default is <code>true</code>.
*/
public static final String PREF_TRACES_ENABLE = "tracesEnable"; //$NON-NLS-1$
/**
* Boolean preference whether to automatically terminate GDB when the inferior exists. Default is <code>true</code>.
*/
public static final String PREF_AUTO_TERMINATE_GDB = "autoTerminateGdb"; //$NON-NLS-1$
/**
* Help prefixes.
*/
public static final String PREFIX = GdbPlugin.PLUGIN_ID + "."; //$NON-NLS-1$
public static final String PREFERENCE_PAGE= PREFIX + "preference_page_context"; //$NON-NLS-1$
}
/*******************************************************************************
* Copyright (c) 2009, 2010 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Ericsson - initial implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb;
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
/**
* @noimplement This interface is not intended to be implemented by clients.
* @since 2.0
*/
public interface IGdbDebugPreferenceConstants {
/**
* Boolean preference whether to enable GDB traces. Default is <code>true</code>.
*/
public static final String PREF_TRACES_ENABLE = "tracesEnable"; //$NON-NLS-1$
/**
* Boolean preference whether to automatically terminate GDB when the inferior exists. Default is <code>true</code>.
*/
public static final String PREF_AUTO_TERMINATE_GDB = "autoTerminateGdb"; //$NON-NLS-1$
/**
* Boolean preference whether to use the advanced Inspect debug text hover. Default is <code>true</code>.
* @since 3.0
*/
public static final String PREF_USE_INSPECTOR_HOVER = "useInspectorHover"; //$NON-NLS-1$
/**
* Help prefixes.
*/
public static final String PREFIX = GdbPlugin.PLUGIN_ID + "."; //$NON-NLS-1$
public static final String PREFERENCE_PAGE= PREFIX + "preference_page_context"; //$NON-NLS-1$
}