Example usage for org.eclipse.jdt.internal.core.util Messages element_invalidClassFileName

List of usage examples for org.eclipse.jdt.internal.core.util Messages element_invalidClassFileName

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.core.util Messages element_invalidClassFileName.

Prototype

String element_invalidClassFileName

To view the source code for org.eclipse.jdt.internal.core.util Messages element_invalidClassFileName.

Click Source Link

Usage

From source file:com.codenvy.ide.ext.java.server.internal.core.PackageFragment.java

License:Open Source License

/**
 * @see org.eclipse.jdt.core.IPackageFragment#getClassFile(String)
 * @exception IllegalArgumentException if the name does not end with ".class"
 *///from  w  ww .ja  v  a2  s. c o m
public IClassFile getClassFile(String classFileName) {
    if (!org.eclipse.jdt.internal.compiler.util.Util.isClassFileName(classFileName)) {
        throw new IllegalArgumentException(Messages.bind(Messages.element_invalidClassFileName, classFileName));
    }
    // don't hold on the .class file extension to save memory
    // also make sure to not use substring as the resulting String may hold on the underlying char[] which might be much bigger than necessary
    int length = classFileName.length() - 6;
    char[] nameWithoutExtension = new char[length];
    classFileName.getChars(0, length, nameWithoutExtension, 0);
    return new ClassFile(this, manager, new String(nameWithoutExtension));
}

From source file:org.eclipse.che.jdt.internal.core.PackageFragment.java

License:Open Source License

/**
 * @throws IllegalArgumentException//from www.  j ava 2s. c o m
 *         if the name does not end with ".class"
 * @see org.eclipse.jdt.core.IPackageFragment#getClassFile(String)
 */
public IClassFile getClassFile(String classFileName) {
    if (!org.eclipse.jdt.internal.compiler.util.Util.isClassFileName(classFileName)) {
        throw new IllegalArgumentException(Messages.bind(Messages.element_invalidClassFileName, classFileName));
    }
    // don't hold on the .class file extension to save memory
    // also make sure to not use substring as the resulting String may hold on the underlying char[] which might be much bigger than
    // necessary
    int length = classFileName.length() - 6;
    char[] nameWithoutExtension = new char[length];
    classFileName.getChars(0, length, nameWithoutExtension, 0);
    return new ClassFile(this, manager, new String(nameWithoutExtension));
}

From source file:org.eclipse.jdt.internal.core.PackageFragment.java

License:Open Source License

/**
 * @see IPackageFragment#getClassFile(String)
 * @exception IllegalArgumentException if the name does not end with ".class"
 *//* w w  w.ja  v a2s. co  m*/
public IClassFile getClassFile(String classFileName) {
    if (!org.eclipse.jdt.internal.compiler.util.Util.isClassFileName(classFileName)) {
        throw new IllegalArgumentException(Messages.bind(Messages.element_invalidClassFileName, classFileName));
    }
    // don't hold on the .class file extension to save memory
    // also make sure to not use substring as the resulting String may hold on the underlying char[] which might be much bigger than necessary
    int length = classFileName.length() - 6;
    char[] nameWithoutExtension = new char[length];
    classFileName.getChars(0, length, nameWithoutExtension, 0);
    return new ClassFile(this, new String(nameWithoutExtension));
}