[jboss-cvs] jbosside/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/types ...
Robert Stryker
rob.stryker at jboss.com
Fri Apr 20 19:44:56 EDT 2007
User: rawb
Date: 07/04/20 19:44:56
Added: core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/types
JARArchiveType.java
Removed: core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/types
JARPackageType.java
Log:
It Compiles! Not sure on if it *works* yet
Revision Changes Path
1.1 date: 2007/04/20 23:44:56; author: rawb; state: Exp;jbosside/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/types/JARArchiveType.java
Index: JARArchiveType.java
===================================================================
package org.jboss.ide.eclipse.archives.core.model.types;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.jboss.ide.eclipse.archives.core.Trace;
import org.jboss.ide.eclipse.archives.core.model.IArchive;
import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveFileSetImpl;
import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveImpl;
/**
* The default JAR package type will simply jar-up all the classes in a java project's output directory, and place it in the top-level of the project.
* The name of the resulting JAR will be the project's name followed by a ".jar" extension.
* @author Marshall
*/
public class JARArchiveType extends AbstractArchiveType {
public static final String TYPE_ID = "jar";
public IArchive createDefaultConfiguration(IProject project, IProgressMonitor monitor) {
//IPackageType t = this;
Assert.isNotNull(project);
IJavaProject javaProject = JavaCore.create(project);
Assert.isNotNull(javaProject);
if (monitor == null) monitor = new NullProgressMonitor();
monitor.beginTask("Creating default JAR configuration for java project \"" + project.getName() + "\"", 2);
IPath outputPath;
try {
outputPath = javaProject.getOutputLocation();
} catch (JavaModelException e) {
Trace.trace(JARArchiveType.class, e);
return null;
}
outputPath = outputPath.removeFirstSegments(1);
IContainer outputContainer = project.getFolder(outputPath);
IArchive jar = new ArchiveImpl();
jar.setDestinationPath(project.getLocation(), true);
jar.setExploded(false);
jar.setName(project.getName() + ".jar");
//jar.setPackageType(this);
IArchiveFileSet classes = new ArchiveFileSetImpl();
classes.setIncludesPattern("**/*");
classes.setSourcePath(outputContainer.getLocation());
jar.addChild(classes);
monitor.worked(1);
monitor.done();
return jar;
}
}
More information about the jboss-cvs-commits
mailing list