}
private SelectionListenerAction createWorkbenchAction(
IStructuredSelection selection) {
List<?> list = selection.toList();
SelectionListenerAction action = null;
if (fShell == null) {
fShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell();
}
if (list.size() == 0
|| list.get(0) instanceof IProject
|| (list.get(0) instanceof IAdaptable && ((IAdaptable) list
.get(0)).getAdapter(IResource.class) instanceof IProject)) {
action = new PHPMoveProjectAction(fShell);
action.selectionChanged(selection);
} else if (selectedResources != null) {
action = new MoveResourceAction(fShell);
if (list.size() == 1) {
Object object = list.get(0);
if (object instanceof ElementImplForPhp
&& ((ElementImplForPhp) object).getModelElement() != null) {
IResource resource = ((ElementImplForPhp) object)
.getModelElement().getResource();
if (resource != null) {
selection = new StructuredSelection(resource);
}
}
}
// don't open the move dialog, resource could be moved directly
// using the drop target
if (target != null && directMove(selection) == true) {
return null;
}
action.selectionChanged(selection);
}
return action;
}