KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > bull > eclipse > jonas > actions > rar > AddResourceRarActionDelegate


1 /*
2  * Created on 2 juin 2003
3  *
4  * To change the template for this generated file go to
5  * Window>Preferences>Java>Code Generation>Code and Comments
6  */

7 package com.bull.eclipse.jonas.actions.rar;
8
9 /**
10  * @author Emmanuel RIAS
11  *
12  * To change the template for this generated type comment go to
13  * Window>Preferences>Java>Code Generation>Code and Comments
14  */

15
16 import java.io.File JavaDoc;
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 JavaDoc pathFilter = null;
29     static String JavaDoc[] filter = {"*.jar"};
30     
31     
32     public boolean doActionOn(IFolder fold) throws Exception JavaDoc {
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 JavaDoc fileName = id.getFileName();
40         if ((fileName == null) || (fileName.equals("")))
41             return false;
42         pathFilter = id.getFilterPath();
43         File JavaDoc raDir = fold.getParent().getProject().getLocation().append("resourceAdapter").toFile();
44         FileUtil.copy(new File JavaDoc(pathFilter + File.separator + fileName), new File JavaDoc(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