Author: adietish
Date: 2011-11-21 10:35:25 -0500 (Mon, 21 Nov 2011)
New Revision: 36493
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/StringUtils.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationDetailsDialog.java
Log:
[JBIDE-9927] added embedded cartridges to application details dialog
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/StringUtils.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/StringUtils.java 2011-11-21
14:57:27 UTC (rev 36492)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/StringUtils.java 2011-11-21
15:35:25 UTC (rev 36493)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.jboss.tools.openshift.express.internal.ui.common;
+import java.util.List;
+
/**
* @author André Dietisheim
*/
@@ -27,4 +29,20 @@
|| value.length() == 0;
}
+ public static <T> String toString(List<T> elements,
ToStringConverter<T> converter) {
+ StringBuilder builder = new StringBuilder();
+ for(int i = 0; i < elements.size(); i++) {
+ converter.toString(elements.get(i));
+ builder.append(converter.toString(elements.get(i)));
+ if (i + 1 < elements.size()) {
+ builder.append(", ");
+ }
+ }
+ return builder.toString();
+ }
+
+ public static interface ToStringConverter<T> {
+ public String toString(T object);
+ }
+
}
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationDetailsDialog.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationDetailsDialog.java 2011-11-21
14:57:27 UTC (rev 36492)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationDetailsDialog.java 2011-11-21
15:35:25 UTC (rev 36493)
@@ -29,9 +29,11 @@
import org.eclipse.swt.widgets.Text;
import org.jboss.tools.common.ui.BrowserUtil;
import org.jboss.tools.openshift.express.client.IApplication;
+import org.jboss.tools.openshift.express.client.IEmbeddableCartridge;
import org.jboss.tools.openshift.express.client.utils.RFC822DateUtils;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftImages;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
+import org.jboss.tools.openshift.express.internal.ui.common.StringUtils;
/**
* @author André Dietisheim
@@ -47,7 +49,7 @@
@Override
protected Control createContents(Composite parent) {
- Control control = super.createContents(parent);
+ Control control = super.createContents(parent);
setupDialog(parent);
return control;
}
@@ -56,28 +58,43 @@
protected Control createDialogArea(Composite parent) {
Composite container = new Composite(parent, SWT.NONE);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true,
true).applyTo(container);
- GridLayoutFactory.fillDefaults().numColumns(2).margins(6, 6).applyTo(container);
+ GridLayoutFactory.fillDefaults().numColumns(2).margins(6, 6).spacing(14,
4).applyTo(container);
Label separator = new Label(container, SWT.HORIZONTAL | SWT.SEPARATOR);
GridDataFactory.fillDefaults().span(2, 1).align(SWT.FILL, SWT.TOP).grab(true,
false).applyTo(separator);
- createDetails("Name", application.getName(), container);
- createDetails("Type", application.getCartridge().getName(), container);
- createDetails("Creation Time", new
ErrorMessageCallable<String>("Creation Time") {
+ createDetails("Name:", application.getName(), container);
+ createDetails("Type:", application.getCartridge().getName(), container);
+ createDetails("Embedded Cartridges:", new
ErrorMessageCallable<String>("Embedded Cartridges") {
@Override
public String call() throws Exception {
+ return StringUtils.toString(application.getEmbeddedCartridges(),
+ new StringUtils.ToStringConverter<IEmbeddableCartridge>() {
+
+ @Override
+ public String toString(IEmbeddableCartridge cartridge) {
+ return cartridge.getName();
+ }
+ });
+ }
+
+ }.get(), container);
+ createDetails("Creation Time:", new
ErrorMessageCallable<String>("Creation Time") {
+
+ @Override
+ public String call() throws Exception {
return RFC822DateUtils.getString(application.getCreationTime());
}
}.get(), container);
- createDetails("UUID", new
ErrorMessageCallable<String>("UUID") {
+ createDetails("UUID:", new
ErrorMessageCallable<String>("UUID") {
@Override
public String call() throws Exception {
return application.getUUID();
}
}.get(), container);
- createDetails("Git URL", new ErrorMessageCallable<String>("Git
URL") {
+ createDetails("Git URL:", new ErrorMessageCallable<String>("Git
URL") {
@Override
public String call() throws Exception {
@@ -86,7 +103,7 @@
}.get(), container);
Label publicUrlLabel = new Label(container, SWT.NONE);
- publicUrlLabel.setText("Public URL");
+ publicUrlLabel.setText("Public URL:");
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(publicUrlLabel);
Link publicUrlLink = new Link(container, SWT.WRAP);
String applicationUrl = new ErrorMessageCallable<String>("Public URL")
{
@@ -115,7 +132,7 @@
createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL,
true);
}
-
+
private SelectionAdapter onPublicUrl(final String applicationUrl) {
return new SelectionAdapter() {