[jbosstools-commits] JBoss Tools SVN: r43878 - in trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui: wizard and 1 other directory.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Thu Sep 20 14:15:43 EDT 2012
Author: adietish
Date: 2012-09-20 14:15:42 -0400 (Thu, 20 Sep 2012)
New Revision: 43878
Added:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/LinkSelectionAdapter.java
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPage.java
Log:
[JBIDE-11912] corrected error text and link text. merged the 2 texts with links to a single one
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/LinkSelectionAdapter.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/LinkSelectionAdapter.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/LinkSelectionAdapter.java 2012-09-20 18:15:42 UTC (rev 43878)
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.ui.utils;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+
+/**
+ * @author Andre Dietisheim
+ */
+public abstract class LinkSelectionAdapter extends SelectionAdapter {
+
+ private String text;
+
+ public LinkSelectionAdapter(String text) {
+ Assert.isLegal(text != null
+ && !text.isEmpty());
+ this.text = text;
+ }
+
+ @Override
+ public final void widgetSelected(SelectionEvent e) {
+ if (text.equals(e.text)) {
+ doWidgetSelected(e);
+ }
+ }
+
+ protected abstract void doWidgetSelected(SelectionEvent e);
+
+
+}
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/LinkSelectionAdapter.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPage.java 2012-09-20 17:54:44 UTC (rev 43877)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPage.java 2012-09-20 18:15:42 UTC (rev 43878)
@@ -56,6 +56,7 @@
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
import org.jboss.tools.openshift.express.internal.ui.job.LoadKeysJob;
import org.jboss.tools.openshift.express.internal.ui.utils.JobChainBuilder;
+import org.jboss.tools.openshift.express.internal.ui.utils.LinkSelectionAdapter;
import org.jboss.tools.openshift.express.internal.ui.utils.StringUtils;
import org.jboss.tools.openshift.express.internal.ui.utils.UIUtils;
import org.jboss.tools.openshift.express.internal.ui.wizard.ssh.ManageSSHKeysWizard;
@@ -190,23 +191,16 @@
dbc.addValidationStatusProvider(
new RemoteNameValidationStatusProvider(remoteNameTextObservable, projectNameModelObservable));
- Link sshPrefsLink = new Link(parent, SWT.NONE);
- sshPrefsLink.setText("Make sure your SSH key used with your user " + wizardModel.getUser().getUsername()
- + "\nis listed in <a>SSH2 Preferences</a>.");
+ Link sshLink = new Link(parent, SWT.NONE);
+ sshLink.setText("Make sure that you have SSH keys added to your OpenShift account " + wizardModel.getUser().getUsername() +"\n"
+ + "via <a>SSH Keys wizard</a> and that the private keys are listed in <a>SSH2 Preferences</a>");
GridDataFactory.fillDefaults()
- .align(SWT.FILL, SWT.CENTER).grab(true, false).indent(10, 0).applyTo(sshPrefsLink);
- sshPrefsLink.addSelectionListener(onSshPrefs());
-
- Link sshManagementLink = new Link(parent, SWT.NONE);
- sshManagementLink.setText(
- "Please make sure that you have SSH keys added to your OpenShift account.\n" +
- "You may check them in the <a>SSH2 keys wizard</a>.");
- GridDataFactory.fillDefaults()
- .align(SWT.FILL, SWT.CENTER).grab(true, false).indent(10,0).applyTo(sshManagementLink);
- sshManagementLink.addSelectionListener(onManageSSHKeys());
-
+ .align(SWT.FILL, SWT.CENTER).grab(true, false).indent(10, 0).applyTo(sshLink);
+ sshLink.addSelectionListener(onSshPrefs("SSH2 Preferences"));
+ sshLink.addSelectionListener(onManageSSHKeys("SSH Keys wizard"));
+
ValueBindingBuilder
- .bind(WidgetProperties.text().observe(sshManagementLink))
+ .bind(WidgetProperties.text().observe(sshLink))
.notUpdating(BeanProperties.value(
GitCloningSettingsWizardPageModel.PROPERTY_HAS_REMOTEKEYS).observe(pageModel))
.withStrategy(new UpdateValueStrategy(UpdateValueStrategy.POLICY_CONVERT))
@@ -222,7 +216,7 @@
return ValidationStatus.ok();
} else {
return ValidationStatus
- .error("You have not added any SSH public keys to OpenShift yet. Please use the SSH2 keys wizard.");
+ .error("No public keys found in your account. Please use the SSH keys wizard.");
}
}
})
@@ -257,16 +251,30 @@
};
}
- private SelectionAdapter onSshPrefs() {
- return new SelectionAdapter() {
+ private SelectionAdapter onSshPrefs(String text) {
+ return new LinkSelectionAdapter(text) {
@Override
- public void widgetSelected(SelectionEvent e) {
+ public void doWidgetSelected(SelectionEvent e) {
SshPrivateKeysPreferences.openPreferencesPage(getShell());
}
};
}
+ private SelectionAdapter onManageSSHKeys(String text) {
+ return new LinkSelectionAdapter(text) {
+
+ @Override
+ public void doWidgetSelected(SelectionEvent e) {
+ WizardDialog manageSSHKeysWizard =
+ new OkButtonWizardDialog(getShell(), new ManageSSHKeysWizard(wizardModel.getUser()));
+ if (manageSSHKeysWizard.open() == Dialog.OK) {
+ refreshHasRemoteKeys();
+ }
+ }
+ };
+ }
+
protected void onPageActivated(DataBindingContext dbc) {
enableWidgets(pageModel.isNewProject());
repoPathValidator.forceRevalidate();
@@ -425,19 +433,4 @@
}
}
}
-
- private SelectionAdapter onManageSSHKeys() {
- return new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- WizardDialog manageSSHKeysWizard =
- new OkButtonWizardDialog(getShell(), new ManageSSHKeysWizard(wizardModel.getUser()));
- if (manageSSHKeysWizard.open() == Dialog.OK) {
- refreshHasRemoteKeys();
- }
- }
- };
- }
-
}
More information about the jbosstools-commits
mailing list