use of org.eclipse.xtext.xtext.ui.wizard.project.StatusWidget in project xtext-eclipse by eclipse.
the class AdvancedNewProjectPage method createControl.
@Override
public void createControl(final Composite parent) {
Composite _composite = new Composite(parent, SWT.NONE);
final Procedure1<Composite> _function = (Composite it) -> {
GridData _gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
it.setLayoutData(_gridData);
GridLayout _gridLayout = new GridLayout(1, false);
it.setLayout(_gridLayout);
final Procedure1<Group> _function_1 = (Group it_1) -> {
it_1.setText(Messages.AdvancedNewProjectPage_LabelFacets);
final Procedure1<Button> _function_2 = (Button it_2) -> {
it_2.setText(Messages.AdvancedNewProjectPage_projEclipse);
};
this.createUiProject = this.CheckBox(it_1, _function_2);
final Procedure1<Group> _function_3 = (Group it_2) -> {
final Procedure1<Button> _function_4 = (Button it_3) -> {
it_3.setText(Messages.AdvancedNewProjectPage_projEclipseSDKFeature);
};
this.createSDKProject = this.CheckBox(it_2, _function_4);
final Procedure1<Button> _function_5 = (Button it_3) -> {
it_3.setText(Messages.AdvancedNewProjectPage_projEclipseP2);
};
this.createP2Project = this.CheckBox(it_2, _function_5);
};
this.createUiProjectSubGroup = this.Group(it_1, _function_3);
final Procedure1<Button> _function_4 = (Button it_2) -> {
it_2.setText(Messages.AdvancedNewProjectPage_projIdea);
it_2.setEnabled(true);
};
this.createIdeaProject = this.CheckBox(it_1, _function_4);
final Procedure1<Button> _function_5 = (Button it_2) -> {
it_2.setText(Messages.AdvancedNewProjectPage_projWeb);
it_2.setEnabled(true);
};
this.createWebProject = this.CheckBox(it_1, _function_5);
final Procedure1<Button> _function_6 = (Button it_2) -> {
it_2.setText(Messages.AdvancedNewProjectPage_projIde);
it_2.setEnabled(false);
this.InfoDecoration(it_2, Messages.AdvancedNewProjectPage_projIde_description);
GridData _gridData_1 = new GridData(SWT.LEFT, SWT.CENTER, true, false);
it_2.setLayoutData(_gridData_1);
};
this.createIdeProject = this.CheckBox(it_1, _function_6);
final Procedure1<Button> _function_7 = (Button it_2) -> {
it_2.setText(Messages.WizardNewXtextProjectCreationPage_TestingSupport);
};
this.createTestProject = this.CheckBox(it_1, _function_7);
};
this.Group(it, _function_1);
final Procedure1<Group> _function_2 = (Group it_1) -> {
it_1.setText(Messages.AdvancedNewProjectPage_prefBuildSys);
final Procedure1<Combo> _function_3 = (Combo it_2) -> {
it_2.setEnabled(true);
final Function1<BuildSystem, String> _function_4 = (BuildSystem it_3) -> {
return it_3.toString();
};
it_2.setItems(((String[]) Conversions.unwrapArray(ListExtensions.<BuildSystem, String>map(((List<BuildSystem>) Conversions.doWrapArray(BuildSystem.values())), _function_4), String.class)));
};
this.preferredBuildSystem = this.DropDown(it_1, _function_3);
};
this.Group(it, _function_2);
final Procedure1<Group> _function_3 = (Group it_1) -> {
it_1.setText(Messages.AdvancedNewProjectPage_languageServer);
final Procedure1<Combo> _function_4 = (Combo it_2) -> {
it_2.setEnabled(false);
final Function1<LanguageServer, String> _function_5 = (LanguageServer it_3) -> {
return it_3.toString();
};
it_2.setItems(((String[]) Conversions.unwrapArray(ListExtensions.<LanguageServer, String>map(((List<LanguageServer>) Conversions.doWrapArray(LanguageServer.values())), _function_5), String.class)));
this.InfoDecoration(it_2, Messages.AdvancedNewProjectPage_languageServer_description);
};
this.createLanguageServer = this.DropDown(it_1, _function_4);
};
this.Group(it, _function_3);
final Procedure1<Group> _function_4 = (Group it_1) -> {
it_1.setText(Messages.AdvancedNewProjectPage_srcLayout);
final Procedure1<Combo> _function_5 = (Combo it_2) -> {
it_2.setEnabled(true);
final Function1<SourceLayout, String> _function_6 = (SourceLayout it_3) -> {
return it_3.toString();
};
it_2.setItems(((String[]) Conversions.unwrapArray(ListExtensions.<SourceLayout, String>map(((List<SourceLayout>) Conversions.doWrapArray(SourceLayout.values())), _function_6), String.class)));
};
this.sourceLayout = this.DropDown(it_1, _function_5);
};
this.Group(it, _function_4);
StatusWidget _statusWidget = new StatusWidget(it, SWT.NONE);
final Procedure1<StatusWidget> _function_5 = (StatusWidget it_1) -> {
GridData _gridData_1 = new GridData(SWT.FILL, SWT.TOP, true, false);
it_1.setLayoutData(_gridData_1);
};
StatusWidget _doubleArrow = ObjectExtensions.<StatusWidget>operator_doubleArrow(_statusWidget, _function_5);
this.statusWidget = _doubleArrow;
};
Composite _doubleArrow = ObjectExtensions.<Composite>operator_doubleArrow(_composite, _function);
this.setControl(_doubleArrow);
final SelectionAdapter selectionControl = new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
AdvancedNewProjectPage.this.validate(e);
}
};
final List<Button> uiButtons = Collections.<Button>unmodifiableList(CollectionLiterals.<Button>newArrayList(this.createUiProject, this.createIdeaProject, this.createWebProject));
final SelectionAdapter selectionControlUi = new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
Object _source = e.getSource();
boolean _selection = ((Button) _source).getSelection();
if (_selection) {
boolean _selection_1 = AdvancedNewProjectPage.this.createIdeProject.getSelection();
boolean _not = (!_selection_1);
if (_not) {
AdvancedNewProjectPage.this.autoSelectIdeProject = true;
}
AdvancedNewProjectPage.this.createIdeProject.setSelection(true);
AdvancedNewProjectPage.this.createIdeProject.setEnabled(false);
} else {
final Function1<Button, Boolean> _function = (Button it) -> {
boolean _selection_2 = it.getSelection();
return Boolean.valueOf((!_selection_2));
};
boolean _forall = IterableExtensions.<Button>forall(uiButtons, _function);
if (_forall) {
AdvancedNewProjectPage.this.createIdeProject.setEnabled(true);
}
Object _source_1 = e.getSource();
boolean _equals = Objects.equal(_source_1, AdvancedNewProjectPage.this.createUiProject);
if (_equals) {
AdvancedNewProjectPage.this.createSDKProject.setSelection(false);
AdvancedNewProjectPage.this.createP2Project.setSelection(false);
}
}
AdvancedNewProjectPage.this.validate(e);
}
};
final SelectionAdapter selectionControlUpdateSite = new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
Object _source = e.getSource();
boolean _selection = ((Button) _source).getSelection();
if (_selection) {
boolean _selection_1 = AdvancedNewProjectPage.this.createSDKProject.getSelection();
boolean _not = (!_selection_1);
if (_not) {
AdvancedNewProjectPage.this.autoSelectSDKProject = true;
}
AdvancedNewProjectPage.this.createSDKProject.setSelection(true);
AdvancedNewProjectPage.this.createSDKProject.setEnabled(false);
} else {
AdvancedNewProjectPage.this.createSDKProject.setEnabled(true);
}
AdvancedNewProjectPage.this.validate(e);
}
};
this.createUiProject.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
final boolean uiProjectSelected = AdvancedNewProjectPage.this.createUiProject.getSelection();
AdvancedNewProjectPage.this.createUiProjectSubGroup.setEnabled(uiProjectSelected);
AdvancedNewProjectPage.this.createSDKProject.setEnabled(uiProjectSelected);
AdvancedNewProjectPage.this.createP2Project.setEnabled(uiProjectSelected);
AdvancedNewProjectPage.this.validate(e);
}
});
this.preferredBuildSystem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
BuildSystem _preferredBuildSystem = AdvancedNewProjectPage.this.getPreferredBuildSystem();
final boolean lsEnabled = (!Objects.equal(_preferredBuildSystem, BuildSystem.NONE));
AdvancedNewProjectPage.this.createLanguageServer.setEnabled(lsEnabled);
AdvancedNewProjectPage.this.validate(e);
}
});
this.createLanguageServer.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
boolean _isSelected = AdvancedNewProjectPage.this.isSelected(AdvancedNewProjectPage.this.createLanguageServer, LanguageServer.NONE);
if (_isSelected) {
final Function1<Button, Boolean> _function = (Button it) -> {
boolean _selection = it.getSelection();
return Boolean.valueOf((!_selection));
};
boolean _forall = IterableExtensions.<Button>forall(uiButtons, _function);
if (_forall) {
AdvancedNewProjectPage.this.createIdeProject.setEnabled(true);
}
} else {
boolean _selection = AdvancedNewProjectPage.this.createIdeProject.getSelection();
boolean _not = (!_selection);
if (_not) {
AdvancedNewProjectPage.this.createIdeProject.setSelection(true);
AdvancedNewProjectPage.this.autoSelectIdeProject = true;
}
}
AdvancedNewProjectPage.this.validate(e);
}
});
this.sourceLayout.addSelectionListener(selectionControl);
this.createTestProject.addSelectionListener(selectionControl);
this.createUiProject.addSelectionListener(selectionControlUi);
this.createIdeaProject.addSelectionListener(selectionControlUi);
this.createWebProject.addSelectionListener(selectionControlUi);
this.createIdeProject.addSelectionListener(selectionControl);
this.createSDKProject.addSelectionListener(selectionControl);
this.createP2Project.addSelectionListener(selectionControlUpdateSite);
this.createLanguageServer.addSelectionListener(selectionControl);
this.setDefaults();
PlatformUI.getWorkbench().getHelpSystem().setHelp(this.getShell(), "org.eclipse.xtext.xtext.ui.newProject_Advanced");
}
Aggregations