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

ory;
import org.eclipse.mylyn.tasks.core.data.AbstractTaskAttachmentSource;
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
import org.eclipse.mylyn.tasks.core.data.TaskData;
import org.eclipse.mylyn.tasks.core.sync.SubmitJob;
import org.eclipse.mylyn.tasks.core.sync.SynchronizationJob;
import org.eclipse.mylyn.tasks.ui.TasksUiImages;
import org.eclipse.ui.progress.IProgressConstants;

public class TaskJobFactory
  extends org.eclipse.mylyn.internal.tasks.core.TaskJobFactory
{
  public TaskJobFactory(TaskList taskList, TaskDataManager taskDataManager, IRepositoryManager repositoryManager, IRepositoryModel tasksModel)
  {
    super(taskList, taskDataManager, repositoryManager, tasksModel);
  }
  
  public SynchronizationJob createSynchronizeTasksJob(AbstractRepositoryConnector connector, Set<ITask> tasks)
  {
    return (SynchronizationJob)decorateJob(super.createSynchronizeTasksJob(connector, tasks), TasksUiImages.REPOSITORY_SYNCHRONIZE);
  }
  
  public SynchronizationJob createSynchronizeTasksJob(AbstractRepositoryConnector connector, TaskRepository taskRepository, Set<ITask> tasks)
  {
    return (SynchronizationJob)decorateJob(super.createSynchronizeTasksJob(connector, taskRepository, tasks), 
      TasksUiImages.REPOSITORY_SYNCHRONIZE);
  }
  
  public SynchronizationJob createSynchronizeQueriesJob(AbstractRepositoryConnector connector, TaskRepository repository, Set<RepositoryQuery> queries)
  {
    return (SynchronizationJob)decorateJob(super.createSynchronizeQueriesJob(connector, repository, queries), 
      TasksUiImages.REPOSITORY_SYNCHRONIZE);
  }
  
  public SynchronizationJob createSynchronizeRepositoriesJob(Set<TaskRepository> repositories)
  {
    return (SynchronizationJob)decorateJob(super.createSynchronizeRepositoriesJob(repositories), TasksUiImages.REPOSITORY_SYNCHRONIZE);
  }
  
  public SubmitJob createSubmitTaskJob(AbstractRepositoryConnector connector, TaskRepository taskRepository, ITask task, TaskData taskData, Set<TaskAttribute> oldAttributes)
  {
    return (SubmitJob)decorateJob(super.createSubmitTaskJob(connector, taskRepository, task, taskData, oldAttributes), 
      TasksUiImages.REPOSITORY_SUBMIT);
  }
  
  public SubmitJob createSubmitTaskAttachmentJob(AbstractRepositoryConnector connector, TaskRepository taskRepository, ITask task, AbstractTaskAttachmentSource source, String comment, TaskAttribute attachmentAttribute)
  {
    return (SubmitJob)decorateJob(super.createSubmitTaskAttachmentJob(connector, taskRepository, task, source, comment, 
      attachmentAttribute), TasksUiImages.REPOSITORY_SUBMIT);
  }
  
  private <T extends Job> T decorateJob(T job, ImageDescriptor iconImageDescriptor)
  {
    if (iconImageDescriptor != null) {
      job.setProperty(IProgressConstants.ICON_PROPERTY, iconImageDescriptor);
    }
    return job;
  }
}

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

import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryManager;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.IRepositoryManager;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
import org.eclipse.mylyn.tasks.ui.TasksUi;
import org.eclipse.ui.IActionFilter;

class TaskRepositoryAdapterFactory$1
  implements IActionFilter
{
  TaskRepositoryAdapterFactory$1(TaskRepositoryAdapterFactory paramTaskRepositoryAdapterFactory) {}
  
  public boolean testAttribute(Object target, String name, String value)
  {
    TaskRepository repository = (TaskRepository)target;
    if ("offline".equals(name)) {
      return Boolean.valueOf(value).booleanValue() == repository.isOffline();
    }
    if ("supportQuery".equals(name))
    {
      AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(repository.getConnectorKind());
      AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager()
        .getRepositoryConnector(repository.getConnectorKind());
      return (connectorUi.getQueryWizard(repository, null) != null) && (connector.canQuery(repository));
    }
    if ("supportNewTask".equals(name))
    {
      AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
        repository.getConnectorKind());
      return connector.canCreateNewTask(repository);
    }
    if ("hasRepository".equals(name)) {
      return !repository.getConnectorKind().equals("local");
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.tasks.ui.TaskRepositoryAdapterFactory.1
 * 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.viewers.ISelection;
import org.eclipse.mylyn.commons.ui.CommonImages;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskListFilteredTree;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;

public class GoIntoAction
  extends Action
  implements IViewActionDelegate
{
  public static final String ID = "org.eclipse.mylyn.tasklist.actions.view.go.into";
  
  public GoIntoAction()
  {
    setId("org.eclipse.mylyn.tasklist.actions.view.go.into");
    setText(Messages.GoIntoAction_Go_Into);
    setToolTipText(Messages.GoIntoAction_Go_Into);
    setImageDescriptor(CommonImages.GO_INTO);
  }
  
  public void init(IViewPart view) {}
  
  public void run()
  {
    if (TaskListView.getFromActivePerspective() != null)
    {
      TaskListView.getFromActivePerspective().getFilteredTree().setFilterText("");
      TaskListView.getFromActivePerspective().goIntoCategory();
    }
  }
  
  public void run(IAction action)
  {
    run();
  }
  
  public void selectionChanged(IAction action, ISelection selection) {}
}

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

import org.eclipse.jface.viewers.AbstractTreeViewer;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Event;
import org.eclipse.ui.actions.BaseSelectionListenerAction;

public class OpenTaskListElementAction
  extends BaseSelectionListenerAction
{
  public static final String ID = "org.eclipse.mylyn.tasklist.actions.open";
  private AbstractTreeViewer viewer;
  
  public OpenTaskListElementAction()
  {
    super(Messages.OpenTaskListElementAction_Open);
    setToolTipText(Messages.OpenTaskListElementAction_Open_Task_List_Element);
    setId("org.eclipse.mylyn.tasklist.actions.open");
  }
  
  public AbstractTreeViewer getViewer()
  {
    return viewer;
  }
  
  public void setViewer(AbstractTreeViewer viewer)
  {
    this.viewer = viewer;
  }
  
  public void run()
  {
    runWithEvent(null);
  }
  
  public void runWithEvent(Event event)
  {
    for (Object element : getStructuredSelection().toList()) {
      if (((element instanceof ITask)) && (event != null) && ((keyCode & SWT.MOD1) != 0)) {
        TasksUiInternal.openTaskInBackground((AbstractTask)element, true);
      } else if ((element instanceof ITask)) {
        TasksUiInternal.refreshAndOpenTaskListElement((ITask)element);
      } else if (viewer != null) {
        if (viewer.getExpandedState(element)) {
          viewer.collapseToLevel(element, 1);
        } else {
          viewer.expandToLevel(element, 1);
        }
      }
    }
  }
}

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

import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.mylyn.internal.tasks.core.AbstractTaskCategory;
import org.eclipse.mylyn.internal.tasks.core.LocalTask;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
import org.eclipse.mylyn.tasks.core.IRepositoryElement;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
import org.eclipse.ui.actions.BaseSelectionListenerAction;

public class RenameAction
  extends BaseSelectionListenerAction
{
  public static final String ID = "org.eclipse.mylyn.tasklist.actions.rename";
  private final TaskListView view;
  
  public RenameAction(TaskListView view)
  {
    super(Messages.RenameAction_Rename);
    this.view = view;
    setId("org.eclipse.mylyn.tasklist.actions.rename");
    setAccelerator(16777227);
  }
  
  public void run()
  {
    Object selectedObject = ((IStructuredSelection)view.getViewer().getSelection()).getFirstElement();
    if ((selectedObject instanceof IRepositoryElement))
    {
      IRepositoryElement element = (IRepositoryElement)selectedObject;
      view.setInRenameAction(true);
      view.getViewer().editElement(element, 0);
      view.setInRenameAction(false);
    }
  }
  
  protected boolean updateSelection(IStructuredSelection selection)
  {
    Object selectedObject = selection.getFirstElement();
    if ((selectedObject instanceof AbstractTaskCategory))
    {
      AbstractTaskCategory container = (AbstractTaskCategory)selectedObject;
      return container.isUserManaged();
    }
    if ((selectedObject instanceof IRepositoryQuery)) {
      return true;
    }
    return selectedObject instanceof LocalTask;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.tasks.ui.actions.RenameAction
 * 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.CoreException;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.internal.tasks.core.DefaultTaskMapping;
import org.eclipse.mylyn.internal.tasks.core.LocalTask;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.ITaskMapping;
import org.eclipse.mylyn.tasks.core.data.ITaskDataManager;
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
import org.eclipse.mylyn.tasks.core.data.TaskAttributeMetaData;
import org.eclipse.mylyn.tasks.core.data.TaskData;
import org.eclipse.mylyn.tasks.ui.TasksUi;
import org.eclipse.mylyn.tasks.ui.TasksUiImages;
import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.BaseSelectionListenerAction;

public class CloneTaskAction
  extends BaseSelectionListenerAction
  implements IViewActionDelegate
{
  private static final String ID = "org.eclipse.mylyn.tasklist.actions.clone";
  protected ISelection selection;
  
  public CloneTaskAction()
  {
    super(Messages.CloneTaskAction_Clone_Label);
    setId("org.eclipse.mylyn.tasklist.actions.clone");
    setImageDescriptor(TasksUiImages.TASK_NEW);
  }
  
  public void init(IViewPart view) {}
  
  public void run()
  {
    for (Object selectedObject : getStructuredSelection().toList()) {
      if ((selectedObject instanceof AbstractTask))
      {
        AbstractTask task = (AbstractTask)selectedObject;
        
        String description = Messages.CloneTaskAction_Cloned_from_ + CopyTaskDetailsAction.getTextForTask(task);
        if ((task instanceof LocalTask))
        {
          String notes = task.getNotes();
          if (!"".equals(notes)) {
            description = description + "\n\n" + notes;
          }
        }
        ITaskMapping taskSelection = new DefaultTaskMapping();
        ((DefaultTaskMapping)taskSelection).setDescription(description);
        try
        {
          taskData = TasksUi.getTaskDataManager().getTaskData(task);
        }
        catch (CoreException e)
        {
          TaskData taskData;
          TasksUiInternal.displayStatus(Messages.CloneTaskAction_Clone_Task_Failed, e.getStatus());
          continue;
        }
        TaskData taskData;
        if (taskData != null)
        {
          AbstractRepositoryConnector connector = TasksUi.getRepositoryConnector(taskData.getConnectorKind());
          ITaskMapping mapping = connector.getTaskMapping(taskData);
          if (mapping.getDescription() != null)
          {
            ((DefaultTaskMapping)taskSelection).setDescription(description + "\n\n" + 
              mapping.getDescription());
            
            TaskAttribute attrDescription = mapping.getTaskData()
              .getRoot()
              .getMappedAttribute("task.common.description");
            if (attrDescription != null) {
              attrDescription.getMetaData().setReadOnly(false);
            }
          }
          mapping.merge(taskSelection);
          taskSelection = mapping;
        }
        Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
        if (!TasksUiUtil.openNewTaskEditor(shell, taskSelection, null)) {
          return;
        }
      }
    }
  }
  
  public void run(IAction action)
  {
    run();
  }
  
  public void selectionChanged(IAction action, ISelection selection)
  {
    if ((selection instanceof IStructuredSelection)) {
      super.selectionChanged((IStructuredSelection)selection);
    }
  }
  
  protected boolean updateSelection(IStructuredSelection selection)
  {
    if (!selection.isEmpty())
    {
      for (Object element : selection.toList()) {
        if (!(element instanceof AbstractTask)) {
          return false;
        }
      }
      return true;
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.tasks.ui.actions.CloneTaskAction
 * 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.TextProvider;
import org.eclipse.mylyn.tasks.core.IRepositoryPerson;
import org.eclipse.mylyn.tasks.core.ITaskComment;

class CopyCommenterNameAction$1
  implements ClipboardCopier.TextProvider
{
  CopyCommenterNameAction$1(CopyCommenterNameAction paramCopyCommenterNameAction) {}
  
  public String getTextForElement(Object element)
  {
    if ((element instanceof ITaskComment))
    {
      ITaskComment comment = (ITaskComment)element;
      IRepositoryPerson author = comment.getAuthor();
      if (author != null) {
        return author.getName();
      }
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.tasks.ui.actions.CopyCommenterNameAction.1
 * 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.viewers.TreeViewer;
import org.eclipse.mylyn.commons.ui.CommonImages;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;

public class ExpandAllAction
  extends Action
{
  public static final String ID = "org.eclipse.mylyn.tasklist.actions.expand.all";
  private final TaskListView taskListView;
  
  public ExpandAllAction(TaskListView taskListView)
  {
    this.taskListView = taskListView;
    setId("org.eclipse.mylyn.tasklist.actions.expand.all");
    setText(Messages.ExpandAllAction_Expand_All);
    setToolTipText(Messages.ExpandAllAction_Expand_All);
    setImageDescriptor(CommonImages.EXPAND_ALL);
  }
  
  public void run()
  {
    if (taskListView.getViewer() != null) {
      taskListView.getViewer().expandAll();
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.tasks.ui.actions.ExpandAllAction
 * 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.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.internal.tasks.core.LocalTask;
import org.eclipse.mylyn.internal.tasks.core.Person;
import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
import org.eclipse.mylyn.internal.tasks.core.ScheduledTaskContainer;
import org.eclipse.mylyn.internal.tasks.core.TaskCategory;
import org.eclipse.mylyn.internal.tasks.core.TaskGroup;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.IRepositoryManager;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.ITask.SynchronizationState;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.TasksUi;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.actions.ActionDelegate;
import org.eclipse.ui.actions.ActionFactory;

public class SynchronizeSelectedAction
  extends ActionDelegate
  implements IViewActionDelegate
{
  private IAction action;
  
  public void run(IAction action)
  {
    TaskListView taskListView = TaskListView.getFromActivePerspective();
    if (taskListView != null)
    {
      ISelection selection = taskListView.getViewer().getSelection();
      if (selection.isEmpty()) {
        TasksUiInternal.synchronizeAllRepositories(true);
      } else if ((selection instanceof IStructuredSelection)) {
        synchronizeSelected((IStructuredSelection)selection);
      }
    }
  }
  
  private void synchronizeSelected(IStructuredSelection selection)
  {
    Map<AbstractRepositoryConnector, List<RepositoryQuery>> queriesToSyncMap = new LinkedHashMap();
    Map<AbstractRepositoryConnector, List<ITask>> tasksToSyncMap = new LinkedHashMap();
    TaskGroup group;
    AbstractRepositoryConnector client;
    for (Object obj : selection.toList())
    {
      List<RepositoryQuery> queriesToSync;
      if ((obj instanceof IRepositoryQuery))
      {
        RepositoryQuery repositoryQuery = (RepositoryQuery)obj;
        AbstractRepositoryConnector client = TasksUi.getRepositoryManager().getRepositoryConnector(
          repositoryQuery.getConnectorKind());
        if (client != null)
        {
          queriesToSync = (List)queriesToSyncMap.get(client);
          if (queriesToSync == null)
          {
            queriesToSync = new ArrayList();
            queriesToSyncMap.put(client, queriesToSync);
          }
          queriesToSync.add(repositoryQuery);
        }
      }
      else if ((obj instanceof TaskCategory))
      {
        TaskCategory cat = (TaskCategory)obj;
        for (ITask task : cat.getChildren())
        {
          AbstractRepositoryConnector client = TasksUi.getRepositoryManager().getRepositoryConnector(
            task.getConnectorKind());
          addTaskToSync(client, task, tasksToSyncMap);
        }
      }
      else if ((obj instanceof ITask))
      {
        AbstractTask repositoryTask = (AbstractTask)obj;
        AbstractRepositoryConnector client = TasksUi.getRepositoryManager().getRepositoryConnector(
          repositoryTask.getConnectorKind());
        addTaskToSync(client, repositoryTask, tasksToSyncMap);
      }
      else if ((obj instanceof ScheduledTaskContainer))
      {
        ScheduledTaskContainer scheduledContainer = (ScheduledTaskContainer)obj;
        for (ITask task : scheduledContainer.getChildren())
        {
          AbstractRepositoryConnector client = TasksUi.getRepositoryManager().getRepositoryConnector(
            task.getConnectorKind());
          addTaskToSync(client, task, tasksToSyncMap);
        }
      }
      else if ((obj instanceof Person))
      {
        Person person = (Person)obj;
        for (ITask task : person.getChildren())
        {
          AbstractRepositoryConnector client = TasksUi.getRepositoryManager().getRepositoryConnector(
            task.getConnectorKind());
          addTaskToSync(client, task, tasksToSyncMap);
        }
      }
      else if ((obj instanceof TaskGroup))
      {
        group = (TaskGroup)obj;
        for (ITask task : group.getChildren())
        {
          client = TasksUi.getRepositoryManager().getRepositoryConnector(
            task.getConnectorKind());
          addTaskToSync(client, task, tasksToSyncMap);
        }
      }
    }
    label677:
    Object entry;
    if (!queriesToSyncMap.isEmpty())
    {
      HashMap<TaskRepository, Set<RepositoryQuery>> repositoriesToSync = new HashMap();
      for (group = queriesToSyncMap.keySet().iterator(); group.hasNext(); client.hasNext())
      {
        AbstractRepositoryConnector connector = (AbstractRepositoryConnector)group.next();
        List<RepositoryQuery> queriesToSync = (List)queriesToSyncMap.get(connector);
        if ((queriesToSync == null) || (queriesToSync.isEmpty())) {
          break label677;
        }
        client = queriesToSync.iterator(); continue;RepositoryQuery query = (RepositoryQuery)client.next();
        TaskRepository repos = TasksUi.getRepositoryManager().getRepository(query.getConnectorKind(), 
          query.getRepositoryUrl());
        Set<RepositoryQuery> queries = (Set)repositoriesToSync.get(repos);
        if (queries == null)
        {
          queries = new HashSet();
          repositoriesToSync.put(repos, queries);
        }
        queries.add(query);
      }
      for (group = repositoriesToSync.entrySet().iterator(); group.hasNext();)
      {
        entry = (Map.Entry)group.next();
        TaskRepository repository = (TaskRepository)((Map.Entry)entry).getKey();
        AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
          repository.getConnectorKind());
        Set<RepositoryQuery> queries = (Set)((Map.Entry)entry).getValue();
        TasksUiInternal.synchronizeQueries(connector, repository, queries, null, true);
      }
    }
    if (!tasksToSyncMap.isEmpty()) {
      for (entry = tasksToSyncMap.keySet().iterator(); ((Iterator)entry).hasNext();)
      {
        AbstractRepositoryConnector connector = (AbstractRepositoryConnector)((Iterator)entry).next();
        List<ITask> tasksToSync = (List)tasksToSyncMap.get(connector);
        if ((tasksToSync != null) && (tasksToSync.size() > 0)) {
          TasksUiInternal.synchronizeTasks(connector, new HashSet(tasksToSync), true, null);
        }
      }
    }
  }
  
  private void addTaskToSync(AbstractRepositoryConnector connector, ITask task, Map<AbstractRepositoryConnector, List<ITask>> tasksToSyncMap)
  {
    if ((connector == null) || 
      ((task instanceof LocalTask)) || 
      (task.getSynchronizationState() == ITask.SynchronizationState.OUTGOING_NEW)) {
      return;
    }
    List<ITask> tasksToSync = (List)tasksToSyncMap.get(connector);
    if (tasksToSync == null)
    {
      tasksToSync = new ArrayList();
      tasksToSyncMap.put(connector, tasksToSync);
    }
    tasksToSync.add(task);
  }
  
  public void init(IAction action)
  {
    this.action = action;
  }
  
  public void init(IViewPart view)
  {
    IActionBars actionBars = view.getViewSite().getActionBars();
    actionBars.setGlobalActionHandler(ActionFactory.REFRESH.getId(), action);
    actionBars.updateActionBars();
  }
}

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

import java.util.Collections;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.internal.tasks.core.ITaskListRunnable;
import org.eclipse.mylyn.internal.tasks.core.TaskList;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.tasks.core.IRepositoryElement;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
import org.eclipse.ui.actions.BaseSelectionListenerAction;

public class HideQueryAction
  extends BaseSelectionListenerAction
{
  public HideQueryAction()
  {
    super(Messages.HideQueryAction_Hidden_Label);
    setChecked(false);
    setEnabled(false);
  }
  
  protected boolean updateSelection(IStructuredSelection selection)
  {
    if (selection.isEmpty()) {
      return false;
    }
    boolean hidden = true;
    for (Object element : selection.toList()) {
      if ((element instanceof IRepositoryQuery)) {
        hidden &= Boolean.parseBoolean(((IRepositoryQuery)element).getAttribute("task.common.hidden"));
      } else {
        return false;
      }
    }
    setChecked(hidden);
    return true;
  }
  
  public void run()
  {
    for (Object element : getStructuredSelection().toList()) {
      if ((element instanceof IRepositoryQuery)) {
        try
        {
          final IRepositoryQuery query = (IRepositoryQuery)element;
          TasksUiPlugin.getTaskList().run(new ITaskListRunnable()
          {
            public void execute(IProgressMonitor monitor)
              throws CoreException
            {
              query.setAttribute("task.common.hidden", Boolean.toString(isChecked()));
            }
          });TasksUiPlugin.getTaskList()
            .notifyElementsChanged(Collections.singleton((IRepositoryElement)query));
        }
        catch (CoreException e)
        {
          StatusHandler.log(new Status(4, "org.eclipse.mylyn.tasks.ui", 
            "Failed to set hidden status for query", e));
        }
      }
    }
  }
}

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

import java.util.LinkedHashSet;
import org.eclipse.mylyn.internal.tasks.core.TaskActivationHistory;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.dialogs.FilteredItemsSelectionDialog.SelectionHistory;

class TaskSelectionDialog$TaskSelectionHistory
  extends FilteredItemsSelectionDialog.SelectionHistory
{
  private TaskSelectionDialog$TaskSelectionHistory(TaskSelectionDialog paramTaskSelectionDialog) {}
  
  public synchronized void accessed(Object object) {}
  
  public synchronized boolean contains(Object object)
  {
    return TaskSelectionDialog.access$5(this$0).contains(object);
  }
  
  public synchronized Object[] getHistoryItems()
  {
    return TaskSelectionDialog.access$5(this$0).toArray();
  }
  
  public synchronized boolean isEmpty()
  {
    return TaskSelectionDialog.access$5(this$0).isEmpty();
  }
  
  public void load(IMemento memento) {}
  
  public synchronized boolean remove(Object object)
  {
    TaskSelectionDialog.access$6(this$0).removeTask((ITask)object);
    return TaskSelectionDialog.access$5(this$0).remove(object);
  }
  
  protected Object restoreItemFromMemento(IMemento memento)
  {
    return null;
  }
  
  public void save(IMemento memento) {}
  
  protected void storeItemToMemento(Object item, IMemento memento) {}
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.tasks.ui.actions.TaskSelectionDialog.TaskSelectionHistory
 * 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.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;

class NewTaskAction$RepositorySelectionAction
  extends Action
{
  private final TaskRepository repository;
  
  public NewTaskAction$RepositorySelectionAction(NewTaskAction paramNewTaskAction, TaskRepository repository)
  {
    this.repository = repository;
    setText(repository.getRepositoryLabel());
  }
  
  public void run()
  {
    Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
    if (repository.getConnectorKind().equalsIgnoreCase("local")) {
      TasksUiUtil.openNewLocalTaskEditor(shell, null);
    } else {
      TasksUiUtil.openNewTaskEditor(shell, null, repository);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.tasks.ui.actions.NewTaskAction.RepositorySelectionAction
 * 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.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExecutableExtension;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuCreator;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.mylyn.internal.commons.ui.TaskListImageDescriptor;
import org.eclipse.mylyn.internal.tasks.core.ITaskRepositoryFilter;
import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskRepositoriesSorter;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.IRepositoryManager;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.TasksUi;
import org.eclipse.mylyn.tasks.ui.TasksUiImages;
import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.BaseSelectionListenerAction;

public class NewTaskAction
  extends BaseSelectionListenerAction
  implements IMenuCreator, IViewActionDelegate, IExecutableExtension
{
  private static final String LABEL_NEW_TASK = Messages.NewTaskAction_new_task;
  public static final String ID = "org.eclipse.mylyn.tasklist.ui.repositories.actions.create";
  private boolean skipRepositoryPage = false;
  private boolean localTask = false;
  private Menu dropDownMenu;
  
  public NewTaskAction(String label, boolean alwaysShowWizard)
  {
    super(label);
    if (!alwaysShowWizard) {
      setMenuCreator(this);
    }
    setText(label);
    setToolTipText(label);
    setId("org.eclipse.mylyn.tasklist.ui.repositories.actions.create");
    setEnabled(true);
    setImageDescriptor(TasksUiImages.TASK_NEW);
  }
  
  public NewTaskAction()
  {
    this(LABEL_NEW_TASK, false);
  }
  
  public void run()
  {
    Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
    if ((shell != null) && (!shell.isDisposed())) {
      if (localTask) {
        TasksUiUtil.openNewLocalTaskEditor(shell, null);
      } else if (skipRepositoryPage) {
        TasksUiUtil.openNewTaskEditor(shell, null, TasksUiUtil.getSelectedRepository());
      } else {
        TasksUiUtil.openNewTaskEditor(shell, null, null);
      }
    }
  }
  
  public void run(IAction action)
  {
    run();
  }
  
  public void init(IViewPart view) {}
  
  public void selectionChanged(IAction action, ISelection selection) {}
  
  public void setInitializationData(IConfigurationElement config, String propertyName, Object data)
    throws CoreException
  {
    if ("skipFirstPage".equals(data)) {
      skipRepositoryPage = true;
    }
    if ("local".equals(data)) {
      localTask = true;
    }
  }
  
  public void dispose()
  {
    if (dropDownMenu != null)
    {
      dropDownMenu.dispose();
      dropDownMenu = null;
    }
  }
  
  public Menu getMenu(Control parent)
  {
    if (dropDownMenu != null) {
      dropDownMenu.dispose();
    }
    dropDownMenu = new Menu(parent);
    addActionsToMenu();
    return dropDownMenu;
  }
  
  public Menu getMenu(Menu parent)
  {
    if (dropDownMenu != null) {
      dropDownMenu.dispose();
    }
    dropDownMenu = new Menu(parent);
    addActionsToMenu();
    return dropDownMenu;
  }
  
  private void addActionsToMenu()
  {
    NewTaskAction newTaskAction = new NewTaskAction(LABEL_NEW_TASK, true);
    newTaskAction.setText(Messages.NewTaskAction_Show_Wizard_Label);
    new ActionContributionItem(newTaskAction).fill(dropDownMenu, -1);
    new Separator().fill(dropDownMenu, -1);
    
    Set<TaskRepository> includedRepositories = new HashSet();
    TaskRepository localRepository = TasksUi.getRepositoryManager().getRepository(
      "local", "local");
    
    addRepositoryAction(localRepository);
    
    IWorkingSet workingSet = PlatformUI.getWorkbench()
      .getActiveWorkbenchWindow()
      .getActivePage()
      .getAggregateWorkingSet();
    Object localObject;
    if ((workingSet != null) && (!workingSet.isEmpty()))
    {
      int j = (localObject = workingSet.getElements()).length;
      for (int i = 0; i < j; i++)
      {
        IAdaptable iterable_element = localObject[i];
        if ((iterable_element instanceof RepositoryQuery))
        {
          String repositoryUrl = ((RepositoryQuery)iterable_element).getRepositoryUrl();
          String connectorKind = ((RepositoryQuery)iterable_element).getConnectorKind();
          TaskRepository repository = TasksUi.getRepositoryManager().getRepository(connectorKind, 
            repositoryUrl);
          markForInclusion(includedRepositories, repository);
        }
      }
    }
    if (includedRepositories.isEmpty()) {
      for (TaskRepository repository : TasksUi.getRepositoryManager().getAllRepositories()) {
        markForInclusion(includedRepositories, repository);
      }
    }
    if (!includedRepositories.isEmpty())
    {
      ArrayList<TaskRepository> listOfRepositories = new ArrayList(includedRepositories);
      final TaskRepositoriesSorter comparator = new TaskRepositoriesSorter();
      Collections.sort(listOfRepositories, new Comparator()
      {
        public int compare(TaskRepository arg0, TaskRepository arg1)
        {
          return comparator.compare(null, arg0, arg1);
        }
      });
      for (localObject = listOfRepositories.iterator(); ((Iterator)localObject).hasNext();)
      {
        TaskRepository taskRepository = (TaskRepository)((Iterator)localObject).next();
        addRepositoryAction(taskRepository);
      }
    }
    new Separator().fill(dropDownMenu, -1);
    new ActionContributionItem(new NewQueryAction()).fill(dropDownMenu, -1);
    new ActionContributionItem(new NewCategoryAction()).fill(dropDownMenu, -1);
    new Separator().fill(dropDownMenu, -1);
    AddRepositoryAction action = new AddRepositoryAction();
    action.setText(Messages.NewTaskAction_Add_Repository);
    action.setImageDescriptor(null);
    new ActionContributionItem(action).fill(dropDownMenu, -1);
    new Separator("additions");
  }
  
  private void markForInclusion(Set<TaskRepository> includedRepositories, TaskRepository repository)
  {
    if ((repository != null) && (!repository.getConnectorKind().equals("local")))
    {
      AbstractRepositoryConnector connector = TasksUi.getRepositoryConnector(repository.getConnectorKind());
      if ((connector != null) && 
        (ITaskRepositoryFilter.CAN_CREATE_NEW_TASK.accept(repository, connector))) {
        includedRepositories.add(repository);
      }
    }
  }
  
  private RepositorySelectionAction addRepositoryAction(TaskRepository repository)
  {
    if (repository == null) {
      return null;
    }
    RepositorySelectionAction action = new RepositorySelectionAction(repository);
    ActionContributionItem item = new ActionContributionItem(action);
    action.setText(repository.getRepositoryLabel());
    ImageDescriptor overlay = TasksUiPlugin.getDefault().getOverlayIcon(repository.getConnectorKind());
    ImageDescriptor compositeDescriptor = new TaskListImageDescriptor(TasksUiImages.TASK_NEW, overlay, false, false);
    action.setImageDescriptor(compositeDescriptor);
    item.fill(dropDownMenu, -1);
    return action;
  }
  
  private class RepositorySelectionAction
    extends Action
  {
    private final TaskRepository repository;
    
    public RepositorySelectionAction(TaskRepository repository)
    {
      this.repository = repository;
      setText(repository.getRepositoryLabel());
    }
    
    public void run()
    {
      Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
      if (repository.getConnectorKind().equalsIgnoreCase("local")) {
        TasksUiUtil.openNewLocalTaskEditor(shell, null);
      } else {
        TasksUiUtil.openNewTaskEditor(shell, null, repository);
      }
    }
  }
}

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

import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.IRepositoryManager;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.TasksUi;
import org.eclipse.ui.actions.BaseSelectionListenerAction;

public abstract class AbstractTaskRepositoryAction
  extends BaseSelectionListenerAction
{
  private boolean singleSelect;
  
  public AbstractTaskRepositoryAction(String text)
  {
    super(text);
  }
  
  protected boolean updateSelection(IStructuredSelection selection)
  {
    if ((selection != null) && (!selection.isEmpty()))
    {
      if (singleSelect)
      {
        Object[] array = selection.toArray();
        if (array.length != 1) {
          return false;
        }
      }
      return getTaskRepository(selection.getFirstElement()) != null;
    }
    return false;
  }
  
  protected TaskRepository getTaskRepository(IStructuredSelection selection)
  {
    if ((selection != null) && (!selection.isEmpty())) {
      return getTaskRepository(selection.getFirstElement());
    }
    return null;
  }
  
  protected TaskRepository getTaskRepository(Object selectedObject)
  {
    TaskRepository taskRepository = null;
    if ((selectedObject instanceof TaskRepository))
    {
      taskRepository = (TaskRepository)selectedObject;
    }
    else if ((selectedObject instanceof IRepositoryQuery))
    {
      IRepositoryQuery query = (IRepositoryQuery)selectedObject;
      taskRepository = TasksUi.getRepositoryManager().getRep
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