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

leBarForeground(color);
    }
  }
}

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

import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.forms.events.HyperlinkAdapter;
import org.eclipse.ui.forms.events.HyperlinkEvent;

class PersonAttributeEditor$1
  extends HyperlinkAdapter
{
  PersonAttributeEditor$1(PersonAttributeEditor paramPersonAttributeEditor) {}
  
  public void linkActivated(HyperlinkEvent e)
  {
    String userName = this$0.getModel().getTaskRepository().getUserName();
    if ((userName != null) && (userName.length() > 0))
    {
      this$0.getText().setText(userName);
      this$0.setValue(userName);
    }
  }
}

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

import java.util.Set;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.internal.tasks.core.TaskContainerDelta;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;

class PlanningPart$1
  extends TaskListChangeAdapter
{
  PlanningPart$1(PlanningPart paramPlanningPart) {}
  
  public void containersChanged(Set<TaskContainerDelta> containers)
  {
    for (TaskContainerDelta taskContainerDelta : containers) {
      if ((taskContainerDelta.getElement() instanceof ITask))
      {
        AbstractTask updateTask = (AbstractTask)taskContainerDelta.getElement();
        if ((updateTask != null) && (this$0.getTask() != null) && 
          (updateTask.getHandleIdentifier().equals(this$0.getTask().getHandleIdentifier())) && 
          (PlatformUI.getWorkbench() != null) && (!PlatformUI.getWorkbench().isClosing())) {
          PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable()
          {
            public void run()
            {
              this$0.refresh(false);
            }
          });
        }
      }
    }
  }
}

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

import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.mylyn.commons.ui.CommonImages;
import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
import org.eclipse.mylyn.tasks.ui.TasksUiImages;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.ui.forms.widgets.FormToolkit;

public class PriorityEditor
{
  private Control control;
  private boolean ignoreNotification;
  private Label label;
  private Map<String, String> labelByValue;
  private Menu menu;
  private boolean readOnly;
  private ToolItem selectionButton;
  private ToolBar toolBar;
  private String value;
  
  public void createControl(final Composite parent, FormToolkit toolkit)
  {
    if (isReadOnly())
    {
      label = toolkit.createLabel(parent, "");
      setControl(label);
    }
    else
    {
      toolBar = new ToolBar(parent, 8388608);
      selectionButton = new ToolItem(toolBar, 4);
      selectionButton.addSelectionListener(new SelectionAdapter()
      {
        public void widgetSelected(SelectionEvent e)
        {
          if (menu == null) {
            PriorityEditor.this.createMenu(toolBar);
          }
          Point location = parent.toDisplay(toolBar.getLocation());
          y += selectionButton.getBounds().height;
          if (value != null)
          {
            MenuItem[] items = menu.getItems();
            MenuItem[] arrayOfMenuItem1;
            int j = (arrayOfMenuItem1 = items).length;
            for (int i = 0; i < j; i++)
            {
              MenuItem item = arrayOfMenuItem1[i];
              item.setSelection(value.equals(item.getData()));
            }
          }
          menu.setLocation(location);
          menu.setVisible(true);
        }
      });
      selectionButton.addDisposeListener(new DisposeListener()
      {
        public void widgetDisposed(DisposeEvent e)
        {
          if (menu != null) {
            menu.dispose();
          }
        }
      });
      toolkit.adapt(toolBar);
      setControl(toolBar);
    }
  }
  
  private void createMenu(ToolBar bar)
  {
    menu = new Menu(bar);
    for (String key : labelByValue.keySet())
    {
      final MenuItem item = new MenuItem(menu, 32);
      item.setText((String)labelByValue.get(key));
      item.setData(key);
      item.setImage(getSmallImage(key));
      item.addSelectionListener(new SelectionAdapter()
      {
        public void widgetSelected(SelectionEvent e)
        {
          if (!ignoreNotification)
          {
            value = ((String)item.getData());
            valueChanged(value);
          }
        }
      });
    }
  }
  
  public Control getControl()
  {
    return control;
  }
  
  public Map<String, String> getLabelByValue()
  {
    return Collections.unmodifiableMap(labelByValue);
  }
  
  private ImageDescriptor getLargeImageDescriptor(ITask.PriorityLevel priorityLevel)
  {
    if (priorityLevel != null) {
      switch (priorityLevel)
      {
      case P1: 
        return CommonImages.PRIORITY_1_LARGE;
      case P2: 
        return CommonImages.PRIORITY_2_LARGE;
      case P3: 
        return CommonImages.PRIORITY_3_LARGE;
      case P4: 
        return CommonImages.PRIORITY_4_LARGE;
      case P5: 
        return CommonImages.PRIORITY_5_LARGE;
      }
    }
    return CommonImages.PRIORITY_3_LARGE;
  }
  
  private Image getSmallImage(String value)
  {
    ImageDescriptor descriptor = getSmallImageDescriptor(value);
    if (descriptor != null) {
      return CommonImages.getImage(descriptor);
    }
    return null;
  }
  
  private ImageDescriptor getSmallImageDescriptor(String value)
  {
    ITask.PriorityLevel priorityLevel = ITask.PriorityLevel.fromString(value);
    if (priorityLevel != null) {
      return TasksUiImages.getImageDescriptorForPriority(priorityLevel);
    }
    return null;
  }
  
  public String getToolTipText()
  {
    if (label != null) {
      return label.getToolTipText();
    }
    if (selectionButton != null) {
      return selectionButton.getToolTipText();
    }
    return null;
  }
  
  public boolean isReadOnly()
  {
    return readOnly;
  }
  
  /* Error */
  public void select(String value, ITask.PriorityLevel level)
  {
    // Byte code:
    //   0: aload_0
    //   1: iconst_1
    //   2: putfield 245	org/eclipse/mylyn/internal/tasks/ui/editors/PriorityEditor:ignoreNotification	Z
    //   5: aload_0
    //   6: aload_1
    //   7: putfield 248	org/eclipse/mylyn/internal/tasks/ui/editors/PriorityEditor:value	Ljava/lang/String;
    //   10: aload_0
    //   11: getfield 251	org/eclipse/mylyn/internal/tasks/ui/editors/PriorityEditor:label	Lorg/eclipse/swt/widgets/Label;
    //   14: ifnull +18 -> 32
    //   17: aload_0
    //   18: getfield 251	org/eclipse/mylyn/internal/tasks/ui/editors/PriorityEditor:label	Lorg/eclipse/swt/widgets/Label;
    //   21: aload_0
    //   22: aload_2
    //   23: invokespecial 269	org/eclipse/mylyn/internal/tasks/ui/editors/PriorityEditor:getLargeImageDescriptor	(Lorg/eclipse/mylyn/tasks/core/ITask$PriorityLevel;)Lorg/eclipse/jface/resource/ImageDescriptor;
    //   26: invokestatic 263	org/eclipse/mylyn/commons/ui/CommonImages:getImage	(Lorg/eclipse/jface/resource/ImageDescriptor;)Lorg/eclipse/swt/graphics/Image;
    //   29: invokevirtual 280	org/eclipse/swt/widgets/Label:setImage	(Lorg/eclipse/swt/graphics/Image;)V
    //   32: aload_0
    //   33: getfield 254	org/eclipse/mylyn/internal/tasks/ui/editors/PriorityEditor:selectionButton	Lorg/eclipse/swt/widgets/ToolItem;
    //   36: ifnull +36 -> 72
    //   39: aload_0
    //   40: getfield 253	org/eclipse/mylyn/internal/tasks/ui/editors/PriorityEditor:toolBar	Lorg/eclipse/swt/widgets/ToolBar;
    //   43: ifnull +29 -> 72
    //   46: aload_0
    //   47: getfield 254	org/eclipse/mylyn/internal/tasks/ui/editors/PriorityEditor:selectionButton	Lorg/eclipse/swt/widgets/ToolItem;
    //   50: aload_0
    //   51: aload_2
    //   52: invokespecial 269	org/eclipse/mylyn/internal/tasks/ui/editors/PriorityEditor:getLargeImageDescriptor	(Lorg/eclipse/mylyn/tasks/core/ITask$PriorityLevel;)Lorg/eclipse/jface/resource/ImageDescriptor;
    //   55: invokestatic 263	org/eclipse/mylyn/commons/ui/CommonImages:getImage	(Lorg/eclipse/jface/resource/ImageDescriptor;)Lorg/eclipse/swt/graphics/Image;
    //   58: invokevirtual 293	org/eclipse/swt/widgets/ToolItem:setImage	(Lorg/eclipse/swt/graphics/Image;)V
    //   61: goto +11 -> 72
    //   64: astore_3
    //   65: aload_0
    //   66: iconst_0
    //   67: putfield 245	org/eclipse/mylyn/internal/tasks/ui/editors/PriorityEditor:ignoreNotification	Z
    //   70: aload_3
    //   71: athrow
    //   72: aload_0
    //   73: iconst_0
    //   74: putfield 245	org/eclipse/mylyn/internal/tasks/ui/editors/PriorityEditor:ignoreNotification	Z
    //   77: return
    // Line number table:
    //   Java source line #180	-> byte code offset #0
    //   Java source line #181	-> byte code offset #5
    //   Java source line #182	-> byte code offset #10
    //   Java source line #183	-> byte code offset #17
    //   Java source line #185	-> byte code offset #32
    //   Java source line #186	-> byte code offset #46
    //   Java source line #188	-> byte code offset #64
    //   Java source line #189	-> byte code offset #65
    //   Java source line #190	-> byte code offset #70
    //   Java source line #189	-> byte code offset #72
    //   Java source line #191	-> byte code offset #77
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	78	0	this	PriorityEditor
    //   0	78	1	value	String
    //   0	78	2	level	ITask.PriorityLevel
    //   64	7	3	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   0	64	64	finally
  }
  
  private void setControl(Control control)
  {
    this.control = control;
  }
  
  public void setLabelByValue(Map<String, String> labelByValue)
  {
    this.labelByValue = new LinkedHashMap(labelByValue);
    if (menu != null) {
      menu.dispose();
    }
    menu = null;
  }
  
  public void setReadOnly(boolean readOnly)
  {
    this.readOnly = readOnly;
  }
  
  public void setToolTipText(String text)
  {
    if (label != null) {
      label.setToolTipText(text);
    }
    if (selectionButton != null) {
      selectionButton.setToolTipText(text);
    }
  }
  
  protected void valueChanged(String key) {}
  
  public String getValue()
  {
    return value;
  }
}

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

import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.hyperlink.URLHyperlink;
import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
import org.eclipse.osgi.util.NLS;

@Deprecated
public class TaskUrlHyperlink
  extends URLHyperlink
{
  private final String hyperlinkText;
  
  public TaskUrlHyperlink(IRegion region, String urlString, String hyperlinkText)
  {
    super(region, urlString);
    this.hyperlinkText = hyperlinkText;
  }
  
  public TaskUrlHyperlink(IRegion region, String urlString)
  {
    this(region, urlString, null);
  }
  
  public void open()
  {
    TasksUiUtil.openTask(getURLString());
  }
  
  public String getHyperlinkText()
  {
    if (hyperlinkText != null) {
      return hyperlinkText;
    }
    return NLS.bind(Messages.TaskUrlHyperlink_Open_URL_in_Task_Editor, getURLString());
  }
}

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

import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPage;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

class TaskEditorActionPart$1
  implements Listener
{
  TaskEditorActionPart$1(TaskEditorActionPart paramTaskEditorActionPart) {}
  
  public void handleEvent(Event e)
  {
    this$0.getTaskEditorPage().doSubmit();
  }
}

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

import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.monitor.ui.IActivityContextManager;
import org.eclipse.mylyn.monitor.ui.MonitorUi;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.forms.events.HyperlinkAdapter;
import org.eclipse.ui.forms.events.HyperlinkEvent;

class PlanningPart$8
  extends HyperlinkAdapter
{
  PlanningPart$8(PlanningPart paramPlanningPart) {}
  
  public void linkActivated(HyperlinkEvent e)
  {
    if (MessageDialog.openConfirm(this$0.getControl().getShell(), 
      Messages.TaskEditorPlanningPart_Confirm_Activity_Time_Deletion, 
      Messages.TaskEditorPlanningPart_Do_you_wish_to_reset_your_activity_time_on_this_task_)) {
      MonitorUi.getActivityContextManager().removeActivityTime(this$0.getTask().getHandleIdentifier(), 0L, 
        System.currentTimeMillis());
    }
  }
}

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

import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.action.ControlContribution;
import org.eclipse.mylyn.commons.ui.CommonImages;
import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

class TaskPlanningEditor$4
  extends ControlContribution
{
  TaskPlanningEditor$4(TaskPlanningEditor paramTaskPlanningEditor, String $anonymous0)
  {
    super($anonymous0);
  }
  
  protected Control createControl(Composite parent)
  {
    TaskPlanningEditor.access$4(this$0, new Button(parent, 8388608));
    TaskPlanningEditor.access$1(this$0).setText(Messages.TaskPlanningEditor_Save);
    TaskPlanningEditor.access$1(this$0).setImage(CommonImages.getImage(CommonImages.SAVE));
    TaskPlanningEditor.access$1(this$0).setBackground(null);
    TaskPlanningEditor.access$1(this$0).addListener(13, new Listener()
    {
      public void handleEvent(Event e)
      {
        this$0.doSave(new NullProgressMonitor());
      }
    });
    TaskPlanningEditor.access$1(this$0).setEnabled(this$0.getEditor().isDirty());
    
    return TaskPlanningEditor.access$1(this$0);
  }
}

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

import java.io.File;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
import org.eclipse.jface.viewers.IOpenListener;
import org.eclipse.jface.viewers.OpenEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.mylyn.commons.core.CoreUtil;
import org.eclipse.mylyn.commons.ui.CommonImages;
import org.eclipse.mylyn.commons.ui.TableSorter;
import org.eclipse.mylyn.commons.ui.TableViewerSupport;
import org.eclipse.mylyn.commons.workbench.forms.CommonFormUtil;
import org.eclipse.mylyn.internal.tasks.core.TaskAttachment;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.commands.OpenTaskAttachmentHandler;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiMenus;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskKeyComparator;
import org.eclipse.mylyn.internal.tasks.ui.wizards.TaskAttachmentWizard.Mode;
import org.eclipse.mylyn.tasks.core.ITaskAttachment;
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper;
import org.eclipse.mylyn.tasks.core.data.TaskData;
import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
import org.eclipse.mylyn.tasks.ui.TasksUiImages;
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPage;
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPart;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.events.ExpansionAdapter;
import org.eclipse.ui.forms.events.ExpansionEvent;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.forms.widgets.Section;

public class TaskEditorAttachmentPart
  extends AbstractTaskEditorPart
{
  private Action filterDeprecatedAttachmentsAction;
  private int nonDeprecatedCount;
  private Section section;
  private List<ITaskAttachment> attachmentList;
  private TableViewer attachmentsViewer;
  private AttachmentTableFilter tableFilter;
  private Table attachmentsTable;
  private Composite attachmentsComposite;
  private MenuManager menuManager;
  private boolean hasIncoming;
  private List<TaskAttribute> attachmentAttributes;
  
  private class AttachmentTableSorter
    extends TableSorter
  {
    TaskKeyComparator keyComparator = new TaskKeyComparator();
    
    private AttachmentTableSorter() {}
    
    public int compare(TableViewer viewer, Object e1, Object e2, int columnIndex)
    {
      ITaskAttachment attachment1 = (ITaskAttachment)e1;
      ITaskAttachment attachment2 = (ITaskAttachment)e2;
      switch (columnIndex)
      {
      case 0: 
        return CoreUtil.compare(attachment1.getFileName(), attachment2.getFileName());
      case 1: 
        String description1 = attachment1.getDescription();
        String description2 = attachment2.getDescription();
        return CoreUtil.compare(description1, description2);
      case 2: 
        return CoreUtil.compare(Long.valueOf(attachment1.getLength()), Long.valueOf(attachment2.getLength()));
      case 3: 
        return CoreUtil.compare(attachment1.getAuthor().toString(), attachment2.getAuthor().toString());
      case 4: 
        return CoreUtil.compare(attachment1.getCreationDate(), attachment2.getCreationDate());
      case 5: 
        String key1 = AttachmentTableLabelProvider.getAttachmentId(attachment1);
        String key2 = AttachmentTableLabelProvider.getAttachmentId(attachment2);
        return keyComparator.compare2(key1, key2);
      }
      return super.compare(viewer, e1, e2, columnIndex);
    }
  }
  
  private class AttachmentTableFilter
    extends ViewerFilter
  {
    private boolean filterDeprecatedEnabled;
    
    private AttachmentTableFilter() {}
    
    public boolean isFilterDeprecatedEnabled()
    {
      return filterDeprecatedEnabled;
    }
    
    public void setFilterDeprecatedEnabled(boolean filterDeprecatedEnabled)
    {
      this.filterDeprecatedEnabled = filterDeprecatedEnabled;
    }
    
    public boolean select(Viewer viewer, Object parentElement, Object element)
    {
      if ((filterDeprecatedEnabled) && 
        ((element instanceof ITaskAttachment))) {
        return !((ITaskAttachment)element).isDeprecated();
      }
      return true;
    }
  }
  
  public TaskEditorAttachmentPart()
  {
    setPartName(Messages.TaskEditorAttachmentPart_Attachments);
  }
  
  private final int[] attachmentsColumnWidths = { 130, 150, 70, 100, 100 };
  private final String[] attachmentsColumns = { Messages.TaskEditorAttachmentPart_Name, Messages.TaskEditorAttachmentPart_Description, Messages.TaskEditorAttachmentPart_Size, Messages.TaskEditorAttachmentPart_Creator, Messages.TaskEditorAttachmentPart_Created, Messages.TaskEditorAttachmentPart_ID };
  private static final String ID_POPUP_MENU = "org.eclipse.mylyn.tasks.ui.editor.menu.attachments";
  private static final String PREF_FILTER_DEPRECATED = "org.eclipse.mylyn.tasks.ui.editor.attachments.filter.deprecated";
  
  private void createAttachmentTable(FormToolkit toolkit, Composite attachmentsComposite)
  {
    attachmentsTable = toolkit.createTable(attachmentsComposite, 65538);
    attachmentsTable.setLinesVisible(true);
    attachmentsTable.setHeaderVisible(true);
    attachmentsTable.setLayout(new GridLayout());
    GridDataFactory.fillDefaults()
      .align(4, 4)
      .grab(true, false)
      .hint(500, -1)
      .applyTo(attachmentsTable);
    attachmentsTable.setData("FormWidgetFactory.drawBorder", "treeBorder");
    for (int i = 0; i < attachmentsColumns.length; i++)
    {
      TableColumn column = new TableColumn(attachmentsTable, 16384, i);
      column.setText(attachmentsColumns[i]);
      column.setWidth(attachmentsColumnWidths[i]);
      column.setMoveable(true);
      if (i == 4)
      {
        attachmentsTable.setSortColumn(column);
        attachmentsTable.setSortDirection(1024);
      }
    }
    attachmentsTable.getColumn(2).setAlignment(131072);
    
    attachmentsViewer = new TableViewer(attachmentsTable);
    attachmentsViewer.setUseHashlookup(true);
    attachmentsViewer.setColumnProperties(attachmentsColumns);
    ColumnViewerToolTipSupport.enableFor(attachmentsViewer, 2);
    
    attachmentsViewer.setSorter(new AttachmentTableSorter(null));
    
    attachmentsViewer.setContentProvider(new ArrayContentProvider());
    attachmentsViewer.setLabelProvider(new AttachmentTableLabelProvider(getModel(), 
      getTaskEditorPage().getAttributeEditorToolkit()));
    attachmentsViewer.addOpenListener(new IOpenListener()
    {
      public void open(OpenEvent event)
      {
        openAttachments(event);
      }
    });
    attachmentsViewer.addSelectionChangedListener(getTaskEditorPage());
    attachmentsViewer.setInput(attachmentList.toArray());
    
    menuManager = new MenuManager();
    menuManager.setRemoveAllWhenShown(true);
    menuManager.addMenuListener(new IMenuListener()
    {
      public void menuAboutToShow(IMenuManager manager)
      {
        TasksUiMenus.fillTaskAttachmentMenu(manager);
      }
    });
    getTaskEditorPage().getEditorSite().registerContextMenu("org.eclipse.mylyn.tasks.ui.editor.menu.attachments", menuManager, attachmentsViewer, true);
    Menu menu = menuManager.createContextMenu(attachmentsTable);
    attachmentsTable.setMenu(menu);
    
    attachmentsViewer.addFilter(tableFilter);
    
    new TableViewerSupport(attachmentsViewer, getStateFile());
  }
  
  private File getStateFile()
  {
    IPath stateLocation = Platform.getStateLocation(TasksUiPlugin.getDefault().getBundle());
    return stateLocation.append("TaskEditorAttachmentPart.xml").toFile();
  }
  
  private void createButtons(Composite attachmentsComposite, FormToolkit toolkit)
  {
    Composite attachmentControlsComposite = toolkit.createComposite(attachmentsComposite);
    attachmentControlsComposite.setLayout(new GridLayout(2, false));
    attachmentControlsComposite.setLayoutData(new GridData(1));
    
    Button attachFileButton = toolkit.createButton(attachmentControlsComposite, 
      Messages.TaskEditorAttachmentPart_Attach_, 8);
    attachFileButton.setImage(CommonImages.getImage(CommonImages.FILE_PLAIN));
    attachFileButton.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        EditorUtil.openNewAttachmentWizard(getTaskEditorPage(), TaskAttachmentWizard.Mode.DEFAULT, null);
      }
    });
    getTaskEditorPage().registerDefaultDropListener(attachFileButton);
    
    Button attachScreenshotButton = toolkit.createButton(attachmentControlsComposite, 
      Messages.TaskEditorAttachmentPart_Attach__Screenshot, 8);
    attachScreenshotButton.setImage(CommonImages.getImage(CommonImages.IMAGE_CAPTURE));
    attachScreenshotButton.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        EditorUtil.openNewAttachmentWizard(getTaskEditorPage(), TaskAttachmentWizard.Mode.SCREENSHOT, null);
      }
    });
    getTaskEditorPage().registerDefaultDropListener(attachScreenshotButton);
  }
  
  public void createControl(Composite parent, final FormToolkit toolkit)
  {
    initialize();
    
    section = createSection(parent, toolkit, hasIncoming);
    section.setText(getPartName() + " (" + attachmentAttributes.size() + ")");
    if (hasIncoming) {
      expandSection(toolkit, section);
    } else {
      section.addExpansionListener(new ExpansionAdapter()
      {
        public void expansionStateChanged(ExpansionEvent event)
        {
          if (attachmentsComposite == null)
          {
            TaskEditorAttachmentPart.this.expandSection(toolkit, section);
            getTaskEditorPage().reflow();
          }
        }
      });
    }
    setSection(toolkit, section);
  }
  
  private void expandSection(FormToolkit toolkit, Section section)
  {
    attachmentsComposite = toolkit.createComposite(section);
    attachmentsComposite.setLayout(EditorUtil.createSectionClientLayout());
    attachmentsComposite.setLayoutData(new GridData(1808));
    
    getTaskEditorPage().registerDefaultDropListener(section);
    if (attachmentAttributes.size() > 0)
    {
      createAttachmentTable(toolkit, attachmentsComposite);
    }
    else
    {
      Label label = toolkit.createLabel(attachmentsComposite, Messages.TaskEditorAttachmentPart_No_attachments);
      getTaskEditorPage().registerDefaultDropListener(label);
    }
    createButtons(attachmentsComposite, toolkit);
    
    toolkit.paintBordersFor(attachmentsComposite);
    section.setClient(attachmentsComposite);
  }
  
  public void dispose()
  {
    if (menuManager != null) {
      menuManager.dispose();
    }
    super.dispose();
  }
  
  private void initialize()
  {
    attachmentAttributes = getTaskData().getAttributeMapper().getAttributesByType(getTaskData(), 
      "attachment");
    attachmentList = new ArrayList(attachmentAttributes.size());
    for (TaskAttribute attribute : attachmentAttributes)
    {
      if (getModel().hasIncomingChanges(attribute)) {
        hasIncoming = true;
      }
      TaskAttachment taskAttachment = new TaskAttachment(getModel().getTaskRepository(), getModel().getTask(), 
        attribute);
      getTaskData().getAttributeMapper().updateTaskAttachment(taskAttachment, attribute);
      attachmentList.add(taskAttachment);
      if (!taskAttachment.isDeprecated()) {
        nonDeprecatedCount += 1;
      }
    }
    tableFilter = new AttachmentTableFilter(null);
  }
  
  protected void fillToolBar(ToolBarManager toolBarManager)
  {
    filterDeprecatedAttachmentsAction = new Action("", 2)
    {
      public void run()
      {
        TasksUiPlugin.getDefault().getPreferenceStore().setValue("org.eclipse.mylyn.tasks.ui.editor.attachments.filter.deprecated", isChecked());
        filterDeprecated(isChecked());
      }
    };
    filterDeprecatedAttachmentsAction.setImageDescriptor(TasksUiImages.FILTER_OBSOLETE_SMALL);
    filterDeprecatedAttachmentsAction.setToolTipText(Messages.TaskEditorAttachmentPart_Hide_Obsolete_Tooltip);
    if ((nonDeprecatedCount > 0) && (nonDeprecatedCount < attachmentAttributes.size())) {
      filterDeprecated(TasksUiPlugin.getDefault().getPreferenceStore().getBoolean("org.eclipse.mylyn.tasks.ui.editor.attachments.filter.deprecated"));
    } else {
      filterDeprecatedAttachmentsAction.setEnabled(false);
    }
    toolBarManager.add(filterDeprecatedAttachmentsAction);
    
    Action attachFileAction = new Action()
    {
      public void run()
      {
        EditorUtil.openNewAttachmentWizard(getTaskEditorPage(), TaskAttachmentWizard.Mode.DEFAULT, null);
      }
    };
    attachFileAction.setToolTipText(Messages.TaskEditorAttachmentPart_Attach_);
    attachFileAction.setImageDescriptor(TasksUiImages.FILE_NEW_SMALL);
    toolBarManager.add(attachFileAction);
  }
  
  private void updateSectionTitle()
  {
    if (tableFilter.isFilterDeprecatedEnabled()) {
      section.setText(NLS.bind(Messages.TaskEditorAttachmentPart_Attachment_Section_Title_X_of_Y, new Object[] {
        getPartName(), Integer.valueOf(nonDeprecatedCount), Integer.valueOf(attachmentAttributes.size()) }));
    } else {
      section.setText(NLS.bind(Messages.TaskEditorAttachmentPart_Attachment_Section_Title_X, getPartName(), 
        Integer.valueOf(attachmentAttributes.size())));
    }
  }
  
  protected void openAttachments(OpenEvent event)
  {
    List<ITaskAttachment> attachments = new ArrayList();
    
    StructuredSelection selection = (StructuredSelection)event.getSelection();
    
    List<?> items = selection.toList();
    for (Object item : items) {
      if ((item instanceof ITaskAttachment)) {
        attachments.add((ITaskAttachment)item);
      }
    }
    if (attachments.isEmpty()) {
      return;
    }
    IWorkbenchPage page = getTaskEditorPage().getSite().getWorkbenchWindow().getActivePage();
    try
    {
      OpenTaskAttachmentHandler.openAttachments(page, attachments);
    }
    catch (OperationCanceledException localOperationCanceledException) {}
  }
  
  public boolean setFormInput(Object input)
  {
    if ((input instanceof String))
    {
      String text = (String)input;
      if (attachmentAttributes != null) {
        for (ITaskAttachment attachment : attachmentList) {
          if (text.equals(attachment.getTaskAttribute().getId()))
          {
            CommonFormUtil.setExpanded((ExpandableComposite)getControl(), true);
            return selectReveal(attachment);
          }
        }
      }
    }
    return super.setFormInput(input);
  }
  
  private boolean selectReveal(ITaskAttachment attachment)
  {
    if ((attachment == null) || (attachmentsTable == null)) {
      return false;
    }
    if ((tableFilter.isFilterDeprecatedEnabled()) && (attachment.isDeprecated())) {
      filterDeprecated(false);
    }
    attachmentsViewer.setSelection(new StructuredSelection(attachment));
    
    IManagedForm mform = getManagedForm();
    ScrolledForm form = mform.getForm();
    EditorUtil.focusOn(form, attachmentsTable);
    
    return true;
  }
  
  void filterDeprecated(boolean filter)
  {
    if (filterDeprecatedAttachmentsAction.isChecked() != filter) {
      filterDeprecatedAttachmentsAction.setChecked(filter);
    }
    tableFilter.setFilterDeprecatedEnabled(filter);
    if (attachmentsViewer != null)
    {
      attachmentsViewer.refresh();
      getTaskEditorPage().reflow();
    }
    updateSectionTitle();
  }
}

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

import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

class EditorUtil$6
  implements Listener
{
  EditorUtil$6(CCombo paramCCombo) {}
  
  public void handleEvent(Event event)
  {
    if (keyCode == 16777217) {
      EditorUtil.access$0(val$combo, event);
    } else if (keyCode == 16777218) {
      EditorUtil.access$1(val$combo, event);
    }
  }
}

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

import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.Status;
import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.internal.tasks.core.TaskList;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.tasks.core.IRepositoryManager;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.TasksUi;
import org.eclipse.mylyn.tasks.ui.editors.TaskEditorInput;
import org.eclipse.ui.IElementFactory;
import org.eclipse.ui.IMemento;

public class TaskEditorInputFactory
  implements IElementFactory
{
  public static final String TAG_TASK_HANDLE = "taskHandle";
  public static final String ID_FACTORY = "org.eclipse.mylyn.tasks.ui.elementFactories.task.editor";
  
  public IAdaptable createElement(IMemento memento)
  {
    String handle = memento.getString("taskHandle");
    AbstractTask task = TasksUiPlugin.getTaskList().getTask(handle);
    if (task != null)
    {
      TaskRepository taskRepository = TasksUi.getRepositoryManager().getRepository(task.getConnectorKind(), 
        task.getRepositoryUrl());
      if (taskRepository != null) {
        return new TaskEditorInput(taskRepository, task);
      }
      StatusHandler.log(new Status(2, "org.eclipse.mylyn.tasks.ui", "Repository for connector kind " + 
        task.getConnectorKind() + " with url " + task.getRepositoryUrl() + " cannont be found."));
    }
    else
    {
      StatusHandler.log(new Status(2, "org.eclipse.mylyn.tasks.ui", 
        "Failed to restore task editor: Task with handle \"" + handle + 
        "\" could not be found in task list."));
    }
    return null;
  }
  
  public static void saveState(IMemento memento, TaskEditorInput input)
  {
    if (input.getTask() != null) {
      memento.putString("taskHandle", input.getTask().getHandleIdentifier());
    }
  }
}

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

import org.apache.commons.lang.StringUtils;
import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.swt.widgets.Text;

class IntegerAttributeEditor$1
  implements IInputValidator
{
  IntegerAttributeEditor$1(IntegerAttributeEditor paramIntegerAttributeEditor) {}
  
  public String isValid(String newText)
  {
    if (StringUtils.isNotBlank(newText)) {
      try
      {
        Integer.parseInt(this$0.getText().getText());
      }
      catch (NumberFormatException localNumberFormatException)
      {
        return Messages.IntegerAttributeEditor_this_field_requires_integer_value;
      }
    }
    return null;
  }
}

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

import org.eclipse.jface.action.Action;
import org.eclipse.mylyn.internal.tasks.ui.commands.ViewSourceHandler;
import org.eclipse.swt.custom.StackLayout;

public class RichTextEditor$ViewSourceAction
  extends Action
{
  public RichTextEditor$ViewSourceAction(RichTextEditor paramRichTextEditor)
  {
    super(Messages.RichTextAttributeEditor_Viewer_Source, 2);
    setChecked(false);
    setEnabled(false);
  }
  
  public void run()
  {
    if (isChecked()) {
      this$0.showDefault();
    } else {
      this$0.showEditor();
    }
    if (RichTextEditor.access$0(this$0) != null) {
      EditorUtil.reflow(access$0this$0).topControl);
    }
    ViewSourceHandler.setChecked(isChecked());
  }
}

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

import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.TaskRepository;

class RepositoryTextViewerConfiguration$1
  implements IAdaptable
{
  RepositoryTextViewerConfiguration$1(RepositoryTextViewerConfiguration paramRepositoryTextViewerConfiguration) {}
  
  public Object getAdapter(Class adapter)
  {
    if (adapter == TaskRepository.class) {
      return this$0.getTaskRepository();
    }
    if (adapter == ITask.class) {
      return this$0.getTask();
    }
    return null;
  }
}

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

import java.util.Comparator;
import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor;
import org.eclipse.mylyn.tasks.ui.editors.LayoutHint;

class AbstractTaskEditorAttributeSection$1
  implements Comparator<AbstractAttributeEditor>
{
  AbstractTaskEditorAttributeSection$1(AbstractTaskEditorAttributeSection paramAbstractTaskEditorAttributeSection) {}
  
  public int compare(AbstractAttributeEditor o1, AbstractAttributeEditor o2)
  {
    int p1 = o1.getLayoutHint() != null ? o1.getLayoutHint().getPriority() : 10;
    int p2 = o2.getLayoutHint() != null ? o2.getLayoutHint().getPriority() : 10;
    return p1 - p2;
  }
}

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

import java.text.DateFormat;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.text.ITextListener;
import org.eclipse.jface.text.TextEvent;
import org.eclipse.jface.text.source.SourceViewer;
import org.eclipse.mylyn.commons.workbench.editors.CommonTextSupport;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.internal.tasks.core.LocalRepositoryConnector;
import org.eclipse.mylyn.internal.tasks.core.LocalTask;
import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt
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