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

lipboardCopier.TextProvider
{
  CopyCommentDetailsAction$1(CopyCommentDetailsAction paramCopyCommentDetailsAction) {}
  
  public String getTextForElement(Object element)
  {
    if ((element instanceof ITaskComment))
    {
      ITaskComment comment = (ITaskComment)element;
      IRepositoryPerson author = comment.getAuthor();
      if (author != null) {
        return author.getPersonId();
      }
    }
    return null;
  }
}

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

import java.io.File;
import java.util.Set;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.commons.workbench.WorkbenchUtil;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
import org.eclipse.mylyn.internal.tasks.core.TaskList;
import org.eclipse.mylyn.internal.tasks.core.TransferList;
import org.eclipse.mylyn.internal.tasks.core.externalization.TaskListExternalizer;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.util.ImportExportUtil;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
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.osgi.util.NLS;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;

public class ImportAction
  implements IViewActionDelegate
{
  public void init(IViewPart view) {}
  
  public void selectionChanged(IAction action, ISelection selection) {}
  
  public static class ImportStatus
    extends MultiStatus
  {
    private TransferList taskList;
    
    public ImportStatus(String pluginId, int code, String message, Throwable exception)
    {
      super(code, message, exception);
    }
    
    public TransferList getTaskList()
    {
      return taskList;
    }
  }
  
  public void run(IAction action)
  {
    FileDialog dialog = new FileDialog(WorkbenchUtil.getShell());
    dialog.setText(Messages.ImportAction_Dialog_Title);
    ImportExportUtil.configureFilter(dialog);
    String path = dialog.open();
    if (path != null)
    {
      File file = new File(path);
      if (file.isFile())
      {
        IStatus result = importElements(file);
        if (!result.isOK())
        {
          StatusHandler.log(result);
          TasksUiInternal.displayStatus(Messages.ImportAction_Dialog_Title, new MultiStatus(
            "org.eclipse.mylyn.tasks.core", 0, new IStatus[] { result }, 
            Messages.ImportAction_Problems_encountered, null));
        }
      }
    }
  }
  
  public static ImportStatus importElements(File file)
  {
    TransferList list = new TransferList();
    
    ImportStatus result = new ImportStatus("org.eclipse.mylyn.tasks.core", 0, 
      "Problems encounted during importing", null);
    taskList = list;
    
    TaskListExternalizer externalizer = TasksUiPlugin.getDefault().createTaskListExternalizer();
    try
    {
      externalizer.readTaskList(list, file);
    }
    catch (CoreException e)
    {
      result.add(new Status(4, "org.eclipse.mylyn.tasks.ui", "Problems encountered reading import file", e));
    }
    TaskList taskList = TasksUiPlugin.getTaskList();
    for (AbstractTask task : list.getAllTasks()) {
      if (!validateRepository(task.getConnectorKind(), task.getRepositoryUrl()))
      {
        result.add(new Status(2, "org.eclipse.mylyn.tasks.ui", NLS.bind(
          "Task {0} ignored, unknown connector", task.getSummary())));
      }
      else if (taskList.getTask(task.getHandleIdentifier()) != null)
      {
        result.add(new Status(2, "org.eclipse.mylyn.tasks.ui", NLS.bind(
          "Task {0} ignored, already exists in Task List", task.getSummary())));
      }
      else
      {
        task.setActive(false);
        taskList.addTask(task);
      }
    }
    for (RepositoryQuery query : list.getQueries()) {
      if (!validateRepository(query.getConnectorKind(), query.getRepositoryUrl()))
      {
        result.add(new Status(2, "org.eclipse.mylyn.tasks.ui", NLS.bind(
          "Query {0} ignored, unknown connector", query.getSummary())));
      }
      else
      {
        if (taskList.getQueries().contains(query)) {
          query.setHandleIdentifier(taskList.getUniqueHandleIdentifier());
        }
        taskList.addQuery(query);
        AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
          query.getConnectorKind());
        if (connector != null) {
          TasksUiInternal.synchronizeQuery(connector, query, null, true);
        }
      }
    }
    return result;
  }
  
  private static boolean validateRepository(String connectorKind, String repositoryUrl)
  {
    TaskRepository repository = TasksUi.getRepositoryManager().getRepository(connectorKind, repositoryUrl);
    if (repository == null)
    {
      if (TasksUi.getRepositoryConnector(connectorKind) == null) {
        return false;
      }
      repository = new TaskRepository(connectorKind, repositoryUrl);
      TasksUi.getRepositoryManager().addRepository(repository);
    }
    return true;
  }
}

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

import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.text.TextSelection;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.ITaskComment;
import org.eclipse.mylyn.tasks.core.ITaskMapping;
import org.eclipse.mylyn.tasks.core.TaskMapping;
import org.eclipse.mylyn.tasks.ui.TasksUiImages;
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;

public class NewTaskFromSelectionAction
  extends Action
{
  public static final String ID = "org.eclipse.mylyn.tasks.ui.actions.newTaskFromSelection";
  private ITaskMapping taskMapping;
  
  public NewTaskFromSelectionAction()
  {
    super(Messages.NewTaskFromSelectionAction_New_Task_from_Selection);
    setId("org.eclipse.mylyn.tasks.ui.actions.newTaskFromSelection");
    setImageDescriptor(TasksUiImages.TASK_NEW);
  }
  
  public ITaskMapping getTaskMapping()
  {
    return taskMapping;
  }
  
  public void run(IAction action)
  {
    run();
  }
  
  public void run()
  {
    if (taskMapping == null)
    {
      MessageDialog.openError(null, Messages.NewTaskFromSelectionAction_New_Task_from_Selection, 
        Messages.NewTaskFromSelectionAction_Nothing_selected_to_create_task_from);
      return;
    }
    Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
    TasksUiUtil.openNewTaskEditor(shell, taskMapping, null);
  }
  
  public void selectionChanged(ISelection selection)
  {
    if ((selection instanceof TextSelection))
    {
      TextSelection textSelection = (TextSelection)selection;
      final String text = textSelection.getText();
      if ((text != null) && (text.length() > 0)) {
        taskMapping = new TaskMapping()
        {
          public String getDescription()
          {
            return text;
          }
        };
      } else {
        taskMapping = null;
      }
    }
    else if ((selection instanceof StructuredSelection))
    {
      Object element = ((StructuredSelection)selection).getFirstElement();
      if ((element instanceof ITaskComment))
      {
        ITaskComment comment = (ITaskComment)element;
        final StringBuilder sb = new StringBuilder();
        sb.append("\n" + Messages.NewTaskFromSelectionAction____Created_from_Comment___);
        if (comment.getUrl() == null)
        {
          sb.append("\n" + Messages.NewTaskFromSelectionAction_URL_);
          sb.append(comment.getTask().getUrl());
          sb.append("\n" + Messages.NewTaskFromSelectionAction_Comment_);
          sb.append(comment.getNumber());
        }
        else
        {
          sb.append("\n" + Messages.NewTaskFromSelectionAction_URL_);
          sb.append(comment.getUrl());
        }
        sb.append("\n\n");
        sb.append(comment.getText());
        taskMapping = new TaskMapping()
        {
          public String getDescription()
          {
            return sb.toString();
          }
        };
      }
    }
    setEnabled(taskMapping != null);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.tasks.ui.actions.NewTaskFromSelectionAction
 * 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.internal.tasks.ui.workingsets.TaskWorkingSetUpdater;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.IWorkingSetManager;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.IWorkingSetSelectionDialog;

class TaskSelectionDialog$SelectWorkingSetAction
  extends Action
{
  public TaskSelectionDialog$SelectWorkingSetAction(TaskSelectionDialog paramTaskSelectionDialog)
  {
    super(Messages.TaskSelectionDialog_Select_Working_Set_, 1);
  }
  
  public void run()
  {
    IWorkingSetSelectionDialog dlg = PlatformUI.getWorkbench()
      .getWorkingSetManager()
      .createWorkingSetSelectionDialog(this$0.getShell(), false, 
      new String[] { TaskWorkingSetUpdater.ID_TASK_WORKING_SET });
    if (TaskSelectionDialog.access$0(this$0) != null) {
      dlg.setSelection(new IWorkingSet[] { TaskSelectionDialog.access$0(this$0) });
    }
    if (dlg.open() == 0)
    {
      IWorkingSet[] selection = dlg.getSelection();
      if (selection.length == 0) {
        TaskSelectionDialog.access$2(this$0, null);
      } else {
        TaskSelectionDialog.access$2(this$0, selection[0]);
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.tasks.ui.actions.TaskSelectionDialog.SelectWorkingSetAction
 * 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.core.runtime.IProgressMonitor;
import org.eclipse.mylyn.internal.tasks.core.ITaskListRunnable;
import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;

class AutoUpdateQueryAction$1
  implements ITaskListRunnable
{
  AutoUpdateQueryAction$1(AutoUpdateQueryAction paramAutoUpdateQueryAction, RepositoryQuery paramRepositoryQuery) {}
  
  public void execute(IProgressMonitor monitor)
    throws CoreException
  {
    val$query.setAutoUpdate(this$0.isChecked());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.tasks.ui.actions.AutoUpdateQueryAction.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.mylyn.internal.tasks.ui.workingsets.TaskWorkingSetUpdater;
import org.eclipse.swt.widgets.Event;
import org.eclipse.ui.IWorkingSet;

public class ToggleAllWorkingSetsAction
  extends Action
{
  public ToggleAllWorkingSetsAction()
  {
    super(Messages.ToggleAllWorkingSetsAction_Show_All, 2);
    super.setChecked(TaskWorkingSetUpdater.areNoTaskWorkingSetsEnabled());
  }
  
  public void run()
  {
    Set<IWorkingSet> newList = new HashSet(Arrays.asList(TaskWorkingSetUpdater.getEnabledSets()));
    
    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);
    TaskWorkingSetUpdater.applyWorkingSetsToAllWindows(newList);
  }
  
  public void runWithEvent(Event event)
  {
    run();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.tasks.ui.actions.ToggleAllWorkingSetsAction
 * 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 CollapseAllAction
  extends Action
{
  public static final String ID = "org.eclipse.mylyn.tasklist.actions.collapse.all";
  private final TaskListView taskListView;
  
  public CollapseAllAction(TaskListView taskListView)
  {
    super(Messages.CollapseAllAction_Collapse_All);
    this.taskListView = taskListView;
    setId("org.eclipse.mylyn.tasklist.actions.collapse.all");
    setText(Messages.CollapseAllAction_Collapse_All);
    setToolTipText(Messages.CollapseAllAction_Collapse_All);
    setImageDescriptor(CommonImages.COLLAPSE_ALL);
  }
  
  public void run()
  {
    if (taskListView.getViewer() != null) {
      taskListView.getViewer().collapseAll();
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.tasks.ui.actions.CollapseAllAction
 * 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.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;

class TaskWorkingSetAction$ConfigureWindowWorkingSetsDialog$1
  implements ISelectionChangedListener
{
  TaskWorkingSetAction$ConfigureWindowWorkingSetsDialog$1(TaskWorkingSetAction.ConfigureWindowWorkingSetsDialog paramConfigureWindowWorkingSetsDialog) {}
  
  public void selectionChanged(SelectionChangedEvent event)
  {
    this$1.handleSelectionChanged();
  }
}

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

public enum CopyTaskDetailsAction$Mode
{
  KEY,  URL,  SUMMARY,  SUMMARY_URL;
}

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

import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;

public class SynchronizeAllAction
  implements IViewActionDelegate
{
  public void init(IViewPart view) {}
  
  public void run(IAction action)
  {
    TasksUiInternal.synchronizeAllRepositories(true);
  }
  
  public void selectionChanged(IAction action, ISelection selection) {}
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.tasks.ui.actions.SynchronizeAllAction
 * 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;

class TaskSelectionDialog$DeselectWorkingSetAction
  extends Action
{
  public TaskSelectionDialog$DeselectWorkingSetAction(TaskSelectionDialog paramTaskSelectionDialog)
  {
    super(Messages.TaskSelectionDialog_Deselect_Working_Set, 1);
  }
  
  public void run()
  {
    TaskSelectionDialog.access$2(this$0, null);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.tasks.ui.actions.TaskSelectionDialog.DeselectWorkingSetAction
 * 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 java.util.Set;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuCreator;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.mylyn.commons.ui.CommonImages;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.internal.tasks.core.ITaskListChangeListener;
import org.eclipse.mylyn.internal.tasks.core.TaskActivityManager;
import org.eclipse.mylyn.internal.tasks.core.TaskActivityUtil;
import org.eclipse.mylyn.internal.tasks.core.TaskContainerDelta;
import org.eclipse.mylyn.internal.tasks.core.TaskList;
import org.eclipse.mylyn.internal.tasks.core.WeekDateRange;
import org.eclipse.mylyn.internal.tasks.ui.ScheduleTaskMenuContributor;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskListChangeAdapter;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;

public class TaskEditorScheduleAction
  extends Action
  implements IMenuCreator
{
  private final ITask task;
  private MenuManager menuManager;
  private final ScheduleTaskMenuContributor scheduleMenuContributor = new ScheduleTaskMenuContributor();
  private final ITaskListChangeListener TASK_LIST_LISTENER = new TaskListChangeAdapter()
  {
    public void containersChanged(Set<TaskContainerDelta> containers)
    {
      for (TaskContainerDelta taskContainerDelta : containers) {
        if ((taskContainerDelta.getElement() instanceof ITask))
        {
          AbstractTask updateTask = (AbstractTask)taskContainerDelta.getElement();
          if ((task.equals(updateTask)) && 
            (PlatformUI.getWorkbench() != null) && (!PlatformUI.getWorkbench().isClosing())) {
            PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable()
            {
              public void run()
              {
                updateImageDescriptor();
              }
            });
          }
        }
      }
    }
  };
  
  public TaskEditorScheduleAction(ITask task)
  {
    Assert.isNotNull(task);
    this.task = task;
    updateImageDescriptor();
    setMenuCreator(this);
    setToolTipText(Messages.TaskEditorScheduleAction_Private_Scheduling);
    TasksUiPlugin.getTaskList().addChangeListener(TASK_LIST_LISTENER);
  }
  
  public void run()
  {
    if (((AbstractTask)task).getScheduledForDate() == null)
    {
      TasksUiPlugin.getTaskList().addTaskIfAbsent(task);
      TasksUiPlugin.getTaskActivityManager().setScheduledFor((AbstractTask)task, 
        TaskActivityUtil.getCurrentWeek().getToday());
    }
    else
    {
      TasksUiPlugin.getTaskActivityManager().setScheduledFor((AbstractTask)task, null);
    }
  }
  
  public void updateImageDescriptor()
  {
    if (((task instanceof AbstractTask)) && (((AbstractTask)task).getScheduledForDate() != null)) {
      setImageDescriptor(CommonImages.SCHEDULE_DAY);
    } else {
      setImageDescriptor(CommonImages.SCHEDULE);
    }
    setEnabled(!task.isCompleted());
  }
  
  public Menu getMenu(Control parent)
  {
    if (menuManager != null) {
      menuManager.dispose();
    }
    menuManager = scheduleMenuContributor.getSubMenuManager(Collections.singletonList(task));
    menuManager.createContextMenu(parent);
    return menuManager.getMenu();
  }
  
  public Menu getMenu(Menu parent)
  {
    if (menuManager != null) {
      return menuManager.getMenu();
    }
    return null;
  }
  
  public void dispose()
  {
    if (menuManager != null) {
      menuManager.dispose();
    }
    TasksUiPlugin.getTaskList().removeChangeListener(TASK_LIST_LISTENER);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.tasks.ui.actions.TaskEditorScheduleAction
 * 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.internal.tasks.ui.search.SearchUtil;
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;

public class OpenTaskSearchAction
  extends Action
  implements IViewActionDelegate
{
  public void init(IViewPart view) {}
  
  public void run()
  {
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (window != null) {
      SearchUtil.openSearchDialog(window);
    }
  }
  
  public void run(IAction action)
  {
    run();
  }
  
  public void selectionChanged(IAction action, ISelection selection) {}
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.tasks.ui.actions.OpenTaskSearchAction
 * 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 java.lang.reflect.InvocationTargetException;
import org.eclipse.compare.CompareConfiguration;
import org.eclipse.compare.CompareEditorInput;
import org.eclipse.compare.CompareUI;
import org.eclipse.compare.IStreamContentAccessor;
import org.eclipse.compare.ITypedElement;
import org.eclipse.compare.structuremergeviewer.DiffNode;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.mylyn.commons.ui.CommonImages;
import org.eclipse.mylyn.internal.tasks.ui.util.AttachmentUtil;
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.mylyn.tasks.ui.TasksUiImages;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.actions.BaseSelectionListenerAction;
import org.eclipse.ui.internal.WorkbenchImages;

public class CompareAttachmentsAction
  extends BaseSelectionListenerAction
  implements IViewActionDelegate
{
  private ISelection currentSelection;
  
  public CompareAttachmentsAction()
  {
    super(Messages.CompareAttachmentsAction_Compare_Attachments);
  }
  
  protected CompareAttachmentsAction(String text)
  {
    super(text);
  }
  
  public void init(IViewPart view) {}
  
  public void run(IAction action)
  {
    if ((currentSelection instanceof IStructuredSelection))
    {
      IStructuredSelection selection = (IStructuredSelection)currentSelection;
      Object[] elements = selection.toArray();
      if (elements.length >= 2)
      {
        final ITaskAttachment attachment1 = (ITaskAttachment)elements[0];
        final ITaskAttachment attachment2 = (ITaskAttachment)elements[1];
        
        CompareConfiguration cc = new CompareConfiguration();
        
        cc.setLeftEditable(false);
        cc.setLeftLabel(attachment1.getFileName());
        cc.setLeftImage(getImage(attachment1));
        
        cc.setRightEditable(false);
        cc.setRightLabel(attachment2.getFileName());
        cc.setRightImage(getImage(attachment2));
        
        CompareEditorInput editorInput = new CompareEditorInput(cc)
        {
          public String getTitle()
          {
            return 
              Messages.CompareAttachmentsAction_Compare__ + attachment1.getFileName() + " - " + attachment2.getFileName() + ")";
          }
          
          protected Object prepareInput(IProgressMonitor pm)
            throws InvocationTargetException
          {
            CompareAttachmentsAction.CompareItem left = new CompareAttachmentsAction.CompareItem(CompareAttachmentsAction.this, attachment1);
            CompareAttachmentsAction.CompareItem right = new CompareAttachmentsAction.CompareItem(CompareAttachmentsAction.this, attachment2);
            return new DiffNode(left, right);
          }
        };
        CompareUI.openCompareEditor(editorInput);
      }
    }
  }
  
  private static final String[] IMAGE_EXTENSIONS = { ".jpg", ".gif", ".png", ".tiff", ".tif", ".bmp" };
  
  private Image getImage(ITaskAttachment attachment)
  {
    if (AttachmentUtil.isContext(attachment)) {
      return CommonImages.getImage(TasksUiImages.CONTEXT_TRANSFER);
    }
    if (attachment.isPatch()) {
      return CommonImages.getImage(TasksUiImages.TASK_ATTACHMENT_PATCH);
    }
    String filename = attachment.getFileName();
    if (filename != null)
    {
      filename = filename.toLowerCase();
      String[] arrayOfString;
      int j = (arrayOfString = IMAGE_EXTENSIONS).length;
      for (int i = 0; i < j; i++)
      {
        String extension = arrayOfString[i];
        if (filename.endsWith(extension)) {
          return CommonImages.getImage(CommonImages.IMAGE_FILE);
        }
      }
    }
    return WorkbenchImages.getImage("IMG_OBJ_FILE");
  }
  
  public void selectionChanged(IAction action, ISelection selection)
  {
    currentSelection = selection;
  }
  
  private class CompareItem
    implements IStreamContentAccessor, ITypedElement
  {
    private final ITaskAttachment attachment;
    
    public CompareItem(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
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.tasks.ui.actions;

import java.io.File;
import java.util.List;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.mylyn.commons.workbench.WorkbenchUtil;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.util.AttachmentUtil;
import org.eclipse.mylyn.internal.tasks.ui.util.DownloadAttachmentJob;
import org.eclipse.mylyn.internal.tasks.ui.util.Messages;
import org.eclipse.mylyn.tasks.core.ITaskAttachment;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Shell;

public class SaveAttachmentsAction
  extends Action
{
  public SaveAttachmentsAction(String text)
  {
    super(text);
  }
  
  public void run()
  {
    List<ITaskAttachment> attachments = AttachmentUtil.getSelectedAttachments(null);
    if (attachments.isEmpty()) {
      return;
    }
    if (attachments.size() == 1) {
      saveSingleAttachment((ITaskAttachment)attachments.get(0));
    } else {
      saveAllAttachments(attachments);
    }
  }
  
  private void saveSingleAttachment(ITaskAttachment attachment)
  {
    FileDialog fileChooser = new FileDialog(WorkbenchUtil.getShell(), 8192);
    fileChooser.setFileName(AttachmentUtil.getAttachmentFilename(attachment));
    
    File initDirectory = getInitialDirectory();
    if (initDirectory != null) {
      fileChooser.setFilterPath(initDirectory.getAbsolutePath());
    }
    String filePath = fileChooser.open();
    if (filePath == null) {
      return;
    }
    File file = new File(filePath);
    if ((file.exists()) && 
      (!MessageDialog.openConfirm(WorkbenchUtil.getShell(), Messages.TasksUiMenus_File_exists_, 
      Messages.TasksUiMenus_Overwrite_existing_file_ + file.getName()))) {
      return;
    }
    initDirectory = file.getParentFile();
    if (initDirectory != null) {
      saveInitialDirectory(initDirectory.getAbsolutePath());
    }
    DownloadAttachmentJob job = new DownloadAttachmentJob(attachment, file);
    job.setUser(true);
    job.schedule();
  }
  
  private void saveAllAttachments(List<ITaskAttachment> attachments)
  {
    DirectoryDialog dialog = new DirectoryDialog(WorkbenchUtil.getShell());
    dialog.setText(Messages.SaveAttachmentsAction_selectDirectory);
    dialog.setMessage(Messages.SaveAttachmentsAction_selectDirectoryHint);
    
    File initDirectory = getInitialDirectory();
    if (initDirectory != null) {
      dialog.setFilterPath(initDirectory.getAbsolutePath());
    }
    String directoryPath = dialog.open();
    if (directoryPath == null) {
      return;
    }
    saveInitialDirectory(directoryPath);
    
    File directory = new File(directoryPath);
    if (!directory.exists())
    {
      MessageDialog.openError(WorkbenchUtil.getShell(), Messages.SaveAttachmentsAction_directoryDoesntExist, 
        NLS.bind(Messages.SaveAttachmentsAction_directoryDoesntExist0, directoryPath));
      return;
    }
    for (ITaskAttachment attachment : attachments)
    {
      String filename = AttachmentUtil.getAttachmentFilename(attachment);
      File file = getTargetFile(WorkbenchUtil.getShell(), directory, filename);
      if (file != null)
      {
        DownloadAttachmentJob job = new DownloadAttachmentJob(attachment, file);
        job.setUser(true);
        job.schedule();
      }
    }
  }
  
  private File getTargetFile(Shell shell, File directory, String filename)
  {
    File attachFile = new File(directory, filename);
    for (;;)
    {
      if (!attachFile.exists()) {
        return attachFile;
      }
      boolean overwrite = MessageDialog.openQuestion(
        shell, 
        NLS.bind(Messages.SaveAttachmentsAction_overwriteFile0, attachFile.getName()), 
        NLS.bind(Messages.SaveAttachmentsAction_fileExists_doYouWantToOverwrite0, 
        attachFile.getAbsolutePath()));
      if (overwrite) {
        return attachFile;
      }
      FileDialog fileDialog = new FileDialog(shell, 8192);
      fileDialog.setFilterPath(directory.getAbsolutePath());
      fileDialog.setFileName(attachFile.getName());
      
      filename = fileDialog.open();
      if (filename == null) {
        return null;
      }
      attachFile = new File(filename);
    }
  }
  
  private File getInitialDirectory()
  {
    String dirName = TasksUiPlugin.getDefault()
      .getPreferenceStore()
      .getString("org.eclipse.mylyn.tasks.ui.attachments.defaultDirectory");
    if ((dirName == null) || (dirName.trim().length() == 0)) {
      return null;
    }
    File dirFile = new File(dirName).getAbsoluteFile();
    while ((dirFile != null) && (!dirFile.exists())) {
      dirFile = dirFile.getParentFile();
    }
    return dirFile;
  }
  
  private void saveInitialDirectory(String directory)
  {
    TasksUiPlugin.getDefault().getPreferenceStore().putValue("org.eclipse.mylyn.tasks.ui.attachments.defaultDirectory", directory);
  }
}

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

import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.mylyn.commons.ui.CommonImages;
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.IRepositoryManager;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.ui.TasksUi;
import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
import org.eclipse.mylyn.tasks.ui.editors.TaskEditorInput;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.BaseSelectionListenerAction;

public class SynchronizeEditorAction
  extends BaseSelectionListenerAction
{
  public static final String ID = "org.eclipse.mylyn.tasklist.actions.synchronize.editor";
  
  public SynchronizeEditorAction()
  {
    super(Messages.SynchronizeEditorAction_Synchronize);
    setToolTipText(Messages.SynchronizeEditorAction_Synchronize_Incoming_Changes);
    setId("org.eclipse.mylyn.tasklist.actions.synchronize.editor");
    setImageDescriptor(CommonImages.REFRESH_SMALL);
  }
  
  public void run()
  {
    IStructuredSelection selection = getStructuredSelection();
    if (selection == null) {
      return;
    }
    Object selectedObject = selection.getFirstElement();
    if (!(selectedObject instanceof TaskEditor)) {
      return;
    }
    final TaskEditor editor = (TaskEditor)selectedObject;
    ITask task = editor.getTaskEditorInput().getTask();
    if (task == null) {
      return;
    }
    AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
      task.getConnectorKind());
    if (connector == null) {
      return;
    }
    TasksUiInternal.synchronizeTask(connector, task, true, new JobChangeAdapter()
    {
      public void done(IJobChangeEvent event)
      {
        PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable()
        {
          /* Error */
          public void run()
          {
            // Byte code:
            //   0: aload_0
            //   1: getfield 33	org/eclipse/mylyn/internal/tasks/ui/actions/SynchronizeEditorAction$1$1:val$editor	Lorg/eclipse/mylyn/tasks/ui/editors/TaskEditor;
            //   4: invokevirtual 35	org/eclipse/mylyn/tasks/ui/editors/TaskEditor:refreshPages	()V
            //   7: goto +21 -> 28
            //   10: astore_1
            //   11: aload_0
            //   12: getfield 33	org/eclipse/mylyn/internal/tasks/ui/actions/SynchronizeEditorAction$1$1:val$editor	Lorg/eclipse/mylyn/tasks/ui/editors/TaskEditor;
            //   15: ifnull +11 -> 26
            //   18: aload_0
            //   19: getfield 33	org/eclipse/mylyn/internal/tasks/ui/actions/SynchronizeEditorAction$1$1:val$editor	Lorg/eclipse/mylyn/tasks/ui/editors/TaskEditor;
            //   22: iconst_0
            //   23: invokevirtual 36	org/eclipse/mylyn/tasks/ui/editors/TaskEditor:showBusy	(Z)V
            //   26: aload_1
            //   27: athrow
            //   28: aload_0
            //   29: getfield 33	org/eclipse/mylyn/internal/tasks/ui/actions/SynchronizeEditorAction$1$1:val$editor	Lorg/eclipse/mylyn/tasks/ui/editors/TaskEditor;
            //   32: ifnull +11 -> 43
            //   35: aload_0
            //   36: getfield 33	org/eclipse/mylyn/internal/tasks/ui/actions/SynchronizeEditorAction$1$1:val$editor	Lorg/eclipse/mylyn/tasks/ui/editors/TaskEditor;
            //   39: iconst_0
            //   40: invokevirtual 36	org/eclipse/mylyn/tasks/ui/editors/TaskEditor:showBusy	(Z)V
            //   43: return
            // Line number table:
            //   Java source line #72	-> byte code offset #0
            //   Java source line #73	-> byte code offset #10
            //   Java source line #74	-> byte code offset #11
            //   Java source line #75	-> byte code offset #18
            //   Java source line #77	-> byte code offset #26
            //   Java source line #74	-> byte code offset #28
            //   Java source line #75	-> byte code offset #35
            //   Java source line #78	-> byte code offset #43
            // Local variable table:
            //   start	length	slot	name	signature
            //   0	44	0	this	1
            //   10	17	1	localObject	Object
            // Exception table:
            //   from	to	target	type
            //   0	10	10	finally
          }
        });
      }
    });
    if (editor != null) {
      editor.showBusy(true);
    }
  }
  
  protected boolean updateSelection(IStructuredSelection selection)
  {
    Object selectedObject = selection.getFirstElement();
    if ((selectedObject instanceof TaskEditor))
    {
      TaskEditor editor = (TaskEditor)selectedObject;
      ITask task = editor.getTaskEditorInput().getTask();
      return !(task instanceof LocalTask);
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.tasks.ui.actions.SynchronizeEditorAction
 * 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.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.mylyn.internal.tasks.core.ITaskListRunnable;
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryManager;
import org.eclipse.mylyn.internal.tasks.ui.TaskRepositoryUtil;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.tasks.core.TaskRepository;

class DeleteTaskRepositoryAction$1$1
  implements ITaskListRunnable
{
  DeleteTaskRepositoryAction$1$1(DeleteTaskRepositoryAction.1 param1, List paramList1, List paramList2, TaskRepository paramTaskRepository) {}
  
  public void execute(IProgressMonitor monitor)
    throws CoreException
  {
    DeleteAction.performDeletion(val$tasksToDelete);
    
    DeleteAction.performDeletion(val$queriesToDelete);
    
    TasksUiPlugin.getRepositoryManager().removeRepository(val$repositoryToDelete);
    
    TaskRepositoryUtil.disableAddAutomatically(val$repositoryToDelete.getRepositoryUrl());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.tasks.ui.actions.DeleteTaskRepositoryAction.1.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 CopyCommentDetailsAction
  extends BaseSelectionListenerAction
{
  pub
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