mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-03 14:25:37 +02:00
[252708] using compareStrings() for more robust string compare
This commit is contained in:
parent
e927d71167
commit
763d194c23
1 changed files with 11 additions and 5 deletions
|
@ -101,16 +101,22 @@ public class SystemConnectionPropertyPage extends SystemBasePropertyPage
|
|||
}
|
||||
|
||||
private boolean hasConnectionChanged(IHost conn){
|
||||
|
||||
if (!conn.getName().equals(form.getConnectionName()) ||
|
||||
!conn.getHostName().equals(form.getHostName()) ||
|
||||
!conn.getDescription().equals(form.getConnectionDescription()) ||
|
||||
!conn.getDefaultUserId().equals(form.getDefaultUserId())){
|
||||
if (!compareStrings(conn.getName(), form.getConnectionName()) ||
|
||||
!compareStrings(conn.getHostName(), form.getHostName()) ||
|
||||
!compareStrings(conn.getDescription(), form.getConnectionDescription()) ||
|
||||
!compareStrings(conn.getDefaultUserId(), form.getDefaultUserId())){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean compareStrings(String str1, String str2){
|
||||
if (str1 == null || str1.length() == 0)
|
||||
return (str2 == null || str2.length() == 0);
|
||||
else
|
||||
return (str2 == null || str2.length() == 0) ? false: str1.equals(str2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by parent when user presses OK
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue