Author: xcoulon
Date: 2012-01-25 12:10:50 -0500 (Wed, 25 Jan 2012)
New Revision: 38178
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPageModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPageModel.java
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/GitCloningSettingsWizardPageModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ProjectAndServerAdapterSettingsWizardPage.java
Log:
OPEN - issue JBIDE-10528: Improve OpenShift UI
https://issues.jboss.org/browse/JBIDE-10528
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java 2012-01-25
16:50:02 UTC (rev 38177)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java 2012-01-25
17:10:50 UTC (rev 38178)
@@ -60,6 +60,7 @@
* @author Rob Stryker
*
*/
+@Deprecated
public class AdapterWizardPage extends AbstractOpenShiftWizardPage implements
IWizardPage, PropertyChangeListener {
private AdapterWizardPageModel model;
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPageModel.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPageModel.java 2012-01-25
16:50:02 UTC (rev 38177)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPageModel.java 2012-01-25
17:10:50 UTC (rev 38178)
@@ -23,6 +23,7 @@
* @author Rob Stryker
* @author Xavier Coulon
*/
+@Deprecated
public class AdapterWizardPageModel extends ObservableUIPojo {
private static final String REMOTE_NAME_DEFAULT = "origin";
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java 2012-01-25
16:50:02 UTC (rev 38177)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java 2012-01-25
17:10:50 UTC (rev 38178)
@@ -10,7 +10,6 @@
******************************************************************************/
package org.jboss.tools.openshift.express.internal.ui.wizard;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -83,12 +82,10 @@
private CheckboxTableViewer viewer;
private ApplicationConfigurationWizardPageModel pageModel;
- private CreateNewApplicationWizardModel wizardModel;
public ApplicationConfigurationWizardPage(IWizard wizard,
CreateNewApplicationWizardModel wizardModel) {
super("Application Configuration", "Configure the application you want
to create.",
"Application configuration", wizard);
- this.wizardModel = wizardModel;
this.pageModel = new ApplicationConfigurationWizardPageModel(wizardModel);
}
@@ -341,23 +338,8 @@
};
}
- private void clearViewer() {
- setViewerInput(new ArrayList<IEmbeddableCartridge>());
- }
-
- private void setViewerCheckedElements(final Collection<IEmbeddableCartridge>
cartridges) {
- getShell().getDisplay().syncExec(new Runnable() {
-
- @Override
- public void run() {
- viewer.setCheckedElements(cartridges.toArray());
- }
- });
- }
-
private void setViewerInput(final Collection<IEmbeddableCartridge> cartridges) {
getShell().getDisplay().syncExec(new Runnable() {
-
@Override
public void run() {
viewer.setInput(cartridges);
@@ -457,6 +439,22 @@
@Override
protected void onPageActivated(final DataBindingContext dbc) {
try {
+ WizardUtils.runInWizard(new Job("Loading existing applications...") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ pageModel.loadExistingApplications();
+ return Status.OK_STATUS;
+ } catch (NotFoundOpenShiftException e) {
+ return Status.OK_STATUS;
+ } catch (Exception e) {
+ return new Status(IStatus.ERROR, OpenShiftUIActivator.PLUGIN_ID, "Could not
load applications",
+ e);
+ }
+ }
+
+ }, getContainer(), getDataBindingContext());
+
WizardUtils.runInWizard(new Job("Loading application cartridges...") {
@Override
protected IStatus run(IProgressMonitor monitor) {
@@ -464,11 +462,8 @@
pageModel.loadCartridges();
return Status.OK_STATUS;
} catch (NotFoundOpenShiftException e) {
- // no domain and therefore no applications present
- clearViewer();
return Status.OK_STATUS;
} catch (Exception e) {
- clearViewer();
return new Status(IStatus.ERROR, OpenShiftUIActivator.PLUGIN_ID,
"Could not load application cartridges", e);
}
@@ -481,11 +476,8 @@
setViewerInput(pageModel.loadEmbeddableCartridges());
return Status.OK_STATUS;
} catch (NotFoundOpenShiftException e) {
- // no domain and therefore no applications present
- clearViewer();
return Status.OK_STATUS;
} catch (Exception e) {
- clearViewer();
return new Status(IStatus.ERROR, OpenShiftUIActivator.PLUGIN_ID,
"Could not load embeddable cartridges", e);
}
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPageModel.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPageModel.java 2012-01-25
16:50:02 UTC (rev 38177)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPageModel.java 2012-01-25
17:10:50 UTC (rev 38178)
@@ -40,7 +40,8 @@
private CreateNewApplicationWizardModel wizardModel;
- List<ICartridge> cartridges = new ArrayList<ICartridge>();
+ private List<IApplication> existingApplications = new
ArrayList<IApplication>();
+ private List<ICartridge> cartridges = new ArrayList<ICartridge>();
private List<IEmbeddableCartridge> embeddableCartridges = new
ArrayList<IEmbeddableCartridge>();
private String applicationName;
private IStatus applicationNameStatus;
@@ -49,11 +50,32 @@
public ApplicationConfigurationWizardPageModel(CreateNewApplicationWizardModel
wizardModel) {
this.wizardModel = wizardModel;
}
-
+
public IUser getUser() {
return wizardModel.getUser();
}
+ public void loadExistingApplications() throws OpenShiftException {
+ IUser user = getUser();
+ if (user != null) {
+ setExistingApplications(user.getApplications());
+ }
+ }
+
+ /**
+ * @return the existingApplications
+ */
+ public List<IApplication> getExistingApplications() {
+ return existingApplications;
+ }
+
+ /**
+ * @param existingApplications the existingApplications to set
+ */
+ public void setExistingApplications(List<IApplication> existingApplications) {
+ this.existingApplications = existingApplications;
+ }
+
public void loadCartridges() throws OpenShiftException {
setCartridges(wizardModel.getUser().getCartridges());
}
@@ -108,6 +130,12 @@
status = new Status(IStatus.ERROR, OpenShiftUIActivator.PLUGIN_ID,
"The application name must not contain spaces.");
}
+ for(IApplication application : getExistingApplications()) {
+ if(application.getName().equalsIgnoreCase(applicationName)) {
+ status = new Status(IStatus.ERROR, OpenShiftUIActivator.PLUGIN_ID,
+ "An application with the same name already exists on OpenShift.");
+ }
+ }
setApplicationNameStatus(status);
return 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-01-25
16:50:02 UTC (rev 38177)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPage.java 2012-01-25
17:10:50 UTC (rev 38178)
@@ -57,6 +57,7 @@
"Configure the cloning settings by specifying the clone destination if you
create a new project, and the git remote name if you're using an existing
project.",
"Cloning settings", wizard);
this.pageModel = new GitCloningSettingsWizardPageModel(model);
+ setPageComplete(false);
}
public GitCloningSettingsWizardPage(ImportExistingApplicationWizard wizard,
AbstractOpenShiftApplicationWizardModel model) {
@@ -65,6 +66,7 @@
"Configure the cloning settings by specifying the clone destination if you
create a new project, and the git remote name if you're using an existing
project.",
"Cloning settings", wizard);
this.pageModel = new GitCloningSettingsWizardPageModel(model);
+ setPageComplete(false);
}
@Override
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPageModel.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPageModel.java 2012-01-25
16:50:02 UTC (rev 38177)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPageModel.java 2012-01-25
17:10:50 UTC (rev 38178)
@@ -175,7 +175,7 @@
public String getApplicationName() {
IApplication application = wizardModel.getApplication();
if (application == null) {
- return null;
+ return wizardModel.getApplicationName();
}
return application.getName();
}
@@ -302,13 +302,19 @@
IStatus status = Status.OK_STATUS;
// skip the validation if the user wants to create a new project. The name and state of
the existing project do
// not matter...
+ final IPath repoPath = new Path(getRepositoryPath());
if (!isUseDefaultRepoPath()) {
- IPath repoPath = new Path(getRepositoryPath());
if (repoPath.isEmpty() || !repoPath.isAbsolute() || !repoPath.toFile().canWrite()) {
status = new Status(IStatus.ERROR, OpenShiftUIActivator.PLUGIN_ID,
"The path does not exist or is not writeable.");
}
}
+ final IPath applicationPath = repoPath.append(new Path(getApplicationName()));
+ if (applicationPath.toFile().exists()) {
+ status = new Status(IStatus.ERROR, OpenShiftUIActivator.PLUGIN_ID,
+ "The location '" + repoPath.toOSString() + "' already
contains a folder named '"+ getApplicationName() +"'.");
+ }
+
setCustomRepoPathValidity(status);
return status;
}
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ProjectAndServerAdapterSettingsWizardPage.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ProjectAndServerAdapterSettingsWizardPage.java 2012-01-25
16:50:02 UTC (rev 38177)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ProjectAndServerAdapterSettingsWizardPage.java 2012-01-25
17:10:50 UTC (rev 38178)
@@ -55,10 +55,10 @@
*/
public class ProjectAndServerAdapterSettingsWizardPage extends
AbstractOpenShiftWizardPage {
- public static final String PREF_CONTENTASSISTKEY = "prefContentAssistKey";
-
- private ProjectAndServerAdapterSettingsWizardPageModel pageModel;
+ public static final String PREF_CONTENTASSISTKEY = "prefContentAssistKey";
+ private ProjectAndServerAdapterSettingsWizardPageModel pageModel;
+
private Text existingProjectNameText = null;
public ProjectAndServerAdapterSettingsWizardPage(IWizard wizard,
AbstractOpenShiftApplicationWizardModel wizardModel) {
@@ -75,8 +75,6 @@
createServerAdapterGroup(container, dbc);
createWorkingSetGroup(container, dbc);
}
-
-
private Composite createProjectGroup(Composite parent, DataBindingContext dbc) {
Composite projectGroup = new Composite(parent, SWT.NONE);
@@ -139,11 +137,10 @@
dec.setImage(contentProposalFieldIndicator.getImage());
dec.setDescriptionText("Auto-completion is enabled when you start typing a project
name.");
dec.setShowOnlyOnFocus(true);
-
- AutoCompleteField adapter = new AutoCompleteField(
- existingProjectNameText, new TextContentAdapter(),
- new String [] {});
-
+
+ AutoCompleteField adapter = new AutoCompleteField(existingProjectNameText, new
TextContentAdapter(),
+ new String[] {});
+
adapter.setProposals(getOpenProjectsInWorkspace());
Button browseProjectsButton = new Button(projectGroup, SWT.NONE);
@@ -166,8 +163,8 @@
private String[] getOpenProjectsInWorkspace() {
List<String> projects = new ArrayList<String>();
- for(IProject project: ResourcesPlugin.getWorkspace().getRoot().getProjects()) {
- if(project.exists() && project.isOpen()) {
+ for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) {
+ if (project.exists() && project.isOpen()) {
projects.add(project.getName());
}
}
@@ -220,12 +217,11 @@
ValueBindingBuilder.bind(serverAdapterCheckboxObservable).to(serverAdapterModelObservable).in(dbc);
return serverAdapterGroup;
}
-
+
private IServerType getServerTypeToCreate() {
return
ServerCore.findServerType("org.jboss.tools.openshift.express.openshift.server.type");
}
-
private WorkingSetGroup createWorkingSetGroup(Composite container, DataBindingContext
dbc) {
return new WorkingSetGroup(container, null, new String[] {
"org.eclipse.ui.resourceWorkingSetPage", //$NON-NLS-1$
"org.eclipse.jdt.ui.JavaWorkingSetPage" /* JavaWorkingSetUpdater.ID */});
@@ -296,14 +292,17 @@
@Override
public IObservableList getTargets() {
WritableList targets = new WritableList();
- //targets.add(existingProjectNameTextObservable);
+ // targets.add(existingProjectNameTextObservable);
return targets;
}
}
- /* (non-Javadoc)
- * @see
org.jboss.tools.openshift.express.internal.ui.wizard.AbstractOpenShiftWizardPage#onPageActivated(org.eclipse.core.databinding.DataBindingContext)
+ /*
+ * (non-Javadoc)
+ * @see
+ *
org.jboss.tools.openshift.express.internal.ui.wizard.AbstractOpenShiftWizardPage#onPageActivated(org.eclipse.
+ * core.databinding.DataBindingContext)
*/
@Override
protected void onPageActivated(DataBindingContext dbc) {