Java Code Examples for org.eclipse.xtext.xtext.wizard.ProjectLayout

The following examples show how to use org.eclipse.xtext.xtext.wizard.ProjectLayout. These examples are extracted from open source projects. 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 Project: xtext-core   Source File: ProjectDescriptor.java    License: Eclipse Public License 2.0 6 votes vote down vote up
public String getLocation() {
  String _xifexpression = null;
  ProjectLayout _projectLayout = this.config.getProjectLayout();
  boolean _equals = Objects.equal(_projectLayout, ProjectLayout.FLAT);
  if (_equals) {
    String _rootLocation = this.config.getRootLocation();
    String _plus = (_rootLocation + "/");
    String _name = this.getName();
    _xifexpression = (_plus + _name);
  } else {
    String _location = this.config.getParentProject().getLocation();
    String _plus_1 = (_location + "/");
    String _name_1 = this.getName();
    _xifexpression = (_plus_1 + _name_1);
  }
  return _xifexpression;
}
 
Example 2
public CharSequence settingsGradle() {
  StringConcatenation _builder = new StringConcatenation();
  {
    final Function1<ProjectDescriptor, Boolean> _function = (ProjectDescriptor it) -> {
      return Boolean.valueOf(((!Objects.equal(it, this)) && it.isPartOfGradleBuild()));
    };
    Iterable<ProjectDescriptor> _filter = IterableExtensions.<ProjectDescriptor>filter(this.getConfig().getEnabledProjects(), _function);
    for(final ProjectDescriptor p : _filter) {
      {
        ProjectLayout _projectLayout = this.getConfig().getProjectLayout();
        boolean _equals = Objects.equal(_projectLayout, ProjectLayout.FLAT);
        if (_equals) {
          _builder.append("includeFlat");
        } else {
          _builder.append("include");
        }
      }
      _builder.append(" \'");
      String _name = p.getName();
      _builder.append(_name);
      _builder.append("\'");
      _builder.newLineIfNotEmpty();
    }
  }
  return _builder;
}
 
Example 3
Source Project: xtext-eclipse   Source File: XtextProjectCreator.java    License: Eclipse Public License 2.0 5 votes vote down vote up
private String getConnectionLogicalPath() {
	if (descriptor instanceof ParentProjectDescriptor) {
		return "";
	} else if (descriptor.getConfig().getProjectLayout() == ProjectLayout.FLAT) {
		return "../" + descriptor.getConfig().getParentProject().getName();
	} else {
		return "..";
	}
}
 
Example 4
@Override
protected IProjectInfo getProjectInfo() {
	XtextProjectInfo projectInfo = createProjectInfo();
	LanguageDescriptor language = projectInfo.getLanguage();
	language.setFileExtensions(FileExtensions.fromString(mainPage.getFileExtensions()));
	language.setName(mainPage.getLanguageName());
	projectInfo.setBaseName(mainPage.getProjectName());
	projectInfo.setWorkingSets(Arrays.asList(mainPage.getSelectedWorkingSets()));
	projectInfo.setRootLocation(mainPage.getLocationPath().toString());
	Charset encoding = null;
	try {
		encoding = Charset.forName(ResourcesPlugin.getWorkspace().getRoot().getDefaultCharset());
	}
	catch (final CoreException e) {
		encoding = Charset.defaultCharset();
	}
	projectInfo.setEncoding(encoding);
	String lineDelimiter = InstanceScope.INSTANCE.getNode("org.eclipse.core.runtime").get("line.separator", Strings.newLine());
	projectInfo.setLineDelimiter(lineDelimiter);
	projectInfo.setWorkbench(getWorkbench());
	JavaVersion selectedBree = mainPage.getJavaVersion();
	// Use old default for wizard as fall back, when something goes wrong
	if (selectedBree != null) {
		projectInfo.setJavaVersion(selectedBree);
	}

	BuildSystem buildSystem = advancedPage.getPreferredBuildSystem();
	projectInfo.setPreferredBuildSystem(buildSystem);
	projectInfo.setSourceLayout(advancedPage.getSourceLayout());
	
	projectInfo.getUiProject().setEnabled(advancedPage.isCreateUiProject());
	if (buildSystem != BuildSystem.NONE) {
		projectInfo.setProjectLayout(ProjectLayout.HIERARCHICAL);
	}
	projectInfo.getIdeProject().setEnabled(advancedPage.isCreateIdeProject());
	projectInfo.getWebProject().setEnabled(advancedPage.isCreateWebProject());
	projectInfo.getSdkProject().setEnabled(advancedPage.isCreateSdkProject());
	projectInfo.getP2Project().setEnabled(advancedPage.isCreateP2Project());
	projectInfo.setLanguageServer(advancedPage.getLanguageServer());
	projectInfo.setJunitVersion(advancedPage.getSelectedJUnitVersion());
	
	if (advancedPage.isCreateTestProject()) {
		for (ProjectDescriptor project : projectInfo.getEnabledProjects()) {
			if (project instanceof TestedProjectDescriptor) {
				((TestedProjectDescriptor) project).getTestProject().setEnabled(true);
			}
		}
	}
	return projectInfo;
}
 
Example 5
Source Project: xtext-core   Source File: OptionHandlers.java    License: Eclipse Public License 2.0 4 votes vote down vote up
public ProjectLayoutOptionHandler(CmdLineParser parser, OptionDef option, Setter<? super ProjectLayout> setter) {
	super(parser, option, setter);
}
 
Example 6
Source Project: xtext-core   Source File: OptionHandlers.java    License: Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected ProjectLayout parse(String argument) throws NumberFormatException, CmdLineException {
	return ProjectLayout.valueOf(argument);
}
 
Example 7
Source Project: xtext-core   Source File: WizardConfiguration.java    License: Eclipse Public License 2.0 4 votes vote down vote up
@Pure
public ProjectLayout getProjectLayout() {
  return this.projectLayout;
}
 
Example 8
Source Project: xtext-core   Source File: WizardConfiguration.java    License: Eclipse Public License 2.0 4 votes vote down vote up
public void setProjectLayout(final ProjectLayout projectLayout) {
  this.projectLayout = projectLayout;
}
 
Example 9
@Override
public boolean isEnabled() {
  return ((this.getConfig().needsGradleBuild() || this.getConfig().needsMavenBuild()) || Objects.equal(this.getConfig().getProjectLayout(), ProjectLayout.HIERARCHICAL));
}