Lines 14-19
Link Here
|
14 |
* Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core |
14 |
* Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core |
15 |
* Martin Oberhuber (Wind River) - [186128][refactoring] Move IProgressMonitor last in public base classes |
15 |
* Martin Oberhuber (Wind River) - [186128][refactoring] Move IProgressMonitor last in public base classes |
16 |
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry |
16 |
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry |
|
|
17 |
* Kevin Doyle (IBM) - [198007] Moving multiple folders allows moving to themselves |
17 |
********************************************************************************/ |
18 |
********************************************************************************/ |
18 |
|
19 |
|
19 |
package org.eclipse.rse.internal.files.ui.actions; |
20 |
package org.eclipse.rse.internal.files.ui.actions; |
Lines 117-147
Link Here
|
117 |
*/ |
118 |
*/ |
118 |
public SystemMessage isValid(IHost selectedConnection, Object[] selectedObjects, ISystemRemoteElementAdapter[] remoteAdaptersForSelectedObjects) |
119 |
public SystemMessage isValid(IHost selectedConnection, Object[] selectedObjects, ISystemRemoteElementAdapter[] remoteAdaptersForSelectedObjects) |
119 |
{ |
120 |
{ |
120 |
//if (selectedConnection != sourceConnection) {} // someday, but can't happen today. |
121 |
//if (selectedConnection != sourceConnection) {} // someday, but can't happen today. |
|
|
122 |
IRemoteFile[] files = getSelectedFiles(); |
121 |
Object selectedObject = selectedObjects[0]; |
123 |
Object selectedObject = selectedObjects[0]; |
122 |
if (!(selectedObject instanceof IRemoteFile)) |
124 |
if (!(selectedObject instanceof IRemoteFile) || files == null) |
123 |
return null; |
125 |
return null; |
124 |
IRemoteFile selectedFolder = (IRemoteFile)selectedObject; |
126 |
IRemoteFile selectedFolder = (IRemoteFile)selectedObject; |
125 |
if (selectedFolder.getAbsolutePath().equals(firstSelectionParent.getAbsolutePath())) |
127 |
String selectedFolderPath = selectedFolder.getAbsolutePath(); |
126 |
{ |
128 |
|
127 |
if (targetEqualsSrcMsg == null) |
129 |
for (int i = 0; i < files.length; i++) { |
128 |
targetEqualsSrcMsg = RSEUIPlugin.getPluginMessage(ISystemMessages.FILEMSG_MOVE_TARGET_EQUALS_SOURCE); |
130 |
IRemoteFile selectedFile = files[i]; |
129 |
return targetEqualsSrcMsg; |
131 |
if (selectedFile != null && selectedFile.getParentRemoteFile() != null) { |
130 |
} |
132 |
IRemoteFile selectedParentFile = selectedFile.getParentRemoteFile(); |
131 |
else if (selectedFolder.getAbsolutePath().equals(firstSelection.getAbsolutePath())) |
133 |
|
132 |
{ |
134 |
if (selectedFolderPath.equals(selectedParentFile.getAbsolutePath())) |
133 |
if (targetEqualsSrcMsg == null) |
135 |
{ |
134 |
targetEqualsSrcMsg = RSEUIPlugin.getPluginMessage(ISystemMessages.FILEMSG_MOVE_TARGET_EQUALS_SOURCE); // todo: different msg |
136 |
if (targetEqualsSrcMsg == null) |
135 |
return targetEqualsSrcMsg; |
137 |
targetEqualsSrcMsg = RSEUIPlugin.getPluginMessage(ISystemMessages.FILEMSG_MOVE_TARGET_EQUALS_SOURCE); |
136 |
} |
138 |
return targetEqualsSrcMsg; |
137 |
else if (selectedFolder.isDescendantOf(firstSelection)) |
139 |
} |
138 |
{ |
140 |
else if (selectedFolderPath.equals(selectedFile.getAbsolutePath())) |
139 |
if (targetDescendsFromSrcMsg == null) |
141 |
{ |
140 |
targetDescendsFromSrcMsg = RSEUIPlugin.getPluginMessage(ISystemMessages.FILEMSG_MOVE_TARGET_DESCENDS_FROM_SOURCE); |
142 |
if (targetEqualsSrcMsg == null) |
141 |
return targetDescendsFromSrcMsg; |
143 |
targetEqualsSrcMsg = RSEUIPlugin.getPluginMessage(ISystemMessages.FILEMSG_MOVE_TARGET_EQUALS_SOURCE); // todo: different msg |
142 |
} |
144 |
return targetEqualsSrcMsg; |
143 |
else |
145 |
} |
144 |
return null; |
146 |
else if (selectedFolder.isDescendantOf(selectedFile)) |
|
|
147 |
{ |
148 |
if (targetDescendsFromSrcMsg == null) |
149 |
targetDescendsFromSrcMsg = RSEUIPlugin.getPluginMessage(ISystemMessages.FILEMSG_MOVE_TARGET_DESCENDS_FROM_SOURCE); |
150 |
return targetDescendsFromSrcMsg; |
151 |
} |
152 |
} |
153 |
} |
154 |
return null; |
145 |
} |
155 |
} |
146 |
|
156 |
|
147 |
/** |
157 |
/** |