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

, task);
  }
  
  private static String getTaskEditorId(ITask task)
  {
    String taskEditorId = "org.eclipse.mylyn.tasks.ui.editors.task";
    if (task != null)
    {
      ITask repositoryTask = task;
      AbstractRepositoryConnectorUi repositoryUi = TasksUiPlugin.getConnectorUi(repositoryTask.getConnectorKind());
      String customTaskEditorId = repositoryUi.getTaskEditorId(repositoryTask);
      if (customTaskEditorId != null) {
        taskEditorId = customTaskEditorId;
      }
    }
    return taskEditorId;
  }
  
  private static IEditorPart refreshEditorContentsIfOpen(ITask task, IEditorInput editorInput)
  {
    if ((task != null) && (
      (task.getSynchronizationState() == ITask.SynchronizationState.INCOMING) || 
      (task.getSynchronizationState() == ITask.SynchronizationState.CONFLICT))) {
      for (TaskEditor editor : getActiveRepositoryTaskEditors()) {
        if (editor.getEditorInput().equals(editorInput))
        {
          editor.refreshPages();
          editor.getEditorSite().getPage().activate(editor);
          return editor;
        }
      }
    }
    return null;
  }
  
  private static void synchronizeTask(TaskRepository taskRepository, ITask task)
  {
    if ((task instanceof LocalTask)) {
      return;
    }
    AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
      task.getConnectorKind());
    if (connector.canSynchronizeTask(taskRepository, task)) {
      synchronizeTaskInBackground(connector, task);
    }
  }
  
  public static boolean openRepositoryTask(String connectorKind, String repositoryUrl, String id)
  {
    return openRepositoryTask(connectorKind, repositoryUrl, id, null);
  }
  
  public static boolean openRepositoryTask(String connectorKind, String repositoryUrl, String id, TaskOpenListener listener)
  {
    return openRepositoryTask(connectorKind, repositoryUrl, id, listener, 0L);
  }
  
  public static boolean openRepositoryTask(String connectorKind, String repositoryUrl, String id, TaskOpenListener listener, long timestamp)
  {
    IRepositoryManager repositoryManager = TasksUi.getRepositoryManager();
    AbstractRepositoryConnector connector = repositoryManager.getRepositoryConnector(connectorKind);
    String taskUrl = connector.getTaskUrl(repositoryUrl, id);
    if (taskUrl == null) {
      return false;
    }
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (window == null)
    {
      IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
      if ((windows != null) && (windows.length > 0)) {
        window = windows[0];
      }
    }
    if (window == null) {
      return false;
    }
    IWorkbenchPage page = window.getActivePage();
    
    OpenRepositoryTaskJob job = new OpenRepositoryTaskJob(connectorKind, repositoryUrl, id, taskUrl, timestamp, 
      page);
    job.setListener(listener);
    job.schedule();
    
    return true;
  }
  
  public static boolean openTaskInBackground(ITask task, boolean bringToTop)
  {
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (window != null)
    {
      IEditorPart activeEditor = null;
      IWorkbenchPart activePart = null;
      IWorkbenchPage activePage = window.getActivePage();
      if (activePage != null)
      {
        activeEditor = activePage.getActiveEditor();
        activePart = activePage.getActivePart();
      }
      boolean opened = TasksUiUtil.openTask(task);
      if ((opened) && (activePage != null))
      {
        if ((!bringToTop) && (activeEditor != null)) {
          activePage.bringToTop(activeEditor);
        }
        if (activePart != null) {
          activePage.activate(activePart);
        }
      }
      return opened;
    }
    StatusHandler.log(new Status(4, "org.eclipse.mylyn.tasks.ui", "Unable to open editor for \"" + 
      task.getSummary() + "\": no active workbench window"));
    
    return false;
  }
  
  @Deprecated
  public static String escapeLabelText(String text)
  {
    return CommonUiUtil.toLabel(text);
  }
  
  public static void preservingSelection(TreeViewer viewer, Runnable runnable)
  {
    final ISelection selection = viewer.getSelection();
    
    runnable.run();
    if (selection != null)
    {
      ISelection newSelection = viewer.getSelection();
      if (((newSelection == null) || (newSelection.isEmpty())) && (selection != null) && (!selection.isEmpty())) {
        Display.getDefault().asyncExec(new Runnable()
        {
          public void run()
          {
            setSelection(selection, true);
          }
        });
      } else if (((newSelection instanceof ITreeSelection)) && (!newSelection.isEmpty())) {
        viewer.reveal(((ITreeSelection)newSelection).getFirstElement());
      }
    }
  }
  
  public static String getFormattedDuration(long duration, boolean includeSeconds)
  {
    long seconds = duration / 1000L;
    long minutes = 0L;
    long hours = 0L;
    
    String formatted = "";
    
    String hour = "";
    String min = "";
    String sec = "";
    if (seconds >= 3600L)
    {
      hours = seconds / 3600L;
      if (hours == 1L) {
        hour = hours + Messages.TasksUiInternal__hour_;
      } else if (hours > 1L) {
        hour = hours + Messages.TasksUiInternal__hours_;
      }
      seconds -= hours * 3600L;
      
      minutes = seconds / 60L;
      if (minutes == 1L) {
        min = minutes + Messages.TasksUiInternal__minute_;
      } else if (minutes != 1L) {
        min = minutes + Messages.TasksUiInternal__minutes_;
      }
      seconds -= minutes * 60L;
      if (seconds == 1L) {
        sec = seconds + Messages.TasksUiInternal__second;
      } else if (seconds > 1L) {
        sec = seconds + Messages.TasksUiInternal__seconds;
      }
      formatted = formatted + hour + min;
      if (includeSeconds) {
        formatted = formatted + sec;
      }
    }
    else if (seconds >= 60L)
    {
      minutes = seconds / 60L;
      if (minutes == 1L) {
        min = minutes + Messages.TasksUiInternal__minute_;
      } else if (minutes != 1L) {
        min = minutes + Messages.TasksUiInternal__minutes_;
      }
      seconds -= minutes * 60L;
      if (seconds == 1L) {
        sec = seconds + Messages.TasksUiInternal__second;
      } else if (seconds > 1L) {
        sec = seconds + Messages.TasksUiInternal__seconds;
      }
      formatted = formatted + min;
      if (includeSeconds) {
        formatted = formatted + sec;
      }
    }
    else
    {
      if (seconds == 1L) {
        sec = seconds + Messages.TasksUiInternal__second;
      } else if (seconds > 1L) {
        sec = seconds + Messages.TasksUiInternal__seconds;
      }
      if (includeSeconds) {
        formatted = formatted + sec;
      }
    }
    return formatted;
  }
  
  public static AbstractTask getTask(String repositoryUrl, String taskId, String fullUrl)
  {
    AbstractTask task = null;
    if ((repositoryUrl != null) && (taskId != null)) {
      task = (AbstractTask)getTaskList().getTask(repositoryUrl, taskId);
    }
    if ((task == null) && (fullUrl != null)) {
      task = getTaskByUrl(fullUrl);
    }
    if ((task == null) && (repositoryUrl != null) && (taskId != null)) {
      task = TasksUiPlugin.getTaskList().getTaskByKey(repositoryUrl, taskId);
    }
    return task;
  }
  
  public static AbstractTask getTaskByUrl(String taskUrl)
  {
    Collection<AbstractTask> tasks = TasksUiPlugin.getTaskList().getAllTasks();
    for (AbstractTask task : tasks)
    {
      String currUrl = task.getUrl();
      if ((currUrl != null) && (!currUrl.equals("")) && (currUrl.equals(taskUrl))) {
        return task;
      }
    }
    return null;
  }
  
  public static boolean isTaskUrl(String taskUrl)
  {
    Assert.isNotNull(taskUrl);
    List<TaskRepository> repositories = TasksUiPlugin.getRepositoryManager().getAllRepositories();
    for (TaskRepository repository : repositories) {
      if (taskUrl.startsWith(repository.getUrl())) {
        return true;
      }
    }
    return false;
  }
  
  @Deprecated
  public static String cleanTextForAction(String label)
  {
    return CommonUiUtil.toMenuLabel(label);
  }
  
  public static void executeCommand(IServiceLocator serviceLocator, String commandId, String title, Object object, Event event)
    throws NotEnabledException
  {
    IHandlerService service = (IHandlerService)serviceLocator.getService(IHandlerService.class);
    if (service != null)
    {
      ICommandService commandService = (ICommandService)serviceLocator.getService(ICommandService.class);
      if (commandService != null)
      {
        Command command = commandService.getCommand(commandId);
        if (command != null) {
          try
          {
            if (object != null)
            {
              IEvaluationContext context = service.createContextSnapshot(false);
              context.addVariable("selection", new StructuredSelection(object));
              service.executeCommandInContext(new ParameterizedCommand(command, null), event, context);
            }
            else
            {
              service.executeCommand(commandId, event);
            }
          }
          catch (ExecutionException e)
          {
            displayStatus(title, new Status(4, "org.eclipse.mylyn.tasks.ui", 
              "Command execution failed", e));
          }
          catch (NotDefinedException e)
          {
            displayStatus(
              title, 
              new Status(4, "org.eclipse.mylyn.tasks.ui", NLS.bind(
              "The command with the id ''{0}'' is not defined.", commandId), e));
          }
          catch (NotHandledException e)
          {
            displayStatus(
              title, 
              new Status(4, "org.eclipse.mylyn.tasks.ui", NLS.bind(
              "The command with the id ''{0}'' is not bound.", commandId), e));
          }
        } else {
          displayStatus(
            title, 
            new Status(4, "org.eclipse.mylyn.tasks.ui", NLS.bind(
            "The command with the id ''{0}'' does not exist.", commandId)));
        }
      }
      else
      {
        displayStatus(
          title, 
          new Status(
          4, 
          "org.eclipse.mylyn.tasks.ui", 
          NLS.bind(
          "Command service is not available to execute command with the id ''{0}''.", commandId), new Exception()));
      }
    }
    else
    {
      displayStatus(
        title, 
        new Status(
        4, 
        "org.eclipse.mylyn.tasks.ui", 
        NLS.bind(
        "Handler service is not available to execute command with the id ''{0}''.", commandId), new Exception()));
    }
  }
  
  public static void activateTaskThroughCommand(ITask task)
  {
    try
    {
      executeCommand(
        PlatformUI.getWorkbench(), 
        "org.eclipse.mylyn.tasks.ui.command.activateSelectedTask", Messages.TasksUiInternal_Activate_Task, task, null);
    }
    catch (NotEnabledException e)
    {
      StatusHandler.log(new Status(4, "org.eclipse.mylyn.tasks.ui", NLS.bind(
        "Failed to activate task ''{0}''.", task.getSummary()), e));
    }
  }
  
  public static long getActiveTime(ITask task)
  {
    if (isActivityTrackingEnabled()) {
      return TasksUiPlugin.getTaskActivityManager().getElapsedTime(task);
    }
    return 0L;
  }
  
  public static String getTaskPrefix(String connectorKind)
  {
    AbstractRepositoryConnector connector = TasksUiPlugin.getConnector(connectorKind);
    if (connector != null)
    {
      String prefix = connector.getTaskIdPrefix();
      
      return prefix.length() > 1 ? prefix + " " : prefix;
    }
    return "";
  }
  
  public static void displayFrameworkError(String message)
  {
    RuntimeException exception = new RuntimeException(message);
    if (!CoreUtil.TEST_MODE)
    {
      StatusAdapter status = new StatusAdapter(new Status(4, "org.eclipse.mylyn.tasks.ui", message, 
        exception));
      status.setProperty(IStatusAdapterConstants.TITLE_PROPERTY, "Framework Error");
      StatusManager.getManager().handle(status, 7);
    }
    throw exception;
  }
  
  public static String getAuthenticatedUrl(TaskRepository repository, IRepositoryElement element)
  {
    Assert.isNotNull(repository);
    Assert.isNotNull(element);
    IRepositoryManager repositoryManager = TasksUi.getRepositoryManager();
    AbstractRepositoryConnector connector = repositoryManager.getRepositoryConnector(repository.getConnectorKind());
    if (connector != null)
    {
      URL authenticatedUrl = connector.getAuthenticatedUrl(repository, element);
      if (authenticatedUrl != null) {
        return authenticatedUrl.toString();
      }
      String url = element.getUrl();
      if (isValidUrl(url)) {
        return url;
      }
    }
    return null;
  }
  
  public static TaskRepository getRepository(IRepositoryElement element)
  {
    IRepositoryManager repositoryManager = TasksUi.getRepositoryManager();
    TaskRepository repository = null;
    if ((element instanceof ITask)) {
      repository = repositoryManager.getRepository(((ITask)element).getConnectorKind(), 
        ((ITask)element).getRepositoryUrl());
    } else if ((element instanceof IRepositoryQuery)) {
      repository = repositoryManager.getRepository(((IRepositoryQuery)element).getConnectorKind(), 
        ((IRepositoryQuery)element).getRepositoryUrl());
    }
    return repository;
  }
  
  public static List<ITask> getTasksFromSelection(ISelection selection)
  {
    Assert.isNotNull(selection);
    if (selection.isEmpty()) {
      return Collections.emptyList();
    }
    List<ITask> tasks = new ArrayList();
    if ((selection instanceof IStructuredSelection)) {
      for (Object element : ((IStructuredSelection)selection).toList())
      {
        ITask task = null;
        if ((element instanceof ITask))
        {
          task = (ITask)element;
        }
        else if ((element instanceof IAdaptable))
        {
          IAdaptable adaptable = (IAdaptable)element;
          task = (ITask)adaptable.getAdapter(ITask.class);
        }
        if (task != null) {
          tasks.add(task);
        }
      }
    }
    return tasks;
  }
  
  public static boolean shouldShowIncoming(ITask task)
  {
    ITask.SynchronizationState state = task.getSynchronizationState();
    if (((state == ITask.SynchronizationState.INCOMING) && (!Boolean.valueOf(task.getAttribute("task.common.suppress.incoming")).booleanValue())) || 
      (state == ITask.SynchronizationState.INCOMING_NEW) || (state == ITask.SynchronizationState.CONFLICT)) {
      return true;
    }
    return false;
  }
  
  public static TaskData computeTaskData(TaskData taskData, TaskHistory history, String revisionId, IProgressMonitor monitor)
    throws CoreException
  {
    TaskData newTaskData = TaskDataState.createCopy(taskData);
    List<TaskRevision> revisions = history.getRevisions();
    Collections.reverse(revisions);
    TaskRevision lastRevision = null;
    TaskRevision.Change change;
    for (TaskRevision revision : revisions)
    {
      for (Iterator localIterator2 = revision.getChanges().iterator(); localIterator2.hasNext();)
      {
        change = (TaskRevision.Change)localIterator2.next();
        TaskAttribute attribute = newTaskData.getRoot().getAttribute(change.getAttributeId());
        if (attribute != null) {
          attribute.setValue(change.getRemoved());
        }
      }
      if (revisionId.equals(revision.getId()))
      {
        lastRevision = revision;
        break;
      }
    }
    if ((lastRevision != null) && (lastRevision.getDate() != null))
    {
      List<TaskAttribute> attributes = new ArrayList(newTaskData.getRoot()
        .getAttributes()
        .values());
      for (TaskAttribute attribute : attributes) {
        if ("comment".equals(attribute.getMetaData().getType()))
        {
          TaskCommentMapper mapper = TaskCommentMapper.createFrom(attribute);
          if ((mapper.getCreationDate() != null) && (mapper.getCreationDate().after(lastRevision.getDate()))) {
            newTaskData.getRoot().removeAttribute(attribute.getId());
          }
        }
        else if ("attachment".equals(attribute.getMetaData().getType()))
        {
          TaskAttachmentMapper mapper = TaskAttachmentMapper.createFrom(attribute);
          if ((mapper.getCreationDate() != null) && (mapper.getCreationDate().after(lastRevision.getDate()))) {
            newTaskData.getRoot().removeAttribute(attribute.getId());
          }
        }
      }
    }
    return newTaskData;
  }
  
  public static boolean canGetTaskHistory(ITask task)
  {
    TaskRepository repository = TasksUi.getRepositoryManager().getRepository(task.getConnectorKind(), 
      task.getRepositoryUrl());
    AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
      repository.getConnectorKind());
    return connector.canGetTaskHistory(repository, task);
  }
  
  public static Account getAccount(TaskAttribute attribute)
  {
    Account account;
    Account account;
    if ("person".equals(attribute.getMetaData().getType()))
    {
      IRepositoryPerson person = attribute.getTaskData().getAttributeMapper().getRepositoryPerson(attribute);
      account = Account.id(person.getPersonId()).name(person.getName());
    }
    else
    {
      account = Account.id(attribute.getValue());
    }
    TaskRepository repository = attribute.getTaskData().getAttributeMapper().getTaskRepository();
    return account.kind(repository.getConnectorKind()).url(repository.getRepositoryUrl());
  }
  
  public static boolean isActivityTrackingEnabled()
  {
    return (TasksUiPlugin.getTaskActivityMonitor().isEnabled()) && (MonitorUiPlugin.getDefault().isActivityTrackingEnabled());
  }
  
  public static TaskDropHandler getTaskDropHandler()
  {
    return taskDropHandler;
  }
}

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

import org.eclipse.jface.action.Action;
import org.eclipse.mylyn.tasks.core.ITaskAttachment;

class TasksUiMenus$2
  extends Action
{
  TasksUiMenus$2(String $anonymous0)
  {
    super($anonymous0);
  }
  
  public void run()
  {
    ITaskAttachment attachment = AttachmentUtil.getSelectedAttachment();
    if (attachment != null)
    {
      CopyAttachmentToClipboardJob job = new CopyAttachmentToClipboardJob(attachment);
      job.setUser(true);
      job.schedule();
    }
  }
}

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

import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;

class TasksUiInternal$3
  extends JobChangeAdapter
{
  TasksUiInternal$3(AbstractTask paramAbstractTask) {}
  
  public void done(IJobChangeEvent event)
  {
    PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable()
    {
      public void run()
      {
        TasksUiUtil.openTask(val$task);
      }
    });
  }
}

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

import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.mylyn.internal.tasks.core.sync.SubmitTaskAttachmentJob;
import org.eclipse.mylyn.tasks.core.sync.SubmitJob;

class AttachmentUtil$2
  implements IRunnableWithProgress
{
  AttachmentUtil$2(SubmitJob paramSubmitJob) {}
  
  public void run(IProgressMonitor monitor)
    throws InvocationTargetException, InterruptedException
  {
    if (((SubmitTaskAttachmentJob)val$submitJob).run(monitor) == Status.CANCEL_STATUS) {
      throw new InterruptedException();
    }
  }
}

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

import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.TreeViewer;

class TasksUiInternal$12
  implements Runnable
{
  TasksUiInternal$12(TreeViewer paramTreeViewer, ISelection paramISelection) {}
  
  public void run()
  {
    val$viewer.setSelection(val$selection, true);
  }
}

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

import org.eclipse.core.runtime.IProgressMonitor;

class TasksUiInternal$1$3
  implements Runnable
{
  TasksUiInternal$1$3(TasksUiInternal.1 param1, String paramString) {}
  
  public void run()
  {
    this$1.getWrappedProgressMonitor().subTask(val$name);
  }
}

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

import java.io.File;
import java.util.Set;

public class TaskDataSnapshotOperation
  extends TaskDataExportOperation
{
  public TaskDataSnapshotOperation(String destinationDirectory, String destinationFilename)
  {
    super(destinationDirectory, destinationFilename);
  }
  
  protected void selectFiles(Set<File> filesToExport)
  {
    filesToExport.add(new File(getSourceFolder(), "tasks.xml.zip"));
    filesToExport.add(new File(getSourceFolder(), "repositories.xml.zip"));
    filesToExport.add(new File(getSourceFolder(), "contexts/activity.xml.zip"));
  }
}

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

public abstract class TreeWalker$TreeVisitor
{
  public abstract boolean visit(Object paramObject);
}

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

import java.io.File;
import java.io.IOException;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.util.LocalSelectionTransfer;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.internal.tasks.ui.actions.CopyTaskDetailsAction;
import org.eclipse.swt.dnd.DragSourceAdapter;
import org.eclipse.swt.dnd.DragSourceEvent;
import org.eclipse.swt.dnd.FileTransfer;
import org.eclipse.swt.dnd.TextTransfer;

public class TaskDragSourceListener
  extends DragSourceAdapter
{
  private IStructuredSelection currentSelection;
  private final ISelectionProvider selectionProvider;
  
  public TaskDragSourceListener(ISelectionProvider selectionProvider)
  {
    this.selectionProvider = selectionProvider;
  }
  
  public void dragStart(DragSourceEvent event)
  {
    ISelection selection = selectionProvider.getSelection();
    if (((selection instanceof IStructuredSelection)) && (!selection.isEmpty()))
    {
      currentSelection = ((IStructuredSelection)selection);
    }
    else
    {
      currentSelection = null;
      doit = false;
    }
  }
  
  public void dragSetData(DragSourceEvent event)
  {
    if ((currentSelection == null) || (currentSelection.isEmpty())) {
      return;
    }
    if (LocalSelectionTransfer.getTransfer().isSupportedType(dataType)) {
      LocalSelectionTransfer.getTransfer().setSelection(currentSelection);
    } else if (FileTransfer.getInstance().isSupportedType(dataType)) {
      try
      {
        File file = File.createTempFile("mylyn-tasks", 
          ".xml.zip");
        file.deleteOnExit();
        ImportExportUtil.export(file, currentSelection);
        
        String[] paths = new String[1];
        paths[0] = file.getAbsolutePath();
        data = paths;
      }
      catch (CoreException e)
      {
        StatusHandler.log(new Status(4, "org.eclipse.mylyn.tasks.ui", 
          "Problems encountered dragging task", 
          e));
      }
      catch (IOException e)
      {
        StatusHandler.log(new Status(4, "org.eclipse.mylyn.tasks.ui", 
          "Problems encountered dragging task", 
          e));
      }
    } else if (TextTransfer.getInstance().isSupportedType(dataType)) {
      data = CopyTaskDetailsAction.getTextForTask(currentSelection.getFirstElement());
    }
  }
  
  public void dragFinished(DragSourceEvent event)
  {
    if (LocalSelectionTransfer.getTransfer().isSupportedType(dataType)) {
      LocalSelectionTransfer.getTransfer().setSelection(null);
    }
  }
}

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

import org.eclipse.core.runtime.Platform;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;

@Deprecated
public class PlatformUtil
{
  private static class Eclipse36Checker
  {
    public static final boolean result;
    
    static
    {
      boolean methodAvailable = false;
      try
      {
        StyledText.class.getMethod("setTabStops", new Class[] { int[].class });
        methodAvailable = true;
      }
      catch (NoSuchMethodException localNoSuchMethodException) {}
      result = methodAvailable;
    }
  }
  
  public static String[] getFilterExtensions(String... extensions)
  {
    for (int i = 0; i < extensions.length; i++)
    {
      String extension = extensions[i];
      if ("macosx".equals(Platform.getOS()))
      {
        int j = extension.lastIndexOf('.');
        if (j != -1) {
          extension = extension.substring(j);
        }
      }
      extensions[i] = ("*" + extension);
    }
    return extensions;
  }
  
  public static int getToolTipXShift()
  {
    if (("gtk".equals(SWT.getPlatform())) || ("carbon".equals(SWT.getPlatform())) || ("cocoa".equals(SWT.getPlatform()))) {
      return -26;
    }
    return -23;
  }
  
  public static int getTreeImageOffset()
  {
    if ("carbon".equals(SWT.getPlatform())) {
      return 16;
    }
    if ("cocoa".equals(SWT.getPlatform())) {
      return 13;
    }
    return 20;
  }
  
  public static int getIncomingImageOffset()
  {
    if ("carbon".equals(SWT.getPlatform())) {
      return 5;
    }
    if ("cocoa".equals(SWT.getPlatform())) {
      return 2;
    }
    return 6;
  }
  
  public static int getTreeItemSquish()
  {
    if ("gtk".equals(SWT.getPlatform())) {
      return 8;
    }
    if (isMac()) {
      return 3;
    }
    return 0;
  }
  
  private static boolean isMac()
  {
    return ("carbon".equals(SWT.getPlatform())) || ("cocoa".equals(SWT.getPlatform()));
  }
  
  public static boolean isPaintItemClippingRequired()
  {
    return "gtk".equals(SWT.getPlatform());
  }
  
  public static boolean spinnerHasNativeBorder()
  {
    return (isMac()) && (!isEclipse36orLater());
  }
  
  private static boolean isEclipse36orLater()
  {
    return Eclipse36Checker.result;
  }
  
  public static boolean hasNarrowToolBar()
  {
    return "win32".equals(SWT.getPlatform());
  }
  
  public static int getViewMenuWidth()
  {
    return 32;
  }
}

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

public abstract interface ClipboardCopier$TextProvider
{
  public abstract String getTextForElement(Object paramObject);
}

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

import org.eclipse.jface.util.SafeRunnable;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;

class SelectionProviderAdapter$1
  extends SafeRunnable
{
  SelectionProviderAdapter$1(SelectionProviderAdapter paramSelectionProviderAdapter, ISelectionChangedListener paramISelectionChangedListener, SelectionChangedEvent paramSelectionChangedEvent) {}
  
  public void run()
  {
    val$listener.selectionChanged(val$event);
  }
}

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

import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.core.sync.TaskJob;

class TasksUiInternal$4
  extends JobChangeAdapter
{
  TasksUiInternal$4(TaskRepository paramTaskRepository, TaskJob paramTaskJob) {}
  
  public void done(IJobChangeEvent event)
  {
    synchronized (val$taskRepository)
    {
      val$taskRepository.setUpdating(false);
    }
    if (val$job.getStatus() != null) {
      TasksUiInternal.asyncLogAndDisplayStatus(Messages.TasksUiInternal_Configuration_Refresh_Failed, 
        val$job.getStatus());
    }
  }
}

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

import java.util.Comparator;
import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
import org.eclipse.mylyn.internal.tasks.core.TaskList;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;

public class TaskContainerComparator
  implements Comparator<AbstractTaskContainer>
{
  public int compare(AbstractTaskContainer c1, AbstractTaskContainer c2)
  {
    if (c1.equals(TasksUiPlugin.getTaskList().getDefaultCategory())) {
      return -1;
    }
    if (c2.equals(TasksUiPlugin.getTaskList().getDefaultCategory())) {
      return 1;
    }
    return c1.getSummary().compareToIgnoreCase(c2.getSummary());
  }
}

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

import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.internal.tasks.ui.actions.ClearOutgoingAction;
import org.eclipse.mylyn.tasks.core.ITask;

public class TaskPropertyTester
  extends PropertyTester
{
  private static final String PROPERTY_CAN_GET_ATTACHMENT = "canGetAttachment";
  private static final String PROPERTY_CAN_GET_HISTORY = "canGetHistory";
  private static final String PROPERTY_CAN_POST_ATTACHMENT = "canPostAttachment";
  private static final String PROPERTY_CONNECTOR_KIND = "connectorKind";
  private static final String PROPERTY_HAS_ACTIVE_TIME = "hasActiveTime";
  private static final String PROPERTY_HAS_EDITS = "hasEdits";
  private static final String PROPERTY_HAS_LOCAL_CONTEXT = "hasLocalContext";
  private static final String PROPERTY_HAS_REPOSITORY_CONTEXT = "hasRepositoryContext";
  private static final String PROPERTY_IS_COMPLETED = "isCompleted";
  private static final String PROPERTY_IS_LOCAL = "isLocal";
  private static final String PROPERTY_LOCAL_COMPLETION_STATE = "hasLocalCompletionState";
  
  private boolean equals(boolean value, Object expectedValue)
  {
    return new Boolean(value).equals(expectedValue);
  }
  
  public boolean test(Object receiver, String property, Object[] args, Object expectedValue)
  {
    if ((receiver instanceof ITask))
    {
      ITask task = (ITask)receiver;
      if ("connectorKind".equals(property)) {
        return task.getConnectorKind().equals(expectedValue);
      }
      if ("canPostAttachment".equals(property)) {
        return equals(AttachmentUtil.canUploadAttachment(task), expectedValue);
      }
      if ("canGetAttachment".equals(property)) {
        return equals(AttachmentUtil.canDownloadAttachment(task), expectedValue);
      }
      if ("canGetHistory".equals(property)) {
        return TasksUiInternal.canGetTaskHistory(task);
      }
      if ("hasActiveTime".equals(property)) {
        return equals(TasksUiInternal.getActiveTime(task) > 0L, expectedValue);
      }
      if ("hasEdits".equals(property)) {
        return equals(ClearOutgoingAction.hasOutgoingChanges(task), expectedValue);
      }
      if ("hasLocalContext".equals(property)) {
        return equals(AttachmentUtil.hasLocalContext(task), expectedValue);
      }
      if ("hasRepositoryContext".equals(property)) {
        return equals(AttachmentUtil.hasContextAttachment(task), expectedValue);
      }
      if ("isCompleted".equals(property)) {
        return equals(task.isCompleted(), expectedValue);
      }
      if ("isLocal".equals(property)) {
        return ((task instanceof AbstractTask)) && (equals(((AbstractTask)task).isLocal(), expectedValue));
      }
      if ("hasLocalCompletionState".equals(property)) {
        return equals(TasksUiInternal.hasLocalCompletionState(task), expectedValue);
      }
    }
    return false;
  }
}

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

import org.eclipse.core.runtime.IProgressMonitor;

class TasksUiInternal$1$4
  implements Runnable
{
  TasksUiInternal$1$4(TasksUiInternal.1 param1, int paramInt) {}
  
  public void run()
  {
    this$1.getWrappedProgressMonitor().worked(val$work);
  }
}

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

import java.util.Iterator;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;

@Deprecated
public class ClipboardCopier
{
  private static ClipboardCopier instance = new ClipboardCopier();
  private Clipboard clipboard;
  
  public static ClipboardCopier getDefault()
  {
    return instance;
  }
  
  public static String LINE_SEPARATOR = System.getProperty("line.separator", "\n");
  
  public void copy(IStructuredSelection selection, TextProvider provider)
  {
    if (!selection.isEmpty())
    {
      StringBuilder sb = new StringBuilder();
      for (Iterator<?> it = selection.iterator(); it.hasNext();)
      {
        Object item = it.next();
        String textForElement = provider.getTextForElement(item);
        if (textForElement != null)
        {
          if (sb.length() > 0)
          {
            sb.append(LINE_SEPARATOR);
            sb.append(LINE_SEPARATOR);
          }
          sb.append(textForElement);
        }
      }
      copy(sb.toString());
    }
  }
  
  public void copy(String text)
  {
    Assert.isNotNull(text);
    if (text.length() == 0) {
      return;
    }
    if (clipboard == null)
    {
      Display display = PlatformUI.getWorkbench().getDisplay();
      clipboard = new Clipboard(display);
    }
    TextTransfer textTransfer = TextTransfer.getInstance();
    clipboard.setContents(new Object[] { text }, new Transfer[] { textTransfer });
  }
  
  public void dispose()
  {
    if (clipboard != null)
    {
      clipboard.dispose();
      clipboard = null;
    }
  }
  
  public static abstract interface TextProvider
  {
    public abstract String getTextForElement(Object paramObject);
  }
}

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

import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.mylyn.internal.tasks.ui.actions.SaveAttachmentsAction;
import org.eclipse.mylyn.tasks.core.ITaskAttachment;
import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;

public class TasksUiMenus
{
  public static void fillTaskAttachmentMenu(IMenuManager manager)
  {
    Action saveAction = new SaveAttachmentsAction(Messages.TasksUiMenus_Save_);
    
    Action copyURLToClipAction = new Action(Messages.TasksUiMenus_Copy_URL)
    {
      public void run()
      {
        ITaskAttachment attachment = AttachmentUtil.getSelectedAttachment();
        if (attachment != null)
        {
          Clipboard clip = new Clipboard(PlatformUI.getWorkbench().getDisplay());
          clip.setContents(new Object[] { attachment.getUrl() }, 
            new Transfer[] { TextTransfer.getInstance() });
          clip.dispose();
        }
      }
      
      public boolean isEnabled()
      {
        ITaskAttachment attachment = AttachmentUtil.getSelectedAttachment();
        if (attachment != null) {
          return attachment.getUrl() != null;
        }
        return super.isEnabled();
      }
    };
    Action copyToClipAction = new Action(Messages.TasksUiMenus_Copy_Contents)
    {
      public void run()
      {
        ITaskAttachment attachment = AttachmentUtil.getSelectedAttachment();
        if (attachment != null)
        {
          CopyAttachmentToClipboardJob job = new CopyAttachmentToClipboardJob(attachment);
          job.setUser(true);
          job.schedule();
        }
      }
    };
    manager.add(new Separator("group.open"));
    manager.add(new Separator("group.save"));
    manager.add(saveAction);
    manager.add(copyURLToClipAction);
    manager.add(copyToClipAction);
    manager.add(new Separator("additions"));
  }
}

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

public enum SortCriterion$SortKey
{
  NONE,  DATE_CREATED,  PRIORITY,  RANK,  SUMMARY,  TASK_ID,  TASK_TYPE,  DUE_DATE,  MODIFICATION_DATE;
  
  public static SortKey valueOfLabel(String label)
  {
    SortKey[] arrayOfSortKey;
    int j = (arrayOfSortKey = values()).length;
    for (int i = 0; i < j; i++)
    {
      SortKey value = arrayOfSortKey[i];
      if (value.getLabel().equals(label)) {
        return value;
      }
    }
    return null;
  }
  
  public String getLabel()
  {
    switch (this)
    {
    case DATE_CREATED: 
      return Messages.SortKindEntry_None;
    case MODIFICATION_DATE: 
      return Messages.SortKindEntry_Priority;
    case PRIORITY: 
      return Messages.SortKindEntry_Summary;
    case NONE: 
      return Messages.SortKindEntry_Rank;
    case DUE_DATE: 
      return Messages.SortKindEntry_Date_Created;
    case RANK: 
      return Messages.SortKindEntry_Task_ID;
    case SUMMARY: 
      return Messages.SortCriterion_Type;
    case TASK_ID: 
      return Messages.SortKindEntry_Due_Date;
    case TASK_TYPE: 
      return Messages.SortCriterion_Modification_Date;
    }
    return null;
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