org.eclipse.xtext.ui.util.JREContainerProvider Java Examples
The following examples show how to use
org.eclipse.xtext.ui.util.JREContainerProvider.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Bug330096Test.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
protected IProject createPluginProject(String name) throws CoreException { Injector injector = TestlanguagesActivator.getInstance().getInjector("org.eclipse.xtext.testlanguages.backtracking.SimpleBeeLangTestLanguage"); PluginProjectFactory projectFactory = injector.getInstance(PluginProjectFactory.class); projectFactory.setProjectName(name); projectFactory.setBreeToUse(JREContainerProvider.PREFERRED_BREE); projectFactory.addFolders(Collections.singletonList("src")); projectFactory.addBuilderIds( JavaCore.BUILDER_ID, "org.eclipse.pde.ManifestBuilder", "org.eclipse.pde.SchemaBuilder", XtextProjectHelper.BUILDER_ID); projectFactory.addProjectNatures(JavaCore.NATURE_ID, "org.eclipse.pde.PluginNature", XtextProjectHelper.NATURE_ID); IProject result = projectFactory.createProject(new NullProgressMonitor(), null); JavaProjectSetupUtil.setUnixLineEndings(result); return result; }
Example #2
Source File: SameClassNamesTest.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
public IProject createPluginProject(final String name, final String... requiredBundles) throws CoreException { final PluginProjectFactory projectFactory = this.projectFactoryProvider.get(); projectFactory.setProjectName(name); projectFactory.setBreeToUse(JREContainerProvider.PREFERRED_BREE); projectFactory.addFolders(Collections.<String>singletonList("src")); projectFactory.addBuilderIds( XtextProjectHelper.BUILDER_ID, JavaCore.BUILDER_ID, "org.eclipse.pde.ManifestBuilder", "org.eclipse.pde.SchemaBuilder"); projectFactory.addProjectNatures( XtextProjectHelper.NATURE_ID, JavaCore.NATURE_ID, "org.eclipse.pde.PluginNature"); projectFactory.addRequiredBundles(((List<String>)Conversions.doWrapArray(requiredBundles))); projectFactory.addExportedPackages(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("com.acme"))); NullProgressMonitor _nullProgressMonitor = new NullProgressMonitor(); final IProject result = projectFactory.createProject(_nullProgressMonitor, null); final IJavaProject javaProject = JavaCore.create(result); WorkbenchTestHelper.makeCompliantFor(javaProject, JavaVersion.JAVA8); JavaProjectSetupUtil.addJreClasspathEntry(javaProject); return result; }
Example #3
Source File: ContentAssistTest.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
public static IProject createPluginProject(String name) throws CoreException { Injector injector = XtendActivator.getInstance().getInjector("org.eclipse.xtend.core.Xtend"); PluginProjectFactory projectFactory = injector.getInstance(PluginProjectFactory.class); projectFactory.setBreeToUse(JREContainerProvider.PREFERRED_BREE); projectFactory.setProjectName(name); projectFactory.setProjectDefaultCharset(StandardCharsets.ISO_8859_1.name()); projectFactory.addFolders(Collections.singletonList("src")); projectFactory.addBuilderIds( JavaCore.BUILDER_ID, "org.eclipse.pde.ManifestBuilder", "org.eclipse.pde.SchemaBuilder", XtextProjectHelper.BUILDER_ID); projectFactory.addProjectNatures(JavaCore.NATURE_ID, "org.eclipse.pde.PluginNature", XtextProjectHelper.NATURE_ID); projectFactory.addRequiredBundles(Lists.newArrayList( "org.eclipse.xtext.xbase.lib", "org.eclipse.xtend.lib")); IProject result = projectFactory.createProject(new NullProgressMonitor(), null); JavaProjectSetupUtil.makeJava8Compliant(JavaCore.create(result)); return result; }
Example #4
Source File: AbstractXbaseUITestCase.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
public static IProject createPluginProject(String name) throws CoreException { Injector injector = XbaseActivator.getInstance().getInjector("org.eclipse.xtext.xbase.Xbase"); PluginProjectFactory projectFactory = injector.getInstance(PluginProjectFactory.class); projectFactory.setProjectName(name); projectFactory.setBreeToUse(JREContainerProvider.PREFERRED_BREE); projectFactory.addFolders(Collections.singletonList("src")); projectFactory.addBuilderIds( JavaCore.BUILDER_ID, "org.eclipse.pde.ManifestBuilder", "org.eclipse.pde.SchemaBuilder", XtextProjectHelper.BUILDER_ID); projectFactory.addProjectNatures(JavaCore.NATURE_ID, "org.eclipse.pde.PluginNature", XtextProjectHelper.NATURE_ID); projectFactory.addRequiredBundles(Collections.singletonList("org.eclipse.xtext.xbase.lib")); IProject result = projectFactory.createProject(new NullProgressMonitor(), null); JavaProjectSetupUtil.makeJava8Compliant(JavaCore.create(result)); JavaProjectSetupUtil.setUnixLineEndings(result); return result; }
Example #5
Source File: DisabledBuilderTest.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
private IProject createPluginProject(String name, boolean addBuilder, String dependency) throws CoreException { PluginProjectFactory projectFactory = projectFactoryProvider.get(); projectFactory.setProjectName(name); projectFactory.setBreeToUse(JREContainerProvider.PREFERRED_BREE); projectFactory.addFolders(Collections.singletonList("src")); projectFactory.addBuilderIds(JavaCore.BUILDER_ID, "org.eclipse.pde.ManifestBuilder", "org.eclipse.pde.SchemaBuilder"); if (addBuilder) { projectFactory.addBuilderIds(XtextProjectHelper.BUILDER_ID); } projectFactory.addProjectNatures(JavaCore.NATURE_ID, "org.eclipse.pde.PluginNature", XtextProjectHelper.NATURE_ID); projectFactory.addRequiredBundles(Collections.singletonList("org.eclipse.emf.ecore")); if(dependency != null) projectFactory.addRequiredBundles(Collections.singletonList(dependency)); IProject result = projectFactory.createProject(new NullProgressMonitor(), null); return result; }
Example #6
Source File: AbstractSarlUiTest.java From sarl with Apache License 2.0 | 5 votes |
@Override public void addJreClasspathEntry(IJavaProject javaProject) throws JavaModelException { IClasspathEntry existingJreContainerClasspathEntry = JREContainerProvider.getJREContainerEntry(javaProject); if (existingJreContainerClasspathEntry == null) { addToClasspath(javaProject, JREContainerProvider.getDefaultJREContainerEntry()); } }
Example #7
Source File: AutoEditTest.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
protected IProject createPluginProject(String name) throws CoreException { Injector injector = org.eclipse.xtext.ui.tests.internal.TestsActivator.getInstance().getInjector("org.eclipse.xtext.ui.tests.editor.bracketmatching.BmTestLanguage"); PluginProjectFactory projectFactory = injector.getInstance(PluginProjectFactory.class); projectFactory.setBreeToUse(JREContainerProvider.PREFERRED_BREE); projectFactory.setProjectName(name); projectFactory.addFolders(Collections.singletonList("src")); projectFactory.addBuilderIds(XtextProjectHelper.BUILDER_ID); projectFactory.addProjectNatures(XtextProjectHelper.NATURE_ID); IProject result = projectFactory.createProject(new NullProgressMonitor(), null); JavaProjectSetupUtil.setUnixLineEndings(result); return result; }
Example #8
Source File: WorkbenchTestHelper.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
private static String getBree(JavaVersion javaVersion) { if (javaVersion == null) { return JREContainerProvider.PREFERRED_BREE; } else { return javaVersion.getBree(); } }
Example #9
Source File: AutoEditTest.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
protected IProject createPluginProject(String name) throws CoreException { final IProject[] result = new IProject[1]; IWorkspaceRunnable creatorTask = new IWorkspaceRunnable() { @Override public void run(IProgressMonitor monitor) throws CoreException { Injector injector = XtendActivator.getInstance().getInjector("org.eclipse.xtend.core.Xtend"); PluginProjectFactory projectFactory = injector.getInstance(PluginProjectFactory.class); projectFactory.setBreeToUse(JREContainerProvider.PREFERRED_BREE); projectFactory.setProjectName(name); projectFactory.setProjectDefaultCharset(StandardCharsets.ISO_8859_1.name()); projectFactory.addFolders(Collections.singletonList("src")); projectFactory.addBuilderIds( JavaCore.BUILDER_ID, "org.eclipse.pde.ManifestBuilder", "org.eclipse.pde.SchemaBuilder", XtextProjectHelper.BUILDER_ID); projectFactory.addProjectNatures(JavaCore.NATURE_ID, "org.eclipse.pde.PluginNature", XtextProjectHelper.NATURE_ID); projectFactory.addRequiredBundles(newArrayList("org.eclipse.xtext.xbase.lib")); IProject project = projectFactory.createProject(new NullProgressMonitor(), null); JavaProjectSetupUtil.setUnixLineEndings(project); result[0] = project; } }; ResourcesPlugin.getWorkspace().run(creatorTask, new NullProgressMonitor()); return result[0]; }
Example #10
Source File: JavaProjectSetupUtil.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
/** * @since 2.17 */ public static void addJreClasspathEntry(IJavaProject javaProject, boolean build) throws JavaModelException { // init default mappings makeJava7Default(); IClasspathEntry existingJreContainerClasspathEntry = getJreContainerClasspathEntry(javaProject); if (existingJreContainerClasspathEntry == null) { addToClasspath(javaProject, JREContainerProvider.getDefaultJREContainerEntry(), build); } }
Example #11
Source File: JavaProjectSetupUtil.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
public static void addJreClasspathEntry(IJavaProject javaProject) throws JavaModelException { // init default mappings makeJava7Default(); IClasspathEntry existingJreContainerClasspathEntry = getJreContainerClasspathEntry(javaProject); if (existingJreContainerClasspathEntry == null) { addToClasspath(javaProject, JREContainerProvider.getDefaultJREContainerEntry()); } }
Example #12
Source File: BuilderPerformanceTest.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
private IProject createPluginProject(String name, String... bundleDependencies) throws CoreException { projectFactory.setProjectName(name); projectFactory.setBreeToUse(JREContainerProvider.PREFERRED_BREE); projectFactory.addFolders(Collections.singletonList("src")); projectFactory.addBuilderIds(JavaCore.BUILDER_ID, "org.eclipse.pde.ManifestBuilder", "org.eclipse.pde.SchemaBuilder"); projectFactory.addProjectNatures(JavaCore.NATURE_ID, "org.eclipse.pde.PluginNature"); projectFactory.addRequiredBundles(Arrays.asList(bundleDependencies)); IProject result = projectFactory.createProject(new NullProgressMonitor(), null); return result; }
Example #13
Source File: Bug334456Test.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
private IProject createPluginProject(String name) throws CoreException { PluginProjectFactory projectFactory = projectFactoryProvider.get(); projectFactory.setProjectName(name); projectFactory.setBreeToUse(JREContainerProvider.PREFERRED_BREE); projectFactory.addFolders(Collections.singletonList("src")); projectFactory.addBuilderIds( JavaCore.BUILDER_ID, "org.eclipse.pde.ManifestBuilder", "org.eclipse.pde.SchemaBuilder", XtextProjectHelper.BUILDER_ID); projectFactory.addProjectNatures(JavaCore.NATURE_ID, "org.eclipse.pde.PluginNature", XtextProjectHelper.NATURE_ID); projectFactory.addRequiredBundles(Collections.singletonList("org.eclipse.xtext")); IProject result = projectFactory.createProject(new NullProgressMonitor(), null); return result; }
Example #14
Source File: Bug355821Test.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
private IProject createPluginProject(String name) throws CoreException { projectFactory.setProjectName(name); projectFactory.setBreeToUse(JREContainerProvider.PREFERRED_BREE); projectFactory.addFolders(Collections.singletonList("src")); projectFactory.addBuilderIds(JavaCore.BUILDER_ID, "org.eclipse.pde.ManifestBuilder", "org.eclipse.pde.SchemaBuilder", XtextProjectHelper.BUILDER_ID); projectFactory.addProjectNatures(JavaCore.NATURE_ID, "org.eclipse.pde.PluginNature", XtextProjectHelper.NATURE_ID); projectFactory.addRequiredBundles(Collections.singletonList("org.eclipse.xtext")); IProject result = projectFactory.createProject(new NullProgressMonitor(), null); return result; }
Example #15
Source File: AutoEditTest.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
private IProject createPluginProject(final String name) { this.projectFactory.setBreeToUse(JREContainerProvider.PREFERRED_BREE); this.projectFactory.setProjectName(name); this.projectFactory.addFolders(Collections.<String>singletonList("src")); this.projectFactory.addBuilderIds(XtextProjectHelper.BUILDER_ID); this.projectFactory.addProjectNatures(XtextProjectHelper.NATURE_ID); NullProgressMonitor _nullProgressMonitor = new NullProgressMonitor(); final IProject result = this.projectFactory.createProject(_nullProgressMonitor, null); JavaProjectSetupUtil.setUnixLineEndings(result); return result; }
Example #16
Source File: MockJavaProjectProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
private static void createManifest(final String projectName, final IProject project) throws CoreException { final StringBuilder mainContent = new StringBuilder("Manifest-Version: 1.0\n"); mainContent.append("Bundle-ManifestVersion: 2\n"); mainContent.append("Bundle-Name: " + projectName + "\n"); mainContent.append("Bundle-Vendor: My Company\n"); mainContent.append("Bundle-Version: 1.0.0\n"); mainContent.append("Bundle-SymbolicName: " + projectName.toLowerCase() + "; singleton:=true\n"); mainContent.append("Bundle-ActivationPolicy: lazy\n"); mainContent.append("Bundle-RequiredExecutionEnvironment: " + JREContainerProvider.PREFERRED_BREE + "\n"); mainContent.append("Require-Bundle: com.google.guava\n"); final IFolder metaInf = project.getFolder("META-INF"); metaInf.create(false, true, null); createFile("MANIFEST.MF", metaInf, mainContent.toString()); }
Example #17
Source File: XtextAutoEditStrategyTest.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
protected IProject createPluginProject(String name) { projectFactory.setBreeToUse(JREContainerProvider.PREFERRED_BREE); projectFactory.setProjectName(name); projectFactory.addFolders(Collections.singletonList("src")); projectFactory.addBuilderIds(XtextProjectHelper.BUILDER_ID); projectFactory.addProjectNatures(XtextProjectHelper.NATURE_ID); IProject result = projectFactory.createProject(new NullProgressMonitor(), null); JavaProjectSetupUtil.setUnixLineEndings(result); return result; }
Example #18
Source File: XtextProjectCreator.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
private void configureJavaProject(ProjectDescriptor descriptor, JavaProjectFactory factory) { configurePlainProject(descriptor, factory); factory.addProjectNatures(XtextProjectHelper.NATURE_ID); factory.addBuilderIds(XtextProjectHelper.BUILDER_ID); factory.addProjectNatures(JavaCore.NATURE_ID); factory.addBuilderIds(JavaCore.BUILDER_ID); for (SourceFolderDescriptor sourceFolder : descriptor.getSourceFolders()) { String output = sourceFolder.isTest() ? (needsM2eIntegration(descriptor) ? "target/test-classes" : "test-bin") : null; factory.addSourceFolder(sourceFolder.getPath(), output, sourceFolder.isTest()); } factory.setJreContainerEntry(JREContainerProvider.getJREContainerEntry(descriptor.getBree())); if (needsM2eIntegration(descriptor)) { factory.setDefaultOutput("target/classes"); if (!descriptor.isEclipsePluginProject()) { factory.addClasspathEntries(JavaCore.newContainerEntry(new Path("org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"))); } } if (needsBuildshipIntegration(descriptor) && !descriptor.isEclipsePluginProject()) { factory.addClasspathEntries(JavaCore.newContainerEntry(new Path("org.eclipse.buildship.core.gradleclasspathcontainer"))); } if (requiresJUnitLibContainer(descriptor)) { JUnitVersion junitVersion = descriptor.getConfig().getJunitVersion(); factory.addClasspathEntries(JavaCore.newContainerEntry( new Path("org.eclipse.jdt.junit.JUNIT_CONTAINER").append(Integer.toString(junitVersion.getVersion())), new IAccessRule[0], new IClasspathAttribute[] { JavaCore.newClasspathAttribute("test", "true") }, false/*not exported*/)); } }
Example #19
Source File: WizardNewXtextProjectCreationPage.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
protected void fillBreeCombo(Combo comboToFill) { Set<String> brees = Sets.newLinkedHashSet(); Set<String> availableBrees = Sets.newHashSet(); for (IExecutionEnvironment ee : JavaRuntime.getExecutionEnvironmentsManager().getExecutionEnvironments()) { availableBrees.add(ee.getId()); } for (JavaVersion supportedVersion : JavaVersion.values()) { if (supportedVersion.isAtLeast(JavaVersion.JAVA6)) { String bree = supportedVersion.getBree(); if (availableBrees.contains(bree)) brees.add(bree); } } String[] array = brees.toArray(new String[] {}); String selectionMemento = comboToFill.getText(); comboToFill.setItems(array); int index = comboToFill.indexOf(selectionMemento); String defaultBree = JREContainerProvider.getDefaultBREE(); if (index < 0) { if (brees.contains(defaultBree)) { comboToFill.select(comboToFill.indexOf(defaultBree)); } else { comboToFill.select(array.length - 1); } } comboToFill.select(index); }
Example #20
Source File: Bug369087Test.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
protected static IProject createPluginProject(String name) throws CoreException { Injector injector = TestlanguagesActivator.getInstance().getInjector(TestlanguagesActivator.ORG_ECLIPSE_XTEXT_TESTLANGUAGES_XTEXTGRAMMAR_XTEXTGRAMMARTESTLANGUAGE); PluginProjectFactory projectFactory = injector.getInstance(PluginProjectFactory.class); projectFactory.setBreeToUse(JREContainerProvider.PREFERRED_BREE); projectFactory.setProjectName(name); projectFactory.addFolders(Collections.singletonList("src")); projectFactory.addBuilderIds(XtextProjectHelper.BUILDER_ID); projectFactory.addProjectNatures(XtextProjectHelper.NATURE_ID); IProject result = projectFactory.createProject(new NullProgressMonitor(), null); JavaProjectSetupUtil.setUnixLineEndings(result); return result; }
Example #21
Source File: JavaProjectSetupUtil.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
public static IClasspathEntry getJreContainerClasspathEntry(IJavaProject javaProject) throws JavaModelException { return JREContainerProvider.getJREContainerEntry(javaProject); }
Example #22
Source File: JavaProjectSetupUtil.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
public static IClasspathEntry getJreContainerClasspathEntry(IJavaProject javaProject) throws JavaModelException { return JREContainerProvider.getJREContainerEntry(javaProject); }
Example #23
Source File: WizardNewXtextProjectCreationPage.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
@Override protected boolean validatePage() { if (!super.validatePage()) return false; IStatus status = validateProjectName(); if (!status.isOK()) { setErrorMessage(status.getMessage()); return false; } if (languageNameField == null) // See the comment in createControl return true; if (languageNameField.getText().length() == 0) return false; status = JavaConventions.validateJavaTypeName(languageNameField.getText(), JavaCore.VERSION_1_5, JavaCore.VERSION_1_5); if (!status.isOK()) { setErrorMessage(Messages.WizardNewXtextProjectCreationPage_ErrorMessageLanguageName + status.getMessage()); return false; } if (!languageNameField.getText().contains(".")) { //$NON-NLS-1$ setErrorMessage(Messages.WizardNewXtextProjectCreationPage_ErrorMessageLanguageNameWithoutPackage); return false; } if (extensionsField.getText().length() == 0) return false; if (!PATTERN_EXTENSIONS.matcher(extensionsField.getText()).matches()) { setErrorMessage(Messages.WizardNewXtextProjectCreationPage_ErrorMessageExtensions); return false; } JavaVersion javaVersion = JavaVersion.fromBree(breeCombo.getText()); if (javaVersion != null && !javaVersion.isAtLeast(JavaVersion.JAVA8)) { setMessage(Messages.WizardNewXtextProjectCreationPage_MessageAtLeastJava8, IStatus.WARNING); return true; } if (!Sets.newHashSet(JREContainerProvider.getConfiguredBREEs()).contains(breeCombo.getText())) { setMessage(Messages.WizardNewXtextProjectCreationPage_eeInfo_0 + breeCombo.getText() + Messages.WizardNewXtextProjectCreationPage_eeInfo_1, IMessageProvider.INFORMATION); return true; } setErrorMessage(null); setMessage(null); return true; }
Example #24
Source File: XtendLibClasspathAdderTest.java From xtext-xtend with Eclipse Public License 2.0 | 4 votes |
@Override public void setUp() throws Exception { super.setUp(); pluginProjectFactory.setBreeToUse(JREContainerProvider.PREFERRED_BREE); }
Example #25
Source File: WizardNewXtextProjectCreationPage.java From xtext-eclipse with Eclipse Public License 2.0 | 3 votes |
/** * Sets the defaults for the languageName and extensions. * * @param projectSuffix * the name of the DSL * @see findNextValidProjectSuffix(String, String) */ protected void setDefaults(String projectSuffix) { languageNameField.setText("org.xtext.example." + projectSuffix + ".MyDsl"); //$NON-NLS-1$ //$NON-NLS-2$ extensionsField.setText(projectSuffix); breeCombo.select(breeCombo.indexOf(JREContainerProvider.getDefaultBREE())); validatePage(); }