Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2017-11-13 10:09:01 +0000
committerAlexander Kurtakov2017-11-13 10:09:01 +0000
commitf68db27188c6f5610399784ae5df94e5802923e2 (patch)
tree07df7086e90186ff3aa048f1d4c9108c009c1fde
parent8c91969bdfda8d282f2d1af2785523035567f7cf (diff)
downloadrt.equinox.bundles-f68db27188c6f5610399784ae5df94e5802923e2.tar.gz
rt.equinox.bundles-f68db27188c6f5610399784ae5df94e5802923e2.tar.xz
rt.equinox.bundles-f68db27188c6f5610399784ae5df94e5802923e2.zip
Bug 527182 - Move security.ui bundle to Java 8
* Bump BREE. * Bump minor version. * Enable warnings for new Java constructs. * Use lambdas. * Generify. Change-Id: I38169422f749412aaf13893a2223f0135a8e5760 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--bundles/org.eclipse.equinox.security.ui/.classpath4
-rw-r--r--bundles/org.eclipse.equinox.security.ui/.settings/org.eclipse.jdt.core.prefs20
-rw-r--r--bundles/org.eclipse.equinox.security.ui/META-INF/MANIFEST.MF4
-rw-r--r--bundles/org.eclipse.equinox.security.ui/pom.xml2
-rw-r--r--bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/provisional/security/ui/X500PrincipalHelper.java27
-rw-r--r--bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/Activator.java49
-rw-r--r--bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/ConfirmationDialog.java25
-rw-r--r--bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/SecurityConfigurationSection.java60
-rw-r--r--bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/SecurityStatusControl.java29
-rw-r--r--bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/X509CertificateAttributeContentProvider.java13
-rw-r--r--bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/ChallengeResponseDialog.java16
-rw-r--r--bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/DefaultPasswordProvider.java20
-rw-r--r--bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/PasswordRecoveryDialog.java10
-rw-r--r--bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/StorageLoginDialog.java17
-rw-r--r--bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/StoragePreferencePage.java20
-rw-r--r--bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/TabAdvanced.java6
-rw-r--r--bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/TabContents.java34
-rw-r--r--bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/TabPassword.java12
-rw-r--r--bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/UICallbackProvider.java40
-rw-r--r--bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/view/ExportDialog.java9
-rw-r--r--bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/view/NewNodeDialog.java10
-rw-r--r--bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/view/NewValueDialog.java10
-rw-r--r--bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/view/NodesView.java45
-rw-r--r--bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/view/ValuesView.java72
-rw-r--r--bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/wizard/CertificateImportCertSelectPage.java10
-rw-r--r--bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/wizard/CertificateImportFileSelectPage.java11
-rw-r--r--bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/wizard/CertificateImportTrustEngineSelectPage.java6
27 files changed, 239 insertions, 342 deletions
diff --git a/bundles/org.eclipse.equinox.security.ui/.classpath b/bundles/org.eclipse.equinox.security.ui/.classpath
index ce7393340..eca7bdba8 100644
--- a/bundles/org.eclipse.equinox.security.ui/.classpath
+++ b/bundles/org.eclipse.equinox.security.ui/.classpath
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/bundles/org.eclipse.equinox.security.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.security.ui/.settings/org.eclipse.jdt.core.prefs
index 1bce9dbe8..e9d1abe57 100644
--- a/bundles/org.eclipse.equinox.security.ui/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.equinox.security.ui/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,3 @@
-#Tue Jan 29 15:26:50 EST 2008
eclipse.preferences.version=1
instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
@@ -8,24 +7,24 @@ org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
org.eclipse.jdt.core.circularClasspath=error
org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=error
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
@@ -72,7 +71,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=en
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
@@ -144,7 +143,12 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
org.eclipse.jdt.core.formatter.indentation.size=4
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
diff --git a/bundles/org.eclipse.equinox.security.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.security.ui/META-INF/MANIFEST.MF
index e1fc5c829..3df733c29 100644
--- a/bundles/org.eclipse.equinox.security.ui/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.security.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.equinox.security.ui;singleton:=true
-Bundle-Version: 1.1.400.qualifier
+Bundle-Version: 1.2.0.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Import-Package: javax.crypto.spec,
@@ -27,5 +27,5 @@ Export-Package: org.eclipse.equinox.internal.provisional.security.ui;version="1.
org.eclipse.equinox.internal.security.ui.storage;x-internal:=true,
org.eclipse.equinox.internal.security.ui.storage.view;x-internal:=true,
org.eclipse.equinox.internal.security.ui.wizard;x-internal:=true
-Bundle-RequiredExecutionEnvironment: J2SE-1.4
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
diff --git a/bundles/org.eclipse.equinox.security.ui/pom.xml b/bundles/org.eclipse.equinox.security.ui/pom.xml
index 54aaba41d..7c3a02d84 100644
--- a/bundles/org.eclipse.equinox.security.ui/pom.xml
+++ b/bundles/org.eclipse.equinox.security.ui/pom.xml
@@ -21,7 +21,7 @@
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.security.ui</artifactId>
- <version>1.1.400-SNAPSHOT</version>
+ <version>1.2.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/provisional/security/ui/X500PrincipalHelper.java b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/provisional/security/ui/X500PrincipalHelper.java
index 55591ec99..5c936dc21 100644
--- a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/provisional/security/ui/X500PrincipalHelper.java
+++ b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/provisional/security/ui/X500PrincipalHelper.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, Jay Rosenthal and others.
+ * Copyright (c) 2008, 2017 Jay Rosenthal and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -12,8 +12,7 @@
package org.eclipse.equinox.internal.provisional.security.ui;
-import java.util.ArrayList;
-import java.util.Iterator;
+import java.util.*;
import javax.security.auth.x500.X500Principal;
/**
@@ -44,7 +43,7 @@ public class X500PrincipalHelper {
public final static String attrEMAIL = "EMAILADDRESS"; //$NON-NLS-1$
public final static String attrUID = "UID"; //$NON-NLS-1$
- ArrayList rdnNameArray = new ArrayList();
+ ArrayList<List<String>> rdnNameArray = new ArrayList<>();
private final static String attrTerminator = "="; //$NON-NLS-1$
@@ -187,7 +186,7 @@ public class X500PrincipalHelper {
private void parseDN(String dn) throws IllegalArgumentException {
int startIndex = 0;
char c = '\0';
- ArrayList nameValues = new ArrayList();
+ ArrayList<String> nameValues = new ArrayList<>();
// Clear the existing array, in case this instance is being re-used
rdnNameArray.clear();
@@ -211,7 +210,7 @@ public class X500PrincipalHelper {
if (c != '+') {
rdnNameArray.add(nameValues);
if (endIndex != dn.length())
- nameValues = new ArrayList();
+ nameValues = new ArrayList<>();
else
nameValues = null;
}
@@ -231,13 +230,13 @@ public class X500PrincipalHelper {
* the order they occur. May be empty.
*
*/
- public ArrayList getAllValues(String attributeID) {
- ArrayList retList = new ArrayList();
+ public ArrayList<String> getAllValues(String attributeID) {
+ ArrayList<String> retList = new ArrayList<>();
String searchPart = attributeID + attrTerminator;
- for (Iterator iter = rdnNameArray.iterator(); iter.hasNext();) {
- ArrayList nameList = (ArrayList) iter.next();
- String namePart = (String) nameList.get(0);
+ for (Iterator<List<String>> iter = rdnNameArray.iterator(); iter.hasNext();) {
+ List<String> nameList = iter.next();
+ String namePart = nameList.get(0);
if (namePart.startsWith(searchPart)) {
// Return the string starting after the ID string and the = sign that follows it.
@@ -257,9 +256,9 @@ public class X500PrincipalHelper {
String retNamePart = null;
String searchPart = attributeID + attrTerminator;
- for (Iterator iter = rdnNameArray.iterator(); iter.hasNext();) {
- ArrayList nameList = (ArrayList) iter.next();
- String namePart = (String) nameList.get(0);
+ for (Iterator<List<String>> iter = rdnNameArray.iterator(); iter.hasNext();) {
+ List<String> nameList = iter.next();
+ String namePart = nameList.get(0);
if (namePart.startsWith(searchPart)) {
// Return the string starting after the ID string and the = sign that follows it.
diff --git a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/Activator.java b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/Activator.java
index 4323fc224..efc328a87 100644
--- a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/Activator.java
+++ b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/Activator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.equinox.internal.security.ui;
-import java.util.Arrays;
import java.util.Hashtable;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -39,18 +38,18 @@ public class Activator extends AbstractUIPlugin {
private static final String PROP_DEFAULT_SERVICE = "org.eclipse.osgi"; //$NON-NLS-1$
//service trackers
- private static ServiceTracker trustEngineTracker;
- private static ServiceTracker authzEngineTracker;
- private static ServiceTracker authzManagerTracker;
- private static ServiceTracker platformAdminTracker;
- private static ServiceTracker debugTracker;
+ private static ServiceTracker<?, TrustEngine> trustEngineTracker;
+ private static ServiceTracker<?, AuthorizationEngine> authzEngineTracker;
+ private static ServiceTracker<?, AuthorizationManager> authzManagerTracker;
+ private static ServiceTracker<?, PlatformAdmin> platformAdminTracker;
+ private static ServiceTracker<?, DebugOptions> debugTracker;
// The shared plug-in instance
private static Activator plugin;
// The bundle context
private static BundleContext bundleContext;
- private ServiceRegistration defaultAuthzManagerReg;
+ private ServiceRegistration<AuthorizationManager> defaultAuthzManagerReg;
// debug tracing
private static final String OPTION_DEBUG = "org.eclipse.equinox.security.ui/debug"; //$NON-NLS-1$;
@@ -84,10 +83,10 @@ public class Activator extends AbstractUIPlugin {
plugin = this;
// Register the default authorization manager
- Hashtable properties = new Hashtable(7);
+ Hashtable<String, Object> properties = new Hashtable<>(7);
properties.put(Constants.SERVICE_RANKING, new Integer(Integer.MIN_VALUE));
properties.put(PROP_AUTHZ_MANAGER, PROP_DEFAULT_SERVICE);
- defaultAuthzManagerReg = bundleContext.registerService(AuthorizationManager.class.getName(), new DefaultAuthorizationManager(), properties);
+ defaultAuthzManagerReg = bundleContext.registerService(AuthorizationManager.class, new DefaultAuthorizationManager(), properties);
}
public void stop(BundleContext context) throws Exception {
@@ -132,16 +131,12 @@ public class Activator extends AbstractUIPlugin {
// do nothing just use no filter TODO we may want to log something
}
if (filter != null) {
- trustEngineTracker = new ServiceTracker(bundleContext, filter, null);
+ trustEngineTracker = new ServiceTracker<>(bundleContext, filter, null);
} else
- trustEngineTracker = new ServiceTracker(bundleContext, TrustEngine.class.getName(), null);
+ trustEngineTracker = new ServiceTracker<>(bundleContext, TrustEngine.class, null);
trustEngineTracker.open();
}
- Object[] services = trustEngineTracker.getServices();
- if (services != null) {
- return (TrustEngine[]) Arrays.asList(services).toArray(new TrustEngine[] {});
- }
- return new TrustEngine[0];
+ return trustEngineTracker.getServices(new TrustEngine[] {});
}
public static AuthorizationEngine getAuthorizationEngine() {
@@ -155,13 +150,13 @@ public class Activator extends AbstractUIPlugin {
//TODO:log the error
}
if (filter != null) {
- authzEngineTracker = new ServiceTracker(Activator.getBundleContext(), filter, null);
+ authzEngineTracker = new ServiceTracker<>(Activator.getBundleContext(), filter, null);
} else {
- authzEngineTracker = new ServiceTracker(Activator.getBundleContext(), AuthorizationEngine.class.getName(), null);
+ authzEngineTracker = new ServiceTracker<>(Activator.getBundleContext(), AuthorizationEngine.class, null);
}
authzEngineTracker.open();
}
- return (AuthorizationEngine) authzEngineTracker.getService();
+ return authzEngineTracker.getService();
}
public static AuthorizationManager getAuthorizationManager() {
@@ -175,21 +170,21 @@ public class Activator extends AbstractUIPlugin {
//TODO:log the error
}
if (filter != null) {
- authzManagerTracker = new ServiceTracker(Activator.getBundleContext(), filter, null);
+ authzManagerTracker = new ServiceTracker<>(Activator.getBundleContext(), filter, null);
} else {
- authzManagerTracker = new ServiceTracker(Activator.getBundleContext(), AuthorizationManager.class.getName(), null);
+ authzManagerTracker = new ServiceTracker<>(Activator.getBundleContext(), AuthorizationManager.class, null);
}
authzManagerTracker.open();
}
- return (AuthorizationManager) authzManagerTracker.getService();
+ return authzManagerTracker.getService();
}
public static PlatformAdmin getPlatformAdmin() {
if (platformAdminTracker == null) {
- platformAdminTracker = new ServiceTracker(Activator.getBundleContext(), PlatformAdmin.class.getName(), null);
+ platformAdminTracker = new ServiceTracker<>(Activator.getBundleContext(), PlatformAdmin.class, null);
platformAdminTracker.open();
}
- return (PlatformAdmin) platformAdminTracker.getService();
+ return platformAdminTracker.getService();
}
/**
@@ -215,10 +210,10 @@ public class Activator extends AbstractUIPlugin {
public DebugOptions getDebugOptions() {
if (debugTracker == null) {
- debugTracker = new ServiceTracker(bundleContext, DebugOptions.class.getName(), null);
+ debugTracker = new ServiceTracker<>(bundleContext, DebugOptions.class, null);
debugTracker.open();
}
- return (DebugOptions) debugTracker.getService();
+ return debugTracker.getService();
}
public boolean debugStorageContents() {
diff --git a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/ConfirmationDialog.java b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/ConfirmationDialog.java
index debf5fe6f..bfbbcab2c 100644
--- a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/ConfirmationDialog.java
+++ b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/ConfirmationDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,8 +14,7 @@ import java.security.cert.Certificate;
import org.eclipse.equinox.internal.security.ui.wizard.CertificateViewer;
import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.*;
@@ -50,19 +49,15 @@ public class ConfirmationDialog extends TitleAreaDialog {
protected void createButtonsForButtonBar(Composite parent) {
Button yesBtn = createButton(parent, YES, SecurityUIMsg.CONFIRMATION_DIALGO_YES, true);
- yesBtn.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- setReturnCode(YES);
- close();
- }
- });
+ yesBtn.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
+ setReturnCode(YES);
+ close();
+ }));
Button noBtn = createButton(parent, NO, SecurityUIMsg.CONFIRMATION_DIALGO_NO, false);
- noBtn.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- setReturnCode(NO);
- close();
- }
- });
+ noBtn.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
+ setReturnCode(NO);
+ close();
+ }));
}
}
diff --git a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/SecurityConfigurationSection.java b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/SecurityConfigurationSection.java
index 6a5018256..f42857ec2 100644
--- a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/SecurityConfigurationSection.java
+++ b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/SecurityConfigurationSection.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2016 IBM Corporation and others.
+ * Copyright (c) 2008, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -46,36 +46,36 @@ public class SecurityConfigurationSection implements ISystemSummarySection {
private void appendService(PrintWriter writer, ProviderService service, int index) {
writer.println(" Service: " + service.getType() + ", Algorithm: " + service.getAlgorithm() + ", Class: " + service.getClassName()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- List aliases = service.getAliases();
+ List<String> aliases = service.getAliases();
if (null != aliases && (0 < aliases.size())) {
writer.print(" Aliases: "); //$NON-NLS-1$
- for (Iterator it = aliases.iterator(); it.hasNext();) {
- writer.print((String) it.next());
+ for (Iterator<String> it = aliases.iterator(); it.hasNext();) {
+ writer.print(it.next());
if (it.hasNext()) {
writer.print(", "); //$NON-NLS-1$
}
}
writer.println();
}
- Map attributes = service.getAttributes();
+ Map<String, String> attributes = service.getAttributes();
if ((null != attributes) && (0 < attributes.size())) {
writer.println(" Attributes:"); //$NON-NLS-1$
- for (Iterator it = attributes.entrySet().iterator(); it.hasNext();) {
- Entry entry = (Entry) it.next();
- String key = (String) entry.getKey();
+ for (Iterator<Entry<String, String>> it = attributes.entrySet().iterator(); it.hasNext();) {
+ Entry<String, String> entry = it.next();
+ String key = entry.getKey();
writer.print(" " + key + ": "); //$NON-NLS-1$//$NON-NLS-2$
- writer.println((String) entry.getValue());
+ writer.println(entry.getValue());
}
}
}
private static ProviderService[] getServices(Provider provider) {
- Hashtable serviceList = new Hashtable();
- Hashtable attributeMap = new Hashtable(); // "type" => "Hashtable of (attribute,value) pairs"
- Hashtable aliasMap = new Hashtable(); // "type" => "Arraylist of aliases"
- for (Iterator it = provider.entrySet().iterator(); it.hasNext();) {
- Entry entry = (Entry) it.next();
+ Hashtable<String, String> serviceList = new Hashtable<>();
+ Hashtable<String, Hashtable<String, String>> attributeMap = new Hashtable<>(); // "type" => "Hashtable of (attribute,value) pairs"
+ Hashtable<String, List<String>> aliasMap = new Hashtable<>(); // "type" => "Arraylist of aliases"
+ for (Iterator<Entry<Object, Object>> it = provider.entrySet().iterator(); it.hasNext();) {
+ Entry<Object, Object> entry = it.next();
String key = (String) entry.getKey();
// this is provider info, available off the Provider API
@@ -89,9 +89,9 @@ public class SecurityConfigurationSection implements ISystemSummarySection {
String type = (String) entry.getValue();
String algo = value.substring(0, value.indexOf('.'));
String alias = value.substring(value.indexOf('.') + 1, value.length());
- ArrayList aliasList = (ArrayList) aliasMap.get(type + '.' + algo);
+ List<String> aliasList = aliasMap.get(type + '.' + algo);
if (aliasList == null) {
- aliasList = new ArrayList();
+ aliasList = new ArrayList<>();
aliasList.add(alias);
aliasMap.put(type, aliasList);
} else {
@@ -105,9 +105,9 @@ public class SecurityConfigurationSection implements ISystemSummarySection {
String algorithm = key.substring(key.indexOf('.') + 1, key.indexOf(' '));
String attribute = key.substring(key.indexOf(' ') + 1, key.length());
String value = (String) provider.get(key);
- Hashtable attributeTable = (Hashtable) attributeMap.get(type + '.' + algorithm);
+ Hashtable<String, String> attributeTable = attributeMap.get(type + '.' + algorithm);
if (attributeTable == null) {
- attributeTable = new Hashtable();
+ attributeTable = new Hashtable<>();
attributeTable.put(attribute, value);
attributeMap.put(type + '.' + algorithm, attributeTable);
} else {
@@ -117,20 +117,20 @@ public class SecurityConfigurationSection implements ISystemSummarySection {
// else this is a service
else {
- serviceList.put(key, provider.get(key));
+ serviceList.put(key, (String) provider.get(key));
}
}
ProviderService[] serviceArray = new ProviderService[serviceList.size()];
int serviceCount = 0;
- for (Iterator it = serviceList.entrySet().iterator(); it.hasNext();) {
- Entry entry = (Entry) it.next();
- String key = (String) entry.getKey();
+ for (Iterator<Entry<String, String>> it = serviceList.entrySet().iterator(); it.hasNext();) {
+ Entry<String, String> entry = it.next();
+ String key = entry.getKey();
String type = key.substring(0, key.indexOf('.'));
String algo = key.substring(key.indexOf('.') + 1, key.length());
- String className = (String) entry.getValue();
- List aliases = (List) aliasMap.get(algo);
- Map attributes = (Map) attributeMap.get(key);
+ String className = entry.getValue();
+ List<String> aliases = aliasMap.get(algo);
+ Hashtable<String, String> attributes = attributeMap.get(key);
serviceArray[serviceCount] = new ProviderService(type, algo, className, aliases, attributes);
serviceCount++;
@@ -143,10 +143,10 @@ public class SecurityConfigurationSection implements ISystemSummarySection {
private final String type;
private final String algorithm;
private final String className;
- private final List aliases;
- private final Map attributes;
+ private final List<String> aliases;
+ private final Map<String, String> attributes;
- public ProviderService(String type, String algorithm, String className, List aliases, Map attributes) {
+ public ProviderService(String type, String algorithm, String className, List<String> aliases, Map<String, String> attributes) {
this.type = type;
this.algorithm = algorithm;
this.className = className;
@@ -166,11 +166,11 @@ public class SecurityConfigurationSection implements ISystemSummarySection {
return className;
}
- public List getAliases() {
+ public List<String> getAliases() {
return aliases;
}
- public Map getAttributes() {
+ public Map<String, String> getAttributes() {
return attributes;
}
}
diff --git a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/SecurityStatusControl.java b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/SecurityStatusControl.java
index 11abdff9b..3f2a0673f 100644
--- a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/SecurityStatusControl.java
+++ b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/SecurityStatusControl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -17,8 +17,6 @@ import org.eclipse.jface.action.ControlContribution;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.*;
import org.eclipse.ui.IWorkbenchWindow;
@@ -81,19 +79,6 @@ public class SecurityStatusControl extends ControlContribution {
label = new CLabel(parent, SWT.NONE);
label.setImage(getIcon(currentState));
- label.addMouseListener(new MouseListener() {
- public void mouseDoubleClick(MouseEvent e) {
- //TODO: handleActionInvoked();
- }
-
- public void mouseDown(MouseEvent e) {
- //nothing yet
- }
-
- public void mouseUp(MouseEvent e) {
- //nothing yet
- }
- });
Job updateJob = new Job(ID) {
public IStatus run(IProgressMonitor monitor) {
@@ -102,13 +87,11 @@ public class SecurityStatusControl extends ControlContribution {
if (!currentState.equals(newState)) {
final Display display = getDisplay(window);
if (null != display)
- display.asyncExec(new Runnable() {
- public void run() {
- if (!label.isDisposed()) {
- Image oldIcon = label.getImage();
- label.setImage(getIcon(currentState));
- oldIcon.dispose();
- }
+ display.asyncExec(() -> {
+ if (!label.isDisposed()) {
+ Image oldIcon = label.getImage();
+ label.setImage(getIcon(currentState));
+ oldIcon.dispose();
}
});
currentState = newState;
diff --git a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/X509CertificateAttributeContentProvider.java b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/X509CertificateAttributeContentProvider.java
index a34f9c5c0..6a08e5356 100644
--- a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/X509CertificateAttributeContentProvider.java
+++ b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/X509CertificateAttributeContentProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, Jay Rosenthal
+ * Copyright (c) 2008, 2017 Jay Rosenthal and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -43,7 +43,7 @@ public class X509CertificateAttributeContentProvider implements IStructuredConte
private static String LABEL_KEYUSAGE_ENCIPHERONLY = "encipherOnly"; //$NON-NLS-1$
private static String LABEL_KEYUSAGE_DECIPHERONLY = "decipherOnly"; //$NON-NLS-1$
- private ArrayList elements = new ArrayList();
+ private ArrayList<X509CertificateAttribute> elements = new ArrayList<>();
private Viewer viewer = null;
private static String listDelim = ", "; //$NON-NLS-1$
@@ -138,9 +138,8 @@ public class X509CertificateAttributeContentProvider implements IStructuredConte
X509CertificateAttribute pubKeyInfoItem = new X509CertificateAttribute(SecurityUIMsg.CERTPROP_X509_THMBPRINTX509_PUBKEY_INFO, getHex(pubKey.getEncoded()));
elements.add(pubKeyInfoItem);
- Collection subAltNamesVctr;
try {
- subAltNamesVctr = theCert.getSubjectAlternativeNames();
+ Collection<List<?>> subAltNamesVctr = theCert.getSubjectAlternativeNames();
// StringBuffer bfrSubAltNames = new StringBuffer();
if (subAltNamesVctr != null && subAltNamesVctr.size() > 0) {
@@ -173,13 +172,13 @@ public class X509CertificateAttributeContentProvider implements IStructuredConte
X509CertificateAttribute basicConstraints = new X509CertificateAttribute(SecurityUIMsg.CERTPROP_X509_BASIC_CNSTRNTS, (basicCnstrntsBfr.toString()).substring(0, basicCnstrntsBfr.length() - 2), basicConstraint);
elements.add(basicConstraints);
- List exKeyUsg;
+ List<String> exKeyUsg;
try {
exKeyUsg = theCert.getExtendedKeyUsage();
StringBuffer exKeyUsgBfr = new StringBuffer();
if (exKeyUsg != null && exKeyUsg.size() > 0) {
- for (Iterator exKeyUsgIter = exKeyUsg.iterator(); exKeyUsgIter.hasNext();) {
- exKeyUsgBfr.append(((String) exKeyUsgIter.next()) + listDelim);
+ for (Iterator<String> exKeyUsgIter = exKeyUsg.iterator(); exKeyUsgIter.hasNext();) {
+ exKeyUsgBfr.append((exKeyUsgIter.next()) + listDelim);
}
X509CertificateAttribute exKeyUsgProp = new X509CertificateAttribute(SecurityUIMsg.CERTPROP_X509_EXKEY_USAGE, (exKeyUsgBfr.toString()).substring(0, exKeyUsgBfr.length() - 2), theCert.getExtendedKeyUsage());
diff --git a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/ChallengeResponseDialog.java b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/ChallengeResponseDialog.java
index 14e041587..4933fb3ae 100644
--- a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/ChallengeResponseDialog.java
+++ b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/ChallengeResponseDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -15,8 +15,6 @@ import org.eclipse.jface.dialogs.*;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
@@ -81,20 +79,12 @@ public class ChallengeResponseDialog extends TitleAreaDialog {
new Label(group, SWT.LEFT).setText(SecUIMessages.passwordQuestion);
questions[i] = new Text(group, SWT.LEFT | SWT.BORDER);
questions[i].setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
- questions[i].addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent event) {
- validateOK();
- }
- });
+ questions[i].addModifyListener(event -> validateOK());
new Label(group, SWT.LEFT).setText(SecUIMessages.passwordAnswer);
answers[i] = new Text(group, SWT.LEFT | SWT.BORDER);
answers[i].setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
- answers[i].addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent event) {
- validateOK();
- }
- });
+ answers[i].addModifyListener(event -> validateOK());
}
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
diff --git a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/DefaultPasswordProvider.java b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/DefaultPasswordProvider.java
index 4acee60e8..71123c164 100644
--- a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/DefaultPasswordProvider.java
+++ b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/DefaultPasswordProvider.java
@@ -44,13 +44,11 @@ public class DefaultPasswordProvider extends PasswordProvider {
final StorageLoginDialog loginDialog = new StorageLoginDialog(newPassword, passwordChange, location);
final PBEKeySpec[] result = new PBEKeySpec[1];
- PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
- public void run() {
- if (loginDialog.open() == Window.OK)
- result[0] = loginDialog.getGeneratedPassword();
- else
- result[0] = null;
- }
+ PlatformUI.getWorkbench().getDisplay().syncExec(() -> {
+ if (loginDialog.open() == Window.OK)
+ result[0] = loginDialog.getGeneratedPassword();
+ else
+ result[0] = null;
});
return result[0];
}
@@ -60,11 +58,9 @@ public class DefaultPasswordProvider extends PasswordProvider {
return false;
final Boolean[] result = new Boolean[1];
- PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
- public void run() {
- boolean reply = MessageDialog.openConfirm(StorageUtils.getShell(), SecUIMessages.exceptionTitle, SecUIMessages.exceptionDecode);
- result[0] = Boolean.valueOf(reply);
- }
+ PlatformUI.getWorkbench().getDisplay().syncExec(() -> {
+ boolean reply = MessageDialog.openConfirm(StorageUtils.getShell(), SecUIMessages.exceptionTitle, SecUIMessages.exceptionDecode);
+ result[0] = Boolean.valueOf(reply);
});
return result[0].booleanValue();
}
diff --git a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/PasswordRecoveryDialog.java b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/PasswordRecoveryDialog.java
index 64d46769d..d41df0506 100644
--- a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/PasswordRecoveryDialog.java
+++ b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/PasswordRecoveryDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -17,8 +17,6 @@ import org.eclipse.jface.dialogs.*;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
@@ -74,11 +72,7 @@ public class PasswordRecoveryDialog extends TitleAreaDialog {
new Label(group, SWT.LEFT).setText(question);
answers[i] = new Text(group, SWT.LEFT | SWT.BORDER);
answers[i].setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
- answers[i].addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent event) {
- validateOK();
- }
- });
+ answers[i].addModifyListener(event -> validateOK());
}
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
diff --git a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/StorageLoginDialog.java b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/StorageLoginDialog.java
index 9e2ed6268..89924df8f 100644
--- a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/StorageLoginDialog.java
+++ b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/StorageLoginDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -22,7 +22,8 @@ import org.eclipse.jface.dialogs.*;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -113,20 +114,12 @@ public class StorageLoginDialog extends TitleAreaDialog {
new Label(composite, SWT.LEFT).setText(SecUIMessages.labelPassword);
password = new Text(composite, SWT.LEFT | SWT.BORDER);
- password.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent event) {
- okButton.setEnabled(validatePassword());
- }
- });
+ password.addModifyListener(event -> okButton.setEnabled(validatePassword()));
if (confirmPassword) {
new Label(composite, SWT.LEFT).setText(SecUIMessages.labelConfirm);
confirm = new Text(composite, SWT.LEFT | SWT.BORDER);
- confirm.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent event) {
- okButton.setEnabled(validatePassword());
- }
- });
+ confirm.addModifyListener(event -> okButton.setEnabled(validatePassword()));
} else
confirm = null;
diff --git a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/StoragePreferencePage.java b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/StoragePreferencePage.java
index 8168ec7a1..df5cd75e4 100644
--- a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/StoragePreferencePage.java
+++ b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/StoragePreferencePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -13,7 +13,6 @@ package org.eclipse.equinox.internal.security.ui.storage;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.*;
@@ -48,18 +47,11 @@ public class StoragePreferencePage extends PreferencePage implements IWorkbenchP
advancedTab = new TabAdvanced(folder, 2, getShell());
folder.setSelection(0);
- folder.addSelectionListener(new SelectionListener() {
-
- public void widgetDefaultSelected(SelectionEvent e) {
- // nothing to do
- }
-
- public void widgetSelected(SelectionEvent e) {
- int i = folder.getSelectionIndex();
- if (i == 0 && passwordTab != null) // password page
- passwordTab.onActivated();
- }
- });
+ folder.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
+ int i = folder.getSelectionIndex();
+ if (i == 0 && passwordTab != null) // password page
+ passwordTab.onActivated();
+ }));
Dialog.applyDialogFont(folder);
PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), HELP_ID);
return folder;
diff --git a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/TabAdvanced.java b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/TabAdvanced.java
index 4256cc55b..ed4a1762c 100644
--- a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/TabAdvanced.java
+++ b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/TabAdvanced.java
@@ -28,7 +28,7 @@ public class TabAdvanced {
private static final String PREFERENCES_PLUGIN = "org.eclipse.equinox.security"; //$NON-NLS-1$
- private Map availableCiphers = null;
+ private Map<String, ?> availableCiphers = null;
private Combo cipherSelector = null;
private IEclipsePreferences eclipseNode = null;
@@ -55,8 +55,8 @@ public class TabAdvanced {
// fill cipher selector
int position = 0;
- for (Iterator i = availableCiphers.keySet().iterator(); i.hasNext();) {
- String cipherAlgorithm = (String) i.next();
+ for (Iterator<String> i = availableCiphers.keySet().iterator(); i.hasNext();) {
+ String cipherAlgorithm = i.next();
cipherSelector.add(cipherAlgorithm, position);
if (defaultCipherAlgorithm.equals(cipherAlgorithm))
cipherSelector.select(position);
diff --git a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/TabContents.java b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/TabContents.java
index 8ec84583b..a926d408e 100644
--- a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/TabContents.java
+++ b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/TabContents.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 IBM Corporation and others.
+ * Copyright (c) 2008, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -23,8 +23,7 @@ import org.eclipse.equinox.security.storage.*;
import org.eclipse.jface.layout.*;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
@@ -79,20 +78,17 @@ public class TabContents implements ISecurePreferencesSelection, IDeleteListener
buttonSave = new Button(buttonBar, SWT.PUSH);
buttonSave.setText(SecUIMessages.saveButton);
setButtonSize(buttonSave);
- buttonSave.addSelectionListener(new SelectionAdapter() {
-
- public void widgetSelected(SelectionEvent e) {
- ISecurePreferences root = SecurePreferencesFactory.getDefault();
- if (root == null)
- return;
- try {
- root.flush();
- } catch (IOException exception) {
- Activator.log(IStatus.ERROR, exception.getMessage(), null, exception);
- }
- validateSave(); // save could fail so re-check
+ buttonSave.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
+ ISecurePreferences root = SecurePreferencesFactory.getDefault();
+ if (root == null)
+ return;
+ try {
+ root.flush();
+ } catch (IOException exception) {
+ Activator.log(IStatus.ERROR, exception.getMessage(), null, exception);
}
- });
+ validateSave(); // save could fail so re-check
+ }));
/* Removed for the time being. In future modify/show/export operations could be
* re-introduced with some special access token required to be entered by the user
@@ -109,11 +105,7 @@ public class TabContents implements ISecurePreferencesSelection, IDeleteListener
Button buttonDelete = new Button(buttonBar, SWT.PUSH);
buttonDelete.setText(SecUIMessages.deleteButton);
setButtonSize(buttonDelete);
- buttonDelete.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- deteleDefaultStorage();
- }
- });
+ buttonDelete.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> deteleDefaultStorage()));
URL location = InternalExchangeUtils.defaultStorageLocation();
if (location != null) {
diff --git a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/TabPassword.java b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/TabPassword.java
index 8b3046761..9a9fe613c 100644
--- a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/TabPassword.java
+++ b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/TabPassword.java
@@ -191,10 +191,10 @@ public class TabPassword {
TableColumn priorityColumn = new TableColumn(providerTable, SWT.CENTER);
priorityColumn.setText(SecUIMessages.priorityColumn);
- List availableModules = InternalExchangeUtils.passwordProvidersFind();
- HashSet disabledModules = getDisabledModules();
- for (Iterator i = availableModules.iterator(); i.hasNext();) {
- PasswordProviderDescription module = (PasswordProviderDescription) i.next();
+ List<PasswordProviderDescription> availableModules = InternalExchangeUtils.passwordProvidersFind();
+ HashSet<String> disabledModules = getDisabledModules();
+ for (Iterator<PasswordProviderDescription> i = availableModules.iterator(); i.hasNext();) {
+ PasswordProviderDescription module = i.next();
TableItem item = new TableItem(providerTable, SWT.NONE);
item.setText(new String[] {module.getName(), Integer.toString(module.getPriority())});
item.setData(module);
@@ -245,12 +245,12 @@ public class TabPassword {
enableLogout();
}
- protected HashSet getDisabledModules() {
+ protected HashSet<String> getDisabledModules() {
IEclipsePreferences node = ConfigurationScope.INSTANCE.getNode(PREFERENCES_PLUGIN);
String tmp = node.get(IStorageConstants.DISABLED_PROVIDERS_KEY, null);
if (tmp == null || tmp.length() == 0)
return null;
- HashSet modules = new HashSet();
+ HashSet<String> modules = new HashSet<>();
String[] disabledProviders = tmp.split(","); //$NON-NLS-1$
for (int i = 0; i < disabledProviders.length; i++) {
modules.add(disabledProviders[i]);
diff --git a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/UICallbackProvider.java b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/UICallbackProvider.java
index 8b2817f23..4942e3002 100644
--- a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/UICallbackProvider.java
+++ b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/UICallbackProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -87,22 +87,20 @@ public class UICallbackProvider implements IUICallbacks {
Display display = PlatformUI.getWorkbench().getDisplay();
if (!display.isDisposed() && (display.getThread() == Thread.currentThread())) { // we are running in a UI thread
- PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() { // syncExec not really necessary but kept for safety
- public void run() {
- IProgressService progressService = PlatformUI.getWorkbench().getProgressService();
- InitWithProgress task = new InitWithProgress(callback);
- try {
- progressService.busyCursorWhile(task);
- } catch (InvocationTargetException e) {
- exception[0] = new StorageException(StorageException.INTERNAL_ERROR, e);
- return;
- } catch (InterruptedException e) {
- exception[0] = new StorageException(StorageException.INTERNAL_ERROR, SecUIMessages.initCancelled);
- return;
- }
- exception[0] = task.getException();
- }
- });
+ PlatformUI.getWorkbench().getDisplay().syncExec(() -> {
+ IProgressService progressService = PlatformUI.getWorkbench().getProgressService();
+ InitWithProgress task = new InitWithProgress(callback);
+ try {
+ progressService.busyCursorWhile(task);
+ } catch (InvocationTargetException e1) {
+ exception[0] = new StorageException(StorageException.INTERNAL_ERROR, e1);
+ return;
+ } catch (InterruptedException e2) {
+ exception[0] = new StorageException(StorageException.INTERNAL_ERROR, SecUIMessages.initCancelled);
+ return;
+ }
+ exception[0] = task.getException();
+ });
} else { // we are running in non-UI thread, use Job to show small progress indicator on the status bar
Job job = new Job(SecUIMessages.secureStorageInitialization) {
protected IStatus run(IProgressMonitor monitor) {
@@ -130,11 +128,9 @@ public class UICallbackProvider implements IUICallbacks {
return null;
final Boolean[] result = new Boolean[1];
- PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
- public void run() {
- boolean reply = MessageDialog.openConfirm(StorageUtils.getShell(), SecUIMessages.generalDialogTitle, msg);
- result[0] = Boolean.valueOf(reply);
- }
+ PlatformUI.getWorkbench().getDisplay().syncExec(() -> {
+ boolean reply = MessageDialog.openConfirm(StorageUtils.getShell(), SecUIMessages.generalDialogTitle, msg);
+ result[0] = Boolean.valueOf(reply);
});
return result[0];
}
diff --git a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/view/ExportDialog.java b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/view/ExportDialog.java
index 0dff613ac..23eaf4d51 100644
--- a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/view/ExportDialog.java
+++ b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/view/ExportDialog.java
@@ -19,7 +19,8 @@ import org.eclipse.jface.dialogs.*;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.*;
@@ -87,11 +88,7 @@ public class ExportDialog extends TitleAreaDialog {
fileText.setText(lastFileName);
// add listener after the setText() above
- fileText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent event) {
- okButton.setEnabled(validFile());
- }
- });
+ fileText.addModifyListener(event -> okButton.setEnabled(validFile()));
Button browse = new Button(composite, SWT.NONE);
browse.setText(SecUIMessages.exportDialogBrowse);
diff --git a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/view/NewNodeDialog.java b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/view/NewNodeDialog.java
index 5ec062d30..f76592ca1 100644
--- a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/view/NewNodeDialog.java
+++ b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/view/NewNodeDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 IBM Corporation and others.
+ * Copyright (c) 2008, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -16,8 +16,6 @@ import org.eclipse.equinox.internal.security.ui.storage.IStorageConst;
import org.eclipse.jface.dialogs.*;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.*;
import org.eclipse.ui.PlatformUI;
@@ -52,11 +50,7 @@ public class NewNodeDialog extends TitleAreaDialog {
new Label(composite, SWT.LEFT).setText(SecUIMessages.newNodeLabel);
nodeName = new Text(composite, SWT.LEFT | SWT.BORDER);
- nodeName.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent event) {
- okButton.setEnabled(validName());
- }
- });
+ nodeName.addModifyListener(event -> okButton.setEnabled(validName()));
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
GridLayoutFactory.swtDefaults().generateLayout(composite);
diff --git a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/view/NewValueDialog.java b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/view/NewValueDialog.java
index f16431750..9579328bf 100644
--- a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/view/NewValueDialog.java
+++ b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/view/NewValueDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -16,8 +16,6 @@ import org.eclipse.jface.dialogs.*;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.*;
@@ -73,11 +71,7 @@ public class NewValueDialog extends TitleAreaDialog {
new Label(composite, SWT.LEFT).setText(SecUIMessages.addValueKeyLabel);
keyText = new Text(composite, SWT.LEFT | SWT.BORDER);
- keyText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent event) {
- okButton.setEnabled(validName());
- }
- });
+ keyText.addModifyListener(event -> okButton.setEnabled(validName()));
new Label(composite, SWT.LEFT).setText(SecUIMessages.addValueValueLabel);
valueText = new Text(composite, SWT.LEFT | SWT.BORDER);
diff --git a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/view/NodesView.java b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/view/NodesView.java
index 4a80c4588..3ee285a03 100644
--- a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/view/NodesView.java
+++ b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/view/NodesView.java
@@ -118,16 +118,13 @@ public class NodesView {
nodeTreeViewer.setLabelProvider(new ViewLabelProvider());
nodeTreeViewer.setInput(defaultPrefs);
- nodeTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
-
- public void selectionChanged(SelectionChangedEvent event) {
- TreeSelection selection = (TreeSelection) event.getSelection();
- Object selected = selection.getFirstElement();
- if (selected instanceof ISecurePreferences)
- parentView.setSelection((ISecurePreferences) selected);
- else
- parentView.setSelection(null);
- }
+ nodeTreeViewer.addSelectionChangedListener(event -> {
+ TreeSelection selection = (TreeSelection) event.getSelection();
+ Object selected = selection.getFirstElement();
+ if (selected instanceof ISecurePreferences)
+ parentView.setSelection((ISecurePreferences) selected);
+ else
+ parentView.setSelection(null);
});
if (Activator.getDefault().debugStorageContents()) {
@@ -139,22 +136,20 @@ public class NodesView {
private void hookContextMenu() {
MenuManager menuMgr = new MenuManager(SecUIMessages.nodesContextMenu);
- menuMgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- boolean canRemove = false;
- boolean canAdd = false;
- TreeSelection selection = (TreeSelection) nodeTreeViewer.getSelection();
- Object selected = selection.getFirstElement();
- if (selected instanceof ISecurePreferences) {
- ISecurePreferences node = (ISecurePreferences) selected;
- boolean isRoot = (node.parent() == null);
- boolean isInternal = node.absolutePath().startsWith(IStorageConst.PROVIDER_NODE);
- canRemove = (!isRoot && !isInternal);
- canAdd = !isInternal;
- }
- removeNodeAction.setEnabled(canRemove);
- addNodeAction.setEnabled(canAdd);
+ menuMgr.addMenuListener(manager -> {
+ boolean canRemove = false;
+ boolean canAdd = false;
+ TreeSelection selection = (TreeSelection) nodeTreeViewer.getSelection();
+ Object selected = selection.getFirstElement();
+ if (selected instanceof ISecurePreferences) {
+ ISecurePreferences node = (ISecurePreferences) selected;
+ boolean isRoot = (node.parent() == null);
+ boolean isInternal = node.absolutePath().startsWith(IStorageConst.PROVIDER_NODE);
+ canRemove = (!isRoot && !isInternal);
+ canAdd = !isInternal;
}
+ removeNodeAction.setEnabled(canRemove);
+ addNodeAction.setEnabled(canAdd);
});
Menu menu = menuMgr.createContextMenu(nodeTreeViewer.getControl());
nodeTreeViewer.getControl().setMenu(menu);
diff --git a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/view/ValuesView.java b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/view/ValuesView.java
index 5e2d3a39c..ff8b7fa39 100644
--- a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/view/ValuesView.java
+++ b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/view/ValuesView.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -148,10 +148,6 @@ public class ValuesView {
}
}
- class TableNameSorter extends ViewerSorter {
- // using default implementation for now
- }
-
public ValuesView(Table table, final ISecurePreferencesSelection parentView, Shell shell) {
this.parentView = parentView;
this.shell = shell;
@@ -170,7 +166,7 @@ public class ValuesView {
tableViewer.setContentProvider(new TableContentProvider());
tableViewer.setLabelProvider(new TableLabelProvider());
- tableViewer.setSorter(new TableNameSorter());
+ tableViewer.setComparator(new ViewerComparator());
if (Activator.getDefault().debugStorageContents()) {
makeActions();
@@ -181,39 +177,37 @@ public class ValuesView {
private void hookContextMenu() {
MenuManager menuMgr = new MenuManager(SecUIMessages.nodesContextMenu);
- menuMgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- if (selectedNode == null) {
- addValueAction.setEnabled(false);
- removeValueAction.setEnabled(false);
- return;
- }
- boolean isInternal = selectedNode.absolutePath().startsWith(IStorageConst.PROVIDER_NODE);
- addValueAction.setEnabled(!isInternal);
- removeValueAction.setEnabled(!isInternal);
- if (encryptValueAction != null)
- encryptValueAction.setEnabled(!isInternal);
- if (decryptValueAction != null)
- decryptValueAction.setEnabled(!isInternal);
- if (showValueAction != null)
- showValueAction.setEnabled(false);
-
- // enablement of encrypted/decrypted
- StructuredSelection selection = (StructuredSelection) tableViewer.getSelection();
- Object selected = selection.getFirstElement();
- if (selected instanceof TableValuesElement) {
- String key = ((TableValuesElement) selected).getKey();
- try {
- boolean encrypted = selectedNode.isEncrypted(key);
- if (encryptValueAction != null)
- encryptValueAction.setEnabled(!isInternal && !encrypted);
- if (decryptValueAction != null)
- decryptValueAction.setEnabled(!isInternal && encrypted);
- if (showValueAction != null)
- showValueAction.setEnabled(encrypted);
- } catch (StorageException e) {
- Activator.log(IStatus.ERROR, SecUIMessages.failedDecrypt, null, e);
- }
+ menuMgr.addMenuListener(manager -> {
+ if (selectedNode == null) {
+ addValueAction.setEnabled(false);
+ removeValueAction.setEnabled(false);
+ return;
+ }
+ boolean isInternal = selectedNode.absolutePath().startsWith(IStorageConst.PROVIDER_NODE);
+ addValueAction.setEnabled(!isInternal);
+ removeValueAction.setEnabled(!isInternal);
+ if (encryptValueAction != null)
+ encryptValueAction.setEnabled(!isInternal);
+ if (decryptValueAction != null)
+ decryptValueAction.setEnabled(!isInternal);
+ if (showValueAction != null)
+ showValueAction.setEnabled(false);
+
+ // enablement of encrypted/decrypted
+ StructuredSelection selection = (StructuredSelection) tableViewer.getSelection();
+ Object selected = selection.getFirstElement();
+ if (selected instanceof TableValuesElement) {
+ String key = ((TableValuesElement) selected).getKey();
+ try {
+ boolean encrypted = selectedNode.isEncrypted(key);
+ if (encryptValueAction != null)
+ encryptValueAction.setEnabled(!isInternal && !encrypted);
+ if (decryptValueAction != null)
+ decryptValueAction.setEnabled(!isInternal && encrypted);
+ if (showValueAction != null)
+ showValueAction.setEnabled(encrypted);
+ } catch (StorageException e) {
+ Activator.log(IStatus.ERROR, SecUIMessages.failedDecrypt, null, e);
}
}
});
diff --git a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/wizard/CertificateImportCertSelectPage.java b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/wizard/CertificateImportCertSelectPage.java
index b1d9e911e..2b9102844 100644
--- a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/wizard/CertificateImportCertSelectPage.java
+++ b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/wizard/CertificateImportCertSelectPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -26,7 +26,7 @@ public class CertificateImportCertSelectPage extends WizardPage implements Liste
private Composite certPreview;
private Combo certDropDown;
- private List certList;
+ private List<Certificate> certList;
static CertificateFactory certFact;
@@ -75,10 +75,10 @@ public class CertificateImportCertSelectPage extends WizardPage implements Liste
certDropDown.removeAll();
try {
- certList = new ArrayList();
- Collection collection = certFact.generateCertificates(new FileInputStream(certImportWizard.selectedImportFile));
+ certList = new ArrayList<>();
+ Collection<? extends Certificate> collection = certFact.generateCertificates(new FileInputStream(certImportWizard.selectedImportFile));
// For a set or list
- for (Iterator it = collection.iterator(); it.hasNext();) {
+ for (Iterator<? extends Certificate> it = collection.iterator(); it.hasNext();) {
certList.add(it.next());
}
diff --git a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/wizard/CertificateImportFileSelectPage.java b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/wizard/CertificateImportFileSelectPage.java
index 06c641e23..511ad0a9b 100644
--- a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/wizard/CertificateImportFileSelectPage.java
+++ b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/wizard/CertificateImportFileSelectPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -16,8 +16,7 @@ import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
@@ -55,11 +54,7 @@ public class CertificateImportFileSelectPage extends WizardPage implements Liste
// browse button
browseDirectoriesButton = new Button(certSelectComposite, SWT.PUSH);
browseDirectoriesButton.setText(SecurityUIMsg.WIZARD_BROWSE);
- browseDirectoriesButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handleLocationFileButtonPressed();
- }
- });
+ browseDirectoriesButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> handleLocationFileButtonPressed()));
addListeners();
}
diff --git a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/wizard/CertificateImportTrustEngineSelectPage.java b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/wizard/CertificateImportTrustEngineSelectPage.java
index 34ccdf574..80cfc60d0 100644
--- a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/wizard/CertificateImportTrustEngineSelectPage.java
+++ b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/wizard/CertificateImportTrustEngineSelectPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -24,7 +24,7 @@ public class CertificateImportTrustEngineSelectPage extends WizardPage implement
private Text aliasField;
private Combo trustEngineCombo;
- private ArrayList trustEngines = new ArrayList();
+ private ArrayList<TrustEngine> trustEngines = new ArrayList<>();
protected CertificateImportTrustEngineSelectPage(String pageName) {
super(pageName);
@@ -94,7 +94,7 @@ public class CertificateImportTrustEngineSelectPage extends WizardPage implement
setErrorMessage(SecurityUIMsg.WIZARD_ERROR_ENGINE_REQUIRED);
} else {
setErrorMessage(null);
- ((CertificateImportWizard) getWizard()).selectTrustEngine = (TrustEngine) trustEngines.get(trustEngineCombo.getSelectionIndex());
+ ((CertificateImportWizard) getWizard()).selectTrustEngine = trustEngines.get(trustEngineCombo.getSelectionIndex());
}
}
getWizard().getContainer().updateButtons();

Back to the top