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

9.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.tasks.ui.workingsets;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
import org.eclipse.mylyn.tasks.core.IRepositoryElement;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IPersistableElement;

public class TaskWorkingSetAdapterFactory
  implements IAdapterFactory
{
  private static final String TASK_ELEMENT_FACTORY_ID = "org.eclipse.mylyn.tasks.ui.workingSets.elementFactory";
  private static final Class[] ADAPTER_TYPES = { IPersistableElement.class };
  
  public Class[] getAdapterList()
  {
    return ADAPTER_TYPES;
  }
  
  public Object getAdapter(final Object adaptableObject, Class adapterType)
  {
    if ((adapterType == IPersistableElement.class) && ((adaptableObject instanceof AbstractTaskContainer))) {
      new IPersistableElement()
      {
        public void saveState(IMemento memento)
        {
          IRepositoryElement container = (IRepositoryElement)adaptableObject;
          memento.putString("handle.task", container.getHandleIdentifier());
        }
        
        public String getFactoryId()
        {
          return "org.eclipse.mylyn.tasks.ui.workingSets.elementFactory";
        }
      };
    }
    if ((adapterType == IPersistableElement.class) && ((adaptableObject instanceof IProject))) {
      new IPersistableElement()
      {
        public void saveState(IMemento memento)
        {
          IProject project = (IProject)adaptableObject;
          memento.putString("handle.project", project.getName());
        }
        
        public String getFactoryId()
        {
          return "org.eclipse.mylyn.tasks.ui.workingSets.elementFactory";
        }
      };
    }
    return null;
  }
}

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

import org.eclipse.jface.viewers.CheckboxTreeViewer;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class TaskWorkingSetPage$4
  extends SelectionAdapter
{
  TaskWorkingSetPage$4(TaskWorkingSetPage paramTaskWorkingSetPage) {}
  
  public void widgetSelected(SelectionEvent selectionEvent)
  {
    TaskWorkingSetPage.access$0(this$0).setCheckedElements(new Object[0]);
    this$0.validateInput();
  }
}

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

import java.util.Set;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.PlatformObject;
import org.eclipse.mylyn.tasks.core.TaskRepository;

class TaskWorkingSetPage$TaskRepositoryProjectMapping
  extends PlatformObject
{
  private final TaskRepository taskRepository;
  private final Set<IProject> projects;
  
  public TaskWorkingSetPage$TaskRepositoryProjectMapping(TaskRepository arg1, Set<IProject> taskRepository)
  {
    this.taskRepository = taskRepository;
    projects = mappedProjects;
  }
  
  public Set<IProject> getProjects()
  {
    return projects;
  }
  
  public TaskRepository getTaskRepository()
  {
    return taskRepository;
  }
}

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

import org.eclipse.jface.viewers.CheckboxTreeViewer;
import org.eclipse.ui.IWorkingSet;

class TaskWorkingSetPage$5
  implements Runnable
{
  TaskWorkingSetPage$5(TaskWorkingSetPage paramTaskWorkingSetPage) {}
  
  public void run()
  {
    Object[] items = null;
    if (TaskWorkingSetPage.access$2(this$0) != null)
    {
      items = TaskWorkingSetPage.access$2(this$0).getElements();
      if (items != null)
      {
        TaskWorkingSetPage.access$0(this$0).setCheckedElements(new Object[0]);
        Object[] arrayOfObject1;
        int j = (arrayOfObject1 = items).length;
        for (int i = 0; i < j; i++)
        {
          Object item = arrayOfObject1[i];
          if (item != null) {
            TaskWorkingSetPage.access$0(this$0).setChecked(item, true);
          }
        }
      }
    }
  }
}

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

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.mylyn.internal.tasks.core.AbstractTaskCategory;
import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
import org.eclipse.mylyn.internal.tasks.core.ITaskList;
import org.eclipse.mylyn.internal.tasks.core.TaskList;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
import org.eclipse.mylyn.tasks.core.TaskRepository;

final class TaskWorkingSetPage$WorkingSetPageContentProvider
  implements ITreeContentProvider
{
  private TaskWorkingSetPage.ElementCategory tasksContainer;
  private TaskWorkingSetPage.ElementCategory resourcesContainer;
  private final Map<IRepositoryQuery, TaskRepository> queryMap = new HashMap();
  private final Map<IProject, TaskWorkingSetPage.TaskRepositoryProjectMapping> projectMap = new HashMap();
  
  private TaskWorkingSetPage$WorkingSetPageContentProvider(TaskWorkingSetPage paramTaskWorkingSetPage) {}
  
  public Object[] getChildren(Object parentElement)
  {
    IProject[] projects;
    if ((parentElement instanceof List))
    {
      List<IAdaptable> taskRepositoriesContainers = new ArrayList();
      List<IAdaptable> resourcesRepositoriesContainers = new ArrayList();
      for (AbstractTaskContainer category : TasksUiInternal.getTaskList().getCategories()) {
        taskRepositoriesContainers.add(category);
      }
      projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
      Object unmappedProjects = new HashSet();
      for (Object container : (List)parentElement) {
        if ((container instanceof TaskRepository))
        {
          if (hasChildren(container)) {
            taskRepositoriesContainers.add((TaskRepository)container);
          }
          Set<IProject> mappedProjects = new HashSet();
          IProject[] arrayOfIProject1;
          int j = (arrayOfIProject1 = projects).length;
          for (int i = 0; i < j; i++)
          {
            IProject project = arrayOfIProject1[i];
            TaskRepository taskRepository = TasksUiPlugin.getDefault()
              .getRepositoryForResource(project);
            if (container.equals(taskRepository)) {
              mappedProjects.add(project);
            } else if (taskRepository == null) {
              ((Set)unmappedProjects).add(project);
            }
          }
          if (!mappedProjects.isEmpty())
          {
            TaskWorkingSetPage.TaskRepositoryProjectMapping projectMapping = new TaskWorkingSetPage.TaskRepositoryProjectMapping(this$0, 
              (TaskRepository)container, mappedProjects);
            resourcesRepositoriesContainers.add(projectMapping);
            for (IProject mappedProject : mappedProjects) {
              projectMap.put(mappedProject, projectMapping);
            }
          }
        }
      }
      resourcesRepositoriesContainers.addAll((Collection)unmappedProjects);
      tasksContainer = new TaskWorkingSetPage.ElementCategory(this$0, Messages.TaskWorkingSetPage_Tasks, taskRepositoriesContainers);
      resourcesContainer = new TaskWorkingSetPage.ElementCategory(this$0, Messages.TaskWorkingSetPage_Resources, 
        resourcesRepositoriesContainers);
      return new Object[] { tasksContainer, resourcesContainer };
    }
    if ((parentElement instanceof TaskRepository))
    {
      List<IAdaptable> taskContainers = new ArrayList();
      for (AbstractTaskContainer element : TasksUiPlugin.getTaskList().getRepositoryQueries(
        ((TaskRepository)parentElement).getRepositoryUrl())) {
        if ((element instanceof IRepositoryQuery))
        {
          taskContainers.add(element);
          queryMap.put((IRepositoryQuery)element, (TaskRepository)parentElement);
        }
      }
      return taskContainers.toArray();
    }
    if ((parentElement instanceof TaskWorkingSetPage.TaskRepositoryProjectMapping)) {
      return ((TaskWorkingSetPage.TaskRepositoryProjectMapping)parentElement).getProjects().toArray();
    }
    if ((parentElement instanceof TaskWorkingSetPage.ElementCategory)) {
      return ((TaskWorkingSetPage.ElementCategory)parentElement).getChildren(parentElement);
    }
    return new Object[0];
  }
  
  public boolean hasChildren(Object element)
  {
    return getChildren(element).length > 0;
  }
  
  public Object[] getElements(Object element)
  {
    return getChildren(element);
  }
  
  public Object getParent(Object element)
  {
    if (((element instanceof AbstractTaskCategory)) || ((element instanceof TaskRepository))) {
      return tasksContainer;
    }
    if ((element instanceof IRepositoryQuery)) {
      return queryMap.get(element);
    }
    if ((element instanceof TaskWorkingSetPage.TaskRepositoryProjectMapping)) {
      return resourcesContainer;
    }
    if ((element instanceof IProject))
    {
      Object repository = projectMap.get(element);
      if (repository != null) {
        return repository;
      }
      return resourcesContainer;
    }
    return null;
  }
  
  public void dispose() {}
  
  public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
}

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

import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.Status;
import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
import org.eclipse.mylyn.internal.tasks.core.TaskList;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.ui.IElementFactory;
import org.eclipse.ui.IMemento;

public class TaskWorkingSetElementFactory
  implements IElementFactory
{
  static final String HANDLE_TASK = "handle.task";
  static final String HANDLE_PROJECT = "handle.project";
  
  public IAdaptable createElement(IMemento memento)
  {
    String taskHandle = memento.getString("handle.task");
    if (taskHandle != null)
    {
      TaskList taskList = TasksUiPlugin.getTaskList();
      for (AbstractTaskContainer element : taskList.getRootElements()) {
        if (element.getHandleIdentifier().equals(taskHandle)) {
          return element;
        }
      }
    }
    String projectHandle = memento.getString("handle.project");
    if (projectHandle != null) {
      try
      {
        IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectHandle);
        if (project != null) {
          return project;
        }
      }
      catch (Throwable t)
      {
        StatusHandler.log(new Status(4, "org.eclipse.mylyn.tasks.ui", 
          "Could not not determine project for handle: " + projectHandle, t));
      }
    }
    if (taskHandle != null) {
      try
      {
        IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(taskHandle);
        if (project != null) {
          return project;
        }
      }
      catch (Throwable localThrowable1) {}
    }
    return null;
  }
}

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

import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTreeViewer;
import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
import org.eclipse.mylyn.tasks.core.TaskRepository;

class TaskWorkingSetPage$6
  implements Runnable
{
  TaskWorkingSetPage$6(TaskWorkingSetPage paramTaskWorkingSetPage, CheckStateChangedEvent paramCheckStateChangedEvent) {}
  
  public void run()
  {
    IAdaptable element = (IAdaptable)val$event.getElement();
    handleCheckStateChangeHelper(val$event, element);
    this$0.validateInput();
  }
  
  private void handleCheckStateChangeHelper(CheckStateChangedEvent event, IAdaptable element)
  {
    if (((element instanceof AbstractTaskContainer)) || ((element instanceof IProject)))
    {
      TaskWorkingSetPage.access$0(this$0).setGrayed(element, false);
    }
    else
    {
      Object[] arrayOfObject;
      int j;
      int i;
      if ((element instanceof TaskWorkingSetPage.ElementCategory))
      {
        j = (arrayOfObject = ((TaskWorkingSetPage.ElementCategory)element).getChildren(null)).length;
        for (i = 0; i < j; i++)
        {
          Object child = arrayOfObject[i];
          TaskWorkingSetPage.access$0(this$0).setChecked(child, event.getChecked());
          if ((child instanceof IAdaptable)) {
            handleCheckStateChangeHelper(event, (IAdaptable)child);
          }
        }
      }
      else if (((element instanceof TaskRepository)) || ((element instanceof TaskWorkingSetPage.TaskRepositoryProjectMapping)))
      {
        j = (arrayOfObject = TaskWorkingSetPage.access$1(this$0).getChildren(element)).length;
        for (i = 0; i < j; i++)
        {
          Object child = arrayOfObject[i];
          TaskWorkingSetPage.access$0(this$0).setChecked(child, event.getChecked());
        }
      }
    }
  }
}

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

import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.mylyn.tasks.core.TaskRepository;

class TaskWorkingSetPage$CustomSorter
  extends ViewerSorter
{
  TaskWorkingSetPage$CustomSorter(TaskWorkingSetPage paramTaskWorkingSetPage) {}
  
  public int compare(Viewer viewer, Object e1, Object e2)
  {
    if (((e1 instanceof TaskRepository)) || ((e1 instanceof TaskWorkingSetPage.TaskRepositoryProjectMapping))) {
      return -1;
    }
    if (((e2 instanceof TaskRepository)) || ((e2 instanceof TaskWorkingSetPage.TaskRepositoryProjectMapping))) {
      return 1;
    }
    if (((e1 instanceof TaskWorkingSetPage.ElementCategory)) && 
      (((TaskWorkingSetPage.ElementCategory)e1).getLabel(e1).equals(Messages.TaskWorkingSetPage_Tasks))) {
      return -1;
    }
    if (((e2 instanceof TaskWorkingSetPage.ElementCategory)) && 
      (((TaskWorkingSetPage.ElementCategory)e1).getLabel(e1).equals(Messages.TaskWorkingSetPage_Tasks))) {
      return 1;
    }
    return super.compare(viewer, e1, e2);
  }
}

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

import java.util.List;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.PlatformObject;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.internal.WorkbenchImages;
import org.eclipse.ui.model.IWorkbenchAdapter;

class TaskWorkingSetPage$ElementCategory
  extends PlatformObject
  implements IWorkbenchAdapter
{
  private final String label;
  private final List<IAdaptable> children;
  
  public TaskWorkingSetPage$ElementCategory(String arg1, List<IAdaptable> label)
  {
    this.label = label;
    this.children = children;
  }
  
  public Object[] getChildren(Object o)
  {
    return children.toArray();
  }
  
  public ImageDescriptor getImageDescriptor(Object object)
  {
    return WorkbenchImages.getImageDescriptor("IMG_OBJ_WORKING_SETS");
  }
  
  public String getLabel(Object o)
  {
    return label;
  }
  
  public Object getParent(Object o)
  {
    return null;
  }
}

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

import org.eclipse.osgi.util.NLS;

public class Messages
  extends NLS
{
  private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.tasks.ui.workingsets.messages";
  public static String TaskWorkingSetPage_The_name_must_not_be_empty;
  public static String TaskWorkingSetPage_The_name_must_not_have_a_leading_or_trailing_whitespace;
  public static String TaskWorkingSetPage_No_categories_queries_selected;
  public static String TaskWorkingSetPage_Resources;
  public static String TaskWorkingSetPage_Select_Working_Set_Elements;
  public static String TaskWorkingSetPage_Tasks;
  public static String TaskWorkingSetPage_Page_Description;
  public static String TaskWorkingSetPage_A_working_set_with_the_same_name_already_exists;
  public static String TaskWorkingSetPage_Select_All;
  public static String TaskWorkingSetPage_Deselect_All;
  
  static {}
  
  public static void reloadMessages()
  {
    NLS.initializeMessages("org.eclipse.mylyn.internal.tasks.ui.workingsets.messages", Messages.class);
  }
}

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

import org.eclipse.mylyn.tasks.core.ITaskAttachment;
import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
import org.eclipse.ui.IWorkbenchPage;

public class TaskAttachmentBrowserViewer
  implements ITaskAttachmentViewer
{
  public String getId()
  {
    return "inBrowserViewer";
  }
  
  public String getLabel()
  {
    return Messages.TaskAttachmentViewerBrowser_browser;
  }
  
  public void openAttachment(IWorkbenchPage page, ITaskAttachment attachment)
  {
    TasksUiUtil.openUrl(attachment.getUrl());
  }
}

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

import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import org.eclipse.mylyn.commons.notifications.ui.AbstractUiNotification;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.internal.tasks.core.TaskActivityManager;
import org.eclipse.mylyn.internal.tasks.core.TaskList;
import org.eclipse.mylyn.internal.tasks.ui.notifications.TaskListNotificationReminder;

class TasksUiPlugin$1
  implements ITaskListNotificationProvider
{
  public Set<AbstractUiNotification> getNotifications()
  {
    Collection<AbstractTask> allTasks = TasksUiPlugin.getTaskList().getAllTasks();
    Set<AbstractUiNotification> reminders = new HashSet();
    for (AbstractTask task : allTasks) {
      if ((TasksUiPlugin.getTaskActivityManager().isPastReminder(task)) && (!task.isReminded()))
      {
        reminders.add(new TaskListNotificationReminder(task));
        task.setReminded(true);
      }
    }
    return reminders;
  }
}

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

import java.util.Calendar;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.mylyn.commons.workbench.WorkbenchUtil;
import org.eclipse.mylyn.commons.workbench.forms.DatePicker;
import org.eclipse.mylyn.commons.workbench.forms.DateSelectionDialog;
import org.eclipse.mylyn.internal.tasks.core.DateRange;
import org.eclipse.mylyn.internal.tasks.core.TaskActivityUtil;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Shell;

class ScheduleTaskMenuContributor$3
  extends Action
{
  ScheduleTaskMenuContributor$3(ScheduleTaskMenuContributor paramScheduleTaskMenuContributor, MenuManager paramMenuManager) {}
  
  public void run()
  {
    Calendar theCalendar = TaskActivityUtil.getCalendar();
    if (this$0.getScheduledForDate(ScheduleTaskMenuContributor.access$0(this$0)) != null) {
      theCalendar.setTime(this$0.getScheduledForDate(ScheduleTaskMenuContributor.access$0(this$0)).getStartDate().getTime());
    }
    Shell shell = null;
    if ((val$subMenuManager != null) && (val$subMenuManager.getMenu() != null) && 
      (!val$subMenuManager.getMenu().isDisposed())) {
      shell = val$subMenuManager.getMenu().getShell();
    }
    if (shell == null) {
      shell = WorkbenchUtil.getShell();
    }
    DateSelectionDialog reminderDialog = new DateSelectionDialog(shell, theCalendar, 
      DatePicker.TITLE_DIALOG, false, TasksUiPlugin.getDefault()
      .getPreferenceStore()
      .getInt("org.eclipse.mylyn.tasks.ui.planning.end.hour"));
    int result = reminderDialog.open();
    if (result == 0)
    {
      DateRange range = null;
      if (reminderDialog.getDate() != null) {
        range = TaskActivityUtil.getDayOf(reminderDialog.getDate());
      }
      this$0.setScheduledDate(range);
    }
  }
}

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

import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.Status;
import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.internal.tasks.core.IRepositoryModelListener;

class TasksUiPlugin$8
  implements ISafeRunnable
{
  TasksUiPlugin$8(TasksUiPlugin paramTasksUiPlugin, IRepositoryModelListener paramIRepositoryModelListener) {}
  
  public void handleException(Throwable exception)
  {
    StatusHandler.log(new Status(2, "org.eclipse.mylyn.tasks.ui", "Listener failed: " + 
      val$listener.getClass(), exception));
  }
  
  public void run()
    throws Exception
  {
    val$listener.loaded();
  }
}

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

import com.ibm.icu.text.SimpleDateFormat;
import java.io.File;
import java.text.ParseException;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.Locale;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.mylyn.commons.net.Policy;
import org.eclipse.mylyn.internal.tasks.core.TaskActivityUtil;
import org.eclipse.mylyn.internal.tasks.core.TaskList;
import org.eclipse.mylyn.internal.tasks.ui.util.TaskDataExportOperation;
import org.eclipse.mylyn.internal.tasks.ui.util.TaskDataSnapshotOperation;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.progress.IProgressService;

public class TaskListBackupManager
  implements IPropertyChangeListener
{
  private static final String OLD_MYLYN_2_BACKUP_FILE_PREFIX = "mylyndata-";
  private static final String BACKUP_FILE_PREFIX = "mylyn-v3-data-";
  private static final Pattern MYLYN_BACKUP_REGEXP = Pattern.compile("^(mylyn-v3-data-)?(mylyndata-)?");
  private static final Pattern DATE_FORMAT_OLD = Pattern.compile("\\d{4}-\\d{2}-\\d{2}");
  private static final Pattern DATE_FORMAT = Pattern.compile("\\d{4}-\\d{2}-\\d{2}-\\d{6}");
  private static final long SECOND = 1000L;
  private static final long MINUTE = 60000L;
  private static final long STANDARD_DELAY = 1800000L;
  private String backupFolderPath;
  private Job runBackup;
  private static boolean errorDisplayed = false;
  
  public TaskListBackupManager(String backupFolderPath)
  {
    this.backupFolderPath = backupFolderPath;
    start(1800000L);
  }
  
  public void start(long delay)
  {
    if (runBackup != null) {
      stop();
    }
    runBackup = new Job("Task Data Snapshot")
    {
      protected IStatus run(IProgressMonitor monitor)
      {
        try
        {
          if (TasksUiPlugin.getTaskList().getAllTasks().size() > 0) {
            backupNow(false, monitor);
          }
          return Status.OK_STATUS;
        }
        finally
        {
          schedule(1800000L);
        }
      }
    };
    runBackup.setPriority(40);
    runBackup.setSystem(true);
    runBackup.schedule(delay);
  }
  
  public void stop()
  {
    if (runBackup != null)
    {
      if (!runBackup.cancel()) {
        try
        {
          runBackup.join();
        }
        catch (InterruptedException localInterruptedException) {}
      }
      runBackup = null;
    }
  }
  
  public static String getBackupFileName()
  {
    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd-HHmmss", Locale.ENGLISH);
    String date = format.format(new Date());
    String backupFileName = "mylyn-v3-data-" + date + ".zip";
    return backupFileName;
  }
  
  public void backupNow(boolean synchronous)
  {
    backupNow(synchronous, null);
  }
  
  public synchronized void backupNow(boolean synchronous, IProgressMonitor monitor)
  {
    monitor = Policy.monitorFor(monitor);
    
    File backupFolder = new File(backupFolderPath);
    if (!backupFolder.exists()) {
      backupFolder.mkdir();
    }
    TaskDataExportOperation backupJob = new TaskDataSnapshotOperation(backupFolderPath, getBackupFileName());
    try
    {
      if (!synchronous)
      {
        backupJob.run(monitor);
        removeOldBackups();
      }
      else
      {
        IProgressService service = PlatformUI.getWorkbench().getProgressService();
        service.run(false, true, backupJob);
      }
    }
    catch (InterruptedException localInterruptedException) {}catch (Throwable e)
    {
      if (!errorDisplayed)
      {
        final Status status = new Status(4, "org.eclipse.mylyn.tasks.ui", 
          Messages.TaskListBackupManager_Error_occured_during_scheduled_tasklist_backup, e);
        errorDisplayed = true;
        if (Display.getCurrent() != null) {
          TasksUiInternal.logAndDisplayStatus(Messages.TaskListBackupManager_Scheduled_task_data_backup, 
            status);
        } else {
          PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable()
          {
            public void run()
            {
              TasksUiInternal.logAndDisplayStatus(
                Messages.TaskListBackupManager_Scheduled_task_data_backup, status);
            }
          });
        }
      }
      if (backupJob.getDestinationFile() != null) {
        backupJob.getDestinationFile().delete();
      }
    }
  }
  
  public SortedMap<Long, File> getBackupFiles()
  {
    SortedMap<Long, File> filesMap = new TreeMap();
    String destination = backupFolderPath;
    
    File backupFolder = new File(destination);
    if (!backupFolder.exists()) {
      return filesMap;
    }
    File[] files = backupFolder.listFiles();
    if (files == null) {
      return filesMap;
    }
    File[] arrayOfFile1;
    int j = (arrayOfFile1 = files).length;
    for (int i = 0; i < j; i++)
    {
      File file = arrayOfFile1[i];
      Matcher matcher = MYLYN_BACKUP_REGEXP.matcher(file.getName());
      if (matcher.find())
      {
        Date date = null;
        try
        {
          SimpleDateFormat format = null;
          String dateText = null;
          Matcher dateFormatMatcher = DATE_FORMAT.matcher(file.getName());
          if (dateFormatMatcher.find())
          {
            format = new SimpleDateFormat("yyyy-MM-dd-HHmmss", Locale.ENGLISH);
            dateText = dateFormatMatcher.group();
          }
          else
          {
            dateFormatMatcher = DATE_FORMAT_OLD.matcher(file.getName());
            if (dateFormatMatcher.find())
            {
              format = new SimpleDateFormat("yyyy-MM-dd", 
                Locale.ENGLISH);
              dateText = dateFormatMatcher.group();
            }
          }
          if ((format == null) || (dateText == null) || (dateText.length() <= 0)) {
            continue;
          }
          date = format.parse(dateText);
        }
        catch (IndexOutOfBoundsException localIndexOutOfBoundsException)
        {
          continue;
        }
        catch (ParseException localParseException)
        {
          continue;
        }
        if ((date != null) && (date.getTime() > 0L)) {
          filesMap.put(new Long(date.getTime()), file);
        }
      }
    }
    return filesMap;
  }
  
  public synchronized void removeOldBackups()
  {
    SortedMap<Long, File> filesMap = getBackupFiles();
    if (filesMap.size() > 0)
    {
      Calendar rangeStart = TaskActivityUtil.getCalendar();
      rangeStart.setTimeInMillis(((Long)filesMap.lastKey()).longValue());
      TaskActivityUtil.snapStartOfHour(rangeStart);
      int startHour = rangeStart.get(11);
      Calendar rangeEnd = TaskActivityUtil.getCalendar();
      rangeEnd.setTimeInMillis(rangeStart.getTimeInMillis());
      rangeEnd.add(11, 1);
      for (int x = 0; (x <= startHour) && (x < 9); x++)
      {
        SortedMap<Long, File> subMap = filesMap.subMap(Long.valueOf(rangeStart.getTimeInMillis()), Long.valueOf(rangeEnd.getTimeInMillis()));
        if (subMap.size() > 1) {
          while (subMap.size() > 1)
          {
            File toDelete = (File)subMap.remove(subMap.firstKey());
            toDelete.delete();
          }
        }
        rangeStart.add(11, -1);
        rangeEnd.add(11, -1);
      }
      TaskActivityUtil.snapStartOfDay(rangeEnd);
      rangeStart.add(6, -1);
      for (int x = 1; x <= 12; x++)
      {
        SortedMap<Long, File> subMap = filesMap.subMap(Long.valueOf(rangeStart.getTimeInMillis()), Long.valueOf(rangeEnd.getTimeInMillis()));
        if (subMap.size() > 1) {
          while (subMap.size() > 1)
          {
            File toDelete = (File)subMap.remove(subMap.firstKey());
            toDelete.delete();
          }
        }
        rangeStart.add(6, -1);
        rangeEnd.add(6, -1);
      }
      SortedMap<Long, File> subMap = filesMap.subMap(Long.valueOf(0L), Long.valueOf(rangeStart.getTimeInMillis()));
      if (subMap.size() > 0) {
        while (subMap.size() > 0)
        {
          File toDelete = (File)subMap.remove(subMap.firstKey());
          toDelete.delete();
        }
      }
    }
  }
  
  public void propertyChange(PropertyChangeEvent event)
  {
    if (event.getProperty().equals("org.eclipse.mylyn.data.dir")) {
      backupFolderPath = TasksUiPlugin.getDefault().getBackupFolderPath();
    }
  }
}

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

import java.io.File;
import org.eclipse.core.resources.IStorage;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.PlatformObject;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IPathEditorInput;
import org.eclipse.ui.IPersistableElement;
import org.eclipse.ui.IStorageEditorInput;

class AttachmentFileEditorInput
  extends PlatformObject
  implements IPathEditorInput, IStorageEditorInput
{
  private final File file;
  private final String name;
  private final String tooltipText;
  
  AttachmentFileEditorInput(File file, String name, String tooltipText)
  {
    this.file = file;
    this.name = name;
    this.tooltipText = tooltipText;
  }
  
  public IPath getPath()
  {
    return Path.fromOSString(file.getAbsolutePath());
  }
  
  public boolean exists()
  {
    return file.exists();
  }
  
  public ImageDescriptor getImageDescriptor()
  {
    return null;
  }
  
  public String getName()
  {
    return name;
  }
  
  public IPersistableElement getPersistable()
  {
    return null;
  }
  
  public String getToolTipText()
  {
    return tooltipText;
  }
  
  public IStorage getStorage()
    throws CoreException
  {
    return new AttachmentFileStorage(file, name);
  }
  
  public int hashCode()
  {
    return file.hashCode() ^ name.hashCode();
  }
  
  public boolean equals(Object obj)
  {
    if (!(obj instanceof AttachmentFileEditorInput)) {
      return false;
    }
    AttachmentFileEditorInput other = (AttachmentFileEditorInput)obj;
    return (name.equals(name)) && (file.equals(file));
  }
}

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

import org.eclipse.jface.action.Action;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
import org.eclipse.mylyn.tasks.core.ITask;

class TaskHistoryDropDown$1
  extends Action
{
  TaskHistoryDropDown$1(TaskHistoryDropDown paramTaskHistoryDropDown, String $anonymous0, ITask paramITask)
  {
    super($anonymous0);
  }
  
  public void run()
  {
    TasksUiInternal.openTask(val$active, val$active.getTaskId());
  }
}

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

import java.io.File;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
import org.eclipse.mylyn.internal.tasks.core.TaskActivationHistory;
import org.eclipse.mylyn.internal.tasks.core.TaskList;
import org.eclipse.mylyn.internal.tasks.core.externalization.AbstractExternalizationParticipant;
import org.eclipse.mylyn.internal.tasks.core.externalization.ExternalizationManager;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.ITaskActivationListener;

public class TaskActivationExternalizationParticipant
  extends AbstractExternalizationParticipant
  implements ITaskActivationListener
{
  private final ExternalizationManager externalizationManager;
  private boolean dirty;
  private final TaskActivationHistory activationHistory;
  private final File file;
  private final TaskList taskList;
  
  public TaskActivationExternalizationParticipant(ExternalizationManager externalizationManager, TaskList taskList, TaskActivationHistory history, File file)
  {
    this.externalizationManager = externalizationManager;
    this.taskList = taskList;
    activationHistory = history;
    this.file = file;
  }
  
  public String getDescription()
  {
    return Messages.TaskActivationExternalizationParticipant_Task_Activation_History;
  }
  
  public ISchedulingRule getSchedulingRule()
  {
    return ITasksCoreConstants.ACTIVITY_SCHEDULING_RULE;
  }
  
  public boolean isDirty()
  {
    return dirty;
  }
  
  private void requestSave()
  {
    synchronized (this)
    {
      dirty = true;
    }
    externalizationManager.requestSave();
  }
  
  /* Error */
  public void load(File sourceFile, org.eclipse.core.runtime.IProgressMonitor monitor)
    throws CoreException
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 181	org/eclipse/mylyn/internal/tasks/ui/TaskActivationExternalizationParticipant:activationHistory	Lorg/eclipse/mylyn/internal/tasks/core/TaskActivationHistory;
    //   4: invokevirtual 195	org/eclipse/mylyn/internal/tasks/core/TaskActivationHistory:clear	()V
    //   7: aload_0
    //   8: getfield 180	org/eclipse/mylyn/internal/tasks/ui/TaskActivationExternalizationParticipant:file	Ljava/io/File;
    //   11: invokevirtual 184	java/io/File:exists	()Z
    //   14: ifeq +143 -> 157
    //   17: new 88	java/io/FileReader
    //   20: dup
    //   21: aload_0
    //   22: getfield 180	org/eclipse/mylyn/internal/tasks/ui/TaskActivationExternalizationParticipant:file	Ljava/io/File;
    //   25: invokespecial 189	java/io/FileReader:<init>	(Ljava/io/File;)V
    //   28: astore_3
    //   29: aload_3
    //   30: invokestatic 206	org/eclipse/ui/XMLMemento:createReadRoot	(Ljava/io/Reader;)Lorg/eclipse/ui/XMLMemento;
    //   33: astore 4
    //   35: aload 4
    //   37: ldc 5
    //   39: invokevirtual 205	org/eclipse/ui/XMLMemento:getChildren	(Ljava/lang/String;)[Lorg/eclipse/ui/IMemento;
    //   42: astore 5
    //   44: aload 5
    //   46: dup
    //   47: astore 9
    //   49: arraylength
    //   50: istore 8
    //   52: iconst_0
    //   53: istore 7
    //   55: goto +54 -> 109
    //   58: aload 9
    //   60: iload 7
    //   62: aaload
    //   63: astore 6
    //   65: aload 6
    //   67: ldc 3
    //   69: invokeinterface 211 2 0
    //   74: astore 10
    //   76: aload 10
    //   78: ifnull +28 -> 106
    //   81: aload_0
    //   82: getfield 182	org/eclipse/mylyn/internal/tasks/ui/TaskActivationExternalizationParticipant:taskList	Lorg/eclipse/mylyn/internal/tasks/core/TaskList;
    //   85: aload 10
    //   87: invokevirtual 199	org/eclipse/mylyn/internal/tasks/core/TaskList:getTask	(Ljava/lang/String;)Lorg/eclipse/mylyn/internal/tasks/core/AbstractTask;
    //   90: astore 11
    //   92: aload 11
    //   94: ifnull +12 -> 106
    //   97: aload_0
    //   98: getfield 181	org/eclipse/mylyn/internal/tasks/ui/TaskActivationExternalizationParticipant:activationHistory	Lorg/eclipse/mylyn/internal/tasks/core/TaskActivationHistory;
    //   101: aload 11
    //   103: invokevirtual 198	org/eclipse/mylyn/internal/tasks/core/TaskActivationHistory:addTaskInternal	(Lorg/eclipse/mylyn/internal/tasks/core/AbstractTask;)V
    //   106: iinc 7 1
    //   109: iload 7
    //   111: iload 8
    //   113: if_icmplt -55 -> 58
    //   116: goto +12 -> 128
    //   119: astore 12
    //   121: aload_3
    //   122: invokevirtual 188	java/io/FileReader:close	()V
    //   125: aload 12
    //   127: athrow
    //   128: aload_3
    //   129: invokevirtual 188	java/io/FileReader:close	()V
    //   132: goto +25 -> 157
    //   135: astore_3
    //   136: new 93	org/eclipse/core/runtime/CoreException
    //   139: dup
    //   140: new 94	org/eclipse/core/runtime/Status
    //   143: dup
    //   144: iconst_4
    //   145: ldc 4
    //   147: ldc 1
    //   149: aload_3
    //   150: invokespecial 193	org/eclipse/core/runtime/Status:<init>	(ILjava/lang/String;Ljava/lang/String;Ljava/lang/Throwab
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