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

n());
        }
      };
    }
    return super.getAdapter(adapter);
  }
}

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

import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.ITaskActivityManager;
import org.eclipse.mylyn.tasks.ui.TasksUi;

class TaskListView$19
  implements Runnable
{
  TaskListView$19(TaskListView paramTaskListView) {}
  
  public void run()
  {
    ITask task = TasksUi.getTaskActivityManager().getActiveTask();
    if (task != null) {
      this$0.getViewer().expandToLevel(task, 0);
    }
  }
}

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

import java.util.ArrayList;
import java.util.List;
import org.eclipse.jface.util.LocalSelectionTransfer;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerDropAdapter;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.internal.tasks.core.AbstractTaskCategory;
import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
import org.eclipse.mylyn.internal.tasks.core.DateRange;
import org.eclipse.mylyn.internal.tasks.core.ITaskList;
import org.eclipse.mylyn.internal.tasks.core.LocalTask;
import org.eclipse.mylyn.internal.tasks.core.ScheduledTaskContainer;
import org.eclipse.mylyn.internal.tasks.core.TaskActivityManager;
import org.eclipse.mylyn.internal.tasks.core.TaskCategory;
import org.eclipse.mylyn.internal.tasks.core.TaskList;
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryManager;
import org.eclipse.mylyn.internal.tasks.core.UncategorizedTaskContainer;
import org.eclipse.mylyn.internal.tasks.core.UnmatchedTaskContainer;
import org.eclipse.mylyn.internal.tasks.core.UnsubmittedTaskContainer;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.util.AbstractRetrieveTitleFromUrlJob;
import org.eclipse.mylyn.internal.tasks.ui.util.TaskDropHandler;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.ITaskContainer;
import org.eclipse.mylyn.tasks.ui.TaskDropListener.Operation;
import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
import org.eclipse.swt.dnd.FileTransfer;
import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.TransferData;
import org.eclipse.swt.dnd.URLTransfer;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;

public class TaskListDropAdapter
  extends ViewerDropAdapter
{
  private boolean fileTransfer;
  private boolean localTransfer;
  
  public TaskListDropAdapter(Viewer viewer)
  {
    super(viewer);
    setFeedbackEnabled(true);
  }
  
  public boolean performDrop(Object data)
  {
    List<ITask> tasksToMove = new ArrayList();
    final ITask newTask;
    if (localTransfer)
    {
      ISelection selection = LocalSelectionTransfer.getTransfer().getSelection();
      List<ITask> tasks = TasksUiInternal.getTasksFromSelection(selection);
      tasksToMove.addAll(tasks);
    }
    else if (!fileTransfer)
    {
      if ((data instanceof String))
      {
        String text = (String)data;
        AbstractTask task = createTaskFromUrl(text);
        if (task == null) {
          task = TasksUiInternal.createNewLocalTask(text);
        }
        if (task != null)
        {
          tasksToMove.add(task);
          newTask = task;
          PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable()
          {
            public void run()
            {
              TasksUiUtil.openTask(newTask);
            }
          });
        }
      }
    }
    Object currentTarget = getCurrentTarget();
    if (((currentTarget instanceof LocalTask)) && (areAllLocalTasks(tasksToMove)) && (getCurrentLocation() == 3))
    {
      for (ITask task : tasksToMove) {
        if (!((AbstractTask)task).contains(((LocalTask)currentTarget).getHandleIdentifier())) {
          TasksUiInternal.getTaskList().addTask(task, (LocalTask)currentTarget);
        }
      }
    }
    else if (((currentTarget instanceof ITask)) && (getCurrentLocation() == 3) && 
      (getCurrentOperation() != 2))
    {
      TasksUiInternal.getTaskDropHandler().loadTaskDropListeners();
      TaskDropListener.Operation operation = getCurrentOperation() == 1 ? TaskDropListener.Operation.COPY : TaskDropListener.Operation.LINK;
      TasksUiInternal.getTaskDropHandler().fireTaskDropped(tasksToMove, (ITask)currentTarget, operation);
    }
    else
    {
      for (ITask task : tasksToMove) {
        if ((currentTarget instanceof UncategorizedTaskContainer))
        {
          moveTask(task, (UncategorizedTaskContainer)currentTarget);
        }
        else if ((currentTarget instanceof TaskCategory))
        {
          moveTask(task, (TaskCategory)currentTarget);
        }
        else if ((currentTarget instanceof UnmatchedTaskContainer))
        {
          if (((UnmatchedTaskContainer)currentTarget).getRepositoryUrl().equals(task.getRepositoryUrl())) {
            moveTask(task, (AbstractTaskCategory)currentTarget);
          }
        }
        else if ((currentTarget instanceof ITask))
        {
          ITask targetTask = (ITask)currentTarget;
          TaskListView view = TaskListView.getFromActivePerspective();
          if (((getCurrentLocation() == 1) || (getCurrentLocation() == 2)) && 
            (view != null) && (view.isScheduledPresentation()))
          {
            if ((targetTask instanceof AbstractTask))
            {
              DateRange targetDate = ((AbstractTask)targetTask).getScheduledForDate();
              TasksUiPlugin.getTaskActivityManager().setScheduledFor((AbstractTask)task, targetDate);
            }
          }
          else
          {
            AbstractTaskCategory targetCategory = null;
            
            ITaskContainer container = TaskCategory.getParentTaskCategory(targetTask);
            if (((container instanceof TaskCategory)) || ((container instanceof UncategorizedTaskContainer))) {
              targetCategory = (AbstractTaskCategory)container;
            } else if (((container instanceof UnmatchedTaskContainer)) && 
              (((UnmatchedTaskContainer)container).getRepositoryUrl().equals(
              task.getRepositoryUrl()))) {
              targetCategory = (AbstractTaskCategory)container;
            }
            if (targetCategory != null) {
              moveTask(task, targetCategory);
            }
          }
        }
        else if ((currentTarget instanceof ScheduledTaskContainer))
        {
          ScheduledTaskContainer container = (ScheduledTaskContainer)currentTarget;
          if ((container instanceof TaskScheduleContentProvider.Unscheduled)) {
            TasksUiPlugin.getTaskActivityManager().setScheduledFor((AbstractTask)task, null);
          } else if (isValidTarget(container)) {
            TasksUiPlugin.getTaskActivityManager().setScheduledFor((AbstractTask)task, 
              container.getDateRange());
          }
        }
        else if (currentTarget == null)
        {
          moveTask(task, TasksUiPlugin.getTaskList().getDefaultCategory());
        }
      }
    }
    if (tasksToMove.size() == 1) {
      getViewer().setSelection(new StructuredSelection(tasksToMove.get(0)));
    }
    return true;
  }
  
  private boolean isValidTarget(ScheduledTaskContainer container)
  {
    return ((container instanceof TaskScheduleContentProvider.Unscheduled)) || (!(container instanceof TaskScheduleContentProvider.StateTaskContainer));
  }
  
  private void moveTask(ITask task, AbstractTaskContainer container)
  {
    if (!isUnsubmittedTask(task)) {
      TasksUiInternal.getTaskList().addTask(task, container);
    }
  }
  
  private boolean isUnsubmittedTask(ITask task)
  {
    if ((task instanceof AbstractTask)) {
      for (AbstractTaskContainer parent : ((AbstractTask)task).getParentContainers()) {
        if ((parent instanceof UnsubmittedTaskContainer)) {
          return true;
        }
      }
    }
    return false;
  }
  
  private boolean areAllLocalTasks(List<ITask> tasksToMove)
  {
    for (ITask task : tasksToMove) {
      if ((!(task instanceof LocalTask)) || (isUnsubmittedTask(task))) {
        return false;
      }
    }
    return true;
  }
  
  private AbstractTask createTaskFromUrl(String data)
  {
    if ((!data.startsWith("http://")) && (!data.startsWith("https://"))) {
      return null;
    }
    String[] urlTransfer = data.split("\n");
    if (urlTransfer.length > 0)
    {
      String url = urlTransfer[0];
      AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager()
        .getConnectorForRepositoryTaskUrl(url);
      if (connector != null)
      {
        String repositoryUrl = connector.getRepositoryUrlFromTaskUrl(url);
        String taskId = connector.getTaskIdFromTaskUrl(url);
        AbstractTask task = TasksUiInternal.getTask(repositoryUrl, taskId, url);
        if (task != null) {
          return task;
        }
        if ((repositoryUrl != null) && (taskId != null)) {
          TasksUiInternal.openRepositoryTask(connector.getConnectorKind(), repositoryUrl, taskId, null, 0L);
        }
      }
      else
      {
        final String summary = Messages.TaskListDropAdapter__retrieving_from_URL_;
        final LocalTask newTask = TasksUiInternal.createNewLocalTask(summary);
        newTask.setUrl(url);
        AbstractRetrieveTitleFromUrlJob job = new AbstractRetrieveTitleFromUrlJob(url)
        {
          protected void titleRetrieved(String pageTitle)
          {
            if (newTask.getSummary().equals(summary))
            {
              newTask.setSummary(pageTitle);
              TasksUiInternal.getTaskList().notifyElementChanged(newTask);
            }
          }
        };
        job.schedule();
        return newTask;
      }
    }
    return null;
  }
  
  public boolean validateDrop(Object targetObject, int operation, TransferData transferType)
  {
    fileTransfer = false;
    localTransfer = false;
    if (FileTransfer.getInstance().isSupportedType(transferType))
    {
      fileTransfer = true;
      
      return false;
    }
    if (LocalSelectionTransfer.getTransfer().isSupportedType(transferType))
    {
      localTransfer = true;
      Object target = getCurrentTarget();
      if (((target instanceof UncategorizedTaskContainer)) || ((target instanceof TaskCategory)) || 
        ((target instanceof UnmatchedTaskContainer)) || (
        ((target instanceof ScheduledTaskContainer)) && (isValidTarget((ScheduledTaskContainer)target)))) {
        return true;
      }
      if (((target instanceof ITaskContainer)) && (
        (getCurrentLocation() == 2) || (getCurrentLocation() == 1))) {
        return true;
      }
      if (((target instanceof LocalTask)) && (getCurrentLocation() == 3)) {
        return true;
      }
      if (((target instanceof ITask)) && (getCurrentLocation() == 3) && 
        (getCurrentOperation() != 2)) {
        return true;
      }
      return false;
    }
    if (URLTransfer.getInstance().isSupportedType(transferType)) {
      return true;
    }
    return TextTransfer.getInstance().isSupportedType(transferType);
  }
}

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

import org.eclipse.jface.resource.ColorRegistry;
import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.themes.ITheme;
import org.eclipse.ui.themes.IThemeManager;

public class WorkweekProgressBar
  extends Canvas
{
  private static final int DEFAULT_HEIGHT = 5;
  private int currentTickCount = 0;
  private int maxTickCount = 0;
  private int colorBarWidth = 0;
  private final Color completedColor;
  private final Composite parent;
  
  public WorkweekProgressBar(Composite parent)
  {
    super(parent, 0);
    this.parent = parent;
    
    parent.addControlListener(new ControlAdapter()
    {
      public void controlResized(ControlEvent e)
      {
        colorBarWidth = WorkweekProgressBar.this.scale(currentTickCount);
        redraw();
      }
    });
    addPaintListener(new PaintListener()
    {
      public void paintControl(PaintEvent e)
      {
        WorkweekProgressBar.this.paint(e);
      }
    });
    IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager();
    completedColor = themeManager.getCurrentTheme().getColorRegistry().get("org.eclipse.mylyn.tasks.ui.colors.foreground.today.completed");
  }
  
  public void setMaximum(int max)
  {
    maxTickCount = max;
  }
  
  public void reset()
  {
    currentTickCount = 0;
    maxTickCount = 0;
    colorBarWidth = 0;
    redraw();
  }
  
  public void reset(int ticksDone, int maximum)
  {
    currentTickCount = ticksDone;
    maxTickCount = maximum;
    colorBarWidth = scale(ticksDone);
    computeSize(-1, -1, true);
    redraw();
  }
  
  private void paintStep(int startX, int endX)
  {
    GC gc = new GC(this);
    setStatusColor(gc);
    Rectangle rect = getClientArea();
    startX = Math.max(1, startX);
    gc.fillRectangle(startX, 1, endX - startX, height - 2);
    gc.dispose();
  }
  
  private void setStatusColor(GC gc)
  {
    gc.setBackground(completedColor);
  }
  
  private int scale(int value)
  {
    if (maxTickCount > 0)
    {
      Rectangle r = parent.getClientArea();
      if (width != 0) {
        return Math.max(0, value * (width - 2) / maxTickCount);
      }
    }
    return value;
  }
  
  private void drawBevelRect(GC gc, int x, int y, int w, int h, Color topleft, Color bottomright)
  {
    gc.setForeground(topleft);
    gc.drawLine(x, y, x + w - 1, y);
    gc.drawLine(x, y, x, y + h - 1);
    
    gc.setForeground(bottomright);
    gc.drawLine(x + w, y, x + w, y + h);
    gc.drawLine(x, y + h, x + w, y + h);
  }
  
  private void paint(PaintEvent event)
  {
    GC gc = gc;
    Display disp = getDisplay();
    
    Rectangle rect = getClientArea();
    gc.fillRectangle(rect);
    drawBevelRect(gc, x, y, width - 1, height - 1, 
      disp.getSystemColor(18), 
      disp.getSystemColor(20));
    
    setStatusColor(gc);
    colorBarWidth = Math.min(width - 2, colorBarWidth);
    gc.fillRectangle(1, 1, colorBarWidth, height - 2);
  }
  
  public Point computeSize(int wHint, int hHint, boolean changed)
  {
    checkWidget();
    Point size = new Point(parent.getSize().x, 5);
    if (wHint != -1) {
      x = wHint;
    }
    if (hHint != -1) {
      y = hHint;
    }
    return size;
  }
  
  public void setCount(int count)
  {
    currentTickCount += 1;
    int x = colorBarWidth;
    
    colorBarWidth = scale(currentTickCount);
    if (currentTickCount == maxTickCount) {
      colorBarWidth = (getClientAreawidth - 1);
    }
    paintStep(x, colorBarWidth);
  }
  
  public void step(int failures)
  {
    currentTickCount += 1;
    int x = colorBarWidth;
    
    colorBarWidth = scale(currentTickCount);
    if (currentTickCount == maxTickCount) {
      colorBarWidth = (getClientAreawidth - 1);
    }
    paintStep(x, colorBarWidth);
  }
}

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

import org.eclipse.jface.action.Action;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;

class PriorityDropDownAction$1
  extends Action
{
  PriorityDropDownAction$1(PriorityDropDownAction paramPriorityDropDownAction, String $anonymous0, int $anonymous1)
  {
    super($anonymous0, $anonymous1);
  }
  
  public void run()
  {
    TasksUiPlugin.getDefault().getPreferenceStore().setValue("org.eclipse.mylyn.tasks.ui.filters.priority", ITask.PriorityLevel.P1.toString());
    PriorityDropDownAction.access$0(this$0).displayPrioritiesAbove(TaskListView.PRIORITY_LEVELS[0]);
  }
}

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

import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.mylyn.commons.ui.PlatformUiUtil;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.ISizeProvider;
import org.eclipse.ui.IViewSite;

class TaskListView$25
  implements ISizeProvider
{
  TaskListView$25(TaskListView paramTaskListView) {}
  
  public int getSizeFlags(boolean width)
  {
    if (width) {
      return 128;
    }
    return 0;
  }
  
  public int computePreferredSize(boolean width, int availableParallel, int availablePerpendicular, int preferredResult)
  {
    if ((width) && 
      ((this$0.getViewSite().getActionBars().getToolBarManager() instanceof ToolBarManager)))
    {
      Point size = ((ToolBarManager)this$0.getViewSite().getActionBars().getToolBarManager()).getControl()
        .computeSize(-1, -1);
      
      return x + PlatformUiUtil.getViewMenuWidth();
    }
    return preferredResult;
  }
}

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

import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.mylyn.commons.workbench.DelayedRefreshJob;

class TaskListView$6
  implements IPropertyChangeListener
{
  TaskListView$6(TaskListView paramTaskListView) {}
  
  public void propertyChange(PropertyChangeEvent event)
  {
    if ("org.eclipse.mylyn.tasks.ui.task.list.tool.tip".equals(event.getProperty())) {
      TaskListView.access$5(this$0);
    }
    if ((event.getProperty().equals("org.eclipse.mylyn.tasks.ui.strikethrough.for.completed")) || 
      (event.getProperty().equals("org.eclipse.mylyn.tasks.ui.overlays.incoming.tight"))) {
      TaskListView.access$1(this$0).refresh();
    }
    if ((event.getProperty().equals("org.eclipse.mylyn.tasks.ui.filters.hidden")) || 
      (event.getProperty().equals("org.eclipse.mylyn.tasks.ui.filters.nonmatching")) || 
      (event.getProperty().equals("org.eclipse.mylyn.tasks.ui.group.subtasks")))
    {
      TaskListView.access$6(this$0).updateSettings();
      this$0.refresh(true);
    }
  }
}

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

import org.eclipse.jface.action.MenuManager;
import org.eclipse.mylyn.internal.tasks.core.ITaskList;
import org.eclipse.mylyn.internal.tasks.ui.actions.RepositoryElementActionGroup;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
import org.eclipse.mylyn.tasks.core.ITaskActivityManager;
import org.eclipse.mylyn.tasks.ui.TasksUi;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkingSetManager;
import org.eclipse.ui.PlatformUI;

class TaskListFilteredTree$1
  implements DisposeListener
{
  TaskListFilteredTree$1(TaskListFilteredTree paramTaskListFilteredTree) {}
  
  public void widgetDisposed(DisposeEvent e)
  {
    if (TaskListFilteredTree.access$0(this$0) != null) {
      TasksUiInternal.getTaskList().removeChangeListener(TaskListFilteredTree.access$0(this$0));
    }
    if (TaskListFilteredTree.access$1(this$0) != null) {
      TasksUiInternal.getTaskList().removeChangeListener(TaskListFilteredTree.access$1(this$0));
    }
    if (TaskListFilteredTree.access$2(this$0) != null) {
      TasksUi.getTaskActivityManager().removeActivityListener(TaskListFilteredTree.access$2(this$0));
    }
    if (TaskListFilteredTree.access$3(this$0) != null) {
      PlatformUI.getWorkbench().getWorkingSetManager().removePropertyChangeListener(TaskListFilteredTree.access$3(this$0));
    }
    TaskListFilteredTree.access$4(this$0).setSelectionProvider(null);
    TaskListFilteredTree.access$5(this$0).dispose();
    TaskListFilteredTree.access$6(this$0).dispose();
  }
}

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

import java.text.MessageFormat;
import org.eclipse.ui.PlatformUI;

class TaskListFilteredTree$8
  implements Runnable
{
  TaskListFilteredTree$8(TaskListFilteredTree paramTaskListFilteredTree) {}
  
  public void run()
  {
    if ((PlatformUI.isWorkbenchRunning()) && (!TaskListFilteredTree.access$8(this$0).isDisposed()))
    {
      TaskListFilteredTree.access$8(this$0).reset(TaskListFilteredTree.access$9(this$0), TaskListFilteredTree.access$9(this$0) + TaskListFilteredTree.access$10(this$0));
      
      TaskListFilteredTree.access$8(this$0).setToolTipText(Messages.TaskListFilteredTree_Workweek_Progress + 
        "\n" + 
        MessageFormat.format(Messages.TaskListFilteredTree_Estimated_hours, new Object[] { Integer.valueOf(TaskListFilteredTree.access$9(this$0)), 
        Integer.valueOf(TaskListFilteredTree.access$9(this$0) + TaskListFilteredTree.access$10(this$0)) }) + 
        "\n" + 
        MessageFormat.format(Messages.TaskListFilteredTree_Scheduled_tasks, new Object[] { Integer.valueOf(TaskListFilteredTree.access$11(this$0)), 
        Integer.valueOf(TaskListFilteredTree.access$12(this$0)) }));
    }
  }
}

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

import org.eclipse.mylyn.commons.ui.CommonImages;
import org.eclipse.mylyn.internal.tasks.ui.TaskHistoryDropDown;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.ui.forms.events.HyperlinkEvent;
import org.eclipse.ui.forms.events.IHyperlinkListener;
import org.eclipse.ui.forms.widgets.ImageHyperlink;

class TaskListFilteredTree$12
  implements IHyperlinkListener
{
  private Menu dropDownMenu;
  
  TaskListFilteredTree$12(TaskListFilteredTree paramTaskListFilteredTree, ImageHyperlink paramImageHyperlink) {}
  
  public void linkActivated(HyperlinkEvent event)
  {
    if (dropDownMenu != null) {
      dropDownMenu.dispose();
    }
    TaskHistoryDropDown taskHistory = new TaskHistoryDropDown();
    taskHistory.setScopedToWorkingSet(true);
    dropDownMenu = new Menu(val$activeTaskButton);
    taskHistory.fill(dropDownMenu, 0);
    dropDownMenu.setVisible(true);
  }
  
  public void linkEntered(HyperlinkEvent event)
  {
    val$activeTaskButton.setImage(CommonImages.getImage(CommonImages.TOOLBAR_ARROW_DOWN));
  }
  
  public void linkExited(HyperlinkEvent event)
  {
    val$activeTaskButton.setImage(CommonImages.getImage(CommonImages.TOOLBAR_ARROW_RIGHT));
  }
}

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

import com.ibm.icu.text.DateFormat;
import com.ibm.icu.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.mylyn.commons.core.DateUtil;
import org.eclipse.mylyn.commons.ui.CommonImages;
import org.eclipse.mylyn.commons.ui.CommonUiUtil;
import org.eclipse.mylyn.commons.ui.GradientToolTip;
import org.eclipse.mylyn.commons.ui.PlatformUiUtil;
import org.eclipse.mylyn.commons.ui.compatibility.CommonFonts;
import org.eclipse.mylyn.commons.workbench.forms.ScalingHyperlink;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
import org.eclipse.mylyn.internal.tasks.core.DateRange;
import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
import org.eclipse.mylyn.internal.tasks.core.ScheduledTaskContainer;
import org.eclipse.mylyn.internal.tasks.core.TaskActivityManager;
import org.eclipse.mylyn.internal.tasks.core.TaskCategory;
import org.eclipse.mylyn.internal.tasks.core.UncategorizedTaskContainer;
import org.eclipse.mylyn.internal.tasks.core.UnmatchedTaskContainer;
import org.eclipse.mylyn.internal.tasks.core.data.TaskDataDiff;
import org.eclipse.mylyn.internal.tasks.ui.AbstractTaskListFilter;
import org.eclipse.mylyn.internal.tasks.ui.TaskScalingHyperlink;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.notifications.TaskDiffUtil;
import org.eclipse.mylyn.internal.tasks.ui.notifications.TaskListNotifier;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.IRepositoryElement;
import org.eclipse.mylyn.tasks.core.IRepositoryManager;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.ITask.SynchronizationState;
import org.eclipse.mylyn.tasks.core.ITaskContainer;
import org.eclipse.mylyn.tasks.core.RepositoryStatus;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
import org.eclipse.mylyn.tasks.ui.TaskElementLabelProvider;
import org.eclipse.mylyn.tasks.ui.TasksUi;
import org.eclipse.mylyn.tasks.ui.TasksUiImages;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
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.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Scrollable;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.swt.widgets.Widget;
import org.eclipse.ui.forms.FormColors;

public class TaskListToolTip
  extends GradientToolTip
{
  private static final int MAX_TEXT_WIDTH = 300;
  private static final int MAX_WIDTH = 600;
  private static final int X_SHIFT = PlatformUiUtil.getToolTipXShift();
  private static final int Y_SHIFT = 1;
  private IRepositoryElement currentTipElement;
  private final List<TaskListToolTipListener> listeners = new ArrayList();
  private boolean visible;
  private boolean triggeredByMouse = true;
  private final Control control;
  private final Color titleColor;
  private boolean enabled;
  
  public TaskListToolTip(Control control)
  {
    super(control);
    this.control = control;
    setEnabled(true);
    setShift(new Point(1, 1));
    titleColor = TasksUiPlugin.getDefault().getFormColors(control.getDisplay()).getColor("org.eclipse.ui.forms.TITLE");
  }
  
  public void dispose()
  {
    hide();
  }
  
  protected void afterHideToolTip(Event event)
  {
    triggeredByMouse = true;
    visible = false;
    TaskListToolTipListener[] arrayOfTaskListToolTipListener;
    int j = (arrayOfTaskListToolTipListener = (TaskListToolTipListener[])listeners.toArray(new TaskListToolTipListener[0])).length;
    for (int i = 0; i < j; i++)
    {
      TaskListToolTipListener listener = arrayOfTaskListToolTipListener[i];
      listener.toolTipHidden(event);
    }
  }
  
  public void addTaskListToolTipListener(TaskListToolTipListener listener)
  {
    listeners.add(listener);
  }
  
  public void removeTaskListToolTipListener(TaskListToolTipListener listener)
  {
    listeners.remove(listener);
  }
  
  private IRepositoryElement getTaskListElement(Object hoverObject)
  {
    if ((hoverObject instanceof ScalingHyperlink))
    {
      TaskScalingHyperlink hyperlink = (TaskScalingHyperlink)hoverObject;
      return hyperlink.getTask();
    }
    if ((hoverObject instanceof Widget))
    {
      Object data = ((Widget)hoverObject).getData();
      if (data != null)
      {
        if ((data instanceof ITaskContainer)) {
          return (IRepositoryElement)data;
        }
        if ((data instanceof IAdaptable)) {
          return (IRepositoryElement)((IAdaptable)data).getAdapter(AbstractTaskContainer.class);
        }
      }
    }
    return null;
  }
  
  private String getTitleText(IRepositoryElement element)
  {
    if ((element instanceof ScheduledTaskContainer))
    {
      StringBuilder sb = new StringBuilder();
      sb.append(((ScheduledTaskContainer)element).getShortSummary());
      if (!(element instanceof TaskScheduleContentProvider.StateTaskContainer))
      {
        Calendar start = ((ScheduledTaskContainer)element).getDateRange().getStartDate();
        sb.append(" - ");
        sb.append(DateFormat.getDateInstance(1).format(start.getTime()));
      }
      return sb.toString();
    }
    if ((element instanceof IRepositoryQuery))
    {
      IRepositoryQuery query = (IRepositoryQuery)element;
      StringBuilder sb = new StringBuilder();
      sb.append(element.getSummary());
      sb.append("  [");
      sb.append(getRepositoryLabel(query.getConnectorKind(), query.getRepositoryUrl()));
      sb.append("]");
      return sb.toString();
    }
    if ((element instanceof ITask)) {
      return ((ITask)element).getSummary();
    }
    return new TaskElementLabelProvider(false).getText(element);
  }
  
  private String getDetailsText(IRepositoryElement element)
  {
    if ((element instanceof ScheduledTaskContainer))
    {
      ScheduledTaskContainer container = (ScheduledTaskContainer)element;
      int estimateTotal = 0;
      long activeTotal = 0L;
      for (ITask child : container.getChildren()) {
        if ((child instanceof AbstractTask))
        {
          estimateTotal += ((AbstractTask)child).getEstimatedTimeHours();
          
          activeTotal = activeTotal + TasksUiPlugin.getTaskActivityManager().getElapsedTime(child, container.getDateRange());
        }
      }
      StringBuilder sb = new StringBuilder();
      appendEstimateAndActive(sb, estimateTotal, activeTotal);
      return sb.toString();
    }
    if ((element instanceof ITask))
    {
      ITask task = (ITask)element;
      StringBuilder sb = new StringBuilder();
      AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(task.getConnectorKind());
      String kindLabel = null;
      if (connectorUi != null)
      {
        kindLabel = connectorUi.getTaskKindLabel(task);
        sb.append(kindLabel);
      }
      String key = task.getTaskKey();
      if (key != null)
      {
        sb.append(" ");
        sb.append(key);
      }
      String taskKind = task.getTaskKind();
      if ((taskKind != null) && (taskKind.length() > 0) && (!taskKind.equals(kindLabel)))
      {
        sb.append(" (");
        sb.append(taskKind);
        sb.append(") ");
      }
      sb.append(", ");
      sb.append(task.getPriority());
      sb.append("  [");
      sb.append(getRepositoryLabel(task.getConnectorKind(), task.getRepositoryUrl()));
      sb.append("]");
      sb.append("\n");
      
      String owner = ((ITask)element).getOwner();
      if (owner != null)
      {
        sb.append(NLS.bind(Messages.TaskListToolTip_Assigned_to_X, owner));
        sb.append("\n");
      }
      String extendedToolTipInfo = task.getAttribute("task.common.extended.tooltip");
      if ((extendedToolTipInfo != null) && (extendedToolTipInfo.length() > 0))
      {
        sb.append(extendedToolTipInfo);
        sb.append("\n");
      }
      return sb.toString();
    }
    return null;
  }
  
  private void appendEstimateAndActive(StringBuilder sb, int estimateTotal, long activeTotal)
  {
    sb.append(NLS.bind(Messages.TaskListToolTip_Estimate, Integer.valueOf(estimateTotal)));
    sb.append("\n");
    if (TasksUiInternal.isActivityTrackingEnabled())
    {
      sb.append(NLS.bind(Messages.TaskListToolTip_Active_X, DateUtil.getFormattedDurationShort(activeTotal)));
      sb.append("\n");
    }
  }
  
  private String getRepositoryLabel(String repositoryKind, String repositoryUrl)
  {
    TaskRepository repository = TasksUi.getRepositoryManager().getRepository(repositoryKind, repositoryUrl);
    if (repository != null)
    {
      String label = repository.getRepositoryLabel();
      if (label.indexOf("//") != -1) {
        return label.substring(repository.getRepositoryUrl().indexOf("//") + 2);
      }
      return label;
    }
    return "";
  }
  
  private String getActivityText(IRepositoryElement element)
  {
    if ((element instanceof ITask))
    {
      AbstractTask task = (AbstractTask)element;
      
      StringBuilder sb = new StringBuilder();
      
      Date dueDate = task.getDueDate();
      if (dueDate != null)
      {
        sb.append(NLS.bind(Messages.TaskListToolTip_Due, 
          new Object[] {
          new SimpleDateFormat("E").format(dueDate), 
          DateFormat.getDateInstance(1).format(dueDate), 
          DateFormat.getTimeInstance(3).format(dueDate) }));
        sb.append("\n");
      }
      DateRange scheduledDate = task.getScheduledForDate();
      if (scheduledDate != null)
      {
        sb.append(NLS.bind(Messages.TaskListToolTip_Scheduled, scheduledDate.toString()));
        sb.append("\n");
      }
      long elapsed = TasksUiPlugin.getTaskActivityManager().getElapsedTime(task);
      appendEstimateAndActive(sb, task.getEstimatedTimeHours(), elapsed);
      return sb.toString();
    }
    return null;
  }
  
  private String getIncommingText(IRepositoryElement element)
  {
    if ((element instanceof ITask))
    {
      ITask task = (ITask)element;
      if (task.getSynchronizationState().isIncoming())
      {
        String text = null;
        TaskListNotifier notifier = new TaskListNotifier(TasksUiPlugin.getTaskDataManager(), 
          TasksUiPlugin.getDefault().getSynchronizationManger());
        TaskDataDiff diff = notifier.getDiff(task);
        if ((diff != null) && (diff.hasChanged())) {
          text = TaskDiffUtil.toString(diff, 300, true);
        }
        if ((text != null) && (text.length() > 0)) {
          return text;
        }
      }
    }
    return null;
  }
  
  private String getStatusText(IRepositoryElement element)
  {
    IStatus status = null;
    if ((element instanceof AbstractTask))
    {
      AbstractTask task = (AbstractTask)element;
      status = task.getStatus();
    }
    else if ((element instanceof IRepositoryQuery))
    {
      RepositoryQuery query = (RepositoryQuery)element;
      status = query.getStatus();
    }
    if (status != null)
    {
      StringBuilder sb = new StringBuilder();
      sb.append(status.getMessage());
      if (((status instanceof RepositoryStatus)) && (((RepositoryStatus)status).isHtmlMessage())) {
        sb.append(Messages.TaskListToolTip_Please_synchronize_manually_for_full_error_message);
      }
      return sb.toString();
    }
    return null;
  }
  
  public Point getLocation(Point tipSize, Event event)
  {
    Widget widget = getTipWidget(event);
    if (widget != null)
    {
      Rectangle bounds = getBounds(widget);
      if (bounds != null) {
        return control.toDisplay(x + X_SHIFT, y + height + 1);
      }
    }
    return super.getLocation(tipSize, event);
  }
  
  private ProgressData getProgressData(IRepositoryElement element)
  {
    if ((element instanceof ITaskContainer))
    {
      Object[] children = new Object[0];
      
      children = ((ITaskContainer)element).getChildren().toArray();
      
      int total = children.length;
      if (total > 0)
      {
        int completed = 0;
        for (ITask task : ((ITaskContainer)element).getChildren()) {
          if (task.isCompleted()) {
            completed++;
          }
        }
        String text = NLS.bind(Messages.TaskListToolTip_Total_Complete_Incomplete, new Object[] {
          Integer.valueOf(total), Integer.valueOf(completed), Integer.valueOf(total - completed) });
        return new ProgressData(completed, total, text);
      }
    }
    return null;
  }
  
  private Image getImage(IRepositoryElement element)
  {
    if ((element instanceof IRepositoryQuery))
    {
      IRepositoryQuery query = (IRepositoryQuery)element;
      AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
        query.getConnectorKind());
      if (connector != null) {
        return TasksUiPlugin.getDefault().getBrandingIcon(connector.getConnectorKind());
      }
    }
    else if ((element instanceof ITask))
    {
      ITask repositoryTask = (ITask)element;
      AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
        repositoryTask.getConnectorKind());
      if (connector != null) {
        return TasksUiPlugin.getDefault().getBrandingIcon(connector.getConnectorKind());
      }
    }
    else if ((element instanceof ScheduledTaskContainer))
    {
      return CommonImages.getImage(CommonImages.CALENDAR);
    }
    return null;
  }
  
  protected Widget getTipWidget(Event event)
  {
    Point widgetPosition = new Point(x, y);
    Widget widget = widget;
    if ((widget instanceof ToolBar))
    {
      ToolBar w = (ToolBar)widget;
      return w.getItem(widgetPosition);
    }
    if ((widget instanceof Table))
    {
      Table w = (Table)widget;
      return w.getItem(widgetPosition);
    }
    if ((widget instanceof Tree))
    {
      Tree w = (Tree)widget;
      return w.getItem(widgetPosition);
    }
    return widget;
  }
  
  private Rectangle getBounds(Widget widget)
  {
    if ((widget instanceof ToolItem))
    {
      ToolItem w = (ToolItem)widget;
      return w.getBounds();
    }
    if ((widget instanceof TableItem))
    {
      TableItem w = (TableItem)widget;
      return w.getBounds();
    }
    if ((widget instanceof TreeItem))
    {
      TreeItem w = (TreeItem)widget;
      return w.getBounds();
    }
    return null;
  }
  
  protected boolean shouldCreateToolTip(Event event)
  {
    currentTipElement = null;
    if ((isTriggeredByMouse()) && (!enabled)) {
      return false;
    }
    if (super.shouldCreateToolTip(event))
    {
      Widget tipWidget = getTipWidget(event);
      if (tipWidget != null)
      {
        Rectangle bounds = getBounds(tipWidget);
        if ((tipWidget instanceof ScalingHyperlink)) {
          currentTipElement = getTaskListElement
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