summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorViolaine Batthish2013-05-03 12:10:10 (EDT)
committer Chris Recoskie2013-05-03 12:10:10 (EDT)
commitbaad8deba40478fcc2719734134eab54396697c8 (patch)
tree1e9b0195ad1410918bdc77df1220059057f12d96
parent6e5639c1e2e7bb25178c6d486cd1bfb906f3392a (diff)
downloadorg.eclipse.ptp-baad8deba40478fcc2719734134eab54396697c8.zip
org.eclipse.ptp-baad8deba40478fcc2719734134eab54396697c8.tar.gz
org.eclipse.ptp-baad8deba40478fcc2719734134eab54396697c8.tar.bz2
Bug 407117 - Restore defaults button on Service Configuration property
page
-rw-r--r--core/org.eclipse.ptp.services.ui/src/org/eclipse/ptp/services/ui/ServiceConfigurationPropertyPage.java43
-rw-r--r--core/org.eclipse.ptp.services.ui/src/org/eclipse/ptp/services/ui/widgets/ServiceProviderConfigurationWidget.java6
-rw-r--r--rdt/org.eclipse.ptp.rdt.ui/src/org/eclipse/ptp/rdt/ui/wizards/IndexFileLocationWidget.java17
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 7b4bd2f..0813744 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
@@ -127,6 +127,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;
@@ -150,6 +151,7 @@ public class ServiceConfigurationPropertyPage extends PropertyPage implements
*/
public boolean performOk() {
deleteServiceConfigurations();
+ addServiceConfigurations();
serviceModelWidget.applyChangesToConfiguration();
try {
ServiceModelManager.getInstance().saveModelConfiguration();
@@ -160,6 +162,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
*/
@@ -187,8 +200,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);
}
}
}
@@ -263,7 +279,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);
}
}
@@ -367,4 +384,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 0c8c23a..2ae7e8a 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 41a3e8a..9d6138c 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) {