JBoss Tools SVN: r43917 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-09-21 05:20:20 -0400 (Fri, 21 Sep 2012)
New Revision: 43917
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AbstractSSHKeyWizardPageModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyWizardPageModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/NewSSHKeyWizardPageModel.java
Log:
[JBIDE-11912] implementation finished: corrected bugs with layout and validation status
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AbstractSSHKeyWizardPageModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AbstractSSHKeyWizardPageModel.java 2012-09-21 09:10:25 UTC (rev 43916)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AbstractSSHKeyWizardPageModel.java 2012-09-21 09:20:20 UTC (rev 43917)
@@ -60,5 +60,4 @@
}
return ssh2Home;
}
-
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyWizardPageModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyWizardPageModel.java 2012-09-21 09:10:25 UTC (rev 43916)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyWizardPageModel.java 2012-09-21 09:20:20 UTC (rev 43917)
@@ -15,7 +15,6 @@
import java.io.IOException;
import org.jboss.tools.openshift.express.internal.core.console.UserDelegate;
-import org.jboss.tools.openshift.express.internal.ui.utils.SSHUserConfig;
import com.openshift.client.OpenShiftException;
import com.openshift.client.SSHPublicKey;
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/NewSSHKeyWizardPageModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/NewSSHKeyWizardPageModel.java 2012-09-21 09:10:25 UTC (rev 43916)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/NewSSHKeyWizardPageModel.java 2012-09-21 09:20:20 UTC (rev 43917)
@@ -15,6 +15,7 @@
import java.io.IOException;
import org.jboss.tools.openshift.express.internal.core.console.UserDelegate;
+import org.jboss.tools.openshift.express.internal.ui.utils.FileUtils;
import org.jboss.tools.openshift.express.internal.ui.utils.SSHUtils;
import org.jboss.tools.openshift.express.internal.ui.utils.StringUtils;
@@ -108,6 +109,7 @@
}
private SSHKeyPair createSSHKey() {
+ ensureSSHHomeExists(ssh2Home);
File privateKey = new File(ssh2Home, privateKeyName);
File publicKey = new File(ssh2Home, publicKeyName);
SSHKeyPair keyPair =
@@ -116,4 +118,25 @@
return keyPair;
}
+ private void ensureSSHHomeExists(String ssh2Home)
+ throws OpenShiftException {
+ File ssh2HomeFile = new File(ssh2Home);
+ if (FileUtils.canRead(ssh2HomeFile)) {
+ if (!FileUtils.isDirectory(ssh2HomeFile)) {
+ throw new OpenShiftException(
+ ssh2Home + " is a file instead of a directory. This prevents creation and usage of ssh keys");
+ }
+ return;
+ }
+
+ try {
+ if(!ssh2HomeFile.mkdirs()) {
+ throw new OpenShiftException("Could not create ssh2 home directory at {0}", ssh2Home);
+ }
+ } catch(SecurityException e) {
+ throw new OpenShiftException(e, "Could not create ssh2 home directory at {0}", ssh2Home);
+ }
+ }
+
+
}
13 years, 6 months
JBoss Tools SVN: r43916 - trunk/tests/plugins/org.jboss.tools.tests.installation/src/org/jboss/tools/tests/installation.
by jbosstools-commits@lists.jboss.org
Author: psrna
Date: 2012-09-21 05:10:25 -0400 (Fri, 21 Sep 2012)
New Revision: 43916
Modified:
trunk/tests/plugins/org.jboss.tools.tests.installation/src/org/jboss/tools/tests/installation/InstallTest.java
Log:
* add: install IUs selectively
Modified: trunk/tests/plugins/org.jboss.tools.tests.installation/src/org/jboss/tools/tests/installation/InstallTest.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.tests.installation/src/org/jboss/tools/tests/installation/InstallTest.java 2012-09-21 08:53:14 UTC (rev 43915)
+++ trunk/tests/plugins/org.jboss.tools.tests.installation/src/org/jboss/tools/tests/installation/InstallTest.java 2012-09-21 09:10:25 UTC (rev 43916)
@@ -11,6 +11,9 @@
package org.jboss.tools.tests.installation;
+import java.util.ArrayList;
+import java.util.List;
+
import junit.framework.Assert;
import org.eclipse.swtbot.eclipse.finder.SWTBotEclipseTestCase;
@@ -20,15 +23,20 @@
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.eclipse.swtbot.swt.finder.waits.ICondition;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* This is a bot scenario which performs install through p2 UI.
* It takes as input a p2 repository URL configured in the UPDATE_SITE
- * system property.
+ * system property. By default all features will be installed.
+ * If IUs system property is specified - only selected IUs
+ * will be installed. IUs system property is a comma separeted string
+ * of IU names. For example: "Abridged JBoss Tools 4.0,Hibernate Tools"
*
* @author Mickael Istria
+ * @author Pavol Srna
*/
@RunWith(SWTBotJunit4ClassRunner.class)
public class InstallTest extends SWTBotEclipseTestCase {
@@ -44,10 +52,13 @@
String site = System.getProperty("UPDATE_SITE");
Assert.assertNotNull("No site specified, set UPDATE_SITE system property first", site);
- installFromSite(site);
+ String IUs = System.getProperty("IUs");//optional property to install only selected IUs
+
+ installFromSite(site, IUs);
}
- private void installFromSite(String site) {
+
+ private void installFromSite(String site, String selectedIUs) {
this.bot.menu("Help").menu("Install New Software...").click();
this.bot.shell("Install").bot().button("Add...").click();
this.bot.shell("Add Repository").activate().setFocus();
@@ -70,7 +81,17 @@
return "Could not see categories in tree";
}
});
- this.bot.button("Select All").click();
+
+ if(selectedIUs != null){
+ //select IUs to install
+ for(String iu : selectedIUs.split(",")){
+ assertFalse("IU: \"" + iu + "\" NOT FOUND!", !checkIU(iu));
+ }
+
+ } else {
+ this.bot.button("Select All").click();
+ }
+
this.bot.button("Next >").click();
this.bot.waitUntil(new ICondition() {
@Override
@@ -102,7 +123,7 @@
try {
bot.button("Next >").click();
bot.radio(0).click();
- bot.button("Finish").click();
+ bot.button("Finish").click();
// wait for Security pop-up, or install finished.
final SWTBotShell shell = bot.shell("Installing Software");
bot.waitWhile(new ICondition() {
@@ -165,5 +186,36 @@
}
}
+ /**
+ * Checks IU (Category, or Feature) in a tree
+ * @param iu to be checked
+ * @return true if checked
+ *
+ * @author Pavol Srna
+ */
+ private boolean checkIU(String iu){
+ boolean checked = false;
+ for(SWTBotTreeItem node : bot.tree().getAllItems()){
+ //traverse through all categories
+ if(node.getText().equals(iu)){
+ node.check();
+ checked = true;
+ break;
+ }else{
+ //expand category
+ node.expand();
+ for(SWTBotTreeItem i : node.getItems()){
+ //traverse through category features
+ if(i.getText().equals(iu)){
+ i.check();
+ checked = true;
+ break;
+ }
+ }
+ }
+ }
+ return checked;
+ }
+
}
13 years, 6 months
JBoss Tools SVN: r43915 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-09-21 04:53:14 -0400 (Fri, 21 Sep 2012)
New Revision: 43915
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPage.java
Log:
[JBIDE-11912] implementation finished: corrected bugs with layout and validation status
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-21 08:51:52 UTC (rev 43914)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPage.java 2012-09-21 08:53:14 UTC (rev 43915)
@@ -11,7 +11,6 @@
package org.jboss.tools.openshift.express.internal.ui.wizard;
import org.eclipse.core.databinding.DataBindingContext;
-import org.eclipse.core.databinding.UpdateValueStrategy;
import org.eclipse.core.databinding.beans.BeanProperties;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.core.databinding.validation.IValidator;
@@ -199,11 +198,14 @@
sshLink.addSelectionListener(onSshPrefs("SSH2 Preferences"));
sshLink.addSelectionListener(onManageSSHKeys("SSH Keys wizard"));
+ // we need a binding to have validation setting wizard validation status
+ Label dummyLabel = new Label(parent, SWT.None);
+ dummyLabel.setVisible(false);
+ GridDataFactory.fillDefaults().exclude(true).applyTo(dummyLabel);
ValueBindingBuilder
- .bind(WidgetProperties.text().observe(sshLink))
+ .bind(WidgetProperties.text().observe(dummyLabel))
.notUpdating(BeanProperties.value(
GitCloningSettingsWizardPageModel.PROPERTY_HAS_REMOTEKEYS).observe(pageModel))
- .withStrategy(new UpdateValueStrategy(UpdateValueStrategy.POLICY_CONVERT))
.validatingAfterGet(new IValidator() {
@Override
13 years, 6 months
JBoss Tools SVN: r43914 - workspace/dgolovin.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2012-09-21 04:51:52 -0400 (Fri, 21 Sep 2012)
New Revision: 43914
Removed:
workspace/dgolovin/org.jboss.tools.vpe.docbook/
Log:
dgolovin workspace cleanup
13 years, 6 months
JBoss Tools SVN: r43913 - workspace/dgolovin.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2012-09-21 04:51:11 -0400 (Fri, 21 Sep 2012)
New Revision: 43913
Removed:
workspace/dgolovin/experimental-build/
Log:
dgolovin workspace cleanup
13 years, 6 months
JBoss Tools SVN: r43912 - workspace/dgolovin.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2012-09-21 04:49:31 -0400 (Fri, 21 Sep 2012)
New Revision: 43912
Removed:
workspace/dgolovin/build/
Log:
dgolovin workspace cleanup
13 years, 6 months
JBoss Tools SVN: r43911 - workspace/dgolovin.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2012-09-21 04:46:23 -0400 (Fri, 21 Sep 2012)
New Revision: 43911
Removed:
workspace/dgolovin/tests/
Log:
dgolovin workspace cleanup
13 years, 6 months
JBoss Tools SVN: r43910 - workspace/dgolovin.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2012-09-21 04:44:19 -0400 (Fri, 21 Sep 2012)
New Revision: 43910
Removed:
workspace/dgolovin/xulrunner/
Log:
dgolovin workspace cleanup
13 years, 6 months
JBoss Tools SVN: r43909 - workspace/dgolovin.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2012-09-21 04:42:32 -0400 (Fri, 21 Sep 2012)
New Revision: 43909
Removed:
workspace/dgolovin/jmx/
Log:
dgolovin workspace cleanup
13 years, 6 months
JBoss Tools SVN: r43907 - in trunk/runtime/plugins: org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/download and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: fbricon
Date: 2012-09-21 04:26:57 -0400 (Fri, 21 Sep 2012)
New Revision: 43907
Modified:
trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/model/DownloadRuntime.java
trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/download/DownloadRuntimeDialog.java
Log:
JBIDE-12472 let the user select which runtime he wants to download
Modified: trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/model/DownloadRuntime.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/model/DownloadRuntime.java 2012-09-21 08:19:16 UTC (rev 43906)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/model/DownloadRuntime.java 2012-09-21 08:26:57 UTC (rev 43907)
@@ -36,6 +36,8 @@
private String version;
private String url;
private String licenseURL;
+ private String humanUrl;
+
private boolean disclaimer = true;
public DownloadRuntime(String id, String name, String version, String url) {
@@ -154,4 +156,12 @@
r = in.read(BUFFER);
}
}
+
+ public String getHumanUrl() {
+ return humanUrl;
+ }
+
+ public void setHumanUrl(String humanUrl) {
+ this.humanUrl = humanUrl;
+ }
}
Modified: trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/download/DownloadRuntimeDialog.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/download/DownloadRuntimeDialog.java 2012-09-21 08:19:16 UTC (rev 43906)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/download/DownloadRuntimeDialog.java 2012-09-21 08:26:57 UTC (rev 43907)
@@ -39,9 +39,11 @@
import org.eclipse.swt.events.ModifyListener;
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.Button;
+import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.DirectoryDialog;
@@ -68,6 +70,7 @@
*/
public class DownloadRuntimeDialog extends Dialog {
+ private static final String SELECTED_RUNTIME_REQUIRED = "A runtime must be selected";//$NON-NLS-1$
private static final String SEPARATOR = "/"; //$NON-NLS-1$
private static final String FOLDER_IS_REQUIRED = "This folder is required";
private static final String FOLDER_IS_NOT_WRITABLE = "This folder does not exist or is not writable";
@@ -81,11 +84,18 @@
private Text destinationPathText;
private Text pathText;
private DownloadRuntime downloadRuntime;
+ private List<DownloadRuntime> downloadRuntimes;
private String delete;
private ControlDecoration decPathError;
private ControlDecoration decPathReq;
private ControlDecoration destinationPathError;
private ControlDecoration destinationPathReq;
+ private ControlDecoration selectRuntimeError;
+ private Combo runtimesCombo;
+ private Link urlText;
+ private Group warningComposite;
+ private Label warningLabel;
+ private Link warningLink;
public DownloadRuntimeDialog(Shell parentShell, DownloadRuntime downloadRuntime) {
super(parentShell);
@@ -95,60 +105,69 @@
this.downloadRuntime = downloadRuntime;
}
+ public DownloadRuntimeDialog(Shell parentShell, List<DownloadRuntime> downloadRuntimes) {
+ super(parentShell);
+ setShellStyle(SWT.CLOSE | SWT.MAX | SWT.TITLE | SWT.BORDER
+ | SWT.RESIZE | getDefaultOrientation());
+ dialogSettings = RuntimeUIActivator.getDefault().getDialogSettings();
+ this.downloadRuntimes = downloadRuntimes;
+ if (downloadRuntimes != null && downloadRuntimes.size() == 1) {
+ downloadRuntime = downloadRuntimes.get(0);
+ }
+ }
+
@Override
protected Control createDialogArea(Composite parent) {
- getShell().setText("Download Runtime '" + downloadRuntime.getName() + "'");
+ if (downloadRuntime != null) {
+ getShell().setText("Download Runtime '" + downloadRuntime.getName() + "'");//$NON-NLS-1$ //$NON-NLS-2$
+ } else {
+ getShell().setText("Download Runtime");//$NON-NLS-1$
+ }
Composite area = (Composite) super.createDialogArea(parent);
Composite contents = new Composite(area, SWT.NONE);
GridData gd = new GridData(GridData.FILL_BOTH);
+ gd.widthHint = 690;
contents.setLayoutData(gd);
contents.setLayout(new GridLayout(1, false));
applyDialogFont(contents);
initializeDialogUnits(area);
+
Composite pathComposite = new Composite(contents, SWT.NONE);
gd = new GridData(SWT.FILL, SWT.FILL, true, false);
pathComposite.setLayoutData(gd);
pathComposite.setLayout(new GridLayout(3, false));
- if (downloadRuntime.isDisclaimer()) {
- Group disclaimerComposite = new Group(pathComposite, SWT.NONE);
- gd = new GridData(SWT.FILL, SWT.FILL, true, false);
- gd.horizontalSpan = 3;
- disclaimerComposite.setLayoutData(gd);
- disclaimerComposite.setLayout(new GridLayout(1, false));
- disclaimerComposite.setText("Warning");
- new Label(disclaimerComposite, SWT.NONE).setText("This is a community project and, as such is not supported with an SLA.");
- Link link = new Link(disclaimerComposite, SWT.NONE);
- link.setText("If you're looking for fully supported, certified, enterprise middleware try JBoss Enterprise Middleware products. <a>Show Details</a>");
-
- link.addSelectionListener( new SelectionAdapter( ) {
-
- public void widgetSelected( SelectionEvent e )
- {
- String text = e.text;
- if ("Show Details".equals(text)) {
- IWorkbenchBrowserSupport support = PlatformUI.getWorkbench()
- .getBrowserSupport();
- try {
- URL url = new URL("http://www.redhat.com/jboss/"); //$NON-NLS-1$
- support.getExternalBrowser().openURL(url);
- } catch (Exception e1) {
- RuntimeUIActivator.log(e1);
- }
- }
-
- }
- } );
+ if (downloadRuntimes != null) {
+ addRuntimeSelectionCombo(pathComposite);
}
+
Label urlLabel = new Label(pathComposite, SWT.NONE);
urlLabel.setText("URL:");
- Text urlText = new Text(pathComposite, SWT.READ_ONLY|SWT.BORDER);
+ urlText = new Link(pathComposite, SWT.NONE);
gd = new GridData(SWT.FILL, SWT.FILL, true, false);
gd.horizontalSpan=2;
urlText.setLayoutData(gd);
- urlText.setText(downloadRuntime.getUrl());
- urlText.setEnabled(false);
+ urlText.addSelectionListener( new SelectionAdapter( ) {
+
+ public void widgetSelected( SelectionEvent e )
+ {
+ String t = e.text;
+ String humanUrl = downloadRuntime.getHumanUrl();
+ if (humanUrl != null && t.contains(humanUrl)) {
+ IWorkbenchBrowserSupport support = PlatformUI.getWorkbench()
+ .getBrowserSupport();
+ try {
+ URL url = new URL(humanUrl); //$NON-NLS-1$
+ support.getExternalBrowser().openURL(url);
+ } catch (Exception e1) {
+ RuntimeUIActivator.log(e1);
+ }
+ }
+
+ }
+ } );
+
Label pathLabel = new Label(pathComposite, SWT.NONE);
pathLabel.setText("Install folder:");
@@ -244,10 +263,114 @@
}
});
+
+ warningComposite = new Group(pathComposite, SWT.NONE);
+ gd = new GridData(SWT.FILL, SWT.FILL, true, false);
+ gd.horizontalSpan = 3;
+ warningComposite.setLayoutData(gd);
+ warningComposite.setLayout(new GridLayout(1, false));
+ warningComposite.setText("Warning");
+ warningLabel = new Label(warningComposite, SWT.NONE);
+ warningLink = new Link(warningComposite, SWT.NONE);
+
+ warningLink.addSelectionListener( new SelectionAdapter( ) {
+
+ public void widgetSelected( SelectionEvent e )
+ {
+ String text = e.text;
+ String humanUrl = downloadRuntime == null ? null : downloadRuntime.getHumanUrl();
+ String linkUrl = null;
+ if (humanUrl != null && "link".equals(text)) {//$NON-NLS-1$
+ linkUrl = humanUrl;
+ } else if ("Show Details".equals(text)) {//$NON-NLS-1$
+ linkUrl = "http://www.redhat.com/jboss/";//$NON-NLS-1$
+ }
+
+ if (linkUrl != null) {
+ IWorkbenchBrowserSupport support = PlatformUI.getWorkbench()
+ .getBrowserSupport();
+ try {
+ URL url = new URL(linkUrl);
+ support.getExternalBrowser().openURL(url);
+ } catch (Exception e1) {
+ RuntimeUIActivator.log(e1);
+ }
+ }
+
+ }
+ } );
+
+
+ refresh();
+
return area;
}
+ private void addRuntimeSelectionCombo(Composite parent) {
+ if (downloadRuntimes == null || downloadRuntimes.size() < 2) {
+ return;
+ }
+
+ Label selectRuntimeLabel = new Label(parent, SWT.NONE);
+ selectRuntimeLabel.setText("Select a runtime to download");
+
+ runtimesCombo = new Combo(parent, SWT.FLAT | SWT.BORDER | SWT.READ_ONLY);
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
+ gd.horizontalSpan=2;
+ runtimesCombo.setLayoutData(gd);
+ for (DownloadRuntime r : downloadRuntimes) {
+ runtimesCombo.add(r.getName());
+ }
+
+ runtimesCombo.addSelectionListener(new SelectionListener() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ int i = runtimesCombo.getSelectionIndex();
+ downloadRuntime = downloadRuntimes.get(i);
+ refresh();
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+ });
+ selectRuntimeError = addDecoration(runtimesCombo, FieldDecorationRegistry.DEC_REQUIRED, SELECTED_RUNTIME_REQUIRED);
+ }
+
+ private void refresh() {
+ if (downloadRuntime != null) {
+ boolean requireManualDownload = false;
+ if (downloadRuntime.getUrl() != null) {
+ urlText.setText(downloadRuntime.getUrl());
+ } else if (downloadRuntime.getHumanUrl() != null){
+ urlText.setText("<a>"+downloadRuntime.getHumanUrl().trim()+"</a>");//$NON-NLS-1$ //$NON-NLS-2$
+ requireManualDownload = true;
+ } else {
+ urlText.setText("");
+ }
+ boolean isDisclaimer = downloadRuntime.isDisclaimer();
+ boolean showWarning = isDisclaimer || requireManualDownload;
+
+ if (showWarning) {
+ if (isDisclaimer) {
+ warningLabel.setText("This is a community project and, as such is not supported with an SLA.");//$NON-NLS-1$
+ warningLink.setText("If you're looking for fully supported, certified, enterprise middleware try JBoss Enterprise Middleware products. <a>Show Details</a>");//$NON-NLS-1$
+ } else if (requireManualDownload) {
+ warningLabel.setText("This runtime is only available as manual download.");//$NON-NLS-1$
+ warningLink.setText("Please click on the download <a>link</a>.");//$NON-NLS-1$
+ }
+ }
+ warningComposite.setVisible(showWarning);
+ } else {
+ warningComposite.setVisible(false);
+ }
+ warningComposite.getParent().getParent().layout(true, true);
+ validate();
+ }
+
private String getDefaultPath() {
String defaultPath = dialogSettings.get(DEFAULT_DIALOG_PATH);
if (defaultPath == null || defaultPath.isEmpty()) {
@@ -263,6 +386,15 @@
decPathReq.hide();
destinationPathError.hide();
destinationPathReq.hide();
+
+ boolean hasRuntime = downloadRuntime != null;
+ if (selectRuntimeError != null) {
+ if (hasRuntime) {
+ selectRuntimeError.hide();
+ } else {
+ selectRuntimeError.show();
+ }
+ }
if (path.isEmpty()) {
decPathReq.show();
}
@@ -273,7 +405,9 @@
boolean destExists = checkPath(destination, destinationPathError);
getButton(IDialogConstants.OK_ID).setEnabled(pathExists
&& destExists
- && !path.isEmpty() && !destination.isEmpty());
+ && !path.isEmpty() && !destination.isEmpty()
+ && hasRuntime
+ );
decPathError.setShowHover(true);
}
@@ -282,7 +416,7 @@
return true;
}
try {
- File file = File.createTempFile("temp", "txt", new File(path));
+ File file = File.createTempFile("temp", "txt", new File(path));//$NON-NLS-1$ //$NON-NLS-2$
file.deleteOnExit();
file.delete();
} catch (IOException e) {
@@ -310,6 +444,9 @@
}
protected void validate() {
+ if (getContents() == null) {
+ return;
+ }
getButton(IDialogConstants.OK_ID).setEnabled(true);
if (pathText.getText().isEmpty()) {
getButton(IDialogConstants.OK_ID).setEnabled(false);
@@ -333,13 +470,20 @@
downloadRuntime(selectedDirectory, destinationDirectory, del);
}
+
+
private void downloadRuntime(final String selectedDirectory,
- final String destinationDirectory, final boolean deleteOnExit) {
- Job downloadJob = new Job("Download '" + downloadRuntime.getName()) {
+ final String destinationDirectory, final boolean deleteOnExit) {
+
+ if (downloadRuntime.getUrl() == null || "".equals(downloadRuntime.getUrl().trim())) {//$NON-NLS-1$
+ //nothing to do
+ return;
+ }
+ Job downloadJob = new Job("Download '" + downloadRuntime.getName()) {//$NON-NLS-1$
@Override
public IStatus run(IProgressMonitor monitor) {
- monitor.beginTask("Download '" + downloadRuntime.getName() + "' ...", 100);
+ monitor.beginTask("Download '" + downloadRuntime.getName() + "' ...", 100);//$NON-NLS-1$ //$NON-NLS-2$
downloadAndInstall(selectedDirectory,
destinationDirectory, deleteOnExit, monitor);
return Status.OK_STATUS;
@@ -405,7 +549,7 @@
File directory = new File(selectedDirectory);
directory.mkdirs();
if (!directory.isDirectory()) {
- final String message = "The '" + directory + "' is not a directory.";
+ final String message = "The '" + directory + "' is not a directory.";//$NON-NLS-1$ //$NON-NLS-2$
if (result != null) {
RuntimeUIActivator.getDefault().getLog().log(result);
} else {
@@ -415,7 +559,7 @@
@Override
public void run() {
- MessageDialog.openError(getActiveShell(), "Error", message);
+ MessageDialog.openError(getActiveShell(), "Error", message);//$NON-NLS-1$
}
});
@@ -431,7 +575,7 @@
@Override
public void run() {
- MessageDialog.openError(getActiveShell(), "Error", message);
+ MessageDialog.openError(getActiveShell(), "Error", message);//$NON-NLS-1$
}
});
@@ -461,7 +605,7 @@
@Override
public void run() {
- MessageDialog.openError(getActiveShell(), "Error", message);
+ MessageDialog.openError(getActiveShell(), "Error", message);//$NON-NLS-1$
}
});
@@ -554,7 +698,7 @@
public void run() {
RuntimeUIActivator.launchSearchRuntimePathDialog(
Display.getDefault().getActiveShell(),
- RuntimeUIActivator.getRuntimePaths(), false, 7);
+ RuntimeUIActivator.getDefault().getModel().getRuntimePaths(), false, 7);
}
});
} else /* size == 1 */{
@@ -566,7 +710,7 @@
Display.getDefault().asyncExec(new Runnable() {
public void run() {
MessageDialog.openError(Display.getDefault()
- .getActiveShell(), "Error", "No runtime/server found...");
+ .getActiveShell(), "Error", "No runtime/server found...");//$NON-NLS-1$
}
});
}
13 years, 6 months