mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-02 05:45:58 +02:00
[439921] profile merge should allow optional host merge
This commit is contained in:
parent
4666ad510c
commit
649a0d3b95
1 changed files with 18 additions and 2 deletions
|
@ -10,6 +10,7 @@
|
||||||
* David Dykstal (IBM) - [216858] Need the ability to Import/Export RSE connections for sharing
|
* David Dykstal (IBM) - [216858] Need the ability to Import/Export RSE connections for sharing
|
||||||
* David Dykstal (IBM) - [233876] Filters lost after restart
|
* David Dykstal (IBM) - [233876] Filters lost after restart
|
||||||
* David McKnight (IBM)- [433696] RSE profile merge does not handle property sets
|
* David McKnight (IBM)- [433696] RSE profile merge does not handle property sets
|
||||||
|
* David McKnight (IBM) -[439921] profile merge should allow optional host merge
|
||||||
*********************************************************************************/
|
*********************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.persistence;
|
package org.eclipse.rse.internal.persistence;
|
||||||
|
@ -229,6 +230,16 @@ public class RSEEnvelope {
|
||||||
* @param profile the profile which is updated with the changes. The profile may be active or inactive.
|
* @param profile the profile which is updated with the changes. The profile may be active or inactive.
|
||||||
*/
|
*/
|
||||||
public void mergeWith(ISystemProfile profile) throws CoreException {
|
public void mergeWith(ISystemProfile profile) throws CoreException {
|
||||||
|
mergeWith(profile, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Merges the contents of the envelope into the profile.
|
||||||
|
* @param profile the profile which is updated with the changes. The profile may be active or inactive.
|
||||||
|
* @param allowDuplicateHosts indicates whether existing hosts should be merged or appended
|
||||||
|
*/
|
||||||
|
public void mergeWith(ISystemProfile profile, boolean allowDuplicateHosts) throws CoreException {
|
||||||
List hostNodes = new ArrayList(10);
|
List hostNodes = new ArrayList(10);
|
||||||
List filterPoolNodes = new ArrayList(10);
|
List filterPoolNodes = new ArrayList(10);
|
||||||
List propertySetNodes = new ArrayList(10);
|
List propertySetNodes = new ArrayList(10);
|
||||||
|
@ -252,7 +263,7 @@ public class RSEEnvelope {
|
||||||
for (Iterator z = hostNodes.iterator(); z.hasNext();) {
|
for (Iterator z = hostNodes.iterator(); z.hasNext();) {
|
||||||
RSEDOMNode hostNode = (RSEDOMNode) z.next();
|
RSEDOMNode hostNode = (RSEDOMNode) z.next();
|
||||||
String originalName = hostNode.getName();
|
String originalName = hostNode.getName();
|
||||||
IHost host = mergeHost(profile, hostNode);
|
IHost host = mergeHost(profile, hostNode, allowDuplicateHosts);
|
||||||
hostMap.put(originalName, host);
|
hostMap.put(originalName, host);
|
||||||
}
|
}
|
||||||
// create the filter pools
|
// create the filter pools
|
||||||
|
@ -282,11 +293,16 @@ public class RSEEnvelope {
|
||||||
}
|
}
|
||||||
|
|
||||||
private IHost mergeHost(ISystemProfile profile, RSEDOMNode hostNode) {
|
private IHost mergeHost(ISystemProfile profile, RSEDOMNode hostNode) {
|
||||||
|
return mergeHost(profile, hostNode, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private IHost mergeHost(ISystemProfile profile, RSEDOMNode hostNode, boolean allowDuplicates) {
|
||||||
IHost host = null;
|
IHost host = null;
|
||||||
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
|
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
|
||||||
String baseHostName = hostNode.getName();
|
String baseHostName = hostNode.getName();
|
||||||
String hostName = baseHostName;
|
String hostName = baseHostName;
|
||||||
if (registry.getHost(profile, hostName) != null) {
|
if (allowDuplicates && registry.getHost(profile, hostName) != null) {
|
||||||
int n = 0;
|
int n = 0;
|
||||||
while (registry.getHost(profile, hostName) != null) {
|
while (registry.getHost(profile, hostName) != null) {
|
||||||
n++;
|
n++;
|
||||||
|
|
Loading…
Add table
Reference in a new issue