<commit_before>package ee.ut.cs.rum.workspaces.internal.ui.workspace;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StackLayout;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;

import ee.ut.cs.rum.database.domain.Workspace;
import ee.ut.cs.rum.database.util.WorkspaceAccess;
import ee.ut.cs.rum.workspaces.internal.Activator;
import ee.ut.cs.rum.workspaces.internal.ui.WorkspacesHeader;
import ee.ut.cs.rum.workspaces.ui.WorkspacesUI;

public class WorkspaceSelectorCombo extends Combo {
	private static final long serialVersionUID = -1671918025859199853L;
	
	//TODO: WorkspacesOverview should not be handled trough workspaceDetails list
	private List<Workspace> workspaces;
	private List<Composite> workspaceDetails;
	private WorkspacesUI workspacesUI;
	private WorkspacesHeader workspacesHeader;

	public WorkspaceSelectorCombo(WorkspacesHeader workspacesHeader, WorkspacesUI workspacesUI) {
		super(workspacesHeader, SWT.READ_ONLY);
		this.workspacesUI=workspacesUI;
		this.workspacesHeader=workspacesHeader;

		this.add("Overview");
		this.setVisibleItemCount(10);
		this.select(0);
		updateWorkspaceSelector();

		this.addSelectionListener(new SelectionAdapter() {
			private static final long serialVersionUID = -5264275242878279673L;

			public void widgetSelected( SelectionEvent event ) {
				updateSelectedWorkspaceDetails();
			}
		});
	}
	
	private void updateWorkspaceSelector() {
		this.workspaces = new ArrayList<Workspace>();
		this.workspaces.add(null);
		this.workspaces.addAll(WorkspaceAccess.getWorkspacesDataFromDb());
		createWorkspaceDetailsList(workspaces.size());<commit_msg>WorkspaceSelectorCombo listener is now similar to others<commit_after>package ee.ut.cs.rum.workspaces.internal.ui.workspace;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StackLayout;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

import ee.ut.cs.rum.database.domain.Workspace;
import ee.ut.cs.rum.database.util.WorkspaceAccess;
import ee.ut.cs.rum.workspaces.internal.Activator;
import ee.ut.cs.rum.workspaces.internal.ui.WorkspacesHeader;
import ee.ut.cs.rum.workspaces.ui.WorkspacesUI;

public class WorkspaceSelectorCombo extends Combo {
	private static final long serialVersionUID = -1671918025859199853L;
	
	//TODO: WorkspacesOverview should not be handled trough workspaceDetails list
	private List<Workspace> workspaces;
	private List<Composite> workspaceDetails;
	private WorkspacesUI workspacesUI;
	private WorkspacesHeader workspacesHeader;

	public WorkspaceSelectorCombo(WorkspacesHeader workspacesHeader, WorkspacesUI workspacesUI) {
		super(workspacesHeader, SWT.READ_ONLY);
		this.workspacesUI=workspacesUI;
		this.workspacesHeader=workspacesHeader;

		this.add("Overview");
		this.setVisibleItemCount(10);
		this.select(0);
		updateWorkspaceSelector();

		this.addListener(SWT.Selection, new Listener() {
			private static final long serialVersionUID = -1752969541573951231L;

			public void handleEvent(Event e) {
				updateSelectedWorkspaceDetails();
			}
		});
	}
	
	private void updateWorkspaceSelector() {
		this.workspaces = new ArrayList<Workspace>();
		this.workspaces.add(null);
		this.workspaces.addAll(WorkspaceAccess.getWorkspacesDataFromDb());
		createWorkspaceDetailsList(workspaces.size());
{'fraction_non_alphanumeric': 0.09910913140311804, 'fraction_numerical': 0.022828507795100223, 'mean_word_length': 6.086785009861933, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3320996', 'n_tokens_mistral': 1252, 'n_tokens_neox': 1105, 'n_words': 197}