Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.ui.sdk')
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk/META-INF/MANIFEST.MF3
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk/pom.xml2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/ProvSDKMessages.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/TrustPreferencePage.java74
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/messages.properties6
5 files changed, 73 insertions, 15 deletions
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.ui.sdk/META-INF/MANIFEST.MF
index cc9e868d8..988cfdd1b 100644
--- a/bundles/org.eclipse.equinox.p2.ui.sdk/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %bundleName
Bundle-SymbolicName: org.eclipse.equinox.p2.ui.sdk;singleton:=true
-Bundle-Version: 1.2.2.qualifier
+Bundle-Version: 1.2.3.qualifier
Bundle-Activator: org.eclipse.equinox.internal.p2.ui.sdk.ProvSDKUIActivator
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -18,6 +18,7 @@ Import-Package: javax.xml.parsers,
org.eclipse.compare.structuremergeviewer;resolution:=optional,
org.eclipse.equinox.internal.p2.engine.phases,
org.eclipse.equinox.p2.core;version="[2.0.0,3.0.0)",
+ org.eclipse.equinox.internal.p2.artifact.processors.pgp,
org.eclipse.equinox.p2.engine;version="[2.0.0,3.0.0)",
org.eclipse.equinox.p2.engine.query;version="[2.0.0,3.0.0)",
org.eclipse.equinox.p2.metadata;version="[2.0.0,3.0.0)",
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/pom.xml b/bundles/org.eclipse.equinox.p2.ui.sdk/pom.xml
index 4bbc8001b..32f6d437e 100644
--- a/bundles/org.eclipse.equinox.p2.ui.sdk/pom.xml
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk/pom.xml
@@ -9,6 +9,6 @@
</parent>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.p2.ui.sdk</artifactId>
- <version>1.2.2-SNAPSHOT</version>
+ <version>1.2.3-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/ProvSDKMessages.java b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/ProvSDKMessages.java
index 4c73980f4..bf0a1956c 100644
--- a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/ProvSDKMessages.java
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/ProvSDKMessages.java
@@ -56,5 +56,8 @@ public class ProvSDKMessages extends NLS {
public static String TrustPreferencePage_userColumn;
public static String TrustPreferencePage_fileExportTitle;
public static String TrustPreferencePage_pgpIntro;
+ public static String TrustPreferencePage_fileImportTitle;
+ public static String TrustPreferencePage_addPGPKeyButtonLabel;
+ public static String TrustPreferencePage_removePGPKeyButtonLabel;
}
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/TrustPreferencePage.java b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/TrustPreferencePage.java
index 4b4c2439c..417ba2d68 100644
--- a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/TrustPreferencePage.java
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/TrustPreferencePage.java
@@ -17,6 +17,7 @@ import org.bouncycastle.bcpg.ArmoredOutputStream;
import org.bouncycastle.openpgp.PGPPublicKey;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.internal.p2.artifact.processors.pgp.PGPPublicKeyStore;
import org.eclipse.equinox.internal.p2.engine.phases.CertificateChecker;
import org.eclipse.equinox.internal.p2.ui.ProvUIActivator;
import org.eclipse.jface.dialogs.IDialogConstants;
@@ -33,6 +34,11 @@ import org.eclipse.ui.IWorkbenchPreferencePage;
public class TrustPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
+ private CertificateChecker certificateChecker;
+ private PGPPublicKeyStore trustedKeys;
+ private boolean dirty = false;
+ private TableViewer viewer;
+
public TrustPreferencePage() {
super(ProvSDKMessages.TrustPreferencePage_title);
}
@@ -51,7 +57,7 @@ public class TrustPreferencePage extends PreferencePage implements IWorkbenchPre
pgpLabel.setText(ProvSDKMessages.TrustPreferencePage_pgpIntro);
res.setLayout(new GridLayout(2, false));
- TableViewer viewer = new TableViewer(res);
+ viewer = new TableViewer(res);
viewer.getTable().setHeaderVisible(true);
viewer.setContentProvider(new ArrayContentProvider());
TableViewerColumn idColumn = new TableViewerColumn(viewer, SWT.NONE);
@@ -75,23 +81,19 @@ public class TrustPreferencePage extends PreferencePage implements IWorkbenchPre
userColumn.getColumn().setWidth(400);
userColumn.getColumn().setText(ProvSDKMessages.TrustPreferencePage_userColumn);
viewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- viewer.setInput(
- new CertificateChecker(ProvSDKUIActivator.getDefault().getProvisioningAgent()).buildPGPTrustore());
+ certificateChecker = new CertificateChecker(ProvSDKUIActivator.getDefault().getProvisioningAgent());
+ trustedKeys = certificateChecker.buildPGPTrustore();
+ viewer.setInput(trustedKeys.all());
Composite buttonComposite = createVerticalButtonBar(res);
buttonComposite.setLayoutData(new GridData(SWT.DEFAULT, SWT.BEGINNING, false, false));
Button exportButton = new Button(buttonComposite, SWT.PUSH);
exportButton.setText(ProvSDKMessages.TrustPreferencePage_export);
setVerticalButtonLayoutData(exportButton);
exportButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
- ISelection sel = viewer.getSelection();
- if (!(sel instanceof IStructuredSelection)) {
- return;
- }
- Object o = ((IStructuredSelection)sel).getFirstElement();
- if (!(o instanceof PGPPublicKey)) {
+ PGPPublicKey key = getSelectedKey();
+ if (key == null) {
return;
}
- PGPPublicKey key = (PGPPublicKey)o;
FileDialog dialog = new FileDialog(getShell(), SWT.SAVE);
dialog.setText(ProvSDKMessages.TrustPreferencePage_fileExportTitle);
dialog.setFilterExtensions(new String[] { "*.asc" }); //$NON-NLS-1$
@@ -108,11 +110,50 @@ public class TrustPreferencePage extends PreferencePage implements IWorkbenchPre
.log(new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, ex.getMessage(), ex));
}
}));
- viewer.addPostSelectionChangedListener(e -> exportButton.setEnabled(!e.getSelection().isEmpty()));
- exportButton.setEnabled(!viewer.getSelection().isEmpty());
+ Button addButton = new Button(buttonComposite, SWT.PUSH);
+ addButton.setText(ProvSDKMessages.TrustPreferencePage_addPGPKeyButtonLabel);
+ addButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
+ FileDialog dialog = new FileDialog(getShell(), SWT.OPEN);
+ dialog.setText(ProvSDKMessages.TrustPreferencePage_fileImportTitle);
+ dialog.setFilterExtensions(new String[] { "*.asc" }); //$NON-NLS-1$
+ String path = dialog.open();
+ if (path == null) {
+ return;
+ }
+ trustedKeys.add(new File(path));
+ viewer.setInput(trustedKeys.all());
+ dirty = true;
+ }));
+ setVerticalButtonLayoutData(addButton);
+ Button removeButton = new Button(buttonComposite, SWT.PUSH);
+ removeButton.setText(ProvSDKMessages.TrustPreferencePage_removePGPKeyButtonLabel);
+ removeButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
+ trustedKeys.remove(getSelectedKey());
+ viewer.setInput(trustedKeys.all());
+ dirty = true;
+ }));
+ setVerticalButtonLayoutData(removeButton);
+ viewer.addPostSelectionChangedListener(e -> {
+ exportButton.setEnabled(getSelectedKey() != null);
+ removeButton.setEnabled(getSelectedKey() != null);
+ });
+ exportButton.setEnabled(getSelectedKey() != null);
+ removeButton.setEnabled(getSelectedKey() != null);
return res;
}
+ private PGPPublicKey getSelectedKey() {
+ ISelection sel = viewer.getSelection();
+ if (!(sel instanceof IStructuredSelection)) {
+ return null;
+ }
+ Object o = ((IStructuredSelection) sel).getFirstElement();
+ if (!(o instanceof PGPPublicKey)) {
+ return null;
+ }
+ return (PGPPublicKey) o;
+ }
+
private Composite createVerticalButtonBar(Composite parent) {
// Create composite.
Composite composite = new Composite(parent, SWT.NONE);
@@ -139,4 +180,13 @@ public class TrustPreferencePage extends PreferencePage implements IWorkbenchPre
button.setLayoutData(data);
return data;
}
+
+ @Override
+ public boolean performOk() {
+ if (dirty) {
+ return certificateChecker.persistTrustedKeys(trustedKeys).isOK();
+ }
+ return true;
+ }
+
}
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/messages.properties b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/messages.properties
index 4e79e3211..0e344af3d 100644
--- a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/messages.properties
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/messages.properties
@@ -36,9 +36,13 @@ UpdateHandler_ProgressTaskName=Checking for updates...
RemediationOperation_ResolveJobName=Searching alternate solutions...
RemediationOperation_ResolveJobTask=Some items cannot be at the highest version. Searching for the highest common denominator ...
TrustPreferencePage_title=Trust
-TrustPreferencePage_export=E&xport...
+TrustPreferencePage_export=\uD83D\uDCE5 E&xport...
TrustPreferencePage_idColumn=Id
TrustPreferencePage_userColumn=User
TrustPreferencePage_fileExportTitle=Export PGP public key
+TrustPreferencePage_fileImportTitle=Import PGP public key to trust
+TrustPreferencePage_addPGPKeyButtonLabel=\u2795 &Add...
+TrustPreferencePage_removePGPKeyButtonLabel=\uD83D\uDDD1\uFE0F &Remove
+
TrustPreferencePage_pgpIntro=The following PGP public keys are considered as trusted.\n\
Artifacts that are signed and verified by one of those keys will be trusted and installed without further trust confirmation request. \ No newline at end of file

Back to the top