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

1	(Lorg/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage$SubmitTaskJobListener;)Lorg/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage;
    //   140: invokestatic 144	org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage:access$5	(Lorg/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage;)Lorg/eclipse/mylyn/tasks/core/data/TaskData;
    //   143: invokevirtual 132	org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector:hasRepositoryDueDate	(Lorg/eclipse/mylyn/tasks/core/TaskRepository;Lorg/eclipse/mylyn/tasks/core/ITask;Lorg/eclipse/mylyn/tasks/core/data/TaskData;)Z
    //   146: ifeq +7 -> 153
    //   149: iconst_0
    //   150: goto +4 -> 154
    //   153: iconst_1
    //   154: invokevirtual 126	org/eclipse/mylyn/internal/tasks/ui/editors/TaskMigrator:setMigrateDueDate	(Z)V
    //   157: aload_3
    //   158: aload_2
    //   159: invokevirtual 128	org/eclipse/mylyn/internal/tasks/ui/editors/TaskMigrator:execute	(Lorg/eclipse/mylyn/tasks/core/ITask;)V
    //   162: aload_0
    //   163: getfield 121	org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage$SubmitTaskJobListener$1:this$1	Lorg/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage$SubmitTaskJobListener;
    //   166: invokestatic 146	org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage$SubmitTaskJobListener:access$0	(Lorg/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage$SubmitTaskJobListener;)Z
    //   169: ifeq +13 -> 182
    //   172: aload_0
    //   173: getfield 121	org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage$SubmitTaskJobListener$1:this$1	Lorg/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage$SubmitTaskJobListener;
    //   176: 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;
    //   179: invokevirtual 136	org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage:expandLastComment	()V
    //   182: aload_0
    //   183: getfield 121	org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage$SubmitTaskJobListener$1:this$1	Lorg/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage$SubmitTaskJobListener;
    //   186: 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;
    //   189: new 59	org/eclipse/mylyn/tasks/core/sync/SubmitJobEvent
    //   192: dup
    //   193: aload_0
    //   194: getfield 120	org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage$SubmitTaskJobListener$1:val$job	Lorg/eclipse/mylyn/tasks/core/sync/SubmitJob;
    //   197: invokespecial 135	org/eclipse/mylyn/tasks/core/sync/SubmitJobEvent:<init>	(Lorg/eclipse/mylyn/tasks/core/sync/SubmitJob;)V
    //   200: invokevirtual 141	org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage:handleTaskSubmitted	(Lorg/eclipse/mylyn/tasks/core/sync/SubmitJobEvent;)V
    //   203: goto +19 -> 222
    //   206: astore 4
    //   208: aload_0
    //   209: getfield 121	org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage$SubmitTaskJobListener$1:this$1	Lorg/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage$SubmitTaskJobListener;
    //   212: 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;
    //   215: iconst_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
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPage.SubmitTaskJobListener.1
 * 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.ui.editors.TaskEditorDescriptionPart;
import org.eclipse.mylyn.tasks.core.data.TaskData;
import org.eclipse.mylyn.tasks.core.data.TaskDataModel;

class AbstractTaskEditorPage$9
  extends TaskEditorPartDescriptor
{
  AbstractTaskEditorPage$9(AbstractTaskEditorPage paramAbstractTaskEditorPage, String $anonymous0)
  {
    super($anonymous0);
  }
  
  public AbstractTaskEditorPart createPart()
  {
    TaskEditorDescriptionPart part = new TaskEditorDescriptionPart();
    if (this$0.getModel().getTaskData().isNew())
    {
      part.setExpandVertically(true);
      part.setSectionStyle(320);
    }
    return part;
  }
}

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

import org.eclipse.core.runtime.Assert;
import org.eclipse.mylyn.internal.tasks.ui.editors.BooleanAttributeEditor;
import org.eclipse.mylyn.internal.tasks.ui.editors.DateAttributeEditor;
import org.eclipse.mylyn.internal.tasks.ui.editors.DoubleAttributeEditor;
import org.eclipse.mylyn.internal.tasks.ui.editors.LongTextAttributeEditor;
import org.eclipse.mylyn.internal.tasks.ui.editors.MultiSelectionAttributeEditor;
import org.eclipse.mylyn.internal.tasks.ui.editors.PersonAttributeEditor;
import org.eclipse.mylyn.internal.tasks.ui.editors.RepositoryTextViewerConfiguration.Mode;
import org.eclipse.mylyn.internal.tasks.ui.editors.RichTextAttributeEditor;
import org.eclipse.mylyn.internal.tasks.ui.editors.SingleSelectionAttributeEditor;
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorExtensions;
import org.eclipse.mylyn.internal.tasks.ui.editors.TextAttributeEditor;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper;
import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
import org.eclipse.ui.contexts.IContextService;
import org.eclipse.ui.services.IServiceLocator;

public class AttributeEditorFactory
{
  private final TaskDataModel model;
  private final TaskRepository taskRepository;
  private final IServiceLocator serviceLocator;
  private AttributeEditorToolkit editorToolkit;
  
  public AttributeEditorFactory(TaskDataModel model, TaskRepository taskRepository)
  {
    this(model, taskRepository, null);
  }
  
  public AttributeEditorFactory(TaskDataModel model, TaskRepository taskRepository, IServiceLocator serviceLocator)
  {
    Assert.isNotNull(model);
    Assert.isNotNull(taskRepository);
    this.model = model;
    this.taskRepository = taskRepository;
    this.serviceLocator = serviceLocator;
  }
  
  public AttributeEditorToolkit getEditorToolkit()
  {
    return editorToolkit;
  }
  
  public void setEditorToolkit(AttributeEditorToolkit editorToolkit)
  {
    this.editorToolkit = editorToolkit;
  }
  
  public AbstractAttributeEditor createEditor(String type, TaskAttribute taskAttribute)
  {
    Assert.isNotNull(type);
    if ("boolean".equals(type)) {
      return new BooleanAttributeEditor(model, taskAttribute);
    }
    if ("date".equals(type)) {
      return new DateAttributeEditor(model, taskAttribute);
    }
    if ("dateTime".equals(type))
    {
      DateAttributeEditor editor = new DateAttributeEditor(model, taskAttribute);
      editor.setShowTime(true);
      return editor;
    }
    if ("person".equals(type)) {
      return new PersonAttributeEditor(model, taskAttribute);
    }
    if ("longRichText".equals(type))
    {
      RichTextAttributeEditor editor = null;
      if (serviceLocator != null)
      {
        IContextService contextService = (IContextService)serviceLocator.getService(IContextService.class);
        if (contextService != null)
        {
          AbstractTaskEditorExtension extension = TaskEditorExtensions.getTaskEditorExtension(model.getTaskRepository());
          if (extension != null) {
            editor = new RichTextAttributeEditor(model, taskRepository, taskAttribute, 2, 
              contextService, extension);
          }
        }
      }
      if (editor == null) {
        editor = new RichTextAttributeEditor(model, taskRepository, taskAttribute);
      }
      if (editorToolkit != null) {
        editor.setRenderingEngine(editorToolkit.getRenderingEngine(taskAttribute));
      }
      return editor;
    }
    if ("longText".equals(type)) {
      return new LongTextAttributeEditor(model, taskAttribute);
    }
    if ("multiSelect".equals(type)) {
      return new MultiSelectionAttributeEditor(model, taskAttribute);
    }
    if ("shortRichText".equals(type)) {
      return new RichTextAttributeEditor(model, taskRepository, taskAttribute, 4);
    }
    if ("shortText".equals(type)) {
      return new TextAttributeEditor(model, taskAttribute);
    }
    if ("singleSelect".equals(type)) {
      return new SingleSelectionAttributeEditor(model, taskAttribute);
    }
    if ("taskDepenedency".equals(type))
    {
      RichTextAttributeEditor editor = new RichTextAttributeEditor(model, taskRepository, taskAttribute, 
        18)
        {
          public String getValue()
          {
            return getAttributeMapper().getValueLabel(getTaskAttribute());
          }
        };
        editor.setMode(RepositoryTextViewerConfiguration.Mode.TASK_RELATION);
        editor.setLayoutHint(new LayoutHint(LayoutHint.RowSpan.SINGLE, LayoutHint.ColumnSpan.SINGLE)
        {
          public int getPriority()
          {
            return 11;
          }
        });
        return editor;
      }
      if ("url".equals(type))
      {
        RichTextAttributeEditor editor = new RichTextAttributeEditor(model, taskRepository, taskAttribute, 
          4);
        editor.setMode(RepositoryTextViewerConfiguration.Mode.URL);
        return editor;
      }
      if ("double".equals(type)) {
        return new DoubleAttributeEditor(model, taskAttribute);
      }
      if ("integer".equals(type)) {
        return new DoubleAttributeEditor(model, taskAttribute);
      }
      throw new IllegalArgumentException("Unsupported editor type: \"" + type + "\"");
    }
  }

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

public abstract interface ITasksUiConstants
{
  public static final String ID_COMMAND_MARK_TASK_UNREAD = "org.eclipse.mylyn.tasks.ui.command.markTaskUnread";
  public static final String ID_COMMAND_MARK_TASK_READ = "org.eclipse.mylyn.tasks.ui.command.markTaskRead";
  public static final String ID_PAGE_PLANNING = "org.eclipse.mylyn.tasks.ui.pageFactory.Planning";
  public static final String ID_PERSPECTIVE_PLANNING = "org.eclipse.mylyn.tasks.ui.perspectives.planning";
  public static final String ID_PREFERENCES_COLORS_AND_FONTS = "org.eclipse.ui.preferencePages.ColorsAndFonts";
  public static final String ID_VIEW_TASKS = "org.eclipse.mylyn.tasks.ui.views.tasks";
  public static final String ID_VIEW_REPOSITORIES = "org.eclipse.mylyn.tasks.ui.views.repositories";
}

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

import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.IRepositoryManager;
import org.eclipse.mylyn.tasks.core.IRepositoryModel;
import org.eclipse.mylyn.tasks.core.ITaskActivityManager;
import org.eclipse.mylyn.tasks.core.data.ITaskDataManager;

public class TasksUi
{
  public static AbstractRepositoryConnector getRepositoryConnector(String kind)
  {
    return getRepositoryManager().getRepositoryConnector(kind);
  }
  
  public static AbstractRepositoryConnectorUi getRepositoryConnectorUi(String kind)
  {
    return TasksUiPlugin.getConnectorUi(kind);
  }
  
  public static IRepositoryManager getRepositoryManager()
  {
    return TasksUiPlugin.getRepositoryManager();
  }
  
  public static ITaskActivityManager getTaskActivityManager()
  {
    return TasksUiPlugin.getTaskActivityManager();
  }
  
  public static ITaskDataManager getTaskDataManager()
  {
    return TasksUiPlugin.getTaskDataManager();
  }
  
  public static IRepositoryModel getRepositoryModel()
  {
    return TasksUiPlugin.getRepositoryModel();
  }
  
  public static ITasksUiFactory getUiFactory()
  {
    return TasksUiPlugin.getUiFactory();
  }
}

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

import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.commons.workbench.EditorHandle;
import org.eclipse.mylyn.commons.workbench.browser.BrowserUtil;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.internal.tasks.core.LocalTask;
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryManager;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.util.TaskOpenEvent;
import org.eclipse.mylyn.internal.tasks.ui.util.TaskOpenListener;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskRepositoriesView;
import org.eclipse.mylyn.internal.tasks.ui.wizards.EditRepositoryWizard;
import org.eclipse.mylyn.internal.tasks.ui.wizards.MultiRepositoryAwareWizard;
import org.eclipse.mylyn.internal.tasks.ui.wizards.NewLocalTaskWizard;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.IRepositoryElement;
import org.eclipse.mylyn.tasks.core.IRepositoryManager;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.ITask.SynchronizationState;
import org.eclipse.mylyn.tasks.core.ITaskMapping;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.wizards.TaskRepositoryWizardDialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.ISelectionService;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.statushandlers.StatusManager;

public class TasksUiUtil
{
  @Deprecated
  public static final int FLAG_NO_RICH_EDITOR = 131072;
  
  public static ITask createOutgoingNewTask(String connectorKind, String repositoryUrl)
  {
    Assert.isNotNull(connectorKind);
    LocalTask task = TasksUiInternal.createNewLocalTask(null);
    task.setAttribute("outgoingNewConnectorKind", connectorKind);
    task.setAttribute("outgoingNewRepositoryUrl", repositoryUrl);
    task.setSynchronizationState(ITask.SynchronizationState.OUTGOING_NEW);
    return task;
  }
  
  public static boolean isOutgoingNewTask(ITask task, String connectorKind)
  {
    Assert.isNotNull(task);
    Assert.isNotNull(connectorKind);
    return connectorKind.equals(task.getAttribute("outgoingNewConnectorKind"));
  }
  
  public static TaskRepository getOutgoingNewTaskRepository(ITask task)
  {
    Assert.isNotNull(task);
    String connectorKind = task.getAttribute("outgoingNewConnectorKind");
    String repositoryUrl = task.getAttribute("outgoingNewRepositoryUrl");
    if ((connectorKind != null) && (repositoryUrl != null)) {
      return TasksUi.getRepositoryManager().getRepository(connectorKind, repositoryUrl);
    }
    return null;
  }
  
  public static TaskRepository getSelectedRepository()
  {
    return getSelectedRepository(null);
  }
  
  public static TaskRepository getSelectedRepository(StructuredViewer viewer)
  {
    IStructuredSelection selection = null;
    if (viewer != null) {
      selection = (IStructuredSelection)viewer.getSelection();
    }
    if ((selection == null) || (selection.isEmpty()))
    {
      IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
      ISelection windowSelection = window.getSelectionService().getSelection();
      if ((windowSelection instanceof IStructuredSelection)) {
        selection = (IStructuredSelection)windowSelection;
      }
    }
    if (selection == null) {
      return null;
    }
    Object element = selection.getFirstElement();
    if ((element instanceof TaskRepository)) {
      return (TaskRepository)selection.getFirstElement();
    }
    if ((element instanceof IRepositoryQuery))
    {
      IRepositoryQuery query = (IRepositoryQuery)element;
      return TasksUi.getRepositoryManager().getRepository(query.getConnectorKind(), query.getRepositoryUrl());
    }
    if ((element instanceof ITask))
    {
      ITask task = (ITask)element;
      return TasksUi.getRepositoryManager().getRepository(task.getConnectorKind(), task.getRepositoryUrl());
    }
    if ((element instanceof IResource))
    {
      IResource resource = (IResource)element;
      return TasksUiPlugin.getDefault().getRepositoryForResource(resource);
    }
    if ((element instanceof IAdaptable))
    {
      IAdaptable adaptable = (IAdaptable)element;
      IResource resource = (IResource)adaptable.getAdapter(IResource.class);
      if (resource != null) {
        return TasksUiPlugin.getDefault().getRepositoryForResource(resource);
      }
      ITask task = (ITask)adaptable.getAdapter(AbstractTask.class);
      if (task != null)
      {
        ITask rtask = task;
        return TasksUi.getRepositoryManager().getRepository(rtask.getConnectorKind(), 
          rtask.getRepositoryUrl());
      }
    }
    return null;
  }
  
  public static IEditorPart openEditor(IEditorInput input, String editorId, IWorkbenchPage page)
  {
    if (page == null)
    {
      IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
      if (window != null) {
        page = window.getActivePage();
      }
    }
    if (page == null)
    {
      StatusHandler.log(new Status(4, "org.eclipse.mylyn.tasks.ui", "Unable to open editor for \"" + input + 
        "\": no active workbench window"));
      return null;
    }
    try
    {
      return page.openEditor(input, editorId);
    }
    catch (PartInitException e)
    {
      StatusManager.getManager().handle(
        new Status(4, "org.eclipse.mylyn.tasks.ui", "Open for editor failed: " + input + 
        ", taskId: " + editorId, e), 3);
    }
    return null;
  }
  
  public static int openEditRepositoryWizard(TaskRepository repository)
  {
    AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
      repository.getConnectorKind());
    if ((connector == null) || (
      (!connector.isUserManaged()) && (!connector.getConnectorKind().equals(
      "local")))) {
      return 1;
    }
    EditRepositoryWizard wizard = new EditRepositoryWizard(repository);
    Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
    if ((shell != null) && (!shell.isDisposed()))
    {
      WizardDialog dialog = new TaskRepositoryWizardDialog(shell, wizard);
      dialog.create();
      dialog.setBlockOnOpen(true);
      if (dialog.open() == 1) {
        return 1;
      }
    }
    if (TaskRepositoriesView.getFromActivePerspective() != null) {
      TaskRepositoriesView.getFromActivePerspective().getViewer().refresh();
    }
    return 0;
  }
  
  public static boolean openNewLocalTaskEditor(Shell shell, ITaskMapping taskSelection)
  {
    return openNewTaskEditor(shell, new NewLocalTaskWizard(taskSelection), taskSelection);
  }
  
  private static boolean openNewTaskEditor(Shell shell, IWizard wizard, ITaskMapping taskSelection)
  {
    WizardDialog dialog = new WizardDialog(shell, wizard);
    dialog.setBlockOnOpen(true);
    
    dialog.create();
    if ((!(wizard instanceof MultiRepositoryAwareWizard)) && (wizard.canFinish()))
    {
      wizard.performFinish();
      return true;
    }
    int result = dialog.open();
    return result == 0;
  }
  
  public static boolean openNewTaskEditor(Shell shell, ITaskMapping taskSelection, TaskRepository taskRepository)
  {
    IWizard wizard;
    IWizard wizard;
    if (taskRepository != null)
    {
      AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(taskRepository.getConnectorKind());
      wizard = connectorUi.getNewTaskWizard(taskRepository, taskSelection);
    }
    else
    {
      wizard = TasksUiInternal.createNewTaskWizard(taskSelection);
    }
    return openNewTaskEditor(shell, wizard, taskSelection);
  }
  
  @Deprecated
  public static boolean openRepositoryTask(String repositoryUrl, String taskId, String fullUrl)
  {
    return openTask(repositoryUrl, taskId, fullUrl);
  }
  
  @Deprecated
  public static boolean openRepositoryTask(TaskRepository repository, String taskId)
  {
    return openTask(repository, taskId);
  }
  
  public static boolean openTask(ITask task)
  {
    return TasksUiInternal.openTask(task, task.getTaskId()) != null;
  }
  
  public static void openTask(String url)
  {
    AbstractTask task = TasksUiInternal.getTaskByUrl(url);
    if ((task != null) && (!(task instanceof LocalTask)))
    {
      openTask(task);
    }
    else
    {
      boolean opened = false;
      if (url != null)
      {
        AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager()
          .getConnectorForRepositoryTaskUrl(url);
        if (connector != null)
        {
          String repositoryUrl = connector.getRepositoryUrlFromTaskUrl(url);
          if (repositoryUrl != null)
          {
            String id = connector.getTaskIdFromTaskUrl(url);
            if (id != null)
            {
              TaskRepository repository = TasksUi.getRepositoryManager().getRepository(
                connector.getConnectorKind(), repositoryUrl);
              if (repository != null) {
                opened = openTask(repository, id);
              }
            }
          }
        }
      }
      if (!opened) {
        BrowserUtil.openUrl(url, 0);
      }
    }
  }
  
  public static boolean openTask(String repositoryUrl, String taskId, String fullUrl)
  {
    return openTask(repositoryUrl, taskId, fullUrl, 0L);
  }
  
  public static boolean openTask(String repositoryUrl, String taskId, String fullUrl, long timestamp)
  {
    AbstractTask task = TasksUiInternal.getTask(repositoryUrl, taskId, fullUrl);
    if (task != null) {
      return openTask(task);
    }
    boolean opened = false;
    
    AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager().getConnectorForRepositoryTaskUrl(
      fullUrl);
    if (connector != null) {
      if ((repositoryUrl != null) && (taskId != null))
      {
        opened = TasksUiInternal.openRepositoryTask(connector.getConnectorKind(), repositoryUrl, taskId, null, 
          timestamp);
      }
      else
      {
        repositoryUrl = connector.getRepositoryUrlFromTaskUrl(fullUrl);
        taskId = connector.getTaskIdFromTaskUrl(fullUrl);
        if ((repositoryUrl != null) && (taskId != null)) {
          opened = TasksUiInternal.openRepositoryTask(connector.getConnectorKind(), repositoryUrl, taskId, 
            null, timestamp);
        }
      }
    }
    if (!opened) {
      openUrl(fullUrl);
    }
    return true;
  }
  
  public static boolean openTask(TaskRepository repository, String taskId)
  {
    Assert.isNotNull(repository);
    Assert.isNotNull(taskId);
    return TasksUiInternal.openTask(repository, taskId, null);
  }
  
  public static EditorHandle openTaskWithResult(TaskRepository repository, String taskId)
  {
    Assert.isNotNull(repository);
    Assert.isNotNull(taskId);
    EditorHandle handle = new EditorHandle();
    boolean opened = TasksUiInternal.openTask(repository, taskId, new TaskOpenListener()
    {
      public void taskOpened(TaskOpenEvent event)
      {
        setPart(event.getEditor());
        setItem(event.getTask());
        setStatus(Status.OK_STATUS);
      }
    });
    return opened ? handle : null;
  }
  
  public static void openUrl(String location)
  {
    BrowserUtil.openUrl(location, 131072);
  }
  
  public static boolean openWithBrowser(IRepositoryElement element)
  {
    TaskRepository repository = TasksUiInternal.getRepository(element);
    return (repository != null ? Boolean.valueOf(openWithBrowser(repository, element)) : null).booleanValue();
  }
  
  public static boolean openWithBrowser(TaskRepository repository, IRepositoryElement element)
  {
    String url = TasksUiInternal.getAuthenticatedUrl(repository, element);
    if (url != null)
    {
      openUrl(url);
      return true;
    }
    return false;
  }
  
  public static IViewPart openTasksViewInActivePerspective()
  {
    try
    {
      return 
      
        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView("org.eclipse.mylyn.tasks.ui.views.tasks");
    }
    catch (Exception e)
    {
      StatusHandler.log(new Status(4, "org.eclipse.mylyn.tasks.ui", "Could not show Task List view", e));
    }
    return null;
  }
  
  public static boolean getHighlightCurrentLine()
  {
    return 
    
      TasksUiPlugin.getDefault().getPreferenceStore().getBoolean("org.eclipse.mylyn.tasks.ui.editor.currentLineHighlight");
  }
}

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

import org.eclipse.jface.text.IRegion;

public abstract interface IHighlightingHyperlink
{
  public abstract IRegion getHighlightingRegion();
}

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

import java.text.MessageFormat;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.hyperlink.IHyperlink;
import org.eclipse.mylyn.internal.tasks.ui.Messages;
import org.eclipse.mylyn.internal.tasks.ui.util.TaskOpenEvent;
import org.eclipse.mylyn.internal.tasks.ui.util.TaskOpenListener;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;

public final class TaskHyperlink
  implements IHyperlink
{
  private final IRegion region;
  private final TaskRepository repository;
  private final String taskId;
  private Object selection;
  
  public TaskHyperlink(IRegion region, TaskRepository repository, String taskId)
  {
    this.region = region;
    this.repository = repository;
    this.taskId = taskId;
  }
  
  public IRegion getHyperlinkRegion()
  {
    return region;
  }
  
  public String getTaskId()
  {
    return taskId;
  }
  
  public String getTypeLabel()
  {
    return null;
  }
  
  public TaskRepository getRepository()
  {
    return repository;
  }
  
  public String getHyperlinkText()
  {
    return MessageFormat.format(Messages.TaskHyperlink_Open_Task_X_in_X, new Object[] { taskId, repository.getRepositoryLabel() });
  }
  
  public void open()
  {
    if (repository != null) {
      TasksUiInternal.openTask(repository, taskId, new TaskOpenListener()
      {
        public void taskOpened(TaskOpenEvent event)
        {
          if (selection == null) {
            return;
          }
          if ((event.getEditor() instanceof TaskEditor))
          {
            TaskEditor editor = (TaskEditor)event.getEditor();
            editor.selectReveal(selection);
          }
        }
      });
    } else {
      MessageDialog.openError(null, "Mylyn", Messages.TaskHyperlink_Could_not_determine_repository_for_report);
    }
  }
  
  public Object getSelection()
  {
    return selection;
  }
  
  public void setSelection(Object selection)
  {
    this.selection = selection;
  }
  
  public int hashCode()
  {
    int result = 1;
    result = 31 * result + (region == null ? 0 : region.hashCode());
    result = 31 * result + (repository == null ? 0 : repository.hashCode());
    result = 31 * result + (selection == null ? 0 : selection.hashCode());
    result = 31 * result + (taskId == null ? 0 : taskId.hashCode());
    return result;
  }
  
  public boolean equals(Object obj)
  {
    if (this == obj) {
      return true;
    }
    if (obj == null) {
      return false;
    }
    if (getClass() != obj.getClass()) {
      return false;
    }
    TaskHyperlink other = (TaskHyperlink)obj;
    if (region == null)
    {
      if (region != null) {
        return false;
      }
    }
    else if (!region.equals(region)) {
      return false;
    }
    if (repository == null)
    {
      if (repository != null) {
        return false;
      }
    }
    else if (!repository.equals(repository)) {
      return false;
    }
    if (selection == null)
    {
      if (selection != null) {
        return false;
      }
    }
    else if (!selection.equals(selection)) {
      return false;
    }
    if (taskId == null)
    {
      if (taskId != null) {
        return false;
      }
    }
    else if (!taskId.equals(taskId)) {
      return false;
    }
    return true;
  }
  
  public String toString()
  {
    return 
      "TaskHyperlink [region=" + region + ", repository=" + repository + ", selection=" + selection + ", taskId=" + taskId + "]";
  }
}

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

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import org.eclipse.mylyn.tasks.core.ITask;

public class TaskDropListener$TaskDropEvent
{
  private final Collection<ITask> tasks;
  private final ITask target;
  private final TaskDropListener.Operation operation;
  
  public TaskDropListener$TaskDropEvent(Collection<ITask> tasks, ITask target, TaskDropListener.Operation operation)
  {
    this.tasks = Collections.unmodifiableList(new ArrayList(tasks));
    this.target = target;
    this.operation = operation;
  }
  
  public Collection<ITask> getTasks()
  {
    return tasks;
  }
  
  public ITask getTarget()
  {
    return target;
  }
  
  public TaskDropListener.Operation getOperation()
  {
    return operation;
  }
}

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

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import org.eclipse.mylyn.tasks.core.ITask;

public abstract class TaskDropListener
{
  public abstract void tasksDropped(TaskDropEvent paramTaskDropEvent);
  
  public static enum Operation
  {
    COPY,  LINK,  DROP_ON_TASK_EDITOR;
  }
  
  public static class TaskDropEvent
  {
    private final Collection<ITask> tasks;
    private final ITask target;
    private final TaskDropListener.Operation operation;
    
    public TaskDropEvent(Collection<ITask> tasks, ITask target, TaskDropListener.Operation operation)
    {
      this.tasks = Collections.unmodifiableList(new ArrayList(tasks));
      this.target = target;
      this.operation = operation;
    }
    
    public Collection<ITask> getTasks()
    {
      return tasks;
    }
    
    public ITask getTarget()
    {
      return target;
    }
    
    public TaskDropListener.Operation getOperation()
    {
      return operation;
    }
  }
}

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

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.hyperlink.AbstractHyperlinkDetector;
import org.eclipse.jface.text.hyperlink.IHyperlink;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.tasks.core.IRepositoryManager;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;

public abstract class AbstractTaskHyperlinkDetector
  extends AbstractHyperlinkDetector
{
  public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks)
  {
    IDocument document = textViewer.getDocument();
    if ((document == null) || (document.getLength() == 0)) {
      return null;
    }
    try
    {
      int index;
      if (region.getLength() == 0)
      {
        IRegion lineInfo = document.getLineInformationOfOffset(region.getOffset());
        int lineLength = lineInfo.getLength();
        int lineOffset = lineInfo.getOffset();
        int lineEnd = lineOffset + lineLength;
        int regionEnd = region.getOffset() + region.getLength();
        int index;
        if (lineOffset < region.getOffset())
        {
          int regionLength = Math.max(regionEnd, lineEnd) - lineOffset;
          int contentOffset = lineOffset;
          String content = document.get(lineOffset, regionLength);
          index = region.getOffset() - lineOffset;
        }
        else
        {
          int regionLength = Math.max(regionEnd, lineEnd) - region.getOffset();
          int contentOffset = region.getOffset();
          String content = document.get(contentOffset, regionLength);
          index = 0;
        }
      }
      else
      {
        String content = document.get(region.getOffset(), region.getLength());
        int contentOffset = region.getOffset();
        index = -1;
      }
    }
    catch (BadLocationException localBadLocationException)
    {
      int index;
      return null;
    }
    int index;
    int contentOffset;
    String content;
    List<IHyperlink> hyperlinks = detectHyperlinks(textViewer, content, index, contentOffset);
    if (hyperlinks == null) {
      return null;
    }
    if (region.getLength() == 0) {
      for (Iterator<IHyperlink> it = hyperlinks.iterator(); it.hasNext();)
      {
        IHyperlink hyperlink = (IHyperlink)it.next();
        IRegion hyperlinkRegion = hyperlink.getHyperlinkRegion();
        if (!isInRegion(region, hyperlinkRegion)) {
          it.remove();
        }
      }
    }
    if (hyperlinks.isEmpty()) {
      return null;
    }
    return (IHyperlink[])hyperlinks.toArray(new IHyperlink[hyperlinks.size()]);
  }
  
  protected abstract List<IHyperlink> detectHyperlinks(ITextViewer paramITextViewer, String paramString, int paramInt1, int paramInt2);
  
  private boolean isInRegion(IRegion detectInRegion, IRegion hyperlinkRegion)
  {
    return (detectInRegion.getOffset() >= hyperlinkRegion.getOffset()) && (detectInRegion.getOffset() <= hyperlinkRegion.getOffset() + hyperlinkRegion.getLength());
  }
  
  protected List<TaskRepository> getTaskRepositories(ITextViewer textViewer)
  {
    List<TaskRepository> repositories = new ArrayList();
    TaskRepository selectedRepository = getTaskRepository(textViewer);
    if (selectedRepository != null) {
      repositories.add(selectedRepository);
    } else {
      repositories.addAll(TasksUi.getRepositoryManager().getAllRepositories());
    }
    return repositories;
  }
  
  protected TaskRepository getTaskRepository(ITextViewer textViewer)
  {
    TaskRepository repository = (TaskRepository)getAdapter(TaskRepository.class);
    if (repository != null) {
      return repository;
    }
    IResource resource = (IResource)getAdapter(IResource.class);
    if (resource == null)
    {
      IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
      if (window != null)
      {
        IWorkbenchPage activePage = window.getActivePage();
        if (activePage != null)
        {
          IWorkbenchPart part = activePage.getActivePart();
          if ((part instanceof IEditorPart))
          {
            IEditorInput input = ((IEditorPart)part).getEditorInput();
            if (input != null) {
              resource = (IResource)input.getAdapter(IResource.class);
            }
          }
        }
      }
    }
    if (resource != null) {
      return TasksUiPlugin.getDefault().getRepositoryForResource(resource);
    }
    return null;
  }
}

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

import org.eclipse.mylyn.internal.tasks.ui.util.TaskOpenEvent;
import org.eclipse.mylyn.internal.tasks.ui.util.TaskOpenListener;
import org.eclipse.mylyn.tasks.ui.edito
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