1/* 2 * SvgConvertAction.java 3 * Copyright (C) 2005 Amin Ahmad. 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public 7 * License as published by the Free Software Foundation; either 8 * version 2.1 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public 16 * License along with this library; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 * 19 * Amin Ahmad can be contacted at amin.ahmad@gmail.com or on the web at 20 * www.ahmadsoft.org. 21 */ 22package org.ahmadsoft.foprocessor.popup.actions; 23 24import org.ahmadsoft.foprocessor.ui.dialogs.RenderProgress; 25import org.apache.fop.apps.MimeConstants; 26import org.eclipse.jface.action.IAction; 27import org.eclipse.jface.viewers.ISelection; 28import org.eclipse.ui.IActionDelegate; 29import org.eclipse.ui.IObjectActionDelegate; 30import org.eclipse.ui.IWorkbenchPart; 31 32/** 33 * SVG conversion support for XSL-FO documents. 34 * @author Amin Ahmad 35 */ 36public class SvgConvertAction implements IObjectActionDelegate { 37 38 private IWorkbenchPart targetPart; 39 private ISelection selection; 40 41 /** 42 * Constructor for Action1. 43 */ 44 public SvgConvertAction() { 45 super(); 46 } 47 48 /** 49 * @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart) 50 */ 51 public void setActivePart(IAction action, IWorkbenchPart targetPart) { 52 this.targetPart = targetPart; 53 } 54 55 /** 56 * @see IActionDelegate#run(IAction) 57 */ 58 public void run(IAction action) { 59 RenderProgress rp = new RenderProgress( 60 targetPart.getSite().getShell(), 61 ActionUtils.asRenderSpecs(MimeConstants.MIME_SVG, "svg", selection)); 62 rp.setBlockOnOpen(false); 63 rp.open(); 64 rp.beginRendering(); 65 } 66 67 /** 68 * @see IActionDelegate#selectionChanged(IAction, ISelection) 69 */ 70 public void selectionChanged(IAction action, ISelection selection) { 71 this.selection = selection; 72 } 73 74} 75 76