mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-04 07:35:24 +02:00
[185752] use systemTypeId instead of systemTypeName when persisting profiles.
This commit is contained in:
parent
7c41349015
commit
2bfb3ccad2
3 changed files with 30 additions and 15 deletions
|
@ -287,6 +287,7 @@ public class RSEDOMExporter implements IRSEDOMExporter {
|
|||
|
||||
if (clean || node.isDirty()) {
|
||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE, host.getSystemType().getName());
|
||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_SYSTEM_TYPE, host.getSystemType().getId());
|
||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_OFFLINE, getBooleanString(host.isOffline()));
|
||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_PROMPTABLE, getBooleanString(host.isPromptable()));
|
||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_HOSTNAME, host.getHostName());
|
||||
|
@ -317,11 +318,7 @@ public class RSEDOMExporter implements IRSEDOMExporter {
|
|||
public RSEDOMNode createNode(RSEDOMNode parent, IConnectorService connectorService, boolean clean) {
|
||||
RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_CONNECTOR_SERVICE, connectorService, clean);
|
||||
if (clean || node.isDirty()) {
|
||||
// store it's attributes
|
||||
IRSESystemType systemType = connectorService.getHost().getSystemType();
|
||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE, systemType.getName());
|
||||
|
||||
// can't do this til connector service owns the properties (right now it's still subsystem)
|
||||
// can't do this until connector service owns the properties (right now it's still subsystem)
|
||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_GROUP, connectorService.getName());
|
||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_USE_SSL, getBooleanString(connectorService.isUsingSSL()));
|
||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_PORT, Integer.toString(connectorService.getPort()));
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.eclipse.rse.internal.persistence.dom;
|
|||
|
||||
import java.util.Vector;
|
||||
|
||||
import org.eclipse.rse.core.IRSECoreRegistry;
|
||||
import org.eclipse.rse.core.IRSESystemType;
|
||||
import org.eclipse.rse.core.RSECorePlugin;
|
||||
import org.eclipse.rse.core.filters.ISystemFilter;
|
||||
|
@ -101,17 +102,24 @@ public class RSEDOMImporter {
|
|||
|
||||
// get host node attributes
|
||||
String connectionName = hostNode.getName();
|
||||
String systemTypeName = hostNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE).getValue();
|
||||
String hostName = hostNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_HOSTNAME).getValue();
|
||||
String description = hostNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_DESCRIPTION).getValue();
|
||||
boolean isOffline = getBooleanValue(hostNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_OFFLINE).getValue());
|
||||
boolean isPromptable = getBooleanValue(hostNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_PROMPTABLE).getValue());
|
||||
String systemTypeName = getAttributeValue(hostNode, IRSEDOMConstants.ATTRIBUTE_TYPE);
|
||||
String systemTypeId = getAttributeValue(hostNode, IRSEDOMConstants.ATTRIBUTE_SYSTEM_TYPE);
|
||||
String hostName = getAttributeValue(hostNode, IRSEDOMConstants.ATTRIBUTE_HOSTNAME);
|
||||
String description = getAttributeValue(hostNode, IRSEDOMConstants.ATTRIBUTE_DESCRIPTION);
|
||||
boolean isOffline = getBooleanValue(getAttributeValue(hostNode, IRSEDOMConstants.ATTRIBUTE_OFFLINE));
|
||||
boolean isPromptable = getBooleanValue(getAttributeValue(hostNode, IRSEDOMConstants.ATTRIBUTE_PROMPTABLE));
|
||||
|
||||
// create host and set it's attributes
|
||||
try {
|
||||
// NOTE create host effectively recreates the subsystems
|
||||
// so instead of creating subsystems on restore, we should be updating their properties
|
||||
IRSESystemType systemType = RSECorePlugin.getDefault().getRegistry().getSystemType(systemTypeName);
|
||||
IRSECoreRegistry registry = RSECorePlugin.getDefault().getRegistry();
|
||||
IRSESystemType systemType = null;
|
||||
if (systemTypeId != null) {
|
||||
systemType = registry.getSystemTypeById(systemTypeId);
|
||||
} else if (systemTypeName != null) {
|
||||
systemType = registry.getSystemType(systemTypeName);
|
||||
}
|
||||
host = profile.createHost(systemType, connectionName, hostName, description);
|
||||
host.setOffline(isOffline);
|
||||
host.setPromptable(isPromptable);
|
||||
|
@ -158,11 +166,11 @@ public class RSEDOMImporter {
|
|||
RSEDOMNode ssChild = ssChildren[s];
|
||||
ISubSystem subSystem = restoreSubSystem(host, ssChild);
|
||||
if (subSystem != null && service == null) {
|
||||
ISubSystemConfiguration factory = subSystem.getSubSystemConfiguration();
|
||||
service = factory.getConnectorService(host);
|
||||
ISubSystemConfiguration subsystemConfiguration = subSystem.getSubSystemConfiguration();
|
||||
service = subsystemConfiguration.getConnectorService(host);
|
||||
if (service != null) {
|
||||
if (factory.supportsServerLaunchProperties(host)) {
|
||||
IServerLauncherProperties sl = factory.createServerLauncher(service);
|
||||
if (subsystemConfiguration.supportsServerLaunchProperties(host)) {
|
||||
IServerLauncherProperties sl = subsystemConfiguration.createServerLauncher(service);
|
||||
if (sl != null) {
|
||||
// get server launcher properties
|
||||
// right now we just set them for subsystem, but later that will change
|
||||
|
@ -470,4 +478,13 @@ public class RSEDOMImporter {
|
|||
private ISubSystemConfiguration getSubSystemConfiguration(String subsystemName) {
|
||||
return _registry.getSubSystemConfiguration(subsystemName);
|
||||
}
|
||||
|
||||
private String getAttributeValue(RSEDOMNode node, String attributeName) {
|
||||
String result = null;
|
||||
RSEDOMNodeAttribute attribute = node.getAttribute(attributeName);
|
||||
if (attribute != null) {
|
||||
result = attribute.getValue();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -47,6 +47,7 @@ public interface IRSEDOMConstants {
|
|||
public static final String ATTRIBUTE_HOSTNAME = "hostname"; //$NON-NLS-1$
|
||||
public static final String ATTRIBUTE_OFFLINE = "offline"; //$NON-NLS-1$
|
||||
public static final String ATTRIBUTE_DESCRIPTION = "description"; //$NON-NLS-1$
|
||||
public static final String ATTRIBUTE_SYSTEM_TYPE = "systemType"; //$NON-NLS-1$
|
||||
|
||||
// ConnectorService attributes
|
||||
public static final String ATTRIBUTE_GROUP = "group"; //$NON-NLS-1$
|
||||
|
|
Loading…
Add table
Reference in a new issue