Example usage for org.eclipse.jdt.core IJavaProject getPath

List of usage examples for org.eclipse.jdt.core IJavaProject getPath

Introduction

In this page you can find the example usage for org.eclipse.jdt.core IJavaProject getPath.

Prototype

IPath getPath();

Source Link

Document

Returns the path to the innermost resource enclosing this element.

Usage

From source file:org.eclipse.objectteams.otdt.test.builder.OTEquinoxBuilderTests.java

License:Open Source License

public void testForcedExportTrac154() throws CoreException, IOException {
    IJavaProject trac154b1 = fileManager.setUpJavaProject("Trac154b1");
    env.addProject(trac154b1.getProject());
    IJavaProject trac154b2 = fileManager.setUpJavaProject("Trac154b2");
    env.addProject(trac154b2.getProject());
    IJavaProject trac154a = fileManager.setUpJavaProject("Trac154a");
    env.addProject(trac154a.getProject());
    fullBuild();// ww  w  . j  a  va 2 s  .co m
    expectingNoProblemsFor(trac154b1.getPath());
    expectingNoProblemsFor(trac154b2.getPath());
    expectingOnlySpecificProblemsFor(trac154a.getPath(),
            new Problem[] {
                    getDecapsulationProblem(trac154a, "trac154b1.actions.SampleAction", "aspect/MyTeam.java",
                            29, 59),
                    getDecapsulationProblem(trac154a, "trac154b1.actions.SampleAction", "aspect/MyTeam.java",
                            118, 130) });
}

From source file:org.eclipse.objectteams.otdt.test.builder.OTEquinoxBuilderTests.java

License:Open Source License

public void testBaseImportNoAspectBinding() throws CoreException, IOException {
    IJavaProject trac18b = fileManager.setUpJavaProject("Trac18b");
    env.addProject(trac18b.getProject());
    IJavaProject aspectPlugin = fileManager.setUpJavaProject("MissingAspectBinding");
    aspectPlugin.setOption("org.eclipse.objectteams.otdt.compiler.problem.binding_conventions", "error");
    env.addProject(aspectPlugin.getProject());
    fullBuild();/*from   w w w.j  a v a 2s .  co  m*/
    expectingNoProblemsFor(trac18b.getPath());
    expectingOnlySpecificProblemsFor(aspectPlugin.getPath(), new Problem[] { new Problem("",
            "Illegal base import: no aspect binding declared for team MissingAspectBindingTeam or any nested team (OT/Equinox).",
            aspectPlugin.getPath().append(new Path("src/MissingAspectBindingTeam.java")), 12, 34,
            CategorizedProblem.CAT_CODE_STYLE, IMarker.SEVERITY_ERROR) });
    // now fix it:
    fileManager.replaceWorkspaceFile("MissingAspectBinding/plugin-corrected.xml", aspectPlugin, "plugin.xml");
    incrementalBuild();
    expectingNoProblemsFor(trac18b.getPath());
    expectingNoProblemsFor(aspectPlugin.getPath());
}

From source file:org.eclipse.objectteams.otdt.test.builder.OTEquinoxBuilderTests.java

License:Open Source License

public void testBaseImportTwoAspectBindings() throws CoreException, IOException {
    IJavaProject trac213b1 = fileManager.setUpJavaProject("Trac213b1");
    env.addProject(trac213b1.getProject());
    IJavaProject trac213b2 = fileManager.setUpJavaProject("Trac213b2");
    env.addProject(trac213b2.getProject());
    fullBuild();/*from  w  w w.  j a v  a2  s . co  m*/

    // initially only an empty team
    IJavaProject aspectPlugin = fileManager.setUpJavaProject("Trac213a");
    aspectPlugin.setOption("org.eclipse.objectteams.otdt.compiler.problem.binding_conventions", "error");
    env.addProject(aspectPlugin.getProject());
    fullBuild();

    // now add content to the team, binding to Trac213b1:
    fileManager.replaceWorkspaceFile("Trac213a/auxil/TheTeam_step1.java", aspectPlugin,
            "src/trac213a/TheTeam.java");

    incrementalBuild();
    expectingNoProblemsFor(trac213b1.getPath());
    expectingNoProblemsFor(trac213b2.getPath());
    expectingNoProblemsFor(aspectPlugin.getPath());

    // now add content to the team, binding to Trac213b2:
    fileManager.replaceWorkspaceFile("Trac213a/auxil/plugin_step2.xml", aspectPlugin, "plugin.xml");
    fileManager.replaceWorkspaceFile("Trac213a/auxil/TheTeam_step2.java", aspectPlugin,
            "src/trac213a/TheTeam.java");

    incrementalBuild();
    expectingNoProblemsFor(trac213b1.getPath());
    expectingNoProblemsFor(trac213b2.getPath());
    expectingNoProblemsFor(aspectPlugin.getPath());
}

From source file:org.eclipse.objectteams.otdt.test.builder.OTEquinoxBuilderTests.java

License:Open Source License

public void testWrongBaseImport1() throws CoreException, IOException {
    IJavaProject trac18b = fileManager.setUpJavaProject("Trac18b");
    env.addProject(trac18b.getProject());
    IJavaProject aspectPlugin = fileManager.setUpJavaProject("WrongBaseImport1");
    aspectPlugin.setOption("org.eclipse.objectteams.otdt.compiler.problem.binding_conventions", "error");
    env.addProject(aspectPlugin.getProject());
    fullBuild();/*from  w  w w.j  a va 2 s  .  co m*/
    expectingNoProblemsFor(trac18b.getPath());
    expectingOnlySpecificProblemsFor(aspectPlugin.getPath(), new Problem[] { new Problem("",
            "Illegal base import: this package is not provided by the declared base plug-in(s) Trac18b (OT/Equinox).",
            aspectPlugin.getPath().append(new Path("src/WrongBaseImportTeam1.java")), 12, 63,
            CategorizedProblem.CAT_CODE_STYLE, IMarker.SEVERITY_ERROR) });
}

From source file:org.eclipse.objectteams.otdt.test.builder.OTEquinoxBuilderTests.java

License:Open Source License

public void testWrongBaseImport2() throws CoreException, IOException {
    IJavaProject trac18b = fileManager.setUpJavaProject("Trac18b");
    env.addProject(trac18b.getProject());
    IJavaProject aspectPlugin = fileManager.setUpJavaProject("WrongBaseImport2");
    aspectPlugin.setOption("org.eclipse.objectteams.otdt.compiler.problem.binding_conventions", "error");
    env.addProject(aspectPlugin.getProject());
    fullBuild();//from  w w  w .  j a  v a 2s.co m
    expectingNoProblemsFor(trac18b.getPath());
    expectingOnlySpecificProblemsFor(aspectPlugin.getPath(), new Problem[] { new Problem("",
            "Illegal base import: this package is not provided by the declared base plug-in org.eclipse.objectteams.otequinox but by plug-in Trac18b (OT/Equinox).",
            aspectPlugin.getPath().append(new Path("src/WrongBaseImportTeam2.java")), 12, 34,
            CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR) });
}

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 w w .  j a v a 2s.c  o  m
    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();/*w  w w .j  av  a  2 s . 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();/*w ww .  j  a v a2s .  c  o m*/
    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 .ja  v  a 2s .c  om*/
    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();// www .  j a va2s. c  om
    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());
}