<commit_before>/*******************************************************************************
 * Copyright 2013 <NAME>
 * <EMAIL>
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/
/**
 * 
 */
package de.uni_jena.iaa.linktype.atomic.core.workspace;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.prefs.Preferences;

import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;

/**
 * @author <NAME>
 *
 */
public class PickWorkspaceDialog extends TitleAreaDialog {

	    // the name of the file that tells us that the workspace directory belongs to our application
	    public static final String  WS_IDENTIFIER          = ".atomic_workspace";

	    // you would probably normally define these somewhere in your Preference Constants
	    private static final String _KeyWorkspaceRootDir   = "wsRootDir";
	    private static final String _KeyRememberWorkspace  = "wsRemember";
	    private static final String _KeyLastUsedWorkspaces = "wsLastUsedWorkspaces";

	    // this are our preferences we will be using as the IPreferenceStore is not available yet
	    private static Preferences  _preferences           = Preferences.userNodeForPackage(PickWorkspaceDialog.class);

	    // various dialog messages
	    private static final String _StrMsg                = "Your workspace is where settings and various important files will be stored.";
	    private static final String _StrInfo               = "Please select a directory that will be the workspace root";
	    private static final String _StrError              = "You must set a directory";

	    // our controls
	    private Combo               _workspacePathCombo;
	    private List<String>        _lastUsedWorkspaces;
	    private Button              _RememberWorkspaceButton;

	    // used as separator when we save the last used workspace locations
	    private static final String _SplitChar             = "#";
	    // max number of entries in the history box
	    private static final int    _MaxHistory            = 20;

	    private boolean             _switchWorkspace;

	    // whatever the user picks ends up on this variable
	    private String              _selectedWorkspaceRootLocation;

	    /**
	     * Creates a new workspace dialog with a specific image as title-area image.
	     * 
	     * @param switchWorkspace true if we're using this dialog as a switch workspace dialog
	     * @param wizardImage Image to show
	     */
	    public PickWorkspaceDialog(boolean switchWorkspace/*, Image wizardImage*/) {
	        super(Display.getDefault().getActiveShell());
	        this._switchWorkspace = switchWorkspace;
//	        if (wizardImage != null) {
//	            setTitleImage(wizardImage);<commit_msg>Fix #6: Explain workspace in workspace wizard (http://github.com/infraling/atomic/issues/issues/issue/6)<commit_after>/*******************************************************************************
 * Copyright 2013 <NAME>
 * <EMAIL>
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/
/**
 * 
 */
package de.uni_jena.iaa.linktype.atomic.core.workspace;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.prefs.Preferences;

import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;

/**
 * @author <NAME>
 *
 */
public class PickWorkspaceDialog extends TitleAreaDialog {

	    // the name of the file that tells us that the workspace directory belongs to our application
	    public static final String  WS_IDENTIFIER          = ".atomic_workspace";

	    // you would probably normally define these somewhere in your Preference Constants
	    private static final String _KeyWorkspaceRootDir   = "wsRootDir";
	    private static final String _KeyRememberWorkspace  = "wsRemember";
	    private static final String _KeyLastUsedWorkspaces = "wsLastUsedWorkspaces";

	    // this are our preferences we will be using as the IPreferenceStore is not available yet
	    private static Preferences  _preferences           = Preferences.userNodeForPackage(PickWorkspaceDialog.class);

	    // various dialog messages
	    private static final String _StrMsg                = "Your workspace is where your projects (and some settings) will be stored.\n"
	    		+ "It is portable, and you can have more than one workspace, e.g., for different use cases.";
	    private static final String _StrInfo               = "Please select a directory that will be the workspace root";
	    private static final String _StrError              = "You must set a directory";

	    // our controls
	    private Combo               _workspacePathCombo;
	    private List<String>        _lastUsedWorkspaces;
	    private Button              _RememberWorkspaceButton;

	    // used as separator when we save the last used workspace locations
	    private static final String _SplitChar             = "#";
	    // max number of entries in the history box
	    private static final int    _MaxHistory            = 20;

	    private boolean             _switchWorkspace;

	    // whatever the user picks ends up on this variable
	    private String              _selectedWorkspaceRootLocation;

	    /**
	     * Creates a new workspace dialog with a specific image as title-area image.
	     * 
	     * @param switchWorkspace true if we're using this dialog as a switch workspace dialog
	     * @param wizardImage Image to show
	     */
	    public PickWorkspaceDialog(boolean switchWorkspace/*, Image wizardImage*/) {
	        super(Display.getDefault().getActiveShell());
	        this._switchWorkspace = switchWorkspace;
//	        if (wizardImage != null) {
//	            setTitleImage(wizardImage);
{'fraction_non_alphanumeric': 0.11046931407942238, 'fraction_numerical': 0.002647412755716005, 'mean_word_length': 3.367314766158697, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3147042', 'n_tokens_mistral': 2199, 'n_tokens_neox': 2061, 'n_words': 730}