mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-28 11:25:35 +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))
|
if (adapter.canDrag(dragObject))
|
||||||
{
|
{
|
||||||
// get the subsystem id
|
ISubSystem subSystem = null;
|
||||||
ISubSystem subSystem = adapter.getSubSystem(dragObject);
|
if (dragObject instanceof ISubSystem)
|
||||||
String subSystemId = registry.getAbsoluteNameForSubSystem(subSystem);
|
{
|
||||||
|
subSystem = (ISubSystem)dragObject;
|
||||||
dataStream.append(subSystemId);
|
String subSystemId = RSECorePlugin.getTheSystemRegistry().getAbsoluteNameForSubSystem(subSystem);
|
||||||
dataStream.append(":"); //$NON-NLS-1$
|
dataStream.append(subSystemId);
|
||||||
|
}
|
||||||
String objectId = adapter.getAbsoluteName(dragObject);
|
else if (dragObject instanceof IHost)
|
||||||
dataStream.append(objectId);
|
{
|
||||||
|
IHost connection = (IHost)dragObject;
|
||||||
if (iterator.hasNext())
|
String connectionId = RSECorePlugin.getTheSystemRegistry().getAbsoluteNameForConnection(connection);
|
||||||
{
|
dataStream.append(connectionId);
|
||||||
dataStream.append(SystemViewDataDropAdapter.RESOURCE_SEPARATOR);
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
if (_doResourceTransfer)
|
// get the subsystem id
|
||||||
{
|
subSystem = adapter.getSubSystem(dragObject);
|
||||||
IResource resource = getResource((IAdaptable)dragObject);
|
String subSystemId = registry.getAbsoluteNameForSubSystem(subSystem);
|
||||||
if (resource != null)
|
|
||||||
|
dataStream.append(subSystemId);
|
||||||
|
dataStream.append(":"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
String objectId = adapter.getAbsoluteName(dragObject);
|
||||||
|
dataStream.append(objectId);
|
||||||
|
|
||||||
|
if (iterator.hasNext())
|
||||||
{
|
{
|
||||||
resources.add(resource);
|
dataStream.append(SystemViewDataDropAdapter.RESOURCE_SEPARATOR);
|
||||||
|
}
|
||||||
String fileName = resource.getLocation().toOSString();
|
|
||||||
fileNames.add(fileName);
|
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);
|
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
|
// first extract subsystem id
|
||||||
int connectionDelim = str.indexOf(":"); //$NON-NLS-1$
|
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$
|
int subsystemDelim = str.indexOf(":", connectionDelim + 1); //$NON-NLS-1$
|
||||||
|
|
||||||
String subSystemId = str.substring(0, subsystemDelim);
|
String subSystemId = str.substring(0, subsystemDelim);
|
||||||
|
|
Loading…
Add table
Reference in a new issue