private IJavaProject xtendProject(final String name, final IJavaProject... upstreamProjects) {
   try {
     final IJavaProject result = JavaProjectSetupUtil.createJavaProject(name);
     IProject _project = result.getProject();
     IResourcesSetupUtil.addNature(_project, XtextProjectHelper.NATURE_ID);
     this.xtendLibs.addLibsToClasspath(result, null);
     final Procedure1<IJavaProject> _function =
         new Procedure1<IJavaProject>() {
           @Override
           public void apply(final IJavaProject it) {
             try {
               IPath _path = it.getPath();
               IClasspathEntry _newProjectEntry = JavaCore.newProjectEntry(_path, true);
               JavaProjectSetupUtil.addToClasspath(result, _newProjectEntry);
             } catch (Throwable _e) {
               throw Exceptions.sneakyThrow(_e);
             }
           }
         };
     IterableExtensions.<IJavaProject>forEach(
         ((Iterable<IJavaProject>) Conversions.doWrapArray(upstreamProjects)), _function);
     return result;
   } catch (Throwable _e) {
     throw Exceptions.sneakyThrow(_e);
   }
 }
Пример #2
0
 @Override
 public void setUp() throws Exception {
   super.setUp();
   IJavaProject project = JavaProjectSetupUtil.createJavaProject(TEST_PROJECT);
   addNature(project.getProject(), XtextProjectHelper.NATURE_ID);
   Injector injector = Activator.getInstance().getInjector(getEditorId());
   injector.injectMembers(this);
   IFile fooFile =
       IResourcesSetupUtil.createFile(TEST_PROJECT + "/foo.refactoringtestlanguage", "foo");
   IFile barFile =
       IResourcesSetupUtil.createFile(
           TEST_PROJECT + "/bar.refactoringtestlanguage", "bar { ref foo }");
   waitForAutoBuild();
   fooEditor = openEditor(fooFile);
   barEditor = openEditor(barFile);
   assertTrue(refactoringPreferences.useInlineRefactoring());
 }
 public void createJavaProjectWithXtextNature() {
   try {
     IJavaProject _createJavaProject = JavaProjectSetupUtil.createJavaProject(this.TEST_PROJECT);
     final Procedure1<IJavaProject> _function =
         new Procedure1<IJavaProject>() {
           public void apply(final IJavaProject it) {
             try {
               IProject _project = it.getProject();
               IResourcesSetupUtil.addNature(_project, XtextProjectHelper.NATURE_ID);
               JavaProjectSetupUtil.addSourceFolder(it, "entities-gen");
             } catch (Throwable _e) {
               throw Exceptions.sneakyThrow(_e);
             }
           }
         };
     ObjectExtensions.<IJavaProject>operator_doubleArrow(_createJavaProject, _function);
   } catch (Throwable _e) {
     throw Exceptions.sneakyThrow(_e);
   }
 }