From efa8873ec56f4b6e54fd26b77078a80ca7620d14 Mon Sep 17 00:00:00 2001 From: David McKnight Date: Wed, 4 Apr 2007 15:09:55 +0000 Subject: [PATCH] [179363] to avoid having changed properties reset by unchanged default properties, I've added code to check if the user changed the ServerLauncherPropertiesServiceElement. The explicit properties are set only when the service element changes. --- ...erverLauncherPropertiesServiceElement.java | 7 +++++++ .../rse/ui/widgets/services/ServicesForm.java | 19 ++++--------------- .../wizards/SubSystemServiceWizardPage.java | 15 ++++++++++++--- 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServerLauncherPropertiesServiceElement.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServerLauncherPropertiesServiceElement.java index cf1e8e870e2..ae6275a93a9 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServerLauncherPropertiesServiceElement.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServerLauncherPropertiesServiceElement.java @@ -26,6 +26,7 @@ import org.eclipse.swt.graphics.Image; public class ServerLauncherPropertiesServiceElement extends RSEModelServiceElement { protected IServerLauncherProperties _launcherProperties; + private boolean _userModified = false; public ServerLauncherPropertiesServiceElement(IHost host, ServiceElement parent, IServerLauncherProperties launcherProperties) { @@ -56,10 +57,16 @@ public class ServerLauncherPropertiesServiceElement extends RSEModelServiceEleme public void childChanged(ServiceElement element) { + _userModified = true; _launcherProperties.restoreFromProperties(); _launcherProperties.commit(); getParent().childChanged(element); } + + public boolean userModified() + { + return _userModified; + } public void commit() { diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServicesForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServicesForm.java index be932ed4f6f..ffacebb2654 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServicesForm.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServicesForm.java @@ -157,6 +157,8 @@ public class ServicesForm extends SystemBaseForm implements ICheckStateListener return _factoryViewer.getControl(); } + + private void createFactoryViewer(Composite parent) { // Create the table viewer. @@ -199,23 +201,9 @@ public class ServicesForm extends SystemBaseForm implements ICheckStateListener tableTree.setToolTipText(_serviceTooltip); -/* - TableLayout tableLayout = new TableLayout(); - - TreeColumn factoryColumn = new TreeColumn(tableTree, SWT.LEFT); - factoryColumn.setText("Property"); - tableLayout.addColumnData(new ColumnPixelData(100)); - tableTree.setLayout(tableLayout); - - TreeColumn fileServiceColumn = new TreeColumn(tableTree, SWT.LEFT); - fileServiceColumn.setText("Value"); - tableLayout.addColumnData(new ColumnPixelData(120)); - */ _serviceViewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS); - // Adjust the table viewer. - //String[] properties = new String[] {"STRING", "STRING"}; - //_serviceViewer.setColumnProperties(properties); + _serviceViewer.setContentProvider(new ServiceTableContentProvider()); _serviceViewer.setLabelProvider(new ServiceTableLabelProvider()); @@ -304,4 +292,5 @@ public class ServicesForm extends SystemBaseForm implements ICheckStateListener } return description != null ? description : ""; //$NON-NLS-1$ } + } \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SubSystemServiceWizardPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SubSystemServiceWizardPage.java index 5421c0274ff..29e9f49b004 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SubSystemServiceWizardPage.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SubSystemServiceWizardPage.java @@ -77,6 +77,7 @@ public class SubSystemServiceWizardPage extends AbstractSystemNewConnectionWizar return control; } + protected ServiceElement[] getServiceElements() { @@ -207,11 +208,19 @@ public class SubSystemServiceWizardPage extends AbstractSystemNewConnectionWizar ServerLauncherPropertiesServiceElement[] elements = getPropertiesServiceElement(); if (elements.length > 0) { - IServerLauncherProperties properties = elements[0].getServerLauncherProperties(); + ServerLauncherPropertiesServiceElement element = elements[0]; + if (element.userModified()) + { + IServerLauncherProperties properties = element.getServerLauncherProperties(); - IConnectorService rserv = ss.getConnectorService(); - properties.saveToProperties(); + IConnectorService rserv = ss.getConnectorService(); + properties.saveToProperties(); rserv.setRemoteServerLauncherProperties(properties); + } + else + { // just using defaults + + } /* PropertyElement[] properties = elements[i].getProperties(); for (int p = 0; p < properties.length; p++)