Example usage for org.eclipse.jdt.core JavaCore PUBLIC

List of usage examples for org.eclipse.jdt.core JavaCore PUBLIC

Introduction

In this page you can find the example usage for org.eclipse.jdt.core JavaCore PUBLIC.

Prototype

String PUBLIC

To view the source code for org.eclipse.jdt.core JavaCore PUBLIC.

Click Source Link

Document

Configurable option value: .

Usage

From source file:org.eclipse.jst.j2ee.internal.project.WTPJETEmitter.java

License:Open Source License

/**
 * @param progressMonitor//ww w.j  a v a  2s  .c om
 * @param project
 * @param javaProject
 * @throws CoreException
 * @throws JavaModelException
 * @throws BackingStoreException 
 */
protected void initializeJavaProject(IProgressMonitor progressMonitor, final IProject project,
        IJavaProject javaProject) throws CoreException, JavaModelException, BackingStoreException {
    progressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_JETInitializingProject_message", //$NON-NLS-1$
            new Object[] { project.getName() }));
    IClasspathEntry classpathEntry = JavaCore.newSourceEntry(new Path("/" + project.getName() + "/src")); //$NON-NLS-1$ //$NON-NLS-2$

    //IClasspathEntry jreClasspathEntry = JavaCore.newVariableEntry(new Path(JavaRuntime.JRELIB_VARIABLE), new Path(JavaRuntime.JRESRC_VARIABLE), new Path(JavaRuntime.JRESRCROOT_VARIABLE));
    IClasspathEntry jreClasspathEntry = JavaRuntime.getDefaultJREContainerEntry();

    List classpath = new ArrayList();
    classpath.add(classpathEntry);
    classpath.add(jreClasspathEntry);
    classpath.addAll(classpathEntries);

    IFolder sourceFolder = project.getFolder(new Path("src")); //$NON-NLS-1$
    if (!sourceFolder.exists()) {
        sourceFolder.create(false, true, new SubProgressMonitor(progressMonitor, 1));
    }
    IFolder runtimeFolder = project.getFolder(new Path("runtime")); //$NON-NLS-1$
    if (!runtimeFolder.exists()) {
        runtimeFolder.create(false, true, new SubProgressMonitor(progressMonitor, 1));
    }

    IClasspathEntry[] classpathEntryArray = (IClasspathEntry[]) classpath
            .toArray(new IClasspathEntry[classpath.size()]);

    javaProject.setRawClasspath(classpathEntryArray, new SubProgressMonitor(progressMonitor, 1));

    javaProject.setOutputLocation(new Path("/" + project.getName() + "/runtime"), //$NON-NLS-1$//$NON-NLS-2$
            new SubProgressMonitor(progressMonitor, 1));

    // appended from previous implementation
    createClasspathEntries(project);

    IScopeContext context = new ProjectScope(project);
    IEclipsePreferences prefs = context.getNode(JavaCore.PLUGIN_ID);
    prefs.put(JavaCore.COMPILER_PB_RAW_TYPE_REFERENCE, JavaCore.IGNORE);
    prefs.put(JavaCore.COMPILER_PB_UNCHECKED_TYPE_OPERATION, JavaCore.IGNORE);

    // set Java compiler compliance level to 1.5
    prefs.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5);
    prefs.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_5);
    prefs.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5);
    prefs.put(JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaCore.ERROR);
    prefs.put(JavaCore.COMPILER_PB_ENUM_IDENTIFIER, JavaCore.ERROR);

    // set Javadoc validation to the default ignore level
    prefs.put(JavaCore.COMPILER_PB_INVALID_JAVADOC, JavaCore.IGNORE);
    prefs.put(JavaCore.COMPILER_PB_INVALID_JAVADOC_TAGS, JavaCore.DISABLED);
    prefs.put(JavaCore.COMPILER_PB_INVALID_JAVADOC_TAGS__DEPRECATED_REF, JavaCore.DISABLED);
    prefs.put(JavaCore.COMPILER_PB_INVALID_JAVADOC_TAGS__NOT_VISIBLE_REF, JavaCore.DISABLED);
    prefs.put(JavaCore.COMPILER_PB_INVALID_JAVADOC_TAGS_VISIBILITY, JavaCore.PUBLIC);
    prefs.put(JavaCore.COMPILER_PB_MISSING_JAVADOC_TAG_DESCRIPTION,
            JavaCore.COMPILER_PB_MISSING_JAVADOC_TAG_DESCRIPTION_RETURN_TAG);
    prefs.put(JavaCore.COMPILER_PB_MISSING_JAVADOC_TAGS, JavaCore.IGNORE);
    prefs.put(JavaCore.COMPILER_PB_MISSING_JAVADOC_TAGS_VISIBILITY, JavaCore.PUBLIC);
    prefs.put(JavaCore.COMPILER_PB_MISSING_JAVADOC_TAGS_OVERRIDING, JavaCore.DISABLED);
    prefs.put(JavaCore.COMPILER_PB_MISSING_JAVADOC_COMMENTS, JavaCore.IGNORE);
    prefs.put(JavaCore.COMPILER_PB_MISSING_JAVADOC_COMMENTS_VISIBILITY, JavaCore.PUBLIC);
    prefs.put(JavaCore.COMPILER_PB_MISSING_JAVADOC_COMMENTS_OVERRIDING, JavaCore.DISABLED);

    // store changed properties permanently
    prefs.flush();
}