}
return true;
}
protected Transferable createTransferable(JComponent c, int action) {
SpreadSheet spreadSheet=getSpreadSheet(c);
if (spreadSheet==null) return null;
ArrayList nodes=(ArrayList)spreadSheet.getSelectedNodes().clone();
ArrayList fields=spreadSheet.getSelectedFields();
boolean nodeSelection=(fields==null);
if (fields==null) fields=spreadSheet.getSelectableFields();
if (action==TransferHandler.COPY){
if (nodeSelection){
SpreadSheet.SpreadSheetAction a=getNodeListCopyAction().getSpreadSheetAction();
a.execute(nodes);
}
return new NodeListTransferable(nodes,fields,spreadSheet,spreadSheet.getSelectedRows(),spreadSheet.getSelectedColumns(),nodeSelection);
}else if (action==TransferHandler.MOVE){//cut
if (nodeSelection){
SpreadSheet.SpreadSheetAction a=((nodeSelection)?getNodeListCutAction():getNodeListCopyAction()).getSpreadSheetAction();
for (Iterator i=nodes.iterator();i.hasNext();) {
Node node=(Node)i.next();
final boolean[] okForAll=new boolean[]{false};
if (!transformSubprojectBranches(node,spreadSheet.getCache().getModel().getDataFactory(),new Predicate(){
public boolean evaluate(Object arg0) {
if (okForAll[0]) return true;
Node parent=(Node)arg0;
boolean r=Alert.okCancel( Messages.getString("Message.subprojectCut") );
if (r) okForAll[0]=true;
return r;
}
})) return null;
}
a.execute(nodes);
}
return new NodeListTransferable(nodes,fields,spreadSheet,spreadSheet.getSelectedRows(),spreadSheet.getSelectedColumns(),nodeSelection);
} else return null;
}