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

et, 1);
    menuManager.add(windowWorkingSetAction);
    
    menuManager.addMenuListener(new IMenuListener()
    {
      private final List<ActionContributionItem> lruActions = new ArrayList();
      
      public void menuAboutToShow(IMenuManager manager)
      {
        deselectAction.setEnabled(selectedWorkingSet != null);
        editAction.setEnabled((selectedWorkingSet != null) && (selectedWorkingSet.isEditable()));
        for (ActionContributionItem action : lruActions) {
          manager.remove(action);
        }
        lruActions.clear();
        
        IWorkingSet[] workingSets = PlatformUI.getWorkbench().getWorkingSetManager().getRecentWorkingSets();
        Arrays.sort(workingSets, new WorkingSetLabelComparator());
        int count = 2;
        IWorkingSet[] arrayOfIWorkingSet1;
        int j = (arrayOfIWorkingSet1 = workingSets).length;
        for (int i = 0; i < j; i++)
        {
          IWorkingSet workingSet = arrayOfIWorkingSet1[i];
          if (workingSet.getId().equalsIgnoreCase(TaskWorkingSetUpdater.ID_TASK_WORKING_SET))
          {
            IAction action = new TaskSelectionDialog.FilterWorkingSetAction(TaskSelectionDialog.this, workingSet, count++);
            if (workingSet.equals(selectedWorkingSet)) {
              action.setChecked(true);
            }
            ActionContributionItem ci = new ActionContributionItem(action);
            lruActions.add(ci);
            manager.appendToGroup("lruActions", ci);
          }
        }
        windowWorkingSetAction.setChecked(windowWorkingSet.equals(selectedWorkingSet));
      }
    });
  }
  
  protected IDialogSettings getDialogSettings()
  {
    IDialogSettings settings = TasksUiPlugin.getDefault().getDialogSettings();
    IDialogSettings section = settings.getSection("TaskSelectionDialogSection");
    if (section == null)
    {
      section = settings.addNewSection("TaskSelectionDialogSection");
      section.put("OpenInBrowser", false);
      section.put("ShowCompletedTasks", true);
      section.put("IsUsingWindowWorkingSet", true);
      section.put("WorkingSetName", "");
    }
    return section;
  }
  
  public String getElementName(Object item)
  {
    return labelProvider.getText(item);
  }
  
  protected Comparator getItemsComparator()
  {
    return itemsComparator;
  }
  
  public boolean getOpenInBrowser()
  {
    return openInBrowser;
  }
  
  public boolean getShowExtendedOpeningOptions()
  {
    return showExtendedOpeningOptions;
  }
  
  public boolean needsCreateTask()
  {
    return needsCreateTask;
  }
  
  protected void restoreDialog(IDialogSettings settings)
  {
    openInBrowser = settings.getBoolean("OpenInBrowser");
    showCompletedTasks = settings.getBoolean("ShowCompletedTasks");
    showCompletedTasksAction.setChecked(showCompletedTasks);
    boolean isUsingWindowWorkingSet = settings.getBoolean("IsUsingWindowWorkingSet");
    if (isUsingWindowWorkingSet)
    {
      selectedWorkingSet = windowWorkingSet;
    }
    else
    {
      String workingSetName = settings.get("WorkingSetName");
      if (workingSetName != null) {
        selectedWorkingSet = PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(workingSetName);
      }
    }
    super.restoreDialog(settings);
  }
  
  public void setNeedsCreateTask(boolean value)
  {
    needsCreateTask = value;
  }
  
  public void setOpenInBrowser(boolean openInBrowser)
  {
    this.openInBrowser = openInBrowser;
  }
  
  private void setSelectedWorkingSet(IWorkingSet workingSet)
  {
    selectedWorkingSet = workingSet;
    if (workingSet != null) {
      PlatformUI.getWorkbench().getWorkingSetManager().addRecentWorkingSet(workingSet);
    }
    applyFilter();
  }
  
  public void setShowExtendedOpeningOptions(boolean showExtendedOpeningOptions)
  {
    this.showExtendedOpeningOptions = showExtendedOpeningOptions;
  }
  
  protected void storeDialog(IDialogSettings settings)
  {
    settings.put("OpenInBrowser", openInBrowser);
    settings.put("ShowCompletedTasks", showCompletedTasks);
    settings.put("IsUsingWindowWorkingSet", selectedWorkingSet == windowWorkingSet);
    if (selectedWorkingSet == null) {
      settings.put("WorkingSetName", "");
    } else {
      settings.put("WorkingSetName", selectedWorkingSet.getName());
    }
    super.storeDialog(settings);
  }
  
  protected IStatus validateItem(Object item)
  {
    if ((item instanceof ITask)) {
      return Status.OK_STATUS;
    }
    return new Status(4, "org.eclipse.mylyn.tasks.ui", 
      Messages.TaskSelectionDialog_Selected_item_is_not_a_task);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.tasks.ui.actions.TaskSelectionDialog
 * 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.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.GroupMarker;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.util.SafeRunnable;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.internal.tasks.core.AbstractTaskCategory;
import org.eclipse.mylyn.internal.tasks.core.TaskCategory;
import org.eclipse.mylyn.internal.tasks.core.UncategorizedTaskContainer;
import org.eclipse.mylyn.internal.tasks.ui.IDynamicSubMenuContributor;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.views.Messages;
import org.eclipse.mylyn.internal.tasks.ui.views.UpdateRepositoryConfigurationAction;
import org.eclipse.mylyn.tasks.core.IRepositoryElement;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.ITaskContainer;

public class RepositoryElementActionGroup
{
  protected static final String ID_SEPARATOR_NEW = "new";
  private static final String ID_SEPARATOR_OPERATIONS = "operations";
  private static final String ID_SEPARATOR_TASKS = "tasks";
  protected static final String ID_SEPARATOR_REPOSITORY = "repository";
  private static final String ID_SEPARATOR_PROPERTIES = "properties";
  protected static final String ID_SEPARATOR_NAVIGATE = "navigate";
  private static final String ID_SEPARATOR_OPEN = "open";
  private static final String ID_SEPARATOR_SHOW_IN = "showIn";
  protected static final String ID_SEPARATOR_EDIT = "edit";
  private final CopyTaskDetailsAction copyUrlAction;
  private final CopyTaskDetailsAction copyKeyAction;
  private final CopyTaskDetailsAction copyDetailsAction;
  private final OpenTaskListElementAction openAction;
  private final OpenWithBrowserAction openWithBrowserAction;
  private final DeleteAction deleteAction;
  private final DeleteTaskEditorAction deleteTaskEditorAction;
  private final RemoveFromCategoryAction removeFromCategoryAction;
  private final ShowInSearchViewAction showInSearchViewAction;
  private final ShowInTaskListAction showInTaskListAction;
  private final TaskActivateAction activateAction;
  private final TaskDeactivateAction deactivateAction;
  private ISelectionProvider selectionProvider;
  private final List<ISelectionChangedListener> actions;
  private final AutoUpdateQueryAction autoUpdateAction;
  private final NewSubTaskAction newSubTaskAction;
  private final CloneTaskAction cloneTaskAction;
  
  public RepositoryElementActionGroup()
  {
    actions = new ArrayList();
    
    newSubTaskAction = ((NewSubTaskAction)add(new NewSubTaskAction()));
    
    cloneTaskAction = ((CloneTaskAction)add(new CloneTaskAction()));
    
    activateAction = ((TaskActivateAction)add(new TaskActivateAction()));
    deactivateAction = new TaskDeactivateAction();
    
    copyKeyAction = ((CopyTaskDetailsAction)add(new CopyTaskDetailsAction(CopyTaskDetailsAction.Mode.KEY)));
    copyUrlAction = ((CopyTaskDetailsAction)add(new CopyTaskDetailsAction(CopyTaskDetailsAction.Mode.URL)));
    copyDetailsAction = ((CopyTaskDetailsAction)add(new CopyTaskDetailsAction(CopyTaskDetailsAction.Mode.SUMMARY_URL)));
    if (!isInEditor()) {
      copyDetailsAction.setActionDefinitionId("org.eclipse.ui.edit.copy");
    }
    removeFromCategoryAction = ((RemoveFromCategoryAction)add(new RemoveFromCategoryAction()));
    
    deleteAction = ((DeleteAction)add(new DeleteAction()));
    deleteTaskEditorAction = ((DeleteTaskEditorAction)add(new DeleteTaskEditorAction()));
    openAction = ((OpenTaskListElementAction)add(new OpenTaskListElementAction()));
    openWithBrowserAction = ((OpenWithBrowserAction)add(new OpenWithBrowserAction()));
    showInSearchViewAction = ((ShowInSearchViewAction)add(new ShowInSearchViewAction()));
    showInTaskListAction = ((ShowInTaskListAction)add(new ShowInTaskListAction()));
    
    autoUpdateAction = ((AutoUpdateQueryAction)add(new AutoUpdateQueryAction()));
  }
  
  protected <T extends ISelectionChangedListener> T add(T action)
  {
    actions.add(action);
    return action;
  }
  
  public void setSelectionProvider(ISelectionProvider selectionProvider)
  {
    if (this.selectionProvider != null) {
      for (ISelectionChangedListener action : actions) {
        this.selectionProvider.removeSelectionChangedListener(action);
      }
    }
    this.selectionProvider = selectionProvider;
    if (selectionProvider != null) {
      for (ISelectionChangedListener action : actions)
      {
        this.selectionProvider.addSelectionChangedListener(action);
        ISelection selection = selectionProvider.getSelection();
        if (selection == null) {
          selection = StructuredSelection.EMPTY;
        }
        action.selectionChanged(new SelectionChangedEvent(selectionProvider, selection));
      }
    }
  }
  
  public void fillContextMenu(final IMenuManager manager)
  {
    manager.add(new Separator("new"));
    manager.add(new GroupMarker("navigate"));
    manager.add(new Separator("open"));
    manager.add(new GroupMarker("showIn"));
    manager.add(new Separator("edit"));
    manager.add(new Separator("tasks"));
    manager.add(new GroupMarker("operations"));
    manager.add(new Separator("repository"));
    manager.add(new Separator("additions"));
    manager.add(new Separator("properties"));
    
    IStructuredSelection selection = getSelection();
    Object firstSelectedObject = selection.getFirstElement();
    ITaskContainer element;
    final ITaskContainer element;
    if ((firstSelectedObject instanceof ITaskContainer)) {
      element = (ITaskContainer)firstSelectedObject;
    } else {
      element = null;
    }
    final List<IRepositoryElement> selectedElements = getSelectedTaskContainers(selection);
    AbstractTask task = null;
    if ((element instanceof ITask)) {
      task = (AbstractTask)element;
    }
    if (!isInTaskList())
    {
      MenuManager newSubMenu = new MenuManager(Messages.RepositoryElementActionGroup_New);
      if (newSubTaskAction.isEnabled()) {
        newSubMenu.add(newSubTaskAction);
      }
      if (cloneTaskAction.isEnabled())
      {
        newSubMenu.add(new Separator());
        newSubMenu.add(cloneTaskAction);
      }
      manager.appendToGroup("new", newSubMenu);
    }
    if (((element instanceof ITask)) && (!isInEditor())) {
      addAction("open", openAction, manager, element);
    }
    if (openWithBrowserAction.isEnabled()) {
      manager.appendToGroup("open", openWithBrowserAction);
    }
    showInSearchViewAction.selectionChanged(selection);
    if (showInSearchViewAction.isEnabled()) {
      manager.appendToGroup("open", showInSearchViewAction);
    }
    showInTaskListAction.selectionChanged(selection);
    if ((showInTaskListAction.isEnabled()) && (!isInTaskList())) {
      manager.appendToGroup("open", showInTaskListAction);
    }
    if (task != null) {
      if (task.isActive()) {
        manager.appendToGroup("showIn", deactivateAction);
      } else {
        manager.appendToGroup("showIn", activateAction);
      }
    }
    if (!selection.isEmpty())
    {
      MenuManager copyDetailsSubMenu = new MenuManager(
        Messages.RepositoryElementActionGroup_Copy_Detail_Menu_Label, "org.eclipse.mylyn.tasklist.actions.copy");
      copyDetailsSubMenu.add(copyKeyAction);
      copyDetailsSubMenu.add(copyUrlAction);
      copyDetailsSubMenu.add(copyDetailsAction);
      manager.appendToGroup("edit", copyDetailsSubMenu);
    }
    if ((isInTaskList()) && (!selection.isEmpty())) {
      manager.appendToGroup("edit", deleteAction);
    }
    if (isInEditor()) {
      manager.appendToGroup("tasks", deleteTaskEditorAction);
    }
    removeFromCategoryAction.selectionChanged(selection);
    removeFromCategoryAction.setEnabled(isRemoveFromCategoryEnabled(selectedElements));
    if (removeFromCategoryAction.isEnabled()) {
      manager.appendToGroup("edit", removeFromCategoryAction);
    }
    if (autoUpdateAction.isEnabled()) {
      manager.appendToGroup("repository", autoUpdateAction);
    }
    if ((element instanceof IRepositoryQuery))
    {
      EditRepositoryPropertiesAction repositoryPropertiesAction = new EditRepositoryPropertiesAction();
      repositoryPropertiesAction.selectionChanged(new StructuredSelection(element));
      if (repositoryPropertiesAction.isEnabled())
      {
        MenuManager subMenu = new MenuManager(Messages.TaskListView_Repository);
        manager.appendToGroup("operations", subMenu);
        
        resetRepositoryConfigurationAction = new UpdateRepositoryConfigurationAction();
        resetRepositoryConfigurationAction.selectionChanged(new StructuredSelection(element));
        subMenu.add(resetRepositoryConfigurationAction);
        subMenu.add(new Separator());
        subMenu.add(repositoryPropertiesAction);
      }
    }
    Map<String, List<IDynamicSubMenuContributor>> dynamicMenuMap = TasksUiPlugin.getDefault().getDynamicMenuMap();
    Iterator localIterator;
    for (UpdateRepositoryConfigurationAction resetRepositoryConfigurationAction = dynamicMenuMap.keySet().iterator(); resetRepositoryConfigurationAction.hasNext(); localIterator.hasNext())
    {
      final String menuPath = (String)resetRepositoryConfigurationAction.next();
      localIterator = ((List)dynamicMenuMap.get(menuPath)).iterator(); continue;final IDynamicSubMenuContributor contributor = (IDynamicSubMenuContributor)localIterator.next();
      SafeRunnable.run(new ISafeRunnable()
      {
        public void handleException(Throwable e)
        {
          StatusHandler.log(new Status(4, "org.eclipse.mylyn.tasks.ui", "Menu contributor failed"));
        }
        
        public void run()
          throws Exception
        {
          MenuManager subMenuManager = contributor.getSubMenuManager(selectedElements);
          if (subMenuManager != null) {
            RepositoryElementActionGroup.this.addMenuManager(menuPath, subMenuManager, manager, element);
          }
        }
      });
    }
  }
  
  private boolean isInTaskList()
  {
    return this instanceof TaskListViewActionGroup;
  }
  
  private IStructuredSelection getSelection()
  {
    ISelection selection = selectionProvider != null ? selectionProvider.getSelection() : null;
    if ((selection instanceof IStructuredSelection)) {
      return (IStructuredSelection)selection;
    }
    return StructuredSelection.EMPTY;
  }
  
  private boolean isInEditor()
  {
    return this instanceof TaskEditorActionGroup;
  }
  
  private boolean isRemoveFromCategoryEnabled(List<IRepositoryElement> selectedElements)
  {
    if (selectedElements.isEmpty()) {
      return false;
    }
    for (IRepositoryElement element : selectedElements) {
      if ((element instanceof AbstractTask))
      {
        boolean hasCategory = false;
        for (ITaskContainer container : ((AbstractTask)element).getParentContainers())
        {
          if ((container instanceof TaskCategory)) {
            hasCategory = true;
          }
          if (((container instanceof UncategorizedTaskContainer)) && 
            (!"local".equals(((AbstractTask)element).getConnectorKind()))) {
            hasCategory = true;
          }
        }
        if (!hasCategory) {
          return false;
        }
      }
      else
      {
        return false;
      }
    }
    return true;
  }
  
  private void addMenuManager(String path, IMenuManager menuToAdd, IMenuManager manager, ITaskContainer element)
  {
    if (((element instanceof ITask)) || ((element instanceof IRepositoryQuery))) {
      manager.appendToGroup(path, menuToAdd);
    }
  }
  
  private void addAction(String path, Action action, IMenuManager manager, ITaskContainer element)
  {
    action.setEnabled(false);
    if (element != null) {
      updateActionEnablement(action, element);
    }
    manager.appendToGroup(path, action);
  }
  
  private void updateActionEnablement(Action action, ITaskContainer element)
  {
    if ((element instanceof ITask))
    {
      if ((action instanceof OpenTaskListElementAction)) {
        action.setEnabled(true);
      } else if ((action instanceof CopyTaskDetailsAction)) {
        action.setEnabled(true);
      } else if ((action instanceof RenameAction)) {
        action.setEnabled(true);
      }
    }
    else if (element != null)
    {
      if ((action instanceof GoIntoAction))
      {
        TaskCategory cat = (TaskCategory)element;
        if (cat.getChildren().size() > 0) {
          action.setEnabled(true);
        } else {
          action.setEnabled(false);
        }
      }
      else if ((action instanceof OpenTaskListElementAction))
      {
        action.setEnabled(true);
      }
      else if ((action instanceof CopyTaskDetailsAction))
      {
        action.setEnabled(true);
      }
      else if ((action instanceof RenameAction))
      {
        if ((element instanceof AbstractTaskCategory))
        {
          AbstractTaskCategory container = (AbstractTaskCategory)element;
          action.setEnabled(container.isUserManaged());
        }
        else if ((element instanceof IRepositoryQuery))
        {
          action.setEnabled(true);
        }
      }
    }
    else {
      action.setEnabled(true);
    }
  }
  
  public List<IRepositoryElement> getSelectedTaskContainers(IStructuredSelection selection)
  {
    List<IRepositoryElement> selectedElements = new ArrayList();
    for (Iterator<?> i = selection.iterator(); i.hasNext();)
    {
      Object object = i.next();
      if ((object instanceof ITaskContainer)) {
        selectedElements.add((IRepositoryElement)object);
      }
    }
    return selectedElements;
  }
  
  public OpenTaskListElementAction getOpenAction()
  {
    return openAction;
  }
  
  public TaskActivateAction getActivateAction()
  {
    return activateAction;
  }
  
  public DeleteAction getDeleteAction()
  {
    return deleteAction;
  }
  
  public CopyTaskDetailsAction getCopyDetailsAction()
  {
    return copyDetailsAction;
  }
}

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

import java.util.List;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuCreator;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.internal.tasks.core.TaskActivationHistory;
import org.eclipse.mylyn.internal.tasks.core.TaskActivityManager;
import org.eclipse.mylyn.internal.tasks.ui.TaskHistoryDropDown;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
import org.eclipse.mylyn.tasks.ui.TasksUiImages;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowPulldownDelegate;

public class ActivateTaskHistoryDropDownAction
  extends Action
  implements IWorkbenchWindowPulldownDelegate, IMenuCreator
{
  public static final String ID = "org.eclipse.mylyn.tasklist.actions.navigate.previous";
  private Menu dropDownMenu;
  private final TaskActivationHistory taskHistory;
  private final TaskHistoryDropDown taskHistoryDropDown;
  
  public ActivateTaskHistoryDropDownAction()
  {
    taskHistory = TasksUiPlugin.getTaskActivityManager().getTaskActivationHistory();
    taskHistoryDropDown = new TaskHistoryDropDown(null, taskHistory);
    setText(Messages.ActivateTaskHistoryDropDownAction_Activate_Previous_Task);
    setToolTipText(Messages.ActivateTaskHistoryDropDownAction_Activate_Previous_Task);
    setId("org.eclipse.mylyn.tasklist.actions.navigate.previous");
    setEnabled(true);
    setImageDescriptor(TasksUiImages.CONTEXT_HISTORY_PREVIOUS);
  }
  
  public void dispose() {}
  
  public Menu getMenu(Control parent)
  {
    if (dropDownMenu != null) {
      dropDownMenu.dispose();
    }
    dropDownMenu = new Menu(parent);
    taskHistoryDropDown.fill(dropDownMenu, -1);
    return dropDownMenu;
  }
  
  public Menu getMenu(Menu parent)
  {
    if (dropDownMenu != null) {
      dropDownMenu.dispose();
    }
    dropDownMenu = new Menu(parent);
    taskHistoryDropDown.fill(dropDownMenu, -1);
    return dropDownMenu;
  }
  
  public void init(IWorkbenchWindow window) {}
  
  public void run()
  {
    if (taskHistory.hasPrevious())
    {
      AbstractTask previousTask = taskHistory.getPreviousTask();
      if ((previousTask != null) && (!previousTask.isActive()))
      {
        TasksUiInternal.activateTaskThroughCommand(previousTask);
        if (TaskListView.getFromActivePerspective() != null) {
          TaskListView.getFromActivePerspective().refresh();
        }
      }
      setEnabled((taskHistory.getPreviousTasks() != null) && (taskHistory.getPreviousTasks().size() > 0));
    }
  }
  
  public void run(IAction action)
  {
    run();
  }
  
  public void selectionChanged(IAction action, ISelection selection) {}
}

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

import java.util.HashSet;
import java.util.Random;
import java.util.Set;
import org.eclipse.jface.dialogs.MessageDialog;
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.util.TasksUiInternal;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
import org.eclipse.mylyn.tasks.core.ITask.SynchronizationState;
import org.eclipse.mylyn.tasks.core.ITaskActivityManager;
import org.eclipse.mylyn.tasks.ui.TasksUi;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Display;

class TaskSelectionDialogWithRandom$1
  implements SelectionListener
{
  TaskSelectionDialogWithRandom$1(TaskSelectionDialogWithRandom paramTaskSelectionDialogWithRandom) {}
  
  public void widgetDefaultSelected(SelectionEvent e) {}
  
  public void widgetSelected(SelectionEvent se)
  {
    try
    {
      Set<ITask> selectedTasks = new HashSet();
      Set<ITask> allScheduled = ((TaskActivityManager)TasksUi.getTaskActivityManager()).getAllScheduledTasks();
      if (!allScheduled.isEmpty())
      {
        selectedTasks.addAll(allScheduled);
        
        selectedTasks.retainAll(TasksUiPlugin.getTaskList().getAllTasks());
      }
      if (selectedTasks.isEmpty()) {
        selectedTasks.addAll(TasksUiPlugin.getTaskList().getAllTasks());
      }
      Set<ITask> potentialTasks = new HashSet();
      addLowEnergyTasks(selectedTasks, potentialTasks, ITask.PriorityLevel.P5);
      addLowEnergyTasks(selectedTasks, potentialTasks, ITask.PriorityLevel.P4);
      if (potentialTasks.isEmpty()) {
        addLowEnergyTasks(selectedTasks, potentialTasks, ITask.PriorityLevel.P3);
      }
      if (potentialTasks.isEmpty()) {
        addLowEnergyTasks(selectedTasks, potentialTasks, ITask.PriorityLevel.P2);
      }
      int randomTaskIndex = new Random().nextInt(potentialTasks.size());
      ITask randomTask = ((ITask[])potentialTasks.toArray(new ITask[potentialTasks.size()]))[randomTaskIndex];
      if (TaskSelectionDialogWithRandom.access$0(this$0)) {
        TasksUi.getTaskActivityManager().activateTask(randomTask);
      }
      TasksUiInternal.refreshAndOpenTaskListElement(randomTask);
      this$0.close();
    }
    catch (Exception localException)
    {
      MessageDialog.openInformation(Display.getDefault().getActiveShell(), 
        Messages.TaskSelectionDialogWithRandom_Feeling_Lazy_Error_Title, 
        Messages.TaskSelectionDialogWithRandom_Feeling_Lazy_Error);
    }
  }
  
  private void addLowEnergyTasks(Set<ITask> selectedTasks, Set<ITask> potentialTasks, ITask.PriorityLevel priorityLevel)
  {
    for (ITask task : selectedTasks) {
      if ((task.getSynchronizationState().isSynchronized()) && (!task.isCompleted()) && 
        (priorityLevel.toString().equals(task.getPriority()))) {
        potentialTasks.add(task);
      }
    }
  }
}

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

import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.bindings.keys.IKeyLookup;
import org.eclipse.jface.bindings.keys.KeyLookupFactory;
import org.eclipse.mylyn.commons.ui.CommonUiUtil;
import org.eclipse.mylyn.internal.tasks.ui.workingsets.TaskWorkingSetUpdater;
import org.eclipse.swt.widgets.Event;
import org.eclipse.ui.IWorkingSet;

public class ToggleWorkingSetAction
  extends Action
{
  private final IWorkingSet workingSet;
  
  public ToggleWorkingSetAction(IWorkingSet workingSet)
  {
    super("", 2);
    this.workingSet = workingSet;
    setText(CommonUiUtil.toMenuLabel(workingSet.getLabel()));
    setImageDescriptor(workingSet.getImageDescriptor());
    setChecked(TaskWorkingSetUpdater.isWorkingSetEnabled(workingSet));
  }
  
  public void run()
  {
    runWithEvent(null);
  }
  
  public void runWithEvent(Event event)
  {
    Set<IWorkingSet> newList = new HashSet(Arrays.asList(TaskWorkingSetUpdater.getEnabledSets()));
    
    boolean modified = false;
    if (event != null) {
      modified = (stateMask & KeyLookupFactory.getDefault().formalModifierLookup("M1")) != 0;
    }
    if (!modified)
    {
      Set<IWorkingSet> tempList = new HashSet();
      Iterator<IWorkingSet> iter = newList.iterator();
      while (iter.hasNext())
      {
        IWorkingSet workingSet = (IWorkingSet)iter.next();
        if ((workingSet != null) && (workingSet.getId() != null) && 
          (workingSet.getId().equalsIgnoreCase(TaskWorkingSetUpdater.ID_TASK_WORKING_SET))) {
          tempList.add(workingSet);
        }
      }
      newList.removeAll(tempList);
      if (isChecked()) {
        newList.add(this.workingSet);
      } else if (!TaskWorkingSetUpdater.isOnlyTaskWorkingSetEnabled(this.workingSet)) {
        newList.add(this.workingSet);
      }
    }
    else if (isChecked())
    {
      newList.add(this.workingSet);
    }
    else
    {
      newList.remove(this.workingSet);
    }
    TaskWorkingSetUpdater.applyWorkingSetsToAllWindows(newList);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.tasks.ui.actions.ToggleWorkingSetAction
 * 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.preference.PreferenceDialog;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.PreferencesUtil;

public class OpenTasksUiPreferencesAction
  extends Action
{
  public static final String ID = "org.eclipse.mylyn.tasks.ui.actions.preferences.open";
  
  public OpenTasksUiPreferencesAction()
  {
    setText(Messages.OpenTasksUiPreferencesAction_Preferences_);
    setToolTipText(Messages.OpenTasksUiPreferencesAction_Preferences_);
    setId("org.eclipse.mylyn.tasks.ui.actions.preferences.open");
  }
  
  public void run()
  {
    PreferenceDialog dlg = PreferencesUtil.createPreferenceDialogOn(PlatformUI.getWorkbench()
      .getActiveWorkbenchWindow()
      .getShell(), "org.eclipse.mylyn.tasks.ui.preferences", new String[] { "org.eclipse.mylyn.tasks.ui.preferences" }, null);
    dlg.open();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.tasks.ui.actions.OpenTasksUiPreferencesAction
 * 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.preference.IPreferenceStore;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;

public class ShowAllQueriesAction
  extends Action
{
  public ShowAllQueriesAction()
  {
    setText(Messages.ShowAllQueriesAction_Show_All_Queries);
    setToolTipText(Messages.ShowAllQueriesAction_Show_All_Queries_Including_Hidden_Queries);
    setChecked(
    
      !TasksUiPlugin.getDefault().getPreferenceStore().getBoolean("org.eclipse.mylyn.tasks.ui.filters.hidden"));
  }
  
  public void run()
  {
    TasksUiPlugin.getDefault().getPreferenceStore().setValue("org.eclipse.mylyn.tasks.ui.filters.hidden", !isChecked());
  }
}

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

import java.util.HashSet;
import java.util.Set;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.ITaskContainer;
import org.eclipse.mylyn.tasks.ui.TaskElementLabelProvider;
import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.dialogs.FilteredItemsSelectionDialog;
import org.eclipse.ui.dialogs.FilteredItemsSelectionDialog.ItemsFilter;
import org.eclipse.ui.dialogs.SearchPattern;

class TaskSelectionDialog$TasksFilter
  extends FilteredItemsSelectionDialog.ItemsFilter
{
  private Set<ITask> allTasksFromWorkingSets;
  private final Set<AbstractTaskContainer> elements;
  private final boolean showCompletedTasks;
  
  public TaskSelectionDialog$TasksFilter(TaskSelectionDialog arg1, 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(TaskSelectionDialog.access$4(this$0).getText(item));
  }
  
  private void populateTasksFromWorkingSets()
  {
    allTasksFromWorkingSets = new HashSet(1000);
    for (ITaskContainer container : elements) {
      allTasksFromWorkingSets.addAll(container.getChildren());
    }
  }
}

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

import java.io.InputStream;
import org.eclipse.compare.IStreamContentAccessor;
import org.eclipse.compare.ITypedElement;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.IRepositoryManager;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.ITaskAttachment;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.core.data.AbstractTaskAttachmentHandler;
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
import org.eclipse.mylyn.tasks.ui.TasksUi;
import org.eclipse.swt.graphics.Image;

class CompareAttachmentsAction$CompareItem
  implements IStreamContentAccessor, ITypedElement
{
  private final ITaskAttachment attachment;
  
  public CompareAttachmentsAction$CompareItem(CompareAttachmentsAction paramCompareAttachmentsAction, ITaskAttachment attachment)
  {
    this.attachment = attachment;
  }
  
  public InputStream getContents()
    throws CoreException
  {
    TaskAttribute attachmentAttribute = attachment.getTaskAttribute();
    if (attachmentAttribute == null) {
      throw new CoreException(new Status(4, "org.eclipse.mylyn.tasks.ui", 
        Messages.CompareAttachmentsAction_Failed_to_find_attachment + attachment.getUrl()));
    }
    TaskRepository taskRepository = attachment.getTaskRepository();
    ITask task = attachment.getTask();
    AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
      taskRepository.getConnectorKind());
    AbstractTaskAttachmentHandler handler = connector.getTaskAttachmentHandler();
    return handler.getContent(taskRepository, task, attachmentAttribute, new NullProgressMonitor());
  }
  
  public Image getImage()
  {
    return null;
  }
  
  public String getName()
  {
    return attachment.getFileName();
  }
  
  public String getType()
  {
    String filename = attachment.getFileName();
    int n = filename.lastIndexOf('.');
    if (n > -1) {
      return filename.substring(n + 1);
    }
    return "txt";
  }
}

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

import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.ITask.SynchronizationState;
import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.actions.BaseSelectionListenerAction;

public abstract class AbstractTaskEditorAction
  extends BaseSelectionListenerAction
{
  protected TaskEditor editor;
  
  public AbstractTaskEditorAction(String text)
  {
    super(text);
  }
  
  public void setEditor(TaskEditor taskEditor)
  {
    editor = taskEditor;
  }
  
  protected boolean taskDirty(ITask task)
  {
    return ((editor != null) && (editor.isDirty())) || (task.getSynchronizationState().equals(ITask.SynchronizationState.OUTGOING)) || (task.getSynchronizationState().equals(ITask.SynchronizationState.CONFLICT));
  }
  
  protected void openInformationDialog(String label, String text)
  {
    Shell shell = null;
    if (editor != null) {
      shell = editor.getSite().getShell();
    }
    MessageDialog.openInformation(shell, label, text);
    if (editor != null) {
      editor.showBusy(false);
    }
  }
}

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

import org.eclipse.mylyn.internal.tasks.core.AbstractTaskCategory;
import org.eclipse.mylyn.internal.tasks.core.ITaskList;
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;

class OpenRepositoryTaskAction$1
  extends TaskOpenListener
{
  OpenRepositoryTaskAction$1(OpenRepositoryTaskAction paramOpenRepositoryTaskAction, AbstractTaskCategory paramAbstractTaskCategory) {}
  
  public void taskOpened(TaskOpenEvent event)
  {
    if ((val$finalCategory != null) && (event.getTask() != null)) {
      TasksUiInternal.getTaskList().addTask(event.getTask(), val$finalCategory);
    }
  }
}

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

import org.eclipse.mylyn.commons.ui.ClipboardCopier;
import org.eclipse.mylyn.commons.ui.ClipboardCopier.TextProvider;
import org.eclipse.mylyn.commons.ui.CommonImages;
import org.eclipse.mylyn.tasks.core.IRepositoryPerson;
import org.eclipse.mylyn.tasks.core.ITaskComment;
import org.eclipse.ui.actions.BaseSelectionListenerAction;

public class CopyCommenterNameAction
  extends BaseSelectionListenerAction
{
  public CopyCommenterNameAction()
  {
    super(Messages.CopyCommenterNameAction_Copy_User_Name);
    setToolTipText(Messages.CopyCommenterNameAction_Copy_User_Name_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.getName();
          }
        }
        return nu
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