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

t_0
        //   216: invokevirtual 138	org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage:showEditorBusy	(Z)V
        //   219: aload 4
        //   221: athrow
        //   222: aload_0
        //   223: getfield 121	org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage$SubmitTaskJobListener$1:this$1	Lorg/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage$SubmitTaskJobListener;
        //   226: invokestatic 147	org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage$SubmitTaskJobListener:access$1	(Lorg/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage$SubmitTaskJobListener;)Lorg/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage;
        //   229: iconst_0
        //   230: invokevirtual 138	org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage:showEditorBusy	(Z)V
        //   233: return
        // Line number table:
        //   Java source line #214	-> byte code offset #0
        //   Java source line #215	-> byte code offset #10
        //   Java source line #216	-> byte code offset #23
        //   Java source line #217	-> byte code offset #46
        //   Java source line #219	-> byte code offset #59
        //   Java source line #220	-> byte code offset #70
        //   Java source line #221	-> byte code offset #78
        //   Java source line #223	-> byte code offset #83
        //   Java source line #224	-> byte code offset #92
        //   Java source line #225	-> byte code offset #97
        //   Java source line #226	-> byte code offset #111
        //   Java source line #227	-> byte code offset #132
        //   Java source line #226	-> byte code offset #143
        //   Java source line #228	-> byte code offset #157
        //   Java source line #230	-> byte code offset #162
        //   Java source line #231	-> byte code offset #172
        //   Java source line #234	-> byte code offset #182
        //   Java source line #235	-> byte code offset #206
        //   Java source line #236	-> byte code offset #208
        //   Java source line #237	-> byte code offset #219
        //   Java source line #236	-> byte code offset #222
        //   Java source line #238	-> byte code offset #233
        // Local variable table:
        //   start	length	slot	name	signature
        //   0	234	0	this	1
        //   69	19	1	oldTask	ITask
        //   77	82	2	newTask	ITask
        //   91	67	3	migrator	org.eclipse.mylyn.internal.tasks.ui.editors.TaskMigrator
        //   206	14	4	localObject	Object
        // Exception table:
        //   from	to	target	type
        //   0	206	206	finally
      }
    });
  }
  
  public void taskSubmitted(SubmitJobEvent event, IProgressMonitor monitor)
    throws CoreException
  {
    if ((!this$0.getModel().getTaskData().isNew()) && (attachContext)) {
      AttachmentUtil.postContext(AbstractTaskEditorPage.access$4(this$0), this$0.getModel().getTaskRepository(), AbstractTaskEditorPage.access$6(this$0), "", null, monitor);
    }
  }
  
  public void taskSynchronized(SubmitJobEvent event, IProgressMonitor monitor) {}
}

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

import org.eclipse.mylyn.internal.tasks.core.TaskList;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.actions.ToggleTaskActivationAction;
import org.eclipse.mylyn.internal.tasks.ui.editors.Messages;
import org.eclipse.mylyn.tasks.core.ITask;

class TaskEditor$13
  extends ToggleTaskActivationAction
{
  TaskEditor$13(TaskEditor paramTaskEditor, ITask $anonymous0)
  {
    super($anonymous0);
  }
  
  public void run()
  {
    TaskList taskList = TasksUiPlugin.getTaskList();
    if (taskList.getTask(TaskEditor.access$7(this$0).getRepositoryUrl(), TaskEditor.access$7(this$0).getTaskId()) == null) {
      this$0.setMessage(Messages.TaskEditor_Task_added_to_the_Uncategorized_container, 
        1);
    }
    super.run();
  }
}

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

class AbstractTaskEditorPage$3
  implements Runnable
{
  AbstractTaskEditorPage$3(AbstractTaskEditorPage paramAbstractTaskEditorPage) {}
  
  public void run()
  {
    this$0.reflow();
  }
}

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

import org.eclipse.jface.text.templates.TemplateContext;
import org.eclipse.jface.text.templates.TemplateVariableResolver;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.ITaskActivityManager;
import org.eclipse.mylyn.tasks.ui.TasksUi;

public class TaskTemplateVariableResolver
  extends TemplateVariableResolver
{
  public static final String TYPE_ACTIVE_TASK_KEY = "activeTaskKey";
  public static final String TYPE_ACTIVE_TASK_PREFIX = "activeTaskPrefix";
  
  protected String resolve(TemplateContext context)
  {
    String type = getType();
    if ("activeTaskKey".equalsIgnoreCase(type))
    {
      ITask activeTask = TasksUi.getTaskActivityManager().getActiveTask();
      if (activeTask != null)
      {
        String taskKey = activeTask.getTaskKey();
        if (taskKey == null) {
          taskKey = activeTask.getTaskId();
        }
        if (taskKey != null) {
          return taskKey.trim();
        }
      }
    }
    else if ("activeTaskPrefix".equalsIgnoreCase(type))
    {
      ITask activeTask = TasksUi.getTaskActivityManager().getActiveTask();
      if (activeTask != null)
      {
        String taskPrefix = TasksUiInternal.getTaskPrefix(activeTask.getConnectorKind());
        if (taskPrefix != null) {
          return taskPrefix;
        }
      }
    }
    return null;
  }
}

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

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.Vector;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.action.ContributionManager;
import org.eclipse.jface.action.ControlContribution;
import org.eclipse.jface.action.GroupMarker;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.jface.resource.CompositeImageDescriptor;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.TextViewer;
import org.eclipse.jface.util.LocalSelectionTransfer;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.commons.ui.CommonImages;
import org.eclipse.mylyn.commons.ui.CommonUiUtil;
import org.eclipse.mylyn.commons.ui.PlatformUiUtil;
import org.eclipse.mylyn.commons.ui.SelectionProviderAdapter;
import org.eclipse.mylyn.commons.workbench.BusyAnimator;
import org.eclipse.mylyn.commons.workbench.BusyAnimator.IBusyClient;
import org.eclipse.mylyn.commons.workbench.WorkbenchUtil;
import org.eclipse.mylyn.commons.workbench.editors.CommonTextSupport;
import org.eclipse.mylyn.internal.tasks.core.TaskList;
import org.eclipse.mylyn.internal.tasks.ui.TaskEditorBloatMonitor;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.actions.OpenWithBrowserAction;
import org.eclipse.mylyn.internal.tasks.ui.actions.TaskEditorScheduleAction;
import org.eclipse.mylyn.internal.tasks.ui.actions.ToggleTaskActivationAction;
import org.eclipse.mylyn.internal.tasks.ui.editors.EditorUtil;
import org.eclipse.mylyn.internal.tasks.ui.editors.Messages;
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorActionContributor;
import org.eclipse.mylyn.internal.tasks.ui.util.TaskDragSourceListener;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
import org.eclipse.mylyn.tasks.ui.TasksUiImages;
import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.dnd.DragSource;
import org.eclipse.swt.dnd.FileTransfer;
import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.FocusAdapter;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.contexts.IContextService;
import org.eclipse.ui.forms.FormColors;
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.editor.IFormPage;
import org.eclipse.ui.forms.editor.SharedHeaderFormEditor;
import org.eclipse.ui.forms.events.HyperlinkAdapter;
import org.eclipse.ui.forms.events.HyperlinkEvent;
import org.eclipse.ui.forms.events.IHyperlinkListener;
import org.eclipse.ui.forms.widgets.Form;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.ImageHyperlink;
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.handlers.IHandlerService;
import org.eclipse.ui.internal.forms.widgets.BusyIndicator;
import org.eclipse.ui.internal.forms.widgets.FormHeading;
import org.eclipse.ui.internal.forms.widgets.TitleRegion;
import org.eclipse.ui.menus.IMenuService;
import org.eclipse.ui.part.WorkbenchPart;
import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
import org.eclipse.ui.services.IDisposable;
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;

public class TaskEditor
  extends SharedHeaderFormEditor
{
  public static final String ID_EDITOR = "org.eclipse.mylyn.tasks.ui.editors.task";
  public static final String ID_TOOLBAR_HEADER = "org.eclipse.mylyn.tasks.ui.editors.task.toolbar.header";
  private static final String ID_LEFT_TOOLBAR_HEADER = "org.eclipse.mylyn.tasks.ui.editors.task.toolbar.header.left";
  private static final int LEFT_TOOLBAR_HEADER_TOOLBAR_PADDING = 3;
  private ToggleTaskActivationAction activateAction;
  @Deprecated
  private final IEditorPart contentOutlineProvider = null;
  private BusyAnimator editorBusyIndicator;
  private MenuManager menuManager;
  private IHyperlinkListener messageHyperLinkListener;
  private ITask task;
  private TaskEditorInput taskEditorInput;
  private TaskDragSourceListener titleDragSourceListener;
  private Composite editorParent;
  private IMenuService menuService;
  private IToolBarManager toolBarManager;
  private ToolBarManager leftToolBarManager;
  private ToolBar leftToolBar;
  private Image headerImage;
  private boolean noExtraPadding;
  private BusyIndicator busyLabel;
  private StyledText titleLabel;
  private CommonTextSupport textSupport;
  private TaskEditorScheduleAction scheduleAction;
  OpenWithBrowserAction openWithBrowserAction;
  private static boolean toolBarFailureLogged;
  
  protected void createPages()
  {
    super.createPages();
    TaskEditorBloatMonitor.editorOpened(this);
  }
  
  protected Composite createPageContainer(Composite parent)
  {
    editorParent = parent;
    Composite composite = super.createPageContainer(parent);
    
    EditorUtil.initializeScrollbars(getHeaderForm().getForm());
    try
    {
      FormHeading heading = (FormHeading)getHeaderForm().getForm().getForm().getHead();
      
      Field field = FormHeading.class.getDeclaredField("titleRegion");
      field.setAccessible(true);
      
      TitleRegion titleRegion = (TitleRegion)field.get(heading);
      
      leftToolBarManager = new ToolBarManager(8388608);
      leftToolBar = leftToolBarManager.createControl(titleRegion);
      leftToolBar.addControlListener(new ControlAdapter()
      {
        private boolean ignoreResizeEvents;
        
        /* Error */
        public void controlResized(ControlEvent e)
        {
          // Byte code:
          //   0: aload_0
          //   1: getfield 30	org/eclipse/mylyn/tasks/ui/editors/TaskEditor$1:ignoreResizeEvents	Z
          //   4: ifeq +4 -> 8
          //   7: return
          //   8: aload_0
          //   9: iconst_1
          //   10: putfield 30	org/eclipse/mylyn/tasks/ui/editors/TaskEditor$1:ignoreResizeEvents	Z
          //   13: aload_0
          //   14: getfield 31	org/eclipse/mylyn/tasks/ui/editors/TaskEditor$1:this$0	Lorg/eclipse/mylyn/tasks/ui/editors/TaskEditor;
          //   17: invokestatic 32	org/eclipse/mylyn/tasks/ui/editors/TaskEditor:access$0	(Lorg/eclipse/mylyn/tasks/ui/editors/TaskEditor;)V
          //   20: aload_0
          //   21: getfield 31	org/eclipse/mylyn/tasks/ui/editors/TaskEditor$1:this$0	Lorg/eclipse/mylyn/tasks/ui/editors/TaskEditor;
          //   24: invokestatic 33	org/eclipse/mylyn/tasks/ui/editors/TaskEditor:access$1	(Lorg/eclipse/mylyn/tasks/ui/editors/TaskEditor;)V
          //   27: goto +11 -> 38
          //   30: astore_2
          //   31: aload_0
          //   32: iconst_0
          //   33: putfield 30	org/eclipse/mylyn/tasks/ui/editors/TaskEditor$1:ignoreResizeEvents	Z
          //   36: aload_2
          //   37: athrow
          //   38: aload_0
          //   39: iconst_0
          //   40: putfield 30	org/eclipse/mylyn/tasks/ui/editors/TaskEditor$1:ignoreResizeEvents	Z
          //   43: return
          // Line number table:
          //   Java source line #223	-> byte code offset #0
          //   Java source line #224	-> byte code offset #7
          //   Java source line #226	-> byte code offset #8
          //   Java source line #229	-> byte code offset #13
          //   Java source line #230	-> byte code offset #20
          //   Java source line #231	-> byte code offset #30
          //   Java source line #232	-> byte code offset #31
          //   Java source line #233	-> byte code offset #36
          //   Java source line #232	-> byte code offset #38
          //   Java source line #234	-> byte code offset #43
          // Local variable table:
          //   start	length	slot	name	signature
          //   0	44	0	this	1
          //   0	44	1	e	ControlEvent
          //   30	7	2	localObject	Object
          // Exception table:
          //   from	to	target	type
          //   13	30	30	finally
        }
      });
      TextViewer titleViewer = new TextViewer(titleRegion, 8);
      
      titleViewer.setDocument(new Document());
      
      titleLabel = titleViewer.getTextWidget();
      titleLabel.setForeground(heading.getForeground());
      titleLabel.setFont(heading.getFont());
      
      titleLabel.addFocusListener(new FocusAdapter()
      {
        public void focusLost(FocusEvent e)
        {
          titleLabel.setSelection(0);
        }
      });
      titleRegion.addControlListener(new ControlAdapter()
      {
        public void controlResized(ControlEvent e)
        {
          TaskEditor.this.updateSizeAndLocations();
        }
      });
      IHandlerService handlerService = (IHandlerService)getSite().getService(IHandlerService.class);
      if (handlerService != null)
      {
        textSupport = new CommonTextSupport(handlerService);
        textSupport.install(titleViewer, false);
      }
    }
    catch (Exception e)
    {
      if (!toolBarFailureLogged) {
        StatusHandler.log(new Status(4, "org.eclipse.mylyn.tasks.ui", 
          "Failed to obtain busy label toolbar", e));
      }
      if (titleLabel != null)
      {
        titleLabel.dispose();
        titleLabel = null;
      }
      if (leftToolBar != null)
      {
        leftToolBar.dispose();
        leftToolBar = null;
      }
      if (leftToolBarManager != null)
      {
        leftToolBarManager.dispose();
        leftToolBarManager = null;
      }
    }
    updateHeader();
    
    return composite;
  }
  
  private BusyIndicator getBusyLabel()
  {
    if (busyLabel != null) {
      return busyLabel;
    }
    try
    {
      FormHeading heading = (FormHeading)getHeaderForm().getForm().getForm().getHead();
      
      heading.setBusy(true);
      heading.setBusy(false);
      
      Field field = FormHeading.class.getDeclaredField("titleRegion");
      field.setAccessible(true);
      
      TitleRegion titleRegion = (TitleRegion)field.get(heading);
      Control[] arrayOfControl;
      int j = (arrayOfControl = titleRegion.getChildren()).length;
      for (int i = 0; i < j; i++)
      {
        Control child = arrayOfControl[i];
        if ((child instanceof BusyIndicator)) {
          busyLabel = ((BusyIndicator)child);
        }
      }
      if (busyLabel == null) {
        return null;
      }
      busyLabel.addControlListener(new ControlAdapter()
      {
        public void controlMoved(ControlEvent e)
        {
          TaskEditor.this.updateSizeAndLocations();
        }
      });
      busyLabel.addDisposeListener(new DisposeListener()
      {
        public void widgetDisposed(DisposeEvent e)
        {
          busyLabel.setMenu(null);
          busyLabel = null;
        }
      });
      if (leftToolBar != null) {
        leftToolBar.moveAbove(busyLabel);
      }
      if (titleLabel != null) {
        titleLabel.moveAbove(busyLabel);
      }
      updateSizeAndLocations();
      
      return busyLabel;
    }
    catch (Exception e)
    {
      if (!toolBarFailureLogged) {
        StatusHandler.log(new Status(4, "org.eclipse.mylyn.tasks.ui", 
          "Failed to obtain busy label toolbar", e));
      }
      busyLabel = null;
    }
    return busyLabel;
  }
  
  private void updateSizeAndLocations()
  {
    if ((busyLabel == null) || (busyLabel.isDisposed())) {
      return;
    }
    Point leftToolBarSize = new Point(0, 0);
    if ((leftToolBar != null) && (!leftToolBar.isDisposed()))
    {
      leftToolBarSize = leftToolBar.getSize();
      int y = leftToolBar.getParent().getSize().y - y - 2;
      if (!hasLeftToolBar()) {
        x = 0;
      }
      leftToolBar.setBounds(busyLabel.getLocation().x, y, x, y);
    }
    if ((titleLabel != null) && (!titleLabel.isDisposed()))
    {
      Point size = titleLabel.computeSize(-1, -1, true);
      int y = (titleLabel.getParent().getSize().y - y) / 2;
      titleLabel.setBounds(busyLabel.getLocation().x + 3 + x, 
        y, x, y);
    }
  }
  
  Composite getEditorParent()
  {
    return editorParent;
  }
  
  protected void addPages()
  {
    initialize();
    
    Set<String> conflictingIds = new HashSet();
    ArrayList<AbstractTaskEditorPageFactory> pageFactories = new ArrayList();
    AbstractTaskEditorPageFactory[] arrayOfAbstractTaskEditorPageFactory;
    int j = (arrayOfAbstractTaskEditorPageFactory = TasksUiPlugin.getDefault().getTaskEditorPageFactories()).length;
    for (int i = 0; i < j; i++)
    {
      AbstractTaskEditorPageFactory pageFactory = arrayOfAbstractTaskEditorPageFactory[i];
      if ((pageFactory.canCreatePageFor(getTaskEditorInput())) && (WorkbenchUtil.allowUseOf(pageFactory)))
      {
        pageFactories.add(pageFactory);
        String[] ids = pageFactory.getConflictingIds(getTaskEditorInput());
        if (ids != null) {
          conflictingIds.addAll(Arrays.asList(ids));
        }
      }
    }
    for (Iterator<AbstractTaskEditorPageFactory> it = pageFactories.iterator(); it.hasNext();) {
      if (conflictingIds.contains(((AbstractTaskEditorPageFactory)it.next()).getId())) {
        it.remove();
      }
    }
    Collections.sort(pageFactories, new Comparator()
    {
      public int compare(AbstractTaskEditorPageFactory o1, AbstractTaskEditorPageFactory o2)
      {
        return o1.getPriority() - o2.getPriority();
      }
    });
    for (AbstractTaskEditorPageFactory factory : pageFactories) {
      try
      {
        IFormPage page = factory.createPage(this);
        int index = addPage(page);
        setPageImage(index, factory.getPageImage());
        setPageText(index, factory.getPageText());
        if (factory.getPriority() == 30) {
          setActivePage(index);
        }
        if ((page instanceof ISelectionProvider)) {
          ((ISelectionProvider)page).addSelectionChangedListener(getActionBarContributor());
        }
      }
      catch (Exception e)
      {
        StatusHandler.log(new Status(4, "org.eclipse.mylyn.tasks.ui", 
          "Could not create editor via factory: " + factory, e));
      }
    }
    updateTitleImage();
    updateHeaderToolBar();
    installTitleDrag(getHeaderForm().getForm().getForm());
    
    getEditorSite().registerContextMenu(menuManager, getEditorSite().getSelectionProvider(), true);
  }
  
  private void initialize()
  {
    editorBusyIndicator = new BusyAnimator(new BusyAnimator.IBusyClient()
    {
      public Image getImage()
      {
        return getTitleImage();
      }
      
      public void setImage(Image image)
      {
        setTitleImage(image);
      }
    });
    menuManager = new MenuManager();
    configureContextMenuManager(menuManager);
    Menu menu = menuManager.createContextMenu(getContainer());
    getContainer().setMenu(menu);
    
    getHeaderForm().getForm().setMenu(menu);
    Composite head = getHeaderForm().getForm().getForm().getHead();
    if (head != null) {
      CommonUiUtil.setMenu(head, menu);
    }
  }
  
  @Deprecated
  public void configureContextMenuManager(MenuManager manager)
  {
    if (manager == null) {
      return;
    }
    IMenuListener listener = new IMenuListener()
    {
      public void menuAboutToShow(IMenuManager manager)
      {
        contextMenuAboutToShow(manager);
      }
    };
    manager.setRemoveAllWhenShown(true);
    manager.addMenuListener(listener);
  }
  
  @Deprecated
  protected void contextMenuAboutToShow(IMenuManager manager)
  {
    TaskEditorActionContributor contributor = getActionBarContributor();
    if (contributor != null) {
      contributor.contextMenuAboutToShow(manager);
    }
  }
  
  protected FormToolkit createToolkit(Display display)
  {
    return new FormToolkit(TasksUiPlugin.getDefault().getFormColors(display));
  }
  
  protected void createHeaderContents(IManagedForm headerForm)
  {
    getToolkit().decorateFormHeading(headerForm.getForm().getForm());
  }
  
  public void dispose()
  {
    disposeScheduleAction();
    if (headerImage != null) {
      headerImage.dispose();
    }
    if (editorBusyIndicator != null) {
      editorBusyIndicator.stop();
    }
    if (activateAction != null) {
      activateAction.dispose();
    }
    if (menuService != null)
    {
      if (leftToolBarManager != null) {
        menuService.releaseContributions(leftToolBarManager);
      }
      if ((toolBarManager instanceof ContributionManager)) {
        menuService.releaseContributions((ContributionManager)toolBarManager);
      }
    }
    if (textSupport != null) {
      textSupport.dispose();
    }
    if ((messageHyperLinkListener instanceof IDisposable)) {
      ((IDisposable)messageHyperLinkListener).dispose();
    }
    super.dispose();
  }
  
  public void doSave(IProgressMonitor monitor)
  {
    IFormPage[] arrayOfIFormPage;
    int j = (arrayOfIFormPage = getPages()).length;
    for (int i = 0; i < j; i++)
    {
      IFormPage page = arrayOfIFormPage[i];
      if (page.isDirty()) {
        page.doSave(monitor);
      }
    }
    editorDirtyStateChanged();
  }
  
  public void doSaveAs()
  {
    throw new UnsupportedOperationException();
  }
  
  private TaskEditorActionContributor getActionBarContributor()
  {
    return (TaskEditorActionContributor)getEditorSite().getActionBarContributor();
  }
  
  public Object getAdapter(Class adapter)
  {
    if (contentOutlineProvider != null) {
      return contentOutlineProvider.getAdapter(adapter);
    }
    if (IContentOutlinePage.class.equals(adapter))
    {
      IFormPage[] pages = getPages();
      IFormPage[] arrayOfIFormPage1;
      int j = (arrayOfIFormPage1 = pages).length;
      for (int i = 0; i < j; i++)
      {
        IFormPage page = arrayOfIFormPage1[i];
        Object outlinePage = page.getAdapter(adapter);
        if (outlinePage != null) {
          return outlinePage;
        }
      }
    }
    return super.getAdapter(adapter);
  }
  
  public Menu getMenu()
  {
    return getContainer().getMenu();
  }
  
  IFormPage[] getPages()
  {
    List<IFormPage> formPages = new ArrayList();
    if (pages != null) {
      for (int i = 0; i < pages.size(); i++)
      {
        Object page = pages.get(i);
        if ((page instanceof IFormPage)) {
          formPages.add((IFormPage)page);
        }
      }
    }
    return (IFormPage[])formPages.toArray(new IFormPage[formPages.size()]);
  }
  
  @Deprecated
  protected IWorkbenchSiteProgressService getProgressService()
  {
    Object siteService = getEditorSite().getAdapter(IWorkbenchSiteProgressService.class);
    if (siteService != null) {
      return (IWorkbenchSiteProgressService)siteService;
    }
    return null;
  }
  
  @Deprecated
  public ISelection getSelection()
  {
    if ((getSite() != null) && (getSite().getSelectionProvider() != null)) {
      return getSite().getSelectionProvider().getSelection();
    }
    return StructuredSelection.EMPTY;
  }
  
  public TaskEditorInput getTaskEditorInput()
  {
    return taskEditorInput;
  }
  
  @Deprecated
  public Form getTopForm()
  {
    return getHeaderForm().getForm().getForm();
  }
  
  public void init(IEditorSite site, IEditorInput input)
    throws PartInitException
  {
    if (!(input instanceof TaskEditorInput)) {
      throw new PartInitException("Invalid editor input \"" + input.getClass() + "\"");
    }
    super.init(site, input);
    
    taskEditorInput = ((TaskEditorInput)input);
    task = taskEditorInput.getTask();
    
    site.getSelectionProvider().setSelection(new StructuredSelection(task));
    
    setPartName(input.getName());
    
    IContextService contextSupport = (IContextService)site.getService(IContextService.class);
    if (contextSupport != null) {
      contextSupport.activateContext("org.eclipse.mylyn.tasks.ui.editors.task");
    }
  }
  
  private void installTitleDrag(Form form)
  {
    if (titleDragSourceListener == null)
    {
      Transfer[] transferTypes;
      Transfer[] transferTypes;
      if (task == null) {
        transferTypes = new Transfer[] { TextTransfer.getInstance() };
      } else {
        transferTypes = new Transfer[] { LocalSelectionTransfer.getTransfer(), TextTransfer.getInstance(), 
          FileTransfer.getInstance() };
      }
      titleDragSourceListener = new TaskDragSourceListener(new SelectionProviderAdapter()
      {
        public ISelection getSelection()
        {
          return new StructuredSelection(task);
        }
      });
      if (titleLabel != null)
      {
        DragSource source = new DragSource(titleLabel, 6);
        source.setTransfer(transferTypes);
        source.addDragListener(titleDragSourceListener);
      }
      else
      {
        form.addTitleDragSupport(6, transferTypes, titleDragSourceListener);
      }
    }
  }
  
  public boolean isDirty()
  {
    IFormPage[] arrayOfIFormPage;
    int j = (arrayOfIFormPage = getPages()).length;
    for (int i = 0; i < j; i++)
    {
      IFormPage page = arrayOfIFormPage[i];
      if (page.isDirty()) {
        return true;
      }
    }
    return false;
  }
  
  public boolean isSaveAsAllowed()
  {
    return false;
  }
  
  @Deprecated
  public void markDirty()
  {
    firePropertyChange(257);
  }
  
  public void refreshPages()
  {
    IFormPage[] arrayOfIFormPage;
    int j = (arrayOfIFormPage = getPages()).length;
    for (int i = 0; i < j; i++)
    {
      IFormPage page = arrayOfIFormPage[i];
      if (((page instanceof TaskFormPage)) && 
        (page.getManagedForm() != null) && (!page.getManagedForm().getForm().isDisposed())) {
        ((TaskFormPage)page).refresh();
      }
    }
  }
  
  public void setFocus()
  {
    IFormPage page = getActivePageInstance();
    if (page != null) {
      page.setFocus();
    } else {
      super.setFocus();
    }
  }
  
  @Deprecated
  public void setFocusOfActivePage()
  {
    if (getActivePage() > -1)
    {
      IFormPage page = getPages()[getActivePage()];
      if (page != null) {
        page.setFocus();
      }
    }
  }
  
  public void setMessage(String message, int type)
  {
    setMessage(message, type, null);
  }
  
  private boolean isHeaderFormDisposed()
  {
    return (getHeaderForm() == null) || (getHeaderForm().getForm() == null) || (getHeaderForm().getForm().isDisposed());
  }
  
  /* Error */
  public void setMessage(String message, int type, IHyperlinkListener listener)
  {
    // Byte code:
    //   0: aload_0
    //   1: invokespecial 1097	org/eclipse/mylyn/tasks/ui/editors/TaskEditor:isHeaderFormDisposed	()Z
    //   4: ifeq +4 -> 8
    //   7: return
    //   8: aload_0
    //   9: invokevirtual 1114	org/eclipse/mylyn/tasks/ui/editors/TaskEditor:getHeaderForm	()Lorg/eclipse/ui/forms/IManagedForm;
    //   12: invokeinterface 1239 1 0
    //   17: iconst_0
    //   18: invokevirtual 1193	org/eclipse/ui/forms/widgets/ScrolledForm:setRedraw	(Z)V
    //   21: aload_0
    //   22: invokevirtual 1114	org/eclipse/mylyn/tasks/ui/editors/TaskEditor:getHeaderForm	()Lorg/eclipse/ui/forms/IManagedForm;
    //   25: invokeinterface 1239 1 0
    //   30: invokevirtual 1197	org/eclipse/ui/forms/widgets/ScrolledForm:getForm	()Lorg/eclipse/ui/forms/widgets/Form;
    //   33: astore 4
    //   35: aload_1
    //   36: ifnull +12 -> 48
    //   39: aload_1
    //   40: bipush 10
    //   42: bipush 32
    //   44: invokevirtual 1004	java/lang/String:replace	(CC)Ljava/lang/String;
    //   47: astore_1
    //   48: aload 4
    //   50: aload_1
    //   51: iload_2
    //   52: aconst_null
    //   53: invokevirtual 1188	org/eclipse/ui/forms/widgets/Form:setMessage	(Ljava/lang/String;I[Lorg/eclipse/ui/forms/IMessage;)V
    //   56: aload_0
    //   57: getfield 993	org/eclipse/mylyn/tasks/ui/editors/TaskEditor:messageHyperLinkListener	Lorg/eclipse/ui/forms/events/IHyperlinkListener;
    //   60: ifnull +34 -> 94
    //   63: aload 4
    //   65: aload_0
    //   66: getfield 993	org/eclipse/mylyn/tasks/ui/editors/TaskEditor:messageHyperLinkListener	Lorg/eclipse/ui/forms/events/IHyperlinkListener;
    //   69: invokevirtual 1186	org/eclipse/ui/forms/widgets/Form:removeMessageHyperlinkListener	(Lorg/eclipse/ui/forms/events/IHyperlinkListener;)V
    //   72: aload_0
    //   73: getfield 993	org/eclipse/mylyn/tasks/ui/editors/TaskEditor:messageHyperLinkListener	Lorg/eclipse/ui/forms/events/IHyperlinkListener;
    //   76: instanceof 538
    //   79: ifeq +15 -> 94
    //   82: aload_0
    //   83: getfield 993	org/eclipse/mylyn/tasks/ui/editors/TaskEditor:messageHyperLinkListener	Lorg/eclipse/ui/forms/events/IHyperlinkListener;
    //   86: checkcast 538	org/eclipse/ui/services/IDisposable
    //   89: invokeinterface 1247 1 0
    //   94: aload_3
    //   95: ifnull +9 -> 104
    //   98: aload 4
    //   100: aload_3
    //   101: invokevirtual 1185	org/eclipse/ui/forms/widgets/Form:addMessageHyperlinkListener	(Lorg/eclipse/ui/forms/events/IHyperlinkListener;)V
    //   104: aload_0
    //   105: aload_3
    //   106: putfield 993	org/eclipse/mylyn/tasks/ui/editors/TaskEditor:messageHyperLinkListener	Lorg/eclipse/ui/forms/events/IHyperlinkListener;
    //   109: aload_0
    //   110: invokespecial 1096	org/eclipse/mylyn/tasks/ui/editors/TaskEditor:hasLeftToolBar	()Z
    //   113: ifeq +56 -> 169
    //   116: aload_0
    //   117: invokespecial 1120	org/eclipse/mylyn/tasks/ui/editors/TaskEditor:getBusyLabel	()Lorg/eclipse/ui/internal/forms/widgets/BusyIndicator;
    //   120: astore 5
    //   122: aload_1
    //   123: ifnull +20 -> 143
    //   126: aload 5
    //   128: ifnull +15 -> 143
    //   131: aload_0
    //   132: aload 5
    //   134: invokevirtual 1201	org/eclipse/ui/internal/forms/widgets/BusyIndicator:getImage	()Lorg/eclipse/swt/graphics/Image;
    //   137: invokespecial 1108	org/eclipse/mylyn/tasks/ui/editors/TaskEditor:setHeaderImage	(Lorg/eclipse/swt/graphics/Image;)V
    //   140: goto +29 -> 169
    //   143: aload_0
    //   144: aconst_null
    //   145: invokespecial 1108	org/eclipse/mylyn/tasks/ui/editors/TaskEditor:setHeaderImage	(Lorg/eclipse/swt/graphics/Image;)V
    //   148: goto +21 -> 169
    //   151: astore 6
    //   153: aload_0
    //   154: invokevirtual 1114	org/eclipse/mylyn/tasks/ui/editors/TaskEditor:getHeaderForm	()Lorg/eclipse/ui/forms/IManagedForm;
    //   157: invokeinterface 1239 1 0
    //   162: iconst_1
    //   163: invokevirtual 1193	org/eclipse/ui/forms/widgets/ScrolledForm:setRedraw	(Z)V
    //   166: aload 6
    //   168: athrow
    //   169: aload_0
    //   170: invokevirtual 1114	org/eclipse/mylyn/tasks/ui/editors/TaskEditor:getHeaderForm	()Lorg/eclipse/ui/forms/IManagedForm;
    //   173: invokeinterface 1239 1 0
    //   178: iconst_1
    //   179: invokevirtual 1193	org/eclipse/ui/forms/widgets/ScrolledForm:setRedraw	(Z)V
    //   182: return
    // Line number table:
    //   Java source line #722	-> byte code offset #0
    //   Java source line #723	-> byte code offset #7
    //   Java source line #728	-> byte code offset #8
    //   Java source line #730	-> byte code offset #21
    //   Java source line #731	-> byte code offset #35
    //   Java source line #732	-> byte code offset #39
    //   Java source line #734	-> byte code offset #48
    //   Java source line #735	-> byte code offset #56
    //   Java source line #736	-> byte code offset #63
    //   Java source line #737	-> byte code offset #72
    //   Java source line #738	-> byte code offset #82
    //   Java source line #741	-> byte code offset #94
    //   Java source line #742	-> byte code offset #98
    //   Java source line #744	-> byte code offset #104
    //   Java source line #747	-> byte code offset #109
    //   Java source line #748	-> byte code offset #116
    //   Java source line #749	-> byte code offset #122
    //   Java source line #750	-> byte code offset #131
    //   Java source line #752	-> byte code offset #143
    //   Java source line #755	-> byte code offset #151
    //   Java source line #756	-> byte code offset #153
    //   Java source line #757	-> byte code offset #166
    //   Java source line #756	-> byte code offset #169
    //   Java source line #758	-> byte code offset #182
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	183	0	this	TaskEditor
    //   0	183	1	message	String
    //   0	183	2	type	int
    //   0	183	3	listener	IHyperlinkListener
    //   33	66	4	form	Form
    //   120	13	5	busyLabel	BusyIndicator
    //   151	16	6	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   8	151	151	finally
  }
  
  private void setHeaderImage(final Image image)
  {
    BusyIndicator busyLabel = getBusyLabel();
    if (busyLabel == null) {
      return;
    }
    final Point size = leftToolBar.computeSize(-1, -1, true);
    Point titleSize = titleLabel.computeSize(-1, -1, true);
    x += x + 3;
    y = Math.max(y, y);
    
    final int padding = (x > 0) && (!noExtraPadding) ? 10 : 1;
    final Rectangle imageBounds = image != null ? image.getBounds() : new Rectangle(0, 0, 0, 0);
    int tempHeight = image != null ? Math.max(y + 1, height) : y + 1;
    
    final int height = tempHeight > height + 5 ? tempHeight - 5 : tempHeight;
    
    CompositeImageDescriptor descriptor = new CompositeImageDescriptor()
    {
      protected void drawCompositeImage(int width, int height)
      {
        if (image != null) {
          drawImage(image.getImageData(), sizex + padding, (height - imagegetBoundsheight) / 2);
        }
      }
      
      protected Point getSize()
      {
        return new Point(sizex + padding + imageBoundswidth, height);
      }
    };
    Image newHeaderImage = descriptor.createImage();
    
    busyLabel.setImage(newHeaderImage);
    if (headerImage != null) {
      headerImage.dispose();
    }
    headerImage = newHeaderImage;
    
    getHeaderForm().getForm().reflow(true);
  }
  
  public String getMessage()
  {
    if ((getHeaderForm() != null) && (getHeaderForm().getForm() != null) && 
      (!getHeaderForm().getForm().isDisposed()))
    {
      Form form = getHeaderForm().getForm().getForm();
      return form.getMessage();
    }
    return null;
  }
  
  public void setStatus(String message, final String title, final IStatus status)
  {
    setMessage(message, 3, new HyperlinkAdapter()
    {
      public void linkActivated(HyperlinkEvent event)
      {
        TasksUiInternal.displayStatus(title, status);
      }
    });
  }
  
  public void showBusy(boolean busy)
  {
    if (editorBusyIndicator != null) {
      if (busy)
      {
        if (TasksUiInternal.isAnimationsEnabled()) {
          editorBusyIndicator.start();
        }
      }
      else {
        editorBusyIndicator.stop();
      }
    }
    if (!isHeaderFormDisposed())
    {
      Form form = getHeaderForm().getForm().getForm();
      if ((form != null) && (!form.isDisposed()))
      {
        IToolBarManager toolBarManager = form.getToolBarManager();
        if ((toolBarManager instanceof ToolBarManager))
        {
          ToolBar control = ((ToolBarManager)toolBarManager).getControl();
          if (control != null) {
            control.setEnabled(!busy);
          }
        }
        if (leftToolBar != null) {
          leftToolBar.setEnabled(!busy);
        }
        if (titleLabel != null) {
          titleLabel.setEnabled(!busy);
        }
        CommonUiUtil.setEnabled(form.getBody(), !busy);
        IFormPage[] arrayOfIFormPage;
        int j = (arrayOfIFormPage = getPages()).length;
        for (int i = 0; i < j; i++)
        {
          IFormPage page = arrayOfIFormPage[i];
          if ((page instanceof WorkbenchPart))
          {
            WorkbenchPart part = (WorkbenchPart)page;
            part.showBusy(busy);
          }
        }
      }
    }
  }
  
  private void updateHeader()
  {
    IEditorInput input = getEditorInput();
    updateHeaderImage();
    updateHeaderLabel();
    setTitleToolTip(input.getToolTipText());
    setPartName(input.getName());
  }
  
  public void updateHeaderToolBar()
  {
    if (isHeaderFormDisposed()) {
      return;
    }
    Form form = getHeaderForm().getForm().getForm();
    toolBarManager = form.getToolBarManager();
    
    toolBarManager.removeAll();
    
    TaskRepository outgoingNewRepository = TasksUiUtil.getOutgoingNewTaskRepository(task);
    final TaskRepository taskRepository = outgoingNewRepository != null 
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