mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
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 <lidia.popescu@windriver.com>
This commit is contained in:
parent
8a73297c10
commit
0cf1ee7fde
16 changed files with 827 additions and 47 deletions
|
@ -283,4 +283,15 @@
|
||||||
</menuContribution>
|
</menuContribution>
|
||||||
</extension>
|
</extension>
|
||||||
|
|
||||||
|
<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>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -25,6 +25,7 @@ import org.junit.runners.Suite;
|
||||||
org.eclipse.cdt.ui.tests.outline.OutlineTestSuite.class,
|
org.eclipse.cdt.ui.tests.outline.OutlineTestSuite.class,
|
||||||
org.eclipse.cdt.ui.tests.viewsupport.ViewSupportTestSuite.class,
|
org.eclipse.cdt.ui.tests.viewsupport.ViewSupportTestSuite.class,
|
||||||
org.eclipse.cdt.ui.tests.callhierarchy.CallHierarchyTestSuite.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.typehierarchy.TypeHierarchyTestSuite.class,
|
||||||
org.eclipse.cdt.ui.tests.includebrowser.IncludeBrowserTestSuite.class,
|
org.eclipse.cdt.ui.tests.includebrowser.IncludeBrowserTestSuite.class,
|
||||||
org.eclipse.cdt.ui.tests.text.contentassist.ContentAssistTestSuite.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.quickfix.AssistQuickFixTest.class,
|
||||||
org.eclipse.cdt.ui.tests.buildconsole.BuildConsoleTests.class,
|
org.eclipse.cdt.ui.tests.buildconsole.BuildConsoleTests.class,
|
||||||
org.eclipse.cdt.ui.tests.search.SearchTestSuite.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.chelp.CHelpTest.class,
|
||||||
org.eclipse.cdt.ui.tests.wizards.classwizard.ClassWizardTestSuite.class,
|
org.eclipse.cdt.ui.tests.wizards.classwizard.ClassWizardTestSuite.class,
|
||||||
org.eclipse.cdt.ui.tests.wizards.settingswizards.SettingsWizardTestSuite.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.editor.EditorTestSuite.class,
|
||||||
org.eclipse.cdt.ui.tests.templateengine.AllTemplateEngineTests.class,
|
org.eclipse.cdt.ui.tests.templateengine.AllTemplateEngineTests.class,
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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");
|
||||||
|
}
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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<String, Object> map = new HashMap<String, Object>();
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -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> T getAdapter(Class<T> 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 <function_name>".
|
||||||
|
* */
|
||||||
|
public String getDslNodeName() {
|
||||||
|
if ( mDslNodeName == null ) {
|
||||||
|
mDslNodeName = "JAVA function " + fRepresentedDecl.getElementName()+"()";
|
||||||
|
}
|
||||||
|
return mDslNodeName;
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: %pluginName
|
Bundle-Name: %pluginName
|
||||||
Bundle-SymbolicName: org.eclipse.cdt.ui; singleton:=true
|
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-Activator: org.eclipse.cdt.ui.CUIPlugin
|
||||||
Bundle-Vendor: %providerName
|
Bundle-Vendor: %providerName
|
||||||
Bundle-Localization: plugin
|
Bundle-Localization: plugin
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
<extension-point id="RefreshExclusionContributor" name="%RefreshExclusionContributorExtensionPoint" schema="schema/RefreshExclusionContributor.exsd"/>
|
<extension-point id="RefreshExclusionContributor" name="%RefreshExclusionContributorExtensionPoint" schema="schema/RefreshExclusionContributor.exsd"/>
|
||||||
<extension-point id="semanticHighlighting" name="%semanticHighlightingExtensionPoint" schema="schema/semanticHighlighting.exsd"/>
|
<extension-point id="semanticHighlighting" name="%semanticHighlightingExtensionPoint" schema="schema/semanticHighlighting.exsd"/>
|
||||||
<extension-point id="newToolChainWizards" name="New ToolChain Wizards" schema="schema/newToolChainWizards.exsd"/>
|
<extension-point id="newToolChainWizards" name="New ToolChain Wizards" schema="schema/newToolChainWizards.exsd"/>
|
||||||
|
<extension-point id="CCallHierarchy" name="The Call Hierarchy Tree Extension" schema="schema/CCallHierarchy.exsd"/>
|
||||||
|
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.core.runtime.adapters">
|
point="org.eclipse.core.runtime.adapters">
|
||||||
|
|
148
core/org.eclipse.cdt.ui/schema/CCallHierarchy.exsd
Normal file
148
core/org.eclipse.cdt.ui/schema/CCallHierarchy.exsd
Normal file
|
@ -0,0 +1,148 @@
|
||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<!-- Schema file written by PDE -->
|
||||||
|
<schema targetNamespace="org.eclipse.cdt.ui" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||||
|
<annotation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.schema plugin="org.eclipse.cdt.ui" id="CCallHierarchy" name="The Call Hierarchy Tree Extension"/>
|
||||||
|
</appInfo>
|
||||||
|
<documentation>
|
||||||
|
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.
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<element name="extension">
|
||||||
|
<annotation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.element />
|
||||||
|
</appInfo>
|
||||||
|
</annotation>
|
||||||
|
<complexType>
|
||||||
|
<sequence>
|
||||||
|
<element ref="CallHierarchyContentProvider"/>
|
||||||
|
<element ref="CallHierarchyLabelProvider"/>
|
||||||
|
</sequence>
|
||||||
|
<attribute name="point" type="string" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="id" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="name" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.attribute translatable="true"/>
|
||||||
|
</appInfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
</complexType>
|
||||||
|
</element>
|
||||||
|
|
||||||
|
<element name="CallHierarchyContentProvider">
|
||||||
|
<complexType>
|
||||||
|
<attribute name="id" type="string" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.attribute kind="identifier"/>
|
||||||
|
</appInfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="class" type="string" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
</documentation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.attribute kind="java" basedOn=":org.eclipse.cdt.ui.ICHEContentProvider"/>
|
||||||
|
</appInfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
</complexType>
|
||||||
|
</element>
|
||||||
|
|
||||||
|
<element name="CallHierarchyLabelProvider">
|
||||||
|
<complexType>
|
||||||
|
<attribute name="id" type="string" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.attribute kind="identifier"/>
|
||||||
|
</appInfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="class" type="string" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
</documentation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.attribute kind="java" basedOn=":org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider$IStyledLabelProvider"/>
|
||||||
|
</appInfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
</complexType>
|
||||||
|
</element>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.section type="since"/>
|
||||||
|
</appInfo>
|
||||||
|
<documentation>
|
||||||
|
6.4
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.section type="examples"/>
|
||||||
|
</appInfo>
|
||||||
|
<documentation>
|
||||||
|
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>
|
||||||
|
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.section type="apiinfo"/>
|
||||||
|
</appInfo>
|
||||||
|
<documentation>
|
||||||
|
[Enter API information here.]
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.section type="implementation"/>
|
||||||
|
</appInfo>
|
||||||
|
<documentation>
|
||||||
|
[Enter information about supplied implementation of this extension point.]
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
|
||||||
|
</schema>
|
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
* Sergey Prigogin (Google)
|
* Sergey Prigogin (Google)
|
||||||
|
* Lidia Popescu (Wind River) [536255] Extension point for open call hierarchy view
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.callhierarchy;
|
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.ITranslationUnit;
|
||||||
import org.eclipse.cdt.core.model.IVariable;
|
import org.eclipse.cdt.core.model.IVariable;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
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;
|
import org.eclipse.cdt.internal.corext.util.CModelUtil;
|
||||||
|
|
||||||
|
@ -91,6 +94,19 @@ public class CHContentProvider extends AsyncTreeContentProvider {
|
||||||
@Override
|
@Override
|
||||||
protected Object[] asyncronouslyComputeChildren(Object parentElement, IProgressMonitor monitor) {
|
protected Object[] asyncronouslyComputeChildren(Object parentElement, IProgressMonitor monitor) {
|
||||||
try {
|
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) {
|
if (parentElement instanceof ICElement) {
|
||||||
return asyncComputeRoot((ICElement) parentElement);
|
return asyncComputeRoot((ICElement) parentElement);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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<ICHEContentProvider> chCProviders = new ArrayList<ICHEContentProvider>();
|
||||||
|
List<IStyledLabelProvider> chLProviders = new ArrayList<IStyledLabelProvider>();
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -8,12 +8,14 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
* Patrick Hofer [bug 325799]
|
* Patrick Hofer [bug 325799]
|
||||||
|
* Lidia Popescu (Wind River) [536255] Extension point for open call hierarchy view
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.callhierarchy;
|
package org.eclipse.cdt.internal.ui.callhierarchy;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.eclipse.jface.resource.ImageDescriptor;
|
import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
|
import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider;
|
||||||
import org.eclipse.jface.viewers.StyledCellLabelProvider;
|
import org.eclipse.jface.viewers.StyledCellLabelProvider;
|
||||||
import org.eclipse.jface.viewers.StyledString;
|
import org.eclipse.jface.viewers.StyledString;
|
||||||
import org.eclipse.osgi.util.NLS;
|
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
|
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;
|
| 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 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 CUILabelProvider fCLabelProvider= new CUILabelProvider(LABEL_OPTIONS_SIMPLE, CElementImageProvider.OVERLAY_ICONS);
|
||||||
private CHContentProvider fContentProvider;
|
private CHContentProvider fContentProvider;
|
||||||
private HashMap<String, Image> fCachedImages= new HashMap<String, Image>();
|
private HashMap<String, Image> fCachedImages= new HashMap<String, Image>();
|
||||||
private Color fColorInactive;
|
private Color fColorInactive;
|
||||||
|
private IStyledLabelProvider[] fProviders;
|
||||||
public CHLabelProvider(Display display, CHContentProvider cp) {
|
private CHViewPart fView;
|
||||||
|
|
||||||
|
public CHLabelProvider(CHViewPart view, Display display, CHContentProvider cp) {
|
||||||
fColorInactive= display.getSystemColor(SWT.COLOR_DARK_GRAY);
|
fColorInactive= display.getSystemColor(SWT.COLOR_DARK_GRAY);
|
||||||
fContentProvider= cp;
|
fContentProvider= cp;
|
||||||
|
fView = view;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Image getImage(Object element) {
|
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) {
|
if (element instanceof CHNode) {
|
||||||
CHNode node= (CHNode) element;
|
CHNode node= (CHNode) element;
|
||||||
Image image= null;
|
Image image= null;
|
||||||
|
@ -96,9 +111,19 @@ public class CHLabelProvider extends AppearanceAwareLabelProvider {
|
||||||
}
|
}
|
||||||
return super.getText(element);
|
return super.getText(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StyledString getStyledText(Object element) {
|
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) {
|
if (element instanceof CHNode) {
|
||||||
CHNode node= (CHNode) element;
|
CHNode node= (CHNode) element;
|
||||||
ICElement decl= node.getOneRepresentedDeclaration();
|
ICElement decl= node.getOneRepresentedDeclaration();
|
||||||
|
@ -120,7 +145,7 @@ public class CHLabelProvider extends AppearanceAwareLabelProvider {
|
||||||
final int offset= label.length();
|
final int offset= label.length();
|
||||||
label.append(NLS.bind(" ({0} {1})", Integer.valueOf(refCount), CHMessages.CHLabelProvider_matches)); //$NON-NLS-1$
|
label.append(NLS.bind(" ({0} {1})", Integer.valueOf(refCount), CHMessages.CHLabelProvider_matches)); //$NON-NLS-1$
|
||||||
label.setStyle(offset, label.length() - offset, StyledString.COUNTER_STYLER);
|
label.setStyle(offset, label.length() - offset, StyledString.COUNTER_STYLER);
|
||||||
|
|
||||||
}
|
}
|
||||||
String decorated= decorateText(label.getString(), element);
|
String decorated= decorateText(label.getString(), element);
|
||||||
if (decorated != null) {
|
if (decorated != null) {
|
||||||
|
@ -131,7 +156,7 @@ public class CHLabelProvider extends AppearanceAwareLabelProvider {
|
||||||
}
|
}
|
||||||
return fCLabelProvider.getStyledText(element);
|
return fCLabelProvider.getStyledText(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String addInitializerDecoration(String label) {
|
private String addInitializerDecoration(String label) {
|
||||||
int i= 0;
|
int i= 0;
|
||||||
char[] content= label.toCharArray();
|
char[] content= label.toCharArray();
|
||||||
|
@ -169,7 +194,7 @@ public class CHLabelProvider extends AppearanceAwareLabelProvider {
|
||||||
label2.setStyle(0, i, null);
|
label2.setStyle(0, i, null);
|
||||||
return label2;
|
return label2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
fCLabelProvider.dispose();
|
fCLabelProvider.dispose();
|
||||||
|
@ -181,7 +206,7 @@ public class CHLabelProvider extends AppearanceAwareLabelProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Image decorateImage(Image image, CHNode node) {
|
private Image decorateImage(Image image, CHNode node) {
|
||||||
int flags= 0;
|
int flags= 0;
|
||||||
if (node.isRecursive()) {
|
if (node.isRecursive()) {
|
||||||
flags |= CElementImageDescriptor.RECURSIVE_RELATION;
|
flags |= CElementImageDescriptor.RECURSIVE_RELATION;
|
||||||
} else if (fContentProvider.hasChildren(node)) {
|
} else if (fContentProvider.hasChildren(node)) {
|
||||||
|
|
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -8,7 +8,8 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
* Sergey Prigogin (Google)
|
* Sergey Prigogin (Google)
|
||||||
*******************************************************************************/
|
* Lidia Popescu (Wind River) [536255] Extension point for open call hierarchy view
|
||||||
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.callhierarchy;
|
package org.eclipse.cdt.internal.ui.callhierarchy;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
@ -24,6 +25,7 @@ import org.eclipse.jface.bindings.BindingManagerEvent;
|
||||||
import org.eclipse.jface.bindings.IBindingManagerListener;
|
import org.eclipse.jface.bindings.IBindingManagerListener;
|
||||||
import org.eclipse.jface.text.Region;
|
import org.eclipse.jface.text.Region;
|
||||||
import org.eclipse.jface.util.LocalSelectionTransfer;
|
import org.eclipse.jface.util.LocalSelectionTransfer;
|
||||||
|
import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider;
|
||||||
import org.eclipse.jface.viewers.IOpenListener;
|
import org.eclipse.jface.viewers.IOpenListener;
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
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.IMethod;
|
||||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
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.CdtActionConstants;
|
||||||
import org.eclipse.cdt.ui.actions.OpenViewActionGroup;
|
import org.eclipse.cdt.ui.actions.OpenViewActionGroup;
|
||||||
import org.eclipse.cdt.ui.refactoring.actions.CRefactoringActionGroup;
|
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_WORKING_SET_FILTER = "workingSetFilter"; //$NON-NLS-1$
|
||||||
private static final String KEY_FILTER_VARIABLES = "variableFilter"; //$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 static final String KEY_SHOW_FILES= "showFilesInLabels"; //$NON-NLS-1$
|
||||||
|
|
||||||
private IMemento fMemento;
|
private IMemento fMemento;
|
||||||
private boolean fShowsMessage;
|
private boolean fShowsMessage;
|
||||||
private CHNode fNavigationNode;
|
private CHNode fNavigationNode;
|
||||||
|
@ -149,6 +152,8 @@ public class CHViewPart extends ViewPart {
|
||||||
|
|
||||||
private IBindingService bindingService;
|
private IBindingService bindingService;
|
||||||
private IBindingManagerListener bindingManagerListener;
|
private IBindingManagerListener bindingManagerListener;
|
||||||
|
private ICHEContentProvider[] fProviders;
|
||||||
|
private IStyledLabelProvider[] fLabelProviders;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFocus() {
|
public void setFocus() {
|
||||||
|
@ -162,7 +167,7 @@ public class CHViewPart extends ViewPart {
|
||||||
updateDescription();
|
updateDescription();
|
||||||
updateActionEnablement();
|
updateActionEnablement();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInput(ICElement input) {
|
public void setInput(ICElement input) {
|
||||||
if (input == null) {
|
if (input == null) {
|
||||||
setMessage(CHMessages.CHViewPart_emptyPageMessage);
|
setMessage(CHMessages.CHViewPart_emptyPageMessage);
|
||||||
|
@ -203,7 +208,7 @@ public class CHViewPart extends ViewPart {
|
||||||
if (element instanceof IFunction || element instanceof IMethod) {
|
if (element instanceof IFunction || element instanceof IMethod) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,7 +217,7 @@ public class CHViewPart extends ViewPart {
|
||||||
fPagebook = new PageBook(parent, SWT.NULL);
|
fPagebook = new PageBook(parent, SWT.NULL);
|
||||||
createInfoPage();
|
createInfoPage();
|
||||||
createViewerPage();
|
createViewerPage();
|
||||||
|
|
||||||
getSite().setSelectionProvider(new AdaptingSelectionProvider(ICElement.class, fTreeViewer));
|
getSite().setSelectionProvider(new AdaptingSelectionProvider(ICElement.class, fTreeViewer));
|
||||||
|
|
||||||
initDragAndDrop();
|
initDragAndDrop();
|
||||||
|
@ -236,9 +241,9 @@ public class CHViewPart extends ViewPart {
|
||||||
}
|
}
|
||||||
|
|
||||||
setMessage(CHMessages.CHViewPart_emptyPageMessage);
|
setMessage(CHMessages.CHViewPart_emptyPageMessage);
|
||||||
|
|
||||||
initializeActionStates();
|
initializeActionStates();
|
||||||
|
|
||||||
IContextService ctxService = getSite().getService(IContextService.class);
|
IContextService ctxService = getSite().getService(IContextService.class);
|
||||||
if (ctxService != null) {
|
if (ctxService != null) {
|
||||||
fContextActivation= ctxService.activateContext(CUIPlugin.CVIEWS_SCOPE);
|
fContextActivation= ctxService.activateContext(CUIPlugin.CVIEWS_SCOPE);
|
||||||
|
@ -247,7 +252,7 @@ public class CHViewPart extends ViewPart {
|
||||||
PlatformUI.getWorkbench().getHelpSystem().setHelp(fPagebook, ICHelpContextIds.CALL_HIERARCHY_VIEW);
|
PlatformUI.getWorkbench().getHelpSystem().setHelp(fPagebook, ICHelpContextIds.CALL_HIERARCHY_VIEW);
|
||||||
addPartListener();
|
addPartListener();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addPartListener() {
|
private void addPartListener() {
|
||||||
fPartListener= new IPartListener2() {
|
fPartListener= new IPartListener2() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -316,7 +321,7 @@ public class CHViewPart extends ViewPart {
|
||||||
}
|
}
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeActionStates() {
|
private void initializeActionStates() {
|
||||||
boolean referencedBy= true;
|
boolean referencedBy= true;
|
||||||
boolean filterVariables= false;
|
boolean filterVariables= false;
|
||||||
|
@ -391,22 +396,30 @@ public class CHViewPart extends ViewPart {
|
||||||
fViewerPage.setSize(100, 100);
|
fViewerPage.setSize(100, 100);
|
||||||
fViewerPage.setLayout(new FillLayout());
|
fViewerPage.setLayout(new FillLayout());
|
||||||
|
|
||||||
fContentProvider= new CHContentProvider(this, display);
|
fProviders = CHEProviderSettings.getCCallHierarchyContentProviders();
|
||||||
fLabelProvider= new CHLabelProvider(display, fContentProvider);
|
fLabelProviders = CHEProviderSettings.getCCallHierarchyLabelProviders();
|
||||||
|
|
||||||
|
fContentProvider= new CHContentProvider(this, display);
|
||||||
|
fLabelProvider = new CHLabelProvider(this, display, fContentProvider);
|
||||||
fTreeViewer= new ExtendedTreeViewer(fViewerPage);
|
fTreeViewer= new ExtendedTreeViewer(fViewerPage);
|
||||||
fTreeViewer.setContentProvider(fContentProvider);
|
fTreeViewer.setContentProvider(fContentProvider);
|
||||||
fTreeViewer.setLabelProvider(new DecoratingCLabelProvider(fLabelProvider));
|
fTreeViewer.setLabelProvider(new DecoratingCLabelProvider(fLabelProvider));
|
||||||
fTreeViewer.setAutoExpandLevel(2);
|
fTreeViewer.setAutoExpandLevel(2);
|
||||||
fTreeViewer.addOpenListener(new IOpenListener() {
|
fTreeViewer.addOpenListener(new IOpenListener() {
|
||||||
@Override
|
@Override
|
||||||
public void open(OpenEvent event) {
|
public void open(OpenEvent event) {
|
||||||
onShowSelectedReference(event.getSelection());
|
onShowSelectedReference(event.getSelection());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if (fProviders !=null) {
|
||||||
|
for (ICHEContentProvider provider : fProviders) {
|
||||||
|
fTreeViewer.addOpenListener(provider.getCCallHierarchyOpenListener());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createInfoPage() {
|
private void createInfoPage() {
|
||||||
fInfoText = new Label(fPagebook, SWT.TOP | SWT.LEFT | SWT.WRAP);
|
fInfoText = new Label(fPagebook, SWT.TOP | SWT.LEFT | SWT.WRAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initDragAndDrop() {
|
private void initDragAndDrop() {
|
||||||
|
@ -427,7 +440,7 @@ public class CHViewPart extends ViewPart {
|
||||||
fOpenViewActionGroup.setEnableIncludeBrowser(true);
|
fOpenViewActionGroup.setEnableIncludeBrowser(true);
|
||||||
fSelectionSearchGroup= new SelectionSearchGroup(getSite());
|
fSelectionSearchGroup= new SelectionSearchGroup(getSite());
|
||||||
fRefactoringActionGroup= new CRefactoringActionGroup(this);
|
fRefactoringActionGroup= new CRefactoringActionGroup(this);
|
||||||
|
|
||||||
fWorkingSetFilterUI= new WorkingSetFilterUI(this, fMemento, KEY_WORKING_SET_FILTER) {
|
fWorkingSetFilterUI= new WorkingSetFilterUI(this, fMemento, KEY_WORKING_SET_FILTER) {
|
||||||
@Override
|
@Override
|
||||||
protected void onWorkingSetChange() {
|
protected void onWorkingSetChange() {
|
||||||
|
@ -439,8 +452,8 @@ public class CHViewPart extends ViewPart {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
fReferencedByAction=
|
fReferencedByAction=
|
||||||
new Action(CHMessages.CHViewPart_ShowCallers_label, IAction.AS_RADIO_BUTTON) {
|
new Action(CHMessages.CHViewPart_ShowCallers_label, IAction.AS_RADIO_BUTTON) {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (isChecked()) {
|
if (isChecked()) {
|
||||||
|
@ -449,10 +462,10 @@ public class CHViewPart extends ViewPart {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
fReferencedByAction.setToolTipText(CHMessages.CHViewPart_ShowCallers_tooltip);
|
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=
|
fMakesReferenceToAction=
|
||||||
new Action(CHMessages.CHViewPart_ShowCallees_label, IAction.AS_RADIO_BUTTON) {
|
new Action(CHMessages.CHViewPart_ShowCallees_label, IAction.AS_RADIO_BUTTON) {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (isChecked()) {
|
if (isChecked()) {
|
||||||
|
@ -461,7 +474,7 @@ public class CHViewPart extends ViewPart {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
fMakesReferenceToAction.setToolTipText(CHMessages.CHViewPart_ShowCallees_tooltip);
|
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() {
|
fVariableFilter= new ViewerFilter() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -484,7 +497,7 @@ public class CHViewPart extends ViewPart {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
fFilterVariablesAction.setToolTipText(CHMessages.CHViewPart_FilterVariables_tooltip);
|
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();
|
fSorterAlphaNumeric= new ViewerComparator();
|
||||||
fSorterReferencePosition= new ViewerComparator() {
|
fSorterReferencePosition= new ViewerComparator() {
|
||||||
|
@ -544,8 +557,8 @@ public class CHViewPart extends ViewPart {
|
||||||
onNextOrPrevious(true);
|
onNextOrPrevious(true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
fNextAction.setToolTipText(CHMessages.CHViewPart_NextReference_tooltip);
|
fNextAction.setToolTipText(CHMessages.CHViewPart_NextReference_tooltip);
|
||||||
CPluginImages.setImageDescriptors(fNextAction, CPluginImages.T_LCL, CPluginImages.IMG_SHOW_NEXT);
|
CPluginImages.setImageDescriptors(fNextAction, CPluginImages.T_LCL, CPluginImages.IMG_SHOW_NEXT);
|
||||||
|
|
||||||
fPreviousAction = new Action(CHMessages.CHViewPart_PreviousReference_label) {
|
fPreviousAction = new Action(CHMessages.CHViewPart_PreviousReference_label) {
|
||||||
@Override
|
@Override
|
||||||
|
@ -554,7 +567,7 @@ public class CHViewPart extends ViewPart {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
fPreviousAction.setToolTipText(CHMessages.CHViewPart_PreviousReference_tooltip);
|
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) {
|
fRefreshAction = new Action(CHMessages.CHViewPart_Refresh_label) {
|
||||||
@Override
|
@Override
|
||||||
|
@ -563,7 +576,7 @@ public class CHViewPart extends ViewPart {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
fRefreshAction.setToolTipText(CHMessages.CHViewPart_Refresh_tooltip);
|
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);
|
fHistoryAction = new CHHistoryDropDownAction(this);
|
||||||
|
|
||||||
|
@ -611,7 +624,7 @@ public class CHViewPart extends ViewPart {
|
||||||
mm.add(new Separator());
|
mm.add(new Separator());
|
||||||
mm.add(fFilterVariablesAction);
|
mm.add(fFilterVariablesAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setNextNode(boolean forward) {
|
private void setNextNode(boolean forward) {
|
||||||
TreeNavigator navigator= new TreeNavigator(fTreeViewer.getTree(), CHNode.class);
|
TreeNavigator navigator= new TreeNavigator(fTreeViewer.getTree(), CHNode.class);
|
||||||
TreeItem selectedItem= navigator.getSelectedItemOrFirstOnLevel(1, forward);
|
TreeItem selectedItem= navigator.getSelectedItemOrFirstOnLevel(1, forward);
|
||||||
|
@ -643,7 +656,7 @@ public class CHViewPart extends ViewPart {
|
||||||
fNavigationDetail= 0;
|
fNavigationDetail= 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onShowSelectedReference(ISelection selection) {
|
protected void onShowSelectedReference(ISelection selection) {
|
||||||
CHNode node= selectionToNode(selection);
|
CHNode node= selectionToNode(selection);
|
||||||
if (node != null && node == fNavigationNode && node.getReferenceCount() > 0) {
|
if (node != null && node == fNavigationNode && node.getReferenceCount() > 0) {
|
||||||
|
@ -699,7 +712,7 @@ public class CHViewPart extends ViewPart {
|
||||||
fTreeViewer.setComparator(fSorterReferencePosition);
|
fTreeViewer.setComparator(fSorterReferencePosition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateDescription() {
|
private void updateDescription() {
|
||||||
String message= ""; //$NON-NLS-1$
|
String message= ""; //$NON-NLS-1$
|
||||||
if (!fShowsMessage) {
|
if (!fShowsMessage) {
|
||||||
|
@ -738,7 +751,7 @@ public class CHViewPart extends ViewPart {
|
||||||
|
|
||||||
setContentDescription(message);
|
setContentDescription(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateActionEnablement() {
|
private void updateActionEnablement() {
|
||||||
fHistoryAction.setEnabled(CallHierarchyUI.getHistoryEntries().length > 0);
|
fHistoryAction.setEnabled(CallHierarchyUI.getHistoryEntries().length > 0);
|
||||||
fNextAction.setEnabled(!fShowsMessage);
|
fNextAction.setEnabled(!fShowsMessage);
|
||||||
|
@ -749,7 +762,7 @@ public class CHViewPart extends ViewPart {
|
||||||
private void updateWorkingSetFilter(WorkingSetFilterUI filterUI) {
|
private void updateWorkingSetFilter(WorkingSetFilterUI filterUI) {
|
||||||
fContentProvider.setWorkingSetFilter(filterUI);
|
fContentProvider.setWorkingSetFilter(filterUI);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSetShowReferencedBy(boolean showReferencedBy) {
|
public void onSetShowReferencedBy(boolean showReferencedBy) {
|
||||||
if (showReferencedBy != fContentProvider.getComputeReferencedBy()) {
|
if (showReferencedBy != fContentProvider.getComputeReferencedBy()) {
|
||||||
Object input= fTreeViewer.getInput();
|
Object input= fTreeViewer.getInput();
|
||||||
|
@ -832,7 +845,7 @@ public class CHViewPart extends ViewPart {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getReferenceCount(CHNode node) {
|
private int getReferenceCount(CHNode node) {
|
||||||
if (node != null) {
|
if (node != null) {
|
||||||
CHNode parent = node.getParent();
|
CHNode parent = node.getParent();
|
||||||
|
@ -896,4 +909,18 @@ public class CHViewPart extends ViewPart {
|
||||||
boolean isPinned() {
|
boolean isPinned() {
|
||||||
return fIsPinned;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
||||||
|
}
|
23
core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/ICHENode.java
Normal file
23
core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/ICHENode.java
Normal file
|
@ -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();
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue