[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.platform] Using JarWriter2

Hi,

I am new to Eclipse Plugin, i was trying to develop a plugin to add the selected java file to a jar file, following is the code

public void run(IAction action) {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
MessageDialog.openInformation(
shell,
"TWE_Plugin Plug-in",
"Twe Action was executed : " + getClass());
IFile[] fileToexport = {file};
JarPackageData description= new JarPackageData();
IPath location= new Path("C:/temp/myjar.jar");
description.setJarLocation(location);
description.setSaveManifest(true);
//description.setManifestMainClass(mainType);
description.setElements(fileToexport);
try
{
TweJarFileWriter jar = new TweJarFileWriter(description, shell);
jar.createJar(file);
}
catch(Exception exp)
{ System.out.println("Exp : " + exp);
exp.printStackTrace();
}
}


public class TweJarFileWriter extends JarWriter2
{
public TweJarFileWriter(JarPackageData jarPackage, Shell parent) throws CoreException
{
super(jarPackage, parent);
}


 public void createJar(IFile file) {

try
{
this.addFile(file, file.getFullPath(), new File(file.getFullPath().toOSString()));
}
catch(Exception exp)
{
System.out.println("Exp : " + exp);
exp.printStackTrace();
}
} }


When i run the pluing nothing is happening, kinldy tell me what is the issue in this code.

Thanks,
Muthu