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

eHandler
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.tasks.ui.commands;

import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.mylyn.internal.tasks.core.data.TaskDataManager;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.tasks.core.ITask;

public class MarkTaskHandler$MarkTaskReadHandler
  extends AbstractTaskHandler
{
  protected void execute(ExecutionEvent event, ITask task)
    throws ExecutionException
  {
    TasksUiPlugin.getTaskDataManager().setTaskRead(task, true);
  }
}

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

import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
import org.eclipse.mylyn.tasks.core.IRepositoryElement;
import org.eclipse.mylyn.tasks.core.ITask;

public class OpenSelectedTaskHandler
  extends AbstractTaskListViewHandler
{
  protected void execute(ExecutionEvent event, TaskListView taskListView, IRepositoryElement item)
  {
    if ((item instanceof ITask)) {
      TasksUiInternal.openTaskInBackground((AbstractTask)item, true);
    }
  }
}

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

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import org.eclipse.core.commands.common.CommandException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.ComboViewer;
import org.eclipse.jface.viewers.DecoratingLabelProvider;
import org.eclipse.jface.viewers.IOpenListener;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.OpenEvent;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.internal.tasks.core.AbstractTaskCategory;
import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
import org.eclipse.mylyn.internal.tasks.core.ITaskRepositoryFilter;
import org.eclipse.mylyn.internal.tasks.core.TaskList;
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryManager;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskRepositoryLabelProvider;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.IRepositoryElement;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.TaskElementLabelProvider;
import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IDecoratorManager;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.SelectionStatusDialog;
import org.eclipse.ui.handlers.IHandlerService;

public class RemoteTaskSelectionDialog
  extends SelectionStatusDialog
{
  private Text idText;
  private TableViewer tasksViewer;
  private ComboViewer repositoriesViewer;
  private Button addToTaskListCheck;
  private ComboViewer categoryViewer;
  private String[] selectedIds;
  private TaskRepository selectedRepository;
  private AbstractTask selectedTask;
  private boolean shouldAddToTaskList;
  private AbstractTaskCategory selectedCategory;
  
  public RemoteTaskSelectionDialog(Shell parent)
  {
    super(parent);
    setShellStyle(getShellStyle() | 0x10);
    setStatusLineAboveButtons(true);
  }
  
  private List<TaskRepository> getTaskRepositories()
  {
    List<TaskRepository> repositories = new ArrayList();
    TaskRepositoryManager repositoryManager = TasksUiPlugin.getRepositoryManager();
    Iterator localIterator2;
    for (Iterator localIterator1 = repositoryManager.getRepositoryConnectors().iterator(); localIterator1.hasNext(); localIterator2.hasNext())
    {
      AbstractRepositoryConnector connector = (AbstractRepositoryConnector)localIterator1.next();
      Set<TaskRepository> connectorRepositories = repositoryManager.getRepositories(connector.getConnectorKind());
      localIterator2 = connectorRepositories.iterator(); continue;TaskRepository repository = (TaskRepository)localIterator2.next();
      if (ITaskRepositoryFilter.CAN_CREATE_TASK_FROM_KEY.accept(repository, connector)) {
        repositories.add(repository);
      }
    }
    return repositories;
  }
  
  protected Control createDialogArea(Composite parent)
  {
    Composite area = (Composite)super.createDialogArea(parent);
    
    Label idLabel = new Label(area, 0);
    idLabel.setText(Messages.RemoteTaskSelectionDialog_Enter_Key_ID__use_comma_for_multiple_);
    idText = new Text(area, 2048);
    idText.setLayoutData(new GridData(4, 4, true, false));
    
    Label matchingTasksLabel = new Label(area, 0);
    matchingTasksLabel.setText(Messages.RemoteTaskSelectionDialog_Matching_tasks);
    tasksViewer = new TableViewer(area, 2820);
    tasksViewer.getControl().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(400, 400).create());
    tasksViewer.setLabelProvider(new DecoratingLabelProvider(new TaskElementLabelProvider(true), 
      PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator()));
    tasksViewer.setContentProvider(new ArrayContentProvider());
    tasksViewer.addFilter(new ViewerFilter()
    {
      public boolean select(Viewer viewer, Object parentElement, Object element)
      {
        if (selectedIds == null) {
          return false;
        }
        if (!(element instanceof ITask)) {
          return false;
        }
        ITask task = (ITask)element;
        String taskId = task.getTaskKey();
        String[] arrayOfString;
        int j = (arrayOfString = selectedIds).length;
        for (int i = 0; i < j; i++)
        {
          String id = arrayOfString[i];
          if (id.equals(taskId)) {
            return true;
          }
        }
        return false;
      }
    });
    tasksViewer.setInput(TasksUiPlugin.getTaskList().getAllTasks());
    idText.addModifyListener(new ModifyListener()
    {
      public void modifyText(ModifyEvent e)
      {
        RemoteTaskSelectionDialog.this.computeIds();
        RemoteTaskSelectionDialog.this.validate();
        tasksViewer.refresh(false);
      }
    });
    tasksViewer.addSelectionChangedListener(new ISelectionChangedListener()
    {
      public void selectionChanged(SelectionChangedEvent event)
      {
        RemoteTaskSelectionDialog.this.validate();
      }
    });
    tasksViewer.addOpenListener(new IOpenListener()
    {
      public void open(OpenEvent event)
      {
        if (getOkButton().getEnabled()) {
          okPressed();
        }
      }
    });
    Table table = tasksViewer.getTable();
    table.showSelection();
    
    Composite repositoriesComposite = new Composite(area, 0);
    repositoriesComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    repositoriesComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(3).create());
    
    Label repositoriesLabel = new Label(repositoriesComposite, 0);
    repositoriesLabel.setText(Messages.RemoteTaskSelectionDialog_Select_a_task_repository);
    
    repositoriesViewer = new ComboViewer(repositoriesComposite, 12);
    repositoriesViewer.setLabelProvider(new TaskRepositoryLabelProvider());
    repositoriesViewer.setContentProvider(new ArrayContentProvider());
    List<TaskRepository> taskRepositories = getTaskRepositories();
    repositoriesViewer.setInput(taskRepositories);
    if (taskRepositories.size() == 1) {
      repositoriesViewer.setSelection(new StructuredSelection(taskRepositories.get(0)));
    }
    TaskRepository currentRepository = TasksUiUtil.getSelectedRepository(null);
    if (currentRepository != null) {
      repositoriesViewer.setSelection(new StructuredSelection(currentRepository), true);
    }
    repositoriesViewer.getControl().setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    repositoriesViewer.addSelectionChangedListener(new ISelectionChangedListener()
    {
      public void selectionChanged(SelectionChangedEvent event)
      {
        tasksViewer.setSelection(StructuredSelection.EMPTY);
        RemoteTaskSelectionDialog.this.validate();
      }
    });
    Button addRepositoryButton = new Button(repositoriesComposite, 0);
    addRepositoryButton.setText(Messages.RemoteTaskSelectionDialog_Add_);
    addRepositoryButton.setEnabled(TasksUiPlugin.getRepositoryManager().hasUserManagedRepositoryConnectors());
    addRepositoryButton.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent event)
      {
        IHandlerService hndSvc = (IHandlerService)PlatformUI.getWorkbench().getService(IHandlerService.class);
        try
        {
          hndSvc.executeCommand("org.eclipse.mylyn.tasks.ui.command.addTaskRepository", null);
          repositoriesViewer.setInput(RemoteTaskSelectionDialog.this.getTaskRepositories());
        }
        catch (CommandException e)
        {
          StatusHandler.log(new Status(4, "org.eclipse.mylyn.tasks.ui", e.getMessage(), e));
        }
      }
    });
    Composite addToTaskListComposite = new Composite(area, 0);
    addToTaskListComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).create());
    
    addToTaskListCheck = new Button(addToTaskListComposite, 32);
    addToTaskListCheck.setText(Messages.RemoteTaskSelectionDialog_Add_to_Task_List_category);
    
    categoryViewer = new ComboViewer(addToTaskListComposite, 12);
    categoryViewer.setContentProvider(new ArrayContentProvider());
    TaskList taskList = TasksUiPlugin.getTaskList();
    LinkedList<AbstractTaskContainer> categories = new LinkedList(taskList.getCategories());
    categories.addFirst(taskList.getDefaultCategory());
    categoryViewer.setInput(categories);
    categoryViewer.setLabelProvider(new LabelProvider()
    {
      public String getText(Object element)
      {
        if ((element instanceof IRepositoryElement)) {
          return ((IRepositoryElement)element).getSummary();
        }
        return super.getText(element);
      }
    });
    categoryViewer.setSelection(new StructuredSelection(taskList.getDefaultCategory()));
    
    categoryViewer.getControl().setEnabled(addToTaskListCheck.getSelection());
    addToTaskListCheck.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        categoryViewer.getControl().setEnabled(addToTaskListCheck.getSelection());
      }
    });
    idText.addKeyListener(new KeyAdapter()
    {
      public void keyPressed(KeyEvent e)
      {
        if (keyCode == 16777218) {
          tasksViewer.getControl().setFocus();
        }
      }
    });
    validate();
    
    Dialog.applyDialogFont(area);
    return area;
  }
  
  private void validate()
  {
    if (idText.getText().trim().equals(""))
    {
      updateStatus(new Status(1, "org.eclipse.mylyn.tasks.ui", 0, 
        Messages.RemoteTaskSelectionDialog_Enter_a_valid_task_ID, null));
      return;
    }
    if ((tasksViewer.getSelection().isEmpty()) && (repositoriesViewer.getSelection().isEmpty()))
    {
      updateStatus(new Status(1, "org.eclipse.mylyn.tasks.ui", 0, 
        Messages.RemoteTaskSelectionDialog_Select_a_task_or_repository, null));
      return;
    }
    updateStatus(new Status(0, "org.eclipse.mylyn.tasks.ui", 0, "", null));
  }
  
  protected void updateStatus(IStatus status)
  {
    super.updateStatus(status);
    
    Button okButton = getOkButton();
    if ((okButton != null) && (!okButton.isDisposed())) {
      okButton.setEnabled(status.isOK());
    }
  }
  
  public String[] getSelectedIds()
  {
    return selectedIds;
  }
  
  public TaskRepository getSelectedTaskRepository()
  {
    return selectedRepository;
  }
  
  public AbstractTask getSelectedTask()
  {
    return selectedTask;
  }
  
  public boolean shouldAddToTaskList()
  {
    return shouldAddToTaskList;
  }
  
  public AbstractTaskCategory getSelectedCategory()
  {
    return selectedCategory;
  }
  
  protected void computeResult()
  {
    computeIds();
    
    ISelection taskSelection = tasksViewer.getSelection();
    if (!taskSelection.isEmpty()) {
      selectedTask = ((AbstractTask)((IStructuredSelection)taskSelection).getFirstElement());
    } else {
      selectedRepository = ((TaskRepository)((IStructuredSelection)repositoriesViewer.getSelection()).getFirstElement());
    }
    shouldAddToTaskList = addToTaskListCheck.getSelection();
    if (shouldAddToTaskList) {
      selectedCategory = ((AbstractTaskCategory)((IStructuredSelection)categoryViewer.getSelection()).getFirstElement());
    }
  }
  
  private void computeIds()
  {
    selectedIds = idText.getText().split(",");
    String[] arrayOfString;
    int j = (arrayOfString = selectedIds).length;
    for (int i = 0; i < j; i++)
    {
      String id = arrayOfString[i];
      id = id.trim();
    }
  }
}

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

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IAdapterManager;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.tasks.core.IRepositoryElement;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.ITaskContainer;
import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
import org.eclipse.mylyn.tasks.ui.editors.TaskEditorInput;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.handlers.HandlerUtil;

public abstract class AbstractTaskHandler
  extends AbstractHandler
{
  protected boolean recurse;
  protected boolean singleTask;
  
  public Object execute(ExecutionEvent event)
    throws ExecutionException
  {
    ISelection selection = HandlerUtil.getActiveMenuSelection(event);
    if ((selection == null) || (selection.isEmpty())) {
      selection = HandlerUtil.getCurrentSelection(event);
    }
    boolean processed = process(event, selection);
    if (!processed)
    {
      IWorkbenchPart part = HandlerUtil.getActivePart(event);
      if ((part instanceof TaskEditor))
      {
        selection = new StructuredSelection(((TaskEditor)part).getTaskEditorInput().getTask());
        processed = process(event, selection);
      }
    }
    return null;
  }
  
  private boolean process(ExecutionEvent event, ISelection selection)
    throws ExecutionException
  {
    boolean processed = false;
    if ((selection instanceof IStructuredSelection))
    {
      Object[] items = ((IStructuredSelection)selection).toArray();
      if (singleTask)
      {
        if ((items.length == 1) && ((items[0] instanceof ITask))) {
          processed |= process(event, items[0], false);
        }
      }
      else
      {
        Object[] arrayOfObject1;
        int j = (arrayOfObject1 = items).length;
        for (int i = 0; i < j; i++)
        {
          Object item = arrayOfObject1[i];
          processed |= process(event, item, recurse);
        }
      }
    }
    return processed;
  }
  
  private boolean process(ExecutionEvent event, Object item, boolean recurse)
    throws ExecutionException
  {
    if (!(item instanceof IRepositoryElement)) {
      item = Platform.getAdapterManager().getAdapter(item, ITask.class);
    }
    if ((item instanceof ITask))
    {
      execute(event, (ITask)item);
      return true;
    }
    if (((item instanceof ITaskContainer)) && ((recurse) || (!(item instanceof AbstractTask))))
    {
      execute(event, (ITaskContainer)item);
      return true;
    }
    return false;
  }
  
  protected void execute(ExecutionEvent event, ITaskContainer item)
    throws ExecutionException
  {
    for (ITask task : item.getChildren()) {
      process(event, task, true);
    }
  }
  
  protected void execute(ExecutionEvent event, ITask task)
    throws ExecutionException
  {}
}

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

import org.eclipse.jface.viewers.IOpenListener;
import org.eclipse.jface.viewers.OpenEvent;
import org.eclipse.swt.widgets.Button;

class RemoteTaskSelectionDialog$4
  implements IOpenListener
{
  RemoteTaskSelectionDialog$4(RemoteTaskSelectionDialog paramRemoteTaskSelectionDialog) {}
  
  public void open(OpenEvent event)
  {
    if (this$0.getOkButton().getEnabled()) {
      RemoteTaskSelectionDialog.access$4(this$0);
    }
  }
}

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

import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.mylyn.internal.tasks.core.TaskCategory;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
import org.eclipse.mylyn.tasks.core.IRepositoryElement;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;

public class OpenTaskListElementPropertiesHandler
  extends AbstractTaskListViewHandler
{
  protected void execute(ExecutionEvent event, TaskListView taskListView, IRepositoryElement item)
  {
    if (((item instanceof TaskCategory)) || ((item instanceof IRepositoryQuery))) {
      TasksUiInternal.refreshAndOpenTaskListElement(item);
    }
  }
}

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

import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.mylyn.internal.tasks.core.data.TaskDataManager;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.tasks.core.ITask;

public class MarkTaskHandler$MarkTaskUnreadHandler
  extends AbstractTaskHandler
{
  protected void execute(ExecutionEvent event, ITask task)
    throws ExecutionException
  {
    TasksUiPlugin.getTaskDataManager().setTaskRead(task, false);
  }
}

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

import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.mylyn.internal.tasks.core.data.TaskDataManager;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.util.TreeWalker.Direction;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
import org.eclipse.mylyn.tasks.core.IRepositoryElement;
import org.eclipse.mylyn.tasks.core.ITask;

public class MarkTaskHandler$MarkTaskReadGoToPreviousUnreadTaskHandler
  extends AbstractTaskListViewHandler
{
  protected void execute(ExecutionEvent event, TaskListView taskListView, IRepositoryElement item)
    throws ExecutionException
  {
    if ((item instanceof ITask))
    {
      ITask task = (ITask)item;
      TasksUiPlugin.getTaskDataManager().setTaskRead(task, true);
      GoToUnreadTaskHandler.execute(event, TreeWalker.Direction.UP);
    }
  }
}

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

import java.util.Collections;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.mylyn.internal.tasks.ui.actions.ClearOutgoingAction;
import org.eclipse.mylyn.tasks.core.ITask;

public class MarkTaskHandler$ClearOutgoingHandler
  extends AbstractTaskHandler
{
  protected void execute(ExecutionEvent event, ITask task)
    throws ExecutionException
  {
    ClearOutgoingAction action = new ClearOutgoingAction(Collections.singletonList(task));
    if (action.isEnabled()) {
      action.run();
    }
  }
}

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

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
import org.eclipse.ui.handlers.HandlerUtil;

public class OpenTaskRepositoryPropertiesHandler
  extends AbstractHandler
{
  public Object execute(ExecutionEvent event)
    throws ExecutionException
  {
    ISelection selection = HandlerUtil.getCurrentSelection(event);
    if ((selection instanceof IStructuredSelection))
    {
      Object item = ((IStructuredSelection)selection).getFirstElement();
      if ((item instanceof TaskRepository)) {
        TasksUiUtil.openEditRepositoryWizard((TaskRepository)item);
      }
    }
    return null;
  }
}

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

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;

public class SynchronizeAllHandler
  extends AbstractHandler
{
  public Object execute(ExecutionEvent event)
    throws ExecutionException
  {
    TasksUiInternal.synchronizeAllRepositories(true);
    return null;
  }
}

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

import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;

class ShowTasksConnectorDiscoveryWizardCommandHandler$1$1
  extends SelectionAdapter
{
  ShowTasksConnectorDiscoveryWizardCommandHandler$1$1(ShowTasksConnectorDiscoveryWizardCommandHandler.1 param1, Button paramButton) {}
  
  public void widgetSelected(SelectionEvent event)
  {
    TasksUiPlugin.getDefault().getPreferenceStore().setValue("org.eclipse.mylyn.tasks.ui.messages.enabled", 
      val$button.getSelection());
  }
}

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

import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;

class RemoteTaskSelectionDialog$5
  implements ISelectionChangedListener
{
  RemoteTaskSelectionDialog$5(RemoteTaskSelectionDialog paramRemoteTaskSelectionDialog) {}
  
  public void selectionChanged(SelectionChangedEvent event)
  {
    RemoteTaskSelectionDialog.access$3(this$0).setSelection(StructuredSelection.EMPTY);
    RemoteTaskSelectionDialog.access$2(this$0);
  }
}

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

import java.util.Iterator;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.jface.viewers.ITreeSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
import org.eclipse.mylyn.tasks.core.IRepositoryElement;
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchSite;
import org.eclipse.ui.handlers.HandlerUtil;

public abstract class AbstractTaskListViewHandler
  extends AbstractHandler
{
  public Object execute(ExecutionEvent event)
    throws ExecutionException
  {
    IWorkbenchSite site = HandlerUtil.getActiveSite(event);
    if ((site instanceof IViewSite))
    {
      IViewSite viewSite = (IViewSite)site;
      IWorkbenchPart part = viewSite.getPart();
      if ((part instanceof TaskListView))
      {
        TaskListView taskListView = (TaskListView)part;
        execute(event, taskListView);
      }
    }
    return null;
  }
  
  protected void execute(ExecutionEvent event, TaskListView taskListView)
    throws ExecutionException
  {
    ITreeSelection selection = (ITreeSelection)taskListView.getViewer().getSelection();
    for (Iterator<?> it = selection.iterator(); it.hasNext();)
    {
      Object item = it.next();
      if ((item instanceof IRepositoryElement)) {
        execute(event, taskListView, (IRepositoryElement)item);
      }
    }
  }
  
  protected void execute(ExecutionEvent event, TaskListView taskListView, IRepositoryElement item)
    throws ExecutionException
  {}
}

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

import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.mylyn.internal.tasks.core.TaskList;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
import org.eclipse.mylyn.tasks.core.ITask;

public class MarkTaskHandler$MarkTaskIncompleteHandler
  extends AbstractTaskHandler
{
  protected void execute(ExecutionEvent event, ITask task)
    throws ExecutionException
  {
    if (TasksUiInternal.hasLocalCompletionState(task))
    {
      task.setCompletionDate(null);
      TasksUiPlugin.getTaskList().notifyElementChanged(task);
    }
  }
}

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

import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.mylyn.commons.workbench.WorkbenchUtil;
import org.eclipse.mylyn.internal.tasks.ui.editors.Messages;
import org.eclipse.mylyn.monitor.ui.IActivityContextManager;
import org.eclipse.mylyn.monitor.ui.MonitorUi;
import org.eclipse.mylyn.tasks.core.ITask;

public class MarkTaskHandler$ClearActiveTimeHandler
  extends AbstractTaskHandler
{
  protected void execute(ExecutionEvent event, ITask task)
    throws ExecutionException
  {
    if (MessageDialog.openConfirm(WorkbenchUtil.getShell(), 
      Messages.TaskEditorPlanningPart_Confirm_Activity_Time_Deletion, 
      Messages.TaskEditorPlanningPart_Do_you_wish_to_reset_your_activity_time_on_this_task_)) {
      MonitorUi.getActivityContextManager().removeActivityTime(task.getHandleIdentifier(), 0L, 
        System.currentTimeMillis());
    }
  }
}

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

import java.util.List;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.mylyn.tasks.core.ITaskAttachment;
import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
import org.eclipse.ui.handlers.HandlerUtil;

public class OpenTaskAttachmentInBrowserHandler
  extends AbstractHandler
{
  public Object execute(ExecutionEvent event)
    throws ExecutionException
  {
    ISelection selection = HandlerUtil.getCurrentSelection(event);
    if ((selection instanceof IStructuredSelection))
    {
      List<?> items = ((IStructuredSelection)selection).toList();
      for (Object item : items) {
        if ((item instanceof ITaskAttachment)) {
          TasksUiUtil.openUrl(((ITaskAttachment)item).getUrl());
        }
      }
    }
    return null;
  }
}

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

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.jface.action.IAction;
import org.eclipse.mylyn.internal.tasks.ui.editors.EditorUtil;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchSite;
import org.eclipse.ui.forms.editor.FormEditor;
import org.eclipse.ui.forms.editor.IFormPage;
import org.eclipse.ui.handlers.HandlerUtil;

public class MaximizePartHandler
  extends AbstractHandler
{
  public Object execute(ExecutionEvent event)
    throws ExecutionException
  {
    IWorkbenchSite site = HandlerUtil.getActiveSite(event);
    if ((site instanceof IEditorSite))
    {
      IWorkbenchPart part = ((IEditorSite)site).getPart();
      if ((part instanceof FormEditor))
      {
        IFormPage page = ((FormEditor)part).getActivePageInstance();
        Control focusedControl = EditorUtil.getFocusControl(page);
        if (focusedControl != null)
        {
          Object data = focusedControl.getData("maximizeAction");
          if ((data instanceof IAction))
          {
            IAction action = (IAction)data;
            action.setChecked(!action.isChecked());
            action.run();
          }
        }
      }
    }
    return null;
  }
}

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

import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.ITaskActivityManager;
import org.eclipse.mylyn.tasks.ui.TasksUi;

public class DeactivateTaskHandler
  extends AbstractTaskHandler
{
  public DeactivateTaskHandler()
  {
    singleTask = true;
  }
  
  protected void execute(ExecutionEvent event, ITask task)
    throws ExecutionException
  {
    TasksUi.getTaskActivityManager().deactivateTask(task);
  }
}

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

import java.util.Date;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.mylyn.internal.tasks.core.TaskList;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
import org.eclipse.mylyn.tasks.core.ITask;

public class MarkTaskHandler$MarkTaskCompleteHandler
  extends AbstractTaskHandler
{
  public static final String ID_COMMAND = "org.eclipse.mylyn.tasks.ui.command.markTaskComplete";
  
  protected void execute(ExecutionEvent event, ITask task)
    throws ExecutionException
  {
    if (TasksUiInternal.hasLocalCompletionState(task))
    {
      task.setCompletionDate(new Date());
      TasksUiPlugin.getTaskList().notifyElementChanged(task);
    }
  }
}

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

import org.eclipse.core.commands.common.CommandException;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.viewers.ComboViewer;
import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.handlers.IHandlerService;

class RemoteTaskSelectionDialog$6
  extends SelectionAdapter
{
  RemoteTaskSelectionDialog$6(RemoteTaskSelectionDialog paramRemoteTaskSelectionDialog) {}
  
  public void widgetSelected(SelectionEvent event)
  {
    IHandlerService hndSvc = (IHandlerService)PlatformUI.getWorkbench().getService(IHandlerService.class);
    try
    {
      hndSvc.executeCommand("org.eclipse.mylyn.tasks.ui.command.addTaskRepository", null);
      RemoteTaskSelectionDialog.access$5(this$0).setInput(RemoteTaskSelectionDialog.access$6(this$0));
    }
    catch (CommandException e)
    {
      StatusHandler.log(new Status(4, "org.eclipse.mylyn.tasks.ui", e.getMessage(), e));
    }
  }
}

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

import java.util.Collections;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.jface.action.ContributionItem;
import org.eclipse.mylyn.internal.tasks.ui.ITaskAttachmentViewer;
import org.eclipse.mylyn.internal.tasks.ui.TaskAttachmentViewerManager;
import org.eclipse.mylyn.internal.tasks.ui.util.AttachmentUtil;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
import org.eclipse.mylyn.tasks.core.ITaskAttachment;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;

public class OpenTaskAttachmentWithMenu
  extends ContributionItem
{
  private final TaskAttachmentViewerManager manager = new TaskAttachmentViewerManager();
  
  public OpenTaskAttachmentWithMenu() {}
  
  public OpenTaskAttachmentWithMenu(String id)
  {
    super(id);
  }
  
  public void fill(Menu menu, int index)
  {
    List<ITaskAttachment> attachments = AttachmentUtil.getSelectedAttachments(null);
    if ((attachments.isEmpty()) || (attachments.size() > 1)) {
      return;
    }
    ITaskAttachment attachment = (ITaskAttachment)attachments.get(0);
    String viewerId = manager.getPreferredViewerID(attachment);
    
    int itemsAdded = 0;
    ITaskAttachmentViewer viewer = manager.getBrowserViewer(attachment);
    if (viewer != null)
    {
      itemsAdded = addItems(menu, index, Collections.singletonList(viewer), attachments, viewerId);
      index += itemsAdded;
    }
    List<ITaskAttachmentViewer> viewers = manager.getWorkbenchViewers(attachment);
    if (viewers.size() > 0)
    {
      itemsAdded = addSeparator(menu, index, itemsAdded);
      index += itemsAdded;
      
      itemsAdded = addItems(menu, index, viewers, attachments, viewerId);
      index += itemsAdded;
    }
    viewers = manager.getSystemViewers(attachment);
    if (viewers.size() > 0)
    {
      itemsAdded = addSeparator(menu, index, itemsAdded);
      index += itemsAdded;
      
      itemsAdded = addItems(menu, index, viewers, attachments, viewerId);
      index += itemsAdded;
    }
  }
  
  protected int addSeparator(Menu menu, int index, int itemsAdded)
  {
    if (itemsAdded > 0)
    {
      new MenuItem(menu, 2, index);
      return 1;
    }
    return 0;
  }
  
  protected int addItems(Menu menu, int index, List<ITaskAttachmentViewer> viewers, List<ITaskAttachment> attachments, String viewerId)
  {
    int i = 0;
    for (ITaskAttachmentViewer viewer : viewers)
    {
      MenuItem item = new MenuItem(menu, 16, index + i);
      item.setText(viewer.getLabel());
      item.addSelectionListener(new RunAssociatedViewer(viewer, attachments));
      if ((viewerId != null) && (viewerId.equals(viewer.getId()))) {
        item.setSelection(true);
      }
      i++;
    }
    return i;
  }
  
  private class RunAssociatedViewer
    extends SelectionAdapter
  {
    private final ITaskAttachmentViewer viewer;
    private final List<ITaskAttachment> attachments;
    
    RunAssociatedViewer(List<ITaskAttachment> handler)
    {
      this.attachments = attachments;
      viewer = handler;
    }
    
    public void widgetSelected(SelectionEvent event)
    {
      if (!((MenuItem)widget).getSelection()) {
        return;
      }
      IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
      if (window != null)
      {
        IWorkbenchPage page = window.getActivePage();
        if (page != null) {
          try
          {
            for (ITaskAttachment attachment : attachments)
            {
              manager.savePreferredViewerID(attachment, viewer.getId());
              try
      
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