Skip to content

Commit ef74c44

Browse files
authored
Fix type filtering in CallHierarchy view (#2400)
- fix CallSearchResultCollector.isIgnored() method to not return false just because show all code is selected - also fix same method to not immediately return when user has selected tests only or hide tests and the test is false - fix dialog message to denote that it is a qualified type name filter and not just a name filter (e.g. can't specify a method name) - fixes #2396
1 parent 56e76d7 commit ef74c44

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/callhierarchy/CallSearchResultCollector.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2019 IBM Corporation and others.
2+
* Copyright (c) 2000, 2025 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -75,15 +75,13 @@ protected Map<String, MethodCall> createCalledMethodsData() {
7575
private boolean isIgnored(IMember enclosingElement) {
7676
String fullyQualifiedName= getTypeOfElement(enclosingElement).getFullyQualifiedName();
7777

78-
if (CallHierarchyCore.getDefault().isShowAll()) {
79-
return false;
80-
}
8178
IClasspathEntry classpathEntry= determineClassPathEntry(enclosingElement);
8279

83-
if (classpathEntry != null) {
80+
if (!CallHierarchyCore.getDefault().isShowAll() && classpathEntry != null) {
8481
boolean isTest= classpathEntry.isTest();
85-
return CallHierarchyCore.getDefault().isHideTestCode() && isTest
86-
|| CallHierarchyCore.getDefault().isShowTestCode() && !isTest;
82+
if (CallHierarchyCore.getDefault().isHideTestCode() && isTest
83+
|| CallHierarchyCore.getDefault().isShowTestCode() && !isTest)
84+
return true;
8785
}
8886
return CallHierarchyCore.getDefault().isIgnored(fullyQualifiedName);
8987
}

org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/callhierarchy/CallHierarchyMessages.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
###############################################################################
2-
# Copyright (c) 2000, 2010 IBM Corporation and others.
2+
# Copyright (c) 2000, 2025 IBM Corporation and others.
33
#
44
# This program and the accompanying materials
55
# are made available under the terms of the Eclipse Public License 2.0
@@ -68,7 +68,7 @@ FiltersDialog_ShowAllCode = Show All Code
6868
FiltersDialog_TestCodeOnly = Test Code only
6969

7070
FiltersDialog_filter= Filter Calls
71-
FiltersDialog_filterOnNames= &Name filter patterns (matching names will be hidden):
71+
FiltersDialog_filterOnNames= Qualified type &name filter patterns (matching types will be hidden):
7272
FiltersDialog_filterOnNamesSubCaption= Patterns are separated by commas (* = any string, ? = any character)
7373
FiltersDialog_maxCallDepth= &Max call depth:
7474
FiltersDialog_messageMaxCallDepthInvalid= The max call depth must be in range [1..99]

org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/callhierarchy/FiltersDialog.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2011 IBM Corporation and others.
2+
* Copyright (c) 2000, 2025 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -91,7 +91,7 @@ private void createMaxCallDepthArea(Composite parent) {
9191
fMaxCallDepth.addModifyListener(e -> validateInput());
9292

9393
GridData gridData = new GridData();
94-
gridData.widthHint = convertWidthInCharsToPixels(10);
94+
gridData.widthHint = convertWidthInCharsToPixels(12);
9595
fMaxCallDepth.setLayoutData(gridData);
9696
}
9797

@@ -130,6 +130,8 @@ private void createTestCodeArea(Composite parent) {
130130

131131
GridData gridData= new GridData();
132132
gridData.horizontalIndent= 0;
133+
gridData.horizontalSpan= 1;
134+
gridData.grabExcessHorizontalSpace= true;
133135
fShowAll.setLayoutData(gridData);
134136
fHideTest.setLayoutData(gridData);
135137
fShowTest.setLayoutData(gridData);
@@ -205,7 +207,7 @@ private void updateUIFromFilter() {
205207
fFilterOnNames.setSelection(CallHierarchy.getDefault().isFilterEnabled());
206208

207209
setSelection();
208-
210+
209211
updateEnabledState();
210212
}
211213

0 commit comments

Comments
 (0)