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

 code offset #54
            //   Java source line #158	-> byte code offset #57
            //   Java source line #162	-> byte code offset #60
            //   Java source line #164	-> byte code offset #73
            //   Java source line #165	-> byte code offset #87
            //   Java source line #166	-> byte code offset #106
            //   Java source line #167	-> byte code offset #120
            //   Java source line #168	-> byte code offset #121
            //   Java source line #169	-> byte code offset #135
            //   Java source line #168	-> byte code offset #137
            //   Java source line #170	-> byte code offset #151
            //   Java source line #172	-> byte code offset #164
            // Local variable table:
            //   start	length	slot	name	signature
            //   0	165	0	this	3
            //   0	165	1	e	ExpansionEvent
            //   105	9	2	composite	Composite
            //   120	16	3	localObject	Object
            // Exception table:
            //   from	to	target	type
            //   73	120	120	finally
          }
        });
      }
      return groupSection;
    }
    
    public List<TaskEditorCommentPart.CommentViewer> getCommentViewers()
    {
      if (commentViewers != null) {
        return commentViewers;
      }
      commentViewers = new ArrayList(commentGroup.getCommentAttributes().size());
      for (TaskAttribute commentAttribute : commentGroup.getCommentAttributes())
      {
        TaskEditorCommentPart.CommentViewer commentViewer = new TaskEditorCommentPart.CommentViewer(TaskEditorCommentPart.this, commentAttribute);
        commentViewers.add(commentViewer);
      }
      return commentViewers;
    }
    
    public boolean isExpanded()
    {
      if (groupSection != null) {
        return groupSection.isExpanded();
      }
      if (commentViewers != null) {
        for (TaskEditorCommentPart.CommentViewer commentViewer : commentViewers) {
          if (commentViewer.isExpanded()) {
            return true;
          }
        }
      }
      return false;
    }
    
    public boolean isFullyExpanded()
    {
      if ((groupSection != null) && (!groupSection.isExpanded())) {
        return false;
      }
      if (commentViewers != null)
      {
        for (TaskEditorCommentPart.CommentViewer commentViewer : commentViewers) {
          if (!commentViewer.isExpanded()) {
            return false;
          }
        }
        return true;
      }
      return false;
    }
    
    public boolean isRenderedInSubSection()
    {
      return renderedInSubSection;
    }
    
    public void setExpanded(boolean expanded)
    {
      if ((groupSection != null) && (groupSection.isExpanded() != expanded)) {
        CommonFormUtil.setExpanded(groupSection, expanded);
      }
    }
    
    public void setFullyExpanded(boolean expanded)
    {
      if ((groupSection != null) && (groupSection.isExpanded() != expanded)) {
        CommonFormUtil.setExpanded(groupSection, expanded);
      }
      if (commentViewers != null) {
        for (TaskEditorCommentPart.CommentViewer commentViewer : commentViewers) {
          commentViewer.setExpanded(expanded);
        }
      }
    }
    
    public void setRenderedInSubSection(boolean renderedInSubSection)
    {
      this.renderedInSubSection = renderedInSubSection;
    }
  }
  
  protected class CommentViewer
  {
    private Composite buttonComposite;
    private final TaskAttribute commentAttribute;
    private ExpandableComposite commentComposite;
    private final TaskComment taskComment;
    private AbstractAttributeEditor editor;
    
    public CommentViewer(TaskAttribute commentAttribute)
    {
      this.commentAttribute = commentAttribute;
      taskComment = new TaskComment(getModel().getTaskRepository(), getModel().getTask(), commentAttribute);
    }
    
    public Control createControl(Composite composite, final FormToolkit toolkit)
    {
      boolean hasIncomingChanges = getModel().hasIncomingChanges(commentAttribute);
      getTaskData().getAttributeMapper().updateTaskComment(taskComment, commentAttribute);
      int style = 8228;
      if ((hasIncomingChanges) || ((expandAllInProgress) && (!suppressExpandViewers))) {
        style |= 0x40;
      }
      commentComposite = toolkit.createExpandableComposite(composite, style);
      commentComposite.clientVerticalSpacing = 0;
      commentComposite.setLayout(new GridLayout());
      commentComposite.setLayoutData(new GridData(768));
      commentComposite.setTitleBarForeground(toolkit.getColors().getColor("org.eclipse.ui.forms.TITLE"));
      
      buttonComposite = createTitle(commentComposite, toolkit);
      
      final Composite commentTextComposite = toolkit.createComposite(commentComposite);
      commentComposite.setClient(commentTextComposite);
      commentTextComposite.setLayout(new FillWidthLayout(EditorUtil.getLayoutAdvisor(getTaskEditorPage()), 15, 0, 
        0, 3));
      commentComposite.addExpansionListener(new ExpansionAdapter()
      {
        public void expansionStateChanged(ExpansionEvent event)
        {
          TaskEditorCommentPart.CommentViewer.this.expandComment(toolkit, commentTextComposite, event.getState());
        }
      });
      if (hasIncomingChanges) {
        commentComposite.setBackground(getTaskEditorPage().getAttributeEditorToolkit().getColorIncoming());
      }
      if (commentComposite.isExpanded()) {
        expandComment(toolkit, commentTextComposite, true);
      }
      EditorUtil.setMarker(commentComposite, commentAttribute.getId());
      return commentComposite;
    }
    
    private Composite createTitle(final ExpandableComposite commentComposite, FormToolkit toolkit)
    {
      Composite titleComposite = toolkit.createComposite(commentComposite);
      commentComposite.setTextClient(titleComposite);
      RowLayout rowLayout = new RowLayout();
      pack = true;
      marginLeft = 0;
      marginBottom = 0;
      marginTop = 0;
      EditorUtil.center(rowLayout);
      titleComposite.setLayout(rowLayout);
      titleComposite.setBackground(null);
      
      ImageHyperlink expandCommentHyperlink = createTitleHyperLink(toolkit, titleComposite, taskComment);
      expandCommentHyperlink.addHyperlinkListener(new HyperlinkAdapter()
      {
        public void linkActivated(HyperlinkEvent e)
        {
          CommonFormUtil.setExpanded(commentComposite, !commentComposite.isExpanded());
        }
      });
      ToolBarManager toolBarManagerTitle = new ToolBarManager(8388608);
      addActionsToToolbarTitle(toolBarManagerTitle, taskComment, this);
      toolBarManagerTitle.createControl(titleComposite);
      
      Composite buttonComposite = toolkit.createComposite(titleComposite);
      RowLayout buttonCompLayout = new RowLayout();
      marginBottom = 0;
      marginTop = 0;
      buttonComposite.setLayout(buttonCompLayout);
      buttonComposite.setBackground(null);
      buttonComposite.setVisible(commentComposite.isExpanded());
      
      ToolBarManager toolBarManagerButton = new ToolBarManager(8388608);
      addActionsToToolbarButton(toolBarManagerButton, taskComment, this);
      toolBarManagerButton.createControl(buttonComposite);
      
      return buttonComposite;
    }
    
    private ImageHyperlink createTitleHyperLink(FormToolkit toolkit, Composite toolbarComp, ITaskComment taskComment)
    {
      ImageHyperlink formHyperlink = toolkit.createImageHyperlink(toolbarComp, 0);
      formHyperlink.setBackground(null);
      formHyperlink.setForeground(toolkit.getColors().getColor("org.eclipse.ui.forms.TITLE"));
      IRepositoryPerson author = taskComment.getAuthor();
      if ((author != null) && 
        (author.getPersonId().equalsIgnoreCase(getTaskEditorPage().getTaskRepository().getUserName()))) {
        formHyperlink.setImage(CommonImages.getImage(CommonImages.PERSON_ME_NARROW));
      } else {
        formHyperlink.setImage(CommonImages.getImage(CommonImages.PERSON_NARROW));
      }
      StringBuilder sb = new StringBuilder();
      if (taskComment.getNumber() >= 0)
      {
        sb.append(taskComment.getNumber());
        sb.append(": ");
      }
      String toolTipText = "";
      if (author != null) {
        if (author.getName() != null)
        {
          sb.append(author.getName());
          toolTipText = author.getPersonId();
        }
        else
        {
          sb.append(author.getPersonId());
        }
      }
      if (taskComment.getCreationDate() != null)
      {
        sb.append(", ");
        sb.append(EditorUtil.formatDateTime(taskComment.getCreationDate()));
      }
      formHyperlink.setFont(commentComposite.getFont());
      formHyperlink.setToolTipText(toolTipText);
      formHyperlink.setText(sb.toString());
      formHyperlink.setEnabled(true);
      formHyperlink.setUnderlined(false);
      return formHyperlink;
    }
    
    private void expandComment(FormToolkit toolkit, Composite composite, boolean expanded)
    {
      buttonComposite.setVisible(expanded);
      if ((expanded) && (composite.getData("viewer") == null))
      {
        TaskAttribute textAttribute = getTaskData().getAttributeMapper().getAssoctiatedAttribute(
          taskComment.getTaskAttribute());
        this.editor = createAttributeEditor(textAttribute);
        if (this.editor != null)
        {
          this.editor.setDecorationEnabled(false);
          this.editor.createControl(composite, toolkit);
          this.editor.getControl().addMouseListener(new MouseAdapter()
          {
            public void mouseDown(MouseEvent e)
            {
              getTaskEditorPage().selectionChanged(taskComment);
            }
          });
          composite.setData("viewer", this.editor);
          
          getTaskEditorPage().getAttributeEditorToolkit().adapt(this.editor);
          getTaskEditorPage().reflow();
        }
      }
      else if ((!expanded) && (composite.getData("viewer") != null))
      {
        AbstractAttributeEditor editor = (AbstractAttributeEditor)composite.getData("viewer");
        editor.getControl().setMenu(null);
        editor.getControl().dispose();
        composite.setData("viewer", null);
        getTaskEditorPage().reflow();
      }
      getTaskEditorPage().selectionChanged(taskComment);
    }
    
    public boolean isExpanded()
    {
      return (commentComposite != null) && (commentComposite.isExpanded());
    }
    
    public void setExpanded(boolean expanded)
    {
      if ((commentComposite != null) && (commentComposite.isExpanded() != expanded)) {
        CommonFormUtil.setExpanded(commentComposite, expanded);
      }
    }
    
    public AbstractAttributeEditor getEditor()
    {
      return editor;
    }
    
    public TaskAttribute getTaskAttribute()
    {
      return commentAttribute;
    }
    
    public TaskComment getTaskComment()
    {
      return taskComment;
    }
    
    public Control getControl()
    {
      return commentComposite;
    }
  }
  
  private class ReplyToCommentAction
    extends AbstractReplyToCommentAction
    implements IMenuCreator
  {
    private final ITaskComment taskComment;
    private final TaskEditorCommentPart.CommentViewer commentViewer;
    
    public ReplyToCommentAction(TaskEditorCommentPart.CommentViewer commentViewer, ITaskComment taskComment)
    {
      super(taskComment);
      this.commentViewer = commentViewer;
      this.taskComment = taskComment;
      setMenuCreator(this);
    }
    
    protected String getReplyText()
    {
      return taskComment.getText();
    }
    
    public Menu getMenu(Control parent)
    {
      currentViewer = commentViewer;
      selectionProvider.setSelection(new StructuredSelection(taskComment));
      return commentMenu;
    }
    
    public void dispose() {}
    
    public Menu getMenu(Menu parent)
    {
      selectionProvider.setSelection(new StructuredSelection(taskComment));
      return commentMenu;
    }
  }
  
  public TaskEditorCommentPart()
  {
    commentGroupStrategy = new CommentGroupStrategy()
    {
      protected boolean hasIncomingChanges(ITaskComment taskComment)
      {
        return getModel().hasIncomingChanges(taskComment.getTaskAttribute());
      }
    };
    setPartName(Messages.TaskEditorCommentPart_Comments);
  }
  
  protected void addActionsToToolbarButton(ToolBarManager toolBarManager, TaskComment taskComment, CommentViewer commentViewer)
  {
    ReplyToCommentAction replyAction = new ReplyToCommentAction(commentViewer, taskComment);
    replyAction.setImageDescriptor(TasksUiImages.COMMENT_REPLY_SMALL);
    toolBarManager.add(replyAction);
  }
  
  protected void addActionsToToolbarTitle(ToolBarManager toolBarManager, TaskComment taskComment, CommentViewer commentViewer) {}
  
  /* Error */
  private void collapseAllComments()
  {
    // Byte code:
    //   0: aload_0
    //   1: invokevirtual 480	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart:getTaskEditorPage	()Lorg/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage;
    //   4: iconst_0
    //   5: invokevirtual 515	org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage:setReflow	(Z)V
    //   8: aload_0
    //   9: invokespecial 476	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart:getCommentGroupViewers	()Ljava/util/List;
    //   12: astore_1
    //   13: iconst_0
    //   14: istore_2
    //   15: goto +50 -> 65
    //   18: aload_1
    //   19: iload_2
    //   20: invokeinterface 532 2 0
    //   25: checkcast 219	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart$CommentGroupViewer
    //   28: invokevirtual 492	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart$CommentGroupViewer:isExpanded	()Z
    //   31: ifeq +31 -> 62
    //   34: aload_1
    //   35: iload_2
    //   36: invokeinterface 532 2 0
    //   41: checkcast 219	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart$CommentGroupViewer
    //   44: iconst_0
    //   45: invokevirtual 496	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart$CommentGroupViewer:setFullyExpanded	(Z)V
    //   48: aload_1
    //   49: iload_2
    //   50: invokeinterface 532 2 0
    //   55: checkcast 219	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart$CommentGroupViewer
    //   58: invokevirtual 494	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart$CommentGroupViewer:isRenderedInSubSection	()Z
    //   61: pop
    //   62: iinc 2 1
    //   65: iload_2
    //   66: aload_1
    //   67: invokeinterface 530 1 0
    //   72: if_icmplt -54 -> 18
    //   75: goto +14 -> 89
    //   78: astore_3
    //   79: aload_0
    //   80: invokevirtual 480	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart:getTaskEditorPage	()Lorg/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage;
    //   83: iconst_1
    //   84: invokevirtual 515	org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage:setReflow	(Z)V
    //   87: aload_3
    //   88: athrow
    //   89: aload_0
    //   90: invokevirtual 480	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart:getTaskEditorPage	()Lorg/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage;
    //   93: iconst_1
    //   94: invokevirtual 515	org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage:setReflow	(Z)V
    //   97: aload_0
    //   98: invokevirtual 480	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart:getTaskEditorPage	()Lorg/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage;
    //   101: invokevirtual 514	org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage:reflow	()V
    //   104: return
    // Line number table:
    //   Java source line #580	-> byte code offset #0
    //   Java source line #584	-> byte code offset #8
    //   Java source line #585	-> byte code offset #13
    //   Java source line #586	-> byte code offset #18
    //   Java source line #587	-> byte code offset #34
    //   Java source line #588	-> byte code offset #48
    //   Java source line #585	-> byte code offset #62
    //   Java source line #598	-> byte code offset #78
    //   Java source line #599	-> byte code offset #79
    //   Java source line #600	-> byte code offset #87
    //   Java source line #599	-> byte code offset #89
    //   Java source line #601	-> byte code offset #97
    //   Java source line #602	-> byte code offset #104
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	105	0	this	TaskEditorCommentPart
    //   12	55	1	viewers	List<CommentGroupViewer>
    //   14	52	2	i	int
    //   78	10	3	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   0	78	78	finally
  }
  
  private TaskComment convertToTaskComment(TaskDataModel taskDataModel, TaskAttribute commentAttribute)
  {
    TaskComment taskComment = new TaskComment(taskDataModel.getTaskRepository(), taskDataModel.getTask(), 
      commentAttribute);
    taskDataModel.getTaskData().getAttributeMapper().updateTaskComment(taskComment, commentAttribute);
    return taskComment;
  }
  
  public void createControl(Composite parent, final FormToolkit toolkit)
  {
    initialize();
    
    selectionProvider = new SelectionProviderAdapter();
    actionGroup = new CommentActionGroup();
    
    MenuManager menuManager = new MenuManager();
    menuManager.setRemoveAllWhenShown(true);
    menuManager.addMenuListener(new IMenuListener()
    {
      public void menuAboutToShow(IMenuManager manager)
      {
        ISelection selection = selectionProvider.getSelection();
        if (((selection instanceof IStructuredSelection)) && (!selection.isEmpty()))
        {
          Object element = ((IStructuredSelection)selection).getFirstElement();
          if ((element instanceof ITaskComment))
          {
            final ITaskComment comment = (ITaskComment)element;
            AbstractReplyToCommentAction replyAction = new AbstractReplyToCommentAction(
              getTaskEditorPage(), comment)
              {
                protected String getReplyText()
                {
                  return comment.getText();
                }
              };
              manager.add(replyAction);
            }
          }
          actionGroup.setContext(new ActionContext(selectionProvider.getSelection()));
          actionGroup.fillContextMenu(manager);
          if ((currentViewer != null) && ((currentViewer.getEditor() instanceof RichTextAttributeEditor)))
          {
            RichTextAttributeEditor editor = (RichTextAttributeEditor)currentViewer.getEditor();
            if (editor.getViewSourceAction().isEnabled())
            {
              manager.add(new Separator("planning"));
              manager.add(editor.getViewSourceAction());
            }
          }
        }
      });
    getTaskEditorPage().getEditorSite().registerContextMenu("org.eclipse.mylyn.tasks.ui.editor.menu.comments", menuManager, selectionProvider, false);
    commentMenu = menuManager.createContextMenu(parent);
    
    section = createSection(parent, toolkit, hasIncoming);
    section.setText(section.getText() + " (" + commentAttributes.size() + ")");
    if (commentAttributes.isEmpty()) {
      section.setEnabled(false);
    } else if (hasIncoming) {
      expandSection(toolkit, section);
    } else {
      section.addExpansionListener(new ExpansionAdapter()
      {
        /* Error */
        public void expansionStateChanged(ExpansionEvent event)
        {
          // Byte code:
          //   0: aload_0
          //   1: getfield 51	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart$3:this$0	Lorg/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart;
          //   4: getfield 50	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart:section	Lorg/eclipse/ui/forms/widgets/Section;
          //   7: invokevirtual 59	org/eclipse/ui/forms/widgets/Section:getClient	()Lorg/eclipse/swt/widgets/Control;
          //   10: ifnonnull +94 -> 104
          //   13: aload_0
          //   14: getfield 51	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart$3:this$0	Lorg/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart;
          //   17: iconst_1
          //   18: invokestatic 53	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart:access$9	(Lorg/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart;Z)V
          //   21: aload_0
          //   22: getfield 51	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart$3:this$0	Lorg/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart;
          //   25: invokevirtual 54	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart:getTaskEditorPage	()Lorg/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage;
          //   28: iconst_0
          //   29: invokevirtual 57	org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage:setReflow	(Z)V
          //   32: aload_0
          //   33: getfield 51	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart$3:this$0	Lorg/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart;
          //   36: aload_0
          //   37: getfield 52	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart$3:val$toolkit	Lorg/eclipse/ui/forms/widgets/FormToolkit;
          //   40: aload_0
          //   41: getfield 51	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart$3:this$0	Lorg/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart;
          //   44: getfield 50	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart:section	Lorg/eclipse/ui/forms/widgets/Section;
          //   47: invokestatic 55	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart:access$10	(Lorg/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart;Lorg/eclipse/ui/forms/widgets/FormToolkit;Lorg/eclipse/ui/forms/widgets/Section;)V
          //   50: goto +25 -> 75
          //   53: astore_2
          //   54: aload_0
          //   55: getfield 51	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart$3:this$0	Lorg/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart;
          //   58: iconst_0
          //   59: invokestatic 53	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart:access$9	(Lorg/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart;Z)V
          //   62: aload_0
          //   63: getfield 51	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart$3:this$0	Lorg/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart;
          //   66: invokevirtual 54	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart:getTaskEditorPage	()Lorg/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage;
          //   69: iconst_1
          //   70: invokevirtual 57	org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage:setReflow	(Z)V
          //   73: aload_2
          //   74: athrow
          //   75: aload_0
          //   76: getfield 51	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart$3:this$0	Lorg/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart;
          //   79: iconst_0
          //   80: invokestatic 53	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart:access$9	(Lorg/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart;Z)V
          //   83: aload_0
          //   84: getfield 51	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart$3:this$0	Lorg/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart;
          //   87: invokevirtual 54	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart:getTaskEditorPage	()Lorg/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage;
          //   90: iconst_1
          //   91: invokevirtual 57	org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage:setReflow	(Z)V
          //   94: aload_0
          //   95: getfield 51	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart$3:this$0	Lorg/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart;
          //   98: invokevirtual 54	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart:getTaskEditorPage	()Lorg/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage;
          //   101: invokevirtual 56	org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage:reflow	()V
          //   104: return
          // Line number table:
          //   Java source line #665	-> byte code offset #0
          //   Java source line #667	-> byte code offset #13
          //   Java source line #668	-> byte code offset #21
          //   Java source line #670	-> byte code offset #32
          //   Java source line #671	-> byte code offset #53
          //   Java source line #672	-> byte code offset #54
          //   Java source line #673	-> byte code offset #62
          //   Java source line #674	-> byte code offset #73
          //   Java source line #672	-> byte code offset #75
          //   Java source line #673	-> byte code offset #83
          //   Java source line #675	-> byte code offset #94
          //   Java source line #677	-> byte code offset #104
          // Local variable table:
          //   start	length	slot	name	signature
          //   0	105	0	this	3
          //   0	105	1	event	ExpansionEvent
          //   53	21	2	localObject	Object
          // Exception table:
          //   from	to	target	type
          //   13	53	53	finally
        }
      });
    }
    setSection(toolkit, section);
  }
  
  public void dispose()
  {
    super.dispose();
    if (actionGroup != null) {
      actionGroup.dispose();
    }
  }
  
  /* Error */
  private void expandAllComments(boolean expandViewers)
  {
    // Byte code:
    //   0: aload_0
    //   1: iconst_1
    //   2: putfield 432	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart:expandAllInProgress	Z
    //   5: aload_0
    //   6: iload_1
    //   7: ifeq +7 -> 14
    //   10: iconst_0
    //   11: goto +4 -> 15
    //   14: iconst_1
    //   15: putfield 434	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart:suppressExpandViewers	Z
    //   18: aload_0
    //   19: invokevirtual 480	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart:getTaskEditorPage	()Lorg/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage;
    //   22: iconst_0
    //   23: invokevirtual 515	org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage:setReflow	(Z)V
    //   26: aload_0
    //   27: getfield 442	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart:section	Lorg/eclipse/ui/forms/widgets/Section;
    //   30: ifnull +95 -> 125
    //   33: aload_0
    //   34: getfield 442	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart:section	Lorg/eclipse/ui/forms/widgets/Section;
    //   37: iconst_1
    //   38: invokestatic 465	org/eclipse/mylyn/commons/workbench/forms/CommonFormUtil:setExpanded	(Lorg/eclipse/ui/forms/widgets/ExpandableComposite;Z)V
    //   41: iload_1
    //   42: ifeq +83 -> 125
    //   45: aload_0
    //   46: invokespecial 476	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart:getCommentGroupViewers	()Ljava/util/List;
    //   49: astore_2
    //   50: aload_2
    //   51: invokeinterface 530 1 0
    //   56: iconst_1
    //   57: isub
    //   58: istore_3
    //   59: goto +36 -> 95
    //   62: aload_2
    //   63: iload_3
    //   64: invokeinterface 532 2 0
    //   69: checkcast 219	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart$CommentGroupViewer
    //   72: invokevirtual 493	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart$CommentGroupViewer:isFullyExpanded	()Z
    //   75: ifne +17 -> 92
    //   78: aload_2
    //   79: iload_3
    //   80: invokeinterface 532 2 0
    //   85: checkcast 219	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart$CommentGroupViewer
    //   88: iconst_1
    //   89: invokevirtual 496	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart$CommentGroupViewer:setFullyExpanded	(Z)V
    //   92: iinc 3 -1
    //   95: iload_3
    //   96: ifge -34 -> 62
    //   99: goto +26 -> 125
    //   102: astore 4
    //   104: aload_0
    //   105: iconst_0
    //   106: putfield 432	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart:expandAllInProgress	Z
    //   109: aload_0
    //   110: iconst_0
    //   111: putfield 434	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart:suppressExpandViewers	Z
    //   114: aload_0
    //   115: invokevirtual 480	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart:getTaskEditorPage	()Lorg/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage;
    //   118: iconst_1
    //   119: invokevirtual 515	org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage:setReflow	(Z)V
    //   122: aload 4
    //   124: athrow
    //   125: aload_0
    //   126: iconst_0
    //   127: putfield 432	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart:expandAllInProgress	Z
    //   130: aload_0
    //   131: iconst_0
    //   132: putfield 434	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart:suppressExpandViewers	Z
    //   135: aload_0
    //   136: invokevirtual 480	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart:getTaskEditorPage	()Lorg/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage;
    //   139: iconst_1
    //   140: invokevirtual 515	org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage:setReflow	(Z)V
    //   143: aload_0
    //   144: invokevirtual 480	org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart:getTaskEditorPage	()Lorg/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage;
    //   147: invokevirtual 514	org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage:reflow	()V
    //   150: return
    // Line number table:
    //   Java source line #694	-> byte code offset #0
    //   Java source line #695	-> byte code offset #5
    //   Java source line #696	-> byte code offset #18
    //   Java source line #698	-> byte code offset #26
    //   Java source line #703	-> byte code offset #33
    //   Java source line #705	-> byte code offset #41
    //   Java source line #706	-> byte code offset #45
    //   Java source line #707	-> byte code offset #50
    //   Java source line #708	-> byte code offset #62
    //   Java source line #709	-> byte code offset #78
    //   Java source line #707	-> byte code offset #92
    //   Java source line #714	-> byte code offset #102
    //   Java source line #715	-> byte code offset #104
    //   Java source line #716	-> byte code offset #109
    //   Java source line #717	-> byte code offset #114
    //   Java source line #718	-> byte code offset #122
    //   Java source line #715	-> byte code offset #125
    //   Java source line #716	-> byte code offset #130
    //   Java source line #717	-> byte code offset #135
    //   Java source line #719	-> byte code offset #143
    //   Java source line #720	-> byte code offset #150
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	151	0	this	TaskEditorCommentPart
    //   0	151	1	expandViewers	boolean
    //   49	30	2	groupViewers	List<CommentGroupViewer>
    //   58	38	3	i	int
    //   102	21	4	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   0	102	102	finally
  }
  
  private void expandSection(FormToolkit toolkit, Section section)
  {
    Composite composite = toolkit.createComposite(section);
    section.setClient(composite);
    composite.setLayout(EditorUtil.createSectionClientLayout());
    
    List<CommentGroupViewer> viewers = getCommentGroupViewers();
    for (CommentGroupViewer viewer : viewers)
    {
      Control control = viewer.createControl(composite, toolkit);
      if (viewer.isRenderedInSubSection()) {
        GridDataFactory.fillDefaults().grab(true, false).indent(-12, 0).applyTo(control);
      } else {
        GridDataFactory.fillDefaults().grab(true, false).indent(-6, 0).applyTo(control);
      }
    }
  }
  
  protected void fillToolBar(ToolBarManager barManager)
  {
    Action collapseAllAction = new Action("")
    {
      public void run()
      {
        TaskEditorCommentPart.this.collapseAllComments();
      }
    };
    collapseAllAction.setImageDescriptor(CommonImages.COLLAPSE_ALL_SMALL);
    collapseAllAction.setToolTipText(Messages.TaskEditorCommentPart_Collapse_Comments);
    barManager.add(collapseAllAction);
    
    Action expandAllAction = new Action("")
    {
      public void run()
      {
        TaskEditorCommentPart.this.expandAllComments(true);
      }
    };
    expandAllAction.setImageDescriptor(CommonImages.EXPAND_ALL_SMALL);
    expandAllAction.setToolTipText(Messages.TaskEditorCommentPart_Expand_Comments);
    barManager.add(expandAllAction);
    if (commentAttributes.isEmpty())
    {
      collapseAllAction.setEnabled(false);
      expandAllAction.setEnabled(false);
    }
  }
  
  public CommentGroupStrategy getCommentGroupStrategy()
  {
    return commentGroupStrategy;
  }
  
  public void setCommentGroupStrategy(CommentGroupStrategy commentGroupStrategy)
  {
    this.commentGroupStrategy = commentGroupStrategy;
  }
  
  private List<CommentGroupViewer> getCommentGroupViewers()
  {
    if (commentGroupViewers != null) {
      return commentGroupViewers;
    }
    List<ITaskComment> comments = new ArrayList();
    for (TaskAttribute commentAttribute : commentAttributes) {
      comments.add(convertToTaskComment(getModel(), commentAttribute));
    }
    String currentPersonId = getModel().getTaskRepository().getUserName();
    Object commentGroups = getCommentGroupStrategy().groupComments(comments, currentPersonId);
    
    commentGroupViewers = new ArrayList(((List)commentGroups).size());
    if (((List)commentGroups).size() > 0) {
      for (int i = 0; i < ((List)commentGroups).size(); i++)
      {
        CommentGroupViewer viewer = new CommentGroupViewer((CommentGroupStrategy.CommentGroup)((List)commentGroups).get(i));
        boolean isLastGroup = i == ((List)commentGroups).size() - 1;
        viewer.setRenderedInSubSection(!isLastGroup);
        commentGroupViewers.add(viewer);
      }
    }
    return commentGroupViewers;
  }
  
  private void initialize()
  {
    commentAttributes = getTaskData().getAttributeMapper().getAttributesByType(getTaskData(), 
      "comment");
    if (commentAttributes.size() > 0) {
      for (TaskAttribute commentAttribute : commentAttributes) {
        if (getModel().hasIncomingChanges(commentAttribute))
        {
          hasIncoming = true;
          break;
        }
      }
    }
  }
  
  public boolean setFormInput(Object input)
  {
    if ((input instanceof String))
    {
      String text = (String)input;
      if (commentAttributes != null) {
        for (TaskAttribute commentAttribute : commentAttributes) {
          if (text.equals(commentAttribute.getId())) {
            selectReveal(commentAttribute);
          }
        }
      }
    }
    return super.setFormInput(input);
  }
  
  public CommentViewer selectReveal(TaskAttribute commentAttribute)
  {
    if (commentAttribute == null) {
      return null;
    }
    expandAllComments(false);
    List<CommentGroupViewer> groupViewers = getCommentGroupViewers();
    Iterator localIterator2;
    for (Iterator localIterator1 = groupViewers.iterator(); localIterator1.hasNext(); localIterator2.hasNext())
    {
      CommentGroupViewer groupViewer = (CommentGroupViewer)localIterator1.next();
      localIterator2 = groupViewer.getCommentViewers().iterator(); continue;CommentViewer viewer = (CommentViewer)localIterator2.next();
      if (viewer.getTaskAttribute().equals(commentAttribute))
      {
        groupViewer.setExpanded(true);
        
        EditorUtil.reveal(getTaskEditorPage().getManagedForm().getForm(), commentAttribute.getId());
        return viewer;
      }
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorCommentPart
 * 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 RichTextEditor$6
  implements IAdaptable
{
  RichTextEditor$6(RichTextEditor paramRichTextEditor) {}
  
  public Object getAdapter(Class adapter)
  {
    if (adapter == TaskRepository.class) {
      return RichTextEditor.access$4(this$0);
    }
    if (adapter == ITask.class) {
      return RichTextEditor.access$5(this$0);
    }
    return null;
  }
}

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

import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.mylyn.commons.ui.SelectionProviderAdapter;
import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
import org.eclipse.ui.IWorkbenchPartSite;

final class TaskEditorActionContributor$SelectionProviderAdapterExtension
  extends SelectionProviderAdapter
  implements ISelectionChangedListener
{
  private TaskEditorActionContributor$SelectionProviderAdapterExtension(TaskEditorActionContributor paramTaskEditorActionContributor) {}
  
  public ISelection getSelection()
  {
    if ((TaskEditorActionContributor.access$0(this$0) != null) && (TaskEditorActionContributor.access$0(this$0).getSite().getSelectionProvider() != null)) {
      return TaskEditorActionContributor.access$0(this$0).getSite().getSelectionProvider().getSelection();
    }
    return StructuredSelection.EMPTY;
  }
  
  public void selectionChanged(SelectionChangedEvent event)
  {
    super.selectionChanged(event);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorActionContributor.SelectionProviderAdapterExtension
 * 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.jface.action.ToolBarManager;
import org.eclipse.mylyn.commons.ui.CommonImages;
import org.eclipse.mylyn.commons.workbench.editors.CommonTextSupport;
import org.eclipse.mylyn.commons.workbench.forms.CommonFormUtil;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.data.TaskData;
import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPage;
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPart;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Section;

public class TaskEditorPlanningPart
  extends AbstractTaskEditorPart
{
  private final PlanningPart part;
  
  private class NotesAction
    extends Action
  {
    public NotesAction()
    {
      setImageDescriptor(CommonImages.NOTES_SMALL);
      setToolTipText(Messages.TaskEditorPlanningPart_Add_Private_Notes_Tooltip);
    }
    
    public void run()
    {
      CommonFormUtil.setExpanded(part.getSection(), true);
      if ((part.getNoteEditor() != null) && (part.getNoteEditor().getControl() != null)) {
        part.getNoteEditor().getControl().setFocus();
      } else {
        part.getControl().setFocus();
      }
    }
  }
  
  public TaskEditorPlanningPart()
  {
    part = new PlanningPart(2)
    {
      protected void fillToolBar(ToolBarManager toolBarManager)
      {
        TaskEditorPlanningPart.NotesAction notesAc
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