/* * XmlConvertAction.java * Copyright (C) 2005 Amin Ahmad. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Amin Ahmad can be contacted at amin.ahmad@gmail.com or on the web at * www.ahmadsoft.org. */ package org.ahmadsoft.foprocessor.popup.actions; import org.ahmadsoft.foprocessor.ui.dialogs.RenderProgress; import org.apache.fop.apps.MimeConstants; import org.eclipse.jface.action.IAction; import org.eclipse.jface.viewers.ISelection; import org.eclipse.ui.IActionDelegate; import org.eclipse.ui.IObjectActionDelegate; import org.eclipse.ui.IWorkbenchPart; /** * XML conversion support for XSL-FO documents. * @author Amin Ahmad */ public class XmlConvertAction implements IObjectActionDelegate { private IWorkbenchPart targetPart; private ISelection selection; /** * Constructor for Action1. */ public XmlConvertAction() { super(); } /** * @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart) */ public void setActivePart(IAction action, IWorkbenchPart targetPart) { this.targetPart = targetPart; } /** * @see IActionDelegate#run(IAction) */ public void run(IAction action) { RenderProgress rp = new RenderProgress( targetPart.getSite().getShell(), ActionUtils.asRenderSpecs(MimeConstants.MIME_FOP_AREA_TREE, "xml.area-tree", selection)); rp.setBlockOnOpen(false); rp.open(); rp.beginRendering(); } /** * @see IActionDelegate#selectionChanged(IAction, ISelection) */ public void selectionChanged(IAction action, ISelection selection) { this.selection = selection; } }