JBoss Tools SVN: r29981 - in trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui: src/org/jboss/tools/internal/deltacloud/ui/common/swt and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-03-23 16:40:23 -0400 (Wed, 23 Mar 2011)
New Revision: 29981
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/ControlDecorationAdapter.java
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/swt/JFaceUtils.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionPage.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionPageModel.java
Log:
[JBIDE-8206] moved checking cloud type to background job
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2011-03-23 18:46:48 UTC (rev 29980)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2011-03-23 20:40:23 UTC (rev 29981)
@@ -1,5 +1,26 @@
+2011-03-23 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
+
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionPageModel.java
+ (setDriverByUrl):
+ (isKnownCloud):
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionPage.java
+ (Driver2Label):
+ (createControl):
+ (bindTestButtonEnablement):
+ (bindCloudType):
+ * src/org/jboss/tools/internal/deltacloud/ui/utils/ControlDecorationAdapter.java (ControlDecorationAdapter):
+ [JBIDE-8206] moved checking cloud type to background job
+
2011-03-21 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/InstanceFilterPage.java
+ (createControl):
+ (onDefaultAllPressed):
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/ImageFilterPage.java
+ (createControl):
+ (onDefaultAllPressed):
+ [JBIDE-8326] added button that resets all filters
+
2011-03-21 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
* src/org/jboss/tools/deltacloud/ui/commands/CopyCVPropertySheetPageEntryHandler.java:
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/swt/JFaceUtils.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/swt/JFaceUtils.java 2011-03-23 18:46:48 UTC (rev 29980)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/swt/JFaceUtils.java 2011-03-23 20:40:23 UTC (rev 29981)
@@ -19,12 +19,15 @@
public class JFaceUtils {
public static ControlDecoration createDecoration(Control control, String message) {
+ return createDecoration(control, message, FieldDecorationRegistry.DEC_ERROR);
+ }
+
+ public static ControlDecoration createDecoration(Control control, String message, String decorationId) {
ControlDecoration controlDecoration = new ControlDecoration(control, SWT.LEFT | SWT.TOP);
controlDecoration.setDescriptionText(message);
FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault()
- .getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
+ .getFieldDecoration(decorationId);
controlDecoration.setImage(fieldDecoration.getImage());
return controlDecoration;
}
-
}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/ControlDecorationAdapter.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/ControlDecorationAdapter.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/ControlDecorationAdapter.java 2011-03-23 20:40:23 UTC (rev 29981)
@@ -0,0 +1,37 @@
+package org.jboss.tools.internal.deltacloud.ui.utils;
+
+import org.eclipse.core.databinding.observable.value.IValueChangeListener;
+import org.eclipse.core.databinding.observable.value.ValueChangeEvent;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.fieldassist.ControlDecoration;
+
+/**
+ * A listener that shows/hides given control decorations on changes in the
+ * validation status it listens to.
+ *
+ * @author André Dietisheim
+ */
+public class ControlDecorationAdapter implements IValueChangeListener {
+ private ControlDecoration decoration;
+
+ public ControlDecorationAdapter(ControlDecoration decoration, IStatus initialStatus) {
+ this.decoration = decoration;
+ setDecorationVisible(initialStatus);
+ }
+
+ @Override
+ public void handleValueChange(ValueChangeEvent event) {
+ if (event.diff.getNewValue() instanceof IStatus) {
+ IStatus status = (IStatus) event.diff.getNewValue();
+ setDecorationVisible(status);
+ }
+ }
+
+ private void setDecorationVisible(IStatus status) {
+ if (!status.isOK()) {
+ decoration.show();
+ } else {
+ decoration.hide();
+ }
+ }
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/ControlDecorationAdapter.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionPage.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionPage.java 2011-03-23 18:46:48 UTC (rev 29980)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionPage.java 2011-03-23 20:40:23 UTC (rev 29981)
@@ -35,6 +35,7 @@
import org.eclipse.jface.databinding.wizard.WizardPageSupport;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.fieldassist.ControlDecoration;
+import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
@@ -67,6 +68,8 @@
import org.jboss.tools.internal.deltacloud.ui.common.databinding.validator.MandatoryStringValidator;
import org.jboss.tools.internal.deltacloud.ui.common.swt.JFaceUtils;
import org.jboss.tools.internal.deltacloud.ui.preferences.IPreferenceKeys;
+import org.jboss.tools.internal.deltacloud.ui.utils.ControlDecorationAdapter;
+import org.jboss.tools.internal.deltacloud.ui.utils.DataBindingUtils;
import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
/**
@@ -114,40 +117,23 @@
};
/**
- * Displays the cloud type in the given label. Listens to ValueChangeEvents
- * and sets the given label accordingly.
+ * jface databinding converter that converts Driver values to displayable
+ * text
*
- * @param typeLabel
- * the label that shall display the delta cloud type
- *
- * @see IValueChangeListener
- * @see DeltaCloudServerType
+ * @see DeltaCloudDriver
*/
- private class DeltaCloudTypeLabelAdapter implements IValueChangeListener {
+ private static class Driver2Label extends Converter {
- private Label typeLabel;
-
- public DeltaCloudTypeLabelAdapter(DeltaCloudDriver cloudType, Label typeLabel) {
- this.typeLabel = typeLabel;
- init(cloudType);
+ private Driver2Label() {
+ super(DeltaCloudDriver.class, String.class);
}
- private void init(DeltaCloudDriver cloudType) {
- setLabelText(cloudType);
- }
-
@Override
- public void handleValueChange(ValueChangeEvent event) {
- Object newValue = event.diff.getNewValue();
- setLabelText(newValue);
- }
-
- private void setLabelText(Object cloudType) {
- if (cloudType != null && !DeltaCloudDriver.UNKNOWN.equals(cloudType)) {
- typeLabel.setText(cloudType.toString());
- } else {
- typeLabel.setText("?"); // $NON-NLS-1$
+ public Object convert(Object fromObject) {
+ if (fromObject instanceof DeltaCloudDriver) {
+ return ((DeltaCloudDriver) fromObject).name();
}
+ return null;
}
}
@@ -201,7 +187,6 @@
setMessage(success);
showDecorations(!success);
}
-
});
monitor.done();
}
@@ -297,7 +282,6 @@
public CloudConnectionPage(String pageName, DeltaCloud initial, CloudConnection connection)
throws MalformedURLException, DeltaCloudException {
-
this(pageName, initial.getName(), initial.getURL(), initial.getUsername(),
initial.getPassword(), initial.getDriver(), connection);
}
@@ -354,8 +338,16 @@
Label typeLabel = new Label(container, SWT.NULL);
typeLabel.setText(WizardMessages.getString(CLOUDTYPE_LABEL));
Label computedTypeLabel = new Label(container, SWT.NULL);
- Binding urlTypeBinding = bindCloudType(dbc, urlText, computedTypeLabel);
+ Binding typeLabelBinding = bindCloudType(dbc, urlText, computedTypeLabel);
+ // bind url text decoration to type
+ ControlDecoration decoration = JFaceUtils.createDecoration(
+ urlText, WizardMessages.getString("IllegalCloudUrl.msg"), FieldDecorationRegistry.DEC_WARNING);
+ IObservableValue validationStatusProvider = typeLabelBinding.getValidationStatus();
+ DataBindingUtils.addValueChangeListener(
+ new ControlDecorationAdapter(decoration, (IStatus) validationStatusProvider.getValue()),
+ typeLabelBinding.getValidationStatus(), urlText);
+
// set url from preferences
String url =
new StringPreferenceValue(IPreferenceKeys.LAST_URL, Activator.PLUGIN_ID).get(urlText.getText());
@@ -365,7 +357,8 @@
Label usernameLabel = new Label(container, SWT.NULL);
usernameLabel.setText(WizardMessages.getString(USERNAME_LABEL));
Text usernameText = new Text(container, SWT.BORDER | SWT.SINGLE);
- UIUtils.createPreferencesProposalAdapter(usernameText, IDeltaCloudPreferenceConstants.CLOUD_USERNAME_PROPOSAL_KEY);
+ UIUtils.createPreferencesProposalAdapter(usernameText,
+ IDeltaCloudPreferenceConstants.CLOUD_USERNAME_PROPOSAL_KEY);
IObservableValue usernameObservable = WidgetProperties.text(SWT.Modify).observe(usernameText);
dbc.bindValue(
usernameObservable,
@@ -384,16 +377,16 @@
// test button
final Button testButton = new Button(container, SWT.NULL);
testButton.setText(WizardMessages.getString(TESTBUTTON_LABEL));
- boolean isUrlValid = ((IStatus) urlTypeBinding.getValidationStatus().getValue()).getSeverity() == IStatus.OK;
- urlTypeBinding.getValidationStatus().addValueChangeListener(
- enableButtonOnUrlValidityChanges(testButton, isUrlValid));
+ bindTestButtonEnablement(testButton, dbc);
CredentialsTestAdapter credentialsTestAdapter = new CredentialsTestAdapter(
usernameText,
passwordText);
testButton.addSelectionListener(credentialsTestAdapter);
- usernameObservable.addValueChangeListener(credentialsTestAdapter);
- passwordTextObservable.addValueChangeListener(credentialsTestAdapter);
+ DataBindingUtils.addValueChangeListener(
+ credentialsTestAdapter, usernameObservable, usernameText);
+ DataBindingUtils.addValueChangeListener(
+ credentialsTestAdapter, passwordTextObservable, passwordText);
// ec2 user link
Link ec2userLink = new Link(container, SWT.NULL);
@@ -486,24 +479,25 @@
}
/**
- * Enables/Disables (credentials) test button on url validity changes.
+ * Enables/Disables (credentials) test button on changes in the driver
+ * property of the model.
*
* @param testButton
- * the test button
- * @param isUrlValid
- * @return the i value change listener
+ * the test button to bind
+ * @param dbc
+ * the databinding context to use
*/
- private IValueChangeListener enableButtonOnUrlValidityChanges(final Button testButton, boolean isUrlValid) {
-
- testButton.setEnabled(isUrlValid);
- return new IValueChangeListener() {
-
- @Override
- public void handleValueChange(ValueChangeEvent event) {
- IStatus status = (IStatus) event.diff.getNewValue();
- testButton.setEnabled(status.isOK());
- }
- };
+ private void bindTestButtonEnablement(final Button testButton, DataBindingContext dbc) {
+ dbc.bindValue(
+ WidgetProperties.enabled().observe(testButton),
+ BeanProperties.value(CloudConnectionPageModel.PROPERTY_DRIVER).observe(connectionModel),
+ new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER),
+ new UpdateValueStrategy().setConverter(new Converter(DeltaCloudDriver.class, Boolean.class) {
+ @Override
+ public Object convert(Object fromObject) {
+ return connectionModel.isKnownCloud(fromObject);
+ }
+ }));
}
/**
@@ -520,37 +514,43 @@
* @param typeLabel
* the cloud type label to display the cloud type in
* @return
+ * @return
* @return the binding that was created
*/
private Binding bindCloudType(DataBindingContext dbc, Text urlText, final Label typeLabel) {
- UpdateValueStrategy updateStrategy = new UpdateValueStrategy();
- Url2DriverConverter urlToCloudTypeConverter = new Url2DriverConverter();
- updateStrategy.setConverter(urlToCloudTypeConverter);
- updateStrategy.setBeforeSetValidator(new CloudDriverValidator());
- // bind url to cloud type in model
- Binding urlTypeBinding = dbc.bindValue(
- WidgetProperties.text(SWT.Modify).observeDelayed(CLOUDTYPE_CHECK_DELAY, urlText),
+ // bind driver value to driver label
+ Binding typeLabelBinding = dbc.bindValue(
+ WidgetProperties.text().observe(typeLabel),
BeanProperties.value(CloudConnectionPageModel.PROPERTY_DRIVER).observe(connectionModel),
- updateStrategy,
- new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER));
- /*
- * bind converter to delta cloud label.
- *
- * Cloud type cannot be fetched from the model since invalid url's don't
- * get propagated to the model and no type update happens in this case.
- * We could not show invalid urls in the label if we would get the type
- * in the model.
- */
- IObservableValue cloudTypeObservable = urlToCloudTypeConverter.getCloudTypeObservable();
- Object value = cloudTypeObservable.getValue();
- Assert.isTrue(value == null || value instanceof DeltaCloudDriver);
- DeltaCloudTypeLabelAdapter cloudTypeAdapter = new DeltaCloudTypeLabelAdapter((DeltaCloudDriver) value,
- typeLabel);
- cloudTypeObservable.addValueChangeListener(cloudTypeAdapter);
- ControlDecorationSupport.create(urlTypeBinding, SWT.LEFT | SWT.TOP);
+ new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER),
+ new UpdateValueStrategy()
+ .setConverter(new Driver2Label())
+ .setAfterGetValidator(new IValidator() {
+ @Override
+ public IStatus validate(Object value) {
+ if (connectionModel.isKnownCloud(value)) {
+ return ValidationStatus.ok();
+ } else {
+ return ValidationStatus.warning(WizardMessages.getString("IllegalCloudUrl.msg"));
+ }
+ }
+ })
+ );
- return urlTypeBinding;
+ // set driver value when user stops typing or moves focus away
+ DataBindingUtils.addValueChangeListener(
+ new IValueChangeListener() {
+
+ @Override
+ public void handleValueChange(ValueChangeEvent event) {
+ String url = (String) event.diff.getNewValue();
+ connectionModel.setDriverByUrl(url);
+ }
+ },
+ WidgetProperties.text(SWT.Modify).observeDelayed(CLOUDTYPE_CHECK_DELAY, urlText),
+ urlText);
+ return typeLabelBinding;
}
/**
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionPageModel.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionPageModel.java 2011-03-23 18:46:48 UTC (rev 29980)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionPageModel.java 2011-03-23 20:40:23 UTC (rev 29981)
@@ -11,14 +11,21 @@
package org.jboss.tools.internal.deltacloud.ui.wizards;
import java.net.MalformedURLException;
+import java.text.MessageFormat;
+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.jboss.tools.deltacloud.core.DeltaCloud;
import org.jboss.tools.deltacloud.core.DeltaCloudDriver;
-import org.jboss.tools.internal.deltacloud.core.observable.ObservablePojo;
+import org.jboss.tools.deltacloud.core.DeltaCloudException;
+import org.jboss.tools.internal.deltacloud.ui.common.databinding.validator.ObservableUIPojo;
/**
* @author Andre Dietisheim
*/
-public class CloudConnectionPageModel extends ObservablePojo {
+public class CloudConnectionPageModel extends ObservableUIPojo {
public static final String PROPERTY_URL = "url"; //$NON-NLS-1$
public static final String PROPERTY_NAME = "name"; //$NON-NLS-1$
@@ -42,17 +49,19 @@
this("", "", "", "", DeltaCloudDriver.UNKNOWN);
}
- public CloudConnectionPageModel(String name, String url, String username, String password) throws MalformedURLException {
+ public CloudConnectionPageModel(String name, String url, String username, String password)
+ throws MalformedURLException {
this(name, url, username, password, DeltaCloudDriver.UNKNOWN);
}
public CloudConnectionPageModel(String name, String url, String username, String password, DeltaCloudDriver driver) {
this.name = name;
this.initialName = name;
- this.url = url;
+ this.url = url;
this.username = username;
this.password = password;
- this.driver = driver;
+ // this.driver = driver;
+ setDriverByUrl(url);
}
public String getUsername() {
@@ -98,4 +107,41 @@
public void setDriver(DeltaCloudDriver driver) {
firePropertyChange(PROPERTY_DRIVER, this.driver, this.driver = driver);
}
+
+ /**
+ * Sets the driver for a given cloud url. Queries the cloud at the given url
+ * and determine its driver.
+ *
+ * @param cloudUrl
+ * the url of the cloud to query
+ */
+ public void setDriverByUrl(final String url) {
+ setDriver(DeltaCloudDriver.UNKNOWN);
+ new Job(MessageFormat.format("Determining driver for cloud at url {0}", url)) {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ DeltaCloudDriver driver = getDriverFor(url);
+ setDriver(driver);
+ return Status.OK_STATUS;
+ }
+
+ }.schedule();
+ }
+
+ private DeltaCloudDriver getDriverFor(String url) {
+ try {
+ return DeltaCloud.getServerDriver(url);
+ } catch (DeltaCloudException e) {
+ return DeltaCloudDriver.UNKNOWN;
+ }
+ }
+
+ public boolean isKnownCloud(Object value) {
+ if (value instanceof DeltaCloudDriver) {
+ DeltaCloudDriver driver = (DeltaCloudDriver) value;
+ return driver != DeltaCloudDriver.UNKNOWN;
+ }
+ return false;
+ }
}
13 years, 9 months
JBoss Tools SVN: r29980 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2011-03-23 14:46:48 -0400 (Wed, 23 Mar 2011)
New Revision: 29980
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeAllStringsWizard.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsUtils.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizard.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizardRegisterBundlePage.java
Log:
https://issues.jboss.org/browse/JBIDE-7004 , registering bundle functionality was added.
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeAllStringsWizard.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeAllStringsWizard.java 2011-03-23 17:14:09 UTC (rev 29979)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeAllStringsWizard.java 2011-03-23 18:46:48 UTC (rev 29980)
@@ -18,9 +18,12 @@
import java.util.Properties;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.texteditor.ITextEditor;
+import org.jboss.tools.common.EclipseUtil;
import org.jboss.tools.jst.jsp.JspEditorPlugin;
import org.jboss.tools.jst.jsp.bundle.BundleMap;
import org.jboss.tools.jst.jsp.bundle.BundleMap.BundleEntry;
@@ -49,9 +52,9 @@
@Override
public void addPages() {
super.addPages();
- page1 = new ExternalizeAllStringsSelectBundlePage("ExternalizeAllStringsSelectBundlePage");
- page2 = new ExternalizeAllStringsKeysListPage("ExternalizeAllStringsKeysListPage");
- page3 = new ExternalizeStringsWizardRegisterBundlePage("ExternalizeStringsWizardRegisterBundlePage");
+ page1 = new ExternalizeAllStringsSelectBundlePage("ExternalizeAllStringsSelectBundlePage"); //$NON-NLS-1$
+ page2 = new ExternalizeAllStringsKeysListPage("ExternalizeAllStringsKeysListPage"); //$NON-NLS-1$
+ page3 = new ExternalizeStringsWizardRegisterBundlePage("ExternalizeStringsWizardRegisterBundlePage"); //$NON-NLS-1$
/*
* Add all the pages to the wizard
*/
@@ -75,7 +78,8 @@
* Exit when the file is null
*/
if (bundleFile == null) {
- JspEditorPlugin.getDefault().logError("Cannot externalize all string, because bundle file is not found");
+ JspEditorPlugin.getDefault().logError(
+ "Cannot externalize all string, because bundle file is not found"); //$NON-NLS-1$
return false;
}
if (bundleFile.exists()) {
@@ -88,19 +92,95 @@
JspEditorPlugin.getDefault().logError(e);
}
if (out.checkError()) {
- JspEditorPlugin.getDefault().logError("Error while writing to the properties file");
+ JspEditorPlugin.getDefault().logError(
+ "Error while writing to the properties file"); //$NON-NLS-1$
}
out.close();
out = null;
}
- page2.replaceAllStrings(findBundlePrefix());
+ String bundleName = page3.getBundleName();
+ String bundlePrefix = findBundlePrefix();
+ /*
+ * When no registered bundles found for entered properties file
+ * the wizard will generate its own bundler prefix and path.
+ */
+ if (Constants.EMPTY.equalsIgnoreCase(bundlePrefix)) {
+ /*
+ * In such a case there was no matching bundle prefix in the bundle map
+ * and user has entered its own bundle prefix.
+ * Thus this new name should be registered on the page depending on the
+ * choice where to register the bundle.
+ * Otherwise already found prefix is used without any additional registration.
+ */
+ String bundlePath;
+ String var;
+ /*
+ * Get the source folders for the project
+ */
+ String userDefinedPath = bundleFile.getAbsolutePath().replaceAll("\\\\", "/"); //$NON-NLS-1$ //$NON-NLS-2$
+ String srcPath = userDefinedPath;
+ IResource[] src = EclipseUtil.getJavaSourceRoots(ExternalizeStringsUtils.getProject(editor));
+ if (src != null) {
+ if (src.length > 1) {
+ for (IResource res : src) {
+ srcPath = res.getFullPath().toString();
+ if (userDefinedPath.indexOf(srcPath) > -1) {
+ break;
+ }
+ }
+ } else if (src.length == 1) {
+ srcPath = src[0].getFullPath().toString();
+ }
+ }
+ /*
+ * After the source folder has been found --
+ * generate the bundle path.
+ */
+ int srcPathIndex = userDefinedPath.indexOf(srcPath);
+ if (srcPathIndex > -1) {
+ /*
+ * User has selected the folder in the projects's source path.
+ * Replace the beginning
+ */
+ bundlePath = userDefinedPath.substring(srcPathIndex + srcPath.length() + 1).replaceAll("/", "\\."); //$NON-NLS-1$ //$NON-NLS-2$
+ } else {
+ /*
+ * User defined path is different from the source folder.
+ * Thus base-name would be incorrect.
+ */
+ bundlePath = userDefinedPath;
+ }
+ int pos = bundlePath.indexOf(Constants.PROPERTIES_EXTENTION);
+ if (pos > -1) {
+ bundlePath = bundlePath.substring(0, pos);
+ }
+
+ if (!Constants.EMPTY.equalsIgnoreCase(bundleName)) {
+ /*
+ * Get the name from the last page
+ */
+ var = bundleName;
+ } else {
+ /*
+ * var = file name from page1
+ */
+ var = bundlePath.substring(bundlePath.lastIndexOf("/") + 1); //$NON-NLS-1$
+ bundleName = var;
+ }
+ if (page3.isInFacesConfig()) {
+ ExternalizeStringsUtils.registerInFacesConfig(editor, bundlePath, var);
+ } else if (page3.isViaLoadBundle()) {
+ ExternalizeStringsUtils.registerViaLoadBundle(editor, bundlePath, var);
+ }
+ }
+ page2.replaceAllStrings(bundleName);
return true;
}
public String findBundlePrefix() {
String bundlePrefix = Constants.EMPTY;
if (page1.getBundleFile() != null) {
- String ap = page1.getBundleFile().getAbsolutePath();
+ String ap = getUserDefinedFile().getAbsolutePath();
for (BundleEntry be : bm.getBundles()) {
IFile bf = bm.getBundleFile(be.uri);
if (ap.equalsIgnoreCase(bf.getLocation().toOSString())) {
@@ -124,4 +204,10 @@
public void setPage3BundleName() {
page3.setBundleName(findBundlePrefix());
}
+ protected IProject getProject() {
+ return ExternalizeStringsUtils.getProject(editor);
+ }
+ protected File getUserDefinedFile() {
+ return page1.getBundleFile();
+ }
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsUtils.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsUtils.java 2011-03-23 17:14:09 UTC (rev 29979)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsUtils.java 2011-03-23 18:46:48 UTC (rev 29980)
@@ -30,6 +30,7 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.TextSelection;
import org.eclipse.jface.viewers.ColumnLayoutData;
import org.eclipse.jface.viewers.ColumnWeightData;
@@ -47,20 +48,33 @@
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
import org.eclipse.wst.sse.ui.internal.provisional.extensions.ISourceEditingTextTools;
+import org.eclipse.wst.xml.core.internal.document.AttrImpl;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
import org.eclipse.wst.xml.ui.internal.provisional.IDOMSourceEditingTextTools;
+import org.jboss.tools.common.meta.action.XActionInvoker;
+import org.jboss.tools.common.meta.action.impl.handlers.DefaultCreateHandler;
import org.jboss.tools.common.model.XModel;
+import org.jboss.tools.common.model.XModelException;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.project.IModelNature;
+import org.jboss.tools.common.model.ui.editors.dnd.DropURI;
+import org.jboss.tools.common.model.ui.views.palette.PaletteInsertHelper;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.model.util.ModelFeatureFactory;
import org.jboss.tools.common.util.FileUtil;
import org.jboss.tools.jst.jsp.JspEditorPlugin;
import org.jboss.tools.jst.jsp.bundle.BundleMap;
import org.jboss.tools.jst.jsp.editor.IVisualContext;
+import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
import org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor;
import org.jboss.tools.jst.jsp.jspeditor.SourceEditorPageContext;
+import org.jboss.tools.jst.jsp.jspeditor.dnd.JSPPaletteInsertHelper;
+import org.jboss.tools.jst.jsp.jspeditor.dnd.PaletteTaglibInserter;
import org.jboss.tools.jst.jsp.messages.JstUIMessages;
import org.jboss.tools.jst.jsp.util.Constants;
import org.jboss.tools.jst.jsp.util.FaceletsUtil;
@@ -68,8 +82,10 @@
import org.jboss.tools.jst.web.project.list.IWebPromptingProvider;
import org.jboss.tools.jst.web.project.list.WebPromptingProvider;
import org.jboss.tools.jst.web.tld.TaglibData;
+import org.jboss.tools.jst.web.tld.URIConstants;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
+import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/**
@@ -414,4 +430,159 @@
*/
return result;
}
+
+ public static void registerInFacesConfig(ITextEditor editor, String bundlePath, String var) {
+ /*
+ * Register new bundle in the faces-config.xml
+ * We should write only correct base-name.
+ * If it is not -- then just skip it. But such a situation
+ * should never happen.
+ */
+ IProject project = getProject(editor);
+ if (project != null) {
+ XModel model = EclipseResourceUtil.getModelNature(project).getModel();
+ XModelObject facesConfig = ExternalizeStringsUtils.findFacesConfig(model);
+ XModelObject application = facesConfig.getChildByPath("application"); //$NON-NLS-1$
+ XModelObject resourceBundle = facesConfig.getModel().createModelObject("JSFResourceBundle", null); //$NON-NLS-1$
+ resourceBundle.setAttributeValue("base-name", bundlePath); //$NON-NLS-1$
+ resourceBundle.setAttributeValue("var", var); //$NON-NLS-1$
+ try {
+ DefaultCreateHandler.addCreatedObject(application, resourceBundle, 0);
+ } catch (XModelException e) {
+ JspEditorPlugin.getDefault().logError(
+ "Could not add <resource-bundle> to the faces-config.xml", e); //$NON-NLS-1$
+ }
+ /*
+ * When the faces-config.xml is opened in the editor the following
+ * action should be called to ensure that changes have been applied.
+ */
+ XActionInvoker.invoke("SaveActions.Save", facesConfig, new Properties()); //$NON-NLS-1$
+ }
+ }
+
+
+ public static void registerViaLoadBundle(ITextEditor editor, String bundlePath, String var) {
+ /*
+ * Add <f:loadBundle> tag to the current page.
+ * Insert the tag inside <f:view> or <html>.
+ */
+ String jsfCoreTaglibPrefix = registerMessageTaglib(editor);
+ IStructuredModel model = null;
+ IModelManager manager = StructuredModelManager.getModelManager();
+ if (manager != null) {
+ try {
+ model = manager.getModelForEdit(getFile(editor));
+ } catch (IOException e) {
+ JspEditorPlugin.getDefault().logError(e);
+ } catch (CoreException e) {
+ JspEditorPlugin.getDefault().logError(e);
+ }
+ if (model instanceof IDOMModel) {
+ IDOMModel domModel = (IDOMModel) model;
+ IDOMDocument document = domModel.getDocument();
+ NodeList viewList = document.getElementsByTagName(jsfCoreTaglibPrefix + ":view"); //$NON-NLS-1$
+ NodeList subviewList = document.getElementsByTagName(jsfCoreTaglibPrefix + ":subview"); //$NON-NLS-1$
+ NodeList htmlList = document.getElementsByTagName("html"); //$NON-NLS-1$
+ IDocument doc = editor.getDocumentProvider().getDocument(editor.getEditorInput());
+ Node node = null;
+ if (viewList.getLength() > 0) {
+ /*
+ * Add loadBundle right after f:view declaration
+ */
+ node = viewList.item(0);
+ } else if (subviewList.getLength() > 0) {
+ /*
+ * There is no f:view, may be f:subwiew
+ */
+ node = subviewList.item(0);
+ } else {
+ /*
+ * Register at least somewhere
+ */
+ node = htmlList.item(0);
+ }
+ if (node != null) {
+ /*
+ * Create f:loadBundle element
+ */
+ Document srcDoc = node.getOwnerDocument();
+ Element loadBundle = srcDoc.createElement(
+ jsfCoreTaglibPrefix + Constants.COLON + "loadBundle"); //$NON-NLS-1$
+ loadBundle.setAttribute("var", var); //$NON-NLS-1$
+ loadBundle.setAttribute("basename", bundlePath); //$NON-NLS-1$
+ Node firstChild = node.getFirstChild();
+ if (firstChild != null) {
+ firstChild.insertBefore(loadBundle, node);
+ }
+ }
+ }
+ } else {
+ JspEditorPlugin.getDefault().logWarning(
+ JstUIMessages.EXTERNALIZE_STRINGS_DIALOG_CANNOT_ADD_LOAD_BUNDLE_TAG);
+ }
+ }
+
+ /**
+ * Register Message Taglibs on page
+ */
+ public static String registerMessageTaglib(ITextEditor editor) {
+ List<TaglibData> taglibs = null;
+ String jsfCoreTaglibPrefix = "f"; //$NON-NLS-1$
+ if (editor instanceof JSPMultiPageEditor) {
+ StructuredTextEditor ed = ((JSPMultiPageEditor) editor).getSourceEditor();
+ if (ed instanceof JSPTextEditor) {
+ IVisualContext context = ((JSPTextEditor) ed).getPageContext();
+ if (context instanceof SourceEditorPageContext) {
+ SourceEditorPageContext sourcePageContext = (SourceEditorPageContext) context;
+ taglibs = sourcePageContext.getTagLibs();
+ if (null == taglibs) {
+ JspEditorPlugin.getDefault().logError(
+ JstUIMessages.CANNOT_LOAD_TAGLIBS_FROM_PAGE_CONTEXT);
+ } else {
+ boolean isJsfCoreTaglibRegistered = false;
+ for (TaglibData tl : taglibs) {
+ if (DropURI.JSF_CORE_URI.equalsIgnoreCase(tl.getUri())) {
+ isJsfCoreTaglibRegistered = true;
+ jsfCoreTaglibPrefix = tl.getPrefix();
+ break;
+ }
+ }
+ if (!isJsfCoreTaglibRegistered) {
+ /*
+ * Register the required taglib
+ */
+ PaletteTaglibInserter PaletteTaglibInserter = new PaletteTaglibInserter();
+ Properties p = new Properties();
+ p.put("selectionProvider", editor.getSelectionProvider()); //$NON-NLS-1$
+ p.setProperty(URIConstants.LIBRARY_URI, DropURI.JSF_CORE_URI);
+ p.setProperty(URIConstants.LIBRARY_VERSION, ""); //$NON-NLS-1$
+ p.setProperty(URIConstants.DEFAULT_PREFIX, jsfCoreTaglibPrefix);
+ p.setProperty(JSPPaletteInsertHelper.PROPOPERTY_ADD_TAGLIB, "true"); //$NON-NLS-1$
+ p.setProperty(JSPPaletteInsertHelper.PROPOPERTY_REFORMAT_BODY, "yes"); //$NON-NLS-1$
+ p.setProperty(PaletteInsertHelper.PROPOPERTY_START_TEXT,
+ "<%@ taglib uri=\"http://java.sun.com/jsf/core\" prefix=\"f\" %>\\n"); //$NON-NLS-1$
+ PaletteTaglibInserter.inserTaglib(ed.getTextViewer().getDocument(), p);
+ }
+ }
+ }
+ }
+ }
+ return jsfCoreTaglibPrefix;
+ }
+
+ public static IFile getFile(ITextEditor editor) {
+ if (editor.getEditorInput() instanceof IFileEditorInput) {
+ return ((IFileEditorInput)editor.getEditorInput()).getFile();
+ }
+ return null;
+ }
+
+ public static IProject getProject(ITextEditor editor) {
+ IFile file = getFile(editor);
+ if (file != null) {
+ return file.getProject();
+ }
+ return null;
+ }
+
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizard.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizard.java 2011-03-23 17:14:09 UTC (rev 29979)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizard.java 2011-03-23 18:46:48 UTC (rev 29980)
@@ -195,9 +195,9 @@
*/
if (page1.isNewFile() && !page3.isUserDefined()) {
var = page3.getBundleName();
- if (getProject()!=null) {
- IProject project = getProject();
- String userDefinedPath = page2.getContainerFullPath().toString();
+ IProject project = ExternalizeStringsUtils.getProject(editor);
+ if (project != null) {
+ String userDefinedPath = getUserDefinedPath().toString();
/*
* Get the source folders for the project
*/
@@ -286,8 +286,10 @@
Object selectedElement = structuredSelection.getFirstElement();
if (selectedElement instanceof Node) {
Node node = (Node) selectedElement;
- registerMessageTaglib();
- String jsfCoreTaglibPrefix = "f"; //$NON-NLS-1$
+ String jsfCoreTaglibPrefix = ExternalizeStringsUtils.registerMessageTaglib(editor);
+ /*
+ * Create f:loadBundle element
+ */
Element loadBundle = node.getOwnerDocument().createElement(
jsfCoreTaglibPrefix + Constants.COLON + "loadBundle"); //$NON-NLS-1$
loadBundle.setAttribute("var", var); //$NON-NLS-1$
@@ -323,53 +325,6 @@
page1.replaceText(replacement);
return true;
}
- /**
- * Register Message Taglibs on page
- */
- protected void registerMessageTaglib(){
- List<TaglibData> taglibs = null;
- String jsfCoreTaglibPrefix = "f"; //$NON-NLS-1$
- if (editor instanceof JSPMultiPageEditor) {
- StructuredTextEditor ed = ((JSPMultiPageEditor) editor).getSourceEditor();
- if (ed instanceof JSPTextEditor) {
- IVisualContext context = ((JSPTextEditor) ed).getPageContext();
- if (context instanceof SourceEditorPageContext) {
- SourceEditorPageContext sourcePageContext = (SourceEditorPageContext) context;
- taglibs = sourcePageContext.getTagLibs();
- if (null == taglibs) {
- JspEditorPlugin.getDefault().logError(
- JstUIMessages.CANNOT_LOAD_TAGLIBS_FROM_PAGE_CONTEXT);
- } else {
- boolean isJsfCoreTaglibRegistered = false;
- for (TaglibData tl : taglibs) {
- if (DropURI.JSF_CORE_URI.equalsIgnoreCase(tl.getUri())) {
- isJsfCoreTaglibRegistered = true;
- jsfCoreTaglibPrefix = tl.getPrefix();
- break;
- }
- }
- if (!isJsfCoreTaglibRegistered) {
- /*
- * Register the required taglib
- */
- PaletteTaglibInserter PaletteTaglibInserter = new PaletteTaglibInserter();
- Properties p = new Properties();
- p.put("selectionProvider", getSelectionProvider()); //$NON-NLS-1$
- p.setProperty(URIConstants.LIBRARY_URI, DropURI.JSF_CORE_URI);
- p.setProperty(URIConstants.LIBRARY_VERSION, ""); //$NON-NLS-1$
- p.setProperty(URIConstants.DEFAULT_PREFIX, jsfCoreTaglibPrefix);
- p.setProperty(JSPPaletteInsertHelper.PROPOPERTY_ADD_TAGLIB, "true"); //$NON-NLS-1$
- p.setProperty(JSPPaletteInsertHelper.PROPOPERTY_REFORMAT_BODY, "yes"); //$NON-NLS-1$
- p.setProperty(PaletteInsertHelper.PROPOPERTY_START_TEXT,
- "<%@ taglib uri=\"http://java.sun.com/jsf/core\" prefix=\"f\" %>\\n"); //$NON-NLS-1$
- PaletteTaglibInserter.inserTaglib(ed.getTextViewer().getDocument(), p);
- }
- }
- }
- }
- }
-
- }
private IDocument getDocument(){
IDocumentProvider prov = editor.getDocumentProvider();
@@ -385,8 +340,8 @@
*/
private IPath getContainerFullPath(){
IPath containerFullPath = null;
- if (editor.getEditorInput() instanceof IFileEditorInput) {
- IProject project = ((IFileEditorInput)editor.getEditorInput()).getFile().getProject();
+ IProject project = ExternalizeStringsUtils.getProject(editor);
+ if (project != null) {
IResource[] src = EclipseUtil.getJavaSourceRoots(project);
if (src.length > 0) {
containerFullPath = src[0].getFullPath();
@@ -401,15 +356,14 @@
return containerFullPath;
}
- protected String getFileName(){
- return editor.getEditorInput().getName();
+ protected IPath getUserDefinedPath() {
+ return page2.getContainerFullPath();
}
- protected IProject getProject(){
- IProject project = null;
- if (editor.getEditorInput() instanceof IFileEditorInput) {
- project = ((IFileEditorInput)editor.getEditorInput()).getFile().getProject();
- }
- return project;
+ protected String getFileName() {
+ return editor.getEditorInput().getName();
}
+ protected IProject getProject() {
+ return ExternalizeStringsUtils.getProject(editor);
+ }
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizardRegisterBundlePage.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizardRegisterBundlePage.java 2011-03-23 17:14:09 UTC (rev 29979)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizardRegisterBundlePage.java 2011-03-23 18:46:48 UTC (rev 29980)
@@ -52,6 +52,7 @@
private Button userDefined;
private Label bundleLabel;
private Text bundleName;
+ private Group group;
/**
* Instantiates a new externalize strings wizard register bundle page.
@@ -101,7 +102,7 @@
/*
* Group with a place for bundle
*/
- Group group = new Group(composite, SWT.SHADOW_ETCHED_IN);
+ group = new Group(composite, SWT.SHADOW_ETCHED_IN);
group.setLayout(new GridLayout(1, true));
group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
group.setText(JstUIMessages.EXTERNALIZE_STRINGS_DIALOG_SAVE_RESOURCE_BUNDLE);
@@ -205,12 +206,18 @@
* Update bundle name field.
*/
private void updateBundleNameField() {
- if (isUserDefined()) {
- bundleLabel.setEnabled(false);
- bundleName.setEnabled(false);
- } else {
- bundleLabel.setEnabled(true);
- bundleName.setEnabled(true);
+ /*
+ * While externalizing all strings - this update is unnecessary.
+ * It will be done in setBundleName() method.
+ */
+ if (getWizard() instanceof ExternalizeStringsWizard) {
+ if (isUserDefined()) {
+ bundleLabel.setEnabled(false);
+ bundleName.setEnabled(false);
+ } else {
+ bundleLabel.setEnabled(true);
+ bundleName.setEnabled(true);
+ }
}
}
@@ -221,31 +228,40 @@
*/
private boolean isSourceFolderSelected() {
boolean sourceFolderSelected = false;
+ IProject project = null;
+ String userDefinedPath = Constants.EMPTY;
if (getWizard() instanceof ExternalizeStringsWizard) {
- ExternalizeStringsWizard wiz = (ExternalizeStringsWizard) getWizard();
- if (wiz.getProject()!=null) {
- IProject project = wiz.getProject();
- WizardNewFileCreationPage page2 = (WizardNewFileCreationPage)wiz.getPage(
- ExternalizeStringsWizard.EXTERNALIZE_STRINGS_DIALOG_NEW_FILE_PAGE);
- String userDefinedPath = page2.getContainerFullPath().toString();
- /*
- * Get the source folders for the project
- */
- IResource[] src = EclipseUtil.getJavaSourceRoots(project);
- /*
- * When there are multiple source folders --
- * match user defined folder to them.
- */
- String srcPath = Constants.EMPTY;
- for (IResource res : src) {
- srcPath = res.getFullPath().toString();
- if (userDefinedPath.indexOf(srcPath) > -1) {
- sourceFolderSelected = true;
- break;
- }
- }
+ ExternalizeStringsWizard wiz = (ExternalizeStringsWizard) getWizard();
+ project = wiz.getProject();
+ if (project != null) {
+ userDefinedPath = wiz.getUserDefinedPath().toString();
}
+ } else if (getWizard() instanceof ExternalizeAllStringsWizard) {
+ ExternalizeAllStringsWizard wiz = (ExternalizeAllStringsWizard) getWizard();
+ project = wiz.getProject();
+ if (project != null) {
+ userDefinedPath = wiz.getUserDefinedFile().getAbsolutePath().toString();
+ }
}
+ if ((project != null)
+ && !Constants.EMPTY.equalsIgnoreCase(userDefinedPath)) {
+ /*
+ * Get the source folders for the project
+ */
+ IResource[] src = EclipseUtil.getJavaSourceRoots(project);
+ /*
+ * When there are multiple source folders --
+ * match user defined folder to them.
+ */
+ String srcPath = Constants.EMPTY;
+ for (IResource res : src) {
+ srcPath = res.getFullPath().toString();
+ if (userDefinedPath.indexOf(srcPath) > -1) {
+ sourceFolderSelected = true;
+ break;
+ }
+ }
+ }
return sourceFolderSelected;
}
@@ -272,8 +288,17 @@
public void setBundleName(String bn) {
if (bundleName != null) {
- bundleName.setText(bn);
+ if (!Constants.EMPTY.equalsIgnoreCase(bn)) {
+ bundleName.setText(bn);
+ bundleName.setEditable(false);
+ bundleLabel.setEnabled(false);
+ group.setEnabled(false);
+ } else {
+ bundleName.setText(Constants.EMPTY);
+ bundleName.setEditable(true);
+ bundleLabel.setEnabled(true);
+ group.setEnabled(true);
+ }
}
}
-
}
13 years, 9 months
JBoss Tools SVN: r29979 - trunk/vpe/tests/org.jboss.tools.vpe.test/scheme.
by jbosstools-commits@lists.jboss.org
Author: yradtsevich
Date: 2011-03-23 13:14:09 -0400 (Wed, 23 Mar 2011)
New Revision: 29979
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.test/scheme/scheme.xsd
Log:
https://issues.jboss.org/browse/JBIDE-8613 : VPE test falures
- failure of TemplateSchemeValidateTest.testValidationGlobalTemplates() is fixed. The failure was caused by changes in https://issues.jboss.org/browse/JBIDE-8220
Modified: trunk/vpe/tests/org.jboss.tools.vpe.test/scheme/scheme.xsd
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.test/scheme/scheme.xsd 2011-03-23 17:05:16 UTC (rev 29978)
+++ trunk/vpe/tests/org.jboss.tools.vpe.test/scheme/scheme.xsd 2011-03-23 17:14:09 UTC (rev 29979)
@@ -629,6 +629,7 @@
<xsd:enumeration value="FontSizeFormat"/>
<xsd:enumeration value="BackgroundColorFormat"/>
<xsd:enumeration value="ForegroundColorFormat"/>
+ <xsd:enumeration value="StyleFormat"/>
</xsd:restriction>
</xsd:simpleType>
<!-- -->
13 years, 9 months
JBoss Tools SVN: r29978 - trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide.
by jbosstools-commits@lists.jboss.org
Author: yradtsevich
Date: 2011-03-23 13:05:16 -0400 (Wed, 23 Mar 2011)
New Revision: 29978
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE1494Test.java
Log:
https://issues.jboss.org/browse/JBIDE-8613 : VPE test falures
- failure of JBIDE1494Test.testJBIDE1494() is fixed. The failure was caused by changes in https://issues.jboss.org/browse/JBIDE-8220
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE1494Test.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE1494Test.java 2011-03-23 16:49:34 UTC (rev 29977)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE1494Test.java 2011-03-23 17:05:16 UTC (rev 29978)
@@ -75,7 +75,7 @@
assertNotNull(h_output_template.getTextFormattingData());
//text formating for h:output
- assertEquals(7,h_output_template.getTextFormattingData().getAllFormatData().length);
+ assertEquals(8, h_output_template.getTextFormattingData().getAllFormatData().length);
Node h_dataTable = (Node) ContentAssistUtils.getNodeAt(part
.getSourceEditor().getTextViewer(), 473);
@@ -88,7 +88,7 @@
assertNotNull(h_data_Table.getTextFormattingData());
- assertEquals(8,h_data_Table.getTextFormattingData().getAllFormatData().length);
+ assertEquals(9, h_data_Table.getTextFormattingData().getAllFormatData().length);
Node span =(Node) ContentAssistUtils.getNodeAt(part
.getSourceEditor().getTextViewer(), 615);
@@ -98,7 +98,7 @@
VpeTemplate spanTemplate = templateManager.getTemplate(vpeController.getPageContext(),span, dependencySet);
assertNotNull(spanTemplate);
- assertEquals(10,spanTemplate.getTextFormattingData().getAllFormatData().length);
+ assertEquals(11,spanTemplate.getTextFormattingData().getAllFormatData().length);
}
13 years, 9 months
JBoss Tools SVN: r29977 - trunk/examples/tests/org.jboss.tools.project.examples.test/META-INF.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-03-23 12:49:34 -0400 (Wed, 23 Mar 2011)
New Revision: 29977
Modified:
trunk/examples/tests/org.jboss.tools.project.examples.test/META-INF/MANIFEST.MF
Log:
JBIDE-8618 Add JUnit tests for Project Examples
Modified: trunk/examples/tests/org.jboss.tools.project.examples.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/examples/tests/org.jboss.tools.project.examples.test/META-INF/MANIFEST.MF 2011-03-23 15:33:10 UTC (rev 29976)
+++ trunk/examples/tests/org.jboss.tools.project.examples.test/META-INF/MANIFEST.MF 2011-03-23 16:49:34 UTC (rev 29977)
@@ -25,13 +25,13 @@
org.eclipse.ui,
org.eclipse.core.resources,
org.junit4,
- org.jboss.ide.seam.gen,
org.jboss.tools.jsf.vpe.seam,
org.jboss.tools.seam.pages.xml,
org.jboss.tools.seam.ui,
org.jboss.tools.seam.ui.pages,
org.jboss.tools.seam.xml,
- org.jboss.tools.seam.xml.ui
+ org.jboss.tools.seam.xml.ui,
+ org.jboss.tools.seam.text.ext
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Export-Package: org.jboss.tools.project.examples.test
13 years, 9 months
JBoss Tools SVN: r29976 - trunk/examples/tests/org.jboss.tools.project.examples.test/META-INF.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-03-23 11:33:10 -0400 (Wed, 23 Mar 2011)
New Revision: 29976
Modified:
trunk/examples/tests/org.jboss.tools.project.examples.test/META-INF/MANIFEST.MF
Log:
JBIDE-8618 Add JUnit tests for Project Examples
Modified: trunk/examples/tests/org.jboss.tools.project.examples.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/examples/tests/org.jboss.tools.project.examples.test/META-INF/MANIFEST.MF 2011-03-23 10:28:25 UTC (rev 29975)
+++ trunk/examples/tests/org.jboss.tools.project.examples.test/META-INF/MANIFEST.MF 2011-03-23 15:33:10 UTC (rev 29976)
@@ -24,7 +24,14 @@
org.eclipse.jst.jee.web,
org.eclipse.ui,
org.eclipse.core.resources,
- org.junit4;bundle-version="4.8.1"
+ org.junit4,
+ org.jboss.ide.seam.gen,
+ org.jboss.tools.jsf.vpe.seam,
+ org.jboss.tools.seam.pages.xml,
+ org.jboss.tools.seam.ui,
+ org.jboss.tools.seam.ui.pages,
+ org.jboss.tools.seam.xml,
+ org.jboss.tools.seam.xml.ui
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Export-Package: org.jboss.tools.project.examples.test
13 years, 9 months
JBoss Tools SVN: r29975 - in branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui: src/org/jboss/tools/deltacloud/ui/commands and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-03-23 06:28:25 -0400 (Wed, 23 Mar 2011)
New Revision: 29975
Modified:
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/StopInstanceHandler.java
Log:
[JBIDE-8295] asking user to confirm instance stop now
Modified: branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
===================================================================
--- branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2011-03-23 10:24:45 UTC (rev 29974)
+++ branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2011-03-23 10:28:25 UTC (rev 29975)
@@ -1,5 +1,9 @@
2011-03-23 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
+ * src/org/jboss/tools/deltacloud/ui/views/CVMessages.properties:
+ * src/org/jboss/tools/deltacloud/ui/commands/StopInstanceHandler.java (doStopInstance):
+ [JBIDE-8295] asking user to confirm instance stop now
+
* src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.properties:
* src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnectionWizard.java (createCloud):
* src/org/jboss/tools/internal/deltacloud/ui/wizards/EditCloudConnectionWizard.java (editCloud):
Modified: branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/StopInstanceHandler.java
===================================================================
--- branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/StopInstanceHandler.java 2011-03-23 10:24:45 UTC (rev 29974)
+++ branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/StopInstanceHandler.java 2011-03-23 10:28:25 UTC (rev 29975)
@@ -17,21 +17,28 @@
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.MessageDialogWithToggle;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.handlers.HandlerUtil;
import org.jboss.tools.common.log.StatusFactory;
import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
import org.jboss.tools.deltacloud.ui.Activator;
import org.jboss.tools.deltacloud.ui.views.CVMessages;
import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
+import org.jboss.tools.internal.deltacloud.ui.utils.WorkbenchUtils;
+import org.osgi.service.prefs.Preferences;
/**
* @author Andre Dietisheim
*/
public class StopInstanceHandler extends AbstractInstanceHandler {
+ private static final String DONT_CONFIRM_CREATE_INSTANCE = "dont_confirm_create_instance"; //$NON-NLS-1$
+
private final static String STOPPING_INSTANCE_TITLE = "StoppingInstance.title"; //$NON-NLS-1$
private final static String STOPPING_INSTANCE_MSG = "StoppingInstance.msg"; //$NON-NLS-1$
private final static String STOP_INSTANCES_DIALOG_TITLE = "StopInstancesDialog.title"; //$NON-NLS-1$
@@ -84,19 +91,60 @@
}
private void stopInstances(Object[] deltaCloudInstances) {
- for (int i = 0; i < deltaCloudInstances.length; i++) {
- stopInstance((DeltaCloudInstance) deltaCloudInstances[i]);
+ if (askUserToConfirm()) {
+ for (int i = 0; i < deltaCloudInstances.length; i++) {
+ doStopInstance((DeltaCloudInstance) deltaCloudInstances[i]);
+ }
}
}
private void stopInstance(DeltaCloudInstance instance) {
if (instance != null) {
+ if (askUserToConfirm()) {
+ doStopInstance(instance);
+ }
+ }
+ }
+
+ private void doStopInstance(DeltaCloudInstance instance) {
+ if (instance != null) {
executeInstanceAction(
- instance
- , DeltaCloudInstance.Action.STOP
- , DeltaCloudInstance.State.STOPPED
- , CVMessages.getString(STOPPING_INSTANCE_TITLE)
- , CVMessages.getFormattedString(STOPPING_INSTANCE_MSG, new String[] { instance.getName() }));
+ instance
+ , DeltaCloudInstance.Action.STOP
+ , DeltaCloudInstance.State.STOPPED
+ , CVMessages.getString(STOPPING_INSTANCE_TITLE)
+ , CVMessages.getFormattedString(STOPPING_INSTANCE_MSG, new String[] { instance.getAlias() }));
}
}
+
+ private boolean askUserToConfirm() {
+ return openConfirmationDialog(
+ CVMessages.getString("StopInstancesConfirm.title"),
+ CVMessages.getString("StopInstancesConfirm.msg"),
+ CVMessages.getString("StopInstancesConfirmDontWarn.msg"),
+ DONT_CONFIRM_CREATE_INSTANCE,
+ Activator.PLUGIN_ID,
+ WorkbenchUtils.getActiveShell());
+ }
+
+ private static boolean openConfirmationDialog(String title, String message, String dontShowAgainMessage,
+ String preferencesKey, String pluginId, Shell shell) {
+ boolean confirmed = true;
+ Preferences prefs = new InstanceScope().getNode(pluginId);
+ boolean dontShowDialog =
+ prefs.getBoolean(preferencesKey, false);
+ if (!dontShowDialog) {
+ MessageDialogWithToggle dialog =
+ MessageDialogWithToggle.openOkCancelConfirm(shell, title, message, dontShowAgainMessage,
+ false, null, null);
+ confirmed = dialog.getReturnCode() == Dialog.OK;
+ boolean toggleState = dialog.getToggleState();
+ // If warning turned off by user, set the preference for future
+ // usage
+ if (toggleState) {
+ prefs.putBoolean(preferencesKey, true);
+ }
+ }
+ return confirmed;
+ }
}
13 years, 9 months
JBoss Tools SVN: r29974 - in branches/jbosstools-3.2.x/deltacloud/plugins: org.jboss.tools.deltacloud.core/src/org/jboss/tools/internal/deltacloud/core/observable and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-03-23 06:24:45 -0400 (Wed, 23 Mar 2011)
New Revision: 29974
Modified:
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/internal/deltacloud/core/observable/ObservablePojo.java
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ImageView.java
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/InstanceView.java
Log:
[JBIDE-8590] adding listeners only if they're not added yet
Modified: branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
===================================================================
--- branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2011-03-23 10:22:28 UTC (rev 29973)
+++ branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2011-03-23 10:24:45 UTC (rev 29974)
@@ -1,985 +1,18 @@
-2011-01-11 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
+2011-03-16 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java
- (listRealms):
- [JBIDE-7935] moved realms unmarshalling to separate classes (and added tests).
- * src/org/jboss/tools/deltacloud/core/client/request/TypeRequest.java:
- * src/org/jboss/tools/deltacloud/core/client/request/PerformInstanceActionRequest.java:
- * src/org/jboss/tools/deltacloud/core/client/request/ListRealmsRequest.java:
- * src/org/jboss/tools/deltacloud/core/client/request/ListRealmRequest.java:
- * src/org/jboss/tools/deltacloud/core/client/request/ListKeysRequest.java:
- * src/org/jboss/tools/deltacloud/core/client/request/ListKeyRequest.java:
- * src/org/jboss/tools/deltacloud/core/client/request/ListInstancesRequest.java:
- * src/org/jboss/tools/deltacloud/core/client/request/ListInstanceRequest.java:
- * src/org/jboss/tools/deltacloud/core/client/request/ListImagesRequest.java:
- * src/org/jboss/tools/deltacloud/core/client/request/ListImageRequest.java:
- * src/org/jboss/tools/deltacloud/core/client/request/ListHardwareProfilesRequest.java:
- * src/org/jboss/tools/deltacloud/core/client/request/ListHardwareProfileRequest.java:
- * src/org/jboss/tools/deltacloud/core/client/request/DeleteKeyRequest.java:
- * src/org/jboss/tools/deltacloud/core/client/request/CreateKeyRequest.java:
- * src/org/jboss/tools/deltacloud/core/client/request/CreateInstanceRequest.java:
- * src/org/jboss/tools/deltacloud/core/client/request/AbstractListObjectsRequest.java:
- * src/org/jboss/tools/deltacloud/core/client/request/AbstractDeltaCloudRequest.java:
- (urlString):
- (url):
- (getUrl):
- (toString):
- (getUrlString):
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java
- (request):
- [JBIDE-7695] delayed URL creation to request time. Gained capability to store invalid urls and report them at request time.
- * src/org/jboss/tools/deltacloud/core/client/unmarshal/ImagesUnmarshaller.java:
- * src/org/jboss/tools/deltacloud/core/client/unmarshal/ImageUnmarshaller.java:
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java
- (listImages):
- (listImages):
- [JBIDE-7935] moved image unmarshalling to its own class (and created tests for it)
+ * src/org/jboss/tools/internal/deltacloud/core/observable/ObservablePojo.java
+ (contains):
+ (addPropertyChangeListener):
+ (addPropertyChangeListener):
+ [JBIDE-8590] adding listeners only if they're not added yet
-2011-01-10 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
+2011-03-09 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
- * src/org/jboss/tools/deltacloud/core/client/unmarshal/HardwareProfileUnmarshaller.java:
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java (listProfile):
- [JBIDE-7935] moved HardwareProfile unmarshalling to HardwareProfileUnmarshaller
-
-2011-01-04 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
-
- * src/org/jboss/tools/deltacloud/core/DeltaCloudInstancesRepository.java:
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (loadInstances):
- [JBIDE-7294] added factory for DeltaCloudInstance instances, removed functionality from DeltaCloudInstanceRepository
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java (createInstance):
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java (createInstance):
- * src/org/jboss/tools/deltacloud/core/client/request/CreateInstanceRequest.java (doCreateUrl):
- [JBIDE-7294] removed name parameter from request since DeltaCloud does not honor the name you choose
- * src/org/jboss/tools/deltacloud/core/IInstanceAliasMapping.java:
- * src/org/jboss/tools/deltacloud/core/InstanceAliasMapping.java:
- * src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java
- (setAlias):
- (getAlias):
-
-2011-01-03 adietisheim <adietisheim@adietisheim-thinkpad>
-
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (createInstance):
- * src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java
- (getAlias):
- (setAlias):
- [JBIDE-7294] implementing alias support
-
-2010-12-27 adietisheim <adietisheim@adietisheim-thinkpad>
-
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (isValid):
- [JBIDE-7864] added isValid property tester to offer "launch instance" on valid clouds only
-
-2010-12-23 adietisheim <adietisheim@adietisheim-thinkpad>
-
- * src/org/jboss/tools/deltacloud/core/job/AbstractCloudElementJob.java (CLOUDELEMENT.KEYS):
- * src/org/jboss/tools/deltacloud/core/DeltaCloudKey.java:
* src/org/jboss/tools/deltacloud/core/DeltaCloud.java
- (createKey):
- (getKeys):
- [JBIDE-7763] added methods to DeltaCloud to get all keys and to create a key on the server
-
-2010-12-22 adietisheim <adietisheim@adietisheim-thinkpad>
-
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java (DeltaCloudClientImpl):
- [JBIDE-7981] need to create a documentbuilder on each new parsing to avoid threads using the same builder.
- * src/org/jboss/tools/deltacloud/core/FieldMatcher.java (FieldMatcher):
- [JBIDE-7981] set filter to filter in case insensitive manner
-
-2010-12-21 André Dietisheim <adietish(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/client/unmarshal/KeysUnmarshaller.java:
- * src/org/jboss/tools/deltacloud/core/client/unmarshal/KeyUnmarshaller.java:
- * src/org/jboss/tools/deltacloud/core/client/unmarshal/KeyActionUnmarshaller.java:
- * src/org/jboss/tools/deltacloud/core/client/unmarshal/AbstractDOMUnmarshaller.java:
- * src/org/jboss/tools/deltacloud/core/client/unmarshal/AbstractDeltaCloudObjectUnmarshaller.java:
- * src/org/jboss/tools/deltacloud/core/client/request/ListKeysRequest.java:
- * src/org/jboss/tools/deltacloud/core/client/Key.java:
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java
- (createKey):
- (listKeys):
- (listKey):
- [JBIDE-7763][JBIDE-7371] implemented keys related methods & tests, now returning Key object
-
-2010-12-17 André Dietisheim <adietish(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java (createKey):
- [JBIDE-7371] added #createKey method that now returns a key instance
-
-2010-12-16 André Dietisheim <adietish(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/client/request/ListKeysRequest.java:
- * src/org/jboss/tools/deltacloud/core/client/request/CreateKeyRequest.java:
- [JBIDE-7371] implementing listing keys with deltacloud client
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (testCredentials):
- [JBIDE-7911] corrected: throws exceptions on error (internal server error, connection error etc)
-
-2010-12-15 André Dietisheim <adietish(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java
- (Driver):
- [JBIDE-7864] replacing cloud type strings by Driver enum
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java
- (getInstanceJob):
- (waitWhilePending):
- (registerInstanceJob):
- [JBIDE-7912] removed since job concurrency is dealt with job scheduling rules now
- * src/org/jboss/tools/deltacloud/core/job/InstanceSchedulingRule.java (isConflicting):
- * src/org/jboss/tools/deltacloud/core/job/CloudSchedulingRule.java (isConflicting):
- * src/org/jboss/tools/deltacloud/core/job/CloudElementSchedulingRule.java (isConflicting):
- [JBIDE-7594] corrected scheduling rules to have correct blocking across the scheduling class hierarchy
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (createSecurePasswordStore):
- [JBIDE-7594] created #createSecurePasswordStore to be able to fake store in tests
-
-2010-12-14 André Dietisheim <adietish(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java (updateInstance):
- [JBIDE-7889] now also set pulic_adresses and private_adresses when updating instances
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (refreshInstance):
- [JBIDE-7889] removed code that replaced instances in the local cache.
- I now set a new instance to the DeltaCloudInstance (DeltaCloudInstance#setInstance)
- * src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java (setInstance):
- [JBIDE-7889] added #setInstance to be able to refresh instances
- * src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java (toString):
- [JBIDE-7889] added #toString to facilitate debuggin
- * src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java (getActions):
- [JBIDE-7889] changed #getActions to return DeltaCloudInstance#Action (and not strings)
- * src/org/jboss/tools/deltacloud/core/job/InstanceSchedulingRule.java:
- * src/org/jboss/tools/deltacloud/core/job/InstanceStateJob.java:
- * src/org/jboss/tools/deltacloud/core/job/InstanceActionJob.java:
- [JBIDE-7594] added instance related job & scheduling rule
- (blocks instance jobs on same instance and superclass jobs on same cloud & element)
- * src/org/jboss/tools/deltacloud/core/job/CloudElementSchedulingRule.java (isOnSameElement):
- [JBIDE-7594] corrected scheduling rule to block superclass scheduling rule on the same cloud
- * src/org/jboss/tools/deltacloud/core/job/AbstractCloudElementJob.java (CLOUDELEMENT):
- [JBIDE-7594] added scheduling element that reflects cloud properties being processed (instances, images, realms, profiles)
-
-2010-12-13 André Dietisheim <adietish(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java
- (loadInstances):
- (loadImages):
- [JBIDE-7880] clear images and clear instances before loading them.
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java
- (PROP_INSTANCES_ADDED):
- (createInstance):
- [JBIDE-7877] added notification for instances that are added
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java
- (IInstanceStateMatcher.matchesState):
- * src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java (State):
- (Action):
- (getState):
- (performInstanceAction):
- [JBIDE-7877] replaced state- and action-strings in DeltaCloudInstace by enums
-
-2010-12-10 André Dietisheim <adietish(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (loadImages):
- [JBIDE-7738] made #loadImages public, RefreshImagesHandler needs access to it
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (loadInstances):
- [JBIDE-7738] made #loadInstances public, RefreshInstancesHandler needs access to it
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (update):
- [JBIDE-7863] need to store the password if either connection name, username, pw or url changes
- * src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java (notifyCloudRename):
- [JBIDE-7856] removed notifyCloudRename since DeltaCloud now notifies about changes in its properties (images, instances, name)
- * src/org/jboss/tools/internal/deltacloud/core/observable/ObservablePojo.java:
- [JBIDE-7856] switched the observer pattern in DeltaCloud to PropertyChangeSupport, moved ObservablePojo
- to core to get PropertyChangeSupport in DeltaCloud.
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java:
- [JBIDE-7856] switched the observer pattern in DeltaCloud to PropertyChangeSupport, removed
- IInstanceListListener and IImageListlistener.
- (update):
- (setName):
+ (PROP_URL):
+ (PROP_USERNAME):
(updateConnectionProperties):
- (updateInstanceFilter):
- (updateImageFilter):
- (loadInstances):
- (clearImages):
- (clearInstances):
- (replaceInstance):
- (performInstanceAction):
- (loadImages):
- (createInstance):
- [JBIDE-7856] switched the observer pattern in DeltaCloud to PropertyChangeSupport, fireing changes when name is changed.
- Loading instances and images only if url, username, pw change.
-
-2010-12-09 André Dietisheim <adietish(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java
- (loadImages):
- (loadInstances):
- (getInstances):
- (getImages):
- [JBIDE-7848] separated the usecases: actively getting images/instances and passive updates. You now get the images and dont need to trigger getting and get the update of it.
- * src/org/jboss/tools/deltacloud/core/DeltaCloudImage.java:
- [JBIDE-7849] removed shadowing instance variable to DeltaCloud
-
-2010-12-08 André Dietisheim <adietish(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/job/AbstractCloudElementJob.java:
- * src/org/jboss/tools/deltacloud/core/job/AbstractCloudJob.java:
- * src/org/jboss/tools/deltacloud/core/job/CloudElementSchedulingRule.java:
- * src/org/jboss/tools/deltacloud/core/job/CloudSchedulingRule.java:
- [JBIDE-7594] started scheduling rules. need further refinement.
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (getImage):
- [JBIDE-7834] implemented #getLastImage(id) that queries the local cache and the server (fallback),
- removed #getImage(String id), #loadImage(String imageId), removed #findInstanceById
-
-2010-12-06 André Dietisheim <adietish(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/InstanceFilter.java (InstanceFilter):
- * src/org/jboss/tools/deltacloud/core/GetImagesCommand.java:
- * src/org/jboss/tools/deltacloud/core/AbstractDeltaCloudCommand.java:
- [JBIDE-7688][JBIDE-7813] now getting images and instances in async manner by commands
- * src/org/jboss/tools/deltacloud/core/AbstractCloudElementFilter.java
- (filter):
- (AbstractCloudElementFilter):
- (getCloud):
- (getCloudElements):
- * src/org/jboss/tools/deltacloud/core/AllImageFilter.java (AllImageFilter):
- * src/org/jboss/tools/deltacloud/core/ImageFilter.java
- (ImageFilter):
- (getCloudElements):
- * src/org/jboss/tools/deltacloud/core/AllInstanceFilter.java (AllInstanceFilter):
- * src/org/jboss/tools/deltacloud/core/InstanceFilter.java
- (InstanceFilter):
- (getCloudElements):
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java
- (createInstanceFilter):
- (createImageFilter):
- * src/org/jboss/tools/deltacloud/core/ICloudElementFilter.java (filter):
- [JBIDE-7688][JBIDE-7813] CloudElementFilter#filter is now cloud instance specific (is instantiated with a reference to a cloud)
-
-2010-12-03 André Dietisheim <adietish(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/AllImageFilter.java:
- * src/org/jboss/tools/deltacloud/core/AllInstanceFilter.java:
- * src/org/jboss/tools/deltacloud/core/ImageFilter.java:
- * src/org/jboss/tools/deltacloud/core/InstanceFilter.java:
- * src/org/jboss/tools/deltacloud/core/ICloudElementFilter.java:
- [JBIDE-7688] provide common superclass and interface to ImageFilter and InstanceFilter
- * src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java:
- * src/org/jboss/tools/deltacloud/core/DeltaCloudImage.java:
- * src/org/jboss/tools/deltacloud/core/AbstractDeltaCloudElement.java:
- * src/org/jboss/tools/deltacloud/core/IDeltaCloudElement.java:
- [JBIDE-7688] provide common superclass and interface to DeltaCloudImage and DeltaCloudInstance
-
-2010-11-26 André Dietisheim <adietish(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/SecurePasswordStore.java:
- * src/org/jboss/tools/deltacloud/core/DeltaCloudPasswordStorageKey.java:
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java:
- (editCloud):
- (getPassword):
- (createClient):
- (dispose):
- (loadImage):
- * src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java (removeCloud):
- [JBIDE-7731] extracted password storage to its own class (removed duplicate code in EditCloudConnectionWizard, NewCloudConnectionWizard and DeltaCloud)
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java:
- (loadImage):
- [JBIDE-7694] removed duplicate loadImage(id) / getImage(id) methods
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java
- (images):
- (instances)
- (getImages):
- (getInstances):
- (loadImages):
- (loadInstances):
- [JBIDE-7694] corrected lazy initialisation (to signal correctly that no instances had been loaded so far)
-
-2010-11-25 André Dietisheim <adietish(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java:
- * src/org/jboss/tools/deltacloud/core/DeltaCloudImagesRepository.java:
- * src/org/jboss/tools/deltacloud/core/DeltaCloudInstancesRepository.java:
- * src/org/jboss/tools/deltacloud/core/AbstractDeltaCloudObjectRepository.java:
- [JBIDE-7694] revamped synchronization in class DeltaCloud: extracted image- and instance-list to their own classes
- (and could drop all synchronization in deltacloud)
-
-2010-11-19 André Dietisheim <adietish(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java:
- (isRunning):
- [JBIDE-7678] renamed State to InstanceState, added property isRunning, testing for ShowInRemoteSystemExplorerHandler
- * src/org/jboss/tools/deltacloud/core/client/Instance.java (InstanceState):
- (isRunning):
- [JBIDE-7678] renamed State to InstanceState, added property isRunning, testing for ShowInRemoteSystemExplorerHandler
- * src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java (loadCloud):
- [JBIDE-7663] removed loading of images and instances on startup
-
-2010-11-18 André Dietisheim <adietish(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/ICloudManagerListener.java (cloudsChanged):
- [JBIDE-7628] renamed notification method (to better reflect what it notifies)
- * src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java (removeCloud):
- [JBIDE-7628] loadClouds made private -> no explicit loading by clients, clouds should be loaded if needed
- (saveClouds):
- (notifyCloudRename):
- [JBIDE-7628] added proper throwing (no swallowing any more)
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (DeltaCloud):
- [JBIDE-7628] cleanup (removed duplicate notification code)
- * src/org/jboss/tools/deltacloud/core/client/request/DeltaCloudRequest.java (getUrl):
- * src/org/jboss/tools/deltacloud/core/client/request/AbstractDeltaCloudRequest.java (getUrl):
- [JBIDE-7593] need to return URL (not String)
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java
- (addCredentials):
- [JBIDE-7593] need to use URL (not String)
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java
- (sendRequest):
- [JBIDE-7593] need to add credentials using the url that is effectively used in the request (which may be either the baseURL or the url in the action)
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (DeltaCloud):
- [JBIDE-7625] store password in the constructor
- (editCloud):
- [JBIDE-7625] have to create new client when cloud was edited
- * src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java (removeCloud):
- [JBIDE-7625] removed check for pw on identical url any more since we now save the pw with the name of the cloud
- [JBIDE-7627] reinitialize cloud list when loading clouds (otherwise clouds loaded will simply get added to the existing ones)
- (loadClouds):
-
-2010-11-17 André Dietisheim <adietish(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java
- (createInstance):
- (createKey):
- (deleteKey):
- [JBIDE-7597] added missing methods to interface
- * src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java
- (loadCloud):
- (loadClouds):
- [JBIDE-7597] continue loading clouds even if a single cloud fails
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java
- (loadImages):
- (loadInstances):
- [JBIDE-7597] added proper error messages to exceptions thrown
- (editCloud):
- (updateInstanceFilter):
- (updateImageFilter):
- [JBIDE-7597] removed saving (ring dependency DeltaCloud <--> DeltaCloudManager) in DeltaCloud.
- Ideal solution would be dirty notification to DeltaCloud -> DeltaCloudManager
- (getClient):
- [JBIDE-7597] delayed client creation after instantiation so that DeltaCloud may be created without throwing exceptions.
- (loadChildren):
- [JBIDE-7597] made sure loading instances and images throw exceptions individually. Collecting them in a multi exception
- (getProfiles):
- [JBIDE-7597] removed exception swalloing, made sure exceptions get thrown
- (testConnection):
- [JBIDE-7597] made sure no DeltaCloudClientException gets outside of DeltaCloud
- (destroyInstance):
- [JBIDE-7597] added exception to destroy instance
- (clearInstances):
- (clearImages):
- (loadInstances):
- (loadImages):
- (loadChildren):
- [JBIDE-7544] clearing images and instances before refreshing them (to avoid conflicting user actions)
-
-2010-11-16 André Dietisheim <adietish(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java (DeltaCloudManager):
- [JBIDE-7597] removed implicit loading of persisted connections. moved to explicit loading.
- (loadClouds):
- [JBIDE-7597] collecting exceptions are returning them as errors.
- * src/org/jboss/tools/deltacloud/core/client/Image.java:
- * src/org/jboss/tools/deltacloud/core/DeltaCloudImage.java:
- * src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java
- * src/org/jboss/tools/deltacloud/core/client/Instance.java
- [JBIDE-7617] removed equals and hash code since it resulted in odd behaviors towards selection
- * src/org/jboss/tools/deltacloud/core/client/Instance.java
- (canStart):
- (canStop):
- (canReboot):
- (canDestroy):
- * src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java
- (canStart):
- (canStop):
- (canReboot):
- (canDestroy):
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java
- (registerInstanceJob):
- (getInstanceJob):
- (registerInstanceJob):
- (removeInstanceJob):
- [JBIDE-7603] renamed instance job related methods from action job to instance job (since jobs are not only used for actions)
- (waitWhilePending):
- (waitForState):
- [JBIDE-7603] moved (duplicate) instance state waiting code to delta cloud and removed duplication
- (loadChildren):
- (loadInstances):
- (getCurrInstances):
- (refreshInstance):
- [JBIDE-7597] load images / instances now throw of DeltaCloudExceptions (exceptions are not swallowed any longer)
-
-2010-11-11 André Dietisheim <adietish(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java (DeltaCloudInstance):
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (refreshInstance):
- (loadInstances):
- (createInstance):
- [JBIDE-7516] added reference to DeltaCloud in DeltaCloudInstance
-
-2010-11-10 André Dietisheim <adietish(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/client/utils/UrlBuilder.java:
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java (DeltaCloudClientImpl):
- (sendRequest):
- (createRequest):
- (getServerType):
- (createInstance):
- (createInstance):
- (createInstance):
- (createInstance):
- (listProfile):
- (listProfiles):
- (listImages):
- (listImages):
- (listInstances):
- (listInstances):
- (listRealms):
- (listRealms):
- (createKey):
- (createInstanceActions):
- (listDeltaCloudObjects):
- (getDocument):
- (performInstanceAction):
- * src/org/jboss/tools/deltacloud/core/client/request/TypeRequest.java:
- * src/org/jboss/tools/deltacloud/core/client/request/PerformInstanceActionRequest.java:
- * src/org/jboss/tools/deltacloud/core/client/request/ListRealmsRequest.java:
- * src/org/jboss/tools/deltacloud/core/client/request/ListRealmRequest.java:
- * src/org/jboss/tools/deltacloud/core/client/request/ListKeyRequest.java:
- * src/org/jboss/tools/deltacloud/core/client/request/ListInstancesRequest.java:
- * src/org/jboss/tools/deltacloud/core/client/request/ListInstanceRequest.java:
- * src/org/jboss/tools/deltacloud/core/client/request/ListImagesRequest.java:
- * src/org/jboss/tools/deltacloud/core/client/request/ListImageRequest.java:
- * src/org/jboss/tools/deltacloud/core/client/request/ListHardwareProfilesRequest.java:
- * src/org/jboss/tools/deltacloud/core/client/request/ListHardwareProfileRequest.java:
- * src/org/jboss/tools/deltacloud/core/client/request/DeltaCloudRequest.java:
- * src/org/jboss/tools/deltacloud/core/client/request/DeleteKeyRequest.java:
- * src/org/jboss/tools/deltacloud/core/client/request/CreateInstanceRequest.java:
- * src/org/jboss/tools/deltacloud/core/client/request/AbstractListObjectsRequest.java:
- * src/org/jboss/tools/deltacloud/core/client/request/AbstractDeltaCloudRequest.java:
- [JBIDE-7537] Created classes for each request type.
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java (createInstanceActions):
- [JBIDE-7537] removed base url stripping
-
-2010-11-09 André Dietisheim <adietish(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/client/Instance.java
- (hashCode):
- (equals):
- [JBIDE-7513] added equals and hascode methods to be able to match new instances to old ones
- (so that I can keep the selection in the cloud viewer)
- * src/org/jboss/tools/deltacloud/core/client/Image.java
- (hashCode):
- (equals):
- [JBIDE-7513] added equals and hascode methods to be able to match new instances to old ones
- (so that I can keep the selection in the cloud viewer)
- * src/org/jboss/tools/deltacloud/core/ImageFilter.java (setRules):
- * src/org/jboss/tools/deltacloud/core/InstanceFilter.java
- (setRules):
- (createRule):
- [JBIDE-7518] removed duplicate code for matcher creation
- (createRule):
- (setRules):
- [JBIDE-7518] removed duplicate code for matcher creation
- * src/org/jboss/tools/deltacloud/core/ICloudElementFilter.java:
- * src/org/jboss/tools/deltacloud/core/IImageFilter.java:
- * src/org/jboss/tools/deltacloud/core/IInstanceFilter.java
-
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (editCloud):
- [JBIDE-7521] storing cloud after it has been edited
- (editCloud):
- [JBIDE-7518] added notification after cloud was edited
- (DeltaCloud):
- (createImageFilter):
- (updateImageFilter):
- (createInstanceFilter):
- (updateInstanceFilter):
- [JBIDE-7518] cleanup code duplication (imageFilter and instanceFilter creation)
- (editCloud):
- [JBIDE-7518] load images and instances after editing the cloud -> notifies listeners of changes
-
-2010-11-05 André Dietisheim <adietish(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (performInstanceAction):
- [JBIDE-7503] added instance notification
-
-2010-11-04 André Dietisheim <adietish(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java:
- * src/org/jboss/tools/deltacloud/core/client/InstanceAction.java:
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java:
- * src/org/jboss/tools/deltacloud/core/client/Instance.java (start), (stop), (destroy), (reboot):
- [JBIDE-7484] removed instance related methods from client, unified funtionality in #performAction and offered additional methods on
- Instance (#start, #stop, #destroy, #reboot). Furthermore update instance upon action responses from server.
-
-2010-10-29 André Dietisheim <adietish(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/client/HttpStatusCode.java: extracted and put in a 2 enums:
- HttpStatusCode, HttpStatusRange (server-, client-error)
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java
- (listDeltaCloudObjects): rethrows DeltaCloudClientException (was catching and wrapping)
- (getDocument): refactored and split #listDeltaCloudObjects implementation into parts
-
-2010-10-26 André Dietisheim <adietish(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (testConnection):
- [JBIDE-7407] now returns <code>false</code> if listing instances fails with a DeltaCloudClientException
-
-2010-10-25 Jeff Johnston <jjohnstn(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java: Move cloud type constants
- here as the DeltaCloud contains the type field.
- * src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java: Move cloud type constants
- from here to DeltaCloud.
-
-2010-10-25 Jeff Johnston <jjohnstn(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (DeltaCloud): Fix constructor
- typo caused by copying so that type is passed when it is offered.
-
-2010-10-22 Jeff Johnston <jjohnstn(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (DeltaCloud): Don't add
- "api" to URL in constructor as the client is adding this as well.
-
-2010-10-22 André Dietisheim <adietish(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java
- (shutdownInstance): [JBIDE-7401] changed to POST (api break in dc 0.0.8)
- (startInstance): [JBIDE-7401] changed to POST (api break in dc 0.0.8)
-
-2010-10-22 Jeff Johnston <jjohnstn(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java (listProfile): Fix to
- wrap the xml result in a StringReader before trying to unmarshal.
- (listImages): Ditto.
- (listRealms): Ditto.
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (getLastImageId): New method.
- (setLastImageId): Ditto.
- (getLastKeyname): Ditto.
- (setLastKeyname): Ditto.
- (getImage): Ditto.
- (save): Make public.
- * src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java (loadClouds): Add code to get
- the last keyname and last imageid used for the cloud.
- (saveClouds): Save the last keyname and last imageid used for instance launching.
-
-2010-10-21 André Dietisheim <adietish(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java
- (getRequest): extracted to its own method, changed to switch (from if-else)
- (sendRequest): added http status code check (latest deltacloud 0.0.8 now reports 404 on missing resource)
-
-2010-10-20 André Dietisheim <adietish(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java (getDeltaCloudType): moved from UI to deltacloud client
- (DCNS): Added API enum (for api requests)
- (getServerType): moved to instance method, reuse existing client code (instead of duplication)
-
-2010-10-12 Jeff Johnston <jjohnstn(a)redhat.com>
-
- * build.properties: Remove lib/deltacloudclient jar specification as it
- no longer exists in the lib directory.
-
-2010-10-08 Jeff Johnston <jjohnstn(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/AllInstanceFilter.java: New file.
- * src/org/jboss/tools/deltacloud/core/IInstanceFilter.java: New file.
- * src/org/jboss/tools/deltacloud/core/InstanceFilter.java: New file.
- * src/org/jboss/tools/deltacloud/core/AllFieldMatcher.java (toString): Switch back
- to non-regex, just a wildcard.
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (DeltaCloud): Add instance
- filter rules to constructor.
- (getInstanceFilter): New method.
- (createInstanceFilter): Ditto.
- * src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java (loadClouds): Add instance
- filter support.
- (saveClouds): Ditto.
- * src/org/jboss/tools/deltacloud/core/FieldMatcher.java (FieldMatcher): Use the input
- string to form a regex where all non-alphanumeric characters are escaped and wildcards
- are expanded to a reluctant any character matcher.
- (transform): New method to transform the input rule into a regex.
- * src/org/jboss/tools/deltacloud/core/IImageFilter.java: Fix ALL_STRING.
- * src/org/jboss/tools/deltacloud/core/ImageFilter.java (setRules): Fix checking for
- AllFieldMatchers.
-
-2010-10-07 Jeff Johnston <jjohnstn(a)redhat.com>
-
- [JBIDE-7181]
- * src/org/jboss/tools/deltacloud/core/AllFieldMatcher.java (toString): Fix to
- return proper regex for ALL text.
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (DeltaCloud): Default to
- ALL rules if image filter regex does not parse.
- * src/org/jboss/tools/deltacloud/core/FieldMatcher.java (FieldMatcher): Add a
- throws statement.
- * src/org/jboss/tools/deltacloud/core/IImageFilter.java: Fix ALL string.
- * src/org/jboss/tools/deltacloud/core/ImageFilter.java (setRules): Adds a
- throws statement.
-
-2010-10-07 André Dietisheim <adietish(a)redhat.com>
-
- * lib/deltacloudclient-1.0.jar: [JBIDE-7259] removed unneeded jar from classpath
-
-2010-10-06 Jeff Johnston <jjohnstn(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/AllFieldMatcher.java: New file.
- * src/org/jboss/tools/deltacloud/core/AllImageFilter.java: New file.
- * src/org/jboss/tools/deltacloud/core/FieldMatcher.java: New file.
- * src/org/jboss/tools/deltacloud/core/IFieldMatcher.java: New file.
- * src/org/jboss/tools/deltacloud/core/IImageFilter.java: New file.
- * src/org/jboss/tools/deltacloud/core/ImageFilter.java: New file.
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (save): New method.
- (createImageFilter): Ditto.
- (getImageFilter): Ditto.
- (DeltaCloud): Add a image filter rules parameter.
- * src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java (loadClouds): Add
- check for image filtering rules.
- (saveClouds): Save image filtering rules.
-
-2010-09-17 Jeff Johnston <jjohnstn(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (editCloud): New method.
- * src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java (notifyCloudRename): Ditto.
- * src/org/jboss/tools/deltacloud/core/ICloudManagerListener.java: Add rename event.
-
-2010-09-08 Jeff Johnston <jjohnstn(a)redhat.com>
-
- * .classpath: Fix to remove error messages.
- * META-INF/MANIFEST.MF: Move deltaclient.jar to end of dependencies.
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (getActionJob): New method.
- (registerActionJob): Ditto.
- (removeActionJob): Ditto.
- * src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java (removeCloud): Use cached
- username and url.
-
-2010-09-03 Jeff Johnston <jjohnstn(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (addReplaceInstance): New method.
-
-2010-09-01 Jeff Johnston <jjohnstn(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java (deleteKey): Change
- arguments to just the key name is given. Don't delete any file.
- (createKey): Change the directory argument to just be a String instead of an IPath.
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (deleteKey): New method.
- (createKey): Ditto.
- (refreshInstance): Remove stack trace on error since a pending cloud start will
- result in not found until the cloud actually is running.
-
-2010-08-30 Jeff Johnston <jjohnstn(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/Activator.java: Add Copyright and License info.
- * src/org/jboss/tools/deltacloud/core/client/AddressList.java: Ditto.
- * src/org/jboss/tools/deltacloud/core/client/API.java: Ditto.
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudAuthException.java: Ditto.
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java: Ditto.
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientException.java: Ditto.
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudObject.java: Ditto.
- * src/org/jboss/tools/deltacloud/core/client/HardwareProfile.java: Ditto.
- * src/org/jboss/tools/deltacloud/core/client/Image.java: Ditto.
- * src/org/jboss/tools/deltacloud/core/client/Instance.java: Ditto.
- * src/org/jboss/tools/deltacloud/core/client/Property.java: Ditto.
- * src/org/jboss/tools/deltacloud/core/client/Realm.java: Ditto.
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java: Ditto.
- * src/org/jboss/tools/deltacloud/core/DeltaCloudException.java: Ditto.
- * src/org/jboss/tools/deltacloud/core/DeltaCloudHardwareProfile.java: Ditto.
- * src/org/jboss/tools/deltacloud/core/DeltaCloudHardwareProperty.java: Ditto.
- * src/org/jboss/tools/deltacloud/core/DeltaCloudImage.java: Ditto.
- * src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java: Ditto.
- * src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java: Ditto.
- * src/org/jboss/tools/deltacloud/core/DeltaCloudRealm.java: Ditto.
- * src/org/jboss/tools/deltacloud/core/ICloudManagerListener.java: Ditto.
- * src/org/jboss/tools/deltacloud/core/IImageListListener.java: Ditto.
- * src/org/jboss/tools/deltacloud/core/IInstanceListListener.java: Ditto.
- * META-INF/MANIFEST.MF: Back-leveling to 0.0.1 as not in 1.0.0 state yet.
-
-2010-08-27 Jeff Johnston <jjohnstn(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java (buildInstance): Add
- call to getAuthentication method.
- (getAuthentication): New method to get authentication items such as keyname.
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (getCurrInstances): Synchronize on
- new instanceLock object.
- (getInstances): Ditto.
- (performInstanceAction): Do not do any special actions for EC2 clouds, namely
- deleting a key if stopping.
- (refreshInstance): Do not reset the key.
- (createInstance): Do not look for EC2 type, do not create a key, but just check if a keyname is specified.
- Do not save the key if specified as this is done when creating the instance.
- * src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java: Add MOCK type.
-
-2010-08-26 Jeff Johnston <jjohnstn(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java (createKey): Remove
- any empty lines so the key will work with RSE.
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (notifyImageListListeners): Pass new
- cloud argument to listeners.
- (notifyInstanceListListeners): Ditto.
- (refreshInstance): Fix the check for states to be in the String realm rather than
- the State realm.
- * src/org/jboss/tools/deltacloud/core/IImageListListener.java: Add new cloud argument
- to listChanged notifier method.
- * src/org/jboss/tools/deltacloud/core/IInstanceListListener.java: Ditto.
-
-2010-08-23 Jeff Johnston <jjohnstn(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/client/Instance.java (getKey): New method.
- (setKey): Ditto.
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (getCurrInstances): Fix to
- call getInstances if there aren't any instances yet.
- (getCurrImages): New method.
- (refreshInstance): Pass any instance key into the new instance.
- (getImages): Synchronize on imageLock.
- (loadChildren): New method that loads the children in a thread.
- (createInstance): Save the key if generated into the instance.
- * src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java (getKey): New method.
- * src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java (loadClouds): Ditto.
-
-2010-08-20 Jeff Johnston <jjohnstn(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java (DCNS): Add KEYS.
- (deleteKey): New method to delete a keypair.
- (createKey): New method to create a keypair.
- (checkForErrors): Add extra check for status 404.
- (createInstance): New method with additional keyname parameter to create instance using a
- specified keypair.
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (getType): New method.
- (DeltaCloud): Add type parameter and add keys collection.
- (performInstanceAction): Add check for EC2 STOP action in which case look for a key in the key
- collection and if found, delete it.
- (createInstance): If EC2 cloud, create a key and pass the name to the new client createInstance
- API that takes a keypair name.
- * src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java (setGivenName): New method to store
- the name chosen by the user in the dialog.
- (getGivenName): New method to get the name chosen by the user in the dialog.
- * src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java (loadClouds): Add type support.
- (saveClouds): Ditto.
-
-2010-08-18 Jeff Johnston <jjohnstn(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java (checkForErrors): Make
- the code smarter and look for status node. There are some internal errors that don't need
- to be stopped for.
- (buildInstance): Throw DeltaCloudClientException instead of returning null if an
- unexpected type of Exception occurs.
- * src/org/jboss/tools/deltacloud/core/client/Instance.java (setState): Set to BOGUS
- if the state is not expected.
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (performInstanceAction): Throw
- a DeltaCloudException if an low-level exception occurs.
- (refreshInstance): Ignore a transition to a BOGUS state.
- * src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java: Add new TERMINATED and
- BOGUS state strings.
-
-2010-08-17 Jeff Johnston <jjohnstn(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java (getOwnerId): New method.
-
-2010-08-17 Jeff Johnston <jjohnstn(a)redhat.com>
-
- * lib/log4j-1.2.14.jar: New file.
- * .classpath: Add log4j jar.
- * build.properties: Ditto.
- * META-INF/MANIFEST.MF: Remove org.apache.log4j as dependency
- and add stored jar to classpath.
-
-2010-08-17 Jeff Johnston <jjohnstn(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java (createInstance): New
- API that takes a memory and storage setting for the hardware profile.
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (createInstance): Change API to
- accept memory and storage settings.
-
-2010-08-16 Jeff Johnston <jjohnstn(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java (buildHardwareProfile): Remove
- extraneous statements that cause unused warning.
- * src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java: Remove extraneous import
- that causes warning.
-
-2010-08-16 Jeff Johnston <jjohnstn(a)redhat.com>
-
- * META-INF/MANIFEST.MF: Add dependency on org.eclipse.equinox.security.
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (DeltaCloud): Store
- the password for the cloud using Secure Preferences using the cloud's url
- and username to form the key.
- (getPreferencesKey): New static method to formulate a preferences key used
- to store and retrieve a password for a cloud.
- * src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java (loadClouds):
- New method to get persisted clouds.
- (getClouds): Remove test stuff that creates a sample connection to the
- mock cloud.
- (saveClouds): New method to persist clouds minus passwords.
- (DeltaCloudManager): Add call to loadClouds at construction.
- (addCloud): Call saveClouds after modifying list.
- (removeCloud): Ditto.
-
-2010-08-13 Jeff Johnston <jjohnstn(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (DeltaCloud): Take the
- url as a String input. Create the URL when constructing the client and add
- "/api" to the user-specified url.
- (getURL): Return the url directly.
-
-2010-08-12 Jeff Johnston <jjohnstn(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java (destroyInstance): Fix to use
- DELETE request.
- (sendRequest): Fix to allow DELETE request.
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (destroyInstance): New method.
-
-2010-08-11 Jeff Johnston <jjohnstn(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java (performInstanceAction): New method.
- * src/org/jboss/tools/deltacloud/core/client/Instance.java (getActionNames): Ditto.
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (getCurrInstances): Ditto.
- (performInstanceAction): Ditto.
- (refreshInstance): Add notification.
- * src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java (getActions): New method.
-
-2010-08-11 Jeff Johnston <jjohnstn(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (getInstances): Make
- instances a private field instead of local to the method.
- (refreshInstance): New method.
- (createInstance): Add notification to IInstanceListListeners.
- * src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java: Add static
- strings for the various states.
-
-2010-08-09 Jeff Johnston <jjohnstn(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java (getHostName): New method.
-
-2010-08-06 Jeff Johnston <jjohnstn(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java (sendRequest): Add
- exception handling.
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (createInstance): New method.
- * src/org/jboss/tools/deltacloud/core/DeltaCloudRealm.java: Add state constants.
-
-2010-08-05 Jeff Johnston <jjohnstn(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/DeltaCloudHardwareProperty.java (getKind): Fix to
- upper-case the low-level value before converting to an enum.
-
-2010-08-04 Jeff Johnston <jjohnstn(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/DeltaCloudHardwareProfile.java: New file.
- * src/org/jboss/tools/deltacloud/core/DeltaCloudHardwareProperty.java: New file.
- * src/org/jboss/tools/deltacloud/core/client/HardwareProfile.java (getArchitecture): Return
- the value instead of using toString method.
- (getNamedProperty): Verify that properties is not null before accessing.
- (getCPU): Return value instead of using toString.
- * src/org/jboss/tools/deltacloud/core/client/Property.java (Range.Range): New class.
- (getRange): New method.
- (Range.getLast): Ditto.
- (Range.getFirst): Ditto.
- (getEnums): Ditto.
- (toString): Fix to not include unit if it is "label".
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (getProfiles): New method.
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java (buildHardwareProfile): Fix
- bug with getting enum properties.
-
-2010-08-04 Jeff Johnston <jjohnstn(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudAuthException.java: New file.
- * src/org/jboss/tools/deltacloud/core/DeltaCloudException.java: New file.
- * src/org/jboss/tools/deltacloud/core/DeltaCloudRealm.java: New file.
- * src/org/jboss/tools/deltacloud/core/Activator.java (logErrorMessage): Ditto.
- (log): Ditto.
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java (listDeltaCloudObjects):
- Check for errors.
- (checkForErrors): New method to check for connection errors.
- (buildHardwareProfile): Check for errors and change so method throws exceptions.
- (buildInstance): Ditto.
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (getInstances): Log error instead of
- printing stack trace.
- (getImages): Ditto.
- (getRealms): New method.
- (testConnection): Ditto.
-
-2010-08-03 Jeff Johnston <jjohnstn(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java (getClouds): Remove default
- cloud connection that was set up for testing.
-
-2010-07-29 Jeff Johnston <jjohnstn(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java (buildHardwareProfile): XML
- has changed element name to hardware_profile from hardware-profile.
- (buildInstance): Ditto.
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudObject.java (getId): Denote as
- XMLAttribute now that id is no longer an element.
- * src/org/jboss/tools/deltacloud/core/client/Instance.java (publicAddresses): Change
- XML element name to public_addresses from public-addresses.
- (privateAddresses): Similar except for private-addresses to private_addresses.
-
-2010-07-28 Jeff Johnston <jjohnstn(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java (findCloud): New
- method to find a cloud by name.
-
-2010-07-27 Jeff Johnston <jjohnstn(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/client/Property.java: New file.
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java (getProfileProperties): Renamed
- from setProfileProperties and cpu support added.
- (buildDeltaCloudObject): Add support for HardwareProfile.
- (buildHardwareProfile): New method to build up a hardware profile.
- (buildInstance): Add hardware profile support.
- (createInstance): Change to use getProfileProperties which was renamed.
- * src/org/jboss/tools/deltacloud/core/client/HardwareProfile.java (getArchitecture): New method.
- (getNamedProperty): Ditto.
- (getCPU): Ditto.
- (toString): Ditto.
- (getProperties): Ditto.
- (getMemory): Change to get the memory property.
- (getStorage): Change to get the storage property.
- (HardwareProfile): Make private.
- * src/org/jboss/tools/deltacloud/core/client/Instance.java (setCPU): New method.
- (getCPU): Ditto.
- (toString): Add cpu support.
-
-2010-07-26 Jeff Johnston <jjohnstn(a)redhat.com>
-
- * src/org/jboss/tools/deltacloud/core/client/AddressList.java: New file.
- * src/org/jboss/tools/deltacloud/core/client/API.java: New file.
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java: New file.
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientException.java: New file.
- * src/org/jboss/tools/deltacloud/core/client/DeltaCloudObject.java: New file.
- * src/org/jboss/tools/deltacloud/core/client/HardwareProfile.java: New file.
- * src/org/jboss/tools/deltacloud/core/client/Image.java: New file.
- * src/org/jboss/tools/deltacloud/core/client/Instance.java: New file.
- * src/org/jboss/tools/deltacloud/core/client/Realm.java: New file.
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java: Import classes from new
- client package.
- * src/org/jboss/tools/deltacloud/core/DeltaCloudImage.java: Ditto.
- * src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java (getProfileId): New
- method.
-
-2010-07-23 Jeff Johnston <jjohnstn(a)redhat.com>
-
- * .classpath: New file.
- * .project: New file.
- * .settings/org.eclipse.jdt.core.prefs: New file.
- * .settings/org.eclipse.pde.core.prefs: New file.
- * build.properties: New file.
- * lib/apache-mime4j-0.6.jar: New file.
- * lib/commons-codec-1.3.jar: New file.
- * lib/commons-logging-1.1.1.jar: New file.
- * lib/deltacloudclient-1.0.jar: New file.
- * lib/httpclient-4.0.1.jar: New file.
- * lib/httpcore-4.0.1.jar: New file.
- * lib/httpcore-nio-4.0.1.jar: New file.
- * lib/httpmime-4.0.1.jar: New file.
- * META-INF/MANIFEST.MF: New file.
- * src/org/jboss/tools/deltacloud/core/Activator.java: New file.
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java: New file.
- * src/org/jboss/tools/deltacloud/core/DeltaCloudImage.java: New file.
- * src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java: New file.
- * src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java: New file.
- * src/org/jboss/tools/deltacloud/core/ICloudManagerListener.java: New file.
- * src/org/jboss/tools/deltacloud/core/IImageListListener.java: New file.
- * src/org/jboss/tools/deltacloud/core/IInstanceListListener.java: New file.d/core/observable/ObservablePojo.java (addPropertyChangeListener):
+ * src/org/jboss/tools/internal/deltacloud/core/observable/ObservablePojo.java (addPropertyChangeListener):
[JBIDE-7523] added change notification for username and url
2011-01-11 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
@@ -990,7 +23,7 @@
* src/org/jboss/tools/deltacloud/core/client/request/TypeRequest.java:
* src/org/jboss/tools/deltacloud/core/client/request/PerformInstanceActionRequest.java:
* src/org/jboss/tools/deltacloud/core/client/request/ListRealmsRequest.java:
- * src/org/bosstools/branches/3.2.heliosjboss/tools/deltacloud/core/client/request/ListRealmRequest.java:
+ * src/org/jboss/tools/deltacloud/core/client/request/ListRealmRequest.java:
* src/org/jboss/tools/deltacloud/core/client/request/ListKeysRequest.java:
* src/org/jboss/tools/deltacloud/core/client/request/ListKeyRequest.java:
* src/org/jboss/tools/deltacloud/core/client/request/ListInstancesRequest.java:
Modified: branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/internal/deltacloud/core/observable/ObservablePojo.java
===================================================================
--- branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/internal/deltacloud/core/observable/ObservablePojo.java 2011-03-23 10:22:28 UTC (rev 29973)
+++ branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/internal/deltacloud/core/observable/ObservablePojo.java 2011-03-23 10:24:45 UTC (rev 29974)
@@ -34,11 +34,15 @@
}
public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
- propertyChangeSupport.addPropertyChangeListener(propertyName, listener);
+ if (!contains(listener)) {
+ propertyChangeSupport.addPropertyChangeListener(propertyName, listener);
+ }
}
public void addPropertyChangeListener(PropertyChangeListener listener) {
- propertyChangeSupport.addPropertyChangeListener(listener);
+ if (!contains(listener)) {
+ propertyChangeSupport.addPropertyChangeListener(listener);
+ }
}
public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
@@ -50,6 +54,17 @@
propertyChangeSupport.removePropertyChangeListener(listener);
}
+ protected boolean contains(PropertyChangeListener listener) {
+ boolean contains = false;
+ for (PropertyChangeListener registeredListener : propertyChangeSupport.getPropertyChangeListeners()) {
+ if (registeredListener == listener) {
+ contains = true;
+ break;
+ }
+ }
+ return contains;
+ }
+
protected PropertyChangeSupport getPropertyChangeSupport() {
return propertyChangeSupport;
}
Modified: branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java
===================================================================
--- branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java 2011-03-23 10:22:28 UTC (rev 29973)
+++ branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java 2011-03-23 10:24:45 UTC (rev 29974)
@@ -431,7 +431,7 @@
protected void addPropertyChangeListener(DeltaCloud cloud) {
if (cloud != null) {
- cloud.addPropertyChangeListener(DeltaCloud.PROP_NAME, this);
+ cloud.addPropertyChangeListener(this);
}
}
@@ -469,6 +469,7 @@
@Override
public void dispose() {
+ removePropertyChangeListener(currentCloud);
getSite().getWorkbenchWindow().getSelectionService().removePostSelectionListener(workbenchSelectionListener);
DeltaCloudManager.getDefault().removeCloudManagerListener(this);
super.dispose();
Modified: branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ImageView.java
===================================================================
--- branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ImageView.java 2011-03-23 10:22:28 UTC (rev 29973)
+++ branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ImageView.java 2011-03-23 10:24:45 UTC (rev 29974)
@@ -10,8 +10,6 @@
*******************************************************************************/
package org.jboss.tools.deltacloud.ui.views.cloudelements;
-import java.beans.PropertyChangeEvent;
-
import org.jboss.tools.deltacloud.core.DeltaCloud;
import org.jboss.tools.deltacloud.core.DeltaCloudImage;
import org.jboss.tools.deltacloud.core.ICloudElementFilter;
@@ -48,14 +46,6 @@
}
@Override
- public void propertyChange(PropertyChangeEvent event) {
- super.propertyChange(event);
- if (DeltaCloud.PROP_IMAGES.equals(event.getPropertyName())) {
- updateFilteredLabel();
- }
- }
-
- @Override
protected ICloudElementFilter<DeltaCloudImage> getFilter(DeltaCloud cloud) {
return cloud.getImageFilter();
}
Modified: branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/InstanceView.java
===================================================================
--- branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/InstanceView.java 2011-03-23 10:22:28 UTC (rev 29973)
+++ branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/InstanceView.java 2011-03-23 10:24:45 UTC (rev 29974)
@@ -52,14 +52,6 @@
evaluationService.requestEvaluation("org.jboss.tools.deltacloud.ui.commands.canReboot");
evaluationService.requestEvaluation("org.jboss.tools.deltacloud.ui.commands.canDestroy");
}
-
- @Override
- protected void addPropertyChangeListener(DeltaCloud cloud) {
- if (cloud != null) {
- super.addPropertyChangeListener(cloud);
- cloud.addPropertyChangeListener(DeltaCloud.PROP_INSTANCES, this);
- }
- }
@Override
public void propertyChange(PropertyChangeEvent event) {
@@ -73,5 +65,4 @@
protected ICloudElementFilter<DeltaCloudInstance> getFilter(DeltaCloud cloud) {
return cloud.getInstanceFilter();
}
-
}
13 years, 9 months
JBoss Tools SVN: r29973 - in branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui: src/org/jboss/tools/internal/deltacloud/ui/wizards and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-03-23 06:22:28 -0400 (Wed, 23 Mar 2011)
New Revision: 29973
Modified:
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/EditCloudConnectionWizard.java
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnectionWizard.java
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.properties
Log:
[JBIDE-8148] editing and creating clouds in background jobs now
Modified: branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
===================================================================
--- branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2011-03-23 10:17:11 UTC (rev 29972)
+++ branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2011-03-23 10:22:28 UTC (rev 29973)
@@ -1,3 +1,10 @@
+2011-03-23 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
+
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.properties:
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnectionWizard.java (createCloud):
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/EditCloudConnectionWizard.java (editCloud):
+ [JBIDE-8148] editing and creating clouds in background jobs now
+
2011-03-22 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
* src/org/jboss/tools/deltacloud/ui/views/Columns.java:
Modified: branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/EditCloudConnectionWizard.java
===================================================================
--- branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/EditCloudConnectionWizard.java 2011-03-23 10:17:11 UTC (rev 29972)
+++ branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/EditCloudConnectionWizard.java 2011-03-23 10:22:28 UTC (rev 29973)
@@ -10,13 +10,16 @@
*******************************************************************************/
package org.jboss.tools.internal.deltacloud.ui.wizards;
-import java.text.MessageFormat;
-
+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.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IWorkbench;
import org.jboss.tools.deltacloud.core.DeltaCloud;
import org.jboss.tools.deltacloud.core.Driver;
-import org.jboss.tools.deltacloud.ui.ErrorUtils;
+import org.jboss.tools.deltacloud.core.job.AbstractCloudJob;
+import org.jboss.tools.internal.deltacloud.ui.utils.WizardUtils;
/**
* @author Jeff Johnston
@@ -42,14 +45,25 @@
String username = mainPage.getModel().getUsername();
String password = mainPage.getModel().getPassword();
Driver driver = mainPage.getModel().getDriver();
+ return editCloud(initialCloud, name, url, username, password, driver);
+ }
+
+ private boolean editCloud(final DeltaCloud cloud, final String name, final String url, final String username,
+ final String password, final Driver driver) {
try {
- initialCloud.update(name, url, username, password, driver);
+ Job job = new AbstractCloudJob(WizardMessages.getFormattedString("EditCloudConnection.message", cloud.getName()), cloud) {
+
+ @Override
+ protected IStatus doRun(IProgressMonitor monitor) throws Exception {
+ initialCloud.update(name, url, username, password, driver);
+ return Status.OK_STATUS;
+ }
+ };
+ WizardUtils.runInWizard(job, getContainer());
+ return job.getResult() != null && job.getResult().getCode() != IStatus.ERROR;
} catch (Exception e) {
- // TODO internationalize strings
- ErrorUtils.handleError("Error",
- MessageFormat.format("Could not edit cloud \"{0}\"", initialCloud.getName()),
- e, getShell());
+ return false;
}
- return true;
}
+
}
Modified: branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnectionWizard.java
===================================================================
--- branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnectionWizard.java 2011-03-23 10:17:11 UTC (rev 29972)
+++ branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnectionWizard.java 2011-03-23 10:22:28 UTC (rev 29973)
@@ -10,12 +10,15 @@
*******************************************************************************/
package org.jboss.tools.internal.deltacloud.ui.wizards;
-import java.text.MessageFormat;
-
+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.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
+import org.jboss.tools.common.log.StatusFactory;
import org.jboss.tools.deltacloud.core.DeltaCloud;
import org.jboss.tools.deltacloud.core.DeltaCloudException;
import org.jboss.tools.deltacloud.core.DeltaCloudManager;
@@ -24,6 +27,7 @@
import org.jboss.tools.deltacloud.ui.ErrorUtils;
import org.jboss.tools.internal.deltacloud.ui.preferences.IPreferenceKeys;
import org.jboss.tools.internal.deltacloud.ui.preferences.StringPreferenceValue;
+import org.jboss.tools.internal.deltacloud.ui.utils.WizardUtils;
/**
* @author Jeff Johnston
@@ -114,14 +118,32 @@
String password = mainPage.getModel().getPassword();
Driver driver = mainPage.getModel().getDriver();
+ return createCloud(name, url, username, password, driver);
+ }
+
+ private boolean createCloud(final String name, final String url, final String username, final String password,
+ final Driver driver) {
+ Job job = new Job(WizardMessages.getFormattedString("CloudConnection.msg", name)) {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ DeltaCloud newCloud = new DeltaCloud(name, url, username, password, driver);
+ DeltaCloudManager.getDefault().addCloud(newCloud);
+ return Status.OK_STATUS;
+ } catch (Exception e) {
+ // TODO internationalize strings
+ return StatusFactory.getInstance(IStatus.ERROR, Activator.PLUGIN_ID,
+ WizardMessages.getFormattedString("CloudConnectionError.msg", name), e);
+ }
+ }
+
+ };
try {
- DeltaCloud newCloud = new DeltaCloud(name, url, username, password, driver);
- DeltaCloudManager.getDefault().addCloud(newCloud);
+ WizardUtils.runInWizard(job, getContainer());
+ return job.getResult() != null && job.getResult().getCode() != IStatus.ERROR;
} catch (Exception e) {
- // TODO internationalize strings
- ErrorUtils
- .handleError("Error", MessageFormat.format("Could not create cloud {0}", name), e, getShell());
+ return false;
}
- return true;
}
}
Modified: branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.properties
===================================================================
--- branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.properties 2011-03-23 10:17:11 UTC (rev 29972)
+++ branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.properties 2011-03-23 10:22:28 UTC (rev 29973)
@@ -11,6 +11,8 @@
CloudConnection.desc=Specify connection details for a cloud you wish to access
CloudConnection.title=Cloud Connection
CloudConnection.name=Cloud Connection
+CloudConnection.msg=Create cloud {0}
+CloudConnectionError.msg=Could not create cloud {0}
CloudConnectionTestSuccess.msg=Connection Test successful
CloudConnectionTestFailure.msg=Connection Test failed
CloudConnectionTestingCredentials.msg=Testing credentials...
@@ -18,6 +20,7 @@
NewCloudConnection.name=New Cloud Connection
EditCloudConnection.name=Edit Cloud Connection
+EditCloudConnection.message=Edit Cloud {0}
EditCloudConnectionError.title=Error Editing Cloud Connection
EditCloudConnectionError.message=Could not open connection wizard
13 years, 9 months
JBoss Tools SVN: r29972 - in branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui: src/org/jboss/tools/deltacloud/ui/commands and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-03-23 06:17:11 -0400 (Wed, 23 Mar 2011)
New Revision: 29972
Added:
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CopyCVPropertySheetPageEntryHandler.java
Modified:
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySection.java
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySheetPage.java
Log:
[JBIDE-8416] implemented custom property sheet page so that elements opied (to the clipboard) from it do not contain the label
Modified: branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
===================================================================
--- branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2011-03-23 10:14:37 UTC (rev 29971)
+++ branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2011-03-23 10:17:11 UTC (rev 29972)
@@ -324,6 +324,23 @@
</enabledWhen>
</handler>
</extension>
+ <extension
+ point="org.eclipse.ui.handlers">
+ <!-- copy property sheet entry handler -->
+ <handler
+ class="org.jboss.tools.deltacloud.ui.commands.CopyCVPropertySheetPageEntryHandler"
+ commandId="org.eclipse.ui.edit.copy">
+ <activeWhen>
+ <with
+ variable="selection">
+ <iterate>
+ <instanceof
+ value="org.jboss.tools.deltacloud.ui.views.cloud.property.CVPropertySheetPage$PropertySourceContentProvider$CVPropertySheetPageEntry" />
+ </iterate>
+ </with>
+ </activeWhen>
+ </handler>
+ </extension>
<!-- InstanceView context menu ================================== -->
<extension point="org.eclipse.ui.menus">
<menuContribution
@@ -675,6 +692,25 @@
</extension>
+ <!-- CVPropertySheetPage context menu ================================== -->
+ <extension point="org.eclipse.ui.menus">
+ <menuContribution
+ allPopups="true"
+ locationURI="popup:org.jboss.tools.deltacloud.ui.views.CVPropertySheetPage">
+ <separator
+ name="edit"
+ visible="true" />
+ </menuContribution>
+ <!-- filter images -->
+ <menuContribution
+ allPopups="true"
+ locationURI="popup:org.jboss.tools.deltacloud.ui.views.CVPropertySheetPage?after=edit">
+ <!-- image commands -->
+ <command
+ commandId="org.eclipse.ui.edit.copy"/>
+ </menuContribution>
+ </extension>
+
<!-- Commands ========================================= -->
<extension
point="org.eclipse.ui.commands">
Added: branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CopyCVPropertySheetPageEntryHandler.java
===================================================================
--- branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CopyCVPropertySheetPageEntryHandler.java (rev 0)
+++ branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CopyCVPropertySheetPageEntryHandler.java 2011-03-23 10:17:11 UTC (rev 29972)
@@ -0,0 +1,61 @@
+package org.jboss.tools.deltacloud.ui.commands;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.dnd.TextTransfer;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.jboss.tools.deltacloud.ui.Activator;
+import org.jboss.tools.deltacloud.ui.views.cloud.property.CVPropertySheetPage;
+import org.jboss.tools.deltacloud.ui.views.cloud.property.CVPropertySheetPage.PropertySourceContentProvider.CVPropertySheetPageEntry;
+
+/**
+ * A handler for the copy command (org.eclipse.ui.edit.copy) that copies entries
+ * in the CVPropertySheetPage to the clipboard.
+ *
+ * @author André Dietisheim
+ *
+ * @see CVPropertySheetPage
+ * @see CVPropertySheetPageEntry
+ */
+public class CopyCVPropertySheetPageEntryHandler extends AbstractHandler {
+
+ private Clipboard clipboard;
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ if (selection instanceof IStructuredSelection) {
+ Object selectedObject = ((IStructuredSelection) selection).getFirstElement();
+ if (selectedObject instanceof CVPropertySheetPageEntry) {
+ CVPropertySheetPageEntry entry = (CVPropertySheetPageEntry) selectedObject;
+ Shell shell = HandlerUtil.getActiveShell(event);
+ if (shell == null) {
+ return null;
+ }
+ Clipboard clipboard = getClipboard(shell.getDisplay());
+ clipboard.setContents(
+ new Object[] { entry.getStringValue() },
+ new Transfer[] { TextTransfer.getInstance() });
+ return Status.OK_STATUS;
+ }
+ }
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ "The element to copy is not of an entry of the deltacloud property view");
+ }
+
+ private Clipboard getClipboard(Display display) {
+ if (clipboard == null) {
+ this.clipboard = new Clipboard(display);
+ }
+ return clipboard;
+ }
+}
Property changes on: branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CopyCVPropertySheetPageEntryHandler.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySection.java
===================================================================
--- branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySection.java 2011-03-23 10:14:37 UTC (rev 29971)
+++ branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySection.java 2011-03-23 10:17:11 UTC (rev 29972)
@@ -17,7 +17,6 @@
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.views.properties.PropertySheetPage;
import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
@@ -26,7 +25,7 @@
/**
* The Property Sheet Page.
*/
- protected PropertySheetPage page;
+ protected CVPropertySheetPage page;
/**
* @see org.eclipse.ui.views.properties.tabbed.ISection#createControls(org.eclipse.swt.widgets.Composite,
Modified: branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySheetPage.java
===================================================================
--- branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySheetPage.java 2011-03-23 10:14:37 UTC (rev 29971)
+++ branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySheetPage.java 2011-03-23 10:17:11 UTC (rev 29972)
@@ -12,39 +12,68 @@
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ControlAdapter;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeColumn;
+import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.views.properties.PropertySheetPage;
+import org.eclipse.ui.part.Page;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.IPropertySheetPage;
+import org.eclipse.ui.views.properties.IPropertySource;
import org.jboss.tools.deltacloud.core.DeltaCloud;
import org.jboss.tools.deltacloud.ui.views.cloud.CloudItem;
+import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
import org.jboss.tools.internal.deltacloud.ui.utils.WorkbenchUtils;
/**
+ * A custom property sheet page for deltacloud element properties.
+ *
* @Jeff Johnston
* @author André Dietisheim
*/
-public class CVPropertySheetPage extends PropertySheetPage {
+public class CVPropertySheetPage extends Page implements IPropertySheetPage {
+ public static final String ID = "org.jboss.tools.deltacloud.ui.views.CVPropertySheetPage";
+
+ protected TreeViewer viewer;
+ protected Composite control;
+
private DeltaCloud deltaCloud;
private PropertyChangeListener cloudPropertyListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
Display.getDefault().syncExec(new Runnable() {
-
+
@Override
public void run() {
- refresh();
+ viewer.refresh();
}
});
}
};
public CVPropertySheetPage() {
- super();
- setSorter(new CVPropertySheetNonSorter());
}
@Override
@@ -59,9 +88,18 @@
}
}
- super.selectionChanged(part, selection);
+ setInput(selection);
}
+ private void setInput(ISelection selection) {
+ if (selection instanceof IStructuredSelection) {
+ Object o = ((IStructuredSelection) selection).getFirstElement();
+ if (o != null) {
+ viewer.setInput(o);
+ }
+ }
+ }
+
private void addPropertyChangeListener(DeltaCloud deltaCloud) {
if (deltaCloud != null) {
deltaCloud.addPropertyChangeListener(cloudPropertyListener);
@@ -74,4 +112,150 @@
}
}
+ @Override
+ public void dispose() {
+ removePropertyChangeListener(deltaCloud);
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ control = new Composite(parent, SWT.BORDER);
+ control.setLayout(new FillLayout());
+ this.viewer = createTreeViewer(control);
+ getSite().setSelectionProvider(viewer);
+ createContextMenu(viewer.getControl());
+ }
+
+ private TreeViewer createTreeViewer(Composite parent) {
+ final Tree tree = new Tree(parent, SWT.SINGLE | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.NONE);
+ tree.setHeaderVisible(true);
+ tree.setLinesVisible(true);
+ tree.setFont(parent.getFont());
+
+ TreeColumn column = new TreeColumn(tree, SWT.SINGLE);
+ column.setText("Property");
+ TreeColumn column2 = new TreeColumn(tree, SWT.SINGLE);
+ column2.setText("Value");
+
+ tree.addControlListener(setTreeColumInitialSize(tree));
+
+ TreeViewer viewer = new TreeViewer(tree);
+ PropertySourceContentProvider provider = new PropertySourceContentProvider();
+ viewer.setContentProvider(provider);
+ viewer.setLabelProvider(provider);
+ return viewer;
+ }
+
+ private ControlAdapter setTreeColumInitialSize(final Tree tree) {
+ return new ControlAdapter() {
+ public void controlResized(ControlEvent e) {
+ Rectangle area = tree.getClientArea();
+ TreeColumn[] columns = tree.getColumns();
+ if (area.width > 0) {
+ columns[0].setWidth(area.width * 40 / 100);
+ columns[1].setWidth(area.width - columns[0].getWidth() - 4);
+ tree.removeControlListener(this);
+ }
+ }
+ };
+ }
+
+ private void createContextMenu(Control control) {
+ IMenuManager menuManager = UIUtils.createContextMenu(control);
+ UIUtils.registerContributionManager(UIUtils.getContextMenuId(ID), menuManager, control);
+ }
+
+ @Override
+ public Control getControl() {
+ return control;
+ }
+
+ @Override
+ public void setActionBars(IActionBars actionBars) {
+ }
+
+ @Override
+ public void setFocus() {
+ viewer.getControl().setFocus();
+ }
+
+ public static class PropertySourceContentProvider extends LabelProvider
+ implements ITableLabelProvider, ITreeContentProvider {
+
+ protected IPropertySource input;
+
+ public static class CVPropertySheetPageEntry {
+ private IPropertyDescriptor descriptor;
+ private IPropertySource source;
+
+ private CVPropertySheetPageEntry(IPropertyDescriptor descriptor, IPropertySource source) {
+ this.descriptor = descriptor;
+ this.source = source;
+ }
+
+ public String getLabel() {
+ return descriptor.getDisplayName();
+ }
+
+ public Object getValue() {
+ return source.getPropertyValue(descriptor.getId());
+ }
+
+ public String getStringValue() {
+ return String.valueOf(getValue());
+ }
+ }
+
+ public PropertySourceContentProvider() {
+ }
+
+ public Object[] getElements(Object inputElement) {
+ IPropertySource propertySource = UIUtils.adapt(inputElement, IPropertySource.class);
+ if (propertySource == null) {
+ return new Object[]{};
+ }
+ this.input = propertySource;
+ List<CVPropertySheetPageEntry> elements = new ArrayList<CVPropertySheetPageEntry>();
+ for (IPropertyDescriptor descriptor : input.getPropertyDescriptors()) {
+ elements.add(new CVPropertySheetPageEntry(descriptor, input));
+ }
+ return elements.toArray();
+ }
+
+ public void dispose() {
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ public Object[] getChildren(Object parentElement) {
+ return new Object[] {};
+ }
+
+ public Object getParent(Object element) {
+ return null;
+ }
+
+ public boolean hasChildren(Object element) {
+ return false;
+ }
+
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+ if (columnIndex == 0) {
+ return ((CVPropertySheetPageEntry) element).getLabel();
+ }
+ else if (columnIndex == 1 && element instanceof CVPropertySheetPageEntry) {
+ return String.valueOf(((CVPropertySheetPageEntry) element).getValue());
+ }
+ return null;
+ }
+ }
+
+ public void refresh() {
+ viewer.refresh();
+ }
}
13 years, 9 months