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

sitoryCredentialsDialog_Save_Password;
  public static String TaskRepositoryCredentialsDialog_Saved_passwords_are_stored_that_is_difficult;
  public static String TaskRepositoryCredentialsDialog_Task_Repository;
  public static String TaskRepositoryCredentialsDialog_User_ID;
  public static String TaskRepositoryCredentialsDialog_Filename;
  public static String UiLegendControl_Active_task;
  public static String UiLegendControl_Adjust_Colors_and_Fonts_;
  public static String UiLegendControl_Also_see_the_Getting_Started_documentation_online;
  public static String UiLegendControl_Category;
  public static String UiLegendControl_Completed;
  public static String UiLegendControl_Completed_today;
  public static String UiLegendControl_Conflicting_changes;
  public static String UiLegendControl_Date_range;
  public static String UiLegendControl__default_;
  public static String UiLegendControl_Focus_view_on_active_task;
  public static String UiLegendControl_Has_due_date;
  public static String UiLegendControl_http_www_eclipse_org_mylyn_start;
  public static String UiLegendControl_Inactive_task_with_context;
  public static String UiLegendControl_Inactive_task_with_no_context;
  public static String UiLegendControl_Incoming_changes;
  public static String UiLegendControl_New_task;
  public static String UiLegendControl_Open_Task_List_;
  public static String UiLegendControl_Outgoing_changes;
  public static String UiLegendControl_Past_Due_date;
  public static String UiLegendControl_Past_scheduled_date;
  public static String UiLegendControl_Priorities;
  public static String UiLegendControl_Query;
  public static String UiLegendControl_Scheduled_for_today;
  public static String UiLegendControl_Synchronization;
  public static String UiLegendControl_Synchronization_failed;
  public static String UiLegendControl_Task;
  public static String UiLegendControl_Task_Activity;
  public static String UiLegendControl_Task_Context;
  public static String UiLegendControl_Tasks;
  public static String UiLegendControl_Tasks_UI_Legend;
  public static String UiLegendControl_Unsubmitted_outgoing_changes;
  public static String UiLegendDialog_Close_Dialog;
  
  static {}
  
  public static void reloadMessages()
  {
    NLS.initializeMessages("org.eclipse.mylyn.internal.tasks.ui.dialogs.messages", Messages.class);
  }
}

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

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class AbstractWorkingSetDialogCOPY$4
  extends SelectionAdapter
{
  AbstractWorkingSetDialogCOPY$4(AbstractWorkingSetDialogCOPY paramAbstractWorkingSetDialogCOPY) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    this$0.selectAllSets();
  }
}

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

import org.eclipse.jface.preference.PreferenceDialog;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.PreferencesUtil;
import org.eclipse.ui.forms.events.HyperlinkEvent;
import org.eclipse.ui.forms.events.IHyperlinkListener;

class UiLegendControl$3
  implements IHyperlinkListener
{
  UiLegendControl$3(UiLegendControl paramUiLegendControl) {}
  
  public void linkActivated(HyperlinkEvent e)
  {
    PreferenceDialog dlg = PreferencesUtil.createPreferenceDialogOn(PlatformUI.getWorkbench()
      .getActiveWorkbenchWindow()
      .getShell(), "org.eclipse.ui.preferencePages.ColorsAndFonts", 
      new String[] { "org.eclipse.ui.preferencePages.ColorsAndFonts" }, null);
    dlg.open();
  }
  
  public void linkEntered(HyperlinkEvent e) {}
  
  public void linkExited(HyperlinkEvent e) {}
}

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

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.mylyn.internal.tasks.ui.wizards.LocalRepositorySettingsPage;
import org.eclipse.mylyn.internal.tasks.ui.wizards.NewLocalTaskWizard;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.ITaskMapping;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
import org.eclipse.mylyn.tasks.ui.wizards.ITaskRepositoryPage;

public class LocalRepositoryConnectorUi
  extends AbstractRepositoryConnectorUi
{
  public ImageDescriptor getTaskKindOverlay(ITask task)
  {
    return super.getTaskKindOverlay(task);
  }
  
  public IWizard getNewTaskWizard(TaskRepository taskRepository, ITaskMapping selection)
  {
    return new NewLocalTaskWizard(selection);
  }
  
  public IWizard getQueryWizard(TaskRepository repository, IRepositoryQuery queryToEdit)
  {
    return null;
  }
  
  public String getConnectorKind()
  {
    return "local";
  }
  
  public ITaskRepositoryPage getSettingsPage(TaskRepository taskRepository)
  {
    return new LocalRepositorySettingsPage(taskRepository);
  }
  
  public boolean hasSearchPage()
  {
    return false;
  }
}

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

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.mylyn.commons.core.CoreUtil;
import org.eclipse.mylyn.commons.net.AuthenticationCredentials;
import org.eclipse.mylyn.commons.net.AuthenticationType;
import org.eclipse.mylyn.commons.net.Policy;
import org.eclipse.mylyn.commons.net.UnsupportedRequestException;
import org.eclipse.mylyn.commons.workbench.WorkbenchUtil;
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryDelta;
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryDelta.Type;
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryLocation;
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryManager;
import org.eclipse.mylyn.internal.tasks.ui.dialogs.TaskRepositoryCredentialsDialog;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;

public class TaskRepositoryLocationUi
  extends TaskRepositoryLocation
{
  private static Object lock = new Object();
  
  public TaskRepositoryLocationUi(TaskRepository taskRepository)
  {
    super(taskRepository);
  }
  
  public void requestCredentials(AuthenticationType authType, String message, IProgressMonitor monitor)
    throws UnsupportedRequestException
  {
    if (CoreUtil.TEST_MODE) {
      throw new UnsupportedRequestException();
    }
    AuthenticationCredentials oldCredentials = taskRepository.getCredentials(authType);
    synchronized (lock)
    {
      if (!areEqual(oldCredentials, taskRepository.getCredentials(authType))) {
        return;
      }
      if (Policy.isBackgroundMonitor(monitor)) {
        throw new UnsupportedRequestException();
      }
      PasswordRunner runner = new PasswordRunner(authType, message);
      if (!PlatformUI.getWorkbench().getDisplay().isDisposed())
      {
        PlatformUI.getWorkbench().getDisplay().syncExec(runner);
        if (runner.isCanceled()) {
          throw new OperationCanceledException();
        }
        if (!runner.isChanged()) {
          throw new UnsupportedRequestException();
        }
      }
      else
      {
        throw new UnsupportedRequestException();
      }
    }
  }
  
  private boolean areEqual(AuthenticationCredentials oldCredentials, AuthenticationCredentials credentials)
  {
    if (oldCredentials == null) {
      return credentials == null;
    }
    return oldCredentials.equals(credentials);
  }
  
  private class PasswordRunner
    implements Runnable
  {
    private final AuthenticationType authType;
    private boolean changed;
    private final String message;
    private boolean canceled;
    
    public PasswordRunner(AuthenticationType credentialType, String message)
    {
      authType = credentialType;
      this.message = message;
    }
    
    public boolean isChanged()
    {
      return changed;
    }
    
    public boolean isCanceled()
    {
      return canceled;
    }
    
    public void run()
    {
      Shell shell = WorkbenchUtil.getShell();
      if ((shell != null) && (!shell.isDisposed()))
      {
        TaskRepositoryCredentialsDialog dialog = TaskRepositoryCredentialsDialog.createDialog(shell);
        initializeDialog(dialog);
        int resultCode = dialog.open();
        if (resultCode == 0)
        {
          apply(dialog);
          changed = true;
        }
        else if (resultCode == 1000)
        {
          changed = true;
        }
        else
        {
          canceled = true;
        }
      }
    }
    
    private void initializeDialog(TaskRepositoryCredentialsDialog dialog)
    {
      dialog.setTaskRepository(taskRepository);
      dialog.setFileDialog(AuthenticationType.CERTIFICATE.equals(authType));
      AuthenticationCredentials credentials = taskRepository.getCredentials(authType);
      if (credentials != null)
      {
        dialog.setUsername(credentials.getUserName());
        dialog.setPassword(credentials.getPassword());
      }
      if (message != null) {
        dialog.setMessage(message);
      } else {
        dialog.setMessage(getDefaultMessage());
      }
    }
    
    private String getDefaultMessage()
    {
      if (AuthenticationType.REPOSITORY.equals(authType)) {
        return Messages.TaskRepositoryLocationUi_Enter_repository_password;
      }
      if (AuthenticationType.CERTIFICATE.equals(authType)) {
        return Messages.TaskRepositoryLocationUi_Enter_CLIENTCERTIFICATE_password;
      }
      if (AuthenticationType.HTTP.equals(authType)) {
        return Messages.TaskRepositoryLocationUi_Enter_HTTP_password;
      }
      if (AuthenticationType.PROXY.equals(authType)) {
        return Messages.TaskRepositoryLocationUi_Enter_proxy_password;
      }
      return null;
    }
    
    private void apply(TaskRepositoryCredentialsDialog dialog)
    {
      AuthenticationCredentials credentials = new AuthenticationCredentials(dialog.getUserName(), 
        dialog.getPassword());
      taskRepository.setCredentials(authType, credentials, dialog.getSavePassword());
      TasksUiPlugin.getRepositoryManager().notifyRepositorySettingsChanged(taskRepository, 
        new TaskRepositoryDelta(TaskRepositoryDelta.Type.CREDENTIALS, authType));
    }
  }
}

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

import java.util.Set;
import org.eclipse.mylyn.internal.tasks.core.ITaskListChangeListener;
import org.eclipse.mylyn.internal.tasks.core.TaskContainerDelta;
import org.eclipse.mylyn.internal.tasks.core.TaskContainerDelta.Kind;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.swt.widgets.Display;

class TaskTrimWidget$2
  implements ITaskListChangeListener
{
  TaskTrimWidget$2(TaskTrimWidget paramTaskTrimWidget) {}
  
  public void containersChanged(Set<TaskContainerDelta> containers)
  {
    if (TaskTrimWidget.access$1(this$0) != null) {
      for (TaskContainerDelta taskContainerDelta : containers) {
        if ((TaskTrimWidget.access$1(this$0).equals(taskContainerDelta.getElement())) && 
          (taskContainerDelta.getKind().equals(TaskContainerDelta.Kind.CONTENT)))
        {
          Display.getDefault().asyncExec(new Runnable()
          {
            public void run()
            {
              if ((TaskTrimWidget.access$1(this$0) != null) && (TaskTrimWidget.access$1(this$0).isActive())) {
                this$0.indicateActiveTask();
              }
            }
          });
          return;
        }
      }
    }
  }
}

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

import java.io.File;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.atomic.AtomicInteger;
import org.eclipse.core.internal.resources.Workspace;
import org.eclipse.core.net.proxy.IProxyChangeEvent;
import org.eclipse.core.net.proxy.IProxyChangeListener;
import org.eclipse.core.net.proxy.IProxyService;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ISaveContext;
import org.eclipse.core.resources.ISaveParticipant;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.util.SafeRunnable;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.commons.identity.core.IIdentityService;
import org.eclipse.mylyn.commons.net.WebUtil;
import org.eclipse.mylyn.commons.notifications.core.NotificationEnvironment;
import org.eclipse.mylyn.commons.notifications.feed.ServiceMessageManager;
import org.eclipse.mylyn.commons.notifications.ui.AbstractUiNotification;
import org.eclipse.mylyn.commons.workbench.TaskBarManager;
import org.eclipse.mylyn.internal.discovery.ui.AbstractInstallJob;
import org.eclipse.mylyn.internal.discovery.ui.DiscoveryUi;
import org.eclipse.mylyn.internal.monitor.ui.ActivityContextManager;
import org.eclipse.mylyn.internal.monitor.ui.MonitorUiPlugin;
import org.eclipse.mylyn.internal.tasks.core.AbstractSearchHandler;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.internal.tasks.core.IRepositoryModelListener;
import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
import org.eclipse.mylyn.internal.tasks.core.LocalRepositoryConnector;
import org.eclipse.mylyn.internal.tasks.core.RepositoryExternalizationParticipant;
import org.eclipse.mylyn.internal.tasks.core.RepositoryModel;
import org.eclipse.mylyn.internal.tasks.core.RepositoryTemplateManager;
import org.eclipse.mylyn.internal.tasks.core.TaskActivationHistory;
import org.eclipse.mylyn.internal.tasks.core.TaskActivityManager;
import org.eclipse.mylyn.internal.tasks.core.TaskActivityUtil;
import org.eclipse.mylyn.internal.tasks.core.TaskList;
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryDelta;
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryDelta.Type;
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryManager;
import org.eclipse.mylyn.internal.tasks.core.data.SynchronizationManger;
import org.eclipse.mylyn.internal.tasks.core.data.TaskDataManager;
import org.eclipse.mylyn.internal.tasks.core.data.TaskDataStore;
import org.eclipse.mylyn.internal.tasks.core.externalization.ExternalizationManager;
import org.eclipse.mylyn.internal.tasks.core.externalization.IExternalizationParticipant;
import org.eclipse.mylyn.internal.tasks.core.externalization.TaskListExternalizationParticipant;
import org.eclipse.mylyn.internal.tasks.core.externalization.TaskListExternalizer;
import org.eclipse.mylyn.internal.tasks.ui.actions.ActivateTaskDialogAction;
import org.eclipse.mylyn.internal.tasks.ui.actions.NewTaskAction;
import org.eclipse.mylyn.internal.tasks.ui.notifications.TaskListNotificationReminder;
import org.eclipse.mylyn.internal.tasks.ui.notifications.TaskListNotifier;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiExtensionReader;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskRepositoriesView;
import org.eclipse.mylyn.tasks.core.AbstractDuplicateDetector;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
import org.eclipse.mylyn.tasks.core.ITaskContainer;
import org.eclipse.mylyn.tasks.core.RepositoryTemplate;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.core.activity.AbstractTaskActivityMonitor;
import org.eclipse.mylyn.tasks.core.context.AbstractTaskContextStore;
import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
import org.eclipse.mylyn.tasks.ui.AbstractTaskRepositoryLinkProvider;
import org.eclipse.mylyn.tasks.ui.TasksUiImages;
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPageFactory;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IStartup;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.forms.FormColors;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.ui.progress.IProgressService;
import org.eclipse.ui.progress.UIJob;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.util.tracker.ServiceTracker;

public class TasksUiPlugin
  extends AbstractUIPlugin
{
  private static final int DELAY_QUERY_REFRESH_ON_STARTUP = 20000;
  private static final int DEFAULT_LINK_PROVIDER_TIMEOUT = 5000;
  public static final String ID_PLUGIN = "org.eclipse.mylyn.tasks.ui";
  private static final String DIRECTORY_METADATA = ".metadata";
  private static final String NAME_DATA_DIR = ".mylyn";
  private static final char DEFAULT_PATH_SEPARATOR = '/';
  private static final int NOTIFICATION_DELAY = 5000;
  private static TasksUiPlugin INSTANCE;
  private static ExternalizationManager externalizationManager;
  private static TaskActivityManager taskActivityManager;
  private static TaskRepositoryManager repositoryManager;
  private static TaskListSynchronizationScheduler synchronizationScheduler;
  private static TaskDataManager taskDataManager;
  private static Map<String, AbstractRepositoryConnectorUi> repositoryConnectorUiMap = new HashMap();
  private TaskListNotificationManager taskListNotificationManager;
  private TaskListBackupManager taskListBackupManager;
  private RepositoryTemplateManager repositoryTemplateManager;
  private ServiceMessageManager serviceMessageManager;
  private final Set<AbstractTaskEditorPageFactory> taskEditorPageFactories = new HashSet();
  private final TreeSet<AbstractTaskRepositoryLinkProvider> repositoryLinkProviders = new TreeSet(
    new OrderComparator(null));
  private TaskListExternalizer taskListExternalizer;
  private final Map<String, Image> brandingIcons = new HashMap();
  private final Map<String, ImageDescriptor> overlayIcons = new HashMap();
  private final Set<AbstractDuplicateDetector> duplicateDetectors = new HashSet();
  private ISaveParticipant saveParticipant;
  private TaskJobFactory taskJobFactory;
  private FormColors formColors;
  private static AbstractTaskContextStore contextStore;
  private final List<AbstractSearchHandler> searchHandlers = new ArrayList();
  private static final boolean DEBUG_HTTPCLIENT = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.mylyn.tasks.ui/debug/httpclient"));
  
  private static final class OrderComparator
    implements Comparator<AbstractTaskRepositoryLinkProvider>
  {
    public int compare(AbstractTaskRepositoryLinkProvider p1, AbstractTaskRepositoryLinkProvider p2)
    {
      return p1.getOrder() - p2.getOrder();
    }
  }
  
  public static enum TaskListSaveMode
  {
    ONE_HOUR,  THREE_HOURS,  DAY;
    
    public String toString()
    {
      switch (this)
      {
      case DAY: 
        return "1 hour";
      case ONE_HOUR: 
        return "3 hours";
      case THREE_HOURS: 
        return "1 day";
      }
      return "3 hours";
    }
    
    public static TaskListSaveMode fromString(String string)
    {
      if (string == null) {
        return null;
      }
      if (string.equals("1 hour")) {
        return ONE_HOUR;
      }
      if (string.equals("3 hours")) {
        return THREE_HOURS;
      }
      if (string.equals("1 day")) {
        return DAY;
      }
      return null;
    }
    
    public static long fromStringToLong(String string)
    {
      long hour = 3600000L;
      switch (fromString(string))
      {
      case DAY: 
        return hour;
      case ONE_HOUR: 
        return hour * 3L;
      case THREE_HOURS: 
        return hour * 24L;
      }
      return hour * 3L;
    }
  }
  
  public static enum ReportOpenMode
  {
    EDITOR,  INTERNAL_BROWSER,  EXTERNAL_BROWSER;
  }
  
  private static ITaskListNotificationProvider REMINDER_NOTIFICATION_PROVIDER = new 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;
    }
  };
  private final IPropertyChangeListener PROPERTY_LISTENER = new IPropertyChangeListener()
  {
    public void propertyChange(PropertyChangeEvent event)
    {
      if ((event.getProperty().equals("org.eclipse.mylyn.tasks.ui.planning.end.hour")) || 
        (event.getProperty().equals("org.eclipse.mylyn.tasks.ui.planning.week.start.day"))) {
        TasksUiPlugin.this.updateTaskActivityManager();
      }
      if ((event.getProperty().equals("org.eclipse.mylyn.tasks.ui.repositories.synch.schedule")) || 
        (event.getProperty().equals("org.eclipse.mylyn.tasks.ui.repositories.synch.schedule.miliseconds"))) {
        TasksUiPlugin.this.updateSynchronizationScheduler(false);
      }
      if (event.getProperty().equals("org.eclipse.mylyn.tasks.ui.messages.enabled")) {
        if (getPreferenceStore().getBoolean("org.eclipse.mylyn.tasks.ui.messages.enabled")) {
          serviceMessageManager.start();
        } else {
          serviceMessageManager.stop();
        }
      }
    }
  };
  private AbstractTaskActivityMonitor taskActivityMonitor;
  private ServiceReference proxyServiceReference;
  private IProxyChangeListener proxyChangeListener;
  private static TaskListExternalizationParticipant taskListExternalizationParticipant;
  private final Set<IRepositoryModelListener> listeners = new HashSet();
  private File activationHistoryFile;
  private static TaskList taskList;
  private static RepositoryModel repositoryModel;
  private static TasksUiFactory uiFactory;
  @Deprecated
  public static String LABEL_VIEW_REPOSITORIES = Messages.TasksUiPlugin_Task_Repositories;
  private final AtomicInteger initializationCount = new AtomicInteger();
  private SynchronizationManger synchronizationManger;
  
  private class TasksUiInitializationJob
    extends UIJob
  {
    public TasksUiInitializationJob()
    {
      super();
      setSystem(true);
    }
    
    public IStatus runInUIThread(IProgressMonitor monitor)
    {
      monitor.beginTask("Initializing Task List", 5);
      try
      {
        TasksUiExtensionReader.initWorkbenchUiExtensions();
        
        TasksUiPlugin.externalizationManager.getLoadStatus();
        
        List<String> commandLineArgs = Arrays.asList(Platform.getCommandLineArgs());
        activateTask = !commandLineArgs.contains("-no-activate-task");
        if (activateTask) {
          try
          {
            Field field = Workspace.class.getDeclaredField("crashed");
            field.setAccessible(true);
            value = field.get(ResourcesPlugin.getWorkspace());
            if ((value instanceof Boolean)) {
              activateTask = !((Boolean)value).booleanValue();
            }
          }
          catch (Throwable t)
          {
            t.printStackTrace();
          }
        }
        for (Object value = TasksUiPlugin.taskList.getAllTasks().iterator(); ((Iterator)value).hasNext();)
        {
          AbstractTask task = (AbstractTask)((Iterator)value).next();
          if (task.isActive())
          {
            task.setActive(false);
            if (activateTask)
            {
              TasksUiPlugin.taskActivityManager.activateTask(task);
              activateTask = false;
            }
          }
        }
      }
      catch (Throwable t)
      {
        StatusHandler.log(new Status(4, "org.eclipse.mylyn.tasks.ui", 
          "Could not initialize task activity", t));
      }
      monitor.worked(1);
      
      initializeNotificationsAndSynchronization();
      
      TasksUiPlugin.this.addSystemTaskBarActions();
      try
      {
        getPreferenceStore().addPropertyChangeListener(PROPERTY_LISTENER);
        
        TaskRepositoriesView repositoriesView = TaskRepositoriesView.getFromActivePerspective();
        if (repositoriesView != null) {
          repositoriesView.getViewer().refresh();
        }
      }
      catch (Throwable t)
      {
        StatusHandler.log(new Status(4, "org.eclipse.mylyn.tasks.ui", 
          "Could not finish Tasks UI initialization", t));
      }
      finally
      {
        monitor.done();
      }
      return new Status(0, "org.eclipse.mylyn.tasks.ui", 0, "", null);
    }
  }
  
  public TasksUiPlugin()
  {
    INSTANCE = this;
  }
  
  private void addSystemTaskBarActions()
  {
    MenuManager taskBarMenuManager = TaskBarManager.getTaskBarMenuManager();
    if (taskBarMenuManager != null)
    {
      NewTaskAction newTaskAction = new NewTaskAction(Messages.TasksUiPlugin_New_Task, true);
      taskBarMenuManager.add(newTaskAction);
      
      Action activateTaskAction = new Action()
      {
        public void run()
        {
          ActivateTaskDialogAction activateTaskDialogAction = new ActivateTaskDialogAction();
          IWorkbenchWindow window = getWorkbench().getActiveWorkbenchWindow();
          if ((window == null) && (getWorkbench().getWorkbenchWindows().length > 0)) {
            window = getWorkbench().getWorkbenchWindows()[0];
          }
          activateTaskDialogAction.init(window);
          activateTaskDialogAction.run(null);
        }
      };
      activateTaskAction.setImageDescriptor(TasksUiImages.CONTEXT_ACTIVE_CENTERED);
      activateTaskAction.setText(Messages.TasksUiPlugin_Activate_Task);
      taskBarMenuManager.add(activateTaskAction);
      taskBarMenuManager.update(true);
    }
  }
  
  private void updateSynchronizationScheduler(boolean initial)
  {
    if (synchronizationScheduler == null) {
      return;
    }
    boolean enabled = getDefault()
      .getPreferenceStore()
      .getBoolean("org.eclipse.mylyn.tasks.ui.repositories.synch.schedule");
    if (enabled)
    {
      long interval = getDefault()
        .getPreferenceStore()
        .getLong("org.eclipse.mylyn.tasks.ui.repositories.synch.schedule.miliseconds");
      if (initial) {
        synchronizationScheduler.setInterval(20000L, interval);
      } else {
        synchronizationScheduler.setInterval(interval);
      }
    }
    else
    {
      synchronizationScheduler.setInterval(0L);
    }
  }
  
  public void start(BundleContext context)
    throws Exception
  {
    super.start(context);
    try
    {
      if (DEBUG_HTTPCLIENT) {
        initHttpLogging();
      }
      WebUtil.init();
      initializePreferences(getPreferenceStore());
      
      File dataDir = new File(getDataDirectory());
      dataDir.mkdirs();
      
      externalizationManager = new ExternalizationManager(getDataDirectory());
      
      repositoryManager = new TaskRepositoryManager();
      IExternalizationParticipant repositoryParticipant = new RepositoryExternalizationParticipant(
        externalizationManager, repositoryManager);
      externalizationManager.addParticipant(repositoryParticipant);
      
      taskList = new TaskList();
      repositoryModel = new RepositoryModel(taskList, repositoryManager);
      taskListExternalizer = new TaskListExternalizer(repositoryModel, repositoryManager);
      
      taskListExternalizationParticipant = new TaskListExternalizationParticipant(repositoryModel, taskList, 
        taskListExternalizer, externalizationManager, repositoryManager);
      
      externalizationManager.addParticipant(taskListExternalizationParticipant);
      taskList.addChangeListener(taskListExternalizationParticipant);
      
      taskActivityManager = new TaskActivityManager(repositoryManager, taskList);
      
      taskActivityManager.addActivationListener(taskListExternalizationParticipant);
      
      updateTaskActivityManager();
      
      proxyServiceReference = context.getServiceReference(IProxyService.class.getName());
      if (proxyServiceReference != null)
      {
        IProxyService proxyService = (IProxyService)context.getService(proxyServiceReference);
        if (proxyService != null)
        {
          proxyChangeListener = new IProxyChangeListener()
          {
            public void proxyInfoChanged(IProxyChangeEvent event)
            {
              List<TaskRepository> repositories = TasksUiPlugin.repositoryManager.getAllRepositories();
              for (TaskRepository repository : repositories) {
                if (repository.isDefaultProxyEnabled()) {
                  TasksUiPlugin.repositoryManager.notifyRepositorySettingsChanged(repository, 
                    new TaskRepositoryDelta(TaskRepositoryDelta.Type.PROYX));
                }
              }
            }
          };
          proxyService.addProxyChangeListener(proxyChangeListener);
        }
      }
      repositoryTemplateManager = new RepositoryTemplateManager();
      
      TasksUiExtensionReader.initStartupExtensions(taskListExternalizer, repositoryManager);
      
      TaskDataStore taskDataStore = new TaskDataStore(repositoryManager);
      synchronizationManger = new SynchronizationManger(repositoryModel);
      taskDataManager = new TaskDataManager(taskDataStore, repositoryManager, taskList, taskActivityManager, 
        synchronizationManger);
      
      taskJobFactory = new TaskJobFactory(taskList, taskDataManager, repositoryManager, repositoryModel);
      
      taskActivityMonitor = TasksUiExtensionReader.loadTaskActivityMonitor();
      taskActivityMonitor.start(taskActivityManager);
      
      saveParticipant = new ISaveParticipant()
      {
        public void doneSaving(ISaveContext context) {}
        
        public void prepareToSave(ISaveContext context)
          throws CoreException
        {}
        
        public void rollback(ISaveContext context) {}
        
        public void saving(ISaveContext context)
          throws CoreException
        {
          if (context.getKind() == 1) {
            TasksUiPlugin.externalizationManager.stop();
          }
        }
      };
      ResourcesPlugin.getWorkspace().addSaveParticipant(this, saveParticipant);
      
      IPath stateLocation = Platform.getStateLocation(getBundle());
      activationHistoryFile = stateLocation.append("TaskActivationHistory.xml").toFile();
      TaskActivationExternalizationParticipant taskActivationExternalizationParticipant = new TaskActivationExternalizationParticipant(
        externalizationManager, taskList, taskActivityManager.getTaskActivationHistory(), 
        activationHistoryFile);
      taskActivityManager.addActivationListener(taskActivationExternalizationParticipant);
      externalizationManager.addParticipant(taskActivationExternalizationParticipant);
      
      initializeDataSources();
      
      taskListNotificationManager = new TaskListNotificationManager();
      
      String lastMod = getPreferenceStore().getString(
        "org.eclipse.mylyn.tasks.ui.servicemessage.lastmodified");
      String etag = getPreferenceStore().getString("org.eclipse.mylyn.tasks.ui.servicemessage.etag");
      String serviceMessageUrl = getPreferenceStore().getString("org.eclipse.mylyn.tasks.ui.servicemessage.url");
      
      Long checktime = Long.valueOf(getPreferenceStore().getLong("org.eclipse.mylyn.tasks.ui.servicemessage.checktime"));
      
      serviceMessageManager = new ServiceMessageManager(serviceMessageUrl, lastMod, etag, checktime.longValue(), 
        new NotificationEnvironment()
        {
          private Set<String> installedFeatures;
          
          public Set<String> getInstalledFeatures(IProgressMonitor monitor)
          {
            if (installedFeatures == null) {
              installedFeatures = DiscoveryUi.createInstallJob().getInstalledFeatures(monitor);
            }
            return installedFeatures;
          }
        });
      if (getPreferenceStore().getBoolean("org.eclipse.mylyn.tasks.ui.messages.enabled")) {
        serviceMessageManager.start();
      }
      new TasksUiInitializationJob().schedule();
    }
    catch (Exception e)
    {
      StatusHandler.log(new Status(4, "org.eclipse.mylyn.tasks.ui", "Task list initialization failed", e));
    }
  }
  
  private void initHttpLogging()
  {
    System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");
    System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true");
    System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire", "debug");
    System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire.header", "debug");
    System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient", "debug");
    System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient.HttpConnection", 
      "trace");
    System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.axis.message", "debug");
  }
  
  private void updateTaskActivityManager()
  {
    int endHour = getPreferenceStore().getInt("org.eclipse.mylyn.tasks.ui.planning.end.hour");
    
    TaskActivityUtil.setEndHour(endHour);
    
    int newWeekStartDay = getPreferenceStore().getInt("org.eclipse.mylyn.tasks.ui.planning.week.start.day");
    int oldWeekStartDay = taskActivityManager.getWeekStartDay();
    if (oldWeekStartDay != newWeekStartDay) {
      taskActivityManager.setWeekStartDay(newWeekStartDay);
    }
  }
  
  private void loadTemplateRepositories()
  {
    TaskRepository local = getLocalTaskRepository();
    repositoryManager.applyMigrators(local);
    Iterator localIterator2;
    for (Iterator localIterator1 = repositoryManager.getRepositoryConnectors().iterator(); localIterator1.hasNext(); localIterator2.hasNext())
    {
      AbstractRepositoryConnector connector = (AbstractRepositoryConnector)localIterator1.next();
      localIterator2 = repositoryTemplateManager.getTemplates(connector.getConnectorKind()).iterator(); continue;RepositoryTemplate template = (RepositoryTemplate)localIterator2.next();
      if ((addAutomatically) && (!TaskRepositoryUtil.isAddAutomaticallyDisabled(repositoryUrl))) {
        try
        {
          String repositoryUrl = TaskRepositoryManager.stripSlashes(repositoryUrl);
          TaskRepository taskRepository = repositoryManager.getRepository(connector.getConnectorKind(), 
            repositoryUrl);
          if (taskRepository == null)
          {
            taskRepository = new TaskRepository(connector.getConnectorKind(), repositoryUrl);
            taskRepository.setVersion(version);
            taskRepository.setRepositoryLabel(label);
            taskRepository.setCharacterEncoding(characterEncoding);
            if (anonymous) {
              taskRepository.setProperty(
                "org.eclipse.mylyn.tasklist.repositories.enabled", String.valueOf(false));
            }
            taskRepository.setCreatedFromTemplate(true);
            repositoryManager.addRepository(taskRepository);
            repositoryManager.applyMigrators(taskRepository);
          }
        }
        catch (Throwable t)
        {
          StatusHandler.log(new Status(4, "org.eclipse.mylyn.tasks.ui", NLS.bind(
            "Could not load repository template for repository {0}", repositoryUrl), t));
        }
      }
    }
  }
  
  public TaskRepository getLocalTaskRepository()
  {
    TaskRepository localRepository = repositoryManager.getRepository("local", 
      "local");
    if (localRepository == null)
    {
      localRepository = new TaskRepository("local", 
        "local");
      localRepository.setVersion("1");
      localRepository.setRepositoryLabel(LocalRepositoryConnector.REPOSITORY_LABEL);
      repositoryManager.addRepository(localRepository);
    }
    return localRepository;
  }
  
  /* Error */
  public void stop(BundleContext context)
    throws Exception
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 1214	org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin:formColors	Lorg/eclipse/ui/forms/FormColors;
    //   4: ifnull +15 -> 19
    //   7: aload_0
    //   8: getfield 1214	org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin:formColors	Lorg/eclipse/ui/forms/FormColors;
    //   11: invokevirtual 1394	org/eclipse/ui/forms/FormColors:dispose	()V
    //   14: aload_0
    //   15: aconst_null
    //   16: putfield 1214	org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin:formColors	Lorg/eclipse/ui/forms/FormColors;
    //   19: aload_0
    //   20: getfield 1212	org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin:taskActivityMonitor	Lorg/eclipse/mylyn/tasks/core/activity/AbstractTaskActivityMonitor;
    //   23: ifnull +10 -> 33
    //   26: aload_0
    //   27: getfield 1212	org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin:taskActivityMonitor	Lorg/eclipse/mylyn/tasks/core/activity/AbstractTaskActivityMonitor;
    //   30: invokevirtual 1385	org/eclipse/mylyn/tasks/core/activity/AbstractTaskActivityMonitor:stop	()V
    //   33: invokestatic 1262	org/eclipse/core/resources/ResourcesPlugin:getWorkspace	()Lorg/eclipse/core/resources/IWorkspace;
    //   36: ifnull +12 -> 48
    //   39: invokestatic 1262	org/eclipse/core/resources/ResourcesPlugin:getWorkspace	()Lorg/eclipse/core/resources/IWorkspace;
    //   42: aload_0
    //   43: invokeinterface 1423 2 0
    //   48: aload_0
    //   49: getfield 1215	org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin:proxyServiceReference	Lorg/osgi/framework/ServiceReference;
    //   52: ifnull +42 -> 94
    //   55: aload_1
    //   56: aload_0
    //   57: getfield 1215	org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin:p
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