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

.mylyn.internal.tasks.core.TaskActivityUtil;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;

public class TasksReminderDialog
  extends Dialog
{
  private List<AbstractTask> tasks = null;
  private Table table = null;
  private TableViewer tableViewer = null;
  private final String[] columnNames = { Messages.TasksReminderDialog_Description, 
    Messages.TasksReminderDialog_Priority, Messages.TasksReminderDialog_Reminder_Day };
  private static final int DISMISS_ALL_ID = 200;
  private static final int DISMISS_ID = 201;
  private static final int SNOOZE_ID = 202;
  private static long DAY = 86400000L;
  
  public TasksReminderDialog(Shell parentShell, List<AbstractTask> remTasks)
  {
    super(parentShell);
    tasks = remTasks;
    setShellStyle(2272);
  }
  
  protected void configureShell(Shell shell)
  {
    super.configureShell(shell);
    shell.setText(Messages.TasksReminderDialog_Reminders);
  }
  
  protected Control createDialogArea(Composite parent)
  {
    Composite composite = (Composite)super.createDialogArea(parent);
    setBlockOnOpen(false);
    GridLayout gl = new GridLayout(1, false);
    composite.setLayout(gl);
    GridData data = new GridData(1808);
    composite.setLayoutData(data);
    
    Composite container = new Composite(composite, 0);
    gl = new GridLayout(1, false);
    container.setLayout(gl);
    createTable(container);
    createTableViewer();
    
    return composite;
  }
  
  protected void createButtonsForButtonBar(Composite parent)
  {
    createButton(parent, 200, Messages.TasksReminderDialog_Dismiss_All, false);
    createButton(parent, 201, Messages.TasksReminderDialog_Dismiss_Selected, false);
    createButton(parent, 202, Messages.TasksReminderDialog_Remind_tommorrow, true);
  }
  
  private void createTable(Composite parent)
  {
    int style = 68356;
    table = new Table(parent, style);
    GridLayout tlayout = new GridLayout();
    table.setLayout(tlayout);
    GridData wd = new GridData(1808);
    heightHint = 300;
    table.setLayoutData(wd);
    
    table.setLinesVisible(true);
    table.setHeaderVisible(true);
    
    TableColumn column = new TableColumn(table, 16384, 0);
    column.setText(columnNames[0]);
    column.setWidth(180);
    column.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        tableViewer.setSorter(new TasksReminderDialog.ReminderTaskSorter(1));
      }
    });
    column = new TableColumn(table, 16384, 1);
    column.setText(columnNames[1]);
    column.setWidth(50);
    column.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        tableViewer.setSorter(new TasksReminderDialog.ReminderTaskSorter(2));
      }
    });
    column = new TableColumn(table, 16384, 2);
    column.setText(columnNames[2]);
    column.setWidth(100);
    column.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        tableViewer.setSorter(new TasksReminderDialog.ReminderTaskSorter(3));
      }
    });
  }
  
  private void createTableViewer()
  {
    tableViewer = new TableViewer(table);
    tableViewer.setUseHashlookup(true);
    tableViewer.setContentProvider(new ReminderTasksContentProvider(null));
    tableViewer.setLabelProvider(new ReminderTasksLabelProvider(null));
    tableViewer.setInput(tasks);
  }
  
  protected void buttonPressed(int buttonId)
  {
    if (buttonId == 200)
    {
      for (ITask t : tasks) {
        ((AbstractTask)t).setReminded(true);
      }
      okPressed();
    }
    else if (buttonId == 201)
    {
      Object sel = ((IStructuredSelection)tableViewer.getSelection()).getFirstElement();
      if ((sel != null) && ((sel instanceof ITask)))
      {
        ITask t = (ITask)sel;
        ((AbstractTask)t).setReminded(true);
        tasks.remove(t);
        if (tasks.isEmpty()) {
          okPressed();
        } else {
          tableViewer.refresh();
        }
      }
    }
    else if (buttonId == 202)
    {
      Object sel = ((IStructuredSelection)tableViewer.getSelection()).getFirstElement();
      if ((sel != null) && ((sel instanceof ITask)))
      {
        ITask t = (ITask)sel;
        ((AbstractTask)t).setReminded(false);
        ((AbstractTask)t).setScheduledForDate(TaskActivityUtil.getDayOf(new Date(new Date().getTime() + DAY)));
        tasks.remove(t);
        if (tasks.isEmpty()) {
          okPressed();
        } else {
          tableViewer.refresh();
        }
      }
    }
    super.buttonPressed(buttonId);
  }
  
  private class ReminderTasksContentProvider
    implements IStructuredContentProvider
  {
    private ReminderTasksContentProvider() {}
    
    public Object[] getElements(Object inputElement)
    {
      return tasks.toArray();
    }
    
    public void dispose() {}
    
    public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
  }
  
  private static class ReminderTasksLabelProvider
    extends LabelProvider
    implements ITableLabelProvider
  {
    public Image getColumnImage(Object element, int columnIndex)
    {
      return null;
    }
    
    public String getColumnText(Object element, int columnIndex)
    {
      if ((element instanceof ITask))
      {
        AbstractTask task = (AbstractTask)element;
        switch (columnIndex)
        {
        case 0: 
          return task.getSummary();
        case 1: 
          return task.getPriority();
        case 2: 
          return DateFormat.getDateInstance(2).format(task.getScheduledForDate());
        }
      }
      return null;
    }
  }
  
  private static class ReminderTaskSorter
    extends ViewerSorter
  {
    public static final int DESCRIPTION = 1;
    public static final int PRIORITY = 2;
    public static final int DATE = 3;
    private final int criteria;
    
    public ReminderTaskSorter(int criteria)
    {
      this.criteria = criteria;
    }
    
    public int compare(Viewer viewer, Object obj1, Object obj2)
    {
      ITask t1 = (ITask)obj1;
      ITask t2 = (ITask)obj2;
      switch (criteria)
      {
      case 1: 
        return compareDescription(t1, t2);
      case 2: 
        return comparePriority(t1, t2);
      case 3: 
        return compareDate((AbstractTask)t1, (AbstractTask)t2);
      }
      return 0;
    }
    
    private int compareDescription(ITask task1, ITask task2)
    {
      return task1.getSummary().compareToIgnoreCase(task2.getSummary());
    }
    
    private int comparePriority(ITask task1, ITask task2)
    {
      return task1.getPriority().compareTo(task2.getPriority());
    }
    
    private int compareDate(AbstractTask task1, AbstractTask task2)
    {
      return task2.getScheduledForDate().compareTo(task1.getScheduledForDate());
    }
  }
}

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

import java.util.List;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.mylyn.tasks.core.IRepositoryElement;

public abstract interface IDynamicSubMenuContributor
{
  public abstract MenuManager getSubMenuManager(List<IRepositoryElement> paramList);
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.tasks.ui.IDynamicSubMenuContributor
 * 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.util.concurrent.atomic.AtomicReference;

class DownloadAndOpenTaskAttachmentJob$1
  implements Runnable
{
  DownloadAndOpenTaskAttachmentJob$1(DownloadAndOpenTaskAttachmentJob paramDownloadAndOpenTaskAttachmentJob, AtomicReference paramAtomicReference, File paramFile, String paramString) {}
  
  public void run()
  {
    val$status.set(this$0.openEditor(val$tmpFile, val$attachmentFilename));
  }
}

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

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

class TasksUiPreferencePage$3
  implements SelectionListener
{
  TasksUiPreferencePage$3(TasksUiPreferencePage paramTasksUiPreferencePage) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    this$0.updateRefreshGroupEnablements();
  }
  
  public void widgetDefaultSelected(SelectionEvent e) {}
}

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

import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;

class TasksUiPreferencePage$4
  implements ModifyListener
{
  TasksUiPreferencePage$4(TasksUiPreferencePage paramTasksUiPreferencePage) {}
  
  public void modifyText(ModifyEvent e)
  {
    this$0.updateRefreshGroupEnablements();
  }
}

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

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Text;

class TasksUiPreferencePage$5
  extends SelectionAdapter
{
  TasksUiPreferencePage$5(TasksUiPreferencePage paramTasksUiPreferencePage) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    DirectoryDialog dialog = new DirectoryDialog(this$0.getShell());
    dialog.setText(Messages.TasksUiPreferencePage_Folder_Selection);
    dialog.setMessage(Messages.TasksUiPreferencePage_Specify_the_folder_for_tasks);
    String dir = TasksUiPreferencePage.access$0(this$0).getText();
    dir = dir.replaceAll("\\\\", "/");
    dialog.setFilterPath(dir);
    
    dir = dialog.open();
    if ((dir == null) || (dir.equals(""))) {
      return;
    }
    dir = dir.replaceAll("\\\\", "/");
    TasksUiPreferencePage.access$0(this$0).setText(dir);
  }
}

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

import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;

public class MylynPreferencePage
  extends PreferencePage
  implements IWorkbenchPreferencePage
{
  public MylynPreferencePage()
  {
    super(Messages.MylynPreferencePage_Mylyn_Title);
    setDescription(Messages.MylynPreferencePage_General_settings_Description);
  }
  
  public void init(IWorkbench workbench) {}
  
  protected Control createContents(Composite parent)
  {
    Composite composite = new Composite(parent, 0);
    composite.setLayout(new FillLayout());
    
    return composite;
  }
}

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

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

class TasksUiPreferencePage$6
  extends SelectionAdapter
{
  TasksUiPreferencePage$6(TasksUiPreferencePage paramTasksUiPreferencePage) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    this$0.updateRefreshGroupEnablements();
  }
}

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

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

class TasksUiPreferencePage$7
  extends SelectionAdapter
{
  TasksUiPreferencePage$7(TasksUiPreferencePage paramTasksUiPreferencePage) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    this$0.updateRefreshGroupEnablements();
  }
}

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

import java.io.File;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.mylyn.commons.core.CommonMessages;
import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.commons.ui.compatibility.CommonColors;
import org.eclipse.mylyn.internal.monitor.ui.MonitorUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.actions.RestoreTaskListAction;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
import org.eclipse.mylyn.tasks.core.activity.AbstractTaskActivityMonitor;
import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
import org.eclipse.mylyn.tasks.ui.editors.TaskEditorInput;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Spinner;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.dialogs.PreferenceLinkArea;
import org.eclipse.ui.forms.events.ExpansionAdapter;
import org.eclipse.ui.forms.events.ExpansionEvent;
import org.eclipse.ui.forms.events.HyperlinkEvent;
import org.eclipse.ui.forms.events.IHyperlinkListener;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Hyperlink;
import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;

public class TasksUiPreferencePage
  extends PreferencePage
  implements IWorkbenchPreferencePage
{
  public static final String ID = "org.eclipse.mylyn.tasks.ui.preferences";
  private static final String FORWARDSLASH = "/";
  private static final String BACKSLASH_MULTI = "\\\\";
  private static final int MS_MINUTES = 60000;
  private Button useRichEditor;
  private Button editorHighlightsCurrentLine;
  private Button useWebBrowser;
  private Text synchScheduleTime = null;
  private Button enableBackgroundSynch;
  private Text taskDirectoryText = null;
  private Button browse = null;
  private Button notificationEnabledButton = null;
  private final FormToolkit toolkit;
  private Spinner timeoutMinutes;
  private Button timeoutEnabledButton;
  private ExpandableComposite advancedComposite;
  private Combo weekStartCombo;
  private Button activityTrackingEnabledButton;
  private Label timeoutLabel1;
  private Label timeoutLabel2;
  private Button taskListTooltipEnabledButton;
  private Button showTaskTrimButton;
  private Button taskListServiceMessageEnabledButton;
  
  public TasksUiPreferencePage()
  {
    setPreferenceStore(TasksUiPlugin.getDefault().getPreferenceStore());
    toolkit = new FormToolkit(Display.getCurrent());
  }
  
  protected Control createContents(Composite parent)
  {
    Composite container = new Composite(parent, 0);
    GridLayout layout = new GridLayout(1, false);
    container.setLayout(layout);
    
    createTaskRefreshScheduleGroup(container);
    createSchedulingGroup(container);
    createTaskNavigationGroup(container);
    createTaskListGroup(container);
    createTaskEditorGroup(container);
    Group taskActivityGroup = createTaskActivityGroup(container);
    if (!TasksUiPlugin.getTaskActivityMonitor().isEnabled())
    {
      taskActivityGroup.setVisible(false);
      getLayoutDataexclude = true;
    }
    Composite advanced = createAdvancedSection(container);
    createTaskDataControl(advanced);
    if ((getContainer() instanceof IWorkbenchPreferenceContainer))
    {
      String message = Messages.TasksUiPreferencePage_See_X_for_configuring_Task_List_colors;
      new PreferenceLinkArea(advanced, 0, "org.eclipse.ui.preferencePages.ColorsAndFonts", message, 
        (IWorkbenchPreferenceContainer)getContainer(), null);
    }
    createLinks(advanced);
    updateRefreshGroupEnablements();
    applyDialogFont(container);
    return container;
  }
  
  private void createLinks(Composite container)
  {
    Hyperlink link = new Hyperlink(container, 0);
    link.setForeground(CommonColors.HYPERLINK_WIDGET);
    link.setUnderlined(true);
    link.setText(Messages.TasksUiPreferencePage_Use_the_Restore_dialog_to_recover_missing_tasks);
    link.addHyperlinkListener(new IHyperlinkListener()
    {
      public void linkActivated(HyperlinkEvent e)
      {
        getShell().close();
        new RestoreTaskListAction().run();
      }
      
      public void linkEntered(HyperlinkEvent e) {}
      
      public void linkExited(HyperlinkEvent e) {}
    });
  }
  
  private Composite createAdvancedSection(Composite container)
  {
    advancedComposite = toolkit.createExpandableComposite(container, 290);
    
    advancedComposite.setFont(container.getFont());
    advancedComposite.setBackground(container.getBackground());
    advancedComposite.setText(Messages.TasksUiPreferencePage_Advanced);
    advancedComposite.setLayout(new GridLayout(1, false));
    advancedComposite.setLayoutData(new GridData(768));
    advancedComposite.addExpansionListener(new ExpansionAdapter()
    {
      public void expansionStateChanged(ExpansionEvent e)
      {
        getControl().getShell().pack();
      }
    });
    Composite advanced = new Composite(advancedComposite, 0);
    advanced.setLayout(new GridLayout(1, false));
    advancedComposite.setClient(advanced);
    return advanced;
  }
  
  public void init(IWorkbench workbench) {}
  
  public boolean performOk()
  {
    getPreferenceStore().setValue("org.eclipse.mylyn.tasks.ui.notifications.enabled", 
      notificationEnabledButton.getSelection());
    
    getPreferenceStore().setValue("org.eclipse.mylyn.tasks.ui.reporting.open.editor", useRichEditor.getSelection());
    getPreferenceStore().setValue("org.eclipse.mylyn.tasks.ui.editor.currentLineHighlight", 
      editorHighlightsCurrentLine.getSelection());
    getPreferenceStore().setValue("org.eclipse.mylyn.tasks.ui.repositories.synch.schedule", 
      enableBackgroundSynch.getSelection());
    long miliseconds = 60000L * Long.parseLong(synchScheduleTime.getText());
    getPreferenceStore().setValue("org.eclipse.mylyn.tasks.ui.repositories.synch.schedule.miliseconds", 
      miliseconds);
    
    getPreferenceStore().setValue("org.eclipse.mylyn.tasks.ui.task.list.tool.tip", 
      taskListTooltipEnabledButton.getSelection());
    getPreferenceStore().setValue("org.eclipse.mylyn.tasks.ui.messages.enabled", 
      taskListServiceMessageEnabledButton.getSelection());
    getPreferenceStore().setValue("org.eclipse.mylyn.tasks.ui.show.trim", showTaskTrimButton.getSelection());
    
    getPreferenceStore().setValue("org.eclipse.mylyn.tasks.ui.planning.week.start.day", getWeekStartValue());
    
    MonitorUiPlugin.getDefault()
      .getPreferenceStore()
      .setValue("org.eclipse.mylyn.monitor.ui.activity.timeout.enabled", timeoutEnabledButton.getSelection());
    MonitorUiPlugin.getDefault()
      .getPreferenceStore()
      .setValue("org.eclipse.mylyn.monitor.ui.activity.timeout", timeoutMinutes.getSelection() * 60000);
    
    MonitorUiPlugin.getDefault()
      .getPreferenceStore()
      .setValue("org.eclipse.mylyn.monitor.activity.tracking.enabled", activityTrackingEnabledButton.getSelection());
    
    String taskDirectory = taskDirectoryText.getText();
    taskDirectory = taskDirectory.replaceAll("\\\\", "/");
    if (!taskDirectory.equals(TasksUiPlugin.getDefault().getDataDirectory())) {
      if (checkForExistingTasklist(taskDirectory))
      {
        Exception exception = null;
        try
        {
          TasksUiPlugin.getDefault().setDataDirectory(taskDirectory);
        }
        catch (CoreException e)
        {
          exception = e;
          StatusHandler.log(e.getStatus());
          MessageDialog.openError(getShell(), Messages.TasksUiPreferencePage_Task_Data_Directory_Error, 
            Messages.TasksUiPreferencePage_Error_applying_Task_List_data_directory_changes);
        }
        catch (OperationCanceledException ce)
        {
          exception = ce;
        }
        if ((exception != null) && (!taskDirectoryText.isDisposed()))
        {
          String originalDirectory = TasksUiPlugin.getDefault().getDefaultDataDirectory();
          if (!taskDirectory.equals(originalDirectory)) {
            taskDirectoryText.setText(originalDirectory);
          }
        }
      }
      else
      {
        taskDirectoryText.setFocus();
        return false;
      }
    }
    return true;
  }
  
  private int getWeekStartValue()
  {
    return weekStartCombo.getSelectionIndex() + 1;
  }
  
  public boolean performCancel()
  {
    taskDirectoryText.setText(TasksUiPlugin.getDefault().getDefaultDataDirectory());
    notificationEnabledButton.setSelection(getPreferenceStore().getBoolean(
      "org.eclipse.mylyn.tasks.ui.notifications.enabled"));
    
    useRichEditor.setSelection(getPreferenceStore().getBoolean("org.eclipse.mylyn.tasks.ui.reporting.open.editor"));
    editorHighlightsCurrentLine.setSelection(getPreferenceStore().getBoolean(
      "org.eclipse.mylyn.tasks.ui.editor.currentLineHighlight"));
    
    enableBackgroundSynch.setSelection(getPreferenceStore().getBoolean(
      "org.eclipse.mylyn.tasks.ui.repositories.synch.schedule"));
    synchScheduleTime.setText(getMinutesString());
    
    taskListTooltipEnabledButton.setSelection(getPreferenceStore().getBoolean(
      "org.eclipse.mylyn.tasks.ui.task.list.tool.tip"));
    taskListServiceMessageEnabledButton.setSelection(getPreferenceStore().getBoolean(
      "org.eclipse.mylyn.tasks.ui.messages.enabled"));
    showTaskTrimButton.setSelection(getPreferenceStore().getBoolean("org.eclipse.mylyn.tasks.ui.show.trim"));
    
    weekStartCombo.select(getPreferenceStore().getInt("org.eclipse.mylyn.tasks.ui.planning.week.start.day") - 1);
    
    int minutes = MonitorUiPlugin.getDefault().getPreferenceStore().getInt("org.eclipse.mylyn.monitor.ui.activity.timeout") / 
      60000;
    timeoutMinutes.setSelection(minutes);
    timeoutEnabledButton.setSelection(MonitorUiPlugin.getDefault()
      .getPreferenceStore()
      .getBoolean("org.eclipse.mylyn.monitor.ui.activity.timeout.enabled"));
    
    activityTrackingEnabledButton.setSelection(MonitorUiPlugin.getDefault()
      .getPreferenceStore()
      .getBoolean("org.eclipse.mylyn.monitor.activity.tracking.enabled"));
    
    return true;
  }
  
  public void performDefaults()
  {
    super.performDefaults();
    taskDirectoryText.setText(TasksUiPlugin.getDefault().getDefaultDataDirectory());
    
    notificationEnabledButton.setSelection(getPreferenceStore().getDefaultBoolean(
      "org.eclipse.mylyn.tasks.ui.notifications.enabled"));
    
    useRichEditor.setSelection(getPreferenceStore().getDefaultBoolean("org.eclipse.mylyn.tasks.ui.reporting.open.editor"));
    editorHighlightsCurrentLine.setSelection(getPreferenceStore().getDefaultBoolean(
      "org.eclipse.mylyn.tasks.ui.editor.currentLineHighlight"));
    
    taskListTooltipEnabledButton.setSelection(getPreferenceStore().getDefaultBoolean(
      "org.eclipse.mylyn.tasks.ui.task.list.tool.tip"));
    taskListServiceMessageEnabledButton.setSelection(getPreferenceStore().getDefaultBoolean(
      "org.eclipse.mylyn.tasks.ui.messages.enabled"));
    showTaskTrimButton.setSelection(getPreferenceStore().getDefaultBoolean("org.eclipse.mylyn.tasks.ui.show.trim"));
    
    enableBackgroundSynch.setSelection(getPreferenceStore().getDefaultBoolean(
      "org.eclipse.mylyn.tasks.ui.repositories.synch.schedule"));
    
    long miliseconds = getPreferenceStore().getDefaultLong(
      "org.eclipse.mylyn.tasks.ui.repositories.synch.schedule.miliseconds");
    long minutes = miliseconds / 60000L;
    synchScheduleTime.setText(minutes);
    weekStartCombo.select(getPreferenceStore().getDefaultInt("org.eclipse.mylyn.tasks.ui.planning.week.start.day") - 1);
    
    int activityTimeoutMinutes = MonitorUiPlugin.getDefault()
      .getPreferenceStore()
      .getDefaultInt("org.eclipse.mylyn.monitor.ui.activity.timeout") / 
      60000;
    timeoutMinutes.setSelection(activityTimeoutMinutes);
    timeoutEnabledButton.setSelection(MonitorUiPlugin.getDefault()
      .getPreferenceStore()
      .getDefaultBoolean("org.eclipse.mylyn.monitor.ui.activity.timeout.enabled"));
    
    activityTrackingEnabledButton.setSelection(MonitorUiPlugin.getDefault()
      .getPreferenceStore()
      .getDefaultBoolean("org.eclipse.mylyn.monitor.activity.tracking.enabled"));
    
    updateRefreshGroupEnablements();
  }
  
  private void createTaskRefreshScheduleGroup(Composite parent)
  {
    Group group = new Group(parent, 16);
    group.setText(Messages.TasksUiPreferencePage_Synchronization);
    GridLayout gridLayout = new GridLayout(1, false);
    group.setLayout(gridLayout);
    
    group.setLayoutData(new GridData(768));
    Composite enableSynch = new Composite(group, 0);
    gridLayout = new GridLayout(4, false);
    marginWidth = 0;
    marginHeight = 0;
    enableSynch.setLayout(gridLayout);
    enableBackgroundSynch = new Button(enableSynch, 32);
    enableBackgroundSynch.setText(Messages.TasksUiPreferencePage_Synchronize_with_repositories_every);
    enableBackgroundSynch.setSelection(getPreferenceStore().getBoolean(
      "org.eclipse.mylyn.tasks.ui.repositories.synch.schedule"));
    enableBackgroundSynch.addSelectionListener(new SelectionListener()
    {
      public void widgetSelected(SelectionEvent e)
      {
        updateRefreshGroupEnablements();
      }
      
      public void widgetDefaultSelected(SelectionEvent e) {}
    });
    synchScheduleTime = new Text(enableSynch, 133120);
    GridData gridData = new GridData();
    widthHint = 25;
    synchScheduleTime.setLayoutData(gridData);
    synchScheduleTime.setText(getMinutesString());
    synchScheduleTime.addModifyListener(new ModifyListener()
    {
      public void modifyText(ModifyEvent e)
      {
        updateRefreshGroupEnablements();
      }
    });
    Label label = new Label(enableSynch, 0);
    label.setText(Messages.TasksUiPreferencePage_minutes);
    
    notificationEnabledButton = new Button(group, 32);
    notificationEnabledButton.setText(Messages.TasksUiPreferencePage_Display_notifications_for_overdue_tasks_and_incoming_changes);
    notificationEnabledButton.setSelection(getPreferenceStore().getBoolean(
      "org.eclipse.mylyn.tasks.ui.notifications.enabled"));
  }
  
  private void createTaskEditorGroup(Composite parent)
  {
    Group container = new Group(parent, 16);
    container.setLayout(new GridLayout(2, false));
    container.setLayoutData(new GridData(768));
    
    container.setText(Messages.TasksUiPreferencePage_Task_Editing);
    useRichEditor = new Button(container, 16);
    useRichEditor.setText(Messages.TasksUiPreferencePage_Rich_Editor__Recommended_);
    useRichEditor.setSelection(getPreferenceStore().getBoolean("org.eclipse.mylyn.tasks.ui.reporting.open.editor"));
    useWebBrowser = new Button(container, 16);
    useWebBrowser.setText(Messages.TasksUiPreferencePage_Web_Browser);
    useWebBrowser.setSelection(!getPreferenceStore().getBoolean("org.eclipse.mylyn.tasks.ui.reporting.open.editor"));
    
    editorHighlightsCurrentLine = new Button(container, 32);
    editorHighlightsCurrentLine.setText(Messages.TasksUiPreferencePage_highlight_current_line);
    editorHighlightsCurrentLine.setSelection(getPreferenceStore().getBoolean(
      "org.eclipse.mylyn.tasks.ui.editor.currentLineHighlight"));
  }
  
  private void createTaskDataControl(Composite parent)
  {
    Group taskDataGroup = new Group(parent, 16);
    taskDataGroup.setText(Messages.TasksUiPreferencePage_Task_Data);
    taskDataGroup.setLayout(new GridLayout(1, false));
    taskDataGroup.setLayoutData(new GridData(768));
    
    Composite dataDirComposite = new Composite(taskDataGroup, 0);
    GridLayout gridLayout = new GridLayout(3, false);
    marginWidth = 0;
    marginHeight = 0;
    dataDirComposite.setLayout(gridLayout);
    dataDirComposite.setLayoutData(new GridData(768));
    
    Label label = new Label(dataDirComposite, 0);
    label.setText(Messages.TasksUiPreferencePage_Data_directory_);
    
    String taskDirectory = TasksUiPlugin.getDefault().getDataDirectory();
    taskDirectory = taskDirectory.replaceAll("\\\\", "/");
    taskDirectoryText = new Text(dataDirComposite, 2048);
    taskDirectoryText.setText(taskDirectory);
    taskDirectoryText.setLayoutData(new GridData(768));
    
    browse = new Button(dataDirComposite, 131072);
    browse.setText(Messages.TasksUiPreferencePage_Browse_);
    browse.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        DirectoryDialog dialog = new DirectoryDialog(getShell());
        dialog.setText(Messages.TasksUiPreferencePage_Folder_Selection);
        dialog.setMessage(Messages.TasksUiPreferencePage_Specify_the_folder_for_tasks);
        String dir = taskDirectoryText.getText();
        dir = dir.replaceAll("\\\\", "/");
        dialog.setFilterPath(dir);
        
        dir = dialog.open();
        if ((dir == null) || (dir.equals(""))) {
          return;
        }
        dir = dir.replaceAll("\\\\", "/");
        taskDirectoryText.setText(dir);
      }
    });
  }
  
  private void createSchedulingGroup(Composite container)
  {
    Group group = new Group(container, 16);
    group.setText(Messages.TasksUiPreferencePage_Scheduling);
    group.setLayout(new GridLayout(5, false));
    group.setLayoutData(new GridData(768));
    
    Label weekStartLabel = new Label(group, 0);
    weekStartLabel.setText(Messages.TasksUiPreferencePage_Week_Start);
    weekStartCombo = new Combo(group, 8);
    
    weekStartCombo.add(CommonMessages.Sunday);
    weekStartCombo.add(CommonMessages.Monday);
    weekStartCombo.add(CommonMessages.Tuesday);
    weekStartCombo.add(CommonMessages.Wednesday);
    weekStartCombo.add(CommonMessages.Thursday);
    weekStartCombo.add(CommonMessages.Friday);
    weekStartCombo.add(CommonMessages.Saturday);
    weekStartCombo.select(getPreferenceStore().getInt("org.eclipse.mylyn.tasks.ui.planning.week.start.day") - 1);
  }
  
  private void createTaskNavigationGroup(Composite parent)
  {
    Group group = new Group(parent, 0);
    group.setText(Messages.TasksUiPreferencePage_Task_Navigation_Group_Label);
    group.setLayoutData(new GridData(768));
    group.setLayout(new GridLayout());
    
    showTaskTrimButton = new Button(group, 32);
    showTaskTrimButton.setLayoutData(new GridData(16384, 16777216, true, false));
    showTaskTrimButton.setText(Messages.TasksUiPreferencePage_Show_active_task_trim_Button_Label);
    showTaskTrimButton.setSelection(getPreferenceStore().getBoolean("org.eclipse.mylyn.tasks.ui.show.trim"));
  }
  
  private void createTaskListGroup(Composite container)
  {
    Group group = new Group(container, 16);
    group.setText(Messages.TasksUiPreferencePage_Task_List_Group);
    group.setLayout(new GridLayout(1, false));
    group.setLayoutData(new GridData(768));
    
    taskListTooltipEnabledButton = new Button(group, 32);
    taskListTooltipEnabledButton.setText(Messages.TasksUiPreferencePage_Show_tooltip_on_hover_Label);
    taskListTooltipEnabledButton.setSelection(getPreferenceStore().getBoolean(
      "org.eclipse.mylyn.tasks.ui.task.list.tool.tip"));
    
    taskListServiceMessageEnabledButton = new Button(group, 32);
    taskListServiceMessageEnabledButton.setText("Display notification when new connectors are available");
    taskListServiceMessageEnabledButton.setSelection(getPreferenceStore().getBoolean(
      "org.eclipse.mylyn.tasks.ui.messages.enabled"));
  }
  
  private Group createTaskActivityGroup(Composite container)
  {
    Group group = new Group(container, 16);
    group.setText(Messages.TasksUiPreferencePage_Task_Timing);
    group.setLayout(new GridLayout(3, false));
    group.setLayoutData(new GridData(768));
    
    boolean activityTrackingEnabled = MonitorUiPlugin.getDefault()
      .getPreferenceStore()
      .getBoolean("org.eclipse.mylyn.monitor.activity.tracking.enabled");
    
    boolean timeoutEnabled = MonitorUiPlugin.getDefault()
      .getPreferenceStore()
      .getBoolean("org.eclipse.mylyn.monitor.ui.activity.timeout.enabled");
    
    activityTrackingEnabledButton = new Button(group, 32);
    activityTrackingEnabledButton.setText(Messages.TasksUiPreferencePage_Enable_Time_Tracking);
    activityTrackingEnabledButton.setSelection(activityTrackingEnabled);
    activityTrackingEnabledButton.setToolTipText(Messages.TasksUiPreferencePage_Track_Time_Spent);
    activityTrackingEnabledButton.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        updateRefreshGroupEnablements();
      }
    });
    GridDataFactory.swtDefaults().span(3, 1).applyTo(activityTrackingEnabledButton);
    
    timeoutEnabledButton = new Button(group, 32);
    timeoutEnabledButton.setText(Messages.TasksUiPreferencePage_Enable_inactivity_timeouts);
    timeoutEnabledButton.setSelection(timeoutEnabled);
    timeoutEnabledButton.setToolTipText(Messages.TasksUiPreferencePage_If_disabled);
    timeoutEnabledButton.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        updateRefreshGroupEnablements();
      }
    });
    GridDataFactory.swtDefaults().span(3, 1).applyTo(timeoutEnabledButton);
    
    timeoutLabel1 = new Label(group, 0);
    timeoutLabel1.setText(Messages.TasksUiPreferencePage_Stop_time_accumulation_after);
    timeoutMinutes = new Spinner(group, 2048);
    timeoutMinutes.setDigits(0);
    timeoutMinutes.setIncrement(5);
    timeoutMinutes.setMaximum(60);
    timeoutMinutes.setMinimum(1);
    long minutes = MonitorUiPlugin.getDefault()
      .getPreferenceStore()
      .getLong("org.eclipse.mylyn.monitor.ui.activity.timeout") / 
      60000L;
    timeoutMinutes.setSelection((int)minutes);
    timeoutMinutes.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        updateRefreshGroupEnablements();
      }
    });
    timeoutLabel2 = new Label(group, 0);
    timeoutLabel2.setText(Messages.TasksUiPreferencePage_minutes_of_inactivity);
    
    return group;
  }
  
  public void updateRefreshGroupEnablements()
  {
    String errorMessage = null;
    if (enableBackgroundSynch.getSelection()) {
      try
      {
        long number = Long.parseLong(synchScheduleTime.getText());
        if (number <= 0L) {
          errorMessage = Messages.TasksUiPreferencePage_Synchronize_schedule_time_must_be_GT_0;
        }
      }
      catch (NumberFormatException localNumberFormatException)
      {
        errorMessage = Messages.TasksUiPreferencePage_Synchronize_schedule_time_must_be_valid_integer;
      }
    }
    setErrorMessage(errorMessage);
    setValid(errorMessage == null);
    if (activityTrackingEnabledButton.getSelection())
    {
      timeoutEnabledButton.setEnabled(true);
      timeoutMinutes.setEnabled(timeoutEnabledButton.getSelection());
      timeoutLabel1.setEnabled(timeoutEnabledButton.getSelection());
      timeoutLabel2.setEnabled(timeoutEnabledButton.getSelection());
    }
    else
    {
      timeoutEnabledButton.setEnabled(false);
      timeoutMinutes.setEnabled(false);
      timeoutLabel1.setEnabled(false);
      timeoutLabel2.setEnabled(false);
    }
    synchScheduleTime.setEnabled(enableBackgroundSynch.getSelection());
  }
  
  private String getMinutesString()
  {
    long miliseconds = getPreferenceStore().getLong(
      "org.eclipse.mylyn.tasks.ui.repositories.synch.schedule.miliseconds");
    long minutes = miliseconds / 60000L;
    return minutes;
  }
  
  private boolean checkForExistingTasklist(String dir)
  {
    File newDataFolder = new File(dir);
    if ((!newDataFolder.exists()) && (!newDataFolder.mkdirs()))
    {
      MessageDialog.openWarning(getControl().getShell(), Messages.TasksUiPreferencePage_Change_data_directory, 
        Messages.TasksUiPreferencePage_Destination_folder_cannot_be_created);
      return false;
    }
    MessageDialog dialogConfirm = new MessageDialog(
      null, 
      Messages.TasksUiPreferencePage_Confirm_Task_List_data_directory_change, 
      null, 
      Messages.TasksUiPreferencePage_A_new_empty_Task_List_will_be_created_in_the_chosen_directory_if_one_does_not_already_exists, 
      4, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 
      1);
    int taskDataDirectoryAction = dialogConfirm.open();
    if (taskDataDirectoryAction != 0) {
      return false;
    }
    for (TaskEditor taskEditor : TasksUiInternal.getActiveRepositoryTaskEditors()) {
      TasksUiInternal.closeTaskEditorInAllPages(taskEditor.getTaskEditorInput().getTask(), true);
    }
    return true;
  }
  
  public void dispose()
  {
    if ((toolkit != null) && 
      (toolkit.getColors() != null)) {
      toolkit.dispose();
    }
    super.dispose();
  }
}

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

import org.eclipse.mylyn.internal.tasks.ui.actions.RestoreTaskListAction;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.forms.events.HyperlinkEvent;
import org.eclipse.ui.forms.events.IHyperlinkListener;

class TasksUiPreferencePage$1
  implements IHyperlinkListener
{
  TasksUiPreferencePage$1(TasksUiPreferencePage paramTasksUiPreferencePage) {}
  
  public void linkActivated(HyperlinkEvent e)
  {
    this$0.getShell().close();
    new RestoreTaskListAction().run();
  }
  
  public void linkEntered(HyperlinkEvent e) {}
  
  public void linkExited(HyperlinkEvent e) {}
}

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

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

class TasksUiPreferencePage$8
  exte
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