List of usage examples for org.eclipse.jdt.core IJavaProject setOption
void setOption(String optionName, String optionValue);
From source file:org.eclipse.objectteams.otdt.test.builder.OTEquinoxBuilderTests.java
License:Open Source License
public void testBaseImportTrac132() throws CoreException, IOException { IJavaProject trac132b = fileManager.setUpJavaProject("Trac132b"); env.addProject(trac132b.getProject()); IJavaProject aspectPlugin1 = fileManager.setUpJavaProject("Trac132a1"); aspectPlugin1.setOption("org.eclipse.objectteams.otdt.compiler.problem.binding_conventions", "error"); env.addProject(aspectPlugin1.getProject()); IJavaProject aspectPlugin2 = fileManager.setUpJavaProject("Trac132a2"); aspectPlugin2.setOption("org.eclipse.objectteams.otdt.compiler.problem.binding_conventions", "error"); env.addProject(aspectPlugin2.getProject()); fullBuild();//from w ww . j a va 2 s . c om expectingNoProblemsFor(trac132b.getPath()); expectingNoProblemsFor(aspectPlugin1.getPath()); expectingNoProblemsFor(aspectPlugin2.getPath()); }
From source file:org.eclipse.objectteams.otdt.test.builder.OTEquinoxBuilderTests.java
License:Open Source License
public void testBaseImportTrac304() throws CoreException, IOException { IJavaProject trac304b = fileManager.setUpJavaProject("Trac304b"); env.addProject(trac304b.getProject()); // the fragment: IJavaProject trac304f = fileManager.setUpJavaProject("Trac304f"); env.addProject(trac304f.getProject()); IJavaProject trac304ot = fileManager.setUpJavaProject("Trac304ot"); trac304ot.setOption("org.eclipse.objectteams.otdt.compiler.problem.binding_conventions", "error"); env.addProject(trac304ot.getProject()); fullBuild();/*ww w. j a v a 2s. c o m*/ expectingNoProblemsFor(trac304b.getPath()); expectingNoProblemsFor(trac304ot.getPath()); }
From source file:org.eclipse.objectteams.otdt.test.builder.OTEquinoxBuilderTests.java
License:Open Source License
public void testIllegalUseOfForcedExport() throws CoreException, IOException { IJavaProject trac18b = fileManager.setUpJavaProject("Trac18b"); env.addProject(trac18b.getProject()); IJavaProject aspectPlugin = fileManager.setUpJavaProject("IllegalUseOfForcedExport"); aspectPlugin.setOption("org.eclipse.objectteams.otdt.compiler.problem.binding_conventions", "error"); env.addProject(aspectPlugin.getProject()); fullBuild();/*from ww w .j a va 2 s .c om*/ expectingNoProblemsFor(trac18b.getPath()); expectingOnlySpecificProblemsFor(aspectPlugin.getPath(), new Problem[] { getIllegalUseOfForcedExportProblem(aspectPlugin, "trac18b.actions.SampleAction", 88, 100), getIllegalUseOfForcedExportProblem(aspectPlugin, "trac18b.actions.SampleAction", 7, 35) }); }
From source file:org.eclipse.objectteams.otdt.test.builder.OTEquinoxBuilderTests.java
License:Open Source License
public void testAccumulatedBases1() throws CoreException, IOException { IJavaProject project = fileManager.setUpJavaProject("AccumulatedBases"); project.setOption("org.eclipse.objectteams.otdt.compiler.problem.binding_conventions", "error"); env.addProject(project.getProject()); fullBuild();/*from w w w . j a va2 s .c o m*/ expectingNoProblemsFor(project.getPath()); fileManager.replaceWorkspaceFile("AccumulatedBases/versions/Team1.java.1", project, "src/accumulatedbases/Team1.java"); incrementalBuild(); expectingNoProblemsFor(project.getPath()); }
From source file:org.eclipse.objectteams.otdt.test.builder.OTEquinoxBuilderTests.java
License:Open Source License
public void testBaseImportTrac132_2() throws CoreException, IOException { IJavaProject trac132b = fileManager.setUpJavaProject("Trac132b"); env.addProject(trac132b.getProject()); IJavaProject aspectPlugin1 = fileManager.setUpJavaProject("Trac132a1"); aspectPlugin1.setOption("org.eclipse.objectteams.otdt.compiler.problem.binding_conventions", "error"); env.addProject(aspectPlugin1.getProject()); IJavaProject aspectPlugin2 = fileManager.setUpJavaProject("Trac132a2"); aspectPlugin2.setOption("org.eclipse.objectteams.otdt.compiler.problem.binding_conventions", "error"); env.addProject(aspectPlugin2.getProject()); fullBuild();//from ww w . jav a 2s .c o m expectingNoProblemsFor(trac132b.getPath()); expectingNoProblemsFor(aspectPlugin1.getPath()); expectingNoProblemsFor(aspectPlugin2.getPath()); // not needed. // JavaModelManager.getJavaModelManager().removePerProjectInfo((JavaProject) trac132b); // JavaModelManager.getJavaModelManager().removePerProjectInfo((JavaProject) aspectPlugin1); // JavaModelManager.getJavaModelManager().removePerProjectInfo((JavaProject) aspectPlugin2); // doesn't work see : //ResourcesPlugin.getPlugin().getBundle().stop(); //ResourcesPlugin.getPlugin().getBundle().start(); // simulate shutdown (from AbstractJavaModelTests.simulateExitRestart: env.getWorkspace().save(true, null); JavaModelManager.getJavaModelManager().shutdown(); JavaModelManager.doNotUse(); // reset the MANAGER singleton // this one is extra: also restart PDE's PluginModelManager: OTTestingEnvironment.restart(); JavaModelManager.getJavaModelManager().startup(); new JavaCorePreferenceInitializer().initializeDefaultPreferences(); env.openEmptyWorkspace(); env.setAutoBuilding(true); trac132b = JavaCore.create(reopenProject("Trac132b")); aspectPlugin1 = JavaCore.create(reopenProject("Trac132a1")); aspectPlugin2 = JavaCore.create(reopenProject("Trac132a2")); env.addClass(new Path("/Trac132a2/src"), "Dummy", "public class Dummy {}"); // trigger minimal build incrementalBuild(); expectingNoProblemsFor(trac132b.getPath()); expectingNoProblemsFor(aspectPlugin1.getPath()); expectingNoProblemsFor(aspectPlugin2.getPath()); }
From source file:org.eclipse.objectteams.otdt.test.builder.OTEquinoxBuilderTests.java
License:Open Source License
public void testAspectExport() throws CoreException, IOException { IJavaProject aeb = fileManager.setUpJavaProject("AspectExportBase"); env.addProject(aeb.getProject());//from ww w. ja v a2s .c o m IJavaProject aea = fileManager.setUpJavaProject("AspectExportAspect"); aea.setOption("org.eclipse.objectteams.otdt.compiler.problem.binding_conventions", "error"); env.addProject(aea.getProject()); fullBuild(); expectingNoProblemsFor(aeb.getPath()); expectingOnlySpecificProblemsFor(aea.getPath(), new Problem[] { getMissingAspectExportProblem(aea, "aea") }); }
From source file:org.eclipse.objectteams.otdt.tests.AbstractJavaModelTests.java
License:Open Source License
protected IJavaProject setUpJavaProject(final String projectName, String compliance) throws CoreException, IOException { // copy files in project from source workspace to target workspace String sourceWorkspacePath = getSourceWorkspacePath(); String targetWorkspacePath = getWorkspaceRoot().getLocation().toFile().getCanonicalPath(); copyDirectory(new File(sourceWorkspacePath, projectName), new File(targetWorkspacePath, projectName)); // ensure variables are set setUpJCLClasspathVariables(compliance); // create project final IProject project = getWorkspaceRoot().getProject(projectName); IWorkspaceRunnable populate = new IWorkspaceRunnable() { public void run(IProgressMonitor monitor) throws CoreException { project.create(null);// w w w. j a va 2s. c om project.open(null); } }; getWorkspace().run(populate, null); IJavaProject javaProject = JavaCore.create(project); setUpProjectCompliance(javaProject, compliance); javaProject.setOption(JavaCore.COMPILER_PB_UNUSED_LOCAL, JavaCore.IGNORE); javaProject.setOption(JavaCore.COMPILER_PB_UNUSED_PRIVATE_MEMBER, JavaCore.IGNORE); javaProject.setOption(JavaCore.COMPILER_PB_FIELD_HIDING, JavaCore.IGNORE); javaProject.setOption(JavaCore.COMPILER_PB_LOCAL_VARIABLE_HIDING, JavaCore.IGNORE); javaProject.setOption(JavaCore.COMPILER_PB_TYPE_PARAMETER_HIDING, JavaCore.IGNORE); return javaProject; }
From source file:org.eclipse.objectteams.otdt.tests.otmodel.OTReconcilerTests.java
License:Open Source License
protected IJavaProject createOTJavaProject(String projectName, String[] sourceFolders, String[] libraries, String output) throws CoreException { IJavaProject javaProject = createJavaProject(projectName, sourceFolders, libraries, output, "1.5"); IProjectDescription description = javaProject.getProject().getDescription(); description.setNatureIds(OTDTPlugin.createProjectNatures(description)); javaProject.getProject().setDescription(description, null); javaProject.setOption(CompilerOptions.OPTION_ReportWeaveIntoSystemClass, CompilerOptions.IGNORE); return javaProject; }
From source file:org.eclipse.objectteams.otdt.tests.otmodel.OTReconcilerTests.java
License:Open Source License
public void testNLSinRoFi1() throws CoreException { try {//ww w . ja v a2 s.c o m // Resources creation IJavaProject p = createOTJavaProject("P", new String[] { "" }, new String[] { "JCL15_LIB" }, "bin"); IProject project = p.getProject(); IProjectDescription prjDesc = project.getDescription(); prjDesc.setBuildSpec(OTDTPlugin.createProjectBuildCommands(prjDesc)); project.setDescription(prjDesc, null); p.setOption(JavaCore.COMPILER_PB_NON_NLS_STRING_LITERAL, JavaCore.ERROR); p.setOption(JavaCore.COMPILER_PB_UNUSED_LOCAL, JavaCore.IGNORE); OTREContainer.initializeOTJProject(project); this.createFolder("/P/MyTeam"); String roleSourceString = "team package MyTeam;\n" + "public class Role {\n" + " void foo() {\n" + " String val= \"OK\";\n" + " }\n" + "}\n"; this.createFile("/P/MyTeam/Role.java", roleSourceString); String teamSourceString = "public team class MyTeam {\n" + " Role r;\n" + "}\n"; this.createFile("/P/MyTeam.java", teamSourceString); char[] roleSourceChars = roleSourceString.toCharArray(); this.problemRequestor.initialize(roleSourceChars); getCompilationUnit("/P/MyTeam/Role.java").getWorkingCopy(this.wcOwner, null); assertProblems("Unexpected problems", "----------\n" + "1. ERROR in /P/MyTeam/Role.java (at line 4)\n" + " String val= \"OK\";\n" + " ^^^^\n" + "Non-externalized string literal; it should be followed by //$NON-NLS-<n>$\n" + "----------\n"); } finally { deleteProject("P"); } }
From source file:org.eclipse.objectteams.otdt.tests.otmodel.OTReconcilerTests.java
License:Open Source License
public void testNLSinRoFi2() throws CoreException { try {// w w w. j av a 2 s. c o m // Resources creation IJavaProject p = createOTJavaProject("P", new String[] { "" }, new String[] { "JCL15_LIB" }, "bin"); IProject project = p.getProject(); IProjectDescription prjDesc = project.getDescription(); prjDesc.setBuildSpec(OTDTPlugin.createProjectBuildCommands(prjDesc)); project.setDescription(prjDesc, null); p.setOption(JavaCore.COMPILER_PB_NON_NLS_STRING_LITERAL, JavaCore.ERROR); p.setOption(JavaCore.COMPILER_PB_UNUSED_LOCAL, JavaCore.IGNORE); OTREContainer.initializeOTJProject(project); this.createFolder("/P/MyTeam"); String roleSourceString = "team package MyTeam;\n" + "public class Role {\n" + " void foo() {\n" + " String val= \"OK\"; //$NON-NLS-1$\n" + " }\n" + "}\n"; this.createFile("/P/MyTeam/Role.java", roleSourceString); String teamSourceString = "public team class MyTeam {\n" + " Role r;\n" + "}\n"; this.createFile("/P/MyTeam.java", teamSourceString); char[] roleSourceChars = roleSourceString.toCharArray(); this.problemRequestor.initialize(roleSourceChars); getCompilationUnit("/P/MyTeam/Role.java").getWorkingCopy(this.wcOwner, null); assertProblems("Unexpected problems", "----------\n" + "----------\n"); } finally { deleteProject("P"); } }