1 7 package com.bull.eclipse.jonas.actions.rar; 8 9 15 16 import java.io.File ; 17 18 import org.eclipse.core.resources.IFolder; 19 import org.eclipse.core.resources.IResource; 20 import org.eclipse.jdt.internal.ui.JavaPlugin; 21 import org.eclipse.swt.widgets.FileDialog; 22 23 import com.bull.eclipse.jonas.actions.JonasFolderAbstractActionDelegate; 24 import com.bull.eclipse.jonas.utils.FileUtil; 25 26 public class AddResourceRarActionDelegate extends JonasFolderAbstractActionDelegate { 27 28 static String pathFilter = null; 29 static String [] filter = {"*.jar"}; 30 31 32 public boolean doActionOn(IFolder fold) throws Exception { 33 FileDialog id = new FileDialog( 34 JavaPlugin.getActiveWorkbenchShell()); 35 if (pathFilter != null) 36 id.setFilterPath(pathFilter); 37 id.setFilterExtensions(filter); 38 id.open(); 39 String fileName = id.getFileName(); 40 if ((fileName == null) || (fileName.equals(""))) 41 return false; 42 pathFilter = id.getFilterPath(); 43 File raDir = fold.getParent().getProject().getLocation().append("resourceAdapter").toFile(); 44 FileUtil.copy(new File (pathFilter + File.separator + fileName), new File (fold.getLocation() + File.separator + fileName)); 45 fold.getParent().getProject().refreshLocal( IResource.DEPTH_INFINITE, null ); 46 47 return false; 48 } 49 50 51 } 52 | Popular Tags |