diff --git a/eclipse-cdt-definedsymbol-fix.patch b/eclipse-cdt-definedsymbol-fix.patch new file mode 100644 index 0000000..3796269 --- /dev/null +++ b/eclipse-cdt-definedsymbol-fix.patch @@ -0,0 +1,65 @@ +--- ./com.redhat.eclipse.cdt.autotools/src/com/redhat/eclipse/cdt/autotools/AutotoolsScannerInfo.java.fix2 2006-09-11 16:22:36.000000000 -0400 ++++ ./com.redhat.eclipse.cdt.autotools/src/com/redhat/eclipse/cdt/autotools/AutotoolsScannerInfo.java 2006-09-11 16:45:51.000000000 -0400 +@@ -278,29 +278,31 @@ public class AutotoolsScannerInfo implem + // Extract -D directives from the compilation string. + // TODO: Handle -U directives as well. + String cs = getCompilationString(); +- Pattern p4 = Pattern.compile(" -D"); +- String[] tokens = p4.split(cs); +- for (int j = 1; j < tokens.length; ++j) { +- String x = tokens[j].trim(); +- int eqSignIndex = x.indexOf('='); +- if (eqSignIndex == -1) { +- int firstSpace = x.indexOf(' ', eqSignIndex); +- if (firstSpace != -1) +- symbolMap.put(x.substring(0, firstSpace), ""); +- else +- symbolMap.put(x, ""); +- } +- else { +- int endIndex = -1; +- if (x.charAt(eqSignIndex + 1) == '\\' && x.charAt(eqSignIndex + 2) == '\"') { +- endIndex = x.indexOf('\"', eqSignIndex + 3) + 1; +- } else { +- endIndex = x.indexOf(' '); ++ if (cs != null) { ++ Pattern p4 = Pattern.compile(" -D"); ++ String[] tokens = p4.split(cs); ++ for (int j = 1; j < tokens.length; ++j) { ++ String x = tokens[j].trim(); ++ int eqSignIndex = x.indexOf('='); ++ if (eqSignIndex == -1) { ++ int firstSpace = x.indexOf(' ', eqSignIndex); ++ if (firstSpace != -1) ++ symbolMap.put(x.substring(0, firstSpace), ""); ++ else ++ symbolMap.put(x, ""); ++ } ++ else { ++ int endIndex = -1; ++ if (x.charAt(eqSignIndex + 1) == '\\' && x.charAt(eqSignIndex + 2) == '\"') { ++ endIndex = x.indexOf('\"', eqSignIndex + 3) + 1; ++ } else { ++ endIndex = x.indexOf(' '); ++ } ++ if (endIndex <= 0) ++ symbolMap.put(x.substring(0,eqSignIndex), x.substring(eqSignIndex+1)); ++ else ++ symbolMap.put(x.substring(0, eqSignIndex), x.substring(eqSignIndex+1, endIndex)); + } +- if (endIndex <= 0) +- symbolMap.put(x.substring(0,eqSignIndex), x.substring(eqSignIndex+1)); +- else +- symbolMap.put(x.substring(0, eqSignIndex), x.substring(eqSignIndex+1, endIndex)); + } + } + // Add the defined symbols from ManagedBuildManager. This will include +@@ -322,7 +324,7 @@ public class AutotoolsScannerInfo implem + + public void createIncludeChain(IFile include, IResource res) { + try { +- include.setSessionProperty(OPEN_INCLUDE, res); ++ include.setSessionProperty(OPEN_INCLUDE, res); + } catch (CoreException e) { + // Do nothing + } diff --git a/eclipse-cdt-definedsymbolhover.patch b/eclipse-cdt-definedsymbolhover.patch new file mode 100644 index 0000000..4c166d2 --- /dev/null +++ b/eclipse-cdt-definedsymbolhover.patch @@ -0,0 +1,96 @@ +--- ./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 ++++ ./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 +@@ -0,0 +1,67 @@ ++package org.eclipse.cdt.internal.ui.text.c.hover; ++ ++import java.util.Map; ++ ++import org.eclipse.cdt.core.CCorePlugin; ++import org.eclipse.cdt.core.model.IWorkingCopy; ++import org.eclipse.cdt.core.parser.IScannerInfo; ++import org.eclipse.cdt.core.parser.IScannerInfoProvider; ++import org.eclipse.cdt.ui.CUIPlugin; ++import org.eclipse.cdt.ui.IWorkingCopyManager; ++import org.eclipse.core.resources.IResource; ++import org.eclipse.jface.text.BadLocationException; ++import org.eclipse.jface.text.IRegion; ++import org.eclipse.jface.text.ITextViewer; ++import org.eclipse.ui.IEditorInput; ++import org.eclipse.ui.IEditorPart; ++ ++public class DefinedSymbolHover extends AbstractCEditorTextHover { ++ ++ /** ++ * ++ */ ++ public DefinedSymbolHover() { ++ super(); ++ } ++ ++ /* ++ * @see ITextHover#getHoverInfo(ITextViewer, IRegion) ++ */ ++ public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) { ++ IEditorPart editor = getEditor(); ++ if (editor != null) { ++ IEditorInput input= editor.getEditorInput(); ++ IWorkingCopyManager manager= CUIPlugin.getDefault().getWorkingCopyManager(); ++ IWorkingCopy copy = manager.getWorkingCopy(input); ++ if (copy == null) { ++ return null; ++ } ++ ++ String expression; ++ try { ++ expression = textViewer.getDocument().get(hoverRegion.getOffset(), hoverRegion.getLength()); ++ expression = expression.trim(); ++ if (expression.length() == 0) ++ return null; ++ ++ String source = null; ++ IResource res = copy.getUnderlyingResource(); ++ ++ IScannerInfo info; ++ IScannerInfoProvider provider = CCorePlugin.getDefault().getScannerInfoProvider(res.getProject()); ++ if (provider != null) { ++ info = provider.getScannerInformation(res); ++ Map definedSymbols = info.getDefinedSymbols(); ++ String x = (String)definedSymbols.get(expression); ++ if (x != null) { ++ source = "-D" + expression + (x.length() > 0 ? " = " + ++ x : ""); ++ } ++ } ++ return source; ++ } catch (BadLocationException e) { ++ } ++ } ++ return null; ++ } ++} +--- ./results/plugins/org.eclipse.cdt.ui/plugin.properties.fix 2006-09-11 15:50:03.000000000 -0400 ++++ ./results/plugins/org.eclipse.cdt.ui/plugin.properties 2006-09-11 15:50:43.000000000 -0400 +@@ -283,6 +283,8 @@ ViewCommand.typeHierarchy.description= S + CEditorTextHoversName=C Editor Text Hovers + sourceHover= Source + sourceHoverDescription= Shows the source of the selected element. ++definedSymbolHover= Defined Symbol ++definedSymbolHoverDescription= Shows the definition of a selected defined symbol. + cdocHover= Documentation + cdocHoverDescription= Shows the documentation of the selected element. + sequentialHover= Combined Hover +--- ./results/plugins/org.eclipse.cdt.ui/plugin.xml.fix 2006-09-11 15:49:54.000000000 -0400 ++++ ./results/plugins/org.eclipse.cdt.ui/plugin.xml 2006-09-11 15:51:19.000000000 -0400 +@@ -145,6 +145,12 @@ + class="org.eclipse.cdt.internal.ui.text.c.hover.CSourceHover" + id="org.eclipse.cdt.ui.CSourceHover"> + ++ ++ +