[jbosstools-commits] JBoss Tools SVN: r35379 - in trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui: common and 1 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Wed Oct 5 13:01:06 EDT 2011


Author: adietish
Date: 2011-10-05 13:01:06 -0400 (Wed, 05 Oct 2011)
New Revision: 35379

Added:
   trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationDetailsDialog.java
Modified:
   trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenshiftImages.java
   trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/ImageRepository.java
   trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AbstractOpenshiftWizardPage.java
   trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java
   trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java
   trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java
   trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java
Log:
[JBIDE-9793] added Application Details 

Modified: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenshiftImages.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenshiftImages.java	2011-10-05 17:00:32 UTC (rev 35378)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenshiftImages.java	2011-10-05 17:01:06 UTC (rev 35379)
@@ -11,6 +11,7 @@
 package org.jboss.tools.openshift.express.internal.ui;
 
 import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
 import org.jboss.tools.openshift.express.internal.ui.common.ImageRepository;
 
 public class OpenshiftImages {
@@ -23,4 +24,5 @@
 	public static final ImageDescriptor OPENSHIFT_LOGO_DARK = repo.create("openshift-logo-dark.png"); //$NON-NLS-1$ 
 	public static final ImageDescriptor OPENSHIFT_LOGO_WHITE = repo.create("openshift-logo-white.png"); //$NON-NLS-1$ 
 	public static final ImageDescriptor OPENSHIFT_LOGO_WHITE_MEDIUM = repo.create("openshift-logo-white-medium.png"); //$NON-NLS-1$ 	
+	public static final Image OPENSHIFT_LOGO_WHITE_MEDIUM_IMG = repo.getImage("openshift-logo-white-medium.png"); //$NON-NLS-1$ 	
 }

Modified: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/ImageRepository.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/ImageRepository.java	2011-10-05 17:00:32 UTC (rev 35378)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/ImageRepository.java	2011-10-05 17:01:06 UTC (rev 35379)
@@ -19,6 +19,7 @@
 import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.jface.resource.ImageRegistry;
 import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.graphics.Image;
 import org.jboss.tools.openshift.express.internal.ui.OpenshiftUIActivator;
 
 public class ImageRepository {
@@ -75,4 +76,8 @@
 			return null;
 		}
 	}
+
+	public Image getImage(String name) {
+		return imageRegistry.get(name);
+	}
 }

Modified: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AbstractOpenshiftWizardPage.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AbstractOpenshiftWizardPage.java	2011-10-05 17:00:32 UTC (rev 35378)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AbstractOpenshiftWizardPage.java	2011-10-05 17:01:06 UTC (rev 35379)
@@ -14,12 +14,15 @@
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.jface.dialogs.IPageChangedListener;
 import org.eclipse.jface.dialogs.PageChangedEvent;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.layout.GridLayoutFactory;
 import org.eclipse.jface.wizard.IWizard;
 import org.eclipse.jface.wizard.IWizardContainer;
 import org.eclipse.jface.wizard.WizardDialog;
 import org.eclipse.jface.wizard.WizardPage;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
 import org.jboss.tools.common.ui.databinding.ParametrizableWizardPageSupport;
 import org.jboss.tools.openshift.express.internal.ui.OpenshiftImages;
 
@@ -45,16 +48,12 @@
 				IStatus.ERROR | IStatus.INFO | IStatus.WARNING | IStatus.CANCEL, this,
 				dbc);
 		Composite container = new Composite(parent, SWT.NONE);
+		GridLayoutFactory.fillDefaults().margins(6,6).applyTo(container);
+		Composite child = new Composite(container, SWT.NONE);
+		GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(child);
 		setControl(container);
 		initPageChangedListener();
-
-		// container.addListener(SWT.Show, new Listener() {
-		// @Override
-		// public void handleEvent(Event event) {
-		// onPageVisible(dbc);
-		// }
-		// });
-		doCreateControls(container, dbc);
+		doCreateControls(child, dbc);
 	}
 
 	protected void initPageChangedListener() {

Added: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationDetailsDialog.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationDetailsDialog.java	                        (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationDetailsDialog.java	2011-10-05 17:01:06 UTC (rev 35379)
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.ui.wizard;
+
+import java.util.concurrent.Callable;
+
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.jboss.tools.openshift.express.client.IApplication;
+import org.jboss.tools.openshift.express.client.utils.RFC822DateUtils;
+import org.jboss.tools.openshift.express.internal.ui.OpenshiftImages;
+
+/**
+ * @author André Dietisheim
+ */
+public class ApplicationDetailsDialog extends TitleAreaDialog {
+
+	private IApplication application;
+
+	public ApplicationDetailsDialog(IApplication application, Shell parentShell) {
+		super(parentShell);
+		this.application = application;
+		setTitleImage(OpenshiftImages.OPENSHIFT_LOGO_WHITE_MEDIUM_IMG);
+	}
+
+	@Override
+	protected Control createDialogArea(Composite parent) {
+		parent.getShell().setText("Application Details");
+		setTitle(NLS.bind("Application {0}", application.getName()));
+
+		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);
+
+		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") {
+
+			@Override
+			public String call() throws Exception {
+				return RFC822DateUtils.getString(application.getCreationTime());
+			}
+		}.get(), container);
+		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") {
+
+			@Override
+			public String call() throws Exception {
+				return application.getGitUri();
+			}
+		}.get(), container);
+		createDetails("Public URL", new ErrorMessageCallable<String>("Public URL") {
+
+			@Override
+			public String call() throws Exception {
+				return application.getApplicationUrl();
+			}
+		}.get(), container);
+
+		return container;
+	}
+
+	private void createDetails(String name, String value, Composite container) {
+		Label label = new Label(container, SWT.None);
+		label.setText(name);
+		GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(label);
+		Text text = new Text(container, SWT.BORDER);
+		text.setEditable(false);
+		GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(text);
+		text.setText(value);
+	}
+
+
+	private abstract class ErrorMessageCallable<T> implements Callable<T> {
+
+		private String fieldName;
+
+		public ErrorMessageCallable(String fieldName) {
+			this.fieldName = fieldName;
+		}
+
+		public T get() {
+			try {
+				return call();
+			} catch (Exception e) {
+				setErrorMessage(NLS.bind("Could not get {0}: {1}", fieldName, e.getMessage()));
+				return null;
+			}
+		}
+
+		@Override
+		public abstract T call() throws Exception;
+	}
+}


Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationDetailsDialog.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java	2011-10-05 17:00:32 UTC (rev 35378)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java	2011-10-05 17:01:06 UTC (rev 35379)
@@ -74,17 +74,19 @@
 
 	@Override
 	protected void doCreateControls(Composite container, DataBindingContext dbc) {
-		GridLayoutFactory.fillDefaults().numColumns(3).margins(10, 10).spacing(4, 4).applyTo(container);
+		GridLayoutFactory.fillDefaults().numColumns(3).applyTo(container);
 
 		Group group = new Group(container, SWT.BORDER);
-		group.setText("Available applications");
-		GridDataFactory.fillDefaults().grab(true, true).align(SWT.FILL, SWT.FILL).span(3, 1).applyTo(group);
+		group.setText("Available Applications");
+		GridDataFactory.fillDefaults().grab(true, true).align(SWT.FILL, SWT.FILL).hint(400, 160).span(3, 1)
+				.applyTo(group);
 		FillLayout fillLayout = new FillLayout(SWT.VERTICAL);
 		fillLayout.marginHeight = 6;
 		fillLayout.marginWidth = 6;
 		group.setLayout(fillLayout);
 
-		this.viewer = createApplicationTable(group);
+		Composite tableContainer = new Composite(group, SWT.NONE);
+		this.viewer = createTable(tableContainer);
 		viewer.addDoubleClickListener(onApplicationDoubleClick());
 
 		Binding selectedApplicationBinding = dbc.bindValue(
@@ -112,11 +114,18 @@
 		Button deleteButton = new Button(container, SWT.PUSH);
 		deleteButton.setText("&Delete");
 		GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).hint(80, 30).applyTo(deleteButton);
-		DataBindingUtils.bindButtonEnablementToValidationStatus(deleteButton, dbc, selectedApplicationBinding);
+		DataBindingUtils.bindEnablementToValidationStatus(deleteButton, dbc, selectedApplicationBinding);
 		deleteButton.addSelectionListener(onDelete(dbc));
+
+		Button detailsButton = new Button(container, SWT.PUSH);
+		detailsButton.setText("De&tails");
+		GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).hint(80, 30).applyTo(detailsButton);
+		DataBindingUtils.bindEnablementToValidationStatus(detailsButton, dbc, IStatus.INFO, selectedApplicationBinding);
+		detailsButton.addSelectionListener(onDetails(dbc));
+
 	}
 
-	protected IDoubleClickListener onApplicationDoubleClick() {
+	private IDoubleClickListener onApplicationDoubleClick() {
 		return new IDoubleClickListener() {
 
 			@Override
@@ -140,23 +149,9 @@
 		};
 	}
 
-	protected SelectionAdapter onNew(DataBindingContext dbc) {
-		return new SelectionAdapter() {
-
-			@Override
-			public void widgetSelected(SelectionEvent e) {
-				Shell shell = getContainer().getShell();
-				if (WizardUtils.openWizardDialog(new NewApplicationDialog(model.getUser()), shell)
-						== Dialog.OK) {
-					viewer.refresh();
-				}
-			}
-		};
-	}
-
-	protected TableViewer createApplicationTable(Group group) {
-		Composite tableContainer = new Composite(group, SWT.NONE);
+	protected TableViewer createTable(Composite tableContainer) {
 		Table table = new Table(tableContainer, SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.H_SCROLL);
+		GridDataFactory.fillDefaults().grab(true, true).applyTo(table);
 		table.setLinesVisible(true);
 		table.setHeaderVisible(true);
 		TableColumnLayout tableLayout = new TableColumnLayout();
@@ -172,6 +167,14 @@
 				cell.setText(application.getName());
 			}
 		}, viewer, tableLayout);
+		createTableColumn("Type", 1, new CellLabelProvider() {
+
+			@Override
+			public void update(ViewerCell cell) {
+				IApplication application = (IApplication) cell.getElement();
+				cell.setText(application.getCartridge().getName());
+			}
+		}, viewer, tableLayout);
 		createTableColumn("URL", 3, new CellLabelProvider() {
 
 			@Override
@@ -210,6 +213,31 @@
 		};
 	}
 
+	private SelectionAdapter onNew(DataBindingContext dbc) {
+		return new SelectionAdapter() {
+
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				Shell shell = getContainer().getShell();
+				if (WizardUtils.openWizardDialog(new NewApplicationDialog(model.getUser()), shell)
+						== Dialog.OK) {
+					viewer.refresh();
+				}
+			}
+		};
+	}
+
+	private SelectionAdapter onDetails(DataBindingContext dbc) {
+		return new SelectionAdapter() {
+
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				Shell shell = getContainer().getShell();
+				new ApplicationDetailsDialog(model.getSelectedApplication(), shell).open();
+			}
+		};
+	}
+
 	@Override
 	protected void onPageActivated(DataBindingContext dbc) {
 		try {

Modified: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java	2011-10-05 17:00:32 UTC (rev 35378)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java	2011-10-05 17:01:06 UTC (rev 35379)
@@ -97,17 +97,17 @@
 		Binding passwordBinding = DataBindingUtils.bindMandatoryTextField(
 				passwordText, "Password", CredentialsWizardPageModel.PROPERTY_PASSWORD, model, dbc);
 
-		Label spacerLabel = new Label(container, SWT.None);
-		GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).span(2, 1).applyTo(spacerLabel);
-
 		// Label credentialsValidatyLabel = new Label(container, SWT.None);
 		// GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).hint(64,
 		// 64).applyTo(credentialsValidatyLabel);
 
+		Label spacerLabel = new Label(container, SWT.None);
+		GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(spacerLabel);
+
 		this.validateButton = new Button(container, SWT.NONE);
 		validateButton.setText("&Validate");
-		GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).indent(0, 10).hint(100, 30).applyTo(validateButton);
-		DataBindingUtils.bindButtonEnablementToValidationStatus(
+		GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).span(2, 1).indent(0, 10).hint(100, 30).applyTo(validateButton);
+		DataBindingUtils.bindEnablementToValidationStatus(
 				validateButton,
 				dbc,
 				rhLoginBining, passwordBinding);

Modified: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java	2011-10-05 17:00:32 UTC (rev 35378)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java	2011-10-05 17:01:06 UTC (rev 35379)
@@ -54,7 +54,8 @@
 	protected String initRhLogin() {
 		String rhLogin = null;
 		rhLogin = rhLoginPreferenceValue.get();
-		if (rhLogin == null) {
+		if (rhLogin == null
+				|| rhLogin.length() == 0) {
 			rhLogin = getUserConfiguration();
 		}
 		return rhLogin;

Modified: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java	2011-10-05 17:00:32 UTC (rev 35378)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java	2011-10-05 17:01:06 UTC (rev 35379)
@@ -68,7 +68,7 @@
 	}
 
 	protected void doCreateControls(Composite container, DataBindingContext dbc) {
-		GridLayoutFactory.fillDefaults().numColumns(3).margins(10, 10).applyTo(container);
+		GridLayoutFactory.fillDefaults().numColumns(3).applyTo(container);
 
 		Label namespaceLabel = new Label(container, SWT.NONE);
 		namespaceLabel.setText("&Domain name");
@@ -98,7 +98,7 @@
 		GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).span(2, 1).indent(0, 10).hint(160, 34)
 				.applyTo(createButton);
 		createButton.addSelectionListener(onCreate(dbc));
-		DataBindingUtils.bindButtonEnablementToValidationStatus(createButton, dbc);
+		DataBindingUtils.bindEnablementToValidationStatus(createButton, dbc);
 
 		dbc.bindValue(
 				new WritableValue(null, IDomain.class)



More information about the jbosstools-commits mailing list