1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-10 10:35:23 +02:00

[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.

This commit is contained in:
David McKnight 2007-04-04 15:09:55 +00:00
parent 4b498e3e85
commit efa8873ec5
3 changed files with 23 additions and 18 deletions

View file

@ -26,6 +26,7 @@ import org.eclipse.swt.graphics.Image;
public class ServerLauncherPropertiesServiceElement extends RSEModelServiceElement public class ServerLauncherPropertiesServiceElement extends RSEModelServiceElement
{ {
protected IServerLauncherProperties _launcherProperties; protected IServerLauncherProperties _launcherProperties;
private boolean _userModified = false;
public ServerLauncherPropertiesServiceElement(IHost host, ServiceElement parent, IServerLauncherProperties launcherProperties) public ServerLauncherPropertiesServiceElement(IHost host, ServiceElement parent, IServerLauncherProperties launcherProperties)
{ {
@ -56,11 +57,17 @@ public class ServerLauncherPropertiesServiceElement extends RSEModelServiceEleme
public void childChanged(ServiceElement element) public void childChanged(ServiceElement element)
{ {
_userModified = true;
_launcherProperties.restoreFromProperties(); _launcherProperties.restoreFromProperties();
_launcherProperties.commit(); _launcherProperties.commit();
getParent().childChanged(element); getParent().childChanged(element);
} }
public boolean userModified()
{
return _userModified;
}
public void commit() public void commit()
{ {
super.commit(); super.commit();

View file

@ -157,6 +157,8 @@ public class ServicesForm extends SystemBaseForm implements ICheckStateListener
return _factoryViewer.getControl(); return _factoryViewer.getControl();
} }
private void createFactoryViewer(Composite parent) private void createFactoryViewer(Composite parent)
{ {
// Create the table viewer. // Create the table viewer.
@ -199,23 +201,9 @@ public class ServicesForm extends SystemBaseForm implements ICheckStateListener
tableTree.setToolTipText(_serviceTooltip); 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); _serviceViewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS);
// Adjust the table viewer.
//String[] properties = new String[] {"STRING", "STRING"};
//_serviceViewer.setColumnProperties(properties);
_serviceViewer.setContentProvider(new ServiceTableContentProvider()); _serviceViewer.setContentProvider(new ServiceTableContentProvider());
_serviceViewer.setLabelProvider(new ServiceTableLabelProvider()); _serviceViewer.setLabelProvider(new ServiceTableLabelProvider());
@ -304,4 +292,5 @@ public class ServicesForm extends SystemBaseForm implements ICheckStateListener
} }
return description != null ? description : ""; //$NON-NLS-1$ return description != null ? description : ""; //$NON-NLS-1$
} }
} }

View file

@ -78,6 +78,7 @@ public class SubSystemServiceWizardPage extends AbstractSystemNewConnectionWizar
return control; return control;
} }
protected ServiceElement[] getServiceElements() protected ServiceElement[] getServiceElements()
{ {
if (_serviceElements == null) if (_serviceElements == null)
@ -207,11 +208,19 @@ public class SubSystemServiceWizardPage extends AbstractSystemNewConnectionWizar
ServerLauncherPropertiesServiceElement[] elements = getPropertiesServiceElement(); ServerLauncherPropertiesServiceElement[] elements = getPropertiesServiceElement();
if (elements.length > 0) if (elements.length > 0)
{ {
IServerLauncherProperties properties = elements[0].getServerLauncherProperties(); ServerLauncherPropertiesServiceElement element = elements[0];
if (element.userModified())
{
IServerLauncherProperties properties = element.getServerLauncherProperties();
IConnectorService rserv = ss.getConnectorService(); IConnectorService rserv = ss.getConnectorService();
properties.saveToProperties(); properties.saveToProperties();
rserv.setRemoteServerLauncherProperties(properties); rserv.setRemoteServerLauncherProperties(properties);
}
else
{ // just using defaults
}
/* /*
PropertyElement[] properties = elements[i].getProperties(); PropertyElement[] properties = elements[i].getProperties();
for (int p = 0; p < properties.length; p++) for (int p = 0; p < properties.length; p++)