mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-05 23:35:48 +02:00
[183994] commit property sets for connector services in the new connection wizard
This commit is contained in:
parent
4486fc1f36
commit
227b7d7bca
1 changed files with 58 additions and 43 deletions
|
@ -20,6 +20,7 @@
|
||||||
package org.eclipse.rse.ui.wizards;
|
package org.eclipse.rse.ui.wizards;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.jface.wizard.IWizard;
|
import org.eclipse.jface.wizard.IWizard;
|
||||||
|
@ -27,6 +28,7 @@ import org.eclipse.rse.core.IRSESystemType;
|
||||||
import org.eclipse.rse.core.RSECorePlugin;
|
import org.eclipse.rse.core.RSECorePlugin;
|
||||||
import org.eclipse.rse.core.model.DummyHost;
|
import org.eclipse.rse.core.model.DummyHost;
|
||||||
import org.eclipse.rse.core.model.IHost;
|
import org.eclipse.rse.core.model.IHost;
|
||||||
|
import org.eclipse.rse.core.model.IPropertySet;
|
||||||
import org.eclipse.rse.core.model.ISystemRegistry;
|
import org.eclipse.rse.core.model.ISystemRegistry;
|
||||||
import org.eclipse.rse.core.subsystems.IConnectorService;
|
import org.eclipse.rse.core.subsystems.IConnectorService;
|
||||||
import org.eclipse.rse.core.subsystems.IServerLauncherProperties;
|
import org.eclipse.rse.core.subsystems.IServerLauncherProperties;
|
||||||
|
@ -36,6 +38,7 @@ import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||||
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
|
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
|
||||||
import org.eclipse.rse.ui.widgets.services.ConnectorServiceElement;
|
import org.eclipse.rse.ui.widgets.services.ConnectorServiceElement;
|
||||||
import org.eclipse.rse.ui.widgets.services.FactoryServiceElement;
|
import org.eclipse.rse.ui.widgets.services.FactoryServiceElement;
|
||||||
|
import org.eclipse.rse.ui.widgets.services.PropertySetServiceElement;
|
||||||
import org.eclipse.rse.ui.widgets.services.RootServiceElement;
|
import org.eclipse.rse.ui.widgets.services.RootServiceElement;
|
||||||
import org.eclipse.rse.ui.widgets.services.ServerLauncherPropertiesServiceElement;
|
import org.eclipse.rse.ui.widgets.services.ServerLauncherPropertiesServiceElement;
|
||||||
import org.eclipse.rse.ui.widgets.services.ServiceElement;
|
import org.eclipse.rse.ui.widgets.services.ServiceElement;
|
||||||
|
@ -49,7 +52,7 @@ import org.eclipse.swt.widgets.Control;
|
||||||
public class SubSystemServiceWizardPage extends AbstractSystemNewConnectionWizardPage implements ISubSystemPropertiesWizardPage
|
public class SubSystemServiceWizardPage extends AbstractSystemNewConnectionWizardPage implements ISubSystemPropertiesWizardPage
|
||||||
{
|
{
|
||||||
private ServicesForm _form;
|
private ServicesForm _form;
|
||||||
private IServiceSubSystemConfiguration _selectedFactory;
|
private IServiceSubSystemConfiguration _selectedConfiguration;
|
||||||
private ServiceElement _root;
|
private ServiceElement _root;
|
||||||
private ServiceElement[] _serviceElements;
|
private ServiceElement[] _serviceElements;
|
||||||
|
|
||||||
|
@ -153,7 +156,7 @@ public class SubSystemServiceWizardPage extends AbstractSystemNewConnectionWizar
|
||||||
{
|
{
|
||||||
_root.commit();
|
_root.commit();
|
||||||
|
|
||||||
_selectedFactory = ((FactoryServiceElement)_form.getSelectedService()).getFactory();
|
_selectedConfiguration = ((FactoryServiceElement)_form.getSelectedService()).getFactory();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -190,56 +193,68 @@ public class SubSystemServiceWizardPage extends AbstractSystemNewConnectionWizar
|
||||||
return (ServerLauncherPropertiesServiceElement[])results.toArray(new ServerLauncherPropertiesServiceElement[results.size()]);
|
return (ServerLauncherPropertiesServiceElement[])results.toArray(new ServerLauncherPropertiesServiceElement[results.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean applyValues(ISubSystem ss)
|
public boolean applyValues(ISubSystem ss) {
|
||||||
{
|
if (_selectedConfiguration != null) {
|
||||||
if (_selectedFactory != null)
|
IServiceSubSystemConfiguration currentConfiguration = (IServiceSubSystemConfiguration) ss.getSubSystemConfiguration();
|
||||||
{
|
if (currentConfiguration != null) {
|
||||||
IServiceSubSystemConfiguration currentFactory = (IServiceSubSystemConfiguration)ss.getSubSystemConfiguration();
|
if (_selectedConfiguration != currentConfiguration) {
|
||||||
if (currentFactory != null)
|
((IServiceSubSystem) ss).switchServiceFactory(_selectedConfiguration);
|
||||||
{
|
|
||||||
if (_selectedFactory != currentFactory)
|
|
||||||
{
|
|
||||||
((IServiceSubSystem)ss).switchServiceFactory(_selectedFactory);
|
|
||||||
}
|
}
|
||||||
//IHost realHost = ss.getHost();
|
if (_root != null) {
|
||||||
if (_root != null)
|
IConnectorService connectorService = ss.getConnectorService();
|
||||||
{
|
// process server launcher properties
|
||||||
{
|
ServerLauncherPropertiesServiceElement[] elements = getPropertiesServiceElement();
|
||||||
ServerLauncherPropertiesServiceElement[] elements = getPropertiesServiceElement();
|
if (elements.length > 0) {
|
||||||
if (elements.length > 0)
|
ServerLauncherPropertiesServiceElement element = elements[0];
|
||||||
{
|
if (element.userModified()) {
|
||||||
ServerLauncherPropertiesServiceElement element = elements[0];
|
IServerLauncherProperties properties = element.getServerLauncherProperties();
|
||||||
if (element.userModified())
|
properties.saveToProperties();
|
||||||
{
|
connectorService.setRemoteServerLauncherProperties(properties);
|
||||||
IServerLauncherProperties properties = element.getServerLauncherProperties();
|
}
|
||||||
|
}
|
||||||
IConnectorService rserv = ss.getConnectorService();
|
/*
|
||||||
properties.saveToProperties();
|
* Process connector service property sets
|
||||||
rserv.setRemoteServerLauncherProperties(properties);
|
* The connector service element (there should be only one) is attached to a dummy host.
|
||||||
}
|
* Therefore the property sets containing the new values can me moved from the (dummy)
|
||||||
else
|
* connector service to the real connector service.
|
||||||
{ // just using defaults
|
*/
|
||||||
|
List connectorServiceElements = getConnectorServiceElements(_root);
|
||||||
}
|
for (Iterator z = connectorServiceElements.iterator(); z.hasNext();) {
|
||||||
/*
|
ConnectorServiceElement element = (ConnectorServiceElement) z.next();
|
||||||
PropertyElement[] properties = elements[i].getProperties();
|
PropertySetServiceElement[] psElements = element.getPropertySets();
|
||||||
for (int p = 0; p < properties.length; p++)
|
for (int i = 0; i < psElements.length; i++) {
|
||||||
{
|
PropertySetServiceElement psElement = psElements[i];
|
||||||
PropertyElement pel = properties[p];
|
IPropertySet set = psElement.getPropertySet();
|
||||||
|
connectorService.addPropertySet(set); // moves the property set, replacing the old one
|
||||||
}
|
|
||||||
*/
|
|
||||||
//rserv.addPropertySets(sets);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the list of connector service elements from a given service element.
|
||||||
|
* @param root The root element from which to search
|
||||||
|
* @return A list of all found connector service elements. The list will be empty if non
|
||||||
|
* are found.
|
||||||
|
*/
|
||||||
|
private List getConnectorServiceElements(ServiceElement root) {
|
||||||
|
List result = new ArrayList(10);
|
||||||
|
if (root instanceof ConnectorServiceElement) {
|
||||||
|
result.add(root);
|
||||||
|
}
|
||||||
|
ServiceElement[] children = root.getChildren();
|
||||||
|
if (children != null) {
|
||||||
|
for (int i = 0; i < children.length; i++) {
|
||||||
|
ServiceElement child = children[i];
|
||||||
|
result.addAll(getConnectorServiceElements(child));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
protected IConnectorService getCustomConnectorService(IServiceSubSystemConfiguration config)
|
protected IConnectorService getCustomConnectorService(IServiceSubSystemConfiguration config)
|
||||||
{
|
{
|
||||||
ServiceElement[] children = _root.getChildren();
|
ServiceElement[] children = _root.getChildren();
|
||||||
|
|
Loading…
Add table
Reference in a new issue