Skip to content

Commit 3d5ae3d

Browse files
raghucssitiloveeclipse
authored andcommitted
Hide ExpandableNode from client's label provider.
Unsafe(No type check before accessing passed model element) client's label provider can lead to ClassCastException. So we can never pass ExpandableNode to client's label provider. see #1353
1 parent 91d17af commit 3d5ae3d

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ViewerColumn.java

+7-8
Original file line numberDiff line numberDiff line change
@@ -138,17 +138,16 @@ public void setEditingSupport(EditingSupport editingSupport) {
138138
Assert.isTrue(false, "Column " + cell.getColumnIndex() + //$NON-NLS-1$
139139
" has no label provider."); //$NON-NLS-1$
140140
}
141-
labelProvider.update(cell);
142-
143-
// check if client has updated the label for this element. Otherwise use default
144-
// label provided
141+
// Set font and label for ExpandableNode. Client label provider should not
142+
// receive it.
145143
if (cell.getElement() instanceof ExpandableNode expNode) {
146144
cell.setFont(JFaceResources.getFontRegistry().getItalic(JFaceResources.DEFAULT_FONT));
147-
String text = cell.getText();
148-
if (text.isEmpty() || text.equals(expNode.toString())) {
149-
cell.setText(expNode.getLabel());
150-
}
145+
cell.setText(expNode.getLabel());
146+
return;
151147
}
148+
149+
labelProvider.update(cell);
150+
152151
}
153152

154153
/**

0 commit comments

Comments
 (0)