List of usage examples for org.eclipse.jdt.core IJavaProject setOption
void setOption(String optionName, String optionValue);
From source file:org.codehaus.groovy.eclipse.refactoring.test.rename.RenameTypeTests.java
License:Open Source License
private void setSomeFieldOptions(IJavaProject project, String prefixes, String suffixes, boolean forStatic) { if (forStatic) { project.setOption(JavaCore.CODEASSIST_STATIC_FIELD_PREFIXES, prefixes); project.setOption(JavaCore.CODEASSIST_STATIC_FIELD_SUFFIXES, suffixes); } else {/*from w w w .j a v a2 s. c om*/ project.setOption(JavaCore.CODEASSIST_FIELD_PREFIXES, prefixes); project.setOption(JavaCore.CODEASSIST_FIELD_SUFFIXES, suffixes); } }
From source file:org.codehaus.groovy.eclipse.refactoring.test.rename.RenameTypeTests.java
License:Open Source License
private void setSomeLocalOptions(IJavaProject project, String prefixes, String suffixes) { project.setOption(JavaCore.CODEASSIST_LOCAL_PREFIXES, prefixes); project.setOption(JavaCore.CODEASSIST_LOCAL_SUFFIXES, suffixes); }
From source file:org.codehaus.groovy.eclipse.refactoring.test.rename.RenameTypeTests.java
License:Open Source License
private void setSomeArgumentOptions(IJavaProject project, String prefixes, String suffixes) { project.setOption(JavaCore.CODEASSIST_ARGUMENT_PREFIXES, prefixes); project.setOption(JavaCore.CODEASSIST_ARGUMENT_SUFFIXES, suffixes); }
From source file:org.eclipse.ajdt.core.tests.AJDTCoreTestCase.java
License:Open Source License
protected void setJava7SourceLevel(IJavaProject javaProject) { javaProject.setOption(CompilerOptions.OPTION_Compliance, "1.7"); javaProject.setOption(CompilerOptions.OPTION_Source, "1.7"); }
From source file:org.eclipse.ajdt.core.tests.AJDTCoreTestCase.java
License:Open Source License
protected IProject createPredefinedProject14(final String projectName) throws CoreException, IOException { IJavaProject jp = setUpJavaProject(projectName); jp.setOption("org.eclipse.jdt.core.compiler.problem.missingSerialVersion", "ignore"); //$NON-NLS-1$ //$NON-NLS-2$ jp.setOption("org.eclipse.jdt.core.compiler.source", "1.4"); //$NON-NLS-1$//$NON-NLS-2$ jp.setOption("org.eclipse.jdt.core.compiler.target", "1.4"); //$NON-NLS-1$ //$NON-NLS-2$ jp.getProject().build(IncrementalProjectBuilder.FULL_BUILD, null); return jp.getProject(); }
From source file:org.eclipse.ajdt.core.tests.AJDTCoreTestCase.java
License:Open Source License
protected IProject createPredefinedProject(final String projectName) throws CoreException, RuntimeException { IJavaProject jp; try {//from w w w . j av a 2 s . co m jp = setUpJavaProject(projectName); } catch (IOException e) { throw new RuntimeException(e); } if (jp == null) { // project was not found return null; } try { jp.setOption("org.eclipse.jdt.core.compiler.problem.missingSerialVersion", "ignore"); //$NON-NLS-1$ //$NON-NLS-2$ } catch (NullPointerException npe) { } // if not autobuilding, then test is completely in charge of building if (isAutobuilding()) { jp.getProject().build(IncrementalProjectBuilder.FULL_BUILD, null); } return jp.getProject(); }
From source file:org.eclipse.ajdt.core.tests.AJDTCoreTestCase.java
License:Open Source License
/** * Create a named project, optionally turn of some irritating options that can clog up the output and then build it *//*w w w . j av a 2 s. c om*/ protected IProject createPredefinedProject(final String projectName, boolean turnOffIrritatingOptions) throws CoreException, IOException { IJavaProject jp = setUpJavaProject(projectName); if (turnOffIrritatingOptions) { jp.setOption("org.eclipse.jdt.core.compiler.problem.missingSerialVersion", "ignore");//$NON-NLS-1$ //$NON-NLS-2$ // $NON-NLS-2$ jp.setOption("org.eclipse.jdt.core.compiler.problem.rawTypeReference", "ignore");//$NON-NLS-1$ //$NON-NLS-2$ // $NON-NLS-2$ jp.setOption("org.eclipse.jdt.core.compiler.taskTags", "");//$NON-NLS-1$ //$NON-NLS-2$ // $NON-NLS-2$ } jp.getProject().build(IncrementalProjectBuilder.FULL_BUILD, null); return jp.getProject(); }
From source file:org.eclipse.andmore.internal.project.ProjectHelper.java
License:Open Source License
/** * Checks, and fixes if needed, the compiler compliance level, and the source compatibility * level// w w w .ja v a 2 s. c o m * @param javaProject The Java project to check and fix. */ public static final void checkAndFixCompilerCompliance(IJavaProject javaProject) { Pair<Integer, String> result = checkCompilerCompliance(javaProject); if (result.getFirst().intValue() != COMPILER_COMPLIANCE_OK) { // setup the preferred compiler compliance level. javaProject.setOption(JavaCore.COMPILER_COMPLIANCE, AndmoreAndroidConstants.COMPILER_COMPLIANCE_PREFERRED); javaProject.setOption(JavaCore.COMPILER_SOURCE, AndmoreAndroidConstants.COMPILER_COMPLIANCE_PREFERRED); javaProject.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, AndmoreAndroidConstants.COMPILER_COMPLIANCE_PREFERRED); // clean the project to make sure we recompile try { javaProject.getProject().build(IncrementalProjectBuilder.CLEAN_BUILD, new NullProgressMonitor()); } catch (CoreException e) { AndmoreAndroidPlugin.printErrorToConsole(javaProject.getProject(), "Project compiler settings changed. Clean your project."); } } }
From source file:org.eclipse.buildship.core.workspace.internal.JavaSourceSettingsUpdater.java
License:Open Source License
private static boolean updateJavaProjectOptionIfNeeded(IJavaProject project, String optionKey, String newValue) {//from w w w . j a v a 2 s . c om String currentValue = project.getOption(optionKey, true); if (currentValue == null || !currentValue.equals(newValue)) { project.setOption(optionKey, newValue); return true; } else { return false; } }
From source file:org.eclipse.che.jdt.rest.CompilerSetupService.java
License:Open Source License
@POST @Path("/set") @Consumes(APPLICATION_JSON)//from w w w . java2 s .c o m public void setParameters(@QueryParam("projectpath") String projectPath, @NotNull Map<String, String> changedParameters) { IJavaProject project = JAVA_MODEL.getJavaProject(projectPath); for (Map.Entry<String, String> entry : changedParameters.entrySet()) { String optionId = entry.getKey(); String value = entry.getValue(); project.setOption(optionId, value); } }