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

ts()) {
          if ((element != null) && (element.getHandleIdentifier().equals(handle)))
          {
            remove = false;
            break;
          }
        }
      }
      else if ((adaptable instanceof IProject))
      {
        IProject project = ResourcesPlugin.getWorkspace()
          .getRoot()
          .getProject(((IProject)adaptable).getName());
        if ((project == null) || (!project.exists())) {
          remove = true;
        }
      }
      if (remove)
      {
        iter.remove();
        changed = true;
      }
    }
    if (changed) {
      workingSet.setElements((IAdaptable[])list.toArray(new IAdaptable[list.size()]));
    }
  }
  
  /* Error */
  public boolean contains(IWorkingSet workingSet)
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 355	org/eclipse/mylyn/internal/tasks/ui/workingsets/TaskWorkingSetUpdater:workingSets	Ljava/util/List;
    //   4: dup
    //   5: astore_2
    //   6: monitorenter
    //   7: aload_0
    //   8: getfield 355	org/eclipse/mylyn/internal/tasks/ui/workingsets/TaskWorkingSetUpdater:workingSets	Ljava/util/List;
    //   11: aload_1
    //   12: invokeinterface 400 2 0
    //   17: aload_2
    //   18: monitorexit
    //   19: ireturn
    //   20: aload_2
    //   21: monitorexit
    //   22: athrow
    // Line number table:
    //   Java source line #160	-> byte code offset #0
    //   Java source line #161	-> byte code offset #7
    //   Java source line #160	-> byte code offset #20
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	23	0	this	TaskWorkingSetUpdater
    //   0	23	1	workingSet	IWorkingSet
    //   5	16	2	Ljava/lang/Object;	Object
    // Exception table:
    //   from	to	target	type
    //   7	19	20	finally
    //   20	22	20	finally
  }
  
  /* Error */
  public boolean remove(IWorkingSet workingSet)
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 355	org/eclipse/mylyn/internal/tasks/ui/workingsets/TaskWorkingSetUpdater:workingSets	Ljava/util/List;
    //   4: dup
    //   5: astore_2
    //   6: monitorenter
    //   7: aload_0
    //   8: getfield 355	org/eclipse/mylyn/internal/tasks/ui/workingsets/TaskWorkingSetUpdater:workingSets	Ljava/util/List;
    //   11: aload_1
    //   12: invokeinterface 401 2 0
    //   17: aload_2
    //   18: monitorexit
    //   19: ireturn
    //   20: aload_2
    //   21: monitorexit
    //   22: athrow
    // Line number table:
    //   Java source line #166	-> byte code offset #0
    //   Java source line #167	-> byte code offset #7
    //   Java source line #166	-> byte code offset #20
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	23	0	this	TaskWorkingSetUpdater
    //   0	23	1	workingSet	IWorkingSet
    //   5	16	2	Ljava/lang/Object;	Object
    // Exception table:
    //   from	to	target	type
    //   7	19	20	finally
    //   20	22	20	finally
  }
  
  public void containersChanged(Set<TaskContainerDelta> delta)
  {
    if (!isEnabled()) {
      return;
    }
    for (TaskContainerDelta taskContainerDelta : delta) {
      if (((taskContainerDelta.getElement() instanceof TaskCategory)) || 
        ((taskContainerDelta.getElement() instanceof IRepositoryQuery))) {
        synchronized (workingSets)
        {
          ArrayList<IAdaptable> elements;
          switch (taskContainerDelta.getKind())
          {
          case CONTENT: 
            for (IWorkingSet workingSet : workingSets)
            {
              elements = new ArrayList(
                Arrays.asList(workingSet.getElements()));
              elements.remove(taskContainerDelta.getElement());
              workingSet.setElements((IAdaptable[])elements.toArray(new IAdaptable[elements.size()]));
            }
            break;
          case ADDED: 
            IWorkingSet[] arrayOfIWorkingSet;
            elements = (arrayOfIWorkingSet = getEnabledSets()).length;
            for (ArrayList<IAdaptable> localArrayList1 = 0; localArrayList1 < elements; localArrayList1++)
            {
              IWorkingSet workingSet = arrayOfIWorkingSet[localArrayList1];
              ArrayList<IAdaptable> elements = new ArrayList(
                Arrays.asList(workingSet.getElements()));
              elements.add(taskContainerDelta.getElement());
              workingSet.setElements((IAdaptable[])elements.toArray(new IAdaptable[elements.size()]));
            }
          }
        }
      }
    }
  }
  
  public static IWorkingSet[] getEnabledSets()
  {
    Set<IWorkingSet> workingSets = new HashSet();
    Set<IWorkbenchWindow> windows = MonitorUi.getMonitoredWindows();
    for (IWorkbenchWindow iWorkbenchWindow : windows)
    {
      IWorkbenchPage page = iWorkbenchWindow.getActivePage();
      if (page != null) {
        workingSets.addAll(Arrays.asList(page.getWorkingSets()));
      }
    }
    return (IWorkingSet[])workingSets.toArray(new IWorkingSet[workingSets.size()]);
  }
  
  public static boolean areNoTaskWorkingSetsEnabled()
  {
    IWorkingSet[] workingSets = PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSets();
    IWorkingSet[] arrayOfIWorkingSet1 = workingSets;int j = workingSets.length;
    for (int i = 0; i < j; i++)
    {
      IWorkingSet workingSet = arrayOfIWorkingSet1[i];
      if ((workingSet != null) && (workingSet.getId().equalsIgnoreCase(ID_TASK_WORKING_SET)) && 
        (isWorkingSetEnabled(workingSet))) {
        return false;
      }
    }
    return true;
  }
  
  public static boolean isWorkingSetEnabled(IWorkingSet set)
  {
    IWorkingSet[] enabledSets = getEnabledSets();
    IWorkingSet[] arrayOfIWorkingSet1;
    int j = (arrayOfIWorkingSet1 = enabledSets).length;
    for (int i = 0; i < j; i++)
    {
      IWorkingSet enabledSet = arrayOfIWorkingSet1[i];
      if (enabledSet.equals(set)) {
        return true;
      }
    }
    return false;
  }
  
  public static boolean isOnlyTaskWorkingSetEnabled(IWorkingSet set)
  {
    if (!isWorkingSetEnabled(set)) {
      return false;
    }
    IWorkingSet[] enabledSets = getEnabledSets();
    for (int i = 0; i < enabledSets.length; i++) {
      if ((!enabledSets[i].equals(set)) && 
        (enabledSets[i].getId().equalsIgnoreCase(ID_TASK_WORKING_SET))) {
        return false;
      }
    }
    return true;
  }
  
  private void processResourceDelta(TaskWorkingSetDelta result, IResourceDelta delta)
  {
    IResource resource = delta.getResource();
    int type = resource.getType();
    int index = result.indexOf(resource);
    int kind = delta.getKind();
    int flags = delta.getFlags();
    if ((kind == 4) && (type == 4) && (index != -1) && 
      ((flags & 0x4000) != 0)) {
      result.set(index, resource);
    }
    if ((index != -1) && (kind == 2)) {
      if ((flags & 0x2000) != 0) {
        result.set(index, ResourcesPlugin.getWorkspace().getRoot().findMember(delta.getMovedToPath()));
      } else {
        result.remove(index);
      }
    }
    if (projectGotClosedOrOpened(resource, kind, flags)) {
      return;
    }
    IResourceDelta[] children = delta.getAffectedChildren();
    IResourceDelta[] arrayOfIResourceDelta1;
    int j = (arrayOfIResourceDelta1 = children).length;
    for (int i = 0; i < j; i++)
    {
      IResourceDelta element = arrayOfIResourceDelta1[i];
      processResourceDelta(result, element);
    }
  }
  
  private boolean projectGotClosedOrOpened(IResource resource, int kind, int flags)
  {
    return (resource.getType() == 4) && (kind == 4) && ((flags & 0x4000) != 0);
  }
  
  public void resourceChanged(IResourceChangeEvent event)
  {
    for (IWorkingSet workingSet : workingSets)
    {
      TaskWorkingSetDelta workingSetDelta = new TaskWorkingSetDelta(workingSet);
      if (event.getDelta() != null) {
        processResourceDelta(workingSetDelta, event.getDelta());
      }
      workingSetDelta.process();
    }
  }
  
  public static void applyWorkingSetsToAllWindows(Collection<IWorkingSet> workingSets)
  {
    IWorkingSet[] workingSetArray = (IWorkingSet[])workingSets.toArray(new IWorkingSet[workingSets.size()]);
    int j;
    int i;
    for (Iterator localIterator = MonitorUi.getMonitoredWindows().iterator(); localIterator.hasNext(); i < j)
    {
      IWorkbenchWindow window = (IWorkbenchWindow)localIterator.next();
      IWorkbenchPage[] arrayOfIWorkbenchPage;
      j = (arrayOfIWorkbenchPage = window.getPages()).length;i = 0; continue;IWorkbenchPage page = arrayOfIWorkbenchPage[i];
      page.setWorkingSets(workingSetArray);i++;
    }
  }
  
  public static Set<IWorkingSet> getActiveWorkingSets(IWorkbenchWindow window)
  {
    if ((window != null) && (window.getActivePage() != null))
    {
      Set<IWorkingSet> allSets = new HashSet(Arrays.asList(window.getActivePage().getWorkingSets()));
      Set<IWorkingSet> tasksSets = new HashSet(allSets);
      for (IWorkingSet workingSet : allSets) {
        if ((workingSet.getId() == null) || 
          (!workingSet.getId().equalsIgnoreCase(ID_TASK_WORKING_SET))) {
          tasksSets.remove(workingSet);
        }
      }
      return tasksSets;
    }
    return Collections.emptySet();
  }
}

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

import org.eclipse.mylyn.tasks.core.IRepositoryElement;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IPersistableElement;

class TaskWorkingSetAdapterFactory$1
  implements IPersistableElement
{
  TaskWorkingSetAdapterFactory$1(TaskWorkingSetAdapterFactory paramTaskWorkingSetAdapterFactory, Object paramObject) {}
  
  public void saveState(IMemento memento)
  {
    IRepositoryElement container = (IRepositoryElement)val$adaptableObject;
    memento.putString("handle.task", container.getHandleIdentifier());
  }
  
  public String getFactoryId()
  {
    return "org.eclipse.mylyn.tasks.ui.workingSets.elementFactory";
  }
}

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

import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.ICheckStateListener;

class TaskWorkingSetPage$2
  implements ICheckStateListener
{
  TaskWorkingSetPage$2(TaskWorkingSetPage paramTaskWorkingSetPage) {}
  
  public void checkStateChanged(CheckStateChangedEvent event)
  {
    this$0.handleCheckStateChange(event);
  }
}

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

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.PlatformObject;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTreeViewer;
import org.eclipse.jface.viewers.DecoratingLabelProvider;
import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.mylyn.internal.tasks.core.AbstractTaskCategory;
import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
import org.eclipse.mylyn.internal.tasks.core.ITaskList;
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.internal.tasks.ui.views.TaskRepositoryLabelProvider;
import org.eclipse.mylyn.tasks.core.IRepositoryManager;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.TaskElementLabelProvider;
import org.eclipse.mylyn.tasks.ui.TasksUi;
import org.eclipse.mylyn.tasks.ui.TasksUiImages;
import org.eclipse.swt.custom.BusyIndicator;
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.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IDecoratorManager;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.IWorkingSetManager;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.IWorkingSetPage;
import org.eclipse.ui.internal.WorkbenchImages;
import org.eclipse.ui.model.IWorkbenchAdapter;
import org.eclipse.ui.model.WorkbenchLabelProvider;

public class TaskWorkingSetPage
  extends WizardPage
  implements IWorkingSetPage
{
  private static final int SIZING_SELECTION_WIDGET_WIDTH = 50;
  private static final int SIZING_SELECTION_WIDGET_HEIGHT = 200;
  private Text text;
  private CheckboxTreeViewer treeViewer;
  private IWorkingSet workingSet;
  private final WorkingSetPageContentProvider workingSetPageContentProvider = new WorkingSetPageContentProvider(null);
  private boolean firstCheck = false;
  
  private final class WorkingSetPageContentProvider
    implements ITreeContentProvider
  {
    private TaskWorkingSetPage.ElementCategory tasksContainer;
    private TaskWorkingSetPage.ElementCategory resourcesContainer;
    private final Map<IRepositoryQuery, TaskRepository> queryMap = new HashMap();
    private final Map<IProject, TaskWorkingSetPage.TaskRepositoryProjectMapping> projectMap = new HashMap();
    
    private WorkingSetPageContentProvider() {}
    
    public Object[] getChildren(Object parentElement)
    {
      IProject[] projects;
      if ((parentElement instanceof List))
      {
        List<IAdaptable> taskRepositoriesContainers = new ArrayList();
        List<IAdaptable> resourcesRepositoriesContainers = new ArrayList();
        for (AbstractTaskContainer category : TasksUiInternal.getTaskList().getCategories()) {
          taskRepositoriesContainers.add(category);
        }
        projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
        Object unmappedProjects = new HashSet();
        for (Object container : (List)parentElement) {
          if ((container instanceof TaskRepository))
          {
            if (hasChildren(container)) {
              taskRepositoriesContainers.add((TaskRepository)container);
            }
            Set<IProject> mappedProjects = new HashSet();
            IProject[] arrayOfIProject1;
            int j = (arrayOfIProject1 = projects).length;
            for (int i = 0; i < j; i++)
            {
              IProject project = arrayOfIProject1[i];
              TaskRepository taskRepository = TasksUiPlugin.getDefault()
                .getRepositoryForResource(project);
              if (container.equals(taskRepository)) {
                mappedProjects.add(project);
              } else if (taskRepository == null) {
                ((Set)unmappedProjects).add(project);
              }
            }
            if (!mappedProjects.isEmpty())
            {
              TaskWorkingSetPage.TaskRepositoryProjectMapping projectMapping = new TaskWorkingSetPage.TaskRepositoryProjectMapping(TaskWorkingSetPage.this, 
                (TaskRepository)container, mappedProjects);
              resourcesRepositoriesContainers.add(projectMapping);
              for (IProject mappedProject : mappedProjects) {
                projectMap.put(mappedProject, projectMapping);
              }
            }
          }
        }
        resourcesRepositoriesContainers.addAll((Collection)unmappedProjects);
        tasksContainer = new TaskWorkingSetPage.ElementCategory(TaskWorkingSetPage.this, Messages.TaskWorkingSetPage_Tasks, taskRepositoriesContainers);
        resourcesContainer = new TaskWorkingSetPage.ElementCategory(TaskWorkingSetPage.this, Messages.TaskWorkingSetPage_Resources, 
          resourcesRepositoriesContainers);
        return new Object[] { tasksContainer, resourcesContainer };
      }
      if ((parentElement instanceof TaskRepository))
      {
        List<IAdaptable> taskContainers = new ArrayList();
        for (AbstractTaskContainer element : TasksUiPlugin.getTaskList().getRepositoryQueries(
          ((TaskRepository)parentElement).getRepositoryUrl())) {
          if ((element instanceof IRepositoryQuery))
          {
            taskContainers.add(element);
            queryMap.put((IRepositoryQuery)element, (TaskRepository)parentElement);
          }
        }
        return taskContainers.toArray();
      }
      if ((parentElement instanceof TaskWorkingSetPage.TaskRepositoryProjectMapping)) {
        return ((TaskWorkingSetPage.TaskRepositoryProjectMapping)parentElement).getProjects().toArray();
      }
      if ((parentElement instanceof TaskWorkingSetPage.ElementCategory)) {
        return ((TaskWorkingSetPage.ElementCategory)parentElement).getChildren(parentElement);
      }
      return new Object[0];
    }
    
    public boolean hasChildren(Object element)
    {
      return getChildren(element).length > 0;
    }
    
    public Object[] getElements(Object element)
    {
      return getChildren(element);
    }
    
    public Object getParent(Object element)
    {
      if (((element instanceof AbstractTaskCategory)) || ((element instanceof TaskRepository))) {
        return tasksContainer;
      }
      if ((element instanceof IRepositoryQuery)) {
        return queryMap.get(element);
      }
      if ((element instanceof TaskWorkingSetPage.TaskRepositoryProjectMapping)) {
        return resourcesContainer;
      }
      if ((element instanceof IProject))
      {
        Object repository = projectMap.get(element);
        if (repository != null) {
          return repository;
        }
        return resourcesContainer;
      }
      return null;
    }
    
    public void dispose() {}
    
    public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
  }
  
  private class TaskRepositoryProjectMapping
    extends PlatformObject
  {
    private final TaskRepository taskRepository;
    private final Set<IProject> projects;
    
    public TaskRepositoryProjectMapping(Set<IProject> taskRepository)
    {
      this.taskRepository = taskRepository;
      projects = mappedProjects;
    }
    
    public Set<IProject> getProjects()
    {
      return projects;
    }
    
    public TaskRepository getTaskRepository()
    {
      return taskRepository;
    }
  }
  
  class ElementCategory
    extends PlatformObject
    implements IWorkbenchAdapter
  {
    private final String label;
    private final List<IAdaptable> children;
    
    public ElementCategory(List<IAdaptable> label)
    {
      this.label = label;
      this.children = children;
    }
    
    public Object[] getChildren(Object o)
    {
      return children.toArray();
    }
    
    public ImageDescriptor getImageDescriptor(Object object)
    {
      return WorkbenchImages.getImageDescriptor("IMG_OBJ_WORKING_SETS");
    }
    
    public String getLabel(Object o)
    {
      return label;
    }
    
    public Object getParent(Object o)
    {
      return null;
    }
  }
  
  class AggregateLabelProvider
    implements ILabelProvider
  {
    private final TaskElementLabelProvider taskLabelProvider = new TaskElementLabelProvider(false);
    private final TaskRepositoryLabelProvider taskRepositoryLabelProvider = new TaskRepositoryLabelProvider();
    private final WorkbenchLabelProvider workbenchLabelProvider = new WorkbenchLabelProvider();
    
    AggregateLabelProvider() {}
    
    public Image getImage(Object element)
    {
      if ((element instanceof AbstractTaskContainer)) {
        return taskLabelProvider.getImage(element);
      }
      if ((element instanceof TaskRepository)) {
        return taskRepositoryLabelProvider.getImage(element);
      }
      if ((element instanceof TaskWorkingSetPage.TaskRepositoryProjectMapping)) {
        return getImage(((TaskWorkingSetPage.TaskRepositoryProjectMapping)element).getTaskRepository());
      }
      return workbenchLabelProvider.getImage(element);
    }
    
    public String getText(Object element)
    {
      if ((element instanceof AbstractTaskContainer)) {
        return taskLabelProvider.getText(element);
      }
      if ((element instanceof TaskRepository)) {
        return taskRepositoryLabelProvider.getText(element);
      }
      if ((element instanceof TaskWorkingSetPage.TaskRepositoryProjectMapping)) {
        return getText(((TaskWorkingSetPage.TaskRepositoryProjectMapping)element).getTaskRepository());
      }
      return workbenchLabelProvider.getText(element);
    }
    
    public void addListener(ILabelProviderListener listener) {}
    
    public void dispose() {}
    
    public boolean isLabelProperty(Object element, String property)
    {
      return false;
    }
    
    public void removeListener(ILabelProviderListener listener) {}
  }
  
  class CustomSorter
    extends ViewerSorter
  {
    CustomSorter() {}
    
    public int compare(Viewer viewer, Object e1, Object e2)
    {
      if (((e1 instanceof TaskRepository)) || ((e1 instanceof TaskWorkingSetPage.TaskRepositoryProjectMapping))) {
        return -1;
      }
      if (((e2 instanceof TaskRepository)) || ((e2 instanceof TaskWorkingSetPage.TaskRepositoryProjectMapping))) {
        return 1;
      }
      if (((e1 instanceof TaskWorkingSetPage.ElementCategory)) && 
        (((TaskWorkingSetPage.ElementCategory)e1).getLabel(e1).equals(Messages.TaskWorkingSetPage_Tasks))) {
        return -1;
      }
      if (((e2 instanceof TaskWorkingSetPage.ElementCategory)) && 
        (((TaskWorkingSetPage.ElementCategory)e1).getLabel(e1).equals(Messages.TaskWorkingSetPage_Tasks))) {
        return 1;
      }
      return super.compare(viewer, e1, e2);
    }
  }
  
  public TaskWorkingSetPage()
  {
    super("taskWorkingSetPage", Messages.TaskWorkingSetPage_Select_Working_Set_Elements, null);
    setDescription(Messages.TaskWorkingSetPage_Page_Description);
    setImageDescriptor(TasksUiImages.BANNER_WORKING_SET);
  }
  
  public void finish()
  {
    Object[] elements = treeViewer.getCheckedElements();
    Set<IAdaptable> validElements = new HashSet();
    Object[] arrayOfObject1;
    int j = (arrayOfObject1 = elements).length;
    for (int i = 0; i < j; i++)
    {
      Object element = arrayOfObject1[i];
      if (((element instanceof AbstractTaskContainer)) || ((element instanceof IProject))) {
        validElements.add((IAdaptable)element);
      }
    }
    addSpecialContainers(validElements);
    if (workingSet == null)
    {
      IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager();
      workingSet = workingSetManager.createWorkingSet(getWorkingSetName(), 
        (IAdaptable[])validElements.toArray(new IAdaptable[validElements.size()]));
    }
    else
    {
      if (!getWorkingSetName().equals(workingSet.getName())) {
        workingSet.setName(getWorkingSetName());
      }
      workingSet.setElements((IAdaptable[])validElements.toArray(new IAdaptable[validElements.size()]));
    }
  }
  
  private void addSpecialContainers(Set<IAdaptable> validElements)
  {
    HashSet<AbstractTaskContainer> specialContainers = new HashSet();
    for (IAdaptable element : validElements) {
      if ((element instanceof IRepositoryQuery))
      {
        IRepositoryQuery query = (IRepositoryQuery)element;
        if (query.getRepositoryUrl() != null)
        {
          AbstractTaskContainer orphansContainer = TasksUiPlugin.getTaskList().getUnmatchedContainer(
            query.getRepositoryUrl());
          if (orphansContainer != null) {
            specialContainers.add(orphansContainer);
          }
          AbstractTaskContainer unsubmittedContainer = TasksUiPlugin.getTaskList().getUnsubmittedContainer(
            query.getRepositoryUrl());
          if (unsubmittedContainer != null) {
            specialContainers.add(unsubmittedContainer);
          }
        }
      }
    }
    validElements.addAll(specialContainers);
  }
  
  public IWorkingSet getSelection()
  {
    return workingSet;
  }
  
  public void setSelection(IWorkingSet workingSet)
  {
    this.workingSet = workingSet;
    if ((getShell() != null) && (text != null))
    {
      firstCheck = true;
      initializeCheckedState();
      text.setText(workingSet.getName());
    }
  }
  
  private String getWorkingSetName()
  {
    return text.getText();
  }
  
  public void createControl(Composite parent)
  {
    initializeDialogUnits(parent);
    
    Composite composite = new Composite(parent, 0);
    
    GridLayout layout = new GridLayout();
    marginWidth = convertHorizontalDLUsToPixels(7);
    marginHeight = convertVerticalDLUsToPixels(7);
    verticalSpacing = convertVerticalDLUsToPixels(4);
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(256));
    setControl(composite);
    
    Label label = new Label(composite, 64);
    label.setText("");
    label.setLayoutData(new GridData(772));
    
    text = new Text(composite, 2052);
    text.setLayoutData(new GridData(768));
    text.addModifyListener(new ModifyListener()
    {
      public void modifyText(ModifyEvent e)
      {
        validateInput();
      }
    });
    text.setFocus();
    
    label = new Label(composite, 64);
    label.setText("");
    label.setLayoutData(new GridData(772));
    
    treeViewer = new CheckboxTreeViewer(composite);
    treeViewer.setUseHashlookup(true);
    treeViewer.setContentProvider(workingSetPageContentProvider);
    
    treeViewer.setLabelProvider(new DecoratingLabelProvider(new AggregateLabelProvider(), PlatformUI.getWorkbench()
      .getDecoratorManager()
      .getLabelDecorator()));
    treeViewer.setSorter(new CustomSorter());
    
    ArrayList<Object> containers = new ArrayList();
    for (TaskRepository repository : TasksUi.getRepositoryManager().getAllRepositories()) {
      containers.add(repository);
    }
    containers.addAll(Arrays.asList(ResourcesPlugin.getWorkspace().getRoot().getProjects()));
    
    treeViewer.setInput(containers);
    
    GridData data = new GridData(1808);
    heightHint = 200;
    widthHint = 50;
    treeViewer.getControl().setLayoutData(data);
    
    treeViewer.addCheckStateListener(new ICheckStateListener()
    {
      public void checkStateChanged(CheckStateChangedEvent event)
      {
        handleCheckStateChange(event);
      }
    });
    Composite buttonComposite = new Composite(composite, 0);
    layout = new GridLayout(2, false);
    marginWidth = 0;
    marginHeight = 0;
    horizontalSpacing = convertHorizontalDLUsToPixels(4);
    buttonComposite.setLayout(layout);
    buttonComposite.setLayoutData(new GridData(256));
    
    Button selectAllButton = new Button(buttonComposite, 8);
    selectAllButton.setText(Messages.TaskWorkingSetPage_Select_All);
    selectAllButton.setToolTipText("");
    selectAllButton.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent selectionEvent)
      {
        treeViewer.setCheckedElements(workingSetPageContentProvider.getElements(treeViewer.getInput()));
        validateInput();
      }
    });
    setButtonLayoutData(selectAllButton);
    
    Button deselectAllButton = new Button(buttonComposite, 8);
    deselectAllButton.setText(Messages.TaskWorkingSetPage_Deselect_All);
    deselectAllButton.setToolTipText("");
    deselectAllButton.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent selectionEvent)
      {
        treeViewer.setCheckedElements(new Object[0]);
        validateInput();
      }
    });
    setButtonLayoutData(deselectAllButton);
    if (workingSet != null)
    {
      IAdaptable[] arrayOfIAdaptable;
      int j = (arrayOfIAdaptable = workingSet.getElements()).length;
      for (int i = 0; i < j; i++)
      {
        Object object = arrayOfIAdaptable[i];
        treeViewer.expandToLevel(object, 1);
      }
    }
    else
    {
      treeViewer.expandToLevel(2);
    }
    initializeCheckedState();
    if (workingSet != null) {
      text.setText(workingSet.getName());
    }
    setPageComplete(false);
    Dialog.applyDialogFont(composite);
  }
  
  private void initializeCheckedState()
  {
    BusyIndicator.showWhile(getShell().getDisplay(), new Runnable()
    {
      public void run()
      {
        Object[] items = null;
        if (workingSet != null)
        {
          items = workingSet.getElements();
          if (items != null)
          {
            treeViewer.setCheckedElements(new Object[0]);
            Object[] arrayOfObject1;
            int j = (arrayOfObject1 = items).length;
            for (int i = 0; i < j; i++)
            {
              Object item = arrayOfObject1[i];
              if (item != null) {
                treeViewer.setChecked(item, true);
              }
            }
          }
        }
      }
    });
  }
  
  protected void handleCheckStateChange(final CheckStateChangedEvent event)
  {
    BusyIndicator.showWhile(getShell().getDisplay(), new Runnable()
    {
      public void run()
      {
        IAdaptable element = (IAdaptable)event.getElement();
        handleCheckStateChangeHelper(event, element);
        validateInput();
      }
      
      private void handleCheckStateChangeHelper(CheckStateChangedEvent event, IAdaptable element)
      {
        if (((element instanceof AbstractTaskContainer)) || ((element instanceof IProject)))
        {
          treeViewer.setGrayed(element, false);
        }
        else
        {
          Object[] arrayOfObject;
          int j;
          int i;
          if ((element instanceof TaskWorkingSetPage.ElementCategory))
          {
            j = (arrayOfObject = ((TaskWorkingSetPage.ElementCategory)element).getChildren(null)).length;
            for (i = 0; i < j; i++)
            {
              Object child = arrayOfObject[i];
              treeViewer.setChecked(child, event.getChecked());
              if ((child instanceof IAdaptable)) {
                handleCheckStateChangeHelper(event, (IAdaptable)child);
              }
            }
          }
          else if (((element instanceof TaskRepository)) || ((element instanceof TaskWorkingSetPage.TaskRepositoryProjectMapping)))
          {
            j = (arrayOfObject = workingSetPageContentProvider.getChildren(element)).length;
            for (i = 0; i < j; i++)
            {
              Object child = arrayOfObject[i];
              treeViewer.setChecked(child, event.getChecked());
            }
          }
        }
      }
    });
  }
  
  protected void validateInput()
  {
    String errorMessage = null;
    String infoMessage = null;
    String newText = text.getText();
    if (!newText.equals(newText.trim()))
    {
      errorMessage = Messages.TaskWorkingSetPage_The_name_must_not_have_a_leading_or_trailing_whitespace;
    }
    else if (firstCheck)
    {
      firstCheck = false;
      return;
    }
    if ("".equals(newText)) {
      errorMessage = Messages.TaskWorkingSetPage_The_name_must_not_be_empty;
    }
    if ((errorMessage == null) && ((workingSet == null) || (!newText.equals(workingSet.getName()))))
    {
      IWorkingSet[] workingSets = PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSets();
      IWorkingSet[] arrayOfIWorkingSet1;
      int j = (arrayOfIWorkingSet1 = workingSets).length;
      for (int i = 0; i < j; i++)
      {
        IWorkingSet workingSet2 = arrayOfIWorkingSet1[i];
        if (newText.equals(workingSet2.getName())) {
          errorMessage = Messages.TaskWorkingSetPage_A_working_set_with_the_same_name_already_exists;
        }
      }
    }
    if (treeViewer.getCheckedElements().length == 0) {
      infoMessage = Messages.TaskWorkingSetPage_No_categories_queries_selected;
    }
    setMessage(infoMessage, 1);
    setErrorMessage(errorMessage);
    setPageComplete(errorMessage == null);
  }
}

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

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.ui.IWorkingSet;

class TaskWorkingSetUpdater$TaskWorkingSetDelta
{
  private final IWorkingSet workingSet;
  private final List<Object> elements;
  private boolean changed;
  
  public TaskWorkingSetUpdater$TaskWorkingSetDelta(IWorkingSet workingSet)
  {
    this.workingSet = workingSet;
    elements = new ArrayList(Arrays.asList(workingSet.getElements()));
  }
  
  public int indexOf(Object element)
  {
    return elements.indexOf(element);
  }
  
  public void set(int index, Object element)
  {
    elements.set(index, element);
    changed = true;
  }
  
  public void remove(int index)
  {
    if (elements.remove(index) != null) {
      changed = true;
    }
  }
  
  public void process()
  {
    if (changed) {
      workingSet.setElements((IAdaptable[])elements.toArray(new IAdaptable[elements.size()]));
    }
  }
}

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

import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskRepositoryLabelProvider;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.TaskElementLabelProvider;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.model.WorkbenchLabelProvider;

class TaskWorkingSetPage$AggregateLabelProvider
  implements ILabelProvider
{
  private final TaskElementLabelProvider taskLabelProvider = new TaskElementLabelProvider(false);
  private final TaskRepositoryLabelProvider taskRepositoryLabelProvider = new TaskRepositoryLabelProvider();
  private final WorkbenchLabelProvider workbenchLabelProvider = new WorkbenchLabelProvider();
  
  TaskWorkingSetPage$AggregateLabelProvider(TaskWorkingSetPage paramTaskWorkingSetPage) {}
  
  public Image getImage(Object element)
  {
    if ((element instanceof AbstractTaskContainer)) {
      return taskLabelProvider.getImage(element);
    }
    if ((element instanceof TaskRepository)) {
      return taskRepositoryLabelProvider.getImage(element);
    }
    if ((element instanceof TaskWorkingSetPage.TaskRepositoryProjectMapping)) {
      return getImage(((TaskWorkingSetPage.TaskRepositoryProjectMapping)element).getTaskRepository());
    }
    return workbenchLabelProvider.getImage(element);
  }
  
  public String getText(Object element)
  {
    if ((element instanceof AbstractTaskContainer)) {
      return taskLabelProvider.getText(element);
    }
    if ((element instanceof TaskRepository)) {
      return taskRepositoryLabelProvider.getText(element);
    }
    if ((element instanceof TaskWorkingSetPage.TaskRepositoryProjectMapping)) {
      return getText(((TaskWorkingSetPage.TaskRepositoryProjectMapping)element).getTaskRepository());
    }
    return workbenchLabelProvider.getText(element);
  }
  
  public void addListener(ILabelProviderListener listener) {}
  
  public void dispose() {}
  
  public boolean isLabelProperty(Object element, String property)
  {
    return false;
  }
  
  public void removeListener(ILabelProviderListener listener) {}
}

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

import org.eclipse.core.resources.IProject;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IPersistableElement;

class TaskWorkingSetAdapterFactory$2
  implements IPersistableElement
{
  TaskWorkingSetAdapterFactory$2(TaskWorkingSetAdapterFactory paramTaskWorkingSetAdapterFactory, Object paramObject) {}
  
  public void saveState(IMemento memento)
  {
    IProject project = (IProject)val$adaptableObject;
    memento.putString("handle.project", project.getName());
  }
  
  public String getFactoryId()
  {
    return "org.eclipse.mylyn.tasks.ui.workingSets.elementFactory";
  }
}

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

import org.eclipse.jface.viewers.CheckboxTreeViewer;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class TaskWorkingSetPage$3
  extends SelectionAdapter
{
  TaskWorkingSetPage$3(TaskWorkingSetPage paramTaskWorkingSetPage) {}
  
  public void widgetSelected(SelectionEvent selectionEvent)
  {
    TaskWorkingSetPage.access$0(this$0).setCheckedElements(TaskWorkingSetPage.access$1(this$0).getElements(TaskWorkingSetPage.access$0(this$0).getInput()));
    this$0.validateInput();
  }
}

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

import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.IWorkingSetElementAdapter;

public class TaskWorkingSetElementAdapter
  implements IWorkingSetElementAdapter
{
  public IAdaptable[] adaptElements(IWorkingSet workingSet, IAdaptable[] elements)
  {
    IAdaptable[] arrayOfIAdaptable;
    int j = (arrayOfIAdaptable = elements).length;
    for (int i = 0; i < j; i++)
    {
      IAdaptable adaptable = arrayOfIAdaptable[i];
      if (!(adaptable instanceof AbstractTaskContainer)) {
        return selectContainers(elements);
      }
    }
    return elements;
  }
  
  private IAdaptable[] selectContainers(IAdaptable[] elements)
  {
    List<IAdaptable> containers = new ArrayList(elements.length);
    IAdaptable[] arrayOfIAdaptable;
    int j = (arrayOfIAdaptable = elements).length;
    for (int i = 0; i < j; i++)
    {
      IAdaptable adaptable = arrayOfIAdaptable[i];
      if ((adaptable instanceof AbstractTaskContainer)) {
        containers.add(adaptable);
      } else if ((adaptable instanceof IProject)) {
        containers.add(adaptable);
      }
    }
    return (IAdaptable[])containers.toArray(new IAdaptable[containers.size()]);
  }
  
  public void dispose() {}
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.tasks.ui.workingsets.TaskWorkingSetElementAdapter
 * Java Class Version: 5 (4
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