JBoss Tools SVN: r26557 - trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-11-15 09:49:15 -0500 (Mon, 15 Nov 2010)
New Revision: 26557
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceHandler.java
Log:
[JBIDE-7581] NewInstance renamed to NewInstanceWizard
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceHandler.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceHandler.java 2010-11-15 12:50:38 UTC (rev 26556)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceHandler.java 2010-11-15 14:49:15 UTC (rev 26557)
@@ -24,7 +24,7 @@
import org.jboss.tools.deltacloud.core.DeltaCloud;
import org.jboss.tools.deltacloud.core.DeltaCloudImage;
import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
-import org.jboss.tools.internal.deltacloud.ui.wizards.NewInstance;
+import org.jboss.tools.internal.deltacloud.ui.wizards.NewInstanceWizard;
/**
* @author Andre Dietisheim
@@ -45,7 +45,7 @@
private void createInstance(DeltaCloudImage deltaCloudImage, Shell shell) {
if (deltaCloudImage != null) {
DeltaCloud deltaCloud = deltaCloudImage.getDeltaCloud();
- IWizard wizard = new NewInstance(deltaCloud, deltaCloudImage);
+ IWizard wizard = new NewInstanceWizard(deltaCloud, deltaCloudImage);
WizardDialog dialog = new WizardDialog(shell, wizard);
dialog.create();
dialog.open();
15 years, 5 months
JBoss Tools SVN: r26556 - in trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext: config/requirement and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: jpeterka
Date: 2010-11-15 07:50:38 -0500 (Mon, 15 Nov 2010)
New Revision: 26556
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/DBBean.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/StopDBServer.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/DatabaseHelper.java
Log:
Internal hsqldb stopping fixed in bot ext
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/DBBean.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/DBBean.java 2010-11-15 12:12:15 UTC (rev 26555)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/DBBean.java 2010-11-15 12:50:38 UTC (rev 26556)
@@ -21,7 +21,7 @@
public String scriptPath;
public DBType dbType;
public String name;
- public boolean internal = true;
+ public boolean internal = false;
public static DBBean fromString(String propValue) throws Exception{
try {
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/StopDBServer.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/StopDBServer.java 2010-11-15 12:12:15 UTC (rev 26555)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/StopDBServer.java 2010-11-15 12:50:38 UTC (rev 26556)
@@ -7,8 +7,9 @@
@Override
public boolean checkFulfilled() {
- if (TestConfigurator.currentConfig.getDB().internal && DatabaseHelper.isHSQLDBRunning())
- return false;
+ if (TestConfigurator.currentConfig.getDB() != null)
+ if (TestConfigurator.currentConfig.getDB().internal && DatabaseHelper.isHSQLDBRunning())
+ return false;
return true;
}
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/DatabaseHelper.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/DatabaseHelper.java 2010-11-15 12:12:15 UTC (rev 26555)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/DatabaseHelper.java 2010-11-15 12:50:38 UTC (rev 26556)
@@ -50,7 +50,7 @@
public static int SLEEP = 1000;
public static Logger log = Logger.getLogger(DatabaseHelper.class);
- private static boolean hsqlRunning;
+ private static boolean hsqlRunning = false;
/**
* Create HSQLDB Driver
15 years, 5 months
JBoss Tools SVN: r26555 - trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-11-15 07:12:15 -0500 (Mon, 15 Nov 2010)
New Revision: 26555
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceModel.java
Log:
[JBIDE-7581] minor cleanup and documentation
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceModel.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceModel.java 2010-11-15 12:03:53 UTC (rev 26554)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceModel.java 2010-11-15 12:12:15 UTC (rev 26555)
@@ -73,19 +73,25 @@
private String getArch(String id) {
String arch = "";
if (id != null && id.length() > 0) {
- DeltaCloudImage[] images = cloud.getCurrImages();
- for (int i = 0; i < images.length; ++i) {
- DeltaCloudImage image = images[i];
- if (image.getId().equals(id)) {
- imageContainer.setImage(image);
- arch = image.getArchitecture();
- break;
- }
+ DeltaCloudImage image = getImage(id, arch, cloud.getCurrImages());
+ if (image != null) {
+ imageContainer.setImage(image);
+ arch = image.getArchitecture();
}
}
return arch;
}
+ private DeltaCloudImage getImage(String id, String arch, DeltaCloudImage[] images) {
+ for (int i = 0; i < images.length; ++i) {
+ DeltaCloudImage image = images[i];
+ if (image.getId().equals(id)) {
+ return image;
+ }
+ }
+ return null;
+ }
+
}
public static class ArchValidator implements IValidator {
15 years, 5 months
JBoss Tools SVN: r26554 - trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-11-15 07:03:53 -0500 (Mon, 15 Nov 2010)
New Revision: 26554
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceModel.java
Log:
[JBIDE-7581] corrected author
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceModel.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceModel.java 2010-11-15 12:02:23 UTC (rev 26553)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceModel.java 2010-11-15 12:03:53 UTC (rev 26554)
@@ -20,7 +20,7 @@
import org.jboss.tools.internal.deltacloud.ui.common.databinding.ObservablePojo;
/**
- * @author Andre Dietisheim
+ * @author Jeff Jonhston
*/
public class NewInstanceModel extends ObservablePojo {
15 years, 5 months
JBoss Tools SVN: r26553 - trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-11-15 07:02:23 -0500 (Mon, 15 Nov 2010)
New Revision: 26553
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceWizard.java
Log:
[JBIDE-7581] minor cleanup and documentation
Copied: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceWizard.java (from rev 26044, trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstance.java)
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceWizard.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceWizard.java 2010-11-15 12:02:23 UTC (rev 26553)
@@ -0,0 +1,224 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.internal.deltacloud.ui.wizards;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.MessageDialogWithToggle;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.rse.core.IRSECoreRegistry;
+import org.eclipse.rse.core.IRSESystemType;
+import org.eclipse.rse.core.RSECorePlugin;
+import org.eclipse.rse.core.model.IHost;
+import org.eclipse.rse.core.model.ISystemRegistry;
+import org.eclipse.rse.core.model.SystemStartHere;
+import org.eclipse.rse.core.subsystems.IConnectorService;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudException;
+import org.jboss.tools.deltacloud.core.DeltaCloudImage;
+import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
+import org.jboss.tools.deltacloud.ui.Activator;
+import org.jboss.tools.deltacloud.ui.IDeltaCloudPreferenceConstants;
+import org.jboss.tools.deltacloud.ui.views.CVMessages;
+import org.osgi.service.prefs.Preferences;
+
+/**
+ * @author Jeff Jonhston
+ */
+public class NewInstanceWizard extends Wizard {
+
+ private final static String CREATE_INSTANCE_FAILURE_TITLE = "CreateInstanceError.title"; //$NON-NLS-1$
+ private final static String CREATE_INSTANCE_FAILURE_MSG = "CreateInstanceError.msg"; //$NON-NLS-1$
+ private final static String DEFAULT_REASON = "CreateInstanceErrorReason.msg"; //$NON-NLS-1$
+ private final static String CONFIRM_CREATE_TITLE = "ConfirmCreate.title"; //$NON-NLS-1$
+ private final static String CONFIRM_CREATE_MSG = "ConfirmCreate.msg"; //$NON-NLS-1$
+ private final static String DONT_SHOW_THIS_AGAIN_MSG = "DontShowThisAgain.msg"; //$NON-NLS-1$
+ private final static String STARTING_INSTANCE_MSG = "StartingInstance.msg"; //$NON-NLS-1$
+ private final static String STARTING_INSTANCE_TITLE = "StartingInstance.title"; //$NON-NLS-1$
+ private final static String RSE_CONNECTING_MSG = "ConnectingRSE.msg"; //$NON-NLS-1$
+
+ private NewInstancePage mainPage;
+
+ private DeltaCloud cloud;
+ private DeltaCloudImage image;
+ private DeltaCloudInstance instance;
+
+ public NewInstanceWizard(DeltaCloud cloud, DeltaCloudImage image) {
+ this.cloud = cloud;
+ this.image = image;
+ }
+
+ @Override
+ public void addPages() {
+ mainPage = new NewInstancePage(cloud, image);
+ addPage(mainPage);
+ }
+
+ @Override
+ public boolean canFinish() {
+ return mainPage.isPageComplete();
+ }
+
+
+ private class WatchCreateJob extends Job {
+
+ private DeltaCloud cloud;
+ private String instanceId;
+ private String instanceName;
+
+ public WatchCreateJob(String title, DeltaCloud cloud,
+ String instanceId, String instanceName) {
+ super(title);
+ this.cloud = cloud;
+ this.instanceId = instanceId;
+ this.instanceName = instanceName;
+ }
+
+ public IStatus run(IProgressMonitor pm) {
+ if (!pm.isCanceled()){
+ DeltaCloudInstance instance = null;
+ try {
+ pm.beginTask(WizardMessages.getFormattedString(STARTING_INSTANCE_MSG, new String[] {instanceName}), IProgressMonitor.UNKNOWN);
+ pm.worked(1);
+ cloud.registerActionJob(instanceId, this);
+ boolean finished = false;
+ while (!finished && !pm.isCanceled()) {
+ instance = cloud.refreshInstance(instanceId);
+ if (instance != null && !instance.getState().equals(DeltaCloudInstance.PENDING))
+ break;
+ Thread.sleep(400);
+ }
+
+ } catch (Exception e) {
+ // do nothing
+ } finally {
+ cloud.addReplaceInstance(instance);
+ cloud.removeActionJob(instanceId, this);
+ String hostname = instance.getHostName();
+ Preferences prefs = new InstanceScope().getNode(Activator.PLUGIN_ID);
+ boolean autoConnect = prefs.getBoolean(IDeltaCloudPreferenceConstants.AUTO_CONNECT_INSTANCE, true);
+ if (hostname != null && hostname.length() > 0 && autoConnect) {
+ ISystemRegistry registry = SystemStartHere.getSystemRegistry();
+ RSECorePlugin rsep = RSECorePlugin.getDefault();
+ IRSECoreRegistry coreRegistry = rsep.getCoreRegistry();
+ IRSESystemType[] sysTypes = coreRegistry.getSystemTypes();
+ IRSESystemType sshType = null;
+ for (IRSESystemType sysType : sysTypes) {
+ if (sysType.getId().equals(IRSESystemType.SYSTEMTYPE_SSH_ONLY_ID))
+ sshType = sysType;
+ }
+ String connectionName = instance.getName() + " [" + instance.getId() + "]"; //$NON-NLS-1$ //$NON-NLS-2$
+ try {
+ IHost host = registry.createHost(sshType, connectionName, hostname, null);
+ if (host != null) {
+ host.setDefaultUserId("root"); //$NON-NLS-1$
+ IConnectorService[] services = host.getConnectorServices();
+ if (services.length > 0) {
+ final IConnectorService service = services[0];
+ Job connect = new Job(CVMessages.getFormattedString(RSE_CONNECTING_MSG, connectionName)) {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ service.connect(monitor);
+ return Status.OK_STATUS;
+ } catch(Exception e) {
+ return Status.CANCEL_STATUS;
+ }
+ }
+ };
+ connect.setUser(true);
+ connect.schedule();
+ }
+ }
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ Activator.log(e);
+ }
+ }
+ pm.done();
+ }
+ return Status.OK_STATUS;
+ }
+ else {
+ pm.done();
+ return Status.CANCEL_STATUS;
+ }
+ };
+ };
+
+ @Override
+ public boolean performFinish() {
+ String imageId = image.getId();
+ String profileId = mainPage.getHardwareProfile();
+ String realmId = mainPage.getRealmId();
+ String memory = mainPage.getMemoryProperty();
+ String storage = mainPage.getStorageProperty();
+ String keyname = mainPage.getKeyName();
+ String name = null;
+ try {
+ name = URLEncoder.encode(mainPage.getInstanceName(), "UTF-8"); //$NON-NLS-1$
+ } catch (UnsupportedEncodingException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ boolean result = false;
+ String errorMessage = WizardMessages.getString(DEFAULT_REASON);
+ try {
+ Preferences prefs = new InstanceScope().getNode(Activator.PLUGIN_ID);
+ boolean dontShowDialog = prefs.getBoolean(IDeltaCloudPreferenceConstants.DONT_CONFIRM_CREATE_INSTANCE, false);
+ if (!dontShowDialog) {
+ MessageDialogWithToggle dialog =
+ MessageDialogWithToggle.openOkCancelConfirm(getShell(), WizardMessages.getString(CONFIRM_CREATE_TITLE),
+ WizardMessages.getString(CONFIRM_CREATE_MSG),
+ WizardMessages.getString(DONT_SHOW_THIS_AGAIN_MSG),
+ false, null, null);
+ int retCode = dialog.getReturnCode();
+ boolean toggleState = dialog.getToggleState();
+ if (retCode == Dialog.CANCEL)
+ return true;
+ // If warning turned off by user, set the preference for future usage
+ if (toggleState) {
+ prefs.putBoolean(IDeltaCloudPreferenceConstants.DONT_CONFIRM_CREATE_INSTANCE, true);
+ }
+ }
+ instance = cloud.createInstance(name, imageId, realmId, profileId, keyname, memory, storage);
+ if (instance != null)
+ result = true;
+ if (instance != null && instance.getState().equals(DeltaCloudInstance.PENDING)) {
+ final String instanceId = instance.getId();
+ final String instanceName = name;
+ Job job = new WatchCreateJob(WizardMessages.getString(STARTING_INSTANCE_TITLE),
+ cloud, instanceId, instanceName);
+ job.setUser(true);
+ job.schedule();
+ }
+ } catch (DeltaCloudException e) {
+ errorMessage = e.getLocalizedMessage();
+ }
+ if (!result) {
+ ErrorDialog.openError(this.getShell(),
+ WizardMessages.getString(CREATE_INSTANCE_FAILURE_TITLE),
+ WizardMessages.getFormattedString(CREATE_INSTANCE_FAILURE_MSG, new String[] {name, imageId, realmId, profileId}),
+ new Status(IStatus.ERROR, Activator.PLUGIN_ID, errorMessage));
+ }
+ return result;
+ }
+
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceWizard.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 5 months
JBoss Tools SVN: r26552 - trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-11-15 07:01:51 -0500 (Mon, 15 Nov 2010)
New Revision: 26552
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java
Log:
[JBIDE-7581] minor cleanup and documentation
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java 2010-11-15 11:30:29 UTC (rev 26551)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java 2010-11-15 12:01:51 UTC (rev 26552)
@@ -48,7 +48,7 @@
private final static String NAME = "NewInstance.name"; //$NON-NLS-1$
private final static String DESCRIPTION = "NewInstance.desc"; //$NON-NLS-1$
private final static String TITLE = "NewInstance.title"; //$NON-NLS-1$
-
+
private static final String NAME_LABEL = "Name.label"; //$NON-NLS-1$
private static final String IMAGE_LABEL = "Image.label"; //$NON-NLS-1$
private static final String ARCH_LABEL = "Arch.label"; //$NON-NLS-1$
@@ -57,16 +57,15 @@
private static final String KEY_LABEL = "Key.label"; //$NON-NLS-1$
private static final String MANAGE_BUTTON_LABEL = "ManageButton.label"; //$NON-NLS-1$
private static final String PROPERTIES_LABEL = "Properties.label"; //$NON-NLS-1$
-
+
private static final String NONE_RESPONSE = "None.response"; //$NON-NLS-1$
@SuppressWarnings("unused")
private static final String NAME_ALREADY_IN_USE = "ErrorNameInUse.text"; //$NON-NLS-1$
-
private DeltaCloud cloud;
private DeltaCloudImage image;
private ArrayList<DeltaCloudHardwareProfile> profiles;
-
+
private Text nameText;
private Text keyText;
private Combo hardware;
@@ -76,7 +75,7 @@
private ProfileComposite currPage;
private ProfileComposite[] profilePages;
private ArrayList<String> realmIds;
-
+
private ModifyListener textListener = new ModifyListener() {
@Override
@@ -95,12 +94,12 @@
currPage.setVisible(true);
}
};
-
+
private SelectionListener manageListener = new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
Shell shell = getShell();
- ManageKeys wizard = new ManageKeys(cloud, ".pem"); //$NON-NLS-1$
+ ManageKeys wizard = new ManageKeys(cloud, ".pem"); //$NON-NLS-1$
WizardDialog dialog = new CustomWizardDialog(shell, wizard,
IDialogConstants.OK_LABEL);
dialog.create();
@@ -109,9 +108,9 @@
if (keyname != null)
keyText.setText(keyname);
}
-
+
};
-
+
public NewInstancePage(DeltaCloud cloud, DeltaCloudImage image) {
super(WizardMessages.getString(NAME));
this.cloud = cloud;
@@ -129,29 +128,29 @@
public String getRealmId() {
if (realm instanceof Combo) {
- int index = ((Combo)realm).getSelectionIndex();
+ int index = ((Combo) realm).getSelectionIndex();
return realmIds.get(index);
} else {
return null;
}
}
-
+
public String getCpuProperty() {
return currPage.getCPU();
}
-
+
public String getStorageProperty() {
return currPage.getStorage();
}
-
+
public String getMemoryProperty() {
return currPage.getMemory();
}
-
+
public String getInstanceName() {
return nameText.getText();
}
-
+
public String getKeyName() {
if (keyText == null) {
return null;
@@ -159,13 +158,13 @@
return keyText.getText();
}
}
-
+
private void validate() {
boolean complete = true;
boolean errorFree = true;
-
+
setMessage(null);
-
+
String name = nameText.getText();
if (name.length() == 0) {
complete = false;
@@ -178,18 +177,18 @@
else {
Preferences prefs = new InstanceScope().getNode(Activator.PLUGIN_ID);
try {
- prefs.put(IDeltaCloudPreferenceConstants.LAST_EC2_KEYNAME, keyname);
+ prefs.put(IDeltaCloudPreferenceConstants.LAST_EC2_KEYNAME, keyname);
} catch (Exception e) {
// ignore
}
}
}
-
+
if (errorFree)
setErrorMessage(null);
setPageComplete(complete & errorFree);
}
-
+
private void getPossibleProfiles() {
profiles = new ArrayList<DeltaCloudHardwareProfile>();
DeltaCloudHardwareProfile[] allProfiles = cloud.getProfiles();
@@ -199,7 +198,7 @@
}
}
}
-
+
private String[] getProfileIds(Composite container) {
String[] ids = new String[profiles.size()];
profilePages = new ProfileComposite[profiles.size()];
@@ -212,40 +211,39 @@
currPage = profilePages[0];
return ids;
}
-
+
@Override
public void createControl(Composite parent) {
final Composite container = new Composite(parent, SWT.NULL);
FormLayout layout = new FormLayout();
layout.marginHeight = 5;
layout.marginWidth = 5;
- container.setLayout(layout);
-
+ container.setLayout(layout);
+
Label dummyLabel = new Label(container, SWT.NULL);
Label imageLabel = new Label(container, SWT.NULL);
imageLabel.setText(WizardMessages.getString(IMAGE_LABEL));
-
+
Label imageId = new Label(container, SWT.NULL);
imageId.setText(image.getName());
-
+
Label archLabel = new Label(container, SWT.NULL);
archLabel.setText(WizardMessages.getString(ARCH_LABEL));
-
+
Label arch = new Label(container, SWT.NULL);
arch.setText(image.getArchitecture());
-
+
Label nameLabel = new Label(container, SWT.NULL);
nameLabel.setText(WizardMessages.getString(NAME_LABEL));
-
+
Label realmLabel = new Label(container, SWT.NULL);
realmLabel.setText(WizardMessages.getString(REALM_LABEL));
-
nameText = new Text(container, SWT.BORDER | SWT.SINGLE);
nameText.addModifyListener(textListener);
-
-
+ nameText.setBackground(nameText.getDisplay().getSystemColor(SWT.COLOR_RED));
+
DeltaCloudRealm[] realms = cloud.getRealms();
realmIds = new ArrayList<String>();
ArrayList<String> realmNames = new ArrayList<String>();
@@ -256,20 +254,11 @@
realmIds.add(r.getId());
}
}
- if (realmIds.size() > 0) {
- Combo combo = new Combo(container, SWT.BORDER | SWT.READ_ONLY);
- combo.setItems(realmNames.toArray(new String[realmNames.size()]));
- combo.setText(realmNames.get(0));
- realm = combo;
- } else {
- Label label = new Label(container, SWT.NULL);
- label.setText(WizardMessages.getString(NONE_RESPONSE));
- realm = label;
- }
-
+ createRealmsControl(container, realmNames);
+
Label hardwareLabel = new Label(container, SWT.NULL);
hardwareLabel.setText(WizardMessages.getString(HARDWARE_LABEL));
-
+
hardware = new Combo(container, SWT.READ_ONLY);
Group groupContainer = new Group(container, SWT.BORDER);
groupContainer.setText(WizardMessages.getString(PROPERTIES_LABEL));
@@ -277,37 +266,36 @@
groupLayout.marginHeight = 0;
groupLayout.marginWidth = 0;
groupContainer.setLayout(groupLayout);
-
-
+
profileIds = getProfileIds(groupContainer);
-
+
if (profileIds.length > 0) {
hardware.setItems(profileIds);
hardware.setText(profileIds[0]);
profilePages[0].setVisible(true);
hardware.addModifyListener(comboListener);
}
-
+
Point p1 = nameLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT);
Point p2 = nameText.computeSize(SWT.DEFAULT, SWT.DEFAULT);
int centering = (p2.y - p1.y + 1) / 2;
-
+
FormData f = new FormData();
f.left = new FormAttachment(0, 0);
f.right = new FormAttachment(100, 0);
dummyLabel.setLayoutData(f);
-
+
f = new FormData();
f.top = new FormAttachment(dummyLabel, 8 + centering);
f.left = new FormAttachment(0, 0);
nameLabel.setLayoutData(f);
-
+
f = new FormData();
f.top = new FormAttachment(dummyLabel, 8);
f.left = new FormAttachment(hardwareLabel, 5);
f.right = new FormAttachment(100, 0);
nameText.setLayoutData(f);
-
+
f = new FormData();
f.top = new FormAttachment(nameText, 8);
f.left = new FormAttachment(0, 0);
@@ -318,22 +306,22 @@
f.left = new FormAttachment(hardwareLabel, 5);
f.right = new FormAttachment(100, 0);
imageId.setLayoutData(f);
-
+
f = new FormData();
f.top = new FormAttachment(imageLabel, 8);
f.left = new FormAttachment(0, 0);
archLabel.setLayoutData(f);
-
+
f = new FormData();
f.top = new FormAttachment(imageLabel, 8);
f.left = new FormAttachment(hardwareLabel, 5);
arch.setLayoutData(f);
-
+
f = new FormData();
f.top = new FormAttachment(arch, 8 + centering);
f.left = new FormAttachment(0, 0);
realmLabel.setLayoutData(f);
-
+
f = new FormData();
f.top = new FormAttachment(arch, 8);
f.left = new FormAttachment(hardwareLabel, 5);
@@ -341,7 +329,7 @@
realm.setLayoutData(f);
Control control = realm;
-
+
if (cloud.getType().equals(DeltaCloud.EC2_TYPE)) {
Label keyLabel = new Label(container, SWT.NULL);
keyLabel.setText(WizardMessages.getString(KEY_LABEL));
@@ -364,9 +352,9 @@
keyLabel.setLayoutData(f);
f = new FormData();
- int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- Point minSize = keyManage.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
- f.width = Math.max(widthHint, minSize.x);
+ int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
+ Point minSize = keyManage.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
+ f.width = Math.max(widthHint, minSize.x);
f.top = new FormAttachment(realm, 8);
f.right = new FormAttachment(realm, 0, SWT.RIGHT);
keyManage.setLayoutData(f);
@@ -376,29 +364,52 @@
f.left = new FormAttachment(hardwareLabel, 5);
f.right = new FormAttachment(keyManage, -10);
keyText.setLayoutData(f);
-
+
control = keyText;
}
-
+
f = new FormData();
f.top = new FormAttachment(control, 8 + centering);
f.left = new FormAttachment(0, 0);
hardwareLabel.setLayoutData(f);
-
+
f = new FormData();
f.top = new FormAttachment(control, 8);
f.left = new FormAttachment(hardwareLabel, 5);
f.right = new FormAttachment(100, 0);
hardware.setLayoutData(f);
-
+
f = new FormData();
f.top = new FormAttachment(hardware, 10);
f.left = new FormAttachment(0, 0);
f.right = new FormAttachment(100, 0);
f.bottom = new FormAttachment(100, 0);
groupContainer.setLayoutData(f);
-
+
setControl(container);
}
+ /**
+ * Creates the control that shall display the available realms. It creates
+ * either a combo, if there are realms available, or a label if none are
+ * available.
+ *
+ * @param parent
+ * the container
+ * @param realmNames
+ * the realm names
+ */
+ private void createRealmsControl(final Composite parent, ArrayList<String> realmNames) {
+ if (realmIds.size() > 0) {
+ Combo combo = new Combo(parent, SWT.BORDER | SWT.READ_ONLY);
+ combo.setItems(realmNames.toArray(new String[realmNames.size()]));
+ combo.setText(realmNames.get(0));
+ realm = combo;
+ } else {
+ Label label = new Label(parent, SWT.NULL);
+ label.setText(WizardMessages.getString(NONE_RESPONSE));
+ realm = label;
+ }
+ }
+
}
15 years, 5 months
JBoss Tools SVN: r26551 - trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-11-15 06:30:29 -0500 (Mon, 15 Nov 2010)
New Revision: 26551
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFCapabilitiesPreferencesPage.java
Log:
JBIDE-7571
https://jira.jboss.org/browse/JBIDE-7571
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFCapabilitiesPreferencesPage.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFCapabilitiesPreferencesPage.java 2010-11-15 11:20:34 UTC (rev 26550)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFCapabilitiesPreferencesPage.java 2010-11-15 11:30:29 UTC (rev 26551)
@@ -15,6 +15,7 @@
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.viewers.*;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.SWTException;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.ui.*;
@@ -85,6 +86,9 @@
if(copy == null || copy.getChildren().length == 0) return;
Display.getDefault().asyncExec(new Runnable() {
public void run() {
+ if(capabilityList.getControl() == null || capabilityList.getControl().isDisposed()) {
+ return;
+ }
capabilityList.getSelectionProvider().setSelection(new StructuredSelection(copy.getChildren()[0]));
capabilityList.update();
capabilitySelectionChanged();
15 years, 5 months
JBoss Tools SVN: r26550 - trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-11-15 06:20:34 -0500 (Mon, 15 Nov 2010)
New Revision: 26550
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage2.java
Log:
[JBIDE-7581] fixed NPE
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage2.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage2.java 2010-11-15 11:01:42 UTC (rev 26549)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage2.java 2010-11-15 11:20:34 UTC (rev 26550)
@@ -53,6 +53,9 @@
import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
import org.jboss.tools.internal.deltacloud.ui.common.databinding.validator.MandatoryStringValidator;
+/**
+ * @author Jeff Jonston
+ */
public class NewInstancePage2 extends WizardPage {
private static final int IMAGE_CHECK_DELAY = 500;
@@ -197,7 +200,9 @@
public void clearProfiles() {
hardware.removeModifyListener(comboListener);
hardware.removeAll();
- currPage.setVisible(false);
+ if (currPage != null) {
+ currPage.setVisible(false);
+ }
hardware.setEnabled(false);
hardware.addModifyListener(comboListener);
}
15 years, 5 months
JBoss Tools SVN: r26549 - trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2010-11-15 06:01:42 -0500 (Mon, 15 Nov 2010)
New Revision: 26549
Modified:
trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/JSFVersions.xml
Log:
https://jira.jboss.org/browse/JBIDE-7591
Modified: trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/JSFVersions.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/JSFVersions.xml 2010-11-15 10:51:53 UTC (rev 26548)
+++ trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/JSFVersions.xml 2010-11-15 11:01:42 UTC (rev 26549)
@@ -18,12 +18,12 @@
<projectTempl location="./jsf-1.2-facelets" />
</version>
<version displayName="JSF 2.0" servlet-version="3.0">
- <lib type="common" location="../lib/ApacheCommon2.3" />
+ <lib type="core" location="../lib/ApacheCommon2.3" />
<refLib type="servlet" location="../servlet" />
<projectTempl location="./jsf-2.0" />
</version>
<version displayName="JSF 2.0 & RichFaces 4.0" servlet-version="3.0">
- <lib type="common" location="../lib/RichFaces4.0" />
+ <lib type="core" location="../lib/RichFaces4.0" />
<refLib type="servlet" location="../servlet" />
<projectTempl location="./jsf-2.0-RichFaces-4.0" />
</version>
15 years, 5 months
JBoss Tools SVN: r26548 - trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2010-11-15 05:51:53 -0500 (Mon, 15 Nov 2010)
New Revision: 26548
Modified:
trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/JSFVersions.xml
Log:
https://jira.jboss.org/browse/JBIDE-7591
Modified: trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/JSFVersions.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/JSFVersions.xml 2010-11-15 10:46:45 UTC (rev 26547)
+++ trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/JSFVersions.xml 2010-11-15 10:51:53 UTC (rev 26548)
@@ -18,13 +18,11 @@
<projectTempl location="./jsf-1.2-facelets" />
</version>
<version displayName="JSF 2.0" servlet-version="3.0">
- <lib type="core" location="../lib/jsf-1.2"/>
<lib type="common" location="../lib/ApacheCommon2.3" />
<refLib type="servlet" location="../servlet" />
<projectTempl location="./jsf-2.0" />
</version>
<version displayName="JSF 2.0 & RichFaces 4.0" servlet-version="3.0">
- <lib type="core" location="../lib/jsf-1.2"/>
<lib type="common" location="../lib/RichFaces4.0" />
<refLib type="servlet" location="../servlet" />
<projectTempl location="./jsf-2.0-RichFaces-4.0" />
15 years, 5 months