Skip to content

Commit 58aa636

Browse files
Fix AST-137779: Truncate long custom state names in filter menu and triage combo
Custom states with very long names caused the state filter dropdown menu to expand across the entire screen. Fix truncates display text to 50 chars (with trailing "...") in both the state filter MenuItem and the triage state ComboViewer LabelProvider. The full state name is still used internally for filtering and triage submission. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent 1b94a50 commit 58aa636

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

checkmarx-ast-eclipse-plugin/src/com/checkmarx/eclipse/views/CheckmarxView.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,13 @@ private void createResultViewPanel(Composite resultsComposite) {
626626
combo_1.setLayoutData(gd_combo_1);
627627

628628
triageStateComboViewer = new ComboViewer(triageView, SWT.READ_ONLY);
629+
triageStateComboViewer.setLabelProvider(new LabelProvider() {
630+
@Override
631+
public String getText(Object element) {
632+
String s = element instanceof String ? (String) element : super.getText(element);
633+
return s.length() > 50 ? s.substring(0, 47) + "..." : s;
634+
}
635+
});
629636
Combo combo_2 = triageStateComboViewer.getCombo();
630637
combo_2.setEnabled(true);
631638
combo_2.setData(PluginConstants.DATA_ID_KEY, PluginConstants.TRIAGE_STATE_COMBO_ID);

checkmarx-ast-eclipse-plugin/src/com/checkmarx/eclipse/views/actions/ActionFilterStatePreference.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public Menu getMenu(final Control parent) {
8989

9090
for (String customState : customStates) {
9191
MenuItem item = new MenuItem(menu, SWT.CHECK);
92-
item.setText(customState);
92+
item.setText(truncate(customState));
9393
item.setSelection(FilterState.isCustomStateSelected(customState));
9494
item.addSelectionListener(new SelectionAdapter() {
9595
@Override
@@ -127,4 +127,8 @@ public void widgetSelected(SelectionEvent e) {
127127
public Menu getMenu(final Menu parent) {
128128
return null;
129129
}
130+
131+
private static String truncate(String text) {
132+
return text.length() > 50 ? text.substring(0, 47) + "..." : text;
133+
}
130134
}

0 commit comments

Comments
 (0)