diff --git a/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/UniversalSecurityPlugin.java b/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/UniversalSecurityPlugin.java index 718afe369c4..d41f9625c76 100644 --- a/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/UniversalSecurityPlugin.java +++ b/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/UniversalSecurityPlugin.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2007 IBM Corporation and others. + * Copyright (c) 2006, 2008 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 @@ -7,20 +7,17 @@ * * Initial Contributors: * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, + * component that contains this file: David McKnight, Kushal Munir, + * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * + * * Contributors: - * {Name} (company) - description of contribution. + * Martin Oberhuber (Wind River) - [235626] Convert dstore.security to MessageBundle format *******************************************************************************/ package org.eclipse.rse.internal.dstore.security; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Platform; @@ -35,14 +32,13 @@ public class UniversalSecurityPlugin extends AbstractUIPlugin { private final static String KEYSTORE = "dstorekeystore.dat"; //$NON-NLS-1$ private static UniversalSecurityPlugin inst; - private static ResourceBundle aResourceBundle; public static final String PLUGIN_ID = "org.eclipse.rse.dstore.security"; //$NON-NLS-1$ public UniversalSecurityPlugin() { if (inst == null) inst = this; } - + public static UniversalSecurityPlugin getDefault() { return inst; } @@ -51,30 +47,8 @@ public class UniversalSecurityPlugin extends AbstractUIPlugin return PLUGIN_ID; } - public static ResourceBundle getResourceBundle() { - if(aResourceBundle == null) - { - try { - aResourceBundle = Platform.getResourceBundle(Platform.getBundle(PLUGIN_ID)); - } catch (Exception e) { - aResourceBundle = null; - } - } - return aResourceBundle; - } - - public static String getString(String key) { - try { - return getResourceBundle().getString(key); - } catch (MissingResourceException e) { - return key; - } - } - - - public static String getKeyStoreLocation() { - + Bundle bundle = Platform.getBundle(PLUGIN_ID); return Platform.getStateLocation(bundle).append(KEYSTORE).toOSString(); } @@ -83,12 +57,12 @@ public class UniversalSecurityPlugin extends AbstractUIPlugin { return "dstore"; //$NON-NLS-1$ } - + public static String getWorkspaceName(){ IPath workspace = Platform.getLocation(); int nr = workspace.segmentCount(); String workspaceName = workspace.segment(nr - 1); - return workspaceName; + return workspaceName; } /* (non-Javadoc) @@ -97,7 +71,7 @@ public class UniversalSecurityPlugin extends AbstractUIPlugin public void stop(BundleContext context) throws Exception { super.stop(context); - + savePluginPreferences(); ImageRegistry.shutdown(); } @@ -108,13 +82,13 @@ public class UniversalSecurityPlugin extends AbstractUIPlugin public static IWorkbenchWindow getActiveWorkbenchWindow() { return getDefault().getWorkbench().getActiveWorkbenchWindow(); } - + public void log(IStatus status) { getLog().log(status); } - + public void log(Throwable e) { log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, "Error", e)); //$NON-NLS-1$ } - + } diff --git a/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/UniversalSecurityProperties.java b/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/UniversalSecurityProperties.java index 6068e273600..0d4b9a93712 100644 --- a/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/UniversalSecurityProperties.java +++ b/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/UniversalSecurityProperties.java @@ -7,28 +7,25 @@ * * Initial Contributors: * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, + * component that contains this file: David McKnight, Kushal Munir, + * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * + * * Contributors: * Martin Oberhuber (Wind River) - [181112] NLS missing messages + * Martin Oberhuber (Wind River) - [235626] Convert dstore.security to MessageBundle format *******************************************************************************/ package org.eclipse.rse.internal.dstore.security; - import org.eclipse.osgi.util.NLS; - - public class UniversalSecurityProperties extends NLS { - private static String BUNDLE_NAME = "org.eclipse.rse.internal.dstore.security.UniversalSecurityProperties";//$NON-NLS-1$ + private static String BUNDLE_NAME = "org.eclipse.rse.internal.dstore.security.UniversalSecurityProperties"; //$NON-NLS-1$ - public static String RESID_SECURITY_CERTIFICATE_PROP_TITLE; - public static String RESID_SECURITY_VALIDITY_PERIOD; + public static String RESID_SECURITY_VALIDITY_PERIOD; public static String RESID_SECURITY_CERTIF_VERSION_LBL; public static String RESID_SECURITY_PROP_ALIAS_LBL; public static String RESID_SECURITY_ISSUED_TO_LBL; @@ -56,27 +53,32 @@ public class UniversalSecurityProperties extends NLS public static String RESID_SECURITY_IO_SAVE_ERROR_; public static String RESID_SECURITY_CERTIFICATE_STORE_ERROR_; public static String RESID_SECURITY_UNINIT_KEYSTORE_ERROR_; + public static String RESID_SECURITY_ALGORITHM_ERROR_; + public static String RESID_SECURITY_LOAD_KEYSTORE_ERROR_; + public static String RESID_SECURITY_KEY_LOAD_ERROR_; + public static String RESID_SECURITY_INITIALIZE_ERROR_; + public static String RESID_SECURITY_SECURITY_PROVIDER_ERROR_; public static String RESID_SECURITY_CERTIFICATE_EXC_; public static String RESID_SECURITY_LOAD_IO_EXC_; public static String RESID_SECURITY_CERTIFICATE_LOAD_EXC_; public static String RESID_SECURITY_PREF_SEC_DESCRIPTION; public static String RESID_SECURITY_PROPERTIES_LBL; - + public static String RESID_SECURITY_TRUST_WIZ_ALIAS_TITLE; public static String RESID_SECURITY_TRUST_WIZ_ALIAS_DESC; - + public static String RESID_SECURITY_TRUST_WIZ_CERTIFICATE_TITLE; - public static String RESID_SECURITY_TRUST_WIZ_CERTIFICATE_DESC; + public static String RESID_SECURITY_TRUST_WIZ_CERTIFICATE_DESC; public static String RESID_SECURITY_TRUST_IMPORT_CERTIFICATE_WIZARD; public static String RESID_SECURITY_CERTIFICATE_INFORMATION; - + public static String RESID_SECURITY_VALIDITY_LBL; - - static + + static { // load message values from bundle file initializeMessages(BUNDLE_NAME, UniversalSecurityProperties.class); } - + } diff --git a/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/UniversalSecurityProperties.properties b/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/UniversalSecurityProperties.properties index 44719f62e38..edd58e0e24a 100644 --- a/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/UniversalSecurityProperties.properties +++ b/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/UniversalSecurityProperties.properties @@ -12,7 +12,7 @@ # Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. # # Contributors: -# {Name} (company) - description of contribution. +# Martin Oberhuber (Wind River) - [235626] Convert dstore.security to MessageBundle format ############################################################################### # NLS_MESSAGEFORMAT_NONE @@ -48,6 +48,13 @@ RESID_SECURITY_IO_SAVE_ERROR_ = A input-output exception occurred while saving key store \n%1. RESID_SECURITY_CERTIFICATE_STORE_ERROR_ = One or more certificates in the\n%1\nkey store could not be stored. RESID_SECURITY_UNINIT_KEYSTORE_ERROR_ = Keystore %1 \nhas not been initialized. +# FIXME MISSING STRINGS START + RESID_SECURITY_ALGORITHM_ERROR_ = Algorithm error in Keystore %1 + RESID_SECURITY_LOAD_KEYSTORE_ERROR_ = An error occurred when processing Keystore. + RESID_SECURITY_KEY_LOAD_ERROR_ = Error loading key from %1 + RESID_SECURITY_INITIALIZE_ERROR_ = Error initializing keystore at %1 + RESID_SECURITY_SECURITY_PROVIDER_ERROR_ = Missing Security Provider +# FIXME MISSING STRINGS END RESID_SECURITY_CERTIFICATE_EXC_ = A certificate exception occurred while loading the file\n%1 RESID_SECURITY_LOAD_IO_EXC_ = A input-output exception occurred while loading the file\n%1 RESID_SECURITY_CERTIFICATE_LOAD_EXC_ = Unable to load certificate. diff --git a/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/preference/CertPropertiesDialog.java b/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/preference/CertPropertiesDialog.java index d66a8f39789..e76241770a3 100644 --- a/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/preference/CertPropertiesDialog.java +++ b/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/preference/CertPropertiesDialog.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2007 IBM Corporation and others. + * Copyright (c) 2006, 2008 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 @@ -7,19 +7,18 @@ * * Initial Contributors: * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, + * component that contains this file: David McKnight, Kushal Munir, + * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * + * * Contributors: - * {Name} (company) - description of contribution. + * Martin Oberhuber (Wind River) - [235626] Convert dstore.security to MessageBundle format *******************************************************************************/ package org.eclipse.rse.internal.dstore.security.preference; -import org.eclipse.rse.internal.dstore.security.UniversalSecurityPlugin; import org.eclipse.rse.internal.dstore.security.UniversalSecurityProperties; import org.eclipse.rse.internal.dstore.security.widgets.CertificatePropertiesForm; import org.eclipse.rse.ui.dialogs.SystemPromptDialog; @@ -30,25 +29,25 @@ import org.eclipse.swt.widgets.Shell; -public class CertPropertiesDialog extends SystemPromptDialog +public class CertPropertiesDialog extends SystemPromptDialog { private Object _cert; - public CertPropertiesDialog(Shell parentShell, Object cert) + public CertPropertiesDialog(Shell parentShell, Object cert) { - super(parentShell, UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_CERTIFICATE_PROP_TITLE)); + super(parentShell, UniversalSecurityProperties.RESID_SECURITY_CERTIFICATE_PROP_TITLE); _cert = cert; } - - + + public Control getInitialFocusControl() { return getOkButton(); } protected Control createInner(Composite parent) - { + { CertificatePropertiesForm form = new CertificatePropertiesForm(getShell(), _cert, true); return form.createContents(parent); } diff --git a/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/preference/KeyElement.java b/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/preference/KeyElement.java index c8fb5f9b257..a3f72c5d3b6 100644 --- a/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/preference/KeyElement.java +++ b/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/preference/KeyElement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2007 IBM Corporation and others. + * Copyright (c) 2006, 2008 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 @@ -7,12 +7,12 @@ * * Initial Contributors: * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, + * component that contains this file: David McKnight, Kushal Munir, + * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * + * * Contributors: - * {Name} (company) - description of contribution. + * Martin Oberhuber (Wind River) - [235626] Convert dstore.security to MessageBundle format *******************************************************************************/ package org.eclipse.rse.internal.dstore.security.preference; @@ -21,7 +21,6 @@ package org.eclipse.rse.internal.dstore.security.preference; import java.security.Key; import org.eclipse.rse.internal.dstore.security.ImageRegistry; -import org.eclipse.rse.internal.dstore.security.UniversalSecurityPlugin; import org.eclipse.rse.internal.dstore.security.UniversalSecurityProperties; import org.eclipse.swt.graphics.Image; @@ -35,27 +34,27 @@ public class KeyElement extends Element super(alias, value); _key = key; } - + public String getType() { - return UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_KEY_ENTRY); + return UniversalSecurityProperties.RESID_SECURITY_KEY_ENTRY; } - + public String getAlgorithm() { return _key.getAlgorithm(); } - + public String getFormat() { return _key.getFormat(); } - + public Image getImage() { return org.eclipse.rse.internal.dstore.security.ImageRegistry.getImage(ImageRegistry.IMG_CERTIF_FILE); } - + public Object getCert() { return _key; diff --git a/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/preference/NewCertDialog.java b/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/preference/NewCertDialog.java index 628194ca0f2..8d1b8c07e69 100644 --- a/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/preference/NewCertDialog.java +++ b/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/preference/NewCertDialog.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2007 IBM Corporation and others. + * Copyright (c) 2006, 2008 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 @@ -7,12 +7,12 @@ * * Initial Contributors: * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, + * component that contains this file: David McKnight, Kushal Munir, + * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * + * * Contributors: - * {Name} (company) - description of contribution. + * Martin Oberhuber (Wind River) - [235626] Convert dstore.security to MessageBundle format *******************************************************************************/ package org.eclipse.rse.internal.dstore.security.preference; @@ -49,26 +49,26 @@ public class NewCertDialog extends SystemPromptDialog implements Listener { /** - * + * */ private final UniversalSecurityPreferencePage page; private CertificateForm _certForm; private Certificate _certificate; private Shell _shell; - + public NewCertDialog(UniversalSecurityPreferencePage page, Shell shell){ - super(shell,UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_ADD_CERT_DLG_TITLE) ); + super(shell, UniversalSecurityProperties.RESID_SECURITY_ADD_CERT_DLG_TITLE); this.page = page; _shell = shell; } - + public Control getInitialFocusControl() { return _certForm.getInitialFocusControl(); } - + protected Control createInner(Composite parent) - { + { Composite content = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); GridData data = GridUtil.createFill(); @@ -82,81 +82,82 @@ public class NewCertDialog extends SystemPromptDialog implements Listener return content; } - protected Control createButtonBar(Composite parent) + protected Control createButtonBar(Composite parent) { Control control = super.createButtonBar(parent); - getOkButton().setEnabled(false); - return control; + getOkButton().setEnabled(false); + return control; } - + protected boolean processOK(){ - try{ + try{ _certificate = _certForm.loadCertificate(this.page._keyStore); } catch(FileNotFoundException e){ - String text = UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_KEY_IO_ERROR_); + String text = UniversalSecurityProperties.RESID_SECURITY_KEY_IO_ERROR_; text = StringModifier.change(text, "%1", _certForm.getPath()); //$NON-NLS-1$ - String msg = UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_CERTIFICATE_LOAD_EXC_); - + String msg = UniversalSecurityProperties.RESID_SECURITY_CERTIFICATE_LOAD_EXC_; + Status err = new Status(IStatus.ERROR,ResourcesPlugin.PI_RESOURCES,IStatus.ERROR,text,e); - ErrorDialog.openError(UniversalSecurityPlugin.getActiveWorkbenchShell(),UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_SEC_MSG), msg,err); + ErrorDialog.openError(UniversalSecurityPlugin.getActiveWorkbenchShell(), UniversalSecurityProperties.RESID_SECURITY_SEC_MSG, msg, err); return false; - + } catch(IOException e){ - String text = UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_LOAD_IO_EXC_); + String text = UniversalSecurityProperties.RESID_SECURITY_LOAD_IO_EXC_; text = StringModifier.change(text, "%1", _certForm.getPath()); //$NON-NLS-1$ text = StringModifier.change(text, "%1", UniversalSecurityPlugin.getKeyStoreLocation()); //$NON-NLS-1$ - String msg = UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_CERTIFICATE_LOAD_EXC_); - + String msg = UniversalSecurityProperties.RESID_SECURITY_CERTIFICATE_LOAD_EXC_; + Status err = new Status(IStatus.ERROR,ResourcesPlugin.PI_RESOURCES,IStatus.ERROR,text,e); - ErrorDialog.openError(UniversalSecurityPlugin.getActiveWorkbenchShell(),UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_SEC_MSG), msg,err); + ErrorDialog.openError(UniversalSecurityPlugin.getActiveWorkbenchShell(), UniversalSecurityProperties.RESID_SECURITY_SEC_MSG, msg, err); return false; - + } catch(CertificateException exc){ - String text = UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_CERTIFICATE_EXC_); + String text = UniversalSecurityProperties.RESID_SECURITY_CERTIFICATE_EXC_; text = StringModifier.change(text, "%1", _certForm.getPath()); //$NON-NLS-1$ - String msg = UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_CERTIFICATE_LOAD_EXC_); - + String msg = UniversalSecurityProperties.RESID_SECURITY_CERTIFICATE_LOAD_EXC_; + Status err = new Status(IStatus.ERROR,ResourcesPlugin.PI_RESOURCES,IStatus.ERROR,text,exc); - ErrorDialog.openError(UniversalSecurityPlugin.getActiveWorkbenchShell(),UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_SEC_MSG), msg,err); + ErrorDialog.openError(UniversalSecurityPlugin.getActiveWorkbenchShell(), UniversalSecurityProperties.RESID_SECURITY_SEC_MSG, msg, err); return false; } catch(KeyStoreException exc){ - String text = UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_KEY_STORE_ERROR_); + String text = UniversalSecurityProperties.RESID_SECURITY_KEY_STORE_ERROR_; text = StringModifier.change(text, "%1", UniversalSecurityPlugin.getKeyStoreLocation()); //$NON-NLS-1$ - String msg = UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_CERTIFICATE_LOAD_EXC_); - + String msg = UniversalSecurityProperties.RESID_SECURITY_CERTIFICATE_LOAD_EXC_; + Status err = new Status(IStatus.ERROR,ResourcesPlugin.PI_RESOURCES,IStatus.ERROR,text,exc); - ErrorDialog.openError(UniversalSecurityPlugin.getActiveWorkbenchShell(),UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_SEC_MSG), msg,err); + ErrorDialog.openError(UniversalSecurityPlugin.getActiveWorkbenchShell(), UniversalSecurityProperties.RESID_SECURITY_SEC_MSG, msg, err); return false; } - + if (_certificate instanceof X509Certificate) { - X509CertificateElement elem = new X509CertificateElement(_certForm.getAliasName(), UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_TRUSTED_CERTIFICATE), (X509Certificate)_certificate); + X509CertificateElement elem = new X509CertificateElement(_certForm.getAliasName(), UniversalSecurityProperties.RESID_SECURITY_TRUSTED_CERTIFICATE, + (X509Certificate) _certificate); this.page._tableItems.add(elem); } - + return true; } - + public void handleEvent(Event e){ getButton(IDialogConstants.OK_ID).setEnabled(_certForm.validateDialog()); } - - + + public Certificate getCertificate(){ return _certificate; } - + } diff --git a/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/preference/RenameCertDialog.java b/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/preference/RenameCertDialog.java index 9b8ff600daa..52576b82eb1 100644 --- a/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/preference/RenameCertDialog.java +++ b/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/preference/RenameCertDialog.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2007 IBM Corporation and others. + * Copyright (c) 2006, 2008 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 @@ -7,19 +7,18 @@ * * Initial Contributors: * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, + * component that contains this file: David McKnight, Kushal Munir, + * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * + * * Contributors: - * {Name} (company) - description of contribution. + * Martin Oberhuber (Wind River) - [235626] Convert dstore.security to MessageBundle format *******************************************************************************/ package org.eclipse.rse.internal.dstore.security.preference; import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.rse.internal.dstore.security.UniversalSecurityPlugin; import org.eclipse.rse.internal.dstore.security.UniversalSecurityProperties; import org.eclipse.rse.internal.dstore.security.util.GridUtil; import org.eclipse.rse.ui.dialogs.SystemPromptDialog; @@ -35,23 +34,23 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; public class RenameCertDialog extends SystemPromptDialog implements Listener{ - + private Text txtName; String newAlias; private String oldAlias; - + public RenameCertDialog(UniversalSecurityPreferencePage page, Shell shell, String oldValue) { - super(shell, UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_RENAME_CERT_DLG_TITLE)); + super(shell, UniversalSecurityProperties.RESID_SECURITY_RENAME_CERT_DLG_TITLE); oldAlias = oldValue; } - + public Control getInitialFocusControl() { return txtName; } - + protected Control createInner(Composite parent) { @@ -64,44 +63,44 @@ public class RenameCertDialog extends SystemPromptDialog implements Listener{ content.setLayoutData(data); Label lblName = new Label(content, SWT.NONE); - lblName.setText(UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_CERTIFICATE_ALIAS)); - + lblName.setText(UniversalSecurityProperties.RESID_SECURITY_CERTIFICATE_ALIAS); + txtName = new Text(content, SWT.BORDER); txtName.setText(oldAlias); txtName.selectAll(); txtName.addListener(SWT.Modify, this); - + data = GridUtil.createHorizontalFill(); data.widthHint = 200; txtName.setLayoutData(data); return content; } - + private void validateDialog(){ if(txtName.getText().trim().length()==0) getButton(IDialogConstants.OK_ID).setEnabled(false); else getButton(IDialogConstants.OK_ID).setEnabled(true); } - + public void handleEvent(Event e){ if(e.widget.equals(txtName)) validateDialog(); } - + protected Control createButtonBar(Composite parent) { - Control control = super.createButtonBar(parent); + Control control = super.createButtonBar(parent); validateDialog(); return control; - + } public String getNewAlias() { return newAlias; } - + protected boolean processOK() { newAlias = txtName.getText(); diff --git a/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/preference/UniversalSecurityPreferencePage.java b/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/preference/UniversalSecurityPreferencePage.java index f791a5bc2bf..dae03012a0b 100644 --- a/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/preference/UniversalSecurityPreferencePage.java +++ b/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/preference/UniversalSecurityPreferencePage.java @@ -7,12 +7,13 @@ * * Initial Contributors: * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, + * component that contains this file: David McKnight, Kushal Munir, + * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * + * * Contributors: * David Dykstal (IBM) - [232131] fix minor layout problems along with date formats + * Martin Oberhuber (Wind River) - [235626] Convert dstore.security to MessageBundle format *******************************************************************************/ package org.eclipse.rse.internal.dstore.security.preference; @@ -103,7 +104,7 @@ public class UniversalSecurityPreferencePage extends PreferencePage implements Text label = new Text(composite, SWT.READ_ONLY); label.setBackground(composite.getBackground()); - label.setText(UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_PREF_SEC_DESCRIPTION)); + label.setText(UniversalSecurityProperties.RESID_SECURITY_PREF_SEC_DESCRIPTION); GridData data = new GridData(); data.horizontalSpan = 2; label.setLayoutData(data); @@ -142,19 +143,19 @@ public class UniversalSecurityPreferencePage extends PreferencePage implements TableColumn aliasColumn = new TableColumn(table, SWT.LEFT); - aliasColumn.setText(UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_PREF_ALIAS_NAME)); + aliasColumn.setText(UniversalSecurityProperties.RESID_SECURITY_PREF_ALIAS_NAME); tableLayout.addColumnData(new ColumnPixelData(100)); - + TableColumn toColumn = new TableColumn(table, SWT.LEFT); - toColumn.setText(UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_PREF_ISSUED_TO)); + toColumn.setText(UniversalSecurityProperties.RESID_SECURITY_PREF_ISSUED_TO); tableLayout.addColumnData(new ColumnPixelData(150)); - + TableColumn frmColumn = new TableColumn(table, SWT.LEFT); - frmColumn.setText(UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_PREF_ISSUED_FROM)); + frmColumn.setText(UniversalSecurityProperties.RESID_SECURITY_PREF_ISSUED_FROM); tableLayout.addColumnData(new ColumnPixelData(150)); - + TableColumn expColumn = new TableColumn(table, SWT.LEFT); - expColumn.setText(UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_PREF_EXPIRES)); + expColumn.setText(UniversalSecurityProperties.RESID_SECURITY_PREF_EXPIRES); tableLayout.addColumnData(new ColumnPixelData(150)); table.setLayout(tableLayout); @@ -171,17 +172,17 @@ public class UniversalSecurityPreferencePage extends PreferencePage implements private void createButtons(Composite parent) { Composite buttonComposite = SystemWidgetHelpers.createComposite(parent, 4); - - _addButton = SystemWidgetHelpers.createPushButton(buttonComposite, UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_ADD_LBL),this); + + _addButton = SystemWidgetHelpers.createPushButton(buttonComposite, UniversalSecurityProperties.RESID_SECURITY_ADD_LBL, this); - _removeButton = SystemWidgetHelpers.createPushButton(buttonComposite, UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_REMOVE_LBL), this); + _removeButton = SystemWidgetHelpers.createPushButton(buttonComposite, UniversalSecurityProperties.RESID_SECURITY_REMOVE_LBL, this); _removeButton.setEnabled(false); - _renameButton = SystemWidgetHelpers.createPushButton(buttonComposite, UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_RENAME_LBL), this); + _renameButton = SystemWidgetHelpers.createPushButton(buttonComposite, UniversalSecurityProperties.RESID_SECURITY_RENAME_LBL, this); _renameButton.setEnabled(false); - _propertiesButton = SystemWidgetHelpers.createPushButton(buttonComposite, UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_PROPERTIES_LBL), this); + _propertiesButton = SystemWidgetHelpers.createPushButton(buttonComposite, UniversalSecurityProperties.RESID_SECURITY_PROPERTIES_LBL, this); _propertiesButton.setEnabled(false); } @@ -219,64 +220,55 @@ public class UniversalSecurityPreferencePage extends PreferencePage implements catch (IOException e) { - String text = UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_IO_SAVE_ERROR_); + String text = UniversalSecurityProperties.RESID_SECURITY_IO_SAVE_ERROR_; text = StringModifier.change(text, "%1", storePath); //$NON-NLS-1$ text = StringModifier.change(text, "%1", storePath); //$NON-NLS-1$ - String msg = UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_KEYSTORE_SAVE_ERROR_); + String msg = UniversalSecurityProperties.RESID_SECURITY_KEYSTORE_SAVE_ERROR_; Status err = new Status(IStatus.ERROR, ResourcesPlugin.PI_RESOURCES, IStatus.ERROR, text, e); - ErrorDialog.openError(UniversalSecurityPlugin - .getActiveWorkbenchShell(), UniversalSecurityPlugin - .getString("SEC_MSG"), msg, err); //$NON-NLS-1$ + ErrorDialog.openError(UniversalSecurityPlugin.getActiveWorkbenchShell(), UniversalSecurityProperties.RESID_SECURITY_SEC_MSG, msg, err); return false; } catch (CertificateException exc) { - String text = UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_CERTIFICATE_STORE_ERROR_); + String text = UniversalSecurityProperties.RESID_SECURITY_CERTIFICATE_STORE_ERROR_; text = StringModifier.change(text, "%1", storePath); //$NON-NLS-1$ - String msg = UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_KEYSTORE_SAVE_ERROR_); + String msg = UniversalSecurityProperties.RESID_SECURITY_KEYSTORE_SAVE_ERROR_; Status err = new Status(IStatus.ERROR, ResourcesPlugin.PI_RESOURCES, IStatus.ERROR, text, exc); ErrorDialog.openError(UniversalSecurityPlugin - .getActiveWorkbenchShell(), UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_SEC_MSG), msg, err); + .getActiveWorkbenchShell(), UniversalSecurityProperties.RESID_SECURITY_SEC_MSG, msg, err); return false; } catch (KeyStoreException exc) { - String text = UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_UNINIT_KEYSTORE_ERROR_); + String text = UniversalSecurityProperties.RESID_SECURITY_UNINIT_KEYSTORE_ERROR_; text = StringModifier.change(text, "%1", UniversalSecurityPlugin //$NON-NLS-1$ .getKeyStoreLocation()); - String msg = UniversalSecurityPlugin - .getString("RESID_SECURITY_KEYSTORE_SAVE_ERROR_"); //$NON-NLS-1$ + String msg = UniversalSecurityProperties.RESID_SECURITY_KEYSTORE_SAVE_ERROR_; Status err = new Status(IStatus.ERROR, ResourcesPlugin.PI_RESOURCES, IStatus.ERROR, text, exc); - ErrorDialog.openError(UniversalSecurityPlugin - .getActiveWorkbenchShell(), UniversalSecurityPlugin - .getString("SEC_MSG"), msg, err); //$NON-NLS-1$ + ErrorDialog.openError(UniversalSecurityPlugin.getActiveWorkbenchShell(), UniversalSecurityProperties.RESID_SECURITY_SEC_MSG, msg, err); return false; } catch (NoSuchAlgorithmException exc2) { - String text = UniversalSecurityPlugin - .getString("RESID_SECURITY_ALGORITHM_ERROR_"); //$NON-NLS-1$ + String text = UniversalSecurityProperties.RESID_SECURITY_ALGORITHM_ERROR_; text = StringModifier.change(text, "%1", UniversalSecurityPlugin //$NON-NLS-1$ .getKeyStoreLocation()); - String msg = UniversalSecurityPlugin - .getString("RESID_SECURITY_KEYSTORE_SAVE_ERROR_"); //$NON-NLS-1$ + String msg = UniversalSecurityProperties.RESID_SECURITY_KEYSTORE_SAVE_ERROR_; Status err = new Status(IStatus.ERROR, ResourcesPlugin.PI_RESOURCES, IStatus.ERROR, text, exc2); - ErrorDialog.openError(UniversalSecurityPlugin - .getActiveWorkbenchShell(), UniversalSecurityPlugin - .getString("SEC_MSG"), msg, err); //$NON-NLS-1$ + ErrorDialog.openError(UniversalSecurityPlugin.getActiveWorkbenchShell(), UniversalSecurityProperties.RESID_SECURITY_SEC_MSG, msg, err); return false; } @@ -323,8 +315,7 @@ public class UniversalSecurityPreferencePage extends PreferencePage implements { Key key = _keyStore.getKey(alias, passw.toCharArray()); KeyElement elem = new KeyElement(alias, - UniversalSecurityPlugin - .getString("RESID_SECURITY_KEY_ENTRY"), //$NON-NLS-1$ + UniversalSecurityProperties.RESID_SECURITY_KEY_ENTRY, key); _tableItems.add(elem); } @@ -339,82 +330,62 @@ public class UniversalSecurityPreferencePage extends PreferencePage implements catch (IOException e) { - String text = UniversalSecurityPlugin - .getString("RESID_SECURITY_LOAD_IO_EXC_"); //$NON-NLS-1$ + String text = UniversalSecurityProperties.RESID_SECURITY_LOAD_IO_EXC_; text = StringModifier.change(text, "%1", storePath); //$NON-NLS-1$ - String msg = UniversalSecurityPlugin - .getString("RESID_SECURITY_LOAD_KEYSTORE_ERROR_"); //$NON-NLS-1$ + String msg = UniversalSecurityProperties.RESID_SECURITY_LOAD_KEYSTORE_ERROR_; Status err = new Status(IStatus.ERROR, ResourcesPlugin.PI_RESOURCES, IStatus.ERROR, text, e); - ErrorDialog.openError(UniversalSecurityPlugin - .getActiveWorkbenchShell(), UniversalSecurityPlugin - .getString("SEC_MSG"), msg, err); //$NON-NLS-1$ + ErrorDialog.openError(UniversalSecurityPlugin.getActiveWorkbenchShell(), UniversalSecurityProperties.RESID_SECURITY_SEC_MSG, msg, err); } catch (CertificateException exc) { - String text = UniversalSecurityPlugin - .getString("RESID_SECURITY_KEY_LOAD_ERROR_"); //$NON-NLS-1$ + String text = UniversalSecurityProperties.RESID_SECURITY_KEY_LOAD_ERROR_; text = StringModifier.change(text, "%1", storePath); //$NON-NLS-1$ - String msg = UniversalSecurityPlugin - .getString("RESID_SECURITY_LOAD_KEYSTORE_ERROR_"); //$NON-NLS-1$ + String msg = UniversalSecurityProperties.RESID_SECURITY_LOAD_KEYSTORE_ERROR_; Status err = new Status(IStatus.ERROR, ResourcesPlugin.PI_RESOURCES, IStatus.ERROR, text, exc); - ErrorDialog.openError(UniversalSecurityPlugin - .getActiveWorkbenchShell(), UniversalSecurityPlugin - .getString("SEC_MSG"), msg, err); //$NON-NLS-1$ + ErrorDialog.openError(UniversalSecurityPlugin.getActiveWorkbenchShell(), UniversalSecurityProperties.RESID_SECURITY_SEC_MSG, msg, err); } catch (KeyStoreException exc) { - String text = UniversalSecurityPlugin - .getString("RESID_SECURITY_INITIALIZE_ERROR_"); //$NON-NLS-1$ + String text = UniversalSecurityProperties.RESID_SECURITY_INITIALIZE_ERROR_; text = StringModifier.change(text, "%1", UniversalSecurityPlugin //$NON-NLS-1$ .getKeyStoreLocation()); - String msg = UniversalSecurityPlugin - .getString("RESID_SECURITY_LOAD_KEYSTORE_ERROR_"); //$NON-NLS-1$ + String msg = UniversalSecurityProperties.RESID_SECURITY_LOAD_KEYSTORE_ERROR_; Status err = new Status(IStatus.ERROR, ResourcesPlugin.PI_RESOURCES, IStatus.ERROR, text, exc); - ErrorDialog.openError(UniversalSecurityPlugin - .getActiveWorkbenchShell(), UniversalSecurityPlugin - .getString("SEC_MSG"), msg, err); //$NON-NLS-1$ + ErrorDialog.openError(UniversalSecurityPlugin.getActiveWorkbenchShell(), UniversalSecurityProperties.RESID_SECURITY_SEC_MSG, msg, err); } catch (NoSuchProviderException exc2) { - String text = UniversalSecurityPlugin - .getString("RESID_SECURITY_SECURITY_PROVIDER_ERROR_"); //$NON-NLS-1$ - String msg = UniversalSecurityPlugin - .getString("RESID_SECURITY_INITIALIZE_ERROR_"); //$NON-NLS-1$ + String text = UniversalSecurityProperties.RESID_SECURITY_SECURITY_PROVIDER_ERROR_; + String msg = UniversalSecurityProperties.RESID_SECURITY_INITIALIZE_ERROR_; msg = StringModifier.change(msg, "%1", UniversalSecurityPlugin //$NON-NLS-1$ .getKeyStoreLocation()); Status err = new Status(IStatus.ERROR, ResourcesPlugin.PI_RESOURCES, IStatus.ERROR, text, exc2); - ErrorDialog.openError(UniversalSecurityPlugin - .getActiveWorkbenchShell(), UniversalSecurityPlugin - .getString("SEC_MSG"), msg, err); //$NON-NLS-1$ + ErrorDialog.openError(UniversalSecurityPlugin.getActiveWorkbenchShell(), UniversalSecurityProperties.RESID_SECURITY_SEC_MSG, msg, err); } catch (NoSuchAlgorithmException exc2) { - String text = UniversalSecurityPlugin - .getString("RESID_SECURITY_ALGORITHM_ERROR_"); //$NON-NLS-1$ + String text = UniversalSecurityProperties.RESID_SECURITY_ALGORITHM_ERROR_; text = StringModifier.change(text, "%1", UniversalSecurityPlugin //$NON-NLS-1$ .getKeyStoreLocation()); - String msg = UniversalSecurityPlugin - .getString("RESID_SECURITY_LOAD_KEYSTORE_ERROR_"); //$NON-NLS-1$ + String msg = UniversalSecurityProperties.RESID_SECURITY_LOAD_KEYSTORE_ERROR_; Status err = new Status(IStatus.ERROR, ResourcesPlugin.PI_RESOURCES, IStatus.ERROR, text, exc2); - ErrorDialog.openError(UniversalSecurityPlugin - .getActiveWorkbenchShell(), UniversalSecurityPlugin - .getString("SEC_MSG"), msg, err); //$NON-NLS-1$ + ErrorDialog.openError(UniversalSecurityPlugin.getActiveWorkbenchShell(), UniversalSecurityProperties.RESID_SECURITY_SEC_MSG, msg, err); } @@ -513,7 +484,7 @@ public class UniversalSecurityPreferencePage extends PreferencePage implements boolean sel = _viewer.getSelection().isEmpty(); _renameButton.setEnabled(!sel); _removeButton.setEnabled(!sel); - _propertiesButton.setEnabled(!sel); + _propertiesButton.setEnabled(!sel); } public void widgetSelected(SelectionEvent e) @@ -522,12 +493,12 @@ public class UniversalSecurityPreferencePage extends PreferencePage implements boolean sel = _viewer.getSelection().isEmpty(); _renameButton.setEnabled(!sel); _removeButton.setEnabled(!sel); - _propertiesButton.setEnabled(!sel); + _propertiesButton.setEnabled(!sel); } public void widgetDefaultSelected(SelectionEvent e) { - widgetSelected(e); + widgetSelected(e); } } diff --git a/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/widgets/CertificateForm.java b/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/widgets/CertificateForm.java index d97bd61087d..385f7da16f8 100644 --- a/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/widgets/CertificateForm.java +++ b/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/widgets/CertificateForm.java @@ -7,12 +7,13 @@ * * Initial Contributors: * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, + * component that contains this file: David McKnight, Kushal Munir, + * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * + * * Contributors: * David Dykstal (IBM) - [230815] fix layout problems with long labels + * Martin Oberhuber (Wind River) - [235626] Convert dstore.security to MessageBundle format *******************************************************************************/ @@ -27,7 +28,6 @@ import java.security.cert.CertificateException; import java.util.ArrayList; import org.eclipse.dstore.core.util.ssl.DStoreKeyStore; -import org.eclipse.rse.internal.dstore.security.UniversalSecurityPlugin; import org.eclipse.rse.internal.dstore.security.UniversalSecurityProperties; import org.eclipse.rse.internal.dstore.security.util.GridUtil; import org.eclipse.rse.ui.SystemBaseForm; @@ -53,23 +53,23 @@ public class CertificateForm extends SystemBaseForm private String _aliasStr; private String _pathStr; private ArrayList listenerList; - + private Button _browseButton; public Shell _shell; - + public CertificateForm(Shell shell, ISystemMessageLine msgLine) { super(shell, msgLine); - listenerList = new ArrayList(); + listenerList = new ArrayList(); _shell = shell; } - + public Control getInitialFocusControl() { return _pathField; } - - public Control createContents(Composite c){ + + public Control createContents(Composite c){ GridData data; Composite nameGroup = new Composite(c, SWT.NONE); @@ -78,29 +78,29 @@ public class CertificateForm extends SystemBaseForm data = GridUtil.createFill(); nameGroup.setLayoutData(data); nameGroup.setLayout(layout); - + Label lblPath = new Label(nameGroup, SWT.NONE); - lblPath.setText(UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_CERTIFICATE_FILE)); - _pathField = new Text(nameGroup, SWT.BORDER); + lblPath.setText(UniversalSecurityProperties.RESID_SECURITY_CERTIFICATE_FILE); + _pathField = new Text(nameGroup, SWT.BORDER); _pathField.setLayoutData(GridUtil.createHorizontalFill()); ((GridData)_pathField.getLayoutData()).widthHint = 150; _pathField.setText(""); //$NON-NLS-1$ - + _browseButton = new Button(nameGroup, SWT.PUSH); - _browseButton.setText(UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_BROWSE)); - + _browseButton.setText(UniversalSecurityProperties.RESID_SECURITY_BROWSE); + _browseButton.addListener(SWT.Selection, this); Label lblName = new Label(nameGroup, SWT.NONE); - lblName.setText(UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_CERTIFICATE_ALIAS)); + lblName.setText(UniversalSecurityProperties.RESID_SECURITY_CERTIFICATE_ALIAS); _aliasField = new Text(nameGroup, SWT.BORDER); _aliasField.setText(""); //$NON-NLS-1$ _aliasField.setLayoutData(GridUtil.createHorizontalFill()); - + _aliasField.addListener(SWT.Modify, this); _pathField.addListener(SWT.Modify, this); - + return _pathField; } @@ -120,29 +120,29 @@ public class CertificateForm extends SystemBaseForm //setButtonState(); _pathStr = _pathField.getText(); _aliasStr = _aliasField.getText(); - NotifyListeners(event); + NotifyListeners(event); } } - + public void NotifyListeners(Event event){ for(int i=0;i0 && _pathField.getText().trim().length()>0); } - + private void showFileDialog(){ String currentSource = _pathField.getText(); FileDialog dlg = new FileDialog(_shell, SWT.OPEN); - + dlg.setFileName(currentSource); dlg.setFilterExtensions(new String[]{"*.cer", "*.*"}); //$NON-NLS-1$ //$NON-NLS-2$ - + String source = dlg.open(); if(source!=null) @@ -157,30 +157,30 @@ public class CertificateForm extends SystemBaseForm } _aliasField.setText(alias); } - + } public Certificate loadCertificate(KeyStore ks) throws IOException, CertificateException, KeyStoreException { - + Certificate fCertificate = DStoreKeyStore.loadCertificate(getPath()); DStoreKeyStore.addCertificateToKeyStore(ks, fCertificate, getAliasName()); return fCertificate; - } + } public void registerListener(Listener listener){ listenerList.add(listener); - + } public String getAliasName() { return _aliasStr; } - + public String getPath() { return _pathStr; } - + } diff --git a/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/widgets/CertificatePropertiesForm.java b/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/widgets/CertificatePropertiesForm.java index 3298bde9e1c..f6c1eeca127 100644 --- a/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/widgets/CertificatePropertiesForm.java +++ b/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/widgets/CertificatePropertiesForm.java @@ -7,13 +7,14 @@ * * Initial Contributors: * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, + * component that contains this file: David McKnight, Kushal Munir, + * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * + * * Contributors: - * David Dykstal (IBM) - [231913] increasing width of form to accomodate translation + * David Dykstal (IBM) - [231913] increasing width of form to accommodate translation * David Dykstal (IBM) - [232131] using ICU for DateFormat + * Martin Oberhuber (Wind River) - [235626] Convert dstore.security to MessageBundle format *******************************************************************************/ package org.eclipse.rse.internal.dstore.security.widgets; @@ -21,7 +22,6 @@ package org.eclipse.rse.internal.dstore.security.widgets; import java.security.Key; import java.security.cert.X509Certificate; -import org.eclipse.rse.internal.dstore.security.UniversalSecurityPlugin; import org.eclipse.rse.internal.dstore.security.UniversalSecurityProperties; import org.eclipse.rse.internal.dstore.security.util.GridUtil; import org.eclipse.rse.internal.dstore.security.util.StringModifier; @@ -47,12 +47,12 @@ public class CertificatePropertiesForm extends SystemBaseForm { this(shell, certificate, alias, false); } - + public CertificatePropertiesForm(Shell shell, Object certificate) { this(shell, certificate, false); } - + public CertificatePropertiesForm(Shell shell, Object certificate, String alias, boolean advanced) { super(shell, null); @@ -60,12 +60,12 @@ public class CertificatePropertiesForm extends SystemBaseForm _alias = alias; _advanced = advanced; } - + public CertificatePropertiesForm(Shell shell, Object certificate, boolean advanced) { this(shell, certificate, null, advanced); } - + public Control createContents(Composite parent) { @@ -78,7 +78,7 @@ public class CertificatePropertiesForm extends SystemBaseForm return createSimpleContents(parent); } } - + public Control createSimpleContents(Composite parent) { Composite content = new Composite(parent, SWT.NONE); @@ -89,89 +89,89 @@ public class CertificatePropertiesForm extends SystemBaseForm layout.numColumns = 2; content.setLayout(layout); content.setLayoutData(data); - + if (_alias != null) { Label lblAlias = new Label(content, SWT.NONE); - lblAlias.setText(UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_PROP_ALIAS_LBL)); + lblAlias.setText(UniversalSecurityProperties.RESID_SECURITY_PROP_ALIAS_LBL); data = new GridData(); data.horizontalIndent = 5; lblAlias.setLayoutData(data); - + Label lblAliasValue = new Label(content, SWT.NONE); lblAliasValue.setText(_alias); data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalIndent = 5; lblAliasValue.setLayoutData(data); } - + Label lblVersion = new Label(content, SWT.NONE); - lblVersion.setText(UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_CERTIF_VERSION_LBL)); + lblVersion.setText(UniversalSecurityProperties.RESID_SECURITY_CERTIF_VERSION_LBL); data = new GridData(); - data.horizontalIndent = 5; + data.horizontalIndent = 5; lblVersion.setLayoutData(data); Label lblVersionValue = new Label(content, SWT.NONE); data = new GridData(GridData.FILL_HORIZONTAL); - data.horizontalIndent = 5; + data.horizontalIndent = 5; lblVersionValue.setLayoutData(data); - + Label lblIssuedTo = new Label(content, SWT.NONE); - lblIssuedTo.setText(UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_ISSUED_TO_LBL)); + lblIssuedTo.setText(UniversalSecurityProperties.RESID_SECURITY_ISSUED_TO_LBL); data = new GridData(); data.verticalAlignment = GridData.BEGINNING; - data.horizontalIndent = 5; + data.horizontalIndent = 5; lblIssuedTo.setLayoutData(data); - + Text lblIssuedToValue = new Text(content, SWT.BORDER | SWT.READ_ONLY | SWT.WRAP) ; data = new GridData(GridData.FILL_HORIZONTAL); data.heightHint = 60; - data.horizontalIndent = 5; + data.horizontalIndent = 5; lblIssuedToValue.setLayoutData(data); Label lblIssuedBy = new Label(content, SWT.NONE); - lblIssuedBy.setText(UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_ISSUED_BY_LBL)); + lblIssuedBy.setText(UniversalSecurityProperties.RESID_SECURITY_ISSUED_BY_LBL); data = new GridData(); data.horizontalIndent = 5; - data.verticalAlignment = GridData.BEGINNING; + data.verticalAlignment = GridData.BEGINNING; lblIssuedBy.setLayoutData(data); - + Text lblIssuedByValue = new Text(content, SWT.BORDER |SWT.READ_ONLY | SWT.WRAP); data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalIndent = 5; - data.heightHint = 60; + data.heightHint = 60; lblIssuedByValue.setLayoutData(data); Label lblValidity = new Label(content, SWT.NONE); - lblValidity.setText(UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_VALIDITY_LBL)); + lblValidity.setText(UniversalSecurityProperties.RESID_SECURITY_VALIDITY_LBL); data = new GridData(); - data.horizontalIndent = 5; + data.horizontalIndent = 5; lblValidity.setLayoutData(data); - + Label lblValidityValue = new Label(content, SWT.NONE); data = new GridData(GridData.FILL_HORIZONTAL); - data.horizontalIndent = 5; + data.horizontalIndent = 5; lblValidityValue.setLayoutData(data); - + Label lblAlgorithm = new Label(content, SWT.NONE); - lblAlgorithm.setText(UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_ALGORITHM_LBL)); + lblAlgorithm.setText(UniversalSecurityProperties.RESID_SECURITY_ALGORITHM_LBL); data = new GridData(); - data.horizontalIndent = 5; + data.horizontalIndent = 5; lblAlgorithm.setLayoutData(data); Label lblAlgorithmValue = new Label(content, SWT.NONE); data = new GridData(GridData.FILL_HORIZONTAL); - data.horizontalIndent = 5; + data.horizontalIndent = 5; lblAlgorithmValue.setLayoutData(data); - + if(_certificate instanceof X509Certificate){ lblVersionValue.setText(((X509Certificate)_certificate).getType() + " V."+((X509Certificate)_certificate).getVersion()); //$NON-NLS-1$ lblIssuedToValue.setText(((X509Certificate)_certificate).getSubjectDN().getName()); lblIssuedByValue.setText(((X509Certificate)_certificate).getIssuerDN().getName()); DateFormat df = DateFormat.getDateInstance(DateFormat.LONG); - - String validity = UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_VALIDITY_PERIOD); + + String validity = UniversalSecurityProperties.RESID_SECURITY_VALIDITY_PERIOD; validity = StringModifier.change(validity,"%1", df.format(((X509Certificate)_certificate).getNotBefore())); //$NON-NLS-1$ validity = StringModifier.change(validity,"%2", df.format(((X509Certificate)_certificate).getNotAfter())); //$NON-NLS-1$ @@ -181,11 +181,11 @@ public class CertificatePropertiesForm extends SystemBaseForm lblVersionValue.setText(((Key)_certificate).getFormat()); lblAlgorithmValue.setText(((Key)_certificate).getAlgorithm()); } - + return content; } - - + + public Control createAdvancedContents(Composite parent) { Composite content = new Composite(parent, SWT.NONE); @@ -196,89 +196,89 @@ public class CertificatePropertiesForm extends SystemBaseForm layout.numColumns = 2; content.setLayout(layout); content.setLayoutData(data); - + if (_alias != null) { Label lblAlias = new Label(content, SWT.NONE); - lblAlias.setText(UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_PROP_ALIAS_LBL)); + lblAlias.setText(UniversalSecurityProperties.RESID_SECURITY_PROP_ALIAS_LBL); data = new GridData(); data.horizontalIndent = 5; lblAlias.setLayoutData(data); - + Label lblAliasValue = new Label(content, SWT.NONE); lblAliasValue.setText(_alias); data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalIndent = 5; lblAliasValue.setLayoutData(data); } - + Label lblVersion = new Label(content, SWT.NONE); - lblVersion.setText(UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_CERTIF_VERSION_LBL)); + lblVersion.setText(UniversalSecurityProperties.RESID_SECURITY_CERTIF_VERSION_LBL); data = new GridData(); - data.horizontalIndent = 5; + data.horizontalIndent = 5; lblVersion.setLayoutData(data); Label lblVersionValue = new Label(content, SWT.NONE); data = new GridData(GridData.FILL_HORIZONTAL); - data.horizontalIndent = 5; + data.horizontalIndent = 5; lblVersionValue.setLayoutData(data); - + Label lblIssuedTo = new Label(content, SWT.NONE); - lblIssuedTo.setText(UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_ISSUED_TO_LBL)); + lblIssuedTo.setText(UniversalSecurityProperties.RESID_SECURITY_ISSUED_TO_LBL); data = new GridData(); data.verticalAlignment = GridData.BEGINNING; - data.horizontalIndent = 5; + data.horizontalIndent = 5; lblIssuedTo.setLayoutData(data); - + Text lblIssuedToValue = new Text(content, SWT.BORDER | SWT.READ_ONLY | SWT.WRAP) ; data = new GridData(GridData.FILL_HORIZONTAL); data.heightHint = 60; - data.horizontalIndent = 5; + data.horizontalIndent = 5; lblIssuedToValue.setLayoutData(data); Label lblIssuedBy = new Label(content, SWT.NONE); - lblIssuedBy.setText(UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_ISSUED_BY_LBL)); + lblIssuedBy.setText(UniversalSecurityProperties.RESID_SECURITY_ISSUED_BY_LBL); data = new GridData(); data.horizontalIndent = 5; - data.verticalAlignment = GridData.BEGINNING; + data.verticalAlignment = GridData.BEGINNING; lblIssuedBy.setLayoutData(data); - + Text lblIssuedByValue = new Text(content, SWT.BORDER |SWT.READ_ONLY | SWT.WRAP); data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalIndent = 5; - data.heightHint = 60; + data.heightHint = 60; lblIssuedByValue.setLayoutData(data); Label lblValidity = new Label(content, SWT.NONE); - lblValidity.setText(UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_VALIDITY_LBL)); + lblValidity.setText(UniversalSecurityProperties.RESID_SECURITY_VALIDITY_LBL); data = new GridData(); - data.horizontalIndent = 5; + data.horizontalIndent = 5; lblValidity.setLayoutData(data); - + Label lblValidityValue = new Label(content, SWT.NONE); data = new GridData(GridData.FILL_HORIZONTAL); - data.horizontalIndent = 5; + data.horizontalIndent = 5; lblValidityValue.setLayoutData(data); - + Label lblAlgorithm = new Label(content, SWT.NONE); - lblAlgorithm.setText(UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_ALGORITHM_LBL)); + lblAlgorithm.setText(UniversalSecurityProperties.RESID_SECURITY_ALGORITHM_LBL); data = new GridData(); - data.horizontalIndent = 5; + data.horizontalIndent = 5; lblAlgorithm.setLayoutData(data); Label lblAlgorithmValue = new Label(content, SWT.NONE); data = new GridData(GridData.FILL_HORIZONTAL); - data.horizontalIndent = 5; + data.horizontalIndent = 5; lblAlgorithmValue.setLayoutData(data); - + if(_certificate instanceof X509Certificate){ lblVersionValue.setText(((X509Certificate)_certificate).getType() + " V."+((X509Certificate)_certificate).getVersion()); //$NON-NLS-1$ lblIssuedToValue.setText(((X509Certificate)_certificate).getSubjectDN().getName()); lblIssuedByValue.setText(((X509Certificate)_certificate).getIssuerDN().getName()); DateFormat df = DateFormat.getDateInstance(DateFormat.LONG); - - String validity = UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_VALIDITY_PERIOD); + + String validity = UniversalSecurityProperties.RESID_SECURITY_VALIDITY_PERIOD; validity = StringModifier.change(validity,"%1", df.format(((X509Certificate)_certificate).getNotBefore())); //$NON-NLS-1$ validity = StringModifier.change(validity,"%2", df.format(((X509Certificate)_certificate).getNotAfter())); //$NON-NLS-1$ @@ -288,7 +288,7 @@ public class CertificatePropertiesForm extends SystemBaseForm lblVersionValue.setText(((Key)_certificate).getFormat()); lblAlgorithmValue.setText(((Key)_certificate).getAlgorithm()); } - + return content; } } diff --git a/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/wizards/SystemImportCertWizardMainPage.java b/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/wizards/SystemImportCertWizardMainPage.java index eea74f284a1..87643e66b30 100644 --- a/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/wizards/SystemImportCertWizardMainPage.java +++ b/rse/plugins/org.eclipse.rse.dstore.security/src/org/eclipse/rse/internal/dstore/security/wizards/SystemImportCertWizardMainPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2007 IBM Corporation and others. + * Copyright (c) 2002, 2008 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 @@ -7,12 +7,12 @@ * * Initial Contributors: * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, + * component that contains this file: David McKnight, Kushal Munir, + * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * + * * Contributors: - * {Name} (company) - description of contribution. + * Martin Oberhuber (Wind River) - [235626] Convert dstore.security to MessageBundle format *******************************************************************************/ package org.eclipse.rse.internal.dstore.security.wizards; @@ -25,7 +25,6 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.TableLayout; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.wizard.Wizard; -import org.eclipse.rse.internal.dstore.security.UniversalSecurityPlugin; import org.eclipse.rse.internal.dstore.security.UniversalSecurityProperties; import org.eclipse.rse.internal.dstore.security.preference.CertTableContentProvider; import org.eclipse.rse.internal.dstore.security.preference.X509CertificateElement; @@ -48,26 +47,26 @@ import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableColumn; -public class SystemImportCertWizardMainPage +public class SystemImportCertWizardMainPage extends AbstractSystemWizardPage - implements Listener -{ + implements Listener +{ protected SystemMessage errorMessage; protected ISystemValidator nameValidator; protected ISystemMessageLine msgLine; - + private List _certificates; private Button _propertiesButton; private TableViewer _viewer; - + /** * Constructor. */ public SystemImportCertWizardMainPage(Wizard wizard, List certs) { super(wizard, "NewCertificate", //$NON-NLS-1$ - UniversalSecurityProperties.RESID_SECURITY_TRUST_WIZ_CERTIFICATE_TITLE, + UniversalSecurityProperties.RESID_SECURITY_TRUST_WIZ_CERTIFICATE_TITLE, UniversalSecurityProperties.RESID_SECURITY_TRUST_WIZ_CERTIFICATE_DESC); _certificates = certs; } @@ -89,18 +88,18 @@ public class SystemImportCertWizardMainPage SystemWidgetHelpers.createLabel(verbiage, UniversalSecurityProperties.RESID_SECURITY_CERTIFICATE_INFORMATION); createTableViewer(verbiage); - + Composite b = new Composite(parent, SWT.NULL); GridLayout blayout = new GridLayout(); GridData bdata = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.END); blayout.numColumns = 3; b.setLayout(blayout); b.setLayoutData(bdata); - _propertiesButton = SystemWidgetHelpers.createPushButton(b, UniversalSecurityProperties.RESID_SECURITY_PROPERTIES_LBL, this); - + _propertiesButton = SystemWidgetHelpers.createPushButton(b, UniversalSecurityProperties.RESID_SECURITY_PROPERTIES_LBL, this); + return _propertiesButton; } - + private void createTableViewer(Composite parent) { @@ -119,15 +118,15 @@ public class SystemImportCertWizardMainPage TableLayout tableLayout = new TableLayout(); TableColumn toColumn = new TableColumn(table, SWT.LEFT); - toColumn.setText(UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_PREF_ISSUED_TO)); + toColumn.setText(UniversalSecurityProperties.RESID_SECURITY_PREF_ISSUED_TO); tableLayout.addColumnData(new ColumnPixelData(90)); - + TableColumn frmColumn = new TableColumn(table, SWT.LEFT); - frmColumn.setText(UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_PREF_ISSUED_FROM)); + frmColumn.setText(UniversalSecurityProperties.RESID_SECURITY_PREF_ISSUED_FROM); tableLayout.addColumnData(new ColumnPixelData(90)); - + TableColumn expColumn = new TableColumn(table, SWT.RIGHT); - expColumn.setText(UniversalSecurityPlugin.getString(UniversalSecurityProperties.RESID_SECURITY_PREF_EXPIRES)); + expColumn.setText(UniversalSecurityProperties.RESID_SECURITY_PREF_EXPIRES); tableLayout.addColumnData(new ColumnPixelData(180)); table.setLayout(tableLayout); @@ -136,9 +135,9 @@ public class SystemImportCertWizardMainPage _viewer.setColumnProperties(properties); _viewer.setContentProvider(new CertTableContentProvider()); _viewer.setLabelProvider(new NewCertTableLabelProvider()); - + if (_certificates != null) - { + { for (int i = 0; i < _certificates.size(); i++) { _viewer.add(getElement(_certificates.get(i))); @@ -146,31 +145,31 @@ public class SystemImportCertWizardMainPage } } - - + + public void handleEvent(Event e) { if (e.widget == _propertiesButton) { IStructuredSelection sel = (IStructuredSelection)_viewer.getSelection(); sel.getFirstElement(); - + X509CertificatePropertiesDialog dlg = new X509CertificatePropertiesDialog(getShell(), (X509CertificateElement)sel.getFirstElement()); dlg.open(); } } - + public X509CertificateElement getElement(Object cert) { if (cert instanceof X509Certificate) { - return new X509CertificateElement(null, - UniversalSecurityProperties.RESID_SECURITY_TRUSTED_CERTIFICATE, + return new X509CertificateElement(null, + UniversalSecurityProperties.RESID_SECURITY_TRUSTED_CERTIFICATE, (X509Certificate)cert); } return null; } - + /** * Return the Control to be given initial focus. * Override from parent. Return control to be given initial focus. @@ -179,31 +178,31 @@ public class SystemImportCertWizardMainPage { return _propertiesButton; } - + /** * Init values using input data */ protected void initializeInput() { } - - - + + + /** - * Completes processing of the wizard. If this - * method returns true, the wizard will close; + * Completes processing of the wizard. If this + * method returns true, the wizard will close; * otherwise, it will stay active. - * This method is an override from the parent Wizard class. + * This method is an override from the parent Wizard class. * * @return whether the wizard finished successfully */ - public boolean performFinish() + public boolean performFinish() { - + return true; } - - + + /** * Return true if the page is complete, so to enable Finish. @@ -213,6 +212,6 @@ public class SystemImportCertWizardMainPage { return true; } - + }