Lines 31-36
Link Here
|
31 |
* Martin Oberhuber (Wind River) - [189123] Move renameSubSystemProfile() from UI to Core |
31 |
* Martin Oberhuber (Wind River) - [189123] Move renameSubSystemProfile() from UI to Core |
32 |
* Martin Oberhuber (Wind River) - [175680] Deprecate obsolete ISystemRegistry methods |
32 |
* Martin Oberhuber (Wind River) - [175680] Deprecate obsolete ISystemRegistry methods |
33 |
* Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core |
33 |
* Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core |
|
|
34 |
* Xuan Chen (IBM) - [194838] Move the code for comparing two objects by absolute name to a common location |
34 |
********************************************************************************/ |
35 |
********************************************************************************/ |
35 |
|
36 |
|
36 |
package org.eclipse.rse.ui.internal.model; |
37 |
package org.eclipse.rse.ui.internal.model; |
Lines 40-45
Link Here
|
40 |
import java.util.List; |
41 |
import java.util.List; |
41 |
import java.util.Vector; |
42 |
import java.util.Vector; |
42 |
|
43 |
|
|
|
44 |
import org.eclipse.core.runtime.IAdaptable; |
43 |
import org.eclipse.core.runtime.IProgressMonitor; |
45 |
import org.eclipse.core.runtime.IProgressMonitor; |
44 |
import org.eclipse.core.runtime.Platform; |
46 |
import org.eclipse.core.runtime.Platform; |
45 |
import org.eclipse.core.runtime.jobs.ISchedulingRule; |
47 |
import org.eclipse.core.runtime.jobs.ISchedulingRule; |
Lines 79-84
Link Here
|
79 |
import org.eclipse.rse.core.subsystems.ISubSystem; |
81 |
import org.eclipse.rse.core.subsystems.ISubSystem; |
80 |
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; |
82 |
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; |
81 |
import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy; |
83 |
import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy; |
|
|
84 |
import org.eclipse.rse.core.subsystems.ISystemDragDropAdapter; |
82 |
import org.eclipse.rse.internal.core.filters.SystemFilterStartHere; |
85 |
import org.eclipse.rse.internal.core.filters.SystemFilterStartHere; |
83 |
import org.eclipse.rse.internal.core.model.SystemHostPool; |
86 |
import org.eclipse.rse.internal.core.model.SystemHostPool; |
84 |
import org.eclipse.rse.internal.core.model.SystemModelChangeEvent; |
87 |
import org.eclipse.rse.internal.core.model.SystemModelChangeEvent; |
Lines 1027-1032
Link Here
|
1027 |
dataStream.append(factoryId); |
1030 |
dataStream.append(factoryId); |
1028 |
return dataStream.toString(); |
1031 |
return dataStream.toString(); |
1029 |
} |
1032 |
} |
|
|
1033 |
|
1034 |
/** |
1035 |
* Check if two objects refers to the same system object by comparing it absoluteName with its subsystem id. |
1036 |
* |
1037 |
* @param firstObject the first object to compare |
1038 |
* @param firstObjectFullName the full name of the firstObject. If null, get the full name from the firstObject |
1039 |
* @param secondObject the second object to compare |
1040 |
* @param secondObjectFullName the full name of the secondObject. If null, get the full name from the secondObject |
1041 |
*/ |
1042 |
public boolean isSameObjectByAbsoluteName(Object firstObject, String firstObjectFullName, Object secondObject, String secondObjectFullName) |
1043 |
{ |
1044 |
if (firstObject == secondObject) |
1045 |
{ |
1046 |
return true; |
1047 |
} |
1048 |
String firstObjectAbsoluteNameWithSubSystemId = null; |
1049 |
|
1050 |
//Simply doing comparason of if two object is equal is not enough |
1051 |
//If two different objects, but if their absoluate path (with subsystem id) |
1052 |
//are the same, they refer to the same remote object. |
1053 |
|
1054 |
if(firstObject instanceof IAdaptable) |
1055 |
{ |
1056 |
ISystemDragDropAdapter adapter = null; |
1057 |
|
1058 |
adapter = (ISystemDragDropAdapter)((IAdaptable)firstObject).getAdapter(ISystemDragDropAdapter.class); |
1059 |
|
1060 |
if (adapter != null ) { |
1061 |
// first need to check subsystems |
1062 |
ISubSystem subSystem = adapter.getSubSystem(firstObject); |
1063 |
String subSystemId = getAbsoluteNameForSubSystem(subSystem); |
1064 |
if (firstObjectFullName != null) |
1065 |
{ |
1066 |
firstObjectAbsoluteNameWithSubSystemId = subSystemId + ":" + firstObjectFullName; //$NON-NLS-1$ |
1067 |
} |
1068 |
else |
1069 |
{ |
1070 |
String absolutePath = adapter.getAbsoluteName(firstObject); |
1071 |
firstObjectAbsoluteNameWithSubSystemId = subSystemId + ":" + absolutePath; //$NON-NLS-1$ |
1072 |
} |
1073 |
|
1074 |
} |
1075 |
} |
1076 |
|
1077 |
|
1078 |
String secondObjectAbsoluteNameWithSubSystemId = null; |
1079 |
if(secondObject instanceof IAdaptable) |
1080 |
{ |
1081 |
ISystemDragDropAdapter adapter = null; |
1082 |
|
1083 |
adapter = (ISystemDragDropAdapter)((IAdaptable)secondObject).getAdapter(ISystemDragDropAdapter.class); |
1084 |
|
1085 |
if (adapter != null ) { |
1086 |
// first need to check subsystems |
1087 |
ISubSystem subSystem = adapter.getSubSystem(secondObject); |
1088 |
String subSystemId = getAbsoluteNameForSubSystem(subSystem); |
1089 |
if (secondObjectFullName != null) |
1090 |
{ |
1091 |
secondObjectAbsoluteNameWithSubSystemId = subSystemId + ":" + secondObjectFullName; //$NON-NLS-1$ |
1092 |
} |
1093 |
else |
1094 |
{ |
1095 |
String absolutePath = adapter.getAbsoluteName(secondObject); |
1096 |
secondObjectAbsoluteNameWithSubSystemId = subSystemId + ":" + absolutePath; //$NON-NLS-1$ |
1097 |
} |
1098 |
|
1099 |
} |
1100 |
} |
1101 |
|
1102 |
if (firstObjectAbsoluteNameWithSubSystemId != null && firstObjectAbsoluteNameWithSubSystemId.equals(secondObjectAbsoluteNameWithSubSystemId)) |
1103 |
{ |
1104 |
return true; |
1105 |
} |
1106 |
|
1107 |
return false; |
1108 |
} |
1030 |
|
1109 |
|
1031 |
/* |
1110 |
/* |
1032 |
* (non-Javadoc) |
1111 |
* (non-Javadoc) |