From 1ac7f34fc4e3c45b51d3980f4c83d0ab5bb3cf7b Mon Sep 17 00:00:00 2001 From: Donat Csikos Date: Fri, 15 May 2020 15:49:41 +0200 Subject: [PATCH] Fix build failures --- ...eCompositeImportOptionsPreferencePage.java | 16 ++- ...dleCompositeRootProjectPreferencePage.java | 47 +++--- ...radleWorkspaceCompositePreferencePage.java | 42 +++--- .../util/widget/GradleProjectGroup.java | 134 +++++++++--------- .../ui/internal/util/widget/UiBuilder.java | 22 +-- .../AbstractWizardPage.java | 26 ++-- .../AbstractWorkspaceCompositeWizard.java | 18 ++- ...dleCreateWorkspaceCompositeWizardPage.java | 38 +++-- .../GradleImportOptionsWizardPage.java | 31 ++-- .../GradleRootProjectWizardPage.java | 50 ++++--- .../WorkspaceCompositeCreationWizard.java | 19 ++- .../WorkspaceCompositeWizardMessages.java | 24 ++-- 12 files changed, 227 insertions(+), 240 deletions(-) diff --git a/org.eclipse.buildship.ui/src/main/java/org/eclipse/buildship/ui/internal/preferences/GradleCompositeImportOptionsPreferencePage.java b/org.eclipse.buildship.ui/src/main/java/org/eclipse/buildship/ui/internal/preferences/GradleCompositeImportOptionsPreferencePage.java index 4bb7c126db..c1e74bbc38 100644 --- a/org.eclipse.buildship.ui/src/main/java/org/eclipse/buildship/ui/internal/preferences/GradleCompositeImportOptionsPreferencePage.java +++ b/org.eclipse.buildship.ui/src/main/java/org/eclipse/buildship/ui/internal/preferences/GradleCompositeImportOptionsPreferencePage.java @@ -1,10 +1,12 @@ -/* - * Copyright (c) 2017 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) 2019 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.preferences; diff --git a/org.eclipse.buildship.ui/src/main/java/org/eclipse/buildship/ui/internal/preferences/GradleCompositeRootProjectPreferencePage.java b/org.eclipse.buildship.ui/src/main/java/org/eclipse/buildship/ui/internal/preferences/GradleCompositeRootProjectPreferencePage.java index 6570fd72b4..1afc18af35 100644 --- a/org.eclipse.buildship.ui/src/main/java/org/eclipse/buildship/ui/internal/preferences/GradleCompositeRootProjectPreferencePage.java +++ b/org.eclipse.buildship.ui/src/main/java/org/eclipse/buildship/ui/internal/preferences/GradleCompositeRootProjectPreferencePage.java @@ -1,15 +1,15 @@ -/* - * Copyright (c) 2017 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) 2019 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.preferences; -import org.eclipse.buildship.ui.internal.util.layout.LayoutUtils; -import org.eclipse.buildship.ui.internal.wizard.workspacecomposite.WorkspaceCompositeWizardMessages; import org.eclipse.jface.layout.GridDataFactory; import org.eclipse.jface.layout.GridLayoutFactory; import org.eclipse.swt.SWT; @@ -23,6 +23,9 @@ import org.eclipse.swt.widgets.Text; import org.eclipse.ui.dialogs.PropertyPage; +import org.eclipse.buildship.ui.internal.util.layout.LayoutUtils; +import org.eclipse.buildship.ui.internal.wizard.workspacecomposite.WorkspaceCompositeWizardMessages; + /** * Preference page for composite root project. * @@ -39,29 +42,29 @@ public final class GradleCompositeRootProjectPreferencePage extends PropertyPage private Button selectRootProject; private Composite rootProjectSettingsComposite; private Label rootProjectLabel; - + private Layout createLayout() { GridLayout layout = LayoutUtils.newGridLayout(2); layout.horizontalSpacing = 4; layout.verticalSpacing = 4; return layout; } - + @Override protected Control createContents(Composite parent) { - - this.rootProjectSettingsComposite = new Composite(parent, SWT.NONE); - rootProjectSettingsComposite.setLayout(createLayout()); - this.overrideSettingsCheckbox = new Button(rootProjectSettingsComposite, SWT.CHECK); + this.rootProjectSettingsComposite = new Composite(parent, SWT.NONE); + this.rootProjectSettingsComposite.setLayout(createLayout()); + + this.overrideSettingsCheckbox = new Button(this.rootProjectSettingsComposite, SWT.CHECK); this.overrideSettingsCheckbox.setText("Use project as composite root"); - GridDataFactory.swtDefaults().applyTo(rootProjectSettingsComposite); - - Label line = new Label(rootProjectSettingsComposite, SWT.SEPARATOR | SWT.HORIZONTAL); + GridDataFactory.swtDefaults().applyTo(this.rootProjectSettingsComposite); + + Label line = new Label(this.rootProjectSettingsComposite, SWT.SEPARATOR | SWT.HORIZONTAL); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(2, 1).applyTo(line); - + // composite root container - Composite workspaceCompositeNameComposite = new Composite(rootProjectSettingsComposite, SWT.NONE); + Composite workspaceCompositeNameComposite = new Composite(this.rootProjectSettingsComposite, SWT.NONE); GridLayoutFactory.swtDefaults().extendedMargins(0, 0, 0, 10).numColumns(3).applyTo(workspaceCompositeNameComposite); GridDataFactory.swtDefaults().align(SWT.FILL, SWT.TOP).grab(true, false).span(3, SWT.DEFAULT).applyTo(workspaceCompositeNameComposite); @@ -73,12 +76,12 @@ protected Control createContents(Composite parent) { // root project text field this.workspaceCompositeRootProjectLabel = new Text(workspaceCompositeNameComposite, SWT.BORDER); this.workspaceCompositeRootProjectLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); - + // root project select button this.selectRootProject = new Button(workspaceCompositeNameComposite, SWT.PUSH); this.selectRootProject.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); this.selectRootProject.setText(WorkspaceCompositeWizardMessages.Button_Select_RootProject); - return rootProjectSettingsComposite; + return this.rootProjectSettingsComposite; } @Override diff --git a/org.eclipse.buildship.ui/src/main/java/org/eclipse/buildship/ui/internal/preferences/GradleWorkspaceCompositePreferencePage.java b/org.eclipse.buildship.ui/src/main/java/org/eclipse/buildship/ui/internal/preferences/GradleWorkspaceCompositePreferencePage.java index 34d0b5a146..63d52f0aa1 100644 --- a/org.eclipse.buildship.ui/src/main/java/org/eclipse/buildship/ui/internal/preferences/GradleWorkspaceCompositePreferencePage.java +++ b/org.eclipse.buildship.ui/src/main/java/org/eclipse/buildship/ui/internal/preferences/GradleWorkspaceCompositePreferencePage.java @@ -1,22 +1,18 @@ -/* - * Copyright (c) 2017 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) 2019 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.preferences; -import org.eclipse.buildship.ui.internal.util.font.FontUtils; -import org.eclipse.buildship.ui.internal.util.layout.LayoutUtils; -import org.eclipse.buildship.ui.internal.util.widget.GradleProjectGroup; -import org.eclipse.buildship.ui.internal.util.widget.UiBuilder; -import org.eclipse.buildship.ui.internal.wizard.workspacecomposite.WorkspaceCompositeWizardMessages; import org.eclipse.jface.layout.GridDataFactory; import org.eclipse.jface.layout.GridLayoutFactory; import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Font; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; @@ -24,8 +20,12 @@ import org.eclipse.swt.widgets.Text; import org.eclipse.ui.dialogs.PropertyPage; +import org.eclipse.buildship.ui.internal.util.layout.LayoutUtils; +import org.eclipse.buildship.ui.internal.util.widget.GradleProjectGroup; +import org.eclipse.buildship.ui.internal.wizard.workspacecomposite.WorkspaceCompositeWizardMessages; + /** - * Preference page for workspace composite configuration + * Preference page for workspace composite configuration. * * @author Sebastian Kuzniarz */ @@ -41,11 +41,11 @@ public final class GradleWorkspaceCompositePreferencePage extends PropertyPage { @Override protected Control createContents(Composite parent) { - this.gradleWorkspaceCompositeSettingsComposite = new Composite(parent, SWT.FILL); - gradleWorkspaceCompositeSettingsComposite.setLayout(LayoutUtils.newGridLayout(2)); + this.gradleWorkspaceCompositeSettingsComposite = new Composite(parent, SWT.FILL); + this.gradleWorkspaceCompositeSettingsComposite.setLayout(LayoutUtils.newGridLayout(2)); // composite name container - Composite workspaceCompositeNameComposite = new Composite(gradleWorkspaceCompositeSettingsComposite, SWT.FILL); + Composite workspaceCompositeNameComposite = new Composite(this.gradleWorkspaceCompositeSettingsComposite, SWT.FILL); GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 5).numColumns(2).applyTo(workspaceCompositeNameComposite); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).grab(true, false).span(3, SWT.DEFAULT).applyTo(workspaceCompositeNameComposite); @@ -57,11 +57,11 @@ protected Control createContents(Composite parent) { // composite name text field this.workspaceCompositeNameText = new Text(workspaceCompositeNameComposite, SWT.BORDER); this.workspaceCompositeNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); - - this.gradleProjectCheckboxtreeComposite = new GradleProjectGroup(gradleWorkspaceCompositeSettingsComposite); + + this.gradleProjectCheckboxtreeComposite = new GradleProjectGroup(this.gradleWorkspaceCompositeSettingsComposite); GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).span(3, SWT.DEFAULT).applyTo(this.gradleProjectCheckboxtreeComposite); - - return gradleWorkspaceCompositeSettingsComposite; + + return this.gradleWorkspaceCompositeSettingsComposite; } @Override diff --git a/org.eclipse.buildship.ui/src/main/java/org/eclipse/buildship/ui/internal/util/widget/GradleProjectGroup.java b/org.eclipse.buildship.ui/src/main/java/org/eclipse/buildship/ui/internal/util/widget/GradleProjectGroup.java index 2bd1a42502..c23d4511b5 100644 --- a/org.eclipse.buildship.ui/src/main/java/org/eclipse/buildship/ui/internal/util/widget/GradleProjectGroup.java +++ b/org.eclipse.buildship.ui/src/main/java/org/eclipse/buildship/ui/internal/util/widget/GradleProjectGroup.java @@ -1,18 +1,15 @@ -/* - * 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) 2019 Gradle Inc. * - * Contributors: - * Sebastian Kuzniarz (Diebold Nixdorf Inc.) - initial UI implementation - */ + * 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.util.widget; -import org.eclipse.buildship.ui.internal.util.gradle.GradleDistributionViewModel; -import org.eclipse.buildship.ui.internal.wizard.workspacecomposite.WorkspaceCompositeWizardMessages; import org.eclipse.jface.layout.GridLayoutFactory; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Font; @@ -23,65 +20,66 @@ import org.eclipse.swt.widgets.Tree; import org.eclipse.swt.widgets.TreeItem; +import org.eclipse.buildship.ui.internal.wizard.workspacecomposite.WorkspaceCompositeWizardMessages; + @SuppressWarnings("unused") public class GradleProjectGroup extends Group { - - private Font font; - private Button newGradleProject; - private Button addExternalGradleProject; - private Composite buttonComposite; - private Tree gradleProjectTree; - - public GradleProjectGroup(Composite parent) { - super(parent, SWT.NONE); - setText(WorkspaceCompositeWizardMessages.Group_Label_GradleProjects); - createWidgets(); - } - - public void createWidgets() { - setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - GridLayoutFactory.swtDefaults().numColumns(4).applyTo(this); - - this.gradleProjectTree = new Tree(this, SWT.CHECK); - this.gradleProjectTree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); - - this.buttonComposite = new Composite(this, SWT.NONE); - this.buttonComposite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, true, 1, 1)); - GridLayoutFactory.fillDefaults().numColumns(1).applyTo(buttonComposite); - - this.newGradleProject = new Button(buttonComposite, SWT.PUSH); - this.newGradleProject.setText(WorkspaceCompositeWizardMessages.Button_New_GradleProject); - this.newGradleProject.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); - - this.addExternalGradleProject = new Button(buttonComposite, SWT.PUSH); - this.addExternalGradleProject.setText(WorkspaceCompositeWizardMessages.Button_Add_ExternalGradleProject); - this.addExternalGradleProject.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); - - fillCheckboxTreeWithFakeData(); - } - - private void fillCheckboxTreeWithFakeData() { - for (int i = 0; i < 4; i++) { - TreeItem iItem = new TreeItem(this.gradleProjectTree, 0); - iItem.setText("TreeItem (0) -" + i); - for (int j = 0; j < 4; j++) { - TreeItem jItem = new TreeItem(iItem, 0); - jItem.setText("TreeItem (1) -" + j); - for (int k = 0; k < 4; k++) { - TreeItem kItem = new TreeItem(jItem, 0); - kItem.setText("TreeItem (2) -" + k); - for (int l = 0; l < 4; l++) { - TreeItem lItem = new TreeItem(kItem, 0); - lItem.setText("TreeItem (3) -" + l); - } - } - } - } - } - - @Override - protected void checkSubclass() { + private Font font; + private Button newGradleProject; + private Button addExternalGradleProject; + private Composite buttonComposite; + private Tree gradleProjectTree; + + public GradleProjectGroup(Composite parent) { + super(parent, SWT.NONE); + setText(WorkspaceCompositeWizardMessages.Group_Label_GradleProjects); + createWidgets(); + } + + public void createWidgets() { + setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + GridLayoutFactory.swtDefaults().numColumns(4).applyTo(this); + + this.gradleProjectTree = new Tree(this, SWT.CHECK); + this.gradleProjectTree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); + + this.buttonComposite = new Composite(this, SWT.NONE); + this.buttonComposite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, true, 1, 1)); + GridLayoutFactory.fillDefaults().numColumns(1).applyTo(this.buttonComposite); + + this.newGradleProject = new Button(this.buttonComposite, SWT.PUSH); + this.newGradleProject.setText(WorkspaceCompositeWizardMessages.Button_New_GradleProject); + this.newGradleProject.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + this.addExternalGradleProject = new Button(this.buttonComposite, SWT.PUSH); + this.addExternalGradleProject.setText(WorkspaceCompositeWizardMessages.Button_Add_ExternalGradleProject); + this.addExternalGradleProject.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + fillCheckboxTreeWithFakeData(); + } + + private void fillCheckboxTreeWithFakeData() { + for (int i = 0; i < 4; i++) { + TreeItem iItem = new TreeItem(this.gradleProjectTree, 0); + iItem.setText("TreeItem (0) -" + i); + for (int j = 0; j < 4; j++) { + TreeItem jItem = new TreeItem(iItem, 0); + jItem.setText("TreeItem (1) -" + j); + for (int k = 0; k < 4; k++) { + TreeItem kItem = new TreeItem(jItem, 0); + kItem.setText("TreeItem (2) -" + k); + for (int l = 0; l < 4; l++) { + TreeItem lItem = new TreeItem(kItem, 0); + lItem.setText("TreeItem (3) -" + l); + } + } + } + } + } + + @Override + protected void checkSubclass() { // Disable the check that prevents subclassing of SWT components - } + } } diff --git a/org.eclipse.buildship.ui/src/main/java/org/eclipse/buildship/ui/internal/util/widget/UiBuilder.java b/org.eclipse.buildship.ui/src/main/java/org/eclipse/buildship/ui/internal/util/widget/UiBuilder.java index 8960712bf5..5cb2a45d94 100644 --- a/org.eclipse.buildship.ui/src/main/java/org/eclipse/buildship/ui/internal/util/widget/UiBuilder.java +++ b/org.eclipse.buildship.ui/src/main/java/org/eclipse/buildship/ui/internal/util/widget/UiBuilder.java @@ -84,16 +84,16 @@ public UiBuilder alignFillHorizontal() { this.control.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); return this; } - + /** * Aligns the created widget to fill the cell vertically aligned at top. * * @return the builder */ - public UiBuilder alignFillVerticalTop() { + public UiBuilder alignFillVerticalTop() { this.control.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, true, 1, 1)); - return this; - } + return this; + } /** * Aligns the created widget to fill both horizontal and vertical. @@ -186,7 +186,7 @@ public UiBuilder