diff options
| author | Violaine Batthish | 2013-05-03 16:10:10 +0000 |
|---|---|---|
| committer | Chris Recoskie | 2013-05-03 16:18:27 +0000 |
| commit | e7128d0adc40ef17ec9b2caa7c6a344410387c9b (patch) | |
| tree | 5ba6e7dd8576e4e6c3733b1cd8edc0be6d6facc5 | |
| parent | 4c91a46b9512b2e60ef3ee2ca33ae7b41512ded4 (diff) | |
| download | org.eclipse.ptp-e7128d0adc40ef17ec9b2caa7c6a344410387c9b.tar.gz org.eclipse.ptp-e7128d0adc40ef17ec9b2caa7c6a344410387c9b.tar.xz org.eclipse.ptp-e7128d0adc40ef17ec9b2caa7c6a344410387c9b.zip | |
Bug 407117 - Restore defaults button on Service Configuration property
page
3 files changed, 61 insertions, 5 deletions
diff --git a/core/org.eclipse.ptp.services.ui/src/org/eclipse/ptp/services/ui/ServiceConfigurationPropertyPage.java b/core/org.eclipse.ptp.services.ui/src/org/eclipse/ptp/services/ui/ServiceConfigurationPropertyPage.java index 30e1f89ad..d92a8298d 100644 --- a/core/org.eclipse.ptp.services.ui/src/org/eclipse/ptp/services/ui/ServiceConfigurationPropertyPage.java +++ b/core/org.eclipse.ptp.services.ui/src/org/eclipse/ptp/services/ui/ServiceConfigurationPropertyPage.java @@ -128,6 +128,7 @@ public class ServiceConfigurationPropertyPage extends PropertyPage implements private IServiceConfiguration currentConfig; private Vector<IServiceConfiguration> deletedServiceConfigurations; + private Vector<IServiceConfiguration> addedServiceConfigurations; private final EventHandler eventHandler = new EventHandler(); private Composite propertiesPane; private Button removeButton; @@ -151,6 +152,7 @@ public class ServiceConfigurationPropertyPage extends PropertyPage implements */ public boolean performOk() { deleteServiceConfigurations(); + addServiceConfigurations(); serviceModelWidget.applyChangesToConfiguration(); try { ServiceModelManager.getInstance().saveModelConfiguration(); @@ -161,6 +163,17 @@ public class ServiceConfigurationPropertyPage extends PropertyPage implements } /** + * Add selected service configurations to the set of service + * configurations known to the service model manager + */ + private void addServiceConfigurations() { + if (addedServiceConfigurations != null) + for (IServiceConfiguration configuration : addedServiceConfigurations) + ServiceModelManager.getInstance().addConfiguration( + getProject(), configuration); + } + + /** * Add a new service configuration to the list of service configurations * used by this project */ @@ -188,8 +201,11 @@ public class ServiceConfigurationPropertyPage extends PropertyPage implements item = new TableItem(serviceConfigurationList, 0); item.setData(config); item.setText(config.getName()); - ServiceModelManager.getInstance().addConfiguration( - getProject(), config); + // ServiceModelManager.getInstance().addConfiguration( + // getProject(), config); + if (addedServiceConfigurations == null) + addedServiceConfigurations = new Vector<IServiceConfiguration>(); + addedServiceConfigurations.add(config); } } } @@ -264,7 +280,8 @@ public class ServiceConfigurationPropertyPage extends PropertyPage implements // Selected service model is added to vector to be deleted during Ok // or Apply button processing deletedServiceConfigurations.add(selectedConfig); - serviceConfigurationList.remove(serviceConfigurationList.getSelectionIndex()); + serviceConfigurationList.remove(serviceConfigurationList + .getSelectionIndex()); serviceModelWidget.setServiceConfiguration(null); } } @@ -368,4 +385,24 @@ public class ServiceConfigurationPropertyPage extends PropertyPage implements getProjectConfigurations(); return propertiesPane; } + + /* (non-Javadoc) + * @see org.eclipse.jface.preference.PreferencePage#performDefaults() + */ + @Override + protected void performDefaults() { + // clean up pending deletes + if (deletedServiceConfigurations != null) + deletedServiceConfigurations.removeAllElements(); + // remove any pending additions + if (addedServiceConfigurations != null) + addedServiceConfigurations.removeAllElements(); + currentConfig = null; + serviceConfigurationList.removeAll(); // cleanup table + getProjectConfigurations(); // reload table + serviceModelWidget.setServiceConfiguration(null); + super.performDefaults(); + setErrorMessage(null); + } + } diff --git a/core/org.eclipse.ptp.services.ui/src/org/eclipse/ptp/services/ui/widgets/ServiceProviderConfigurationWidget.java b/core/org.eclipse.ptp.services.ui/src/org/eclipse/ptp/services/ui/widgets/ServiceProviderConfigurationWidget.java index 538b93422..3c1deaeb3 100644 --- a/core/org.eclipse.ptp.services.ui/src/org/eclipse/ptp/services/ui/widgets/ServiceProviderConfigurationWidget.java +++ b/core/org.eclipse.ptp.services.ui/src/org/eclipse/ptp/services/ui/widgets/ServiceProviderConfigurationWidget.java @@ -439,6 +439,12 @@ public class ServiceProviderConfigurationWidget extends Composite { providerLabel.setEnabled(!disabled); enabledCheckbox.setSelection(!disabled); enabledCheckbox.setEnabled(true); + } else { + providerCombo.removeAll(); + enabledCheckbox.setEnabled(false); + providerLabel.setEnabled(false); + stackLayout.topControl = null; + configurationComposite.layout(); } } diff --git a/rdt/org.eclipse.ptp.rdt.ui/src/org/eclipse/ptp/rdt/ui/wizards/IndexFileLocationWidget.java b/rdt/org.eclipse.ptp.rdt.ui/src/org/eclipse/ptp/rdt/ui/wizards/IndexFileLocationWidget.java index 41a3e8a62..9d6138c02 100644 --- a/rdt/org.eclipse.ptp.rdt.ui/src/org/eclipse/ptp/rdt/ui/wizards/IndexFileLocationWidget.java +++ b/rdt/org.eclipse.ptp.rdt.ui/src/org/eclipse/ptp/rdt/ui/wizards/IndexFileLocationWidget.java @@ -16,6 +16,7 @@ import java.util.Map; import org.eclipse.core.runtime.ListenerList; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.preference.PreferenceDialog; import org.eclipse.ptp.internal.rdt.ui.RSEUtils; import org.eclipse.ptp.rdt.ui.messages.Messages; import org.eclipse.rse.core.model.IHost; @@ -36,6 +37,7 @@ import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; public class IndexFileLocationWidget extends Composite { @@ -181,8 +183,19 @@ public class IndexFileLocationWidget extends Composite { remoteFileSubSystem.getRemoteFileObject(path, new NullProgressMonitor()); if (!currentRemoteFolder.canWrite()){ - MessageDialog.openWarning(getShell(), - Messages.getString("InvalidIndexLocationTitle"), Messages.getString("InvalidIndexLocationLabel")); //$NON-NLS-1$ //$NON-NLS-2$ + // display the message in the property dialog if possible + Composite parent = text.getParent(); + while (parent!=null && !(parent instanceof Shell)) + parent=parent.getParent(); + if (parent instanceof Shell) { + if (parent.getData() instanceof PreferenceDialog) { + PreferenceDialog dialog = (PreferenceDialog)parent.getData(); + dialog.setErrorMessage(Messages.getString("InvalidIndexLocationLabel")); //$NON-NLS-1$ + } + } else + // just display a dialog + MessageDialog.openWarning(getShell(), + Messages.getString("InvalidIndexLocationTitle"), Messages.getString("InvalidIndexLocationLabel")); //$NON-NLS-1$ //$NON-NLS-2$ } } catch (SystemMessageException e1) { |
