### Eclipse Workspace Patch 1.0 #P org.eclipse.rse.core Index: META-INF/MANIFEST.MF =================================================================== RCS file: /cvsroot/tools/org.eclipse.tm.rse/plugins/org.eclipse.rse.core/META-INF/MANIFEST.MF,v retrieving revision 1.42 diff -u -r1.42 MANIFEST.MF --- META-INF/MANIFEST.MF 6 Oct 2010 13:12:42 -0000 1.42 +++ META-INF/MANIFEST.MF 1 Mar 2011 21:48:07 -0000 @@ -2,7 +2,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.rse.core;singleton:=true -Bundle-Version: 3.1.200.qualifier +Bundle-Version: 3.2.0.qualifier Bundle-Activator: org.eclipse.rse.core.RSECorePlugin Bundle-Localization: plugin Require-Bundle: org.eclipse.core.runtime, Index: src/org/eclipse/rse/core/model/DummyHost.java =================================================================== RCS file: /cvsroot/tools/org.eclipse.tm.rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/DummyHost.java,v retrieving revision 1.6 diff -u -r1.6 DummyHost.java --- src/org/eclipse/rse/core/model/DummyHost.java 23 Apr 2008 18:19:56 -0000 1.6 +++ src/org/eclipse/rse/core/model/DummyHost.java 1 Mar 2011 21:48:07 -0000 @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2006, 2008 IBM Corporation and others. All rights reserved. + * Copyright (c) 2006, 2011 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -14,6 +14,7 @@ * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType * David Dykstal (IBM) - 142806: refactoring persistence framework * David Dykstal (IBM) - [226561] Add API markup to RSE javadocs for extend / implement + * David McKnight (IBM) - [338510] "Copy Connection" operation deletes the registered property set in the original connection ********************************************************************************/ package org.eclipse.rse.core.model; @@ -264,4 +265,11 @@ public void setDefaultEncoding(String encoding, boolean fromRemote) { } + + /** + * @since 3.2 + */ + public void clonePropertySets(IPropertySetContainer targetContainer) { + } + } \ No newline at end of file Index: src/org/eclipse/rse/core/model/IPropertySetContainer.java =================================================================== RCS file: /cvsroot/tools/org.eclipse.tm.rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/IPropertySetContainer.java,v retrieving revision 1.9 diff -u -r1.9 IPropertySetContainer.java --- src/org/eclipse/rse/core/model/IPropertySetContainer.java 27 May 2009 15:17:38 -0000 1.9 +++ src/org/eclipse/rse/core/model/IPropertySetContainer.java 1 Mar 2011 21:48:07 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2009 IBM Corporation and others. + * Copyright (c) 2006, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -15,6 +15,7 @@ * Johann Draschwandtner (Wind River) - [227509][apidoc] Add note how to persist property sets * David Dykstal (IBM) - [226561] Add API markup to RSE javadocs for extend / implement * David Dykstal (IBM) - [261486][api] add noextend to interfaces that require it + * David McKnight (IBM) - [338510] "Copy Connection" operation deletes the registered property set in the original connection *******************************************************************************/ package org.eclipse.rse.core.model; @@ -100,5 +101,14 @@ * false if a property set was not removed, usually if it does not exist in the container. */ public boolean removePropertySet(String name); + + /** + * Make copies of a list of property sets and add them to the specified container. + * Each property set may contain its own list of property sets, so the + * method is recursive. + * @param targetContainer new container to copy property sets into + * @since 3.2 + */ + public void clonePropertySets(IPropertySetContainer targetContainer); } Index: src/org/eclipse/rse/core/model/PropertySetContainer.java =================================================================== RCS file: /cvsroot/tools/org.eclipse.tm.rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/PropertySetContainer.java,v retrieving revision 1.9 diff -u -r1.9 PropertySetContainer.java --- src/org/eclipse/rse/core/model/PropertySetContainer.java 26 Jan 2011 20:47:21 -0000 1.9 +++ src/org/eclipse/rse/core/model/PropertySetContainer.java 1 Mar 2011 21:48:07 -0000 @@ -14,10 +14,12 @@ * David Dykstal (IBM) - 142806: refactoring persistence framework * David Dykstal (IBM) - [226561] Add API markup to RSE javadocs for extend / implement * David McKnight (IBM) - [334837] Ordering of Library list entries incorrect after migration + * David McKnight (IBM) - [338510] "Copy Connection" operation deletes the registered property set in the original connection ********************************************************************************/ package org.eclipse.rse.core.model; +import java.io.ObjectInputStream.GetField; import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedHashMap; @@ -84,5 +86,30 @@ public boolean removePropertySet(String name) { return _propertySets.remove(name) != null; } + + /** + * @since 3.2 + */ + public void clonePropertySets(IPropertySetContainer container) { + IPropertySet[] propertySets = getPropertySets(); + if (propertySets != null && propertySets.length > 0) + clonePropertySets(container, propertySets); + } + + private void clonePropertySets(IPropertySetContainer container, IPropertySet[] propertySets){ + if (propertySets == null) { + return; + } + for (int i = 0, n = propertySets.length; i < n; ++i) { + IPropertySet fromSet = propertySets[i]; + IPropertySet copySet = container.createPropertySet(fromSet.getName(), fromSet.getDescription()); + String[] fromKeys = fromSet.getPropertyKeys(); + for (int i2 = 0, n2 = fromKeys.length; i2 < n2; ++i2) { + IProperty fromProperty = fromSet.getProperty(fromKeys[i2]); + copySet.addProperty(fromProperty.getKey(), fromProperty.getValue(), fromProperty.getType()); + } + clonePropertySets(copySet, fromSet.getPropertySets()); + } + } } \ No newline at end of file Index: src/org/eclipse/rse/core/subsystems/AbstractDelegatingConnectorService.java =================================================================== RCS file: /cvsroot/tools/org.eclipse.tm.rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/AbstractDelegatingConnectorService.java,v retrieving revision 1.12 diff -u -r1.12 AbstractDelegatingConnectorService.java --- src/org/eclipse/rse/core/subsystems/AbstractDelegatingConnectorService.java 18 Apr 2008 09:19:50 -0000 1.12 +++ src/org/eclipse/rse/core/subsystems/AbstractDelegatingConnectorService.java 1 Mar 2011 21:48:08 -0000 @@ -14,6 +14,7 @@ * Martin Oberhuber (Wind River) - [185750] Remove IConnectorService.getHostType() * David Dykstal (IBM) - [210474] Deny save password function missing * David Dykstal (IBM) - [225089][ssh][shells][api] Canceling connection leads to exception + * David McKnight (IBM) - [338510] "Copy Connection" operation deletes the registered property set in the original connection ********************************************************************************/ package org.eclipse.rse.core.subsystems; @@ -21,6 +22,7 @@ import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.core.model.IPropertySet; +import org.eclipse.rse.core.model.IPropertySetContainer; import org.eclipse.rse.core.model.IRSEPersistableContainer; public abstract class AbstractDelegatingConnectorService implements IDelegatingConnectorService @@ -811,4 +813,15 @@ return result; } + /** + * @since 3.2 + */ + public void clonePropertySets(IPropertySetContainer targetContainer) { + IConnectorService connectorService = getRealConnectorService(); + if (connectorService != null) { + connectorService.clonePropertySets(targetContainer); + } + } + + } Index: src/org/eclipse/rse/internal/core/model/SystemHostPool.java =================================================================== RCS file: /cvsroot/tools/org.eclipse.tm.rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemHostPool.java,v retrieving revision 1.9 diff -u -r1.9 SystemHostPool.java --- src/org/eclipse/rse/internal/core/model/SystemHostPool.java 11 Jan 2011 14:54:47 -0000 1.9 +++ src/org/eclipse/rse/internal/core/model/SystemHostPool.java 1 Mar 2011 21:48:08 -0000 @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved. + * Copyright (c) 2002, 2011 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -22,6 +22,7 @@ * Martin Oberhuber (Wind River) - [206742] Make SystemHostPool thread-safe * David Dykstal (IBM) - [210537] removed exception signaling from this class to match the interface * Tom Hochstein (Freescale) - [301075] Host copy doesn't copy contained property sets + * David McKnight (IBM) - [338510] "Copy Connection" operation deletes the registered property set in the original connection ********************************************************************************/ package org.eclipse.rse.internal.core.model; @@ -38,9 +39,6 @@ import org.eclipse.rse.core.RSEPreferencesManager; import org.eclipse.rse.core.model.Host; import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.IProperty; -import org.eclipse.rse.core.model.IPropertySet; -import org.eclipse.rse.core.model.IPropertySetContainer; import org.eclipse.rse.core.model.IRSEPersistableContainer; import org.eclipse.rse.core.model.ISystemHostPool; import org.eclipse.rse.core.model.ISystemProfile; @@ -410,33 +408,11 @@ conn.getHostName(), conn.getDescription(), conn.getLocalDefaultUserId(), IRSEUserIdConstants.USERID_LOCATION_HOST); // Copy all properties as well. - clonePropertySets(copy, conn.getPropertySets()); + conn.clonePropertySets(copy); return copy; } - - /** - * Make copies of a list of property sets and add them to the specified container. - * Each property set may contain its own list of property sets, so the - * method is recursive. - * @param container - * @param propertySets - */ - private static void clonePropertySets(IPropertySetContainer container, IPropertySet[] propertySets) { - if (propertySets == null) { - return; - } - for (int i = 0, n = propertySets.length; i < n; ++i) { - IPropertySet fromSet = propertySets[i]; - IPropertySet copySet = container.createPropertySet(fromSet.getName(), fromSet.getDescription()); - String[] fromKeys = fromSet.getPropertyKeys(); - for (int i2 = 0, n2 = fromKeys.length; i2 < n2; ++i2) { - IProperty fromProperty = fromSet.getProperty(fromKeys[i2]); - copySet.addProperty(fromProperty.getKey(), fromProperty.getValue(), fromProperty.getType()); - } - clonePropertySets(copySet, fromSet.getPropertySets()); - } - } - + + /* * (non-Javadoc) * @see org.eclipse.rse.core.model.ISystemHostPool#moveHosts(org.eclipse.rse.core.model.IHost[], int) #P org.eclipse.rse.ui Index: subsystems/org/eclipse/rse/core/subsystems/SubSystemConfiguration.java =================================================================== RCS file: /cvsroot/tools/org.eclipse.tm.rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystemConfiguration.java,v retrieving revision 1.83 diff -u -r1.83 SubSystemConfiguration.java --- subsystems/org/eclipse/rse/core/subsystems/SubSystemConfiguration.java 30 Oct 2008 19:09:23 -0000 1.83 +++ subsystems/org/eclipse/rse/core/subsystems/SubSystemConfiguration.java 1 Mar 2011 21:48:10 -0000 @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved. + * Copyright (c) 2002, 2011 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -37,6 +37,7 @@ * Martin Oberhuber (Wind River) - [226574][api] Add ISubSystemConfiguration#supportsEncoding() * David Dykstal (IBM) - [236516] Bug in user code causes failure in RSE initialization * Martin Oberhuber (Wind River) - [218309] ConcurrentModificationException during workbench startup + * David McKnight (IBM) - [338510] "Copy Connection" operation deletes the registered property set in the original connection ********************************************************************************/ package org.eclipse.rse.core.subsystems; @@ -66,6 +67,9 @@ import org.eclipse.rse.core.filters.ISystemFilterString; import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.core.model.ILabeledObject; +import org.eclipse.rse.core.model.IProperty; +import org.eclipse.rse.core.model.IPropertySet; +import org.eclipse.rse.core.model.IPropertySetContainer; import org.eclipse.rse.core.model.IRSEPersistableContainer; import org.eclipse.rse.core.model.ISubSystemConfigurator; import org.eclipse.rse.core.model.ISystemProfile; @@ -1057,6 +1061,7 @@ } return subsys; } + /** * Clone a given subsystem into the given connection. * Called when user does a copy-connection action. @@ -1076,7 +1081,9 @@ internalInitializeNewSubSystem(subsys, newConnection); // copy common data subsys.setName(oldSubsystem.getName()); // just in case it was changed - subsys.addPropertySets(oldSubsystem.getPropertySets()); + + oldSubsystem.clonePropertySets(subsys); + subsys.setHidden(oldSubsystem.isHidden());