mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-03 07:05:24 +02:00
[187737] need to account for hosts in copy and paste actions
This commit is contained in:
parent
5c025fd25d
commit
8ccaf101ec
2 changed files with 61 additions and 27 deletions
|
@ -174,33 +174,48 @@ public class SystemCopyToClipboardAction extends SystemBaseAction implements IV
|
|||
|
||||
if (adapter.canDrag(dragObject))
|
||||
{
|
||||
// get the subsystem id
|
||||
ISubSystem subSystem = adapter.getSubSystem(dragObject);
|
||||
String subSystemId = registry.getAbsoluteNameForSubSystem(subSystem);
|
||||
|
||||
dataStream.append(subSystemId);
|
||||
dataStream.append(":"); //$NON-NLS-1$
|
||||
|
||||
String objectId = adapter.getAbsoluteName(dragObject);
|
||||
dataStream.append(objectId);
|
||||
|
||||
if (iterator.hasNext())
|
||||
{
|
||||
dataStream.append(SystemViewDataDropAdapter.RESOURCE_SEPARATOR);
|
||||
}
|
||||
|
||||
if (_doResourceTransfer)
|
||||
{
|
||||
IResource resource = getResource((IAdaptable)dragObject);
|
||||
if (resource != null)
|
||||
ISubSystem subSystem = null;
|
||||
if (dragObject instanceof ISubSystem)
|
||||
{
|
||||
subSystem = (ISubSystem)dragObject;
|
||||
String subSystemId = RSECorePlugin.getTheSystemRegistry().getAbsoluteNameForSubSystem(subSystem);
|
||||
dataStream.append(subSystemId);
|
||||
}
|
||||
else if (dragObject instanceof IHost)
|
||||
{
|
||||
IHost connection = (IHost)dragObject;
|
||||
String connectionId = RSECorePlugin.getTheSystemRegistry().getAbsoluteNameForConnection(connection);
|
||||
dataStream.append(connectionId);
|
||||
}
|
||||
else
|
||||
{
|
||||
// get the subsystem id
|
||||
subSystem = adapter.getSubSystem(dragObject);
|
||||
String subSystemId = registry.getAbsoluteNameForSubSystem(subSystem);
|
||||
|
||||
dataStream.append(subSystemId);
|
||||
dataStream.append(":"); //$NON-NLS-1$
|
||||
|
||||
String objectId = adapter.getAbsoluteName(dragObject);
|
||||
dataStream.append(objectId);
|
||||
|
||||
if (iterator.hasNext())
|
||||
{
|
||||
resources.add(resource);
|
||||
|
||||
String fileName = resource.getLocation().toOSString();
|
||||
fileNames.add(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
dataStream.append(SystemViewDataDropAdapter.RESOURCE_SEPARATOR);
|
||||
}
|
||||
|
||||
if (_doResourceTransfer)
|
||||
{
|
||||
IResource resource = getResource((IAdaptable)dragObject);
|
||||
if (resource != null)
|
||||
{
|
||||
resources.add(resource);
|
||||
|
||||
String fileName = resource.getLocation().toOSString();
|
||||
fileNames.add(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -234,7 +249,14 @@ public class SystemCopyToClipboardAction extends SystemBaseAction implements IV
|
|||
ft[i] = (String) fileNames.get(i);
|
||||
}
|
||||
|
||||
_clipboard.setContents(new Object[] { data, ft, textStream.toString() }, new Transfer[] { PluginTransfer.getInstance(), FileTransfer.getInstance(), TextTransfer.getInstance()});
|
||||
if (ft.length > 0)
|
||||
{
|
||||
_clipboard.setContents(new Object[] { data, ft, textStream.toString() }, new Transfer[] { PluginTransfer.getInstance(), FileTransfer.getInstance(), TextTransfer.getInstance()});
|
||||
}
|
||||
else
|
||||
{
|
||||
_clipboard.setContents(new Object[] { data, textStream.toString() }, new Transfer[] { PluginTransfer.getInstance(), TextTransfer.getInstance()});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1985,6 +1985,18 @@ public class SystemRegistry implements ISystemRegistry, ISystemRegistryUI, ISyst
|
|||
{
|
||||
// first extract subsystem id
|
||||
int connectionDelim = str.indexOf(":"); //$NON-NLS-1$
|
||||
if (connectionDelim == -1) // not subsystem, therefore likely to be a connection
|
||||
{
|
||||
int profileDelim = str.indexOf("."); //$NON-NLS-1$
|
||||
if (profileDelim != -1)
|
||||
{
|
||||
String profileId = str.substring(0, profileDelim);
|
||||
String connectionId = str.substring(profileDelim + 1, str.length());
|
||||
ISystemProfile profile = registry.getSystemProfile(profileId);
|
||||
return registry.getHost(profile, connectionId);
|
||||
}
|
||||
}
|
||||
|
||||
int subsystemDelim = str.indexOf(":", connectionDelim + 1); //$NON-NLS-1$
|
||||
|
||||
String subSystemId = str.substring(0, subsystemDelim);
|
||||
|
|
Loading…
Add table
Reference in a new issue