diff options
author | Anton Leherbauer | 2010-04-23 06:24:18 +0000 |
---|---|---|
committer | Anton Leherbauer | 2010-04-23 06:24:18 +0000 |
commit | 1e118a7e58d867c3cb3a7a625ce89e3c24e80b74 (patch) | |
tree | c908879d5365084f775c83c7c688e96d1a8db663 /dsf | |
parent | caa6d148db32410c163ca4204483bb618c6c81e8 (diff) | |
download | org.eclipse.cdt-1e118a7e58d867c3cb3a7a625ce89e3c24e80b74.tar.gz org.eclipse.cdt-1e118a7e58d867c3cb3a7a625ce89e3c24e80b74.tar.xz org.eclipse.cdt-1e118a7e58d867c3cb3a7a625ce89e3c24e80b74.zip |
[309001] Too many debug hovers in Preferences
Diffstat (limited to 'dsf')
3 files changed, 68 insertions, 13 deletions
diff --git a/dsf/org.eclipse.cdt.dsf.ui/plugin.properties b/dsf/org.eclipse.cdt.dsf.ui/plugin.properties index 19146e9de1f..1d9d2332ef1 100644 --- a/dsf/org.eclipse.cdt.dsf.ui/plugin.properties +++ b/dsf/org.eclipse.cdt.dsf.ui/plugin.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2006, 2009 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 @@ -58,6 +58,4 @@ StaleData.foreground.description=This color is used to indicate that a given ele 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. -editorTextHover.label=Debugger -editorTextHover.description=Shows formatted value in debugger hover -debugUpdateModes.label = Debug Update Modes
\ No newline at end of file +debugUpdateModes.label = Debug Update Modes diff --git a/dsf/org.eclipse.cdt.dsf.ui/plugin.xml b/dsf/org.eclipse.cdt.dsf.ui/plugin.xml index 11509761795..c97180f093a 100644 --- a/dsf/org.eclipse.cdt.dsf.ui/plugin.xml +++ b/dsf/org.eclipse.cdt.dsf.ui/plugin.xml @@ -672,15 +672,6 @@ </colorDefinition> </extension> <extension - point="org.eclipse.cdt.ui.textHovers"> - <hover - label="%editorTextHover.label" - description="%editorTextHover.description" - class="org.eclipse.cdt.dsf.debug.ui.DsfDebugTextHover" - id="org.eclipse.cdt.dsf.debug.ui.DsfDebugTextHover"> - </hover> - </extension> - <extension point="org.eclipse.ui.activities"> <activity id="org.eclipse.cdt.dsf.ui.activity.updateModes" @@ -749,4 +740,16 @@ </toggleTargetFactory> </extension> + <!-- Adpater factory for common DSF debug text hover support. + This can be overridden by inidividual session adapters. + --> + <extension + point="org.eclipse.core.runtime.adapters"> + <factory + adaptableType="org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext" + class="org.eclipse.cdt.dsf.debug.internal.ui.DebugTextHoverAdapterFactory"> + <adapter type="org.eclipse.cdt.ui.text.c.hover.ICEditorTextHover"/> + </factory> + </extension> + </plugin> diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/DebugTextHoverAdapterFactory.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/DebugTextHoverAdapterFactory.java new file mode 100644 index 00000000000..8458c7d604a --- /dev/null +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/DebugTextHoverAdapterFactory.java @@ -0,0 +1,54 @@ +/******************************************************************************* + * Copyright (c) 2010 Wind River Systems, Inc. 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.datamodel.DMContexts; +import org.eclipse.cdt.dsf.datamodel.IDMContext; +import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext; +import org.eclipse.cdt.dsf.debug.ui.DsfDebugTextHover; +import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext; +import org.eclipse.cdt.ui.text.c.hover.ICEditorTextHover; +import org.eclipse.core.runtime.IAdapterFactory; + +/** + * Adapter factory adapting an {@link IDMVMContext} to an {@link ICEditorTextHover}. + * + * @since 2.1 + */ +public class DebugTextHoverAdapterFactory implements IAdapterFactory { + + private static final Class<?>[] TYPES = { ICEditorTextHover.class }; + private static final Object fDebugTextHover= new DsfDebugTextHover(); + + @SuppressWarnings("rawtypes") + public Object getAdapter(Object adaptableObject, Class adapterType) { + if (adaptableObject instanceof IDMVMContext) { + IDMContext dmc = ((IDMVMContext) adaptableObject).getDMContext(); + // try session specific hover + Object sessionHover = dmc.getAdapter(adapterType); + if (sessionHover != null) { + return sessionHover; + } + // use default + IFrameDMContext frameDmc = DMContexts.getAncestorOfType(dmc, IFrameDMContext.class); + if (frameDmc != null) { + return fDebugTextHover; + } + } + return null; + } + + @SuppressWarnings("rawtypes") + public Class[] getAdapterList() { + return TYPES; + } + +} |