mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-20 06:35:50 +02:00
equals for RemoteFile - fix for 148981
This commit is contained in:
parent
c927f205ba
commit
011424ad46
1 changed files with 21 additions and 3 deletions
|
@ -1098,9 +1098,9 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable
|
||||||
{
|
{
|
||||||
if (rule instanceof RemoteFile)
|
if (rule instanceof RemoteFile)
|
||||||
{
|
{
|
||||||
String otherPath = ((RemoteFile) rule).getAbsolutePath();
|
String otherPath = ((RemoteFile)rule).getAbsolutePath();
|
||||||
String path = this.getAbsolutePath();
|
String path = this.getAbsolutePath();
|
||||||
String otherHost = ((RemoteFile) rule).getHostName();
|
String otherHost = ((RemoteFile)rule).getHostName();
|
||||||
return getHostName().equals(otherHost) && path.startsWith(otherPath) || otherPath.startsWith(path);
|
return getHostName().equals(otherHost) && path.startsWith(otherPath) || otherPath.startsWith(path);
|
||||||
}
|
}
|
||||||
else if (rule instanceof RemoteFileSchedulingRule)
|
else if (rule instanceof RemoteFileSchedulingRule)
|
||||||
|
@ -1116,6 +1116,24 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean equals(Object otherObj)
|
||||||
|
{
|
||||||
|
if (otherObj instanceof RemoteFile)
|
||||||
|
{
|
||||||
|
RemoteFile other = (RemoteFile)otherObj;
|
||||||
|
if (this == other) return true;
|
||||||
|
|
||||||
|
String otherPath = other.getAbsolutePath();
|
||||||
|
String path = this.getAbsolutePath();
|
||||||
|
String otherHost = other.getHostName();
|
||||||
|
return getHostName().equals(otherHost) && path.equals(otherPath) || otherPath.equals(path);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String getHostName()
|
public String getHostName()
|
||||||
{
|
{
|
||||||
return getSystemConnection().getHostName();
|
return getSystemConnection().getHostName();
|
||||||
|
|
Loading…
Add table
Reference in a new issue