+ * EXPERIMENTAL. This class or interface has been added as + * part of a work in progress. There is no guarantee that this API will work or + * that it will remain the same. Please do not use this API without consulting + * with the CDT team. + * + * @since 5.7 + */ +public interface ICallHierarchyProvider { + /** + * Adds the calling functions and the corresponding call points located in files not covered + * by the CDT index to the call hierarchy results. + * + * @param callee the function being called + * @param linkageID the ID of the linkage to search for calling functions or -1 to search + * all linkages. + * @param index the index, for which the caller is holding a read lock + * @param result the accumulator to add the results to + * @throws CoreException may be thrown in case of an error + */ + void findCalledBy(ICElement callee, int linkageID, IIndex index, ICalledByResult result) + throws CoreException; + + /** + * Adds the called functions and the corresponding call points for a function defined in a file + * not covered by the CDT index to the call hierarchy results. + * + * @param caller the function to get the called functions for + * @param index the index, for which the caller is holding a read lock + * @param result the accumulator to add the results to + * @throws CoreException may be thrown in case of an error + */ + void findCalls(ICElement caller, IIndex index, ICallToResult result) throws CoreException; + + /** + * Checks if an element representing a function is owned by the call hierarchy provider. + * + * @param element the element to check + * @return {@code true} if the element is owned by this provider. + */ + boolean ownsElement(ICElement element); +} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/extensions/ICallToResult.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/extensions/ICallToResult.java new file mode 100644 index 00000000000..9748b2589d0 --- /dev/null +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/extensions/ICallToResult.java @@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2014 Google, 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: + * Sergey Prigogin (Google) - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.ui.extensions; + +import org.eclipse.cdt.core.index.IIndexName; +import org.eclipse.cdt.core.model.ICElement; + +/** + * @see ICallHierarchyProvider#findCalls + * + *
+ * EXPERIMENTAL. This class or interface has been added as + * part of a work in progress. There is no guarantee that this API will work or + * that it will remain the same. Please do not use this API without consulting + * with the CDT team. + * + * @since 5.7 + */ +public interface ICallToResult { + /** + * Adds a call point to the list of call hierarchy results. + * + * @param elems the called methods + * @param ref the call site + */ + public void add(ICElement[] elems, IIndexName ref); +} \ No newline at end of file diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/extensions/ICalledByResult.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/extensions/ICalledByResult.java new file mode 100644 index 00000000000..dd7b0d58462 --- /dev/null +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/extensions/ICalledByResult.java @@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2014 Google, 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: + * Sergey Prigogin (Google) - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.ui.extensions; + +import org.eclipse.cdt.core.index.IIndexName; +import org.eclipse.cdt.core.model.ICElement; + +/** + * @see ICallHierarchyProvider#findCalledBy + * + *
+ * EXPERIMENTAL. This class or interface has been added as + * part of a work in progress. There is no guarantee that this API will work or + * that it will remain the same. Please do not use this API without consulting + * with the CDT team. + * + * @since 5.7 + */ +public interface ICalledByResult { + /** + * Adds a call point to the list of call hierarchy results. + * + * @param elem the caller method + * @param ref the call site + */ + public void add(ICElement elem, IIndexName ref); +} \ No newline at end of file diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/extensions/IExternalSearchProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/extensions/IExternalSearchProvider.java new file mode 100644 index 00000000000..dd7d7d87542 --- /dev/null +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/extensions/IExternalSearchProvider.java @@ -0,0 +1,66 @@ +/******************************************************************************* + * Copyright (c) 2014 Google, 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: + * Sergey Prigogin (Google) - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.ui.extensions; + +import java.util.List; + +import org.eclipse.core.runtime.CoreException; + +import org.eclipse.cdt.core.dom.ast.IBinding; +import org.eclipse.cdt.core.index.IIndex; +import org.eclipse.cdt.core.index.IIndexName; +import org.eclipse.cdt.core.model.ICElement; +import org.eclipse.cdt.core.model.ICProject; + +/** + * Interface for classes implementing the org.eclipse.cdt.ui.externalSearchProviders extension + * point. + * + *
+ * EXPERIMENTAL. This class or interface has been added as + * part of a work in progress. There is no guarantee that this API will work or + * that it will remain the same. Please do not use this API without consulting + * with the CDT team. + * + * @since 5.7 + */ +public interface IExternalSearchProvider { + /** + * Searches for all names that resolve to the given binding. The result can be limited to + * references, declarations or definitions, or a combination of those. + *
+ * When the method is called, the {@code foundNames} list contains the names found in the core
+ * index. The method may add more names to the {@code foundNames} list, but should not remove
+ * the names already present there.
+ *
+ * @param binding A binding for which names are searched for
+ * @param flags A combination of {@link IIndex#FIND_DECLARATIONS},
+ * {@link IIndex#FIND_DEFINITIONS}, {@link IIndex#FIND_REFERENCES} and
+ * {@link IIndex#SEARCH_ACROSS_LANGUAGE_BOUNDARIES}.
+ * @param projects The projects in context of which to do search.
+ * @param foundNames Before the call contains the names found in the core index. After the call
+ * may contain additional names located in files covered by the index extension.
+ * @throws CoreException may be thrown in case of an error
+ *
+ * @see {@link IIndex#findNames(IBinding, int)}
+ */
+ void findNames(IBinding binding, int flags, ICProject[] projects, IIndex index,
+ List