]> git.uio.no Git - ifi-stolz-refaktor.git/blob - case-study/jdt-before/ui/org/eclipse/jdt/internal/ui/jarpackagerfat/FatJarBuilder.java
Case Study: adding data and statistics
[ifi-stolz-refaktor.git] / case-study / jdt-before / ui / org / eclipse / jdt / internal / ui / jarpackagerfat / FatJarBuilder.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2011 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 83258 [jar exporter] Deploy java application as executable jar
11  *     Ferenc Hechler <ferenc_hechler@users.sourceforge.net> - [jar application] add Jar-in-Jar ClassLoader option - https://bugs.eclipse.org/bugs/show_bug.cgi?id=219530
12  *******************************************************************************/
13 package org.eclipse.jdt.internal.ui.jarpackagerfat;
14
15 import java.io.File;
16
17 import org.eclipse.swt.widgets.Shell;
18
19 import org.eclipse.core.runtime.CoreException;
20 import org.eclipse.core.runtime.IPath;
21 import org.eclipse.core.runtime.MultiStatus;
22
23 import org.eclipse.core.resources.IFile;
24
25 import org.eclipse.jdt.ui.jarpackager.IJarBuilderExtension;
26 import org.eclipse.jdt.ui.jarpackager.JarPackageData;
27
28 import org.eclipse.jdt.internal.ui.jarpackager.JarBuilder;
29
30 /**
31  * A builder which is able to handle referenced libraries.
32  * 
33  * @since 3.4
34  */
35 public abstract class FatJarBuilder extends JarBuilder implements IJarBuilderExtension {
36
37         private JarPackageData fJarPackage;
38         private JarWriter4 fJarWriter;
39
40         protected JarWriter4 getJarWriter() {
41                 return fJarWriter;
42         }
43
44         public abstract boolean isRemoveSigners();
45
46         public abstract boolean isMergeManifests();
47
48         public abstract String getManifestClasspath();
49
50         /**
51          * {@inheritDoc}
52          */
53         @Override
54         public void open(JarPackageData jarPackage, Shell displayShell, MultiStatus status) throws CoreException {
55                 super.open(jarPackage, displayShell, status);
56                 fJarPackage= jarPackage;
57                 fJarWriter= new JarWriter4(fJarPackage, displayShell);
58         }
59
60         /**
61          * {@inheritDoc}
62          */
63         public void writeFile(IFile resource, IPath destinationPath) throws CoreException {
64                 fJarWriter.write(resource, destinationPath);
65         }
66
67         public void writeFile(File file, IPath destinationPath) throws CoreException {
68                 fJarWriter.write(file, destinationPath);
69         }
70
71         /**
72          * {@inheritDoc}
73          */
74         public void close() throws CoreException {
75                 if (fJarWriter != null) {
76                         fJarWriter.close();
77                 }
78         }
79
80 }