From b62463718aa3aa098cd86ec651997f732807a809 Mon Sep 17 00:00:00 2001 From: Marvin Philipp Vogel Date: Wed, 13 Oct 2021 14:47:56 +0200 Subject: [PATCH 1/4] Improve wizard interface for the task selection page Signed-off-by: Marvin Philipp Vogel --- .../wizard/TaskSelectionPage.java | 216 +++++++++++------- 1 file changed, 133 insertions(+), 83 deletions(-) diff --git a/plugins/de.cognicrypt.codegenerator/src/main/java/de/cognicrypt/codegenerator/wizard/TaskSelectionPage.java b/plugins/de.cognicrypt.codegenerator/src/main/java/de/cognicrypt/codegenerator/wizard/TaskSelectionPage.java index 3875937a4..97a0184cc 100644 --- a/plugins/de.cognicrypt.codegenerator/src/main/java/de/cognicrypt/codegenerator/wizard/TaskSelectionPage.java +++ b/plugins/de.cognicrypt.codegenerator/src/main/java/de/cognicrypt/codegenerator/wizard/TaskSelectionPage.java @@ -14,7 +14,6 @@ import java.io.File; import java.io.FileInputStream; -import java.io.InputStream; import java.net.URI; import java.net.URL; import java.util.ArrayList; @@ -25,15 +24,19 @@ import org.eclipse.jface.wizard.WizardPage; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.ScrolledComposite; +import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.FontData; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.layout.RowData; +import org.eclipse.swt.layout.RowLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Listener; import org.eclipse.ui.PlatformUI; @@ -46,8 +49,9 @@ public class TaskSelectionPage extends WizardPage { - private Composite container; - private Task selectedTask = null; + private TaskItemComposite selectedTaskItem = null; + private Composite listOfTaskItems; // Row Layout Composite that holds task items composite + private List taskItems = new ArrayList(); // ArrayList of all tasks item composite public TaskSelectionPage() { super(Constants.SELECT_TASK); @@ -58,76 +62,43 @@ public TaskSelectionPage() { @Override public void createControl(final Composite parent) { - final List tasks = TaskJSONReader.getTasks(); + // Make the content able to scroll final ScrolledComposite sc = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL); sc.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - this.container = new Composite(sc, SWT.NONE); - this.container.setBounds(10, 10, 450, 200); - - //To display the Help view after clicking the help icon + // To display the Help view after clicking the help icon PlatformUI.getWorkbench().getHelpSystem().setHelp(sc, "de.cognicrypt.codegenerator.TaskSelectionHelp"); - final GridLayout gl = new GridLayout(2, false); - gl.verticalSpacing = -6; - this.container.setLayout(gl); - - new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1); - new Label(this.container, SWT.NONE); - final Label useCaseDescriptionLabel = new Label(this.container, SWT.WRAP); - final GridData gd_selectProjectLabel = new GridData(SWT.FILL, SWT.FILL, false, false, 1, tasks.size() + 1); - gd_selectProjectLabel.heightHint = 200; - gd_selectProjectLabel.widthHint = 600; - useCaseDescriptionLabel.setLayoutData(gd_selectProjectLabel); - Font a = useCaseDescriptionLabel.getFont(); - useCaseDescriptionLabel.setFont(new Font(useCaseDescriptionLabel.getDisplay(), new FontData(a.getFontData()[0].getName(), 12, SWT.None))); - - final List