c7f2547
--- ./results/plugins/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/DefinedSymbolHover.java.fix	2006-09-11 15:53:00.000000000 -0400
c7f2547
+++ ./results/plugins/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/DefinedSymbolHover.java	2006-09-11 15:52:51.000000000 -0400
c7f2547
@@ -0,0 +1,67 @@
c7f2547
+package org.eclipse.cdt.internal.ui.text.c.hover;
c7f2547
+
c7f2547
+import java.util.Map;
c7f2547
+
c7f2547
+import org.eclipse.cdt.core.CCorePlugin;
c7f2547
+import org.eclipse.cdt.core.model.IWorkingCopy;
c7f2547
+import org.eclipse.cdt.core.parser.IScannerInfo;
c7f2547
+import org.eclipse.cdt.core.parser.IScannerInfoProvider;
c7f2547
+import org.eclipse.cdt.ui.CUIPlugin;
c7f2547
+import org.eclipse.cdt.ui.IWorkingCopyManager;
c7f2547
+import org.eclipse.core.resources.IResource;
c7f2547
+import org.eclipse.jface.text.BadLocationException;
c7f2547
+import org.eclipse.jface.text.IRegion;
c7f2547
+import org.eclipse.jface.text.ITextViewer;
c7f2547
+import org.eclipse.ui.IEditorInput;
c7f2547
+import org.eclipse.ui.IEditorPart;
c7f2547
+
c7f2547
+public class DefinedSymbolHover extends AbstractCEditorTextHover {
c7f2547
+	
c7f2547
+	/**
c7f2547
+	 * 
c7f2547
+	 */
c7f2547
+	public DefinedSymbolHover() {
c7f2547
+		super();
c7f2547
+	}
c7f2547
+
c7f2547
+	/*
c7f2547
+	 * @see ITextHover#getHoverInfo(ITextViewer, IRegion)
c7f2547
+	 */
c7f2547
+	public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) {
c7f2547
+		IEditorPart editor = getEditor();
c7f2547
+		if (editor != null) {
c7f2547
+			IEditorInput input= editor.getEditorInput();
c7f2547
+			IWorkingCopyManager manager= CUIPlugin.getDefault().getWorkingCopyManager();				
c7f2547
+			IWorkingCopy copy = manager.getWorkingCopy(input);
c7f2547
+			if (copy == null) {
c7f2547
+				return null;
c7f2547
+			}
c7f2547
+			
c7f2547
+			String expression;
c7f2547
+			try {
c7f2547
+				expression = textViewer.getDocument().get(hoverRegion.getOffset(), hoverRegion.getLength());
c7f2547
+				expression = expression.trim();
c7f2547
+				if (expression.length() == 0)
c7f2547
+					return null;
c7f2547
+
c7f2547
+				String source = null;
c7f2547
+				IResource res = copy.getUnderlyingResource();
c7f2547
+
c7f2547
+				IScannerInfo info;
c7f2547
+				IScannerInfoProvider provider = CCorePlugin.getDefault().getScannerInfoProvider(res.getProject());
c7f2547
+				if (provider != null) {
c7f2547
+					info = provider.getScannerInformation(res);
c7f2547
+					Map definedSymbols = info.getDefinedSymbols();
c7f2547
+					String x = (String)definedSymbols.get(expression);
c7f2547
+					if (x != null) {
c7f2547
+						source = "-D" + expression + (x.length() > 0 ? " = " +
c7f2547
+						x : "");
c7f2547
+					}
c7f2547
+				}
c7f2547
+				return source;
c7f2547
+			} catch (BadLocationException e) {
c7f2547
+			}
c7f2547
+		}
c7f2547
+		return null;
c7f2547
+	}
c7f2547
+}
c7f2547
--- ./results/plugins/org.eclipse.cdt.ui/plugin.properties.fix	2006-09-11 15:50:03.000000000 -0400
c7f2547
+++ ./results/plugins/org.eclipse.cdt.ui/plugin.properties	2006-09-11 15:50:43.000000000 -0400
c7f2547
@@ -283,6 +283,8 @@ ViewCommand.typeHierarchy.description= S
c7f2547
 CEditorTextHoversName=C Editor Text Hovers
c7f2547
 sourceHover= Source
c7f2547
 sourceHoverDescription= Shows the source of the selected element.
c7f2547
+definedSymbolHover= Defined Symbol
c7f2547
+definedSymbolHoverDescription= Shows the definition of a selected defined symbol.
c7f2547
 cdocHover= Documentation
c7f2547
 cdocHoverDescription= Shows the documentation of the selected element.
c7f2547
 sequentialHover= Combined Hover
c7f2547
--- ./results/plugins/org.eclipse.cdt.ui/plugin.xml.fix	2006-09-11 15:49:54.000000000 -0400
c7f2547
+++ ./results/plugins/org.eclipse.cdt.ui/plugin.xml	2006-09-11 15:51:19.000000000 -0400
c7f2547
@@ -145,6 +145,12 @@
c7f2547
             class="org.eclipse.cdt.internal.ui.text.c.hover.CSourceHover"
c7f2547
             id="org.eclipse.cdt.ui.CSourceHover">
c7f2547
       </hover>
c7f2547
+      
c7f2547
+            label="%definedSymbolHover"
c7f2547
+            description="%definedSymbolHoverDescription"
c7f2547
+            class="org.eclipse.cdt.internal.ui.text.c.hover.DefinedSymbolHover"
c7f2547
+            id="org.eclipse.cdt.ui.DefinedSymbolHover">
c7f2547
+      </hover>
c7f2547
       
c7f2547
             label="%problemHover"
c7f2547
             description="%problemHoverDescription"