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
|
@ -173,9 +173,24 @@ public class SystemCopyToClipboardAction extends SystemBaseAction implements IV
|
|||
textStream.append(getTextTransferAppend(dragObject, adapter));
|
||||
|
||||
if (adapter.canDrag(dragObject))
|
||||
{
|
||||
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
|
||||
ISubSystem subSystem = adapter.getSubSystem(dragObject);
|
||||
subSystem = adapter.getSubSystem(dragObject);
|
||||
String subSystemId = registry.getAbsoluteNameForSubSystem(subSystem);
|
||||
|
||||
dataStream.append(subSystemId);
|
||||
|
@ -200,7 +215,7 @@ public class SystemCopyToClipboardAction extends SystemBaseAction implements IV
|
|||
fileNames.add(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -234,8 +249,15 @@ public class SystemCopyToClipboardAction extends SystemBaseAction implements IV
|
|||
ft[i] = (String) fileNames.get(i);
|
||||
}
|
||||
|
||||
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