final GWTJahiaNode selectedNode = linker.getSelectionContext().getSingleSelection();
if (selectedNode != null) {
linker.loading(Messages.get("label.content.unpublishing", "Unpublishing"));
GWTJahiaWorkflowInfo workflowInfo = selectedNode.getWorkflowInfo();
if (workflowInfo != null) {
final GWTJahiaWorkflowDefinition workflowDefinition = workflowInfo.getPossibleWorkflows().get(
new GWTJahiaWorkflowType("unpublish"));
final List<String> uuids = new ArrayList<String>();
List<GWTJahiaNode> jahiaNodes = linker.getSelectionContext().getMultipleSelection();
if (jahiaNodes.size() > 1) {
for (GWTJahiaNode jahiaNode : jahiaNodes) {
uuids.add(jahiaNode.getUUID());
}
} else {
uuids.add(selectedNode.getUUID());
}
linker.loading(Messages.get("label.gettingPublicationInfo", "Getting publication information"));
JahiaContentManagementService.App.getInstance().getPublicationInfo(uuids, true, true, new BaseAsyncCallback<List<GWTJahiaPublicationInfo>>() {
public void onSuccess(List<GWTJahiaPublicationInfo> result) {
linker.loaded();
EngineContainer container;
if (linker instanceof ManagerLinker) {
container = new EngineWindow();
} else {
container = new EnginePanel();
}
EngineContainer cards = new EngineCards(container, linker);
new WorkflowActionDialog(selectedNode.getPath(), Messages.getWithArgs("label.workflow.start.message",
"{0} started by {1} on {2} - {3} content items involved",
new Object[]{workflowDefinition.getDisplayName(),JahiaGWTParameters.getCurrentUser(), DateTimeFormat.getFormat(
DateTimeFormat.PredefinedFormat.DATE_TIME_SHORT).format(new Date()),result.size()})
, workflowDefinition, linker,
new UnpublicationWorkflow(result), cards);
cards.showEngine();
}