Skip to content

Commit

Permalink
Make source validation tasks pass
Browse files Browse the repository at this point in the history
  • Loading branch information
donat committed May 15, 2020
1 parent b562d16 commit c9a60c1
Show file tree
Hide file tree
Showing 27 changed files with 1,082 additions and 995 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
/*
* Copyright (c) 2018 the original author or authors.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
/*******************************************************************************
* Copyright (c) 2020 Gradle Inc.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
******************************************************************************/

package org.eclipse.buildship.ui.internal.composite;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
/*
* Copyright (c) 2015 the original author or authors.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
/*******************************************************************************
* Copyright (c) 2020 Gradle Inc.
*
* Contributors:
* Etienne Studer & Donát Csikós (Gradle Inc.) - initial API and implementation and initial documentation
* Sebastian Kuzniarz (Diebold Nixdorf Inc.) - refactored HelpContextIdProvider
*/
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
******************************************************************************/

package org.eclipse.buildship.ui.internal.preferences;

Expand All @@ -32,8 +30,8 @@
*/
public abstract class AbstractPropertiesPage extends WizardPage {

private final CompositeConfiguration configuration;
private final CompositeConfiguration configuration;

/**
* Constructor setting up the main messages and the validation facility for this wizard page.
*
Expand All @@ -51,10 +49,10 @@ protected AbstractPropertiesPage(String name, String title, String defaultMessag

// set the basic message and the attached image
setTitle(title);
setDescription(defaultMessage);
setDescription(defaultMessage);
setImageDescriptor(ImageDescriptor.createFromFile(GradleCreateWorkspaceCompositeWizardPage.class, "/icons/full/wizban/wizard.png")); //$NON-NLS-1$
}

protected CompositeConfiguration getConfiguration() {
return this.configuration;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ protected Control createContents(Composite parent) {
}

private void initValues() {
IWorkingSet composite = getTargetComposite();
IWorkingSet composite = getTargetComposite();
BuildConfiguration buildConfig = CorePlugin.configurationManager().loadCompositeConfiguration(composite).getBuildConfiguration();

boolean overrideWorkspaceSettings = buildConfig.isOverrideWorkspaceSettings();
Expand Down Expand Up @@ -95,25 +95,25 @@ private void addListeners() {

@Override
public boolean performOk() {
IWorkingSet composite = getTargetComposite();
ConfigurationManager manager = CorePlugin.configurationManager();
CompositeConfiguration currentConfig = manager.loadCompositeConfiguration(composite);
BuildConfiguration updatedConfig = manager.createBuildConfiguration(currentConfig.getBuildConfiguration().getRootProjectDirectory(),
this.gradleProjectSettingsComposite.getOverrideBuildSettingsCheckbox().getSelection(),
this.gradleProjectSettingsComposite.getGradleDistributionGroup().getDistribution().toGradleDistribution(),
this.gradleProjectSettingsComposite.getAdvancedOptionsGroup().getGradleUserHome(),
this.gradleProjectSettingsComposite.getAdvancedOptionsGroup().getJavaHome(),
this.gradleProjectSettingsComposite.getBuildScansCheckbox().getSelection(),
this.gradleProjectSettingsComposite.getOfflineModeCheckbox().getSelection(),
this.gradleProjectSettingsComposite.getAutoSyncCheckbox().getSelection(),
this.gradleProjectSettingsComposite.getAdvancedOptionsGroup().getArguments(),
this.gradleProjectSettingsComposite.getAdvancedOptionsGroup().getJvmArguments(),
this.gradleProjectSettingsComposite.getShowConsoleViewCheckbox().getSelection(),
this.gradleProjectSettingsComposite.getShowExecutionsViewCheckbox().getSelection());
CompositeConfiguration compConf = new DefaultCompositeConfiguration(currentConfig.getCompositeDir(), composite.getElements(), updatedConfig, currentConfig.projectAsCompositeRoot() ,currentConfig.getRootProject());
manager.saveCompositeConfiguration(compConf);
return true;
IWorkingSet composite = getTargetComposite();
ConfigurationManager manager = CorePlugin.configurationManager();
CompositeConfiguration currentConfig = manager.loadCompositeConfiguration(composite);
BuildConfiguration updatedConfig = manager.createBuildConfiguration(currentConfig.getBuildConfiguration().getRootProjectDirectory(),
this.gradleProjectSettingsComposite.getOverrideBuildSettingsCheckbox().getSelection(),
this.gradleProjectSettingsComposite.getGradleDistributionGroup().getDistribution().toGradleDistribution(),
this.gradleProjectSettingsComposite.getAdvancedOptionsGroup().getGradleUserHome(),
this.gradleProjectSettingsComposite.getAdvancedOptionsGroup().getJavaHome(),
this.gradleProjectSettingsComposite.getBuildScansCheckbox().getSelection(),
this.gradleProjectSettingsComposite.getOfflineModeCheckbox().getSelection(),
this.gradleProjectSettingsComposite.getAutoSyncCheckbox().getSelection(),
this.gradleProjectSettingsComposite.getAdvancedOptionsGroup().getArguments(),
this.gradleProjectSettingsComposite.getAdvancedOptionsGroup().getJvmArguments(),
this.gradleProjectSettingsComposite.getShowConsoleViewCheckbox().getSelection(),
this.gradleProjectSettingsComposite.getShowExecutionsViewCheckbox().getSelection());
CompositeConfiguration compConf = new DefaultCompositeConfiguration(currentConfig.getCompositeDir(), composite.getElements(), updatedConfig, currentConfig.projectAsCompositeRoot() ,currentConfig.getRootProject());
manager.saveCompositeConfiguration(compConf);
return true;
}

@SuppressWarnings("cast")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,20 @@ private Layout createLayout() {
}

public GradleCompositeRootProjectPreferencePage() {
this.rootProjectValidator = Validators.optionalDirectoryValidator("Root project");
this.rootProjectValidator = Validators.optionalDirectoryValidator("Root project");
}

@Override
protected Control createContents(Composite parent) {
this.rootProjectSettingsComposite = buildRootProjectSettingsComposite(parent);
this.rootProjectSettingsComposite = buildRootProjectSettingsComposite(parent);
addListeners();
initValues();
return this.rootProjectSettingsComposite;
}

private Composite buildRootProjectSettingsComposite(Composite parent) {
Composite rootProjectComposite = new Composite(parent, SWT.WRAP);
rootProjectComposite.setLayout(createLayout());
private Composite buildRootProjectSettingsComposite(Composite parent) {
Composite rootProjectComposite = new Composite(parent, SWT.WRAP);
rootProjectComposite.setLayout(createLayout());

this.projectAsCompositeRootCheckbox = new Button(rootProjectComposite, SWT.CHECK);
this.projectAsCompositeRootCheckbox.setText("Use project as composite root");
Expand Down Expand Up @@ -112,17 +112,17 @@ private Composite buildRootProjectSettingsComposite(Composite parent) {
this.selectRootProject.setText(WorkspaceCompositeWizardMessages.Button_Select_RootProject);
this.selectRootProject.setEnabled(false);
return rootProjectComposite;
}
}

private void initValues() {
IWorkingSet composite = getTargetComposite();
IWorkingSet composite = getTargetComposite();

this.compositeConfig = CorePlugin.configurationManager().loadCompositeConfiguration(composite);
boolean useProjectAsCompositeRoot = this.compositeConfig.projectAsCompositeRoot();

this.projectAsCompositeRootCheckbox.setSelection(useProjectAsCompositeRoot);
this.workspaceCompositeRootProjectLabel.setText(this.compositeConfig.getRootProject().toString());
updateEnablement();
this.workspaceCompositeRootProjectLabel.setText(this.compositeConfig.getRootProject().toString());
updateEnablement();
}

private void addListeners() {
Expand All @@ -143,8 +143,8 @@ public void widgetDefaultSelected(SelectionEvent e) {
File rootProjectDir = this.workspaceCompositeRootProjectLabel.getText().isEmpty() ? null: new File(this.workspaceCompositeRootProjectLabel.getText());
this.workspaceCompositeRootProjectLabel.addModifyListener(new ValidatingListener<>(this, () -> rootProjectDir, this.rootProjectValidator));

this.selectRootProject.addSelectionListener(new DirectoryDialogSelectionListener(this.getShell(), this.workspaceCompositeRootProjectLabel, "Root project"));
}
this.selectRootProject.addSelectionListener(new DirectoryDialogSelectionListener(this.getShell(), this.workspaceCompositeRootProjectLabel, "Root project"));
}
}

public void updateEnablement() {
Expand All @@ -168,16 +168,16 @@ public void dispose() {

@Override
public boolean performOk() {
IWorkingSet composite = getTargetComposite();
ConfigurationManager manager = CorePlugin.configurationManager();
CompositeConfiguration currentConfig = manager.loadCompositeConfiguration(composite);

CompositeConfiguration compConf = new DefaultCompositeConfiguration(currentConfig.getCompositeDir(),
composite.getElements(),
currentConfig.getBuildConfiguration(),
this.projectAsCompositeRootCheckbox.getSelection(),
new File(this.workspaceCompositeRootProjectLabel.getText()));
manager.saveCompositeConfiguration(compConf);
return true;
IWorkingSet composite = getTargetComposite();
ConfigurationManager manager = CorePlugin.configurationManager();
CompositeConfiguration currentConfig = manager.loadCompositeConfiguration(composite);

CompositeConfiguration compConf = new DefaultCompositeConfiguration(currentConfig.getCompositeDir(),
composite.getElements(),
currentConfig.getBuildConfiguration(),
this.projectAsCompositeRootCheckbox.getSelection(),
new File(this.workspaceCompositeRootProjectLabel.getText()));
manager.saveCompositeConfiguration(compConf);
return true;
}
}
Loading

0 comments on commit c9a60c1

Please sign in to comment.