Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

STS-3235 A space is now always selected by default for an org. Also

renamed space change listener to handler
  • Loading branch information...
commit aa9515c9a37432a15d72e4d9492ccfe292d422c8 1 parent 7d2be59
nierajsingh authored
View
10 ...ipse.server.core/src/org/cloudfoundry/ide/eclipse/internal/server/core/spaces/CloudSpacesDescriptor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 VMware, Inc.
+ * Copyright (c) 2012 - 2013 VMware, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -24,7 +24,7 @@
* Given a list of CloudSpaces, this will retrieve all the orgs in the
* CloudSpaces, as well as provide mechanisms to find a list of CloudSpaces per
* organization.Note that a cloud space descriptor is NOT indicative that the
- * server supports spaces. A an API is provided to verify that there are indeed
+ * server supports spaces. An API is provided to verify that there are indeed
* spaces available . It is possible that descriptors may be created for servers
* that do not support spaces, in which case the API will return false when
* checking if the server supports spaces.
@@ -100,10 +100,8 @@ protected void setValues() {
}
public CloudSpace getDefaultCloudSpace() {
- // Only return a default if there is one org and one space. Otherwise,
- // force the user
- // to select a space if there is more than one space.
- if (spaces != null && spaces.size() == 1) {
+ // Select the first space as the default space
+ if (spaces != null && spaces.size() > 0) {
return spaces.get(0);
}
return null;
View
28 ....ide.eclipse.server.ui/src/org/cloudfoundry/ide/eclipse/internal/server/ui/CloudSpacesSelectionPart.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 VMware, Inc.
+ * Copyright (c) 2012 - 2013 VMware, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -17,7 +17,7 @@
import org.cloudfoundry.client.lib.domain.CloudSpace;
import org.cloudfoundry.ide.eclipse.internal.server.core.CloudFoundryServer;
import org.cloudfoundry.ide.eclipse.internal.server.core.spaces.CloudSpacesDescriptor;
-import org.cloudfoundry.ide.eclipse.internal.server.ui.editor.CloudSpaceChangeListener;
+import org.cloudfoundry.ide.eclipse.internal.server.ui.editor.CloudSpaceChangeHandler;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.resource.ImageDescriptor;
@@ -42,11 +42,11 @@
private TreeViewer orgsSpacesViewer;
- private CloudSpaceChangeListener spaceChangeListener;
+ private CloudSpaceChangeHandler spaceChangeHandler;
- public CloudSpacesSelectionPart(CloudSpaceChangeListener spaceChangeListener, CloudFoundryServer cloudServer,
+ public CloudSpacesSelectionPart(CloudSpaceChangeHandler spaceChangeHandler, CloudFoundryServer cloudServer,
WizardPage wizardPage) {
- this.spaceChangeListener = spaceChangeListener;
+ this.spaceChangeHandler = spaceChangeHandler;
String serverTypeId = cloudServer.getServer().getServerType().getId();
@@ -58,9 +58,9 @@ public CloudSpacesSelectionPart(CloudSpaceChangeListener spaceChangeListener, Cl
}
}
- public CloudSpacesSelectionPart(CloudSpaceChangeListener spaceChangeListener, CloudFoundryServer cloudServer,
+ public CloudSpacesSelectionPart(CloudSpaceChangeHandler spaceChangeHandler, CloudFoundryServer cloudServer,
IWizardHandle wizardHandle) {
- this.spaceChangeListener = spaceChangeListener;
+ this.spaceChangeHandler = spaceChangeHandler;
String serverTypeId = cloudServer.getServer().getServerType().getId();
@@ -107,8 +107,8 @@ public void selectionChanged(SelectionChangedEvent event) {
}
protected void setInput() {
- if (spaceChangeListener != null && orgsSpacesViewer != null) {
- List<CloudOrganization> orgInput = spaceChangeListener.getCurrentSpacesDescriptor() != null ? spaceChangeListener
+ if (spaceChangeHandler != null && orgsSpacesViewer != null) {
+ List<CloudOrganization> orgInput = spaceChangeHandler.getCurrentSpacesDescriptor() != null ? spaceChangeHandler
.getCurrentSpacesDescriptor().getOrgs() : null;
if (orgInput != null && orgInput.size() > 0) {
CloudOrganization[] organizationInput = orgInput.toArray(new CloudOrganization[orgInput.size()]);
@@ -117,7 +117,7 @@ protected void setInput() {
// Expand all first, so that child elements can be selected
orgsSpacesViewer.setExpandedElements(organizationInput);
- CloudSpace selectedSpace = spaceChangeListener.getCurrentSpacesDescriptor().getDefaultCloudSpace();
+ CloudSpace selectedSpace = spaceChangeHandler.getCurrentSpacesDescriptor().getDefaultCloudSpace();
if (selectedSpace != null) {
// First set the default cloud space as the selected space
@@ -162,8 +162,8 @@ protected void setInput() {
}
protected void setSpaceSelection(CloudSpace selectedSpace) {
- if (spaceChangeListener != null) {
- spaceChangeListener.setSelectedSpace(selectedSpace);
+ if (spaceChangeHandler != null) {
+ spaceChangeHandler.setSelectedSpace(selectedSpace);
}
}
@@ -213,8 +213,8 @@ public void dispose() {
}
public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof CloudOrganization && spaceChangeListener != null) {
- CloudSpacesDescriptor spaceDescriptor = spaceChangeListener.getCurrentSpacesDescriptor();
+ if (parentElement instanceof CloudOrganization && spaceChangeHandler != null) {
+ CloudSpacesDescriptor spaceDescriptor = spaceChangeHandler.getCurrentSpacesDescriptor();
if (spaceDescriptor != null) {
List<CloudSpace> spaces = spaceDescriptor.getOrgSpaces(((CloudOrganization) parentElement)
.getName());
View
20 ...se.server.ui/src/org/cloudfoundry/ide/eclipse/internal/server/ui/editor/CloudFoundryCredentialsPart.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 VMware, Inc.
+ * Copyright (c) 2012 - 2013 VMware, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -91,7 +91,7 @@
private Button cfSignupButton;
- private CloudSpaceChangeListener cloudSpaceChangeListener;
+ private CloudSpaceChangeHandler spaceChangeHandler;
private Map<String, CloudVersion> localV2Cache = new HashMap<String, CloudVersion>();
@@ -124,15 +124,15 @@ public CloudFoundryCredentialsPart(CloudFoundryServer cfServer, IWizardHandle wi
}
public CloudFoundryCredentialsPart(CloudFoundryServer cfServer, WizardPage wizardPage,
- CloudSpaceChangeListener cloudSpaceChangeListener) {
+ CloudSpaceChangeHandler spaceChangeHandler) {
this(cfServer, wizardPage);
- this.cloudSpaceChangeListener = cloudSpaceChangeListener;
+ this.spaceChangeHandler = spaceChangeHandler;
}
public CloudFoundryCredentialsPart(CloudFoundryServer cfServer, IWizardHandle wizardHandle,
- CloudSpaceChangeListener cloudSpaceChangeListener) {
+ CloudSpaceChangeHandler spaceChangeHandler) {
this(cfServer, wizardHandle);
- this.cloudSpaceChangeListener = cloudSpaceChangeListener;
+ this.spaceChangeHandler = spaceChangeHandler;
}
public Composite createComposite(Composite parent) {
@@ -243,8 +243,8 @@ protected boolean updateV2Spaces(List<String> errorMessages, String userName, St
boolean clearV2Spaces = true;
String errorMsg = null;
try {
- if (cloudSpaceChangeListener != null && userName != null && password != null && url != null) {
- cloudSpaceChangeListener.updateDescriptor(url, userName, password, getRunnableContext());
+ if (spaceChangeHandler != null && userName != null && password != null && url != null) {
+ spaceChangeHandler.updateDescriptor(url, userName, password, getRunnableContext());
// Update the local cache
CloudVersion version = CloudUiUtil.getCloudVersion(url, cfServer);
@@ -499,9 +499,9 @@ private void update(boolean clearSpaceDescriptor) {
cfSignupButton.setVisible(false);
}
- if (clearSpaceDescriptor && cloudSpaceChangeListener != null) {
+ if (clearSpaceDescriptor && spaceChangeHandler != null) {
// Clear existing space
- cloudSpaceChangeListener.clearDescriptor();
+ spaceChangeHandler.clearDescriptor();
}
if (folder.getSelectionIndex() == 0) {
View
9 ...al/server/ui/editor/CloudSpaceChangeListener.java → ...nal/server/ui/editor/CloudSpaceChangeHandler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 VMware, Inc.
+ * Copyright (c) 2012 - 2013 VMware, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -51,13 +51,13 @@
*
*
*/
-public class CloudSpaceChangeListener {
+public class CloudSpaceChangeHandler {
private final CloudFoundryServer cloudServer;
private CloudSpacesDescriptor spacesDescriptor;
- public CloudSpaceChangeListener(CloudFoundryServer cloudServer) {
+ public CloudSpaceChangeHandler(CloudFoundryServer cloudServer) {
this.cloudServer = cloudServer;
}
@@ -188,8 +188,5 @@ public boolean hasSetSpace() {
return cloudServer.supportsCloudSpaces();
}
- public CloudSpace getCurrentSpace() {
- return cloudServer.getCloudFoundrySpace() != null ? cloudServer.getCloudFoundrySpace().getSpace() : null;
- }
}
View
14 ...ver.ui/src/org/cloudfoundry/ide/eclipse/internal/server/ui/wizards/CloudFoundryCloudSpaceWizardpage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 VMware, Inc.
+ * Copyright (c) 2012 - 2013 VMware, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,31 +12,31 @@
import org.cloudfoundry.ide.eclipse.internal.server.core.CloudFoundryServer;
import org.cloudfoundry.ide.eclipse.internal.server.ui.CloudSpacesSelectionPart;
-import org.cloudfoundry.ide.eclipse.internal.server.ui.editor.CloudSpaceChangeListener;
+import org.cloudfoundry.ide.eclipse.internal.server.ui.editor.CloudSpaceChangeHandler;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.widgets.Composite;
public class CloudFoundryCloudSpaceWizardpage extends WizardPage {
- private CloudSpaceChangeListener cloudSpaceChangeListener;
+ private CloudSpaceChangeHandler spaceChangeHandler;
private final CloudFoundryServer cloudServer;
protected CloudFoundryCloudSpaceWizardpage(CloudFoundryServer cloudServer,
- CloudSpaceChangeListener cloudSpaceChangeListener) {
+ CloudSpaceChangeHandler spaceChangeHandler) {
super(cloudServer.getServer().getName() + " Organization and Spaces");
this.cloudServer = cloudServer;
- this.cloudSpaceChangeListener = cloudSpaceChangeListener;
+ this.spaceChangeHandler = spaceChangeHandler;
}
public void createControl(Composite parent) {
- CloudSpacesSelectionPart spacesPart = new CloudSpacesSelectionPart(cloudSpaceChangeListener, cloudServer, this);
+ CloudSpacesSelectionPart spacesPart = new CloudSpacesSelectionPart(spaceChangeHandler, cloudServer, this);
Composite composite = spacesPart.createComposite(parent);
setControl(composite);
}
public boolean isPageComplete() {
- return cloudSpaceChangeListener != null && cloudSpaceChangeListener.hasSetSpace();
+ return spaceChangeHandler != null && spaceChangeHandler.hasSetSpace();
}
}
View
4 ...server.ui/src/org/cloudfoundry/ide/eclipse/internal/server/ui/wizards/CloudFoundryCredentialsWizard.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 VMware, Inc.
+ * Copyright (c) 2012 - 2013 VMware, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -79,7 +79,7 @@ protected boolean supportsSpacesInCredentialsPage() {
public IWizardPage getNextPage(IWizardPage page) {
if (page == credentialsPage) {
if (supportsSpacesInCredentialsPage()) {
- cloudSpacePage = new CloudFoundryCloudSpaceWizardpage(server, credentialsPage.getSpaceChangeListener());
+ cloudSpacePage = new CloudFoundryCloudSpaceWizardpage(server, credentialsPage.getSpaceChangeHandler());
cloudSpacePage.setWizard(this);
}
else {
View
18 ...er.ui/src/org/cloudfoundry/ide/eclipse/internal/server/ui/wizards/CloudFoundryCredentialsWizardPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 VMware, Inc.
+ * Copyright (c) 2012 - 2013 VMware, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,7 +12,7 @@
import org.cloudfoundry.ide.eclipse.internal.server.core.CloudFoundryServer;
import org.cloudfoundry.ide.eclipse.internal.server.ui.editor.CloudFoundryCredentialsPart;
-import org.cloudfoundry.ide.eclipse.internal.server.ui.editor.CloudSpaceChangeListener;
+import org.cloudfoundry.ide.eclipse.internal.server.ui.editor.CloudSpaceChangeHandler;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.widgets.Composite;
@@ -26,12 +26,12 @@
private final CloudFoundryCredentialsPart credentialsPart;
- private CloudSpaceChangeListener cloudSpaceChangeListener;
+ private CloudSpaceChangeHandler spaceChangeHandler;
protected CloudFoundryCredentialsWizardPage(CloudFoundryServer server) {
super(server.getServer().getName() + " Credentials");
- cloudSpaceChangeListener = new CloudSpaceChangeListener(server);
- credentialsPart = new CloudFoundryCredentialsPart(server, this, cloudSpaceChangeListener);
+ spaceChangeHandler = new CloudSpaceChangeHandler(server);
+ credentialsPart = new CloudFoundryCredentialsPart(server, this, spaceChangeHandler);
}
public void createControl(Composite parent) {
@@ -44,13 +44,13 @@ public boolean isPageComplete() {
return credentialsPart.isComplete();
}
- public CloudSpaceChangeListener getSpaceChangeListener() {
- return cloudSpaceChangeListener;
+ public CloudSpaceChangeHandler getSpaceChangeHandler() {
+ return spaceChangeHandler;
}
public boolean supportsSpaces() {
- return cloudSpaceChangeListener.getCurrentSpacesDescriptor() != null
- && cloudSpaceChangeListener.getCurrentSpacesDescriptor().supportsSpaces();
+ return spaceChangeHandler.getCurrentSpacesDescriptor() != null
+ && spaceChangeHandler.getCurrentSpacesDescriptor().supportsSpaces();
}
public boolean canFlipToNextPage() {
View
16 ...ver.ui/src/org/cloudfoundry/ide/eclipse/internal/server/ui/wizards/CloudFoundryServerWizardFragment.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 VMware, Inc.
+ * Copyright (c) 2012 - 2013 VMware, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -19,7 +19,7 @@
import org.cloudfoundry.ide.eclipse.internal.server.core.spaces.CloudSpacesDescriptor;
import org.cloudfoundry.ide.eclipse.internal.server.ui.CloudFoundryServerUiPlugin;
import org.cloudfoundry.ide.eclipse.internal.server.ui.editor.CloudFoundryCredentialsPart;
-import org.cloudfoundry.ide.eclipse.internal.server.ui.editor.CloudSpaceChangeListener;
+import org.cloudfoundry.ide.eclipse.internal.server.ui.editor.CloudSpaceChangeHandler;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -48,17 +48,17 @@
private CloudFoundrySpacesWizardFragment spacesFragment;
- private CloudSpaceChangeListener cloudSpaceChangeListener;
+ private CloudSpaceChangeHandler spaceChangeHandler;
@Override
public Composite createComposite(Composite parent, IWizardHandle wizard) {
initServer();
if (cfServer != null) {
- cloudSpaceChangeListener = new WizardFragmentSpaceChangeListener(cfServer, wizard);
+ spaceChangeHandler = new WizardFragmentSpaceChangeHandler(cfServer, wizard);
}
- credentialsPart = new CloudFoundryCredentialsPart(cfServer, wizard, cloudSpaceChangeListener);
+ credentialsPart = new CloudFoundryCredentialsPart(cfServer, wizard, spaceChangeHandler);
return credentialsPart.createComposite(parent);
}
@@ -161,11 +161,11 @@ else if (!cf.supportsCloudSpaces() && !originalServer.supportsCloudSpaces()) {
}
}
- protected class WizardFragmentSpaceChangeListener extends CloudSpaceChangeListener {
+ protected class WizardFragmentSpaceChangeHandler extends CloudSpaceChangeHandler {
private final IWizardHandle wizardHandle;
- public WizardFragmentSpaceChangeListener(CloudFoundryServer cloudServer, IWizardHandle wizardHandle) {
+ public WizardFragmentSpaceChangeHandler(CloudFoundryServer cloudServer, IWizardHandle wizardHandle) {
super(cloudServer);
this.wizardHandle = wizardHandle;
}
@@ -174,7 +174,7 @@ public WizardFragmentSpaceChangeListener(CloudFoundryServer cloudServer, IWizard
protected void handleCloudSpaceDescriptorSelection(CloudSpacesDescriptor spacesDescriptor) {
if (spacesDescriptor != null && spacesDescriptor.supportsSpaces()) {
initServer();
- spacesFragment = new CloudFoundrySpacesWizardFragment(cloudSpaceChangeListener, cfServer);
+ spacesFragment = new CloudFoundrySpacesWizardFragment(spaceChangeHandler, cfServer);
}
else {
spacesFragment = null;
View
14 ...ver.ui/src/org/cloudfoundry/ide/eclipse/internal/server/ui/wizards/CloudFoundrySpacesWizardFragment.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 VMware, Inc.
+ * Copyright (c) 2012 - 2013 VMware, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,32 +12,32 @@
import org.cloudfoundry.ide.eclipse.internal.server.core.CloudFoundryServer;
import org.cloudfoundry.ide.eclipse.internal.server.ui.CloudSpacesSelectionPart;
-import org.cloudfoundry.ide.eclipse.internal.server.ui.editor.CloudSpaceChangeListener;
+import org.cloudfoundry.ide.eclipse.internal.server.ui.editor.CloudSpaceChangeHandler;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.wst.server.ui.wizard.IWizardHandle;
import org.eclipse.wst.server.ui.wizard.WizardFragment;
public class CloudFoundrySpacesWizardFragment extends WizardFragment {
- private final CloudSpaceChangeListener cloudSpaceChangeListener;
+ private final CloudSpaceChangeHandler spaceChangeHandler;
private final CloudFoundryServer cloudServer;
- public CloudFoundrySpacesWizardFragment(CloudSpaceChangeListener cloudSpaceChangeListener,
+ public CloudFoundrySpacesWizardFragment(CloudSpaceChangeHandler spaceChangeHandler,
CloudFoundryServer cloudServer) {
- this.cloudSpaceChangeListener = cloudSpaceChangeListener;
+ this.spaceChangeHandler = spaceChangeHandler;
this.cloudServer = cloudServer;
}
@Override
public Composite createComposite(Composite parent, IWizardHandle handle) {
- CloudSpacesSelectionPart spacesPart = new CloudSpacesSelectionPart(cloudSpaceChangeListener, cloudServer,
+ CloudSpacesSelectionPart spacesPart = new CloudSpacesSelectionPart(spaceChangeHandler, cloudServer,
handle);
return spacesPart.createComposite(parent);
}
public boolean isComplete() {
- return cloudSpaceChangeListener != null && cloudSpaceChangeListener.hasSetSpace();
+ return spaceChangeHandler != null && spaceChangeHandler.hasSetSpace();
}
@Override
Please sign in to comment.
Something went wrong with that request. Please try again.