org.eclipse.mylyn.tasks.ui_3.7.1.v20120425-0100

lic CopyCommentDetailsAction()
  {
    super(Messages.CopyCommentDetailsAction_Copy_User_ID);
    setToolTipText(Messages.CopyCommentDetailsAction_Copy_User_ID_Tooltip);
    setImageDescriptor(CommonImages.COPY);
  }
  
  public void run()
  {
    ClipboardCopier.getDefault().copy(getStructuredSelection(), new ClipboardCopier.TextProvider()
    {
      public String getTextForElement(Object element)
      {
        if ((element instanceof ITaskComment))
        {
          ITaskComment comment = (ITaskComment)element;
          IRepositoryPerson author = comment.getAuthor();
          if (author != null) {
            return author.getPersonId();
          }
        }
        return null;
      }
    });
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.tasks.ui.actions.CopyCommentDetailsAction
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.tasks.ui.actions;

import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.mylyn.commons.workbench.WorkbenchUtil;
import org.eclipse.mylyn.internal.tasks.core.AbstractTaskCategory;
import org.eclipse.mylyn.internal.tasks.core.ITaskList;
import org.eclipse.mylyn.internal.tasks.core.TaskCategory;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.commands.RemoteTaskSelectionDialog;
import org.eclipse.mylyn.internal.tasks.ui.util.TaskOpenEvent;
import org.eclipse.mylyn.internal.tasks.ui.util.TaskOpenListener;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
import org.eclipse.ui.PlatformUI;

public class OpenRepositoryTaskAction
  extends Action
  implements IWorkbenchWindowActionDelegate, IViewActionDelegate
{
  private static final String OPEN_REMOTE_TASK_DIALOG_DIALOG_SETTINGS = "org.eclipse.mylyn.tasks.ui.open.remote";
  
  public void run(IAction action)
  {
    RemoteTaskSelectionDialog dlg = new RemoteTaskSelectionDialog(WorkbenchUtil.getShell());
    dlg.setTitle(Messages.OpenRepositoryTask_Open_Repository_Task);
    
    IDialogSettings settings = TasksUiPlugin.getDefault().getDialogSettings();
    IDialogSettings dlgSettings = settings.getSection("org.eclipse.mylyn.tasks.ui.open.remote");
    if (dlgSettings == null) {
      dlgSettings = settings.addNewSection("org.eclipse.mylyn.tasks.ui.open.remote");
    }
    dlg.setDialogBoundsSettings(dlgSettings, 3);
    if (dlg.open() == 0) {
      if (dlg.getSelectedTask() != null) {
        openExistingTask(dlg);
      } else {
        openRemoteTask(dlg);
      }
    }
  }
  
  private void openExistingTask(RemoteTaskSelectionDialog dlg)
  {
    if (dlg.shouldAddToTaskList()) {
      TasksUiInternal.getTaskList().addTask(dlg.getSelectedTask(), dlg.getSelectedCategory());
    }
    TasksUiInternal.refreshAndOpenTaskListElement(dlg.getSelectedTask());
  }
  
  private void openRemoteTask(RemoteTaskSelectionDialog dlg)
  {
    AbstractTaskCategory finalCategory;
    final AbstractTaskCategory finalCategory;
    if (dlg.shouldAddToTaskList())
    {
      AbstractTaskCategory category = dlg.getSelectedCategory();
      TaskListView taskListView = TaskListView.getFromActivePerspective();
      if (category == null)
      {
        Object selectedObject = ((IStructuredSelection)taskListView.getViewer().getSelection()).getFirstElement();
        if ((selectedObject instanceof TaskCategory)) {
          category = (TaskCategory)selectedObject;
        }
      }
      finalCategory = category;
    }
    else
    {
      finalCategory = null;
    }
    String[] selectedIds = dlg.getSelectedIds();
    boolean openSuccessful = false;
    String[] arrayOfString1;
    int j = (arrayOfString1 = selectedIds).length;
    for (int i = 0; i < j; i++)
    {
      String id = arrayOfString1[i];
      boolean opened = TasksUiInternal.openTask(dlg.getSelectedTaskRepository(), id, new TaskOpenListener()
      {
        public void taskOpened(TaskOpenEvent event)
        {
          if ((finalCategory != null) && (event.getTask() != null)) {
            TasksUiInternal.getTaskList().addTask(event.getTask(), finalCategory);
          }
        }
      });
      if (opened) {
        openSuccessful = true;
      }
      if (!openSuccessful) {
        MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), 
          Messages.OpenRepositoryTask_Open_Task, 
          Messages.OpenRepositoryTask_Could_not_find_matching_repository_task);
      }
    }
  }
  
  public void dispose() {}
  
  public void init(IWorkbenchWindow window) {}
  
  public void selectionChanged(IAction action, ISelection selection) {}
  
  public void init(IViewPart view) {}
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.tasks.ui.actions.OpenRepositoryTaskAction
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.tasks.ui.actions;

import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;

class SynchronizeEditorAction$1
  extends JobChangeAdapter
{
  SynchronizeEditorAction$1(SynchronizeEditorAction paramSynchronizeEditorAction, TaskEditor paramTaskEditor) {}
  
  public void done(IJobChangeEvent event)
  {
    PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable()
    {
      /* Error */
      public void run()
      {
        // Byte code:
        //   0: aload_0
        //   1: getfield 33	org/eclipse/mylyn/internal/tasks/ui/actions/SynchronizeEditorAction$1$1:val$editor	Lorg/eclipse/mylyn/tasks/ui/editors/TaskEditor;
        //   4: invokevirtual 35	org/eclipse/mylyn/tasks/ui/editors/TaskEditor:refreshPages	()V
        //   7: goto +21 -> 28
        //   10: astore_1
        //   11: aload_0
        //   12: getfield 33	org/eclipse/mylyn/internal/tasks/ui/actions/SynchronizeEditorAction$1$1:val$editor	Lorg/eclipse/mylyn/tasks/ui/editors/TaskEditor;
        //   15: ifnull +11 -> 26
        //   18: aload_0
        //   19: getfield 33	org/eclipse/mylyn/internal/tasks/ui/actions/SynchronizeEditorAction$1$1:val$editor	Lorg/eclipse/mylyn/tasks/ui/editors/TaskEditor;
        //   22: iconst_0
        //   23: invokevirtual 36	org/eclipse/mylyn/tasks/ui/editors/TaskEditor:showBusy	(Z)V
        //   26: aload_1
        //   27: athrow
        //   28: aload_0
        //   29: getfield 33	org/eclipse/mylyn/internal/tasks/ui/actions/SynchronizeEditorAction$1$1:val$editor	Lorg/eclipse/mylyn/tasks/ui/editors/TaskEditor;
        //   32: ifnull +11 -> 43
        //   35: aload_0
        //   36: getfield 33	org/eclipse/mylyn/internal/tasks/ui/actions/SynchronizeEditorAction$1$1:val$editor	Lorg/eclipse/mylyn/tasks/ui/editors/TaskEditor;
        //   39: iconst_0
        //   40: invokevirtual 36	org/eclipse/mylyn/tasks/ui/editors/TaskEditor:showBusy	(Z)V
        //   43: return
        // Line number table:
        //   Java source line #72	-> byte code offset #0
        //   Java source line #73	-> byte code offset #10
        //   Java source line #74	-> byte code offset #11
        //   Java source line #75	-> byte code offset #18
        //   Java source line #77	-> byte code offset #26
        //   Java source line #74	-> byte code offset #28
        //   Java source line #75	-> byte code offset #35
        //   Java source line #78	-> byte code offset #43
        // Local variable table:
        //   start	length	slot	name	signature
        //   0	44	0	this	1
        //   10	17	1	localObject	Object
        // Exception table:
        //   from	to	target	type
        //   0	10	10	finally
      }
    });
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.tasks.ui.actions.SynchronizeEditorAction.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.tasks.ui.actions;

class FocusTaskListAction$2
  implements Runnable
{
  FocusTaskListAction$2(FocusTaskListAction paramFocusTaskListAction) {}
  
  /* Error */
  public void run()
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 81	org/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction$2:this$0	Lorg/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction;
    //   4: invokestatic 92	org/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction:access$0	(Lorg/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction;)Lorg/eclipse/mylyn/internal/tasks/ui/views/TaskListView;
    //   7: invokevirtual 99	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:getFilteredTree	()Lorg/eclipse/mylyn/internal/tasks/ui/views/TaskListFilteredTree;
    //   10: iconst_0
    //   11: invokevirtual 93	org/eclipse/mylyn/internal/tasks/ui/views/TaskListFilteredTree:setRedraw	(Z)V
    //   14: aload_0
    //   15: getfield 81	org/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction$2:this$0	Lorg/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction;
    //   18: invokestatic 92	org/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction:access$0	(Lorg/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction;)Lorg/eclipse/mylyn/internal/tasks/ui/views/TaskListView;
    //   21: iconst_1
    //   22: invokevirtual 95	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:setFocusedMode	(Z)V
    //   25: aload_0
    //   26: getfield 81	org/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction$2:this$0	Lorg/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction;
    //   29: aload_0
    //   30: getfield 81	org/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction$2:this$0	Lorg/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction;
    //   33: invokestatic 92	org/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction:access$0	(Lorg/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction;)Lorg/eclipse/mylyn/internal/tasks/ui/views/TaskListView;
    //   36: invokevirtual 97	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:getViewer	()Lorg/eclipse/jface/viewers/TreeViewer;
    //   39: invokevirtual 85	org/eclipse/jface/viewers/TreeViewer:getSorter	()Lorg/eclipse/jface/viewers/ViewerSorter;
    //   42: invokestatic 89	org/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction:access$1	(Lorg/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction;Lorg/eclipse/jface/viewers/ViewerSorter;)V
    //   45: aload_0
    //   46: getfield 81	org/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction$2:this$0	Lorg/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction;
    //   49: new 36	java/util/HashSet
    //   52: dup
    //   53: aload_0
    //   54: getfield 81	org/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction$2:this$0	Lorg/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction;
    //   57: invokestatic 92	org/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction:access$0	(Lorg/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction;)Lorg/eclipse/mylyn/internal/tasks/ui/views/TaskListView;
    //   60: invokevirtual 96	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:getFilters	()Ljava/util/Set;
    //   63: invokespecial 83	java/util/HashSet:<init>	(Ljava/util/Collection;)V
    //   66: invokestatic 88	org/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction:access$2	(Lorg/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction;Ljava/util/Set;)V
    //   69: aload_0
    //   70: getfield 81	org/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction$2:this$0	Lorg/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction;
    //   73: invokestatic 92	org/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction:access$0	(Lorg/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction;)Lorg/eclipse/mylyn/internal/tasks/ui/views/TaskListView;
    //   76: invokevirtual 94	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:clearFilters	()V
    //   79: aload_0
    //   80: getfield 81	org/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction$2:this$0	Lorg/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction;
    //   83: invokestatic 92	org/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction:access$0	(Lorg/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction;)Lorg/eclipse/mylyn/internal/tasks/ui/views/TaskListView;
    //   86: invokevirtual 96	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:getFilters	()Ljava/util/Set;
    //   89: aload_0
    //   90: getfield 81	org/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction$2:this$0	Lorg/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction;
    //   93: invokestatic 90	org/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction:access$3	(Lorg/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction;)Lorg/eclipse/mylyn/internal/tasks/ui/views/TaskListInterestFilter;
    //   96: invokeinterface 100 2 0
    //   101: ifne +20 -> 121
    //   104: aload_0
    //   105: getfield 81	org/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction$2:this$0	Lorg/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction;
    //   108: invokestatic 92	org/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction:access$0	(Lorg/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction;)Lorg/eclipse/mylyn/internal/tasks/ui/views/TaskListView;
    //   111: aload_0
    //   112: getfield 81	org/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction$2:this$0	Lorg/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction;
    //   115: invokestatic 90	org/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction:access$3	(Lorg/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction;)Lorg/eclipse/mylyn/internal/tasks/ui/views/TaskListInterestFilter;
    //   118: invokevirtual 98	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:addFilter	(Lorg/eclipse/mylyn/internal/tasks/ui/AbstractTaskListFilter;)V
    //   121: aload_0
    //   122: getfield 81	org/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction$2:this$0	Lorg/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction;
    //   125: invokestatic 92	org/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction:access$0	(Lorg/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction;)Lorg/eclipse/mylyn/internal/tasks/ui/views/TaskListView;
    //   128: invokevirtual 97	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:getViewer	()Lorg/eclipse/jface/viewers/TreeViewer;
    //   131: aload_0
    //   132: getfield 81	org/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction$2:this$0	Lorg/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction;
    //   135: invokestatic 91	org/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction:access$4	(Lorg/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction;)Lorg/eclipse/mylyn/internal/tasks/ui/views/TaskListInterestSorter;
    //   138: invokevirtual 86	org/eclipse/jface/viewers/TreeViewer:setSorter	(Lorg/eclipse/jface/viewers/ViewerSorter;)V
    //   141: aload_0
    //   142: getfield 81	org/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction$2:this$0	Lorg/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction;
    //   145: invokestatic 92	org/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction:access$0	(Lorg/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction;)Lorg/eclipse/mylyn/internal/tasks/ui/views/TaskListView;
    //   148: invokevirtual 97	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:getViewer	()Lorg/eclipse/jface/viewers/TreeViewer;
    //   151: invokevirtual 84	org/eclipse/jface/viewers/TreeViewer:expandAll	()V
    //   154: aload_0
    //   155: getfield 81	org/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction$2:this$0	Lorg/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction;
    //   158: iconst_1
    //   159: invokestatic 87	org/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction:access$5	(Lorg/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction;Z)V
    //   162: goto +20 -> 182
    //   165: astore_1
    //   166: aload_0
    //   167: getfield 81	org/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction$2:this$0	Lorg/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction;
    //   170: invokestatic 92	org/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction:access$0	(Lorg/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction;)Lorg/eclipse/mylyn/internal/tasks/ui/views/TaskListView;
    //   173: invokevirtual 99	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:getFilteredTree	()Lorg/eclipse/mylyn/internal/tasks/ui/views/TaskListFilteredTree;
    //   176: iconst_1
    //   177: invokevirtual 93	org/eclipse/mylyn/internal/tasks/ui/views/TaskListFilteredTree:setRedraw	(Z)V
    //   180: aload_1
    //   181: athrow
    //   182: aload_0
    //   183: getfield 81	org/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction$2:this$0	Lorg/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction;
    //   186: invokestatic 92	org/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction:access$0	(Lorg/eclipse/mylyn/internal/tasks/ui/actions/FocusTaskListAction;)Lorg/eclipse/mylyn/internal/tasks/ui/views/TaskListView;
    //   189: invokevirtual 99	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:getFilteredTree	()Lorg/eclipse/mylyn/internal/tasks/ui/views/TaskListFilteredTree;
    //   192: iconst_1
    //   193: invokevirtual 93	org/eclipse/mylyn/internal/tasks/ui/views/TaskListFilteredTree:setRedraw	(Z)V
    //   196: return
    // Line number table:
    //   Java source line #107	-> byte code offset #0
    //   Java source line #108	-> byte code offset #14
    //   Java source line #109	-> byte code offset #25
    //   Java source line #110	-> byte code offset #45
    //   Java source line #111	-> byte code offset #69
    //   Java source line #112	-> byte code offset #79
    //   Java source line #113	-> byte code offset #104
    //   Java source line #116	-> byte code offset #121
    //   Java source line #117	-> byte code offset #141
    //   Java source line #120	-> byte code offset #154
    //   Java source line #121	-> byte code offset #165
    //   Java source line #122	-> byte code offset #166
    //   Java source line #123	-> byte code offset #180
    //   Java source line #122	-> byte code offset #182
    //   Java source line #124	-> byte code offset #196
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	197	0	this	2
    //   165	16	1	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   0	165	165	finally
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.tasks.ui.actions.FocusTaskListAction.2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.tasks.ui.actions;

import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.mylyn.internal.tasks.core.TransferList;

public class ImportAction$ImportStatus
  extends MultiStatus
{
  private TransferList taskList;
  
  public ImportAction$ImportStatus(String pluginId, int code, String message, Throwable exception)
  {
    super(pluginId, code, message, exception);
  }
  
  public TransferList getTaskList()
  {
    return taskList;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.tasks.ui.actions.ImportAction.ImportStatus
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.tasks.ui.actions;

import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.ITaskActivityManager;
import org.eclipse.mylyn.tasks.ui.TasksUi;
import org.eclipse.mylyn.tasks.ui.TasksUiImages;
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.actions.BaseSelectionListenerAction;

public class TaskActivateAction
  extends BaseSelectionListenerAction
  implements IViewActionDelegate
{
  public static final String ID = "org.eclipse.mylyn.tasklist.actions.context.activate";
  
  public TaskActivateAction()
  {
    super(Messages.TaskActivateAction_Activate);
    setId("org.eclipse.mylyn.tasklist.actions.context.activate");
    setActionDefinitionId("org.eclipse.mylyn.tasks.ui.command.activateSelectedTask");
    setImageDescriptor(TasksUiImages.CONTEXT_ACTIVE_CENTERED);
  }
  
  public void init(IViewPart view) {}
  
  public void run()
  {
    run(TaskListView.getFromActivePerspective().getSelectedTask());
  }
  
  @Deprecated
  public void run(ITask task)
  {
    if ((task != null) && (!task.isActive())) {
      TasksUi.getTaskActivityManager().activateTask(task);
    }
  }
  
  public void run(IAction action)
  {
    run();
  }
  
  public void selectionChanged(IAction action, ISelection selection)
  {
    if ((selection instanceof IStructuredSelection)) {
      selectionChanged((IStructuredSelection)selection);
    } else {
      selectionChanged(StructuredSelection.EMPTY);
    }
    action.setEnabled(isEnabled());
  }
  
  protected boolean updateSelection(IStructuredSelection selection)
  {
    return (selection != null) && (selection.size() == 1) && ((selection.getFirstElement() instanceof ITask));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.tasks.ui.actions.TaskActivateAction
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.tasks.ui.actions;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.mylyn.commons.ui.compatibility.CommonColors;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
import org.eclipse.mylyn.internal.tasks.core.TaskActivationHistory;
import org.eclipse.mylyn.internal.tasks.core.TaskActivityManager;
import org.eclipse.mylyn.internal.tasks.core.TaskList;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.search.SearchUtil;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskDetailLabelProvider;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskListFilteredTree;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
import org.eclipse.mylyn.internal.tasks.ui.workingsets.TaskWorkingSetUpdater;
import org.eclipse.mylyn.internal.tasks.ui.workingsets.WorkingSetLabelComparator;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.ITaskContainer;
import org.eclipse.mylyn.tasks.ui.TaskElementLabelProvider;
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.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.ISelectionService;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.IWorkingSetManager;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.FilteredItemsSelectionDialog;
import org.eclipse.ui.dialogs.FilteredItemsSelectionDialog.AbstractContentProvider;
import org.eclipse.ui.dialogs.FilteredItemsSelectionDialog.ItemsFilter;
import org.eclipse.ui.dialogs.FilteredItemsSelectionDialog.SelectionHistory;
import org.eclipse.ui.dialogs.IWorkingSetEditWizard;
import org.eclipse.ui.dialogs.IWorkingSetSelectionDialog;
import org.eclipse.ui.dialogs.SearchPattern;
import org.eclipse.ui.forms.events.HyperlinkAdapter;
import org.eclipse.ui.forms.events.HyperlinkEvent;
import org.eclipse.ui.forms.widgets.ImageHyperlink;

public class TaskSelectionDialog
  extends FilteredItemsSelectionDialog
{
  private static final int SEARCH_ID = 1025;
  private static final int CREATE_ID = 1026;
  private static final String IS_USING_WINDOW_WORKING_SET_SETTING = "IsUsingWindowWorkingSet";
  private static final String OPEN_IN_BROWSER_SETTING = "OpenInBrowser";
  private static final String SHOW_COMPLETED_TASKS_SETTING = "ShowCompletedTasks";
  private static final String TASK_SELECTION_DIALOG_SECTION = "TaskSelectionDialogSection";
  private static final String WORKING_SET_NAME_SETTING = "WorkingSetName";
  private Set<AbstractTask> allTasks;
  private Button createTaskButton;
  private final LinkedHashSet<AbstractTask> history;
  private final TaskHistoryItemsComparator itemsComparator;
  private final TaskElementLabelProvider labelProvider;
  private boolean needsCreateTask;
  private boolean openInBrowser;
  private Button openInBrowserCheck;
  private IWorkingSet selectedWorkingSet;
  private boolean showCompletedTasks;
  private final ShowCompletedTasksAction showCompletedTasksAction;
  private boolean showExtendedOpeningOptions;
  private final IWorkingSet windowWorkingSet;
  
  private class DeselectWorkingSetAction
    extends Action
  {
    public DeselectWorkingSetAction()
    {
      super(1);
    }
    
    public void run()
    {
      TaskSelectionDialog.this.setSelectedWorkingSet(null);
    }
  }
  
  private class EditWorkingSetAction
    extends Action
  {
    public EditWorkingSetAction()
    {
      super(1);
    }
    
    public void run()
    {
      IWorkingSetEditWizard wizard = PlatformUI.getWorkbench()
        .getWorkingSetManager()
        .createWorkingSetEditWizard(selectedWorkingSet);
      if (wizard != null)
      {
        WizardDialog dlg = new WizardDialog(getShell(), wizard);
        dlg.open();
      }
    }
  }
  
  private class FilterWorkingSetAction
    extends Action
  {
    private final IWorkingSet workingSet;
    
    public FilterWorkingSetAction(IWorkingSet workingSet, int shortcutKeyNumber)
    {
      super(8);
      this.workingSet = workingSet;
      if ((shortcutKeyNumber >= 1) && (shortcutKeyNumber <= 9)) {
        setText("&" + String.valueOf(shortcutKeyNumber) + " " + workingSet.getLabel());
      } else {
        setText(workingSet.getLabel());
      }
      setImageDescriptor(workingSet.getImageDescriptor());
    }
    
    public void run()
    {
      TaskSelectionDialog.this.setSelectedWorkingSet(workingSet);
    }
  }
  
  private class SelectWorkingSetAction
    extends Action
  {
    public SelectWorkingSetAction()
    {
      super(1);
    }
    
    public void run()
    {
      IWorkingSetSelectionDialog dlg = PlatformUI.getWorkbench()
        .getWorkingSetManager()
        .createWorkingSetSelectionDialog(getShell(), false, 
        new String[] { TaskWorkingSetUpdater.ID_TASK_WORKING_SET });
      if (selectedWorkingSet != null) {
        dlg.setSelection(new IWorkingSet[] { selectedWorkingSet });
      }
      if (dlg.open() == 0)
      {
        IWorkingSet[] selection = dlg.getSelection();
        if (selection.length == 0) {
          TaskSelectionDialog.this.setSelectedWorkingSet(null);
        } else {
          TaskSelectionDialog.this.setSelectedWorkingSet(selection[0]);
        }
      }
    }
  }
  
  private class ShowCompletedTasksAction
    extends Action
  {
    public ShowCompletedTasksAction()
    {
      super(2);
    }
    
    public void run()
    {
      showCompletedTasks = isChecked();
      applyFilter();
    }
  }
  
  private class TaskHistoryItemsComparator
    implements Comparator<Object>
  {
    Map<AbstractTask, Integer> positionByTask = new HashMap();
    
    public TaskHistoryItemsComparator()
    {
      for (int i = 0; i < history.size(); i++) {
        positionByTask.put((AbstractTask)history.get(i), Integer.valueOf(i));
      }
    }
    
    public int compare(Object o1, Object o2)
    {
      Integer p1 = (Integer)positionByTask.get(o1);
      Integer p2 = (Integer)positionByTask.get(o2);
      if ((p1 != null) && (p2 != null)) {
        return p2.compareTo(p1);
      }
      return labelProvider.getText(o1).compareTo(labelProvider.getText(o2));
    }
  }
  
  private class TaskSelectionHistory
    extends FilteredItemsSelectionDialog.SelectionHistory
  {
    private TaskSelectionHistory() {}
    
    public synchronized void accessed(Object object) {}
    
    public synchronized boolean contains(Object object)
    {
      return history.contains(object);
    }
    
    public synchronized Object[] getHistoryItems()
    {
      return history.toArray();
    }
    
    public synchronized boolean isEmpty()
    {
      return history.isEmpty();
    }
    
    public void load(IMemento memento) {}
    
    public synchronized boolean remove(Object object)
    {
      taskActivationHistory.removeTask((ITask)object);
      return history.remove(object);
    }
    
    protected Object restoreItemFromMemento(IMemento memento)
    {
      return null;
    }
    
    public void save(IMemento memento) {}
    
    protected void storeItemToMemento(Object item, IMemento memento) {}
  }
  
  private class TasksFilter
    extends FilteredItemsSelectionDialog.ItemsFilter
  {
    private Set<ITask> allTasksFromWorkingSets;
    private final Set<AbstractTaskContainer> elements;
    private final boolean showCompletedTasks;
    
    public TasksFilter(boolean showCompletedTasks, IWorkingSet selectedWorkingSet)
    {
      super(new SearchPattern());
      
      patternMatcher.setPattern("*" + patternMatcher.getPattern());
      this.showCompletedTasks = showCompletedTasks;
      
      elements = new HashSet();
      if (selectedWorkingSet != null)
      {
        IAdaptable[] arrayOfIAdaptable;
        int j = (arrayOfIAdaptable = selectedWorkingSet.getElements()).length;
        for (int i = 0; i < j; i++)
        {
          IAdaptable adaptable = arrayOfIAdaptable[i];
          AbstractTaskContainer container = (AbstractTaskContainer)adaptable.getAdapter(AbstractTaskContainer.class);
          if (container != null) {
            elements.add(container);
          }
        }
      }
    }
    
    public boolean equalsFilter(FilteredItemsSelectionDialog.ItemsFilter filter)
    {
      if (!super.equalsFilter(filter)) {
        return false;
      }
      if ((filter instanceof TasksFilter))
      {
        TasksFilter tasksFilter = (TasksFilter)filter;
        if (showCompletedTasks != showCompletedTasks) {
          return false;
        }
        return elements.equals(elements);
      }
      return true;
    }
    
    public boolean isConsistentItem(Object item)
    {
      return item instanceof ITask;
    }
    
    public boolean isSubFilter(FilteredItemsSelectionDialog.ItemsFilter filter)
    {
      if (!super.isSubFilter(filter)) {
        return false;
      }
      if ((filter instanceof TasksFilter))
      {
        TasksFilter tasksFilter = (TasksFilter)filter;
        if ((!showCompletedTasks) && (showCompletedTasks)) {
          return false;
        }
        if (elements.isEmpty()) {
          return true;
        }
        if (elements.isEmpty()) {
          return false;
        }
        return elements.containsAll(elements);
      }
      return true;
    }
    
    public boolean matchItem(Object item)
    {
      if (!(item instanceof ITask)) {
        return false;
      }
      if ((!showCompletedTasks) && (((ITask)item).isCompleted())) {
        return false;
      }
      if (!elements.isEmpty())
      {
        if (allTasksFromWorkingSets == null) {
          populateTasksFromWorkingSets();
        }
        if (!allTasksFromWorkingSets.contains(item)) {
          return false;
        }
      }
      return matches(labelProvider.getText(item));
    }
    
    private void populateTasksFromWorkingSets()
    {
      allTasksFromWorkingSets = new HashSet(1000);
      for (ITaskContainer container : elements) {
        allTasksFromWorkingSets.addAll(container.getChildren());
      }
    }
  }
  
  private final IPropertyChangeListener workingSetListener = new IPropertyChangeListener()
  {
    public void propertyChange(PropertyChangeEvent event)
    {
      if ((event.getProperty().equals("workingSetContentChange")) && 
        (event.getNewValue().equals(selectedWorkingSet))) {
        applyFilter();
      }
    }
  };
  private final TaskActivationHistory taskActivationHistory;
  
  public TaskSelectionDialog(Shell parent)
  {
    this(parent, false);
  }
  
  public TaskSelectionDialog(Shell parent, boolean multi)
  {
    super(parent, multi);
    taskActivationHistory = TasksUiPlugin.getTaskActivityManager().getTaskActivationHistory();
    history = new LinkedHashSet(taskActivationHistory.getPreviousTasks());
    itemsComparator = new TaskHistoryItemsComparator(new ArrayList(history));
    needsCreateTask = true;
    labelProvider = new TaskElementLabelProvider(false);
    showCompletedTasksAction = new ShowCompletedTasksAction();
    
    setSelectionHistory(new TaskSelectionHistory(null));
    setListLabelProvider(labelProvider);
    
    setDetailsLabelProvider(new TaskDetailLabelProvider());
    setSeparatorLabel(TaskListView.LABEL_VIEW + Messages.TaskSelectionDialog__matches);
    
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    ISelection selection = window.getSelectionService().getSelection();
    if ((selection instanceof ITextSelection))
    {
      String text = ((ITextSelection)selection).getText();
      int n = text.indexOf('\n');
      if (n > -1) {
        text = text.substring(0, n);
      }
      setInitialPattern(text);
    }
    windowWorkingSet = window.getActivePage().getAggregateWorkingSet();
    selectedWorkingSet = windowWorkingSet;
    
    PlatformUI.getWorkbench().getWorkingSetManager().addPropertyChangeListener(workingSetListener);
  }
  
  public boolean close()
  {
    PlatformUI.getWorkbench().getWorkingSetManager().removePropertyChangeListener(workingSetListener);
    if (openInBrowserCheck != null) {
      openInBrowser = openInBrowserCheck.getSelection();
    }
    return super.close();
  }
  
  protected Control createButtonBar(Composite parent)
  {
    Composite composite = new Composite(parent, 0);
    GridLayout layout = new GridLayout();
    numColumns = 0;
    marginHeight = convertVerticalDLUsToPixels(7);
    marginWidth = convertHorizontalDLUsToPixels(7);
    verticalSpacing = convertVerticalDLUsToPixels(4);
    horizontalSpacing = convertHorizontalDLUsToPixels(4);
    
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(768));
    if (isHelpAvailable()) {
      createHelpControl(composite);
    }
    if (needsCreateTask)
    {
      createTaskButton = createButton(composite, 1026, Messages.TaskSelectionDialog_New_Task_, true);
      createTaskButton.addSelectionListener(new SelectionListener()
      {
        public void widgetDefaultSelected(SelectionEvent e) {}
        
        public void widgetSelected(SelectionEvent e)
        {
          close();
          new NewTaskAction().run();
        }
      });
    }
    createAdditionalButtons(composite);
    
    Label filler = new Label(composite, 0);
    filler.setLayoutData(new GridData(768));
    numColumns += 1;
    super.createButtonsForButtonBar(composite);
    
    return composite;
  }
  
  protected void createAdditionalButtons(Composite parent) {}
  
  protected Control createExtendedContentArea(Composite parent)
  {
    if (!showExtendedOpeningOptions) {
      return null;
    }
    Composite composite = new Composite(parent, 0);
    composite.setLayout(GridLayoutFactory.swtDefaults().margins(0, 5).create());
    composite.setLayoutData(GridDataFactory.fillDefaults().create());
    
    openInBrowserCheck = new Button(composite, 32);
    openInBrowserCheck.setText(Messages.TaskSelectionDialog_Open_with_Browser);
    openInBrowserCheck.setSelection(openInBrowser);
    if (SearchUtil.supportsTaskSearch())
    {
      ImageHyperlink openHyperlink = new ImageHyperlink(composite, 0);
      openHyperlink.setText(TaskListFilteredTree.LABEL_SEARCH);
      openHyperlink.setForeground(CommonColors.HYPERLINK_WIDGET);
      openHyperlink.setUnderlined(true);
      openHyperlink.addHyperlinkListener(new HyperlinkAdapter()
      {
        public void linkActivated(HyperlinkEvent e)
        {
          getShell().close();
          SearchUtil.openSearchDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow());
        }
      });
    }
    return composite;
  }
  
  protected FilteredItemsSelectionDialog.ItemsFilter createFilter()
  {
    return new TasksFilter(showCompletedTasks, selectedWorkingSet);
  }
  
  protected void fillContentProvider(FilteredItemsSelectionDialog.AbstractContentProvider contentProvider, FilteredItemsSelectionDialog.ItemsFilter itemsFilter, IProgressMonitor progressMonitor)
    throws CoreException
  {
    progressMonitor.beginTask(Messages.TaskSelectionDialog_Search_for_tasks, 100);
    if (allTasks == null)
    {
      allTasks = new HashSet();
      TaskList taskList = TasksUiPlugin.getTaskList();
      allTasks.addAll(taskList.getAllTasks());
    }
    progressMonitor.worked(10);
    
    SubProgressMonitor subMonitor = new SubProgressMonitor(progressMonitor, 90);
    subMonitor.beginTask(Messages.TaskSelectionDialog_Scanning_tasks, allTasks.size());
    for (ITask task : allTasks)
    {
      contentProvider.add(task, itemsFilter);
      subMonitor.worked(1);
    }
    subMonitor.done();
    
    progressMonitor.done();
  }
  
  protected void fillViewMenu(IMenuManager menuManager)
  {
    super.fillViewMenu(menuManager);
    menuManager.add(showCompletedTasksAction);
    menuManager.add(new Separator());
    
    menuManager.add(new SelectWorkingSetAction());
    final DeselectWorkingSetAction deselectAction = new DeselectWorkingSetAction();
    menuManager.add(deselectAction);
    final EditWorkingSetAction editAction = new EditWorkingSetAction();
    menuManager.add(editAction);
    menuManager.add(new Separator("lruActions"));
    final FilterWorkingSetAction windowWorkingSetAction = new FilterWorkingSetAction(windowWorkingS
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2019. Infinite Loop Ltd