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

  
  private void hookGlobalActions()
  {
    IActionBars bars = getViewSite().getActionBars();
    bars.setGlobalActionHandler(ActionFactory.DELETE.getId(), actionGroup.getDeleteAction());
    bars.setGlobalActionHandler(ActionFactory.COPY.getId(), actionGroup.getCopyDetailsAction());
  }
  
  private void applyPresentation(String id)
  {
    if (id != null)
    {
      for (AbstractTaskListPresentation presentation : presentationsPrimary) {
        if (id.equals(presentation.getId()))
        {
          applyPresentation(presentation);
          return;
        }
      }
      for (AbstractTaskListPresentation presentation : presentationsSecondary) {
        if (id.equals(presentation.getId()))
        {
          applyPresentation(presentation);
          return;
        }
      }
    }
  }
  
  /* Error */
  public void applyPresentation(AbstractTaskListPresentation presentation)
  {
    // Byte code:
    //   0: aload_0
    //   1: invokevirtual 1803	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:getViewer	()Lorg/eclipse/jface/viewers/TreeViewer;
    //   4: invokevirtual 1676	org/eclipse/jface/viewers/TreeViewer:getControl	()Lorg/eclipse/swt/widgets/Control;
    //   7: iconst_0
    //   8: invokevirtual 1866	org/eclipse/swt/widgets/Control:setRedraw	(Z)V
    //   11: aload_0
    //   12: getfield 1594	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:filteredTree	Lorg/eclipse/mylyn/internal/tasks/ui/views/TaskListFilteredTree;
    //   15: invokevirtual 1757	org/eclipse/mylyn/internal/tasks/ui/views/TaskListFilteredTree:getFilterString	()Ljava/lang/String;
    //   18: ldc_w 681
    //   21: invokevirtual 1626	java/lang/String:equals	(Ljava/lang/Object;)Z
    //   24: ifne +16 -> 40
    //   27: aload_0
    //   28: getfield 1594	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:filteredTree	Lorg/eclipse/mylyn/internal/tasks/ui/views/TaskListFilteredTree;
    //   31: invokevirtual 1763	org/eclipse/mylyn/internal/tasks/ui/views/TaskListFilteredTree:getFilterControl	()Lorg/eclipse/swt/widgets/Text;
    //   34: ldc_w 681
    //   37: invokevirtual 1871	org/eclipse/swt/widgets/Text:setText	(Ljava/lang/String;)V
    //   40: aload_1
    //   41: aload_0
    //   42: invokevirtual 1749	org/eclipse/mylyn/internal/tasks/ui/views/AbstractTaskListPresentation:getContentProvider	(Lorg/eclipse/mylyn/internal/tasks/ui/views/TaskListView;)Lorg/eclipse/mylyn/internal/tasks/ui/views/AbstractTaskListContentProvider;
    //   45: astore_2
    //   46: aload_0
    //   47: invokevirtual 1803	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:getViewer	()Lorg/eclipse/jface/viewers/TreeViewer;
    //   50: aload_2
    //   51: invokevirtual 1668	org/eclipse/jface/viewers/TreeViewer:setContentProvider	(Lorg/eclipse/jface/viewers/IContentProvider;)V
    //   54: aload_0
    //   55: iconst_1
    //   56: invokevirtual 1791	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:refresh	(Z)V
    //   59: aload_0
    //   60: aload_1
    //   61: putfield 1589	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:currentPresentation	Lorg/eclipse/mylyn/internal/tasks/ui/views/AbstractTaskListPresentation;
    //   64: aload_0
    //   65: invokespecial 1787	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:updatePresentationSelectorImage	()V
    //   68: goto +17 -> 85
    //   71: astore_3
    //   72: aload_0
    //   73: invokevirtual 1803	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:getViewer	()Lorg/eclipse/jface/viewers/TreeViewer;
    //   76: invokevirtual 1676	org/eclipse/jface/viewers/TreeViewer:getControl	()Lorg/eclipse/swt/widgets/Control;
    //   79: iconst_1
    //   80: invokevirtual 1866	org/eclipse/swt/widgets/Control:setRedraw	(Z)V
    //   83: aload_3
    //   84: athrow
    //   85: aload_0
    //   86: invokevirtual 1803	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:getViewer	()Lorg/eclipse/jface/viewers/TreeViewer;
    //   89: invokevirtual 1676	org/eclipse/jface/viewers/TreeViewer:getControl	()Lorg/eclipse/swt/widgets/Control;
    //   92: iconst_1
    //   93: invokevirtual 1866	org/eclipse/swt/widgets/Control:setRedraw	(Z)V
    //   96: return
    // Line number table:
    //   Java source line #1062	-> byte code offset #0
    //   Java source line #1063	-> byte code offset #11
    //   Java source line #1064	-> byte code offset #27
    //   Java source line #1066	-> byte code offset #40
    //   Java source line #1067	-> byte code offset #46
    //   Java source line #1068	-> byte code offset #54
    //   Java source line #1070	-> byte code offset #59
    //   Java source line #1071	-> byte code offset #64
    //   Java source line #1072	-> byte code offset #71
    //   Java source line #1073	-> byte code offset #72
    //   Java source line #1074	-> byte code offset #83
    //   Java source line #1073	-> byte code offset #85
    //   Java source line #1075	-> byte code offset #96
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	97	0	this	TaskListView
    //   0	97	1	presentation	AbstractTaskListPresentation
    //   45	6	2	contentProvider	AbstractTaskListContentProvider
    //   71	13	3	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   0	71	71	finally
  }
  
  private void updatePresentationSelectorImage()
  {
    if ((presentationDropDownSelectionAction != null) && (currentPresentation != null)) {
      presentationDropDownSelectionAction.setImageDescriptor(currentPresentation.getImageDescriptor());
    }
    IContributionItem[] arrayOfIContributionItem;
    int j = (arrayOfIContributionItem = getViewSite().getActionBars().getToolBarManager().getItems()).length;
    for (int i = 0; i < j; i++)
    {
      IContributionItem item = arrayOfIContributionItem[i];
      if ((item instanceof ActionContributionItem))
      {
        IAction action = ((ActionContributionItem)item).getAction();
        if ((action instanceof PresentationDropDownSelectionAction.PresentationSelectionAction)) {
          ((PresentationDropDownSelectionAction.PresentationSelectionAction)action).update();
        }
      }
    }
  }
  
  public AbstractTaskListPresentation getCurrentPresentation()
  {
    return currentPresentation;
  }
  
  private void configureColumns(String[] columnNames, final int[] columnWidths)
  {
    TreeColumnLayout layout = (TreeColumnLayout)getViewer().getTree().getParent().getLayout();
    getViewer().setColumnProperties(columnNames);
    columns = new TreeColumn[columnNames.length];
    for (int i = 0; i < columnNames.length; i++)
    {
      columns[i] = new TreeColumn(getViewer().getTree(), 0);
      columns[i].setText(columnNames[i]);
      if (i == 0) {
        layout.setColumnData(columns[i], new ColumnWeightData(100));
      } else {
        layout.setColumnData(columns[i], new ColumnPixelData(columnWidths[i]));
      }
      columns[i].addSelectionListener(new SelectionAdapter()
      {
        public void widgetSelected(SelectionEvent e)
        {
          SortCriterion criterion = tableSorter.getComparator().getSortCriterion(0);
          criterion.setDirection(criterion.getDirection() * -1);
          getViewer().refresh(false);
        }
      });
      columns[i].addControlListener(new ControlListener()
      {
        public void controlResized(ControlEvent e)
        {
          for (int j = 0; j < columnWidths.length; j++) {
            if (columns[j].equals(e.getSource())) {
              columnWidths[j] = columns[j].getWidth();
            }
          }
        }
        
        public void controlMoved(ControlEvent e) {}
      });
    }
  }
  
  private final IPartListener editorListener = new IPartListener()
  {
    private void jumpToEditor(IWorkbenchPart part)
    {
      if ((!linkWithEditor) || (!(part instanceof IEditorPart))) {
        return;
      }
      TaskListView.this.jumpToEditorTask((IEditorPart)part);
    }
    
    public void partActivated(IWorkbenchPart part)
    {
      if (part == TaskListView.this) {
        TaskListView.this.updateDescription();
      } else {
        jumpToEditor(part);
      }
    }
    
    public void partBroughtToTop(IWorkbenchPart part) {}
    
    public void partClosed(IWorkbenchPart part) {}
    
    public void partDeactivated(IWorkbenchPart part)
    {
      if (part == TaskListView.this)
      {
        IViewReference reference = getSite().getPage().findViewReference("org.eclipse.mylyn.tasks.ui.views.tasks");
        if ((reference != null) && (reference.isFastView())) {
          TaskListView.this.updateDescription();
        }
        taskListToolTip.hide();
      }
    }
    
    public void partOpened(IWorkbenchPart part) {}
  };
  
  private void initDragAndDrop(Composite parent)
  {
    Transfer[] dragTypes = { LocalSelectionTransfer.getTransfer(), FileTransfer.getInstance() };
    Transfer[] dropTypes = { LocalSelectionTransfer.getTransfer(), FileTransfer.getInstance(), 
      TextTransfer.getInstance(), RTFTransfer.getInstance(), URLTransfer.getInstance() };
    
    getViewer().addDragSupport(7, dragTypes, 
      new TaskDragSourceListener(getViewer()));
    getViewer().addDropSupport(23, dropTypes, 
      new TaskListDropAdapter(getViewer()));
  }
  
  void expandToActiveTasks()
  {
    IWorkbench workbench = PlatformUI.getWorkbench();
    workbench.getDisplay().asyncExec(new Runnable()
    {
      public void run()
      {
        ITask task = TasksUi.getTaskActivityManager().getActiveTask();
        if (task != null) {
          getViewer().expandToLevel(task, 0);
        }
      }
    });
  }
  
  private void hookContextMenu()
  {
    MenuManager menuManager = new MenuManager("#PopupMenu");
    menuManager.setRemoveAllWhenShown(true);
    menuManager.addMenuListener(new IMenuListener()
    {
      public void menuAboutToShow(IMenuManager manager)
      {
        actionGroup.fillContextMenu(manager);
      }
    });
    Menu menu = menuManager.createContextMenu(getViewer().getControl());
    getViewer().getControl().setMenu(menu);
    getSite().registerContextMenu(menuManager, getViewer());
  }
  
  private void contributeToActionBars()
  {
    IActionBars bars = getViewSite().getActionBars();
    fillLocalPullDown(bars.getMenuManager());
    fillLocalToolBar(bars.getToolBarManager());
  }
  
  private void fillLocalPullDown(IMenuManager manager)
  {
    updateDrillDownActions();
    manager.add(actionGroup.getGoUpAction());
    manager.add(collapseAll);
    manager.add(expandAll);
    manager.add(new Separator("filters"));
    manager.add(sortDialogAction);
    manager.add(filterOnPriorityAction);
    manager.add(filterCompleteTask);
    IMenuManager advancedMenu = new MenuManager(Messages.TaskListView_Advanced_Filters_Label);
    advancedMenu.add(new ShowAllQueriesAction());
    advancedMenu.add(new ShowNonMatchingSubtasksAction());
    advancedMenu.add(new Separator());
    advancedMenu.add(groupSubTasksAction);
    manager.add(advancedMenu);
    
    manager.add(new Separator("search"));
    manager.add(new GroupMarker("tasks"));
    manager.add(synchronizeAutomatically);
    
    manager.add(new Separator("additions"));
    
    manager.addMenuListener(new IMenuListener()
    {
      public void menuAboutToShow(IMenuManager manager)
      {
        filterOnPriorityAction.updateCheckedState();
      }
    });
    manager.add(linkWithEditorAction);
    manager.add(new Separator());
    manager.add(openPreferencesAction);
  }
  
  private void fillLocalToolBar(IToolBarManager manager)
  {
    manager.add(newTaskAction);
    manager.add(new Separator());
    addPresentations(manager);
    manager.add(new Separator());
    manager.add(new GroupMarker("context"));
    manager.add(new Separator());
    manager.add(filterCompleteTask);
    manager.add(collapseAll);
    manager.add(new Separator("additions"));
  }
  
  private void addPresentations(IToolBarManager manager)
  {
    for (AbstractTaskListPresentation presentation : ) {
      if (!presentation.isPrimary())
      {
        manager.add(presentationDropDownSelectionAction);
        return;
      }
    }
    for (AbstractTaskListPresentation presentation : getPresentations()) {
      manager.add(new PresentationDropDownSelectionAction.PresentationSelectionAction(this, presentation));
    }
  }
  
  public List<IRepositoryElement> getSelectedTaskContainers()
  {
    List<IRepositoryElement> selectedElements = new ArrayList();
    for (Iterator<?> i = ((IStructuredSelection)getViewer().getSelection()).iterator(); i.hasNext();)
    {
      Object object = i.next();
      if ((object instanceof ITaskContainer)) {
        selectedElements.add((IRepositoryElement)object);
      }
    }
    return selectedElements;
  }
  
  private void makeActions()
  {
    actionGroup = new TaskListViewActionGroup(this, drillDownAdapter);
    actionGroup.getOpenAction().setViewer(getViewer());
    
    collapseAll = new CollapseAllAction(this);
    expandAll = new ExpandAllAction(this);
    filterCompleteTask = new FilterCompletedTasksAction(this);
    groupSubTasksAction = new GroupSubTasksAction();
    synchronizeAutomatically = new SynchronizeAutomaticallyAction();
    openPreferencesAction = new OpenTasksUiPreferencesAction();
    
    sortDialogAction = new TaskListSortAction(getSite(), this);
    filterOnPriorityAction = new PriorityDropDownAction(this);
    linkWithEditorAction = new LinkWithEditorAction(this);
    newTaskAction = new NewTaskAction();
    filteredTree.getViewer().addSelectionChangedListener(newTaskAction);
  }
  
  private void hookOpenAction()
  {
    getViewer().addOpenListener(new IOpenListener()
    {
      public void open(OpenEvent event)
      {
        actionGroup.getOpenAction().run();
      }
    });
    getViewer().addDoubleClickListener(new IDoubleClickListener()
    {
      public void doubleClick(DoubleClickEvent event)
      {
        if (TasksUiPlugin.getDefault().getPreferenceStore().getBoolean("org.eclipse.mylyn.tasks.ui.activate.when.opened"))
        {
          AbstractTask selectedTask = getSelectedTask();
          if ((selectedTask != null) && (!selectedTask.isActive())) {
            TasksUiInternal.activateTaskThroughCommand(selectedTask);
          }
        }
      }
    });
  }
  
  public void setFocus()
  {
    filteredTree.getViewer().getControl().setFocus();
  }
  
  /* Error */
  public void refresh(boolean expandIfFocused)
  {
    // Byte code:
    //   0: iload_1
    //   1: ifeq +73 -> 74
    //   4: aload_0
    //   5: invokevirtual 1790	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:isFocusedMode	()Z
    //   8: ifeq +66 -> 74
    //   11: aload_0
    //   12: invokespecial 1789	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:isAutoExpandMode	()Z
    //   15: ifeq +59 -> 74
    //   18: aload_0
    //   19: invokevirtual 1803	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:getViewer	()Lorg/eclipse/jface/viewers/TreeViewer;
    //   22: invokevirtual 1676	org/eclipse/jface/viewers/TreeViewer:getControl	()Lorg/eclipse/swt/widgets/Control;
    //   25: iconst_0
    //   26: invokevirtual 1866	org/eclipse/swt/widgets/Control:setRedraw	(Z)V
    //   29: aload_0
    //   30: getfield 1569	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:refreshJob	Lorg/eclipse/mylyn/commons/workbench/DelayedRefreshJob;
    //   33: invokevirtual 1686	org/eclipse/mylyn/commons/workbench/DelayedRefreshJob:refreshNow	()V
    //   36: aload_0
    //   37: invokevirtual 1803	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:getViewer	()Lorg/eclipse/jface/viewers/TreeViewer;
    //   40: invokevirtual 1660	org/eclipse/jface/viewers/TreeViewer:expandAll	()V
    //   43: goto +17 -> 60
    //   46: astore_2
    //   47: aload_0
    //   48: invokevirtual 1803	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:getViewer	()Lorg/eclipse/jface/viewers/TreeViewer;
    //   51: invokevirtual 1676	org/eclipse/jface/viewers/TreeViewer:getControl	()Lorg/eclipse/swt/widgets/Control;
    //   54: iconst_1
    //   55: invokevirtual 1866	org/eclipse/swt/widgets/Control:setRedraw	(Z)V
    //   58: aload_2
    //   59: athrow
    //   60: aload_0
    //   61: invokevirtual 1803	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:getViewer	()Lorg/eclipse/jface/viewers/TreeViewer;
    //   64: invokevirtual 1676	org/eclipse/jface/viewers/TreeViewer:getControl	()Lorg/eclipse/swt/widgets/Control;
    //   67: iconst_1
    //   68: invokevirtual 1866	org/eclipse/swt/widgets/Control:setRedraw	(Z)V
    //   71: goto +10 -> 81
    //   74: aload_0
    //   75: getfield 1569	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:refreshJob	Lorg/eclipse/mylyn/commons/workbench/DelayedRefreshJob;
    //   78: invokevirtual 1686	org/eclipse/mylyn/commons/workbench/DelayedRefreshJob:refreshNow	()V
    //   81: return
    // Line number table:
    //   Java source line #1335	-> byte code offset #0
    //   Java source line #1337	-> byte code offset #18
    //   Java source line #1338	-> byte code offset #29
    //   Java source line #1339	-> byte code offset #36
    //   Java source line #1340	-> byte code offset #46
    //   Java source line #1341	-> byte code offset #47
    //   Java source line #1342	-> byte code offset #58
    //   Java source line #1341	-> byte code offset #60
    //   Java source line #1344	-> byte code offset #74
    //   Java source line #1346	-> byte code offset #81
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	82	0	this	TaskListView
    //   0	82	1	expandIfFocused	boolean
    //   46	13	2	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   18	46	46	finally
  }
  
  public void refresh()
  {
    refreshJob.refreshNow();
  }
  
  public TaskListToolTip getToolTip()
  {
    return taskListToolTip;
  }
  
  public TreeViewer getViewer()
  {
    return filteredTree.getViewer();
  }
  
  public TaskCompletionFilter getCompleteFilter()
  {
    return filterComplete;
  }
  
  public TaskPriorityFilter getPriorityFilter()
  {
    return filterPriority;
  }
  
  public void addFilter(AbstractTaskListFilter filter)
  {
    if (!filters.contains(filter)) {
      filters.add(filter);
    }
  }
  
  public void clearFilters()
  {
    filters.clear();
    filters.add(filterArchive);
    filters.add(filterWorkingSet);
    filters.add(filterPresentation);
  }
  
  public void removeFilter(AbstractTaskListFilter filter)
  {
    filters.remove(filter);
  }
  
  public void updateDrillDownActions()
  {
    actionGroup.updateDrillDownActions();
  }
  
  boolean isInRenameAction = false;
  private DelayedRefreshJob refreshJob;
  private boolean itemNotFoundExceptionLogged;
  private AbstractSearchHandler searchHandler;
  
  public void setInRenameAction(boolean b)
  {
    isInRenameAction = b;
  }
  
  public void goIntoCategory()
  {
    ISelection selection = getViewer().getSelection();
    if ((selection instanceof StructuredSelection))
    {
      StructuredSelection structuredSelection = (StructuredSelection)selection;
      Object element = structuredSelection.getFirstElement();
      if ((element instanceof ITaskContainer))
      {
        drilledIntoCategory = ((AbstractTaskContainer)element);
        drillDownAdapter.goInto();
        IActionBars bars = getViewSite().getActionBars();
        bars.getToolBarManager().remove(actionGroup.getGoUpAction().getId());
        bars.getToolBarManager().add(actionGroup.getGoUpAction());
        bars.updateActionBars();
        updateDrillDownActions();
      }
    }
  }
  
  public void goUpToRoot()
  {
    drilledIntoCategory = null;
    drillDownAdapter.goBack();
    IActionBars bars = getViewSite().getActionBars();
    bars.getToolBarManager().remove("org.eclipse.mylyn.tasklist.actions.view.go.up");
    bars.updateActionBars();
    updateDrillDownActions();
  }
  
  public AbstractTask getSelectedTask()
  {
    ISelection selection = getViewer().getSelection();
    if (selection.isEmpty()) {
      return null;
    }
    if ((selection instanceof StructuredSelection))
    {
      StructuredSelection structuredSelection = (StructuredSelection)selection;
      Object element = structuredSelection.getFirstElement();
      if ((element instanceof ITask)) {
        return (AbstractTask)structuredSelection.getFirstElement();
      }
    }
    return null;
  }
  
  public static AbstractTask getSelectedTask(ISelection selection)
  {
    if ((selection instanceof StructuredSelection))
    {
      StructuredSelection structuredSelection = (StructuredSelection)selection;
      if (structuredSelection.size() != 1) {
        return null;
      }
      Object element = structuredSelection.getFirstElement();
      if ((element instanceof ITask)) {
        return (AbstractTask)structuredSelection.getFirstElement();
      }
    }
    return null;
  }
  
  public void indicatePaused(boolean paused)
  {
    isPaused = paused;
    IStatusLineManager statusLineManager = getViewSite().getActionBars().getStatusLineManager();
    if (isPaused)
    {
      statusLineManager.setMessage(CommonImages.getImage(TasksUiImages.TASKS_VIEW), 
        Messages.TaskListView_Mylyn_context_capture_paused);
      setPartName(Messages.TaskListView__paused_ + LABEL_VIEW);
    }
    else
    {
      statusLineManager.setMessage("");
      setPartName(LABEL_VIEW);
    }
  }
  
  public AbstractTaskContainer getDrilledIntoCategory()
  {
    return drilledIntoCategory;
  }
  
  public TaskListFilteredTree getFilteredTree()
  {
    return filteredTree;
  }
  
  public void selectedAndFocusTask(ITask task)
  {
    if ((task == null) || (getViewer().getControl().isDisposed())) {
      return;
    }
    saveSelection();
    
    IStructuredSelection selection = restoreSelection(task);
    try
    {
      getViewer().setSelection(selection, true);
    }
    catch (SWTError e)
    {
      if (!itemNotFoundExceptionLogged)
      {
        itemNotFoundExceptionLogged = true;
        
        StatusHandler.log(new Status(2, "org.eclipse.mylyn.tasks.ui", 
          "Could not link Task List with editor", 
          e));
      }
    }
  }
  
  private void saveSelection()
  {
    IStructuredSelection selection = (IStructuredSelection)getViewer().getSelection();
    if ((selection.size() == 1) && ((selection.getFirstElement() instanceof ITask)))
    {
      String handle = ((IRepositoryElement)selection.getFirstElement()).getHandleIdentifier();
      lastSelectionByTaskHandle.remove(handle);
      lastSelectionByTaskHandle.put(handle, selection);
      if (lastSelectionByTaskHandle.size() > 10)
      {
        Iterator<String> it = lastSelectionByTaskHandle.keySet().iterator();
        it.next();
        it.remove();
      }
    }
  }
  
  private IStructuredSelection restoreSelection(ITask task)
  {
    IStructuredSelection selection = (IStructuredSelection)lastSelectionByTaskHandle.get(task.getHandleIdentifier());
    if (selection != null) {
      return selection;
    }
    return new StructuredSelection(task);
  }
  
  public Image[] getPirorityImages()
  {
    Image[] images = new Image[ITask.PriorityLevel.values().length];
    for (int i = 0; i < ITask.PriorityLevel.values().length; i++) {
      images[i] = TasksUiImages.getImageForPriority(ITask.PriorityLevel.values()[i]);
    }
    return images;
  }
  
  public Set<AbstractTaskListFilter> getFilters()
  {
    return filters;
  }
  
  public static String getCurrentPriorityLevel()
  {
    if (TasksUiPlugin.getDefault().getPreferenceStore().contains("org.eclipse.mylyn.tasks.ui.filters.priority")) {
      return 
      
        TasksUiPlugin.getDefault().getPreferenceStore().getString("org.eclipse.mylyn.tasks.ui.filters.priority");
    }
    return ITask.PriorityLevel.P5.toString();
  }
  
  public TaskArchiveFilter getArchiveFilter()
  {
    return filterArchive;
  }
  
  private void updateFilterEnablement()
  {
    boolean enabled = !isFocusedMode();
    if (enabled)
    {
      String filterText = filteredTree.getFilterString();
      if ((filterText != null) && (filterText.length() > 0)) {
        enabled = false;
      }
    }
    sortDialogAction.setEnabled(enabled);
    filterOnPriorityAction.setEnabled(enabled);
    filterCompleteTask.setEnabled(enabled);
  }
  
  public boolean isScheduledPresentation()
  {
    return (currentPresentation != null) && ("org.eclipse.mylyn.tasks.ui.scheduled".equals(currentPresentation.getId()));
  }
  
  public boolean isFocusedMode()
  {
    return focusedMode;
  }
  
  private boolean isAutoExpandMode()
  {
    return 
    
      TasksUiPlugin.getDefault().getPreferenceStore().getBoolean("org.eclipse.mylyn.tasks.ui.auto.expand");
  }
  
  /* Error */
  public void setFocusedMode(boolean focusedMode)
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 1551	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:focusedMode	Z
    //   4: iload_1
    //   5: if_icmpne +4 -> 9
    //   8: return
    //   9: aload_0
    //   10: iload_1
    //   11: putfield 1551	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:focusedMode	Z
    //   14: aload_0
    //   15: getfield 1590	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:customDrawer	Lorg/eclipse/mylyn/internal/tasks/ui/views/CustomTaskListDecorationDrawer;
    //   18: iload_1
    //   19: invokevirtual 1751	org/eclipse/mylyn/internal/tasks/ui/views/CustomTaskListDecorationDrawer:setFocusedMode	(Z)V
    //   22: aload_0
    //   23: invokevirtual 1810	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:getViewSite	()Lorg/eclipse/ui/IViewSite;
    //   26: invokeinterface 1951 1 0
    //   31: invokeinterface 1941 1 0
    //   36: astore_2
    //   37: aload_0
    //   38: aload_2
    //   39: invokespecial 1813	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:getToolBarManager	(Lorg/eclipse/jface/action/IToolBarManager;)Lorg/eclipse/jface/action/ToolBarManager;
    //   42: astore_3
    //   43: aload_3
    //   44: ifnull +11 -> 55
    //   47: aload_3
    //   48: invokevirtual 1648	org/eclipse/jface/action/ToolBarManager:getControl	()Lorg/eclipse/swt/widgets/ToolBar;
    //   51: iconst_0
    //   52: invokevirtual 1874	org/eclipse/swt/widgets/ToolBar:setRedraw	(Z)V
    //   55: iload_1
    //   56: ifeq +33 -> 89
    //   59: aload_0
    //   60: invokespecial 1789	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:isAutoExpandMode	()Z
    //   63: ifeq +26 -> 89
    //   66: aload_2
    //   67: ldc_w 692
    //   70: invokeinterface 1921 2 0
    //   75: pop
    //   76: aload_2
    //   77: ldc_w 691
    //   80: invokeinterface 1921 2 0
    //   85: pop
    //   86: goto +39 -> 125
    //   89: aload_2
    //   90: ldc_w 691
    //   93: invokeinterface 1920 2 0
    //   98: ifnonnull +27 -> 125
    //   101: aload_2
    //   102: ldc 1
    //   104: aload_0
    //   105: getfield 1576	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:collapseAll	Lorg/eclipse/mylyn/internal/tasks/ui/actions/CollapseAllAction;
    //   108: invokeinterface 1919 3 0
    //   113: aload_2
    //   114: ldc 1
    //   116: aload_0
    //   117: getfield 1578	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:filterCompleteTask	Lorg/eclipse/mylyn/internal/tasks/ui/actions/FilterCompletedTasksAction;
    //   120: invokeinterface 1919 3 0
    //   125: aload_0
    //   126: invokespecial 1786	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:updateFilterEnablement	()V
    //   129: aload_0
    //   130: invokevirtual 1810	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:getViewSite	()Lorg/eclipse/ui/IViewSite;
    //   133: invokeinterface 1951 1 0
    //   138: invokeinterface 1938 1 0
    //   143: goto +20 -> 163
    //   146: astore 4
    //   148: aload_3
    //   149: ifnull +11 -> 160
    //   152: aload_3
    //   153: invokevirtual 1648	org/eclipse/jface/action/ToolBarManager:getControl	()Lorg/eclipse/swt/widgets/ToolBar;
    //   156: iconst_1
    //   157: invokevirtual 1874	org/eclipse/swt/widgets/ToolBar:setRedraw	(Z)V
    //   160: aload 4
    //   162: athrow
    //   163: aload_3
    //   164: ifnull +11 -> 175
    //   167: aload_3
    //   168: invokevirtual 1648	org/eclipse/jface/action/ToolBarManager:getControl	()Lorg/eclipse/swt/widgets/ToolBar;
    //   171: iconst_1
    //   172: invokevirtual 1874	org/eclipse/swt/widgets/ToolBar:setRedraw	(Z)V
    //   175: return
    // Line number table:
    //   Java source line #1586	-> byte code offset #0
    //   Java source line #1587	-> byte code offset #8
    //   Java source line #1589	-> byte code offset #9
    //   Java source line #1590	-> byte code offset #14
    //   Java source line #1591	-> byte code offset #22
    //   Java source line #1592	-> byte code offset #37
    //   Java source line #1594	-> byte code offset #43
    //   Java source line #1595	-> byte code offset #47
    //   Java source line #1597	-> byte code offset #55
    //   Java source line #1598	-> byte code offset #66
    //   Java source line #1599	-> byte code offset #76
    //   Java source line #1600	-> byte code offset #89
    //   Java source line #1601	-> byte code offset #101
    //   Java source line #1602	-> byte code offset #113
    //   Java source line #1604	-> byte code offset #125
    //   Java source line #1605	-> byte code offset #129
    //   Java source line #1606	-> byte code offset #146
    //   Java source line #1607	-> byte code offset #148
    //   Java source line #1608	-> byte code offset #152
    //   Java source line #1610	-> byte code offset #160
    //   Java source line #1607	-> byte code offset #163
    //   Java source line #1608	-> byte code offset #167
    //   Java source line #1611	-> byte code offset #175
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	176	0	this	TaskListView
    //   0	176	1	focusedMode	boolean
    //   36	78	2	manager	IToolBarManager
    //   42	126	3	toolBarManager	ToolBarManager
    //   146	15	4	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   43	146	146	finally
  }
  
  private ToolBarManager getToolBarManager(IToolBarManager manager)
  {
    if (((manager instanceof ToolBarManager)) && (((ToolBarManager)manager).getControl() != null) && 
      (!((ToolBarManager)manager).getControl().isDisposed())) {
      return (ToolBarManager)manager;
    }
    return null;
  }
  
  public void displayPrioritiesAbove(String priority)
  {
    filterPriority.displayPrioritiesAbove(priority);
    getViewer().refresh();
  }
  
  /* Error */
  public void propertyChange(PropertyChangeEvent event)
  {
    // Byte code:
    //   0: aload_1
    //   1: invokevirtual 1652	org/eclipse/jface/util/PropertyChangeEvent:getProperty	()Ljava/lang/String;
    //   4: astore_2
    //   5: ldc_w 706
    //   8: aload_2
    //   9: invokevirtual 1626	java/lang/String:equals	(Ljava/lang/Object;)Z
    //   12: ifne +13 -> 25
    //   15: ldc_w 707
    //   18: aload_2
    //   19: invokevirtual 1626	java/lang/String:equals	(Ljava/lang/Object;)Z
    //   22: ifeq +143 -> 165
    //   25: aload_0
    //   26: invokevirtual 1812	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:getSite	()Lorg/eclipse/ui/IWorkbenchPartSite;
    //   29: ifnull +117 -> 146
    //   32: aload_0
    //   33: invokevirtual 1812	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:getSite	()Lorg/eclipse/ui/IWorkbenchPartSite;
    //   36: invokeinterface 1966 1 0
    //   41: ifnull +105 -> 146
    //   44: aload_0
    //   45: getfield 1575	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:filterWorkingSet	Lorg/eclipse/mylyn/internal/tasks/ui/TaskWorkingSetFilter;
    //   48: aload_0
    //   49: invokevirtual 1812	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:getSite	()Lorg/eclipse/ui/IWorkbenchPartSite;
    //   52: invokeinterface 1966 1 0
    //   57: invokeinterface 1962 1 0
    //   62: invokevirtual 1704	org/eclipse/mylyn/internal/tasks/ui/TaskWorkingSetFilter:updateWorkingSet	(Lorg/eclipse/ui/IWorkingSet;)Z
    //   65: ifeq +81 -> 146
    //   68: aload_0
    //   69: invokevirtual 1803	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:getViewer	()Lorg/eclipse/jface/viewers/TreeViewer;
    //   72: invokevirtual 1676	org/eclipse/jface/viewers/TreeViewer:getControl	()Lorg/eclipse/swt/widgets/Control;
    //   75: iconst_0
    //   76: invokevirtual 1866	org/eclipse/swt/widgets/Control:setRedraw	(Z)V
    //   79: aload_0
    //   80: getfield 1570	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:drilledIntoCategory	Lorg/eclipse/mylyn/internal/tasks/core/AbstractTaskContainer;
    //   83: ifnull +7 -> 90
    //   86: aload_0
    //   87: invokevirtual 1776	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:goUpToRoot	()V
    //   90: aload_0
    //   91: invokevirtual 1803	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:getViewer	()Lorg/eclipse/jface/viewers/TreeViewer;
    //   94: invokevirtual 1661	org/eclipse/jface/viewers/TreeViewer:refresh	()V
    //   97: aload_0
    //   98: invokevirtual 1790	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:isFocusedMode	()Z
    //   101: ifeq +34 -> 135
    //   104: aload_0
    //   105: invokespecial 1789	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:isAutoExpandMode	()Z
    //   108: ifeq +27 -> 135
    //   111: aload_0
    //   112: invokevirtual 1803	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:getViewer	()Lorg/eclipse/jface/viewers/TreeViewer;
    //   115: invokevirtual 1660	org/eclipse/jface/viewers/TreeViewer:expandAll	()V
    //   118: goto +17 -> 135
    //   121: astore_3
    //   122: aload_0
    //   123: invokevirtual 1803	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:getViewer	()Lorg/eclipse/jface/viewers/TreeViewer;
    //   126: invokevirtual 1676	org/eclipse/jface/viewers/TreeViewer:getControl	()Lorg/eclipse/swt/widgets/Control;
    //   129: iconst_1
    //   130: invokevirtual 1866	org/eclipse/swt/widgets/Control:setRedraw	(Z)V
    //   133: aload_3
    //   134: athrow
    //   135: aload_0
    //   136: invokevirtual 1803	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView:getViewer	()Lorg/eclipse/jface/viewers/TreeViewer;
    //   139: invokevirtual 1676	org/eclipse/jface/viewers/TreeViewer:getControl	()Lorg/eclipse/swt/widgets/Control;
    //   142: iconst_1
    //   143: invokevirtual 1866	org/eclipse/swt/widgets/Control:setRedraw	(Z)V
    //   146: invokestatic 1890	org/eclipse/ui/PlatformUI:getWorkbench	()Lorg/eclipse/ui/IWorkbench;
    //   149: invokeinterface 1953 1 0
    //   154: new 812	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView$24
    //   157: dup
    //   158: aload_0
    //   159: invokespecial 1832	org/eclipse/mylyn/internal/tasks/ui/views/TaskListView$24:<init>	(Lorg/eclipse/mylyn/internal/tasks/ui/views/TaskListView;)V
    //   162: invokevirtual 1869	org/eclipse/swt/widgets/Display:asyncExec	(Ljava/lang/Runnable;)V
    //   165: return
    // Line number table:
    //   Java source line #1627	-> byte code offset #0
    //   Java source line #1628	-> byte code offset #5
    //   Java source line #1629	-> byte code offset #15
    //   Java source line #1630	-> byte code offset #25
    //   Java source line #1631	-> byte code offset #44
    //   Java source line #1633	-> byte code offset #68
    //   Java source line #1635	-> byte code offset #79
    //   Java source line #1636	-> byte code offset #86
    //   Java source line #1639	-> byte code offset #90
    //   Java source line #1640	-> byte code offset #97
    //   Java source line #1641	-> byte code offset #111
    //   Java source line #1643	-> byte code offset #121
    //   Java source line #1644	-> byte code offset #122
    //   Java source line #1645	-> byte code offset #133
    //   Java source line #1644	-> byte code offset #135
    //   Java source line #1649	-> byte code offset #146
    //   Java source line #1655	-> byte code offset #165
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	166	0	this	TaskListView
    //   0	166	1	event	PropertyChangeEvent
    //   4	15	2	property	String
    //   121	13	3	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   68	121	121	finally
  }
  
  public void setLinkWithEditor(boolean linkWithEditor)
  {
    this.linkWithEditor = linkWithEditor;
    linkWithEditorAction.setChecked(linkWithEditor);
    if (linkWithEditor)
    {
      IEditorPart activeEditor = getSite().getPage().getActiveEditor();
      if (activeEditor != null) {
        jumpToEditorTask(activeEditor);
      }
    }
  }
  
  private void jumpToEditorTask(IEditorPart editor)
  {
    IEditorInput input = editor.getEditorInput();
    if ((input instanceof TaskEditorInput))
    {
      ITask task = ((TaskEditorInput)input).getTask();
      ITask selected = getSelectedTask();
      if ((selected == null) || (!selected.equals(task))) {
        selectedAndFocusTask(task);
      }
    }
  }
  
  private void updateToolTip(boolean force)
  {
    if ((taskListToolTip != null) && (taskListToolTip.isVisible()))
    {
      if ((!force) && (taskListToolTip.isTriggeredByMouse())) {
        return;
      }
      TreeItem[] selection = getViewer().getTree().getSelection();
      if ((selection != null) && (selection.length > 0))
      {
        Rectangle bounds = selection[0].getBounds();
        taskListToolTip.show(new Point(x + 1, y + 1));
      }
    }
  }
  
  public static List<AbstractTaskListPresentation> getPresentations()
  {
    List<AbstractTaskListPresentation> presentations = new ArrayList();
    presentations.addAll(presentationsPrimary);
    presentations.addAll(presentationsSecondary);
    return presentations;
  }
  
  public static void addPresentation(AbstractTaskListPresentation presentation)
  {
    if (presentation.isPrimary()) {
      presentationsPrimary.add(presentation);
    } else {
      presentationsSecondary.add(presentation);
    }
  }
  
  public TaskListSorter getSorter()
  {
    return tableSorter;
  }
  
  public boolean show(ShowInContext context)
  {
    ISelection selection = context.getSelection();
    if ((selection instanceof IStructuredSelection))
    {
      getViewer().setSelection(selection, true);
      return true;
    }
    return false;
  }
  
  private void updateTooltipEnablement()
  {
    if (taskListToolTip != null)
    {
      boolean enabled = TasksUiPlugin.getDefault()
        .getPreferenceStore()
        .getBoolean("org.eclipse.mylyn.tasks.ui.task.list.tool.tip");
      taskListToolTip.setEnabled(enabled);
      if ((getViewer().getTree() != null) && (!getViewer().getTree().isDisposed())) {
        getViewer().getTree().setToolTipText(enabled ? "" : null);
      }
    }
  }
  
  public Object getAdapter(Class adapter)
  {
    if (adapter == ISizeProvider.class) {
      new ISizeProvider()
      {
        public int getSizeFlags(boolean width)
        {
          if (width) {
            return 128;
          }
          return 0;
        }
        
        public int computePreferredSize(boolean width, int availableParallel, int availablePerpendicular, int preferredResult)
        {
          if ((width) && 
            ((getViewSite().getActionBars().getToolBarManager() instanceof ToolBarManager)))
          {
            Point size = ((ToolBarManager)getViewSite().getActionBars().getToolBarManager()).getControl()
              .computeSize(-1, -1);
            
            return x + PlatformUiUtil.getViewMenuWidth();
          }
          return preferredResult;
        }
      };
    }
    if (adapter == IShowInTargetList.class) {
      new IShowInTargetList()
      {
        public String[] getShowInTargetIds()
        {
          return new String[] { "org.eclipse.team.ui.GenericHistoryView" };
        }
      };
    }
    if (adapter == IShowInSource.class) {
      new IShowInSource()
      {
        public ShowInContext getShowInContext()
        {
          return new ShowInContext(getViewer().getInput(), getViewer().getSelectio
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