org.eclipse.xtext.ui.util.ProjectFactory Java Examples

The following examples show how to use org.eclipse.xtext.ui.util.ProjectFactory. 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: XtextProjectCreator.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
private void configurePlainProject(ProjectDescriptor descriptor, ProjectFactory factory) {
	factory.setProjectName(descriptor.getName());
	factory.setLocation(new Path(descriptor.getLocation()));
	factory.setProjectDefaultCharset(projectInfo.getEncoding().toString());
	factory.addWorkingSets(Lists.newArrayList(projectInfo.getWorkingSets()));
	factory.addContributor(new DescriptorBasedContributor(descriptor));
	if (needsM2eIntegration(descriptor)) {
		factory.addProjectNatures("org.eclipse.m2e.core.maven2Nature");
		factory.addBuilderIds("org.eclipse.m2e.core.maven2Builder");
	}
	if (needsBuildshipIntegration(descriptor)) {
		factory.addProjectNatures("org.eclipse.buildship.core.gradleprojectnature");
		factory.addBuilderIds("org.eclipse.buildship.core.gradleprojectbuilder");
		factory.addEarlyContributor(new GradleContributor(descriptor));
	}
}
 
Example #2
Source File: DefaultTemplateProjectCreator.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
	SubMonitor subMonitor = SubMonitor.convert(monitor, projectFactories.size());
	try {
		IWorkbench workbench = PlatformUI.getWorkbench();
		IWorkspace workspace = ResourcesPlugin.getWorkspace();
		for (ProjectFactory projectFactory : projectFactories) {
			projectFactory.setWorkbench(workbench);
			projectFactory.setWorkspace(workspace);
			projectFactory.createProject(subMonitor, null);
			subMonitor.worked(1);
		}
	} finally {
		subMonitor.done();
	}
}
 
Example #3
Source File: N4JSProjectCreator.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected ProjectFactory configureProjectFactory(final ProjectFactory factory) {
	final ProjectFactory projectFactory = super.configureProjectFactory(factory);
	final N4JSProjectInfo projectInfo = (N4JSProjectInfo) getProjectInfo();
	if (null != projectInfo.getProjectLocation()) {
		projectFactory.setLocation(projectInfo.getProjectLocation());
	}
	return projectFactory;
}
 
Example #4
Source File: XtextProjectCreator.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
private IProject createFeatureProject(ProjectDescriptor descriptor, SubMonitor monitor) {
	ProjectFactory factory = plainProjectProvider.get();
	configurePlainProject(descriptor, factory);
	factory.addProjectNatures("org.eclipse.pde.FeatureNature");
	factory.addBuilderIds("org.eclipse.pde.FeatureBuilder");
	return factory.createProject(monitor, null);
}
 
Example #5
Source File: AbstractProjectCreator.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected ProjectFactory configureProjectFactory(ProjectFactory factory) {
	factory.setProjectName(getProjectInfo().getProjectName());
	if (projectInfo instanceof IExtendedProjectInfo) {
		IExtendedProjectInfo extendedProjectInfo = (IExtendedProjectInfo) projectInfo;
		factory.setLocation(extendedProjectInfo.getLocationPath());
	}
	factory.addFolders(getAllFolders());
	factory.addReferencedProjects(getReferencedProjects());
	factory.addProjectNatures(getProjectNatures());
	factory.addBuilderIds(getBuilders());
	return factory;
}
 
Example #6
Source File: AbstractPluginProjectCreator.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected ProjectFactory configureProjectFactory(ProjectFactory factory) {
	PluginProjectFactory result = (PluginProjectFactory) super.configureProjectFactory(factory);
	
	result.addRequiredBundles(getRequiredBundles());
	result.addExportedPackages(getExportedPackages());
	result.addImportedPackages(getImportedPackages());
	result.setActivatorClassName(getActivatorClassName());
	
	return result;
}
 
Example #7
Source File: N4JSProjectCreator.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected ProjectFactory createProjectFactory() {
	return projectFactoryProvider.get();
}
 
Example #8
Source File: XtextProjectCreator.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
private IProject createPlainProject(ProjectDescriptor descriptor, SubMonitor monitor) {
	ProjectFactory factory = plainProjectProvider.get();
	configurePlainProject(descriptor, factory);
	return factory.createProject(monitor, null);
}
 
Example #9
Source File: AbstractProjectCreator.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
protected IProject createProject(IProgressMonitor monitor) {
	ProjectFactory factory = createProjectFactory();
	configureProjectBuilder(factory);
	return factory.createProject(monitor, null);
}
 
Example #10
Source File: AbstractProjectCreator.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * @deprecated use {@link #configureProjectFactory(ProjectFactory)} instead.
 */
@Deprecated
protected ProjectFactory configureProjectBuilder(ProjectFactory factory) {
	return configureProjectFactory(factory);
}
 
Example #11
Source File: AbstractProjectTemplate.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
protected ProjectFactory addFile(ProjectFactory project, CharSequence fileName, CharSequence contents) {
	project.addContributor(new TextFileContributor(fileName, contents));
	return project;
}
 
Example #12
Source File: DefaultTemplateProjectCreator.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void generate(ProjectFactory project) {
	projectFactories.add(project);
}
 
Example #13
Source File: CheckProjectCreator.java    From dsl-devkit with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected ProjectFactory configureProjectFactory(final ProjectFactory factory) {
  ProjectFactory result = super.configureProjectFactory(factory);
  result.addProjectNatures(CheckNature.CHECK_NATURE_ID);
  return result;
}
 
Example #14
Source File: IProjectGenerator.java    From xtext-eclipse with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Generate a new {@link IProject} using the provided {@link ProjectFactory}.
 * 
 * @param project
 *            The project factory to create a project from. The generator might choose to modify the factory further to suite his needs.
 */
void generate(ProjectFactory project);
 
Example #15
Source File: AbstractProjectCreator.java    From xtext-eclipse with Eclipse Public License 2.0 votes vote down vote up
protected abstract ProjectFactory createProjectFactory();