diff options
author | Ed Merks | 2022-01-08 09:59:26 +0000 |
---|---|---|
committer | Ed Merks | 2022-01-08 10:27:45 +0000 |
commit | e6de6537cea2115f212b6b3b1dccb5c40f6cb99e (patch) | |
tree | f11966618b09bc5ee4c03687835b468726347324 | |
parent | 87d7676bace86d4b4fca7d5834f9b9822b765ffe (diff) | |
download | rt.equinox.p2-e6de6537cea2115f212b6b3b1dccb5c40f6cb99e.tar.gz rt.equinox.p2-e6de6537cea2115f212b6b3b1dccb5c40f6cb99e.tar.xz rt.equinox.p2-e6de6537cea2115f212b6b3b1dccb5c40f6cb99e.zip |
Bug 578091 - The TrustCertificateDialog's Details... button is neverY20220109-0600Y20220108-0600I20220109-1800I20220108-1800
enabled
In the chain viewer, set the selection when the input changes so that
the details button enables according to that selection and properly
update the Details... button when the selection is a tree node with a
certificate.
Change the menu item to copy the fingerprint from "Copy fingerprint" to
"Copy Fingerprint" (because it should be title case).
Use SWT.FULL_SELECTION for the checkbox table viewer so that selecting
in any column selects the row.
Properly enable/disable the Trust button depending on whether at least
one item is check marked (rather than based on whether the selected item
is check marked).
Change-Id: I932fbba94ea93691317845efd7ab454d509bd87d
Signed-off-by: Ed Merks <ed.merks@gmail.com>
Reviewed-on: https://git.eclipse.org/r/c/equinox/rt.equinox.p2/+/189410
Tested-by: Equinox Bot <equinox-bot@eclipse.org>
2 files changed, 15 insertions, 10 deletions
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/TrustCertificateDialog.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/TrustCertificateDialog.java index f81e31ee5..5ffad2efc 100644 --- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/TrustCertificateDialog.java +++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/TrustCertificateDialog.java @@ -133,20 +133,19 @@ public class TrustCertificateDialog extends SelectionDialog { certificateChainViewer.setContentProvider(new TreeNodeContentProvider()); certificateChainViewer.setLabelProvider(new CertificateLabelProvider()); certificateChainViewer.addSelectionChangedListener(getChainSelectionListener()); + listViewer.addDoubleClickListener(getDoubleClickListener()); + listViewer.addSelectionChangedListener(getParentSelectionListener()); + createButtons(composite); if (inputElement instanceof Object[]) { ISelection selection = null; Object[] nodes = (Object[]) inputElement; if (nodes.length > 0) { selection = new StructuredSelection(nodes[0]); certificateChainViewer.setInput(new TreeNode[] { (TreeNode) nodes[0] }); - selectedCertificate = nodes[0]; + certificateChainViewer.setSelection(selection); } listViewer.setSelection(selection); } - listViewer.addDoubleClickListener(getDoubleClickListener()); - listViewer.addSelectionChangedListener(getParentSelectionListener()); - createButtons(composite); - detailsButton.setEnabled(selectedCertificate instanceof X509Certificate); return composite; } @@ -241,7 +240,7 @@ public class TrustCertificateDialog extends SelectionDialog { initializeDialogUnits(composite); createMessageArea(composite); - listViewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER); + listViewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER | SWT.FULL_SELECTION); GridData data = new GridData(GridData.FILL_BOTH); data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT; data.widthHint = SIZING_SELECTION_WIDGET_WIDTH; @@ -352,7 +351,8 @@ public class TrustCertificateDialog extends SelectionDialog { ISelection selection = event.getSelection(); if (selection instanceof StructuredSelection) { selectedCertificate = ((StructuredSelection) selection).getFirstElement(); - detailsButton.setEnabled(selectedCertificate instanceof X509Certificate); + detailsButton.setEnabled(selectedCertificate instanceof TreeNode + && ((TreeNode) selectedCertificate).getValue() instanceof X509Certificate); } }; } @@ -383,8 +383,13 @@ public class TrustCertificateDialog extends SelectionDialog { if (selection instanceof StructuredSelection) { TreeNode firstElement = (TreeNode) ((StructuredSelection) selection).getFirstElement(); getCertificateChainViewer().setInput(new TreeNode[] { firstElement }); - getOkButton().setEnabled(listViewer.getChecked(firstElement)); - getCertificateChainViewer().refresh(); + if (firstElement.getValue() instanceof X509Certificate) { + getCertificateChainViewer().setSelection(new StructuredSelection(firstElement)); + } + Button okButton = getOkButton(); + if (okButton != null) { + okButton.setEnabled(listViewer.getCheckedElements().length > 0); + } } }; } diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/messages.properties b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/messages.properties index 8d84b0c40..a26826e94 100644 --- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/messages.properties +++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/messages.properties @@ -288,7 +288,7 @@ TrustCertificateDialog_DeselectAll=&Deselect All TrustCertificateDialog_ObjectType=Type TrustCertificateDialog_Id=Id/Fingerprint TrustCertificateDialog_Name=Name \u26A0\uFE0F This is not trustworthy until key/certificate is verified -TrustCertificateDialog_CopyFingerprint=Copy fingerprint +TrustCertificateDialog_CopyFingerprint=Copy Fingerprint TrustCertificateDialog_dates=Validity Dates TrustCertificateDialog_NotYetValidStartDate=\u274C Not yet valid, starts {0} TrustCertificateDialog_expiredSince=\u274C Expired since {0} |