List of usage examples for org.eclipse.jdt.internal.core UserLibraryClasspathContainerInitializer initialize
@Override
public void initialize(IPath containerPath, IJavaProject project) throws CoreException
From source file:org.eclipse.ajdt.ui.tests.builder.BuildPathTests.java
License:Open Source License
public void testInpath() throws Exception { // create container IPath containerPath = new Path("org.eclipse.jdt.USER_LIBRARY/Aspect_Path_Lib"); //$NON-NLS-1$ IJavaProject inpathJProj = JavaCore.create(hasInpath); IClasspathContainer containerHint = new IClasspathContainer() { public IPath getPath() { return new Path("org.eclipse.jdt.USER_LIBRARY/Aspect_Path_Lib"); //$NON-NLS-1$ }/*from w w w. j a v a 2 s . com*/ public int getKind() { return IClasspathContainer.K_APPLICATION; } public String getDescription() { return ""; //$NON-NLS-1$ } public IClasspathEntry[] getClasspathEntries() { return new IClasspathEntry[] { JavaCore.newLibraryEntry(containerProj.getLocation().append("container.jar"), null, null) }; //$NON-NLS-1$ } }; UserLibraryClasspathContainerInitializer initializer = new UserLibraryClasspathContainerInitializer(); initializer.initialize(containerPath, inpathJProj); initializer.requestClasspathContainerUpdate(containerPath, inpathJProj, containerHint); waitForJobsToComplete(); hasInpath.getProject().build(IncrementalProjectBuilder.FULL_BUILD, null); waitForJobsToComplete(); // do launch AspectJApplicationLaunchShortcut launcher = new AspectJApplicationLaunchShortcut(); launcher.launch(openFileInAspectJEditor(hasInpath.getFile("src/aspects/AdviseClassOnInpath.aj"), true), //$NON-NLS-1$ ILaunchManager.RUN_MODE); waitForJobsToComplete(); String console = getConsoleViewContents(); String exp = "advised container!"; //$NON-NLS-1$ assertTrue("Did not find expected string '" + exp + "' in console output:\n" + console, //$NON-NLS-1$//$NON-NLS-2$ console.indexOf(exp) != -1); exp = "advised project!";//$NON-NLS-1$ assertTrue("Did not find expected string '" + exp + "' in console output:\n" + console, //$NON-NLS-1$//$NON-NLS-2$ console.indexOf(exp) != -1); exp = "advised variable!";//$NON-NLS-1$ assertTrue("Did not find expected string '" + exp + "' in console output:\n" + console, //$NON-NLS-1$//$NON-NLS-2$ console.indexOf(exp) != -1); exp = "advised jar!";//$NON-NLS-1$ assertTrue("Did not find expected string '" + exp + "' in console output:\n" + console, //$NON-NLS-1$//$NON-NLS-2$ console.indexOf(exp) != -1); }
From source file:org.eclipse.ajdt.ui.tests.builder.BuildPathTests.java
License:Open Source License
public void testAspectPath() throws Exception { // Ignore these tests on Linux because not passing if (System.getProperty("os.name").equals("Linux")) { return;/*from w w w. java 2 s . co m*/ } // create container IPath containerPath = new Path("org.eclipse.jdt.USER_LIBRARY/Aspect_Path_Lib"); //$NON-NLS-1$ IJavaProject aspectpathJProj = JavaCore.create(hasAspectpath); IClasspathContainer containerHint = new IClasspathContainer() { public IPath getPath() { return new Path("org.eclipse.jdt.USER_LIBRARY/Aspect_Path_Lib"); //$NON-NLS-1$ } public int getKind() { return IClasspathContainer.K_APPLICATION; } public String getDescription() { return ""; //$NON-NLS-1$ } public IClasspathEntry[] getClasspathEntries() { return new IClasspathEntry[] { JavaCore.newLibraryEntry(containerProj.getLocation().append("container.jar"), null, null) }; //$NON-NLS-1$ } }; UserLibraryClasspathContainerInitializer initializer = new UserLibraryClasspathContainerInitializer(); initializer.initialize(containerPath, aspectpathJProj); initializer.requestClasspathContainerUpdate(containerPath, aspectpathJProj, containerHint); waitForJobsToComplete(); hasAspectpath.getProject().build(IncrementalProjectBuilder.FULL_BUILD, null); // do launch AspectJApplicationLaunchShortcut launcher = new AspectJApplicationLaunchShortcut(); launcher.launch(openFileInAspectJEditor(hasAspectpath.getFile("src/main/Main.java"), true), //$NON-NLS-1$ ILaunchManager.RUN_MODE); waitForJobsToComplete(); String console = getConsoleViewContents(); String exp = "from project aspect"; //$NON-NLS-1$ assertTrue("Did not find expected string '" + exp + "' in console output:\n" + console, //$NON-NLS-1$//$NON-NLS-2$ console.indexOf(exp) != -1); exp = "from jar aspect"; //$NON-NLS-1$ assertTrue("Did not find expected string '" + exp + "' in console output:\n" + console, //$NON-NLS-1$//$NON-NLS-2$ console.indexOf(exp) != -1); exp = "from variable aspect"; //$NON-NLS-1$ assertTrue("Did not find expected string '" + exp + "' in console output:\n" + console, //$NON-NLS-1$//$NON-NLS-2$ console.indexOf(exp) != -1); exp = "from container aspect"; //$NON-NLS-1$ assertTrue("Did not find expected string '" + exp + "' in console output:\n" + console, //$NON-NLS-1$//$NON-NLS-2$ console.indexOf(exp) != -1); }