From 0cf1ee7fdece3fd328f69ae69ce9d9396551b975 Mon Sep 17 00:00:00 2001 From: Lidia Popescu Date: Thu, 28 Jun 2018 20:49:56 +0300 Subject: [PATCH] Bug 536255 - Extension point for open call hierarchy view Adding a new extension point that makes possible to extend content from the Open Call Hierarchy View by adding a new node at the top of the tree. Change-Id: I9ac79896a4e8fffc9ed51cdb1be3c70f30d117c4 Signed-off-by: Lidia Popescu --- core/org.eclipse.cdt.ui.tests/plugin.xml | 11 ++ .../eclipse/cdt/ui/tests/AutomatedSuite.java | 5 +- .../extension/CHContentProvider.java | 61 ++++++++ .../extension/CHExtensionTest.java | 106 +++++++++++++ .../extension/CHLabelProvider.java | 72 +++++++++ .../extension/CHOpenListener.java | 92 +++++++++++ .../callhierarchy/extension/DslNode.java | 76 +++++++++ core/org.eclipse.cdt.ui/META-INF/MANIFEST.MF | 2 +- core/org.eclipse.cdt.ui/plugin.xml | 1 + .../schema/CCallHierarchy.exsd | 148 ++++++++++++++++++ .../ui/callhierarchy/CHContentProvider.java | 18 ++- .../ui/callhierarchy/CHEProviderSettings.java | 97 ++++++++++++ .../ui/callhierarchy/CHLabelProvider.java | 45 ++++-- .../internal/ui/callhierarchy/CHViewPart.java | 93 +++++++---- .../eclipse/cdt/ui/ICHEContentProvider.java | 24 +++ .../src/org/eclipse/cdt/ui/ICHENode.java | 23 +++ 16 files changed, 827 insertions(+), 47 deletions(-) create mode 100644 core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHContentProvider.java create mode 100644 core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHExtensionTest.java create mode 100644 core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHLabelProvider.java create mode 100644 core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHOpenListener.java create mode 100644 core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/DslNode.java create mode 100644 core/org.eclipse.cdt.ui/schema/CCallHierarchy.exsd create mode 100644 core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHEProviderSettings.java create mode 100644 core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/ICHEContentProvider.java create mode 100644 core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/ICHENode.java diff --git a/core/org.eclipse.cdt.ui.tests/plugin.xml b/core/org.eclipse.cdt.ui.tests/plugin.xml index d5c5d3bf83c..13962eb220c 100644 --- a/core/org.eclipse.cdt.ui.tests/plugin.xml +++ b/core/org.eclipse.cdt.ui.tests/plugin.xml @@ -283,4 +283,15 @@ + + + + + + diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/AutomatedSuite.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/AutomatedSuite.java index de7940509b0..b85184476c3 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/AutomatedSuite.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/AutomatedSuite.java @@ -25,6 +25,7 @@ import org.junit.runners.Suite; org.eclipse.cdt.ui.tests.outline.OutlineTestSuite.class, org.eclipse.cdt.ui.tests.viewsupport.ViewSupportTestSuite.class, org.eclipse.cdt.ui.tests.callhierarchy.CallHierarchyTestSuite.class, + org.eclipse.cdt.ui.tests.callhierarchy.extension.CHExtensionTest.class, org.eclipse.cdt.ui.tests.typehierarchy.TypeHierarchyTestSuite.class, org.eclipse.cdt.ui.tests.includebrowser.IncludeBrowserTestSuite.class, org.eclipse.cdt.ui.tests.text.contentassist.ContentAssistTestSuite.class, @@ -33,11 +34,11 @@ import org.junit.runners.Suite; org.eclipse.cdt.ui.tests.quickfix.AssistQuickFixTest.class, org.eclipse.cdt.ui.tests.buildconsole.BuildConsoleTests.class, org.eclipse.cdt.ui.tests.search.SearchTestSuite.class, - org.eclipse.cdt.ui.tests.refactoring.RefactoringTestSuite.class, + org.eclipse.cdt.ui.tests.refactoring.RefactoringTestSuite.class, org.eclipse.cdt.ui.tests.chelp.CHelpTest.class, org.eclipse.cdt.ui.tests.wizards.classwizard.ClassWizardTestSuite.class, org.eclipse.cdt.ui.tests.wizards.settingswizards.SettingsWizardTestSuite.class, - org.eclipse.cdt.ui.tests.misc.MiscTestSuite.class, + org.eclipse.cdt.ui.tests.misc.MiscTestSuite.class, org.eclipse.cdt.ui.tests.editor.EditorTestSuite.class, org.eclipse.cdt.ui.tests.templateengine.AllTemplateEngineTests.class, diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHContentProvider.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHContentProvider.java new file mode 100644 index 00000000000..f04412856ae --- /dev/null +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHContentProvider.java @@ -0,0 +1,61 @@ +/******************************************************************************* + * Copyright (c) 2018 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: + * Lidia Popescu - [536255] initial API and implementation. Extension point for open call hierarchy view + *******************************************************************************/ +package org.eclipse.cdt.ui.tests.callhierarchy.extension; + +import org.eclipse.jface.viewers.IOpenListener; + +import org.eclipse.cdt.core.model.ICElement; +import org.eclipse.cdt.ui.ICHEContentProvider; + +import org.eclipse.cdt.internal.core.model.ext.FunctionDeclarationHandle; + +/** + * This class implements ICHEProvider and provides test information + * */ +public class CHContentProvider implements ICHEContentProvider { + + @Override + public Object[] asyncComputeExtendedRoot(Object parentElement) { + Object[] object =null; + if (parentElement instanceof ICElement) { + ICElement element = (ICElement)parentElement; + if ( isDslFunction(element)) { + // check if this function declaration comes from a DSL file + DslNode node = new DslNode(element); + node.setProject(element.getCProject()); + return new Object[]{node}; + } + } + return object; + } + + @Override + public IOpenListener getCCallHierarchyOpenListener() { + return new CHOpenListener(); + } + + /** + * E.g. A custom implementation, suppose that functions that ends with + * "_dsl" have been originally declared in a DSL file. + * @param cElement + * @return + */ + private static boolean isDslFunction(ICElement cElement) { + if (cElement instanceof FunctionDeclarationHandle) { + FunctionDeclarationHandle f = (FunctionDeclarationHandle)cElement; + if (f.getElementName() !=null & f.getElementName().endsWith("_dsl")) { + return true; + } + } + return false; + } + +} diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHExtensionTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHExtensionTest.java new file mode 100644 index 00000000000..af8b5c0b3a8 --- /dev/null +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHExtensionTest.java @@ -0,0 +1,106 @@ +/******************************************************************************* + * Copyright (c) 2018 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: + * Lidia Popescu - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.ui.tests.callhierarchy.extension; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.ui.plugin.AbstractUIPlugin; + +import org.eclipse.cdt.ui.CUIPlugin; +import org.eclipse.cdt.ui.tests.callhierarchy.CallHierarchyBaseTest; + +import org.eclipse.cdt.internal.ui.editor.CEditor; + +import junit.framework.TestSuite; + +/** + * @author Lidia Popescu + * + */ +public class CHExtensionTest extends CallHierarchyBaseTest { + + private static final String FILE_NAME_MAIN_C = "CallHierarchy_main.c"; + private static final String FILE_NAME_DSL = "CallHierarchy_test.java"; + private static final String FILE_NAME_C = "CallHierarchy_test.c"; + + public CHExtensionTest(String name) { + super(name); + } + + public static TestSuite suite() { + return new TestSuite(CHExtensionTest.class); + } + +// {CallHierarchy_main.c} +// extern void function_c(void); +// extern void function_dsl(void); +// +// void main(void) +// { +// function_c(); +// function_dsl(); +// } + +// {CallHierarchy_test.c} +// void function_c(void) +// { +// printf("Hello, world!\n"); +// } + +// {CallHierarchy_test.java} +// /** Suppose this code is written in a different custom programming language, any DSL, e.g. Java*/ +// class CallHierarchy_test { +// public static void function_dsl() { +// System.out.println("Hello, world!"); +// } +// } + public void testCallHierarchy() throws Exception { + + assertNotNull(Platform.getExtensionRegistry().getExtensionPoint("org.eclipse.cdt.ui.CCallHierarchy")); + + ImageDescriptor imageDesc = AbstractUIPlugin.imageDescriptorFromPlugin(CUIPlugin.PLUGIN_ID, CHLabelProvider.ICON_PATH); + assertNotNull(imageDesc); + Image image = imageDesc.createImage(); //$NON-NLS-1$ + assertNotNull(image); + + String content = readTaggedComment(FILE_NAME_DSL); + assertNotNull(content); + IFile file= createFile(getProject(), FILE_NAME_DSL, content); + + content = readTaggedComment(FILE_NAME_C); + assertNotNull(content); + file= createFile(getProject(), FILE_NAME_C, content); + waitUntilFileIsIndexed(fIndex, file); + + content = readTaggedComment(FILE_NAME_MAIN_C); + assertNotNull(content); + file= createFile(getProject(), FILE_NAME_MAIN_C, content); + waitUntilFileIsIndexed(fIndex, file); + CEditor editor = openEditor(file); + + String functionName ="function_c"; + editor.selectAndReveal(content.indexOf(functionName), functionName.length()); + openCallHierarchy(editor); + Tree tree = getCHTreeViewer().getTree(); + checkTreeNode(tree, 0, "function_c() : void"); + checkTreeNode(tree, 0, 0 ,"main() : void"); + + functionName ="function_dsl"; + editor.selectAndReveal(content.indexOf(functionName), functionName.length()); + openCallHierarchy(editor); + tree = getCHTreeViewer().getTree(); + checkTreeNode(tree, 0, "JAVA function function_dsl()"); + checkTreeNode(tree, 0, 0, "function_dsl() : void"); + } +} diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHLabelProvider.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHLabelProvider.java new file mode 100644 index 00000000000..86ae3cfcd3f --- /dev/null +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHLabelProvider.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2018 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: + * Lidia Popescu - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.ui.tests.callhierarchy.extension; + +import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider; +import org.eclipse.jface.viewers.ILabelProviderListener; +import org.eclipse.jface.viewers.StyledCellLabelProvider; +import org.eclipse.jface.viewers.StyledString; +import org.eclipse.swt.graphics.Image; +import org.eclipse.ui.plugin.AbstractUIPlugin; + +import org.eclipse.cdt.core.model.ICElement; +import org.eclipse.cdt.ui.CUIPlugin; + +public class CHLabelProvider implements IStyledLabelProvider { + + public static String ICON_PATH= "$nl$/icons/obj16/container_obj.gif"; + + @Override + public void addListener(ILabelProviderListener listener) { + } + + @Override + public void dispose() { + } + + @Override + public boolean isLabelProperty(Object element, String property) { + return true; + } + + @Override + public void removeListener(ILabelProviderListener listener) { + } + + @Override + public StyledString getStyledText(Object element) { + if (element instanceof DslNode) { + DslNode node = (DslNode)element; + ICElement decl = node.getRepresentedDeclaration(); + + if (decl !=null) { + StyledString label = new StyledString(); + label.append(decl.getElementName()); + if (node.getDslNodeName() != null) { + return StyledCellLabelProvider.styleDecoratedString(node.getDslNodeName(), StyledString.DECORATIONS_STYLER, label); + } + return label; + } + } + return null; + } + + @Override + public Image getImage(Object element) { + if (element instanceof DslNode) { + Image img = AbstractUIPlugin.imageDescriptorFromPlugin( + CUIPlugin.PLUGIN_ID, ICON_PATH).createImage(); //$NON-NLS-1$ + return img; + } + return null; + } + +} diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHOpenListener.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHOpenListener.java new file mode 100644 index 00000000000..4023687829b --- /dev/null +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHOpenListener.java @@ -0,0 +1,92 @@ +/******************************************************************************* + * Copyright (c) 2018 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: + * Lidia Popescu - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.ui.tests.callhierarchy.extension; + +import java.util.HashMap; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.viewers.IOpenListener; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.OpenEvent; +import org.eclipse.jface.viewers.TreeSelection; +import org.eclipse.ui.IEditorDescriptor; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.ide.IDE; +import org.eclipse.ui.part.FileEditorInput; +import org.eclipse.ui.progress.UIJob; + +import org.eclipse.cdt.core.model.ICProject; +import org.eclipse.cdt.ui.testplugin.CTestPlugin; + + +public class CHOpenListener implements IOpenListener { + + /** On Node click open corresponding file */ + @Override + public void open(OpenEvent event) { + if (event !=null ) { + ISelection selection = event.getSelection(); + if (selection instanceof TreeSelection ) { + TreeSelection treeSelection = (TreeSelection)selection; + Object element = treeSelection.getFirstElement(); + if (element instanceof DslNode) { + DslNode node = (DslNode)element; + ICProject project = node.getProject(); + /** + * Based on a custom algorithm the corresponding file and line should be found and open. Suppose that the file + * 'CallHierarchy_test.java' has been found, and the line number '3' where the function 'function_dsl' is defined. + */ + IFile file = project.getProject().getFile("CallHierarchy_test.java"); + IWorkbenchPage page= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart().getSite().getPage(); + IEditorInput input = new FileEditorInput(file); + IEditorDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(input.getName()); + + UIJob ui = new UIJob("Open File") { + + @Override + public IStatus runInUIThread(IProgressMonitor monitor) { + try { + String editorId = null; + if (desc == null || desc.isOpenExternal()) { + editorId = "org.eclipse.ui.DefaultTextEditor"; + } else { + editorId = desc.getId(); + } + IEditorPart editor = page.openEditor(input, editorId); + IMarker fMarker = file.createMarker(IMarker.TEXT); + HashMap map = new HashMap(); + map.put(IMarker.LINE_NUMBER, 3); + fMarker.setAttributes(map); + IDE.gotoMarker(editor,fMarker); + + } catch (PartInitException e) { + e.printStackTrace(); + } catch (CoreException e) { + e.printStackTrace(); + } + return new Status(IStatus.OK, CTestPlugin.PLUGIN_ID, ""); + } + }; + ui.schedule(); + } + } + } + } +} diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/DslNode.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/DslNode.java new file mode 100644 index 00000000000..9da5175c153 --- /dev/null +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/DslNode.java @@ -0,0 +1,76 @@ +/******************************************************************************* + * Copyright (c) 2018 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: + * Lidia Popescu - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.ui.tests.callhierarchy.extension; + +import org.eclipse.core.runtime.IAdaptable; + +import org.eclipse.cdt.core.model.ICElement; +import org.eclipse.cdt.core.model.ICProject; +import org.eclipse.cdt.ui.ICHENode; + + +/** + * The dsl node sample + * */ +public class DslNode implements IAdaptable, ICHENode { + + private ICElement fRepresentedDecl; + private ICProject mProject; + private String mDslNodeName; + + /** + * Constructor used for Open Call Hierarchy command + * */ + public DslNode(ICElement decl) { + this.fRepresentedDecl = decl; + } + + /** + * Constructor used for Open Dsl declaration command + * */ + public DslNode() { + + } + + public ICProject getProject() { + return mProject; + } + + + public void setProject(ICProject mProject) { + this.mProject = mProject; + } + + @Override + public ICElement getRepresentedDeclaration() { + return fRepresentedDecl; + } + + + @Override + public T getAdapter(Class adapterClass) { + if (adapterClass == ICElement.class) { + return (T)getRepresentedDeclaration(); + } + return null; + } + + /** + * Should be displayed with an indication that this is the dsl, + * e.g. "Java function ". + * */ + public String getDslNodeName() { + if ( mDslNodeName == null ) { + mDslNodeName = "JAVA function " + fRepresentedDecl.getElementName()+"()"; + } + return mDslNodeName; + } +} diff --git a/core/org.eclipse.cdt.ui/META-INF/MANIFEST.MF b/core/org.eclipse.cdt.ui/META-INF/MANIFEST.MF index 7ceb8554dc0..f5fa59b5daf 100644 --- a/core/org.eclipse.cdt.ui/META-INF/MANIFEST.MF +++ b/core/org.eclipse.cdt.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.cdt.ui; singleton:=true -Bundle-Version: 6.3.1.qualifier +Bundle-Version: 6.4.0.qualifier Bundle-Activator: org.eclipse.cdt.ui.CUIPlugin Bundle-Vendor: %providerName Bundle-Localization: plugin diff --git a/core/org.eclipse.cdt.ui/plugin.xml b/core/org.eclipse.cdt.ui/plugin.xml index 904df5b5528..5ceb7c9fc7a 100644 --- a/core/org.eclipse.cdt.ui/plugin.xml +++ b/core/org.eclipse.cdt.ui/plugin.xml @@ -32,6 +32,7 @@ + diff --git a/core/org.eclipse.cdt.ui/schema/CCallHierarchy.exsd b/core/org.eclipse.cdt.ui/schema/CCallHierarchy.exsd new file mode 100644 index 00000000000..f0a235b9c9c --- /dev/null +++ b/core/org.eclipse.cdt.ui/schema/CCallHierarchy.exsd @@ -0,0 +1,148 @@ + + + + + + + + + This Call Hierarchy Tree Extension makes possible to extend the CH tree content by adding a new node at the top of the tree, respectivity to customize it's icon and style text, and to add additional click listeners. This could be usefull for mixed source projects, when original declaration of a CDT node comes from a different programming language. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 6.4 + + + + + + + + + A full sample of implementation is provided in org.eclipse.cdt.ui.tests plugin. +<extension + point="org.eclipse.cdt.ui.CCallHierarchy"> + <CallHierarchyLabelProvider + class="org.eclipse.cdt.ui.tests.callhierarchy.extension.CHLabelProvider" + id="org.eclipse.cdt.ui.tests.callhierarchy.extension.CHLabelProvider"> + </CallHierarchyLabelProvider> + <CallHierarchyContentProvider + class="org.eclipse.cdt.ui.tests.callhierarchy.extension.CHContentProvider" + id="org.eclipse.cdt.ui.tests.callhierarchy.extension.CHContentProvider"> + </CallHierarchyContentProvider> + </extension> + + + + + + + + + + + [Enter API information here.] + + + + + + + + + [Enter information about supplied implementation of this extension point.] + + + + + diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHContentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHContentProvider.java index e94fe13becd..9ccf7a3815a 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHContentProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHContentProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2014 Wind River Systems, Inc. and others. + * Copyright (c) 2018 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 @@ -8,6 +8,7 @@ * Contributors: * Markus Schorn - initial API and implementation * Sergey Prigogin (Google) + * Lidia Popescu (Wind River) [536255] Extension point for open call hierarchy view *******************************************************************************/ package org.eclipse.cdt.internal.ui.callhierarchy; @@ -33,6 +34,8 @@ import org.eclipse.cdt.core.model.IMethod; import org.eclipse.cdt.core.model.ITranslationUnit; import org.eclipse.cdt.core.model.IVariable; import org.eclipse.cdt.ui.CUIPlugin; +import org.eclipse.cdt.ui.ICHEContentProvider; +import org.eclipse.cdt.ui.ICHENode; import org.eclipse.cdt.internal.corext.util.CModelUtil; @@ -91,6 +94,19 @@ public class CHContentProvider extends AsyncTreeContentProvider { @Override protected Object[] asyncronouslyComputeChildren(Object parentElement, IProgressMonitor monitor) { try { + ICHEContentProvider[] providers = fView.getContentProviders(); + if (providers != null) { + for (ICHEContentProvider provider : providers) { + Object[] object = provider.asyncComputeExtendedRoot(parentElement); + if (object != null) { + return object; + } + } + } + if (parentElement instanceof ICHENode) { + return asyncComputeRoot(((ICHENode)parentElement).getRepresentedDeclaration()); + } + if (parentElement instanceof ICElement) { return asyncComputeRoot((ICElement) parentElement); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHEProviderSettings.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHEProviderSettings.java new file mode 100644 index 00000000000..b36fda158dd --- /dev/null +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHEProviderSettings.java @@ -0,0 +1,97 @@ +/******************************************************************************* + * Copyright (c) 2018 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: + * Lidia Popescu - [536255] initial API and implementation. Extension point for open call hierarchy view + *******************************************************************************/ +package org.eclipse.cdt.internal.ui.callhierarchy; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtension; +import org.eclipse.core.runtime.IExtensionPoint; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider; +import org.eclipse.jface.viewers.IOpenListener; + +import org.eclipse.cdt.ui.ICHEContentProvider; + +/** + * The Call Hierarchy Extension provider Settings + * Responsible to load all available extensions for EXTENSION_POINT_ID + * */ +public class CHEProviderSettings { + + private static final String EXTENSION_POINT_ID = "org.eclipse.cdt.ui.CCallHierarchy"; //$NON-NLS-1$ + private static final String ELEMENT_NAME_CONTENT = "CallHierarchyContentProvider"; //$NON-NLS-1$ + private static final String ELEMENT_NAME_LABEL = "CallHierarchyLabelProvider"; //$NON-NLS-1$ + private static final String ATTRIB_CLASS = "class"; //$NON-NLS-1$ + + IOpenListener[] openListeners =null; + + static ICHEContentProvider[] chContentProviders = null; + static IStyledLabelProvider[] chLabelProviders = null; + + private static void loadExtensions() { + List chCProviders = new ArrayList(); + List chLProviders = new ArrayList(); + + IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(EXTENSION_POINT_ID); + if (extensionPoint != null) { + IExtension[] extensions = extensionPoint.getExtensions(); + if (extensions != null) { + for (IExtension ex : extensions) { + for (IConfigurationElement el : ex.getConfigurationElements()) { + if (el.getName().equals(ELEMENT_NAME_CONTENT)) { + ICHEContentProvider provider = null; + try { + provider = (ICHEContentProvider) el.createExecutableExtension(ATTRIB_CLASS); + } catch (CoreException e) { + e.printStackTrace(); + } + if (provider != null) { + chCProviders.add(provider); + } + } + if (el.getName().equals(ELEMENT_NAME_LABEL)) { + IStyledLabelProvider provider = null; + try { + provider = (IStyledLabelProvider) el.createExecutableExtension(ATTRIB_CLASS); + } catch (CoreException e) { + e.printStackTrace(); + } + if (provider != null) { + chLProviders.add(provider); + } + } + } + } + } + } + chLabelProviders = chLProviders.toArray(new IStyledLabelProvider[chLProviders.size()]); + chContentProviders = chCProviders.toArray(new ICHEContentProvider[chCProviders.size()]); + } + + + + public static IStyledLabelProvider[] getCCallHierarchyLabelProviders() { + if ( chLabelProviders == null) { + loadExtensions(); + } + return chLabelProviders; + } + + public static ICHEContentProvider[] getCCallHierarchyContentProviders() { + if ( chContentProviders == null) { + loadExtensions(); + } + return chContentProviders; + } +} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHLabelProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHLabelProvider.java index 37d33fa6427..d5fac535313 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHLabelProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHLabelProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2016 Wind River Systems, Inc. and others. + * Copyright (c) 2018 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 @@ -8,12 +8,14 @@ * Contributors: * Markus Schorn - initial API and implementation * Patrick Hofer [bug 325799] + * Lidia Popescu (Wind River) [536255] Extension point for open call hierarchy view *******************************************************************************/ package org.eclipse.cdt.internal.ui.callhierarchy; import java.util.HashMap; import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider; import org.eclipse.jface.viewers.StyledCellLabelProvider; import org.eclipse.jface.viewers.StyledString; import org.eclipse.osgi.util.NLS; @@ -37,19 +39,32 @@ public class CHLabelProvider extends AppearanceAwareLabelProvider { private final static long LABEL_OPTIONS_SIMPLE = CElementLabels.ALL_FULLY_QUALIFIED | CElementLabels.M_PARAMETER_TYPES | CElementLabels.M_APP_RETURNTYPE | CElementLabels.F_APP_TYPE_SIGNATURE | CElementLabels.TEMPLATE_ARGUMENTS; private final static long LABEL_OPTIONS_SHOW_FILES= LABEL_OPTIONS_SIMPLE | CElementLabels.MF_POST_FILE_QUALIFIED; - + private CUILabelProvider fCLabelProvider= new CUILabelProvider(LABEL_OPTIONS_SIMPLE, CElementImageProvider.OVERLAY_ICONS); private CHContentProvider fContentProvider; private HashMap fCachedImages= new HashMap(); private Color fColorInactive; - - public CHLabelProvider(Display display, CHContentProvider cp) { + private IStyledLabelProvider[] fProviders; + private CHViewPart fView; + + public CHLabelProvider(CHViewPart view, Display display, CHContentProvider cp) { fColorInactive= display.getSystemColor(SWT.COLOR_DARK_GRAY); fContentProvider= cp; + fView = view; } - + @Override public Image getImage(Object element) { + if (fProviders == null ) { + fProviders = fView.getLabelProviders(); + } + if ( fProviders != null ) { + for (IStyledLabelProvider provider : fProviders) { + Image img = provider.getImage(element); + if (img != null) + return img; + } + } if (element instanceof CHNode) { CHNode node= (CHNode) element; Image image= null; @@ -96,9 +111,19 @@ public class CHLabelProvider extends AppearanceAwareLabelProvider { } return super.getText(element); } - + @Override public StyledString getStyledText(Object element) { + if (fProviders == null ) { + fProviders = fView.getLabelProviders(); + } + if (fProviders != null) { + for (IStyledLabelProvider provider : fProviders) { + StyledString styledString = provider.getStyledText(element); + if (styledString != null) + return styledString; + } + } if (element instanceof CHNode) { CHNode node= (CHNode) element; ICElement decl= node.getOneRepresentedDeclaration(); @@ -120,7 +145,7 @@ public class CHLabelProvider extends AppearanceAwareLabelProvider { final int offset= label.length(); label.append(NLS.bind(" ({0} {1})", Integer.valueOf(refCount), CHMessages.CHLabelProvider_matches)); //$NON-NLS-1$ label.setStyle(offset, label.length() - offset, StyledString.COUNTER_STYLER); - + } String decorated= decorateText(label.getString(), element); if (decorated != null) { @@ -131,7 +156,7 @@ public class CHLabelProvider extends AppearanceAwareLabelProvider { } return fCLabelProvider.getStyledText(element); } - + private String addInitializerDecoration(String label) { int i= 0; char[] content= label.toCharArray(); @@ -169,7 +194,7 @@ public class CHLabelProvider extends AppearanceAwareLabelProvider { label2.setStyle(0, i, null); return label2; } - + @Override public void dispose() { fCLabelProvider.dispose(); @@ -181,7 +206,7 @@ public class CHLabelProvider extends AppearanceAwareLabelProvider { } private Image decorateImage(Image image, CHNode node) { - int flags= 0; + int flags= 0; if (node.isRecursive()) { flags |= CElementImageDescriptor.RECURSIVE_RELATION; } else if (fContentProvider.hasChildren(node)) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHViewPart.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHViewPart.java index 492821502a5..f69f36f962d 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHViewPart.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHViewPart.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2015 Wind River Systems, Inc. and others. + * Copyright (c) 2018 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 @@ -8,7 +8,8 @@ * Contributors: * Markus Schorn - initial API and implementation * Sergey Prigogin (Google) - *******************************************************************************/ + * Lidia Popescu (Wind River) [536255] Extension point for open call hierarchy view + *******************************************************************************/ package org.eclipse.cdt.internal.ui.callhierarchy; import java.util.Iterator; @@ -24,6 +25,7 @@ import org.eclipse.jface.bindings.BindingManagerEvent; import org.eclipse.jface.bindings.IBindingManagerListener; import org.eclipse.jface.text.Region; import org.eclipse.jface.util.LocalSelectionTransfer; +import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider; import org.eclipse.jface.viewers.IOpenListener; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; @@ -72,6 +74,7 @@ import org.eclipse.cdt.core.model.IFunction; import org.eclipse.cdt.core.model.IMethod; import org.eclipse.cdt.core.model.ITranslationUnit; import org.eclipse.cdt.ui.CUIPlugin; +import org.eclipse.cdt.ui.ICHEContentProvider; import org.eclipse.cdt.ui.actions.CdtActionConstants; import org.eclipse.cdt.ui.actions.OpenViewActionGroup; import org.eclipse.cdt.ui.refactoring.actions.CRefactoringActionGroup; @@ -102,7 +105,7 @@ public class CHViewPart extends ViewPart { private static final String KEY_WORKING_SET_FILTER = "workingSetFilter"; //$NON-NLS-1$ private static final String KEY_FILTER_VARIABLES = "variableFilter"; //$NON-NLS-1$ private static final String KEY_SHOW_FILES= "showFilesInLabels"; //$NON-NLS-1$ - + private IMemento fMemento; private boolean fShowsMessage; private CHNode fNavigationNode; @@ -149,6 +152,8 @@ public class CHViewPart extends ViewPart { private IBindingService bindingService; private IBindingManagerListener bindingManagerListener; + private ICHEContentProvider[] fProviders; + private IStyledLabelProvider[] fLabelProviders; @Override public void setFocus() { @@ -162,7 +167,7 @@ public class CHViewPart extends ViewPart { updateDescription(); updateActionEnablement(); } - + public void setInput(ICElement input) { if (input == null) { setMessage(CHMessages.CHViewPart_emptyPageMessage); @@ -203,7 +208,7 @@ public class CHViewPart extends ViewPart { if (element instanceof IFunction || element instanceof IMethod) { return true; } - + return false; } @@ -212,7 +217,7 @@ public class CHViewPart extends ViewPart { fPagebook = new PageBook(parent, SWT.NULL); createInfoPage(); createViewerPage(); - + getSite().setSelectionProvider(new AdaptingSelectionProvider(ICElement.class, fTreeViewer)); initDragAndDrop(); @@ -236,9 +241,9 @@ public class CHViewPart extends ViewPart { } setMessage(CHMessages.CHViewPart_emptyPageMessage); - + initializeActionStates(); - + IContextService ctxService = getSite().getService(IContextService.class); if (ctxService != null) { fContextActivation= ctxService.activateContext(CUIPlugin.CVIEWS_SCOPE); @@ -247,7 +252,7 @@ public class CHViewPart extends ViewPart { PlatformUI.getWorkbench().getHelpSystem().setHelp(fPagebook, ICHelpContextIds.CALL_HIERARCHY_VIEW); addPartListener(); } - + private void addPartListener() { fPartListener= new IPartListener2() { @Override @@ -316,7 +321,7 @@ public class CHViewPart extends ViewPart { } super.dispose(); } - + private void initializeActionStates() { boolean referencedBy= true; boolean filterVariables= false; @@ -391,22 +396,30 @@ public class CHViewPart extends ViewPart { fViewerPage.setSize(100, 100); fViewerPage.setLayout(new FillLayout()); - fContentProvider= new CHContentProvider(this, display); - fLabelProvider= new CHLabelProvider(display, fContentProvider); + fProviders = CHEProviderSettings.getCCallHierarchyContentProviders(); + fLabelProviders = CHEProviderSettings.getCCallHierarchyLabelProviders(); + + fContentProvider= new CHContentProvider(this, display); + fLabelProvider = new CHLabelProvider(this, display, fContentProvider); fTreeViewer= new ExtendedTreeViewer(fViewerPage); fTreeViewer.setContentProvider(fContentProvider); fTreeViewer.setLabelProvider(new DecoratingCLabelProvider(fLabelProvider)); - fTreeViewer.setAutoExpandLevel(2); + fTreeViewer.setAutoExpandLevel(2); fTreeViewer.addOpenListener(new IOpenListener() { @Override public void open(OpenEvent event) { onShowSelectedReference(event.getSelection()); } }); + if (fProviders !=null) { + for (ICHEContentProvider provider : fProviders) { + fTreeViewer.addOpenListener(provider.getCCallHierarchyOpenListener()); + } + } } - - private void createInfoPage() { - fInfoText = new Label(fPagebook, SWT.TOP | SWT.LEFT | SWT.WRAP); + + private void createInfoPage() { + fInfoText = new Label(fPagebook, SWT.TOP | SWT.LEFT | SWT.WRAP); } private void initDragAndDrop() { @@ -427,7 +440,7 @@ public class CHViewPart extends ViewPart { fOpenViewActionGroup.setEnableIncludeBrowser(true); fSelectionSearchGroup= new SelectionSearchGroup(getSite()); fRefactoringActionGroup= new CRefactoringActionGroup(this); - + fWorkingSetFilterUI= new WorkingSetFilterUI(this, fMemento, KEY_WORKING_SET_FILTER) { @Override protected void onWorkingSetChange() { @@ -439,8 +452,8 @@ public class CHViewPart extends ViewPart { } }; - fReferencedByAction= - new Action(CHMessages.CHViewPart_ShowCallers_label, IAction.AS_RADIO_BUTTON) { + fReferencedByAction= + new Action(CHMessages.CHViewPart_ShowCallers_label, IAction.AS_RADIO_BUTTON) { @Override public void run() { if (isChecked()) { @@ -449,10 +462,10 @@ public class CHViewPart extends ViewPart { } }; fReferencedByAction.setToolTipText(CHMessages.CHViewPart_ShowCallers_tooltip); - CPluginImages.setImageDescriptors(fReferencedByAction, CPluginImages.T_LCL, CPluginImages.IMG_ACTION_SHOW_REF_BY); + CPluginImages.setImageDescriptors(fReferencedByAction, CPluginImages.T_LCL, CPluginImages.IMG_ACTION_SHOW_REF_BY); fMakesReferenceToAction= - new Action(CHMessages.CHViewPart_ShowCallees_label, IAction.AS_RADIO_BUTTON) { + new Action(CHMessages.CHViewPart_ShowCallees_label, IAction.AS_RADIO_BUTTON) { @Override public void run() { if (isChecked()) { @@ -461,7 +474,7 @@ public class CHViewPart extends ViewPart { } }; fMakesReferenceToAction.setToolTipText(CHMessages.CHViewPart_ShowCallees_tooltip); - CPluginImages.setImageDescriptors(fMakesReferenceToAction, CPluginImages.T_LCL, CPluginImages.IMG_ACTION_SHOW_RELATES_TO); + CPluginImages.setImageDescriptors(fMakesReferenceToAction, CPluginImages.T_LCL, CPluginImages.IMG_ACTION_SHOW_RELATES_TO); fVariableFilter= new ViewerFilter() { @Override @@ -484,7 +497,7 @@ public class CHViewPart extends ViewPart { } }; fFilterVariablesAction.setToolTipText(CHMessages.CHViewPart_FilterVariables_tooltip); - CPluginImages.setImageDescriptors(fFilterVariablesAction, CPluginImages.T_LCL, CPluginImages.IMG_ACTION_HIDE_FIELDS); + CPluginImages.setImageDescriptors(fFilterVariablesAction, CPluginImages.T_LCL, CPluginImages.IMG_ACTION_HIDE_FIELDS); fSorterAlphaNumeric= new ViewerComparator(); fSorterReferencePosition= new ViewerComparator() { @@ -544,8 +557,8 @@ public class CHViewPart extends ViewPart { onNextOrPrevious(true); } }; - fNextAction.setToolTipText(CHMessages.CHViewPart_NextReference_tooltip); - CPluginImages.setImageDescriptors(fNextAction, CPluginImages.T_LCL, CPluginImages.IMG_SHOW_NEXT); + fNextAction.setToolTipText(CHMessages.CHViewPart_NextReference_tooltip); + CPluginImages.setImageDescriptors(fNextAction, CPluginImages.T_LCL, CPluginImages.IMG_SHOW_NEXT); fPreviousAction = new Action(CHMessages.CHViewPart_PreviousReference_label) { @Override @@ -554,7 +567,7 @@ public class CHViewPart extends ViewPart { } }; fPreviousAction.setToolTipText(CHMessages.CHViewPart_PreviousReference_tooltip); - CPluginImages.setImageDescriptors(fPreviousAction, CPluginImages.T_LCL, CPluginImages.IMG_SHOW_PREV); + CPluginImages.setImageDescriptors(fPreviousAction, CPluginImages.T_LCL, CPluginImages.IMG_SHOW_PREV); fRefreshAction = new Action(CHMessages.CHViewPart_Refresh_label) { @Override @@ -563,7 +576,7 @@ public class CHViewPart extends ViewPart { } }; fRefreshAction.setToolTipText(CHMessages.CHViewPart_Refresh_tooltip); - CPluginImages.setImageDescriptors(fRefreshAction, CPluginImages.T_LCL, CPluginImages.IMG_REFRESH); + CPluginImages.setImageDescriptors(fRefreshAction, CPluginImages.T_LCL, CPluginImages.IMG_REFRESH); fHistoryAction = new CHHistoryDropDownAction(this); @@ -611,7 +624,7 @@ public class CHViewPart extends ViewPart { mm.add(new Separator()); mm.add(fFilterVariablesAction); } - + private void setNextNode(boolean forward) { TreeNavigator navigator= new TreeNavigator(fTreeViewer.getTree(), CHNode.class); TreeItem selectedItem= navigator.getSelectedItemOrFirstOnLevel(1, forward); @@ -643,7 +656,7 @@ public class CHViewPart extends ViewPart { fNavigationDetail= 0; } } - + protected void onShowSelectedReference(ISelection selection) { CHNode node= selectionToNode(selection); if (node != null && node == fNavigationNode && node.getReferenceCount() > 0) { @@ -699,7 +712,7 @@ public class CHViewPart extends ViewPart { fTreeViewer.setComparator(fSorterReferencePosition); } } - + private void updateDescription() { String message= ""; //$NON-NLS-1$ if (!fShowsMessage) { @@ -738,7 +751,7 @@ public class CHViewPart extends ViewPart { setContentDescription(message); } - + private void updateActionEnablement() { fHistoryAction.setEnabled(CallHierarchyUI.getHistoryEntries().length > 0); fNextAction.setEnabled(!fShowsMessage); @@ -749,7 +762,7 @@ public class CHViewPart extends ViewPart { private void updateWorkingSetFilter(WorkingSetFilterUI filterUI) { fContentProvider.setWorkingSetFilter(filterUI); } - + public void onSetShowReferencedBy(boolean showReferencedBy) { if (showReferencedBy != fContentProvider.getComputeReferencedBy()) { Object input= fTreeViewer.getInput(); @@ -832,7 +845,7 @@ public class CHViewPart extends ViewPart { } } } - + private int getReferenceCount(CHNode node) { if (node != null) { CHNode parent = node.getParent(); @@ -896,4 +909,18 @@ public class CHViewPart extends ViewPart { boolean isPinned() { return fIsPinned; } + + /** + * @return an array of {@link ICHEContentProvider} for Extended Call Hierarchy + */ + public ICHEContentProvider[] getContentProviders() { + return fProviders; + } + + /** + * @return an array of {@link IStyledLabelProvider} for Extended Call Hierarchy + */ + public IStyledLabelProvider[] getLabelProviders() { + return fLabelProviders; + } } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/ICHEContentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/ICHEContentProvider.java new file mode 100644 index 00000000000..21a5a5d3e81 --- /dev/null +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/ICHEContentProvider.java @@ -0,0 +1,24 @@ +/******************************************************************************* + * Copyright (c) 2018 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: + * Lidia Popescu - [536255] initial API and implementation. Extension point for open call hierarchy view + *******************************************************************************/ +package org.eclipse.cdt.ui; + + +import org.eclipse.jface.viewers.IOpenListener; +/** + * The Call Hierarchy Extension Content Provider Interface + * @since 6.4 + * */ +public interface ICHEContentProvider { + + Object[] asyncComputeExtendedRoot(Object parentElement); + + IOpenListener getCCallHierarchyOpenListener(); +} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/ICHENode.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/ICHENode.java new file mode 100644 index 00000000000..08e952d5fd0 --- /dev/null +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/ICHENode.java @@ -0,0 +1,23 @@ +/******************************************************************************* + * Copyright (c) 2018 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: + * Lidia Popescu - [536255] initial API and implementation. Extension point for open call hierarchy view + *******************************************************************************/ +package org.eclipse.cdt.ui; + + +import org.eclipse.cdt.core.model.ICElement; + +/** + * The Call Hierarchy Extension Node + * @since 6.4 + */ +public interface ICHENode { + + ICElement getRepresentedDeclaration(); +}