Example usage for org.eclipse.jdt.internal.compiler.util SuffixConstants EXTENSION_class

List of usage examples for org.eclipse.jdt.internal.compiler.util SuffixConstants EXTENSION_class

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.util SuffixConstants EXTENSION_class.

Prototype

String EXTENSION_class

To view the source code for org.eclipse.jdt.internal.compiler.util SuffixConstants EXTENSION_class.

Click Source Link

Usage

From source file:net.sf.j2s.core.builder.AbstractImageBuilder.java

License:Open Source License

protected char[] writeClassFile(ClassFile classFile, SourceFile compilationUnit, boolean isTopLevelType)
        throws CoreException {
    String fileName = new String(classFile.fileName()); // the qualified type name "p1/p2/A"
    IPath filePath = new Path(fileName);
    IContainer outputFolder = compilationUnit.sourceLocation.binaryFolder;
    IContainer container = outputFolder;
    if (filePath.segmentCount() > 1) {
        container = createFolder(filePath.removeLastSegments(1), outputFolder);
        filePath = new Path(filePath.lastSegment());
    }/* w ww .  jav a 2  s. c  o m*/

    IFile file = container.getFile(filePath.addFileExtension(SuffixConstants.EXTENSION_class));
    writeClassFileContents(classFile, file, fileName, isTopLevelType, compilationUnit);
    // answer the name of the class file as in Y or Y$M
    return filePath.lastSegment().toCharArray();
}

From source file:net.sf.j2s.core.builder.IncrementalImageBuilder.java

License:Open Source License

protected void removeClassFile(IPath typePath, IContainer outputFolder) throws CoreException {
    if (typePath.lastSegment().indexOf('$') == -1) { // is not a nested type
        this.newState.removeQualifiedTypeName(typePath.toString());
        // add dependents even when the type thinks it does not exist to be on the safe side
        if (JavaBuilder.DEBUG)
            System.out.println("Found removed type " + typePath); //$NON-NLS-1$
        addDependentsOf(typePath, true); // when member types are removed, their enclosing type is structurally changed
    }//  w w w.  j a  v  a  2 s.c om
    IFile classFile = outputFolder.getFile(typePath.addFileExtension(SuffixConstants.EXTENSION_class));
    if (classFile.exists()) {
        if (JavaBuilder.DEBUG)
            System.out.println("Deleting class file of removed type " + typePath); //$NON-NLS-1$
        classFile.delete(IResource.FORCE, null);
    }
}