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

e.mylyn.commons.workbench.editors.CommonTextSupport;
import org.eclipse.mylyn.internal.tasks.core.data.FileTaskAttachmentSource;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.editors.RichTextEditor;
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorExtensions;
import org.eclipse.mylyn.internal.tasks.ui.wizards.Messages;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.core.context.AbstractTaskContextStore;
import org.eclipse.mylyn.tasks.core.data.AbstractTaskAttachmentSource;
import org.eclipse.mylyn.tasks.core.data.TaskAttachmentMapper;
import org.eclipse.mylyn.tasks.core.data.TaskAttachmentModel;
import org.eclipse.mylyn.tasks.ui.TasksUiImages;
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorExtension;
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.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.ActiveShellExpression;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.contexts.IContextActivation;
import org.eclipse.ui.contexts.IContextService;
import org.eclipse.ui.handlers.IHandlerService;

public class TaskAttachmentPage
  extends WizardPage
{
  private Button attachContextButton;
  private RichTextEditor commentEditor;
  private Text descriptionText;
  private Combo contentTypeList;
  private Text fileNameText;
  private Button isPatchButton;
  private final TaskAttachmentModel model;
  private boolean needsDescription;
  private final TaskAttachmentMapper taskAttachment;
  private boolean first = true;
  private IContextService contextService;
  private IContextActivation commentContext;
  private CommonTextSupport textSupport;
  private boolean needsReplaceExisting;
  private Button replaceExistingButton;
  
  public TaskAttachmentPage(TaskAttachmentModel model)
  {
    super("AttachmentDetails");
    this.model = model;
    taskAttachment = TaskAttachmentMapper.createFrom(model.getAttribute());
    setTitle(Messages.TaskAttachmentPage_Attachment_Details);
    setNeedsDescription(true);
  }
  
  public void createControl(Composite parent)
  {
    Composite composite = new Composite(parent, 0);
    GridLayout gridLayout = new GridLayout();
    numColumns = 3;
    composite.setLayout(gridLayout);
    setControl(composite);
    
    composite.setLayoutData(new GridData(4, 4, true, true));
    composite.setLayout(new GridLayout(3, false));
    
    new Label(composite, 0).setText(Messages.TaskAttachmentPage_File);
    fileNameText = new Text(composite, 2048);
    fileNameText.setLayoutData(new GridData(4, 128, true, false, 2, 1));
    if (needsReplaceExisting)
    {
      new Label(composite, 0);
      replaceExistingButton = new Button(composite, 32);
      replaceExistingButton.setLayoutData(new GridData(-1, -1, false, false, 2, 1));
      replaceExistingButton.setText(Messages.TaskAttachmentPage_Replace_existing_attachment_Label);
      replaceExistingButton.addSelectionListener(new SelectionAdapter()
      {
        public void widgetSelected(SelectionEvent e)
        {
          taskAttachment.setReplaceExisting(Boolean.valueOf(replaceExistingButton.getSelection()));
          TaskAttachmentPage.this.validate();
        }
      });
    }
    if (needsDescription)
    {
      new Label(composite, 0).setText(Messages.TaskAttachmentPage_Description);
      descriptionText = new Text(composite, 2048);
      descriptionText.setLayoutData(new GridData(4, 128, true, false, 2, 1));
      descriptionText.addModifyListener(new ModifyListener()
      {
        public void modifyText(ModifyEvent e)
        {
          taskAttachment.setDescription(descriptionText.getText().trim());
          TaskAttachmentPage.this.validate();
        }
      });
    }
    Label label = new Label(composite, 0);
    label.setLayoutData(new GridData(16384, 4, false, false));
    label.setText(Messages.TaskAttachmentPage_Comment);
    
    AbstractTaskEditorExtension extension = TaskEditorExtensions.getTaskEditorExtension(model.getTaskRepository());
    if (extension != null)
    {
      String contextId = extension.getEditorContextId();
      if (contextId != null)
      {
        contextService = ((IContextService)PlatformUI.getWorkbench().getService(IContextService.class));
        if (contextService != null) {
          commentContext = contextService.activateContext(contextId, new ActiveShellExpression(getShell()));
        }
      }
    }
    commentEditor = new RichTextEditor(getModel().getTaskRepository(), 2624, 
      contextService, extension, getModel().getTask())
      {
        protected void valueChanged(String value)
        {
          TaskAttachmentPage.this.apply();
        }
      };
      commentEditor.createControl(composite, null);
      commentEditor.getControl().setLayoutData(new GridData(4, 4, true, true, 2, 1));
      
      IHandlerService handlerService = (IHandlerService)PlatformUI.getWorkbench().getService(IHandlerService.class);
      if (handlerService != null)
      {
        textSupport = new CommonTextSupport(handlerService);
        textSupport.install(commentEditor.getViewer(), true);
      }
      new Label(composite, 0).setText(Messages.TaskAttachmentPage_Content_Type);
      
      contentTypeList = new Combo(composite, 2060);
      contentTypeList.setLayoutData(new GridData(-1, -1, false, false, 2, 1));
      String[] contentTypes = FileTaskAttachmentSource.getContentTypes();
      int selection = 0;
      for (int i = 0; i < contentTypes.length; i++)
      {
        String next = contentTypes[i];
        contentTypeList.add(next);
        if (next.equalsIgnoreCase(model.getContentType())) {
          selection = i;
        }
      }
      contentTypeList.addSelectionListener(new SelectionListener()
      {
        public void widgetDefaultSelected(SelectionEvent e) {}
        
        public void widgetSelected(SelectionEvent e)
        {
          taskAttachment.setContentType(contentTypeList.getItem(contentTypeList.getSelectionIndex()));
          TaskAttachmentPage.this.validate();
        }
      });
      contentTypeList.select(selection);
      taskAttachment.setContentType(contentTypeList.getItem(selection));
      
      new Label(composite, 0);
      
      isPatchButton = new Button(composite, 32);
      isPatchButton.setLayoutData(new GridData(-1, -1, false, false, 2, 1));
      isPatchButton.setText(Messages.TaskAttachmentPage_Patch);
      
      new Label(composite, 0);
      
      attachContextButton = new Button(composite, 32);
      attachContextButton.setLayoutData(new GridData(-1, -1, false, false, 2, 1));
      attachContextButton.setText(Messages.TaskAttachmentPage_ATTACHE_CONTEXT);
      attachContextButton.setImage(CommonImages.getImage(TasksUiImages.CONTEXT_ATTACH));
      attachContextButton.setEnabled(TasksUiPlugin.getContextStore().hasContext(model.getTask()));
      
      fileNameText.addModifyListener(new ModifyListener()
      {
        public void modifyText(ModifyEvent e)
        {
          taskAttachment.setFileName(fileNameText.getText());
          TaskAttachmentPage.this.setContentTypeFromFilename(fileNameText.getText());
          TaskAttachmentPage.this.validate();
        }
      });
      isPatchButton.addSelectionListener(new SelectionAdapter()
      {
        private int lastSelected;
        
        public void widgetSelected(SelectionEvent e)
        {
          taskAttachment.setPatch(Boolean.valueOf(isPatchButton.getSelection()));
          if (isPatchButton.getSelection())
          {
            lastSelected = contentTypeList.getSelectionIndex();
            contentTypeList.select(0);
            contentTypeList.setEnabled(false);
            if (attachContextButton.isEnabled()) {
              attachContextButton.setSelection(true);
            }
          }
          else
          {
            contentTypeList.setEnabled(true);
            contentTypeList.select(lastSelected);
          }
          TaskAttachmentPage.this.validate();
        }
      });
      attachContextButton.addSelectionListener(new SelectionAdapter()
      {
        public void widgetSelected(SelectionEvent e)
        {
          TaskAttachmentPage.this.validate();
        }
      });
      validate();
      setErrorMessage(null);
      if (descriptionText != null) {
        descriptionText.setFocus();
      } else {
        commentEditor.getControl().setFocus();
      }
      Dialog.applyDialogFont(composite);
    }
    
    private void validate()
    {
      apply();
      if ((fileNameText != null) && ("".equals(fileNameText.getText().trim())))
      {
        setMessage(Messages.TaskAttachmentPage_Enter_a_file_name);
        setPageComplete(false);
      }
      else if ((descriptionText != null) && ("".equals(descriptionText.getText().trim())))
      {
        setMessage(Messages.TaskAttachmentPage_Enter_a_description);
        setPageComplete(false);
      }
      else
      {
        setMessage(Messages.TaskAttachmentPage_Verify_the_content_type_of_the_attachment);
        setPageComplete(true);
      }
    }
    
    public TaskAttachmentModel getModel()
    {
      return model;
    }
    
    private void apply()
    {
      taskAttachment.applyTo(model.getAttribute());
      model.setComment(commentEditor.getText());
      model.setAttachContext(attachContextButton.getSelection());
      model.setContentType(taskAttachment.getContentType());
    }
    
    private void setContentType(String contentType)
    {
      String[] typeList = contentTypeList.getItems();
      for (int i = 0; i < typeList.length; i++) {
        if (typeList[i].equals(contentType))
        {
          contentTypeList.select(i);
          taskAttachment.setContentType(contentType);
          validate();
          break;
        }
      }
    }
    
    private void setContentTypeFromFilename(String fileName)
    {
      setContentType(FileTaskAttachmentSource.getContentTypeFromFilename(fileName));
    }
    
    private void setFilePath(String path)
    {
      fileNameText.setText(path);
      taskAttachment.setFileName(path);
      if (path.endsWith(".patch"))
      {
        isPatchButton.setSelection(true);
        taskAttachment.setPatch(Boolean.valueOf(true));
        if (attachContextButton.isEnabled()) {
          attachContextButton.setSelection(true);
        }
      }
      validate();
    }
    
    public void setNeedsDescription(boolean supportsDescription)
    {
      needsDescription = supportsDescription;
    }
    
    @Deprecated
    public boolean supportsDescription()
    {
      return needsDescription();
    }
    
    public boolean needsDescription()
    {
      return needsDescription;
    }
    
    public void setVisible(boolean visible)
    {
      if ((visible) && 
        (!fileNameText.getText().equals(taskAttachment.getFileName())))
      {
        fileNameText.setText(taskAttachment.getFileName() == null ? "" : taskAttachment.getFileName());
        if (fileNameText.getText().length() == 0)
        {
          setFilePath(getModel().getSource().getName());
          setContentType(getModel().getSource().getContentType());
        }
      }
      super.setVisible(visible);
      if (first)
      {
        if (descriptionText != null) {
          descriptionText.setFocus();
        } else {
          commentEditor.getControl().setFocus();
        }
        first = false;
      }
    }
    
    public void dispose()
    {
      super.dispose();
      if ((contextService != null) && (commentContext != null))
      {
        contextService.deactivateContext(commentContext);
        commentContext = null;
      }
      if (textSupport != null) {
        textSupport.dispose();
      }
    }
    
    public void setNeedsReplaceExisting(boolean needsReplaceExisting)
    {
      this.needsReplaceExisting = needsReplaceExisting;
    }
    
    public boolean needsReplaceExisting()
    {
      return needsReplaceExisting;
    }
  }

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

import java.net.MalformedURLException;
import java.net.URL;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.mylyn.commons.ui.CommonImages;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
import org.eclipse.swt.graphics.Image;
import org.osgi.framework.Bundle;

public class TasksUiImages
{
  private static final URL baseURL = TasksUiPlugin.getDefault().getBundle().getEntry("/icons/");
  private static final String VIEW = "eview16";
  private static final String TOOL = "etool16";
  private static final String TOOL_SMALL = "etool12";
  private static final String OBJ = "obj16";
  private static final String WIZBAN = "wizban";
  public static final ImageDescriptor TASK = create("etool16", "task.gif");
  public static final ImageDescriptor TASK_COMPLETE = create("etool16", "task-complete.gif");
  public static final ImageDescriptor TASK_INCOMPLETE = create("etool16", "task-incomplete.gif");
  public static final ImageDescriptor TASK_COMPLETED = create("etool16", "task-completed.gif");
  public static final ImageDescriptor TASK_NOTES = create("etool16", "task-notes.gif");
  public static final ImageDescriptor TASK_NEW = create("etool16", "task-new.gif");
  public static final ImageDescriptor TASK_NEW_SUB = create("etool16", "sub-task-new.gif");
  public static final ImageDescriptor TASK_REPOSITORY_HISTORY = create("etool16", "task-repository-history.gif");
  public static final ImageDescriptor TASK_REMOTE = create("etool16", "task-remote.gif");
  public static final ImageDescriptor TASK_WORKING_SET = create("etool16", "open-task.gif");
  public static final ImageDescriptor TASKS_VIEW = create("eview16", "task-list.gif");
  public static final ImageDescriptor TASK_ATTACHMENT_PATCH = create("obj16", "attachment-patch.gif");
  public static final ImageDescriptor FILTER_OBSOLETE_SMALL = create("etool12", "file-delete-line-12x12.png");
  public static final ImageDescriptor FILE_NEW_SMALL = create("etool12", "file-new-12x12.png");
  public static final ImageDescriptor TASK_RETRIEVE = create("etool16", "task-retrieve.gif");
  public static final ImageDescriptor TASK_REPOSITORY = create("etool16", "task-repository.gif");
  public static final ImageDescriptor TASK_REPOSITORY_NEW = create("etool16", "task-repository-new.gif");
  public static final ImageDescriptor CATEGORY = create("etool16", "category.gif");
  public static final ImageDescriptor CATEGORY_NEW = create("etool16", "category-new.gif");
  public static final ImageDescriptor CATEGORY_UNCATEGORIZED = create("etool16", "category-archive.gif");
  public static final ImageDescriptor QUERY = create("etool16", "query.gif");
  public static final ImageDescriptor QUERY_NEW = create("etool16", "query-new.gif");
  public static final ImageDescriptor QUERY_OFFLINE = ImageDescriptor.createWithFlags(QUERY, 
    2);
  public static final ImageDescriptor QUERY_UNMATCHED = create("etool16", "query-unmatched.png");
  public static final ImageDescriptor REPOSITORY = create("eview16", "repository.gif");
  public static final ImageDescriptor REPOSITORY_OFFLINE = ImageDescriptor.createWithFlags(REPOSITORY, 
    2);
  public static final ImageDescriptor REPOSITORY_SYNCHRONIZE_SMALL = create("etool12", 
    "repository-synchronize-small.png");
  public static final ImageDescriptor REPOSITORY_UPDATE_CONFIGURATION = create("etool16", 
    "repository-synchronize-attributes.png");
  public static final ImageDescriptor REPOSITORY_SYNCHRONIZE = create("etool16", "repository-synchronize.gif");
  public static final ImageDescriptor REPOSITORY_SUBMIT = create("etool16", "repository-submit.gif");
  public static final ImageDescriptor REPOSITORY_SMALL = create("obj16", "repository-small.gif");
  public static final ImageDescriptor REPOSITORY_NEW = create("etool16", "repository-new.gif");
  public static final ImageDescriptor REPOSITORY_VALIDATE = create("obj16", "resource_obj.gif");
  public static final ImageDescriptor REPOSITORIES_VIEW = create("eview16", "repositories.gif");
  public static final ImageDescriptor CONTEXT_ACTIVE = create("etool16", "task-active.gif");
  public static final ImageDescriptor CONTEXT_ACTIVE_CENTERED = create("etool16", "task-active-centered.gif");
  public static final ImageDescriptor CONTEXT_INACTIVE_EMPTY = create("etool16", "task-inactive.gif");
  public static final ImageDescriptor CONTEXT_INACTIVE = create("etool16", "task-context.gif");
  public static final ImageDescriptor CONTEXT_FOCUS = create("eview16", "focus.gif");
  public static final ImageDescriptor CONTEXT_ATTACH = create("etool16", "context-attach.gif");
  public static final ImageDescriptor CONTEXT_RETRIEVE = create("etool16", "context-retrieve.gif");
  public static final ImageDescriptor CONTEXT_TRANSFER = create("etool16", "context-transfer.gif");
  public static final ImageDescriptor CONTEXT_CLEAR = create("etool16", "context-clear.gif");
  public static final ImageDescriptor CONTEXT_HISTORY_PREVIOUS = create("etool16", "navigate-previous.gif");
  @Deprecated
  public static final ImageDescriptor CONTEXT_HISTORY_PREVIOUS_PAUSE = create("etool16", "navigate-previous-pause.gif");
  public static final ImageDescriptor CONTEXT_HISTORY_PREVIOUS_ACTIVE = create("etool16", "navigate-previous-active.gif");
  public static final ImageDescriptor CONTEXT_HISTORY_NEXT = create("etool16", "navigate-next.gif");
  public static final ImageDescriptor CONTEXT_CAPTURE_PAUSE = create("etool16", "capture-pause.gif");
  public static final ImageDescriptor CONTEXT_ADD = create("etool16", "context-add.gif");
  public static final ImageDescriptor CONTEXT_COPY = create("etool16", "context-transfer.gif");
  public static final ImageDescriptor COMMENT = create("etool16", "comment.gif");
  public static final ImageDescriptor COMMENT_SORT_DOWN = create("etool16", "sort-down.gif");
  public static final ImageDescriptor COMMENT_SORT_UP = create("etool16", "sort-up.gif");
  public static final ImageDescriptor COMMENT_SORT_DOWN_GRAY = create("etool16", "sort-down-gray.gif");
  public static final ImageDescriptor COMMENT_SORT_UP_GRAY = create("etool16", "sort-up-gray.gif");
  public static final ImageDescriptor COMMENT_REPLY = create("etool16", "reply.gif");
  public static final ImageDescriptor COMMENT_REPLY_SMALL = create("etool12", "reply.gif");
  public static final ImageDescriptor BANNER_REPOSITORY = create("wizban", "banner-repository.gif");
  public static final ImageDescriptor BANNER_REPOSITORY_SETTINGS = create("wizban", "banner-repository-settings.gif");
  public static final ImageDescriptor BANNER_REPOSITORY_CONTEXT = create("wizban", "banner-repository-context.gif");
  public static final ImageDescriptor BANNER_WORKING_SET = create("wizban", "workset_wiz.png");
  public static final ImageDescriptor PRESENTATION_CATEGORIZED = create("etool16", "presentation-categorized.png");
  public static final ImageDescriptor PRESENTATION_SCHEDULED = create("etool16", "presentation-scheduled.png");
  public static final ImageDescriptor BANNER_REPORT_BUG = create("wizban", "bug-wizard.gif");
  public static final ImageDescriptor LOCK_CLOSE = create("etool12", "lock.gif");
  public static final ImageDescriptor LOCK_OPEN = create("etool12", "unlock.gif");
  
  public static Image getImageForPriority(ITask.PriorityLevel priorityLevel)
  {
    if (priorityLevel == null) {
      return null;
    }
    ImageDescriptor imageDescriptor = getImageDescriptorForPriority(priorityLevel);
    if (imageDescriptor != null) {
      return CommonImages.getImage(imageDescriptor);
    }
    return null;
  }
  
  public static ImageDescriptor getImageDescriptorForPriority(ITask.PriorityLevel priorityLevel)
  {
    if (priorityLevel == null) {
      return null;
    }
    switch (priorityLevel)
    {
    case P1: 
      return CommonImages.PRIORITY_1;
    case P2: 
      return CommonImages.PRIORITY_2;
    case P3: 
      return CommonImages.PRIORITY_3;
    case P4: 
      return CommonImages.PRIORITY_4;
    case P5: 
      return CommonImages.PRIORITY_5;
    }
    return null;
  }
  
  public static ImageDescriptor create(String prefix, String name)
  {
    try
    {
      return ImageDescriptor.createFromURL(makeIconFileURL(prefix, name));
    }
    catch (MalformedURLException localMalformedURLException) {}
    return ImageDescriptor.getMissingImageDescriptor();
  }
  
  private static URL makeIconFileURL(String prefix, String name)
    throws MalformedURLException
  {
    if (baseURL == null) {
      throw new MalformedURLException();
    }
    StringBuffer buffer = new StringBuffer(prefix);
    buffer.append('/');
    buffer.append(name);
    return new URL(baseURL, buffer.toString());
  }
}

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

import org.eclipse.mylyn.commons.net.AbstractWebLocation;
import org.eclipse.mylyn.internal.tasks.ui.TaskRepositoryLocationUi;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.core.TaskRepositoryLocationFactory;

public class TaskRepositoryLocationUiFactory
  extends TaskRepositoryLocationFactory
{
  public AbstractWebLocation createWebLocation(TaskRepository taskRepository)
  {
    return new TaskRepositoryLocationUi(taskRepository);
  }
}

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

import org.eclipse.jface.action.Action;
import org.eclipse.mylyn.internal.tasks.ui.actions.ActivateTaskDialogAction;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWindow;

class TasksUiPlugin$3
  extends Action
{
  TasksUiPlugin$3(TasksUiPlugin paramTasksUiPlugin) {}
  
  public void run()
  {
    ActivateTaskDialogAction activateTaskDialogAction = new ActivateTaskDialogAction();
    IWorkbenchWindow window = this$0.getWorkbench().getActiveWorkbenchWindow();
    if ((window == null) && (this$0.getWorkbench().getWorkbenchWindows().length > 0)) {
      window = this$0.getWorkbench().getWorkbenchWindows()[0];
    }
    activateTaskDialogAction.init(window);
    activateTaskDialogAction.run(null);
  }
}

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

import org.eclipse.jface.action.Action;
import org.eclipse.mylyn.internal.tasks.core.DateRange;

class ScheduleTaskMenuContributor$5
  extends Action
{
  ScheduleTaskMenuContributor$5(ScheduleTaskMenuContributor paramScheduleTaskMenuContributor, DateRange paramDateRange) {}
  
  public void run()
  {
    this$0.setScheduledDate(val$dateContainer);
  }
}

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

import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
import org.eclipse.mylyn.internal.tasks.core.LocalTask;
import org.eclipse.mylyn.internal.tasks.core.ScheduledTaskContainer;
import org.eclipse.mylyn.tasks.core.IRepositoryElement;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.ITaskContainer;
import org.eclipse.ui.IWorkingSet;

public class TaskWorkingSetFilter
  extends AbstractTaskListFilter
{
  private IAdaptable[] elements;
  
  public boolean select(Object parent, Object element)
  {
    if ((parent instanceof ITask)) {
      return true;
    }
    if ((parent == null) && ((element instanceof ScheduledTaskContainer))) {
      return true;
    }
    if ((parent == null) && ((element instanceof IRepositoryElement))) {
      return isContainedInWorkingSet((IRepositoryElement)element);
    }
    if (((parent instanceof ITaskContainer)) && (!(parent instanceof ScheduledTaskContainer))) {
      return isContainedInWorkingSet((IRepositoryElement)parent);
    }
    Iterator localIterator;
    if ((element instanceof LocalTask))
    {
      localIterator = ((LocalTask)element).getParentContainers().iterator();
      if (localIterator.hasNext())
      {
        IRepositoryElement container = (IRepositoryElement)localIterator.next();
        return isContainedInWorkingSet(container);
      }
    }
    if (((parent instanceof ScheduledTaskContainer)) && ((element instanceof ITask)))
    {
      for (IRepositoryElement query : ((AbstractTask)element).getParentContainers()) {
        if (isContainedInWorkingSet(query)) {
          return true;
        }
      }
      return false;
    }
    return true;
  }
  
  public boolean select(ITask task)
  {
    for (IRepositoryElement query : ((AbstractTask)task).getParentContainers()) {
      if (isContainedInWorkingSet(query)) {
        return true;
      }
    }
    return false;
  }
  
  public boolean applyToFilteredText()
  {
    return true;
  }
  
  private boolean isContainedInWorkingSet(IRepositoryElement element)
  {
    return isContainedInWorkingSet(element, new HashSet());
  }
  
  private boolean isContainedInWorkingSet(IRepositoryElement container, Set<IRepositoryElement> visited)
  {
    if (elements == null) {
      return true;
    }
    if (visited.contains(container)) {
      return false;
    }
    visited.add(container);
    
    boolean seenTaskWorkingSets = false;
    String handleIdentifier = container.getHandleIdentifier();
    IAdaptable[] arrayOfIAdaptable;
    int j = (arrayOfIAdaptable = elements).length;
    for (int i = 0; i < j; i++)
    {
      IAdaptable adaptable = arrayOfIAdaptable[i];
      if ((adaptable instanceof IRepositoryElement))
      {
        seenTaskWorkingSets = true;
        if (handleIdentifier.equals(((IRepositoryElement)adaptable).getHandleIdentifier())) {
          return true;
        }
        if ((container instanceof AbstractTask)) {
          for (AbstractTaskContainer parent : ((AbstractTask)container).getParentContainers()) {
            if (!visited.contains(parent)) {
              if (isContainedInWorkingSet(parent, visited)) {
                return true;
              }
            }
          }
        }
      }
    }
    return !seenTaskWorkingSets;
  }
  
  public boolean updateWorkingSet(IWorkingSet currentWorkingSet)
  {
    IAdaptable[] newElements = currentWorkingSet.getElements();
    if (!Arrays.equals(elements, newElements))
    {
      elements = newElements;
      return true;
    }
    return false;
  }
  
  public IAdaptable[] getElements()
  {
    return elements;
  }
}

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

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

class TasksReminderDialog$1
  extends SelectionAdapter
{
  TasksReminderDialog$1(TasksReminderDialog paramTasksReminderDialog) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    TasksReminderDialog.access$1(this$0).setSorter(new TasksReminderDialog.ReminderTaskSorter(1));
  }
}

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

import java.util.Collections;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.mylyn.internal.tasks.core.sync.SynchronizationScheduler.Synchronizer;
import org.eclipse.mylyn.internal.tasks.ui.TaskJobFactory;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.sync.SynchronizationJob;

class TasksUiInternal$7
  extends SynchronizationScheduler.Synchronizer<Job>
{
  TasksUiInternal$7(AbstractRepositoryConnector paramAbstractRepositoryConnector, ITask paramITask) {}
  
  public Job createJob()
  {
    SynchronizationJob job = TasksUiPlugin.getTaskJobFactory().createSynchronizeTasksJob(val$connector, 
      Collections.singleton(val$task));
    job.setUser(false);
    job.setSystem(true);
    return job;
  }
}

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

import org.eclipse.swt.custom.StyledText;

class PlatformUtil$Eclipse36Checker
{
  public static final boolean result;
  
  static
  {
    boolean methodAvailable = false;
    try
    {
      StyledText.class.getMethod("setTabStops", new Class[] { int[].class });
      methodAvailable = true;
    }
    catch (NoSuchMethodException localNoSuchMethodException) {}
    result = methodAvailable;
  }
}

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

import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.ui.IEditorPart;

public class TaskOpenEvent
{
  private final TaskRepository repository;
  private final ITask task;
  private final String taskId;
  private final boolean inBrowser;
  private final IEditorPart editor;
  
  public TaskOpenEvent(TaskRepository repository, ITask task, String taskId, IEditorPart editor, boolean inBrowser)
  {
    this.repository = repository;
    this.task = task;
    this.taskId = taskId;
    this.editor = editor;
    this.inBrowser = inBrowser;
  }
  
  public boolean isInBrowser()
  {
    return inBrowser;
  }
  
  public TaskRepository getRepository()
  {
    return repository;
  }
  
  public ITask getTask()
  {
    return task;
  }
  
  public String getTaskId()
  {
    return taskId;
  }
  
  public IEditorPart getEditor()
  {
    return editor;
  }
}

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

import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IContributor;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.commons.ui.CommonImages;
import org.eclipse.mylyn.internal.tasks.core.RepositoryTemplateManager;
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryManager;
import org.eclipse.mylyn.internal.tasks.core.activity.DefaultTaskActivityMonitor;
import org.eclipse.mylyn.internal.tasks.core.context.DefaultTaskContextStore;
import org.eclipse.mylyn.internal.tasks.core.externalization.TaskListExternalizer;
import org.eclipse.mylyn.internal.tasks.ui.IDynamicSubMenuContributor;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.views.AbstractTaskListPresentation;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
import org.eclipse.mylyn.tasks.core.AbstractDuplicateDetector;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryMigrator;
import org.eclipse.mylyn.tasks.core.AbstractTaskListMigrator;
import org.eclipse.mylyn.tasks.core.IRepositoryManager;
import org.eclipse.mylyn.tasks.core.RepositoryTemplate;
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.TasksUi;
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPageFactory;
import org.eclipse.osgi.util.NLS;
import org.eclipse.ui.plugin.AbstractUIPlugin;

public class TasksUiExtensionReader
{
  public static final String EXTENSION_REPOSITORIES = "org.eclipse.mylyn.tasks.ui.repositories";
  public static final String EXTENSION_REPOSITORY_LINKS_PROVIDERS = "org.eclipse.mylyn.tasks.ui.projectLinkProviders";
  public static final String EXTENSION_TEMPLATES = "org.eclipse.mylyn.tasks.core.templates";
  public static final String EXTENSION_TMPL_REPOSITORY = "repository";
  public static final String ELMNT_TMPL_LABEL = "label";
  public static final String ELMNT_TMPL_URLREPOSITORY = "urlRepository";
  public static final String ELMNT_TMPL_REPOSITORYKIND = "repositoryKind";
  public static final String ELMNT_TMPL_CHARACTERENCODING = "characterEncoding";
  public static final String ELMNT_TMPL_ANONYMOUS = "anonymous";
  public static final String ELMNT_TMPL_VERSION = "version";
  public static final String ELMNT_TMPL_URLNEWTASK = "urlNewTask";
  public static final String ELMNT_TMPL_URLTASK = "urlTask";
  public static final String ELMNT_TMPL_URLTASKQUERY = "urlTaskQuery";
  public static final String ELMNT_TMPL_NEWACCOUNTURL = "urlNewAccount";
  public static final String ELMNT_TMPL_ADDAUTO = "addAutomatically";
  public static final String ELMNT_REPOSITORY_CONNECTOR = "connectorCore";
  public static final String ELMNT_REPOSITORY_LINK_PROVIDER = "linkProvider";
  public static final String ELMNT_REPOSITORY_UI = "connectorUi";
  public static final String ELMNT_MIGRATOR = "taskListMigrator";
  public static final String ELMNT_REPOSITORY_MIGRATOR = "repositoryMigrator";
  public static final String ATTR_BRANDING_ICON = "brandingIcon";
  public static final String ATTR_OVERLAY_ICON = "overlayIcon";
  public static final String ELMNT_TYPE = "type";
  public static final String ELMNT_QUERY_PAGE = "queryPage";
  public static final String ELMNT_SETTINGS_PAGE = "settingsPage";
  public static final String EXTENSION_TASK_CONTRIBUTOR = "org.eclipse.mylyn.tasks.ui.actions";
  public static final String ATTR_ACTION_CONTRIBUTOR_CLASS = "taskHandlerClass";
  public static final String DYNAMIC_POPUP_ELEMENT = "dynamicPopupMenu";
  public static final String ATTR_CLASS = "class";
  public static final String ATTR_MENU_PATH = "menuPath";
  public static final String EXTENSION_EDITORS = "org.eclipse.mylyn.tasks.ui.editors";
  public static final String ELMNT_TASK_EDITOR_PAGE_FACTORY = "pageFactory";
  public static final String EXTENSION_DUPLICATE_DETECTORS = "org.eclipse.mylyn.tasks.ui.duplicateDetectors";
  public static final String ELMNT_DUPLICATE_DETECTOR = "detector";
  public static final String ATTR_NAME = "name";
  public static final String ATTR_KIND = "kind";
  private static final String EXTENSION_PRESENTATIONS = "org.eclipse.mylyn.tasks.ui.presentations";
  public static final String ELMNT_PRESENTATION = "presentation";
  public static final String ATTR_ICON = "icon";
  public static final String ATTR_PRIMARY = "primary";
  public static final String ATTR_ID = "id";
  
  private static class ConnectorDescriptor
  {
    IConfigurationElement element;
    IConfigurationElement taskListMigratorElement;
    IConfigurationElement repositoryMigratorElement;
    AbstractRepositoryConnector repositoryConnector;
    AbstractTaskListMigrator taskListMigrator;
    AbstractRepositoryMigrator repositoryMigrator;
    private final String id;
    
    public ConnectorDescriptor(IConfigurationElement element)
    {
      this.element = element;
      id = element.getAttribute("id");
    }
    
    public String getId()
    {
      return id;
    }
    
    public String getConnectorKind()
    {
      return repositoryConnector != null ? repositoryConnector.getConnectorKind() : null;
    }
    
    public IStatus createConnector()
    {
      Assert.isTrue(repositoryConnector == null);
      try
      {
        Object connectorCore = element.createExecutableExtension("class");
        if ((connectorCore instanceof AbstractRepositoryConnector))
        {
          repositoryConnector = ((AbstractRepositoryConnector)connectorCore);
          return Status.OK_STATUS;
        }
        return new Status(4, "org.eclipse.mylyn.tasks.ui", "Could not load connector core " + 
          connectorCore.getClass().getCanonicalName());
      }
      catch (Throwable e)
      {
        return new Status(4, "org.eclipse.mylyn.tasks.ui", "Could not load connector core", e);
      }
    }
    
    public IStatus createTaskListMigrator()
    {
      Assert.isTrue(taskListMigrator == null);
      try
      {
        Object migratorObject = taskListMigratorElement.createExecutableExtension("class");
        if ((migratorObject instanceof AbstractTaskListMigrator))
        {
          taskListMigrator = ((AbstractTaskListMigrator)migratorObject);
          return Status.OK_STATUS;
        }
        return new Status(4, "org.eclipse.mylyn.tasks.ui", 
          "Could not load task list migrator: " + migratorObject.getClass().getCanonicalName() + 
          " must implement " + AbstractTaskListMigrator.class.getCanonicalName());
      }
      catch (Throwable e)
      {
        return new Status(4, "org.eclipse.mylyn.tasks.ui", 
          "Could not load task list migrator extension", e);
      }
    }
    
    public IStatus createRepositoryMigrator()
    {
      Assert.isTrue(repositoryMigrator == null);
      try
      {
        Object migratorObject = repositoryMigratorElement.createExecutableExtension("class");
        if ((migratorObject instanceof AbstractRepositoryMigrator))
        {
          repositoryMigrator = ((AbstractRepositoryMigrator)migratorObject);
          return Status.OK_STATUS;
        }
        return new Status(4, "org.eclipse.mylyn.tasks.ui", 
          "Could not load repository migrator: " + migratorObject.getClass().getCanonicalName() + 
          " must implement " + AbstractRepositoryMigrator.class.getCanonicalName());
      }
      catch (Throwable e)
      {
        return new Status(4, "org.eclipse.mylyn.tasks.ui", 
          "Could not load repository migrator extension", e);
      }
    }
    
    public String getPluginId()
    {
      return element.getContributor().getName();
    }
  }
  
  private static boolean coreExtensionsRead = false;
  private static Set<String> disabledContributors = new HashSet();
  
  public static void initStartupExtensions(TaskListExternalizer taskListExternalizer, TaskRepositoryManager repositoryManager)
  {
    if (!coreExtensionsRead)
    {
      IExtensionRegistry registry = Platform.
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