<commit_before>/*******************************************************************************
 * Copyright (c) 2004 - 2005 University Of British Columbia and others.
 * 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
 *
 * Contributors:
 *     University Of British Columbia - initial API and implementation
 *******************************************************************************/

package org.eclipse.mylar.tasks.ui.views;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;

import javax.security.auth.login.LoginException;

import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IMenuCreator;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.CheckboxCellEditor;
import org.eclipse.jface.viewers.ComboBoxCellEditor;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.ICellModifier;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TextCellEditor;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerDropAdapter;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.jface.window.Window;
import org.eclipse.mylar.core.ITaskscapeListener;
import org.eclipse.mylar.core.MylarPlugin;
import org.eclipse.mylar.dt.MylarWebRef;
import org.eclipse.mylar.tasks.AbstractCategory;
import org.eclipse.mylar.tasks.BugzillaHit;
import org.eclipse.mylar.tasks.BugzillaQueryCategory;
import org.eclipse.mylar.tasks.BugzillaTask;
import org.eclipse.mylar.tasks.ITask;
import org.eclipse.mylar.tasks.ITaskListElement;
import org.eclipse.mylar.tasks.MylarTasksPlugin;
import org.eclipse.mylar.tasks.Task;
import org.eclipse.mylar.tasks.TaskCategory;
import org.eclipse.mylar.tasks.ui.BugzillaTaskEditorInput;
import org.eclipse.mylar.tasks.ui.TaskEditorInput;
import org.eclipse.mylar.tasks.ui.actions.ClearContextAction;
import org.eclipse.mylar.tasks.ui.actions.CreateBugzillaQueryCategoryAction;
import org.eclipse.mylar.tasks.ui.actions.CreateBugzillaTaskAction;
import org.eclipse.mylar.tasks.ui.actions.CreateCategoryAction;
import org.eclipse.mylar.tasks.ui.actions.CreateTaskAction;
import org.eclipse.mylar.tasks.ui.actions.DeleteAction;
import org.eclipse.mylar.tasks.ui.actions.FilterCompletedTasksAction;
import org.eclipse.mylar.tasks.ui.actions.MarkTaskCompleteAction;
import org.eclipse.mylar.tasks.ui.actions.MarkTaskIncompleteAction;
import org.eclipse.mylar.tasks.ui.actions.MoveTaskToRootAction;
import org.eclipse.mylar.tasks.ui.actions.OpenTaskEditorAction;
import org.eclipse.mylar.tasks.ui.actions.RefreshBugzillaAction;
import org.eclipse.mylar.tasks.ui.actions.RefreshBugzillaReportsAction;
import org.eclipse.mylar.tasks.ui.actions.TaskActivateAction;
import org.eclipse.mylar.tasks.ui.actions.TaskDeactivateAction;
import org.eclipse.mylar.ui.MylarImages;
import org.eclipse.mylar.ui.MylarUiPlugin;
import org.eclipse.mylar.ui.internal.views.Highlighter;
import org.eclipse.mylar.ui.internal.views.HighlighterImageDescriptor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.DragSourceEvent;
import org.eclipse.swt.dnd.DragSourceListener;
import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.dnd.TransferData;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.TreeColumn;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.internal.Workbench;
import org.eclipse.ui.part.DrillDownAdapter;
import org.eclipse.ui.part.ViewPart;

/**
 * @author <NAME>
 */
public class TaskListView extends ViewPart {

	private static TaskListView INSTANCE;
	
	TreeViewer viewer;
    private DrillDownAdapter drillDownAdapter;
    
    private RefreshBugzillaReportsAction refresh;
    private CreateTaskAction createTask;
    private CreateCategoryAction createCategory;
    private CreateBugzillaQueryCategoryAction createBugzillaQueryCategory;
    private CreateBugzillaTaskAction createBugzillaTask; 
//    private RenameAction rename;
    private DeleteAction delete;
    private OpenTaskEditorAction doubleClickAction;
    private ClearContextAction clearSelectedTaskscapeAction;

    //private Action toggleIntersectionModeAction = new ToggleIntersectionModeAction();
//    private Action toggleFilteringAction = new ToggleGlobalInterestFilteringAction();

    private MarkTaskCompleteAction completeTask;
    private MarkTaskIncompleteAction incompleteTask;
    private FilterCompletedTasksAction filterCompleteTask;
//    private FilterIncompleteTasksAction filterInCompleteTask;
    private PriorityDropDownAction filterOnPriority;
    private Action moveTaskToRoot; 
    private RefreshBugzillaAction refreshQuery;
    private PriorityFilter priorityFilter = new PriorityFilter();
    
    protected String[] columnNames = new String[] { "", ".", "!", "Description" };
    protected int[] columnWidths = new int[] { 70, 20, 20, 120 };
    private TreeColumn[] columns;
    private IMemento taskListMemento;
    public static final String columnWidthIdentifier = "org.eclipse.mylar.tasks.ui.views.tasklist.columnwidth";
    public static final String tableSortIdentifier = "org.eclipse.mylar.tasks.ui.views.tasklist.sortIndex";
    private int sortIndex = 2;
    
    private static String[] PRIORITY_LEVELS = { "P1", "P2", "P3", "P4", "P5" };    
    
    private final class PriorityDropDownAction extends Action implements IMenuCreator {
    	private Menu dropDownMenu = null;
    	
		public PriorityDropDownAction() {
			super();
			setText("Display Priorities");
			setToolTipText("Show Tasks with Priority Levels");
			setImageDescriptor(MylarImages.FILTER_PRIORITY);
			setMenuCreator(this);			
		}
    	
		public void dispose() {			
			if (dropDownMenu != null) {
				dropDownMenu.dispose();
				dropDownMenu = null;
			}
		}

		public Menu getMenu(Control parent) {			
			if (dropDownMenu != null) {
				dropDownMenu.dispose();
			}
			dropDownMenu = new Menu(parent);<commit_msg>Improved label<commit_after>/*******************************************************************************
 * Copyright (c) 2004 - 2005 University Of British Columbia and others.
 * 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
 *
 * Contributors:
 *     University Of British Columbia - initial API and implementation
 *******************************************************************************/

package org.eclipse.mylar.tasks.ui.views;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;

import javax.security.auth.login.LoginException;

import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IMenuCreator;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.CheckboxCellEditor;
import org.eclipse.jface.viewers.ComboBoxCellEditor;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.ICellModifier;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TextCellEditor;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerDropAdapter;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.jface.window.Window;
import org.eclipse.mylar.core.ITaskscapeListener;
import org.eclipse.mylar.core.MylarPlugin;
import org.eclipse.mylar.dt.MylarWebRef;
import org.eclipse.mylar.tasks.AbstractCategory;
import org.eclipse.mylar.tasks.BugzillaHit;
import org.eclipse.mylar.tasks.BugzillaQueryCategory;
import org.eclipse.mylar.tasks.BugzillaTask;
import org.eclipse.mylar.tasks.ITask;
import org.eclipse.mylar.tasks.ITaskListElement;
import org.eclipse.mylar.tasks.MylarTasksPlugin;
import org.eclipse.mylar.tasks.Task;
import org.eclipse.mylar.tasks.TaskCategory;
import org.eclipse.mylar.tasks.ui.BugzillaTaskEditorInput;
import org.eclipse.mylar.tasks.ui.TaskEditorInput;
import org.eclipse.mylar.tasks.ui.actions.ClearContextAction;
import org.eclipse.mylar.tasks.ui.actions.CreateBugzillaQueryCategoryAction;
import org.eclipse.mylar.tasks.ui.actions.CreateBugzillaTaskAction;
import org.eclipse.mylar.tasks.ui.actions.CreateCategoryAction;
import org.eclipse.mylar.tasks.ui.actions.CreateTaskAction;
import org.eclipse.mylar.tasks.ui.actions.DeleteAction;
import org.eclipse.mylar.tasks.ui.actions.FilterCompletedTasksAction;
import org.eclipse.mylar.tasks.ui.actions.MarkTaskCompleteAction;
import org.eclipse.mylar.tasks.ui.actions.MarkTaskIncompleteAction;
import org.eclipse.mylar.tasks.ui.actions.MoveTaskToRootAction;
import org.eclipse.mylar.tasks.ui.actions.OpenTaskEditorAction;
import org.eclipse.mylar.tasks.ui.actions.RefreshBugzillaAction;
import org.eclipse.mylar.tasks.ui.actions.RefreshBugzillaReportsAction;
import org.eclipse.mylar.tasks.ui.actions.TaskActivateAction;
import org.eclipse.mylar.tasks.ui.actions.TaskDeactivateAction;
import org.eclipse.mylar.ui.MylarImages;
import org.eclipse.mylar.ui.MylarUiPlugin;
import org.eclipse.mylar.ui.internal.views.Highlighter;
import org.eclipse.mylar.ui.internal.views.HighlighterImageDescriptor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.DragSourceEvent;
import org.eclipse.swt.dnd.DragSourceListener;
import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.dnd.TransferData;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.TreeColumn;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.internal.Workbench;
import org.eclipse.ui.part.DrillDownAdapter;
import org.eclipse.ui.part.ViewPart;

/**
 * @author <NAME>
 */
public class TaskListView extends ViewPart {

	private static TaskListView INSTANCE;
	
	TreeViewer viewer;
    private DrillDownAdapter drillDownAdapter;
    
    private RefreshBugzillaReportsAction refresh;
    private CreateTaskAction createTask;
    private CreateCategoryAction createCategory;
    private CreateBugzillaQueryCategoryAction createBugzillaQueryCategory;
    private CreateBugzillaTaskAction createBugzillaTask; 
//    private RenameAction rename;
    private DeleteAction delete;
    private OpenTaskEditorAction doubleClickAction;
    private ClearContextAction clearSelectedTaskscapeAction;

    //private Action toggleIntersectionModeAction = new ToggleIntersectionModeAction();
//    private Action toggleFilteringAction = new ToggleGlobalInterestFilteringAction();

    private MarkTaskCompleteAction completeTask;
    private MarkTaskIncompleteAction incompleteTask;
    private FilterCompletedTasksAction filterCompleteTask;
//    private FilterIncompleteTasksAction filterInCompleteTask;
    private PriorityDropDownAction filterOnPriority;
    private Action moveTaskToRoot; 
    private RefreshBugzillaAction refreshQuery;
    private PriorityFilter priorityFilter = new PriorityFilter();
    
    protected String[] columnNames = new String[] { "", ".", "!", "Description" };
    protected int[] columnWidths = new int[] { 70, 20, 20, 120 };
    private TreeColumn[] columns;
    private IMemento taskListMemento;
    public static final String columnWidthIdentifier = "org.eclipse.mylar.tasks.ui.views.tasklist.columnwidth";
    public static final String tableSortIdentifier = "org.eclipse.mylar.tasks.ui.views.tasklist.sortIndex";
    private int sortIndex = 2;
    
    private static String[] PRIORITY_LEVELS = { "P1", "P2", "P3", "P4", "P5" };    
    
    private final class PriorityDropDownAction extends Action implements IMenuCreator {
    	private Menu dropDownMenu = null;
    	
		public PriorityDropDownAction() {
			super();
			setText("Priority Filter");
			setToolTipText("Filter priority lower than");
			setImageDescriptor(MylarImages.FILTER_PRIORITY);
			setMenuCreator(this);			
		}
    	
		public void dispose() {			
			if (dropDownMenu != null) {
				dropDownMenu.dispose();
				dropDownMenu = null;
			}
		}

		public Menu getMenu(Control parent) {			
			if (dropDownMenu != null) {
				dropDownMenu.dispose();
			}
			dropDownMenu = new Menu(parent);
{'fraction_non_alphanumeric': 0.1155871344287255, 'fraction_numerical': 0.00342574383048912, 'mean_word_length': 5.604105571847508, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '3113273', 'n_tokens_mistral': 4915, 'n_tokens_neox': 4735, 'n_words': 849}