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

;
    composite.getBody().setLayout(layout);
    TableWrapData data = new TableWrapData(128);
    composite.setLayoutData(data);
    
    List<AbstractRepositoryConnector> connectors = new ArrayList(
      TasksUi.getRepositoryManager().getRepositoryConnectors());
    Collections.sort(connectors, new Comparator()
    {
      public int compare(AbstractRepositoryConnector o1, AbstractRepositoryConnector o2)
      {
        return o1.getLabel().compareToIgnoreCase(o2.getLabel());
      }
    });
    for (AbstractRepositoryConnector connector : connectors)
    {
      AbstractRepositoryConnectorUi connectorUi = TasksUi.getRepositoryConnectorUi(connector.getConnectorKind());
      if (connectorUi != null)
      {
        List<LegendElement> elements = connectorUi.getLegendElements();
        if ((elements != null) && (elements.size() > 0))
        {
          legendElements.addAll(elements);
          addLegendElements(composite.getBody(), connector, elements);
        }
        else
        {
          List<ITask> items = connectorUi.getLegendItems();
          if ((items != null) && (!items.isEmpty())) {
            addLegacyLegendItems(composite, connector, items);
          }
        }
      }
    }
    numColumns = Math.max(composite.getBody().getChildren().length, 1);
    
    Point w = composite.computeSize(-1, -1);
    maxWidth = (x / numColumns * 3);
  }
  
  private void addLegendElements(Composite composite, AbstractRepositoryConnector connector, List<LegendElement> elements)
  {
    Section connectorSection = toolkit.createSection(composite, 256);
    connectorSection.setLayout(new TableWrapLayout());
    connectorSection.setLayoutData(new TableWrapData(256));
    
    String label = connector.getLabel();
    int parenIndex = label.indexOf('(');
    if (parenIndex != -1) {
      label = label.substring(0, parenIndex);
    }
    connectorSection.setText(label);
    
    TableWrapLayout clientLayout = new TableWrapLayout();
    numColumns = 2;
    makeColumnsEqualWidth = false;
    verticalSpacing = 1;
    topMargin = 1;
    bottomMargin = 1;
    
    Composite connectorClient = toolkit.createComposite(connectorSection);
    connectorClient.setLayout(clientLayout);
    connectorClient.setLayoutData(new TableWrapData(256));
    connectorSection.setClient(connectorClient);
    for (LegendElement element : elements)
    {
      Label imageLabel = toolkit.createLabel(connectorClient, "");
      imageLabel.setImage(element.getImage());
      toolkit.createLabel(connectorClient, element.getLabel());
    }
    if (elements.size() < 4)
    {
      Label imageLabel = toolkit.createLabel(connectorClient, "");
      toolkit.createLabel(connectorClient, "");
    }
  }
  
  private void addLegacyLegendItems(Composite composite, AbstractRepositoryConnector connector, List<ITask> elements)
  {
    Section connectorSection = toolkit.createSection(composite, 256);
    connectorSection.setLayout(new TableWrapLayout());
    connectorSection.setLayoutData(new TableWrapData(256));
    
    String label = connector.getLabel();
    int parenIndex = label.indexOf('(');
    if (parenIndex != -1) {
      label = label.substring(0, parenIndex);
    }
    connectorSection.setText(label);
    
    TableWrapLayout clientLayout = new TableWrapLayout();
    numColumns = 2;
    makeColumnsEqualWidth = false;
    verticalSpacing = 1;
    topMargin = 1;
    bottomMargin = 1;
    
    Composite connectorClient = toolkit.createComposite(connectorSection);
    connectorClient.setLayout(clientLayout);
    connectorClient.setLayoutData(new TableWrapData(256));
    connectorSection.setClient(connectorClient);
    for (IRepositoryElement taskListElement : elements)
    {
      Label imageLabel = toolkit.createLabel(connectorClient, "");
      imageLabel.setImage(labelProvider.getImage(taskListElement));
      toolkit.createLabel(connectorClient, taskListElement.getSummary());
    }
    if (elements.size() < 4)
    {
      Label imageLabel = toolkit.createLabel(connectorClient, "");
      toolkit.createLabel(connectorClient, "");
    }
  }
  
  private void createGettingStartedSection(Composite parent)
  {
    TableWrapLayout layout = new TableWrapLayout();
    verticalSpacing = 0;
    leftMargin = 0;
    rightMargin = 0;
    topMargin = 0;
    bottomMargin = 0;
    
    Composite hyperlinkClient = toolkit.createComposite(parent);
    hyperlinkClient.setLayout(layout);
    hyperlinkClient.setLayoutData(new TableWrapData(256));
    
    Hyperlink gettingStartedLink = toolkit.createHyperlink(hyperlinkClient, 
      Messages.UiLegendControl_Also_see_the_Getting_Started_documentation_online, 64);
    gettingStartedLink.addHyperlinkListener(new IHyperlinkListener()
    {
      public void linkActivated(HyperlinkEvent e)
      {
        close();
        TasksUiUtil.openUrl(Messages.UiLegendControl_http_www_eclipse_org_mylyn_start);
      }
      
      public void linkEntered(HyperlinkEvent e) {}
      
      public void linkExited(HyperlinkEvent e) {}
    });
  }
}

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

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.window.IShellProvider;
import org.eclipse.mylyn.internal.tasks.ui.util.SortCriterion;
import org.eclipse.mylyn.internal.tasks.ui.util.SortCriterion.SortKey;
import org.eclipse.mylyn.internal.tasks.ui.util.TaskComparator;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.dialogs.SelectionDialog;

public class TaskCompareDialog
  extends SelectionDialog
{
  private Combo[] priorityCombos;
  private Button[] ascendingButtons;
  private Button[] descendingButtons;
  private final String[] propertyText;
  private boolean dirty = false;
  private final TaskComparator taskComparator;
  private String selectedValueLastCombo;
  
  public TaskCompareDialog(IShellProvider parentShell, TaskComparator taskComparator)
  {
    super(parentShell.getShell());
    SortCriterion.SortKey[] values = SortCriterion.SortKey.values();
    propertyText = new String[values.length];
    for (int i = 0; i < values.length; i++) {
      propertyText[i] = values[i].getLabel();
    }
    this.taskComparator = taskComparator;
    setTitle(Messages.TaskCompareDialog_Sorting);
  }
  
  protected Control createDialogArea(Composite parent)
  {
    Composite composite = (Composite)super.createDialogArea(parent);
    initializeDialogUnits(composite);
    Control control = createContentArea(composite);
    GridDataFactory.fillDefaults().grab(true, true).applyTo(control);
    Dialog.applyDialogFont(parent);
    return composite;
  }
  
  protected Control createContentArea(Composite parent)
  {
    Group prioritiesArea = new Group(parent, 0);
    prioritiesArea.setLayout(new GridLayout(3, false));
    prioritiesArea.setText(Messages.TaskCompareDialog_Tasks);
    
    ascendingButtons = new Button[SortCriterion.kindCount];
    descendingButtons = new Button[SortCriterion.kindCount];
    priorityCombos = new Combo[SortCriterion.kindCount];
    for (int i = 0; i < SortCriterion.kindCount; i++)
    {
      final int index = i;
      Label numberLabel = new Label(prioritiesArea, 0);
      if (i == 0) {
        numberLabel.setText(Messages.TaskCompareDialog_Sort_by);
      } else {
        numberLabel.setText(Messages.TaskCompareDialog_Then_by);
      }
      priorityCombos[i] = new Combo(prioritiesArea, 8);
      priorityCombos[i].setLayoutData(new GridData(768));
      
      Composite directionGroup = new Composite(prioritiesArea, 0);
      directionGroup.setLayout(new GridLayout(2, false));
      ascendingButtons[i] = new Button(directionGroup, 16);
      ascendingButtons[i].setText(Messages.TaskCompareDialog_Ascending);
      ascendingButtons[i].addSelectionListener(new SelectionAdapter()
      {
        public void widgetSelected(SelectionEvent e)
        {
          markDirty();
        }
      });
      descendingButtons[i] = new Button(directionGroup, 16);
      descendingButtons[i].setText(Messages.TaskCompareDialog_Descending);
      descendingButtons[i].addSelectionListener(new SelectionAdapter()
      {
        public void widgetSelected(SelectionEvent e)
        {
          markDirty();
        }
      });
      if (i < priorityCombos.length) {
        priorityCombos[i].addSelectionListener(new SelectionAdapter()
        {
          public void widgetSelected(SelectionEvent e)
          {
            ArrayList<String> oldSelectionList = new ArrayList(
              Arrays.asList(priorityCombos[index].getItems()));
            String oldSelection;
            String oldSelection;
            if (index + 1 == SortCriterion.kindCount)
            {
              oldSelection = selectedValueLastCombo;
            }
            else
            {
              oldSelectionList.removeAll(Arrays.asList(priorityCombos[(index + 1)].getItems()));
              oldSelection = propertyText[SortCriterion.SortKey.NONE.ordinal()];
              if (oldSelectionList.size() == 1) {
                oldSelection = (String)oldSelectionList.get(0);
              }
            }
            String newSelection = priorityCombos[index].getItem(priorityCombos[index].getSelectionIndex());
            if (oldSelection.equals(newSelection)) {
              return;
            }
            if (index + 1 == SortCriterion.kindCount) {
              selectedValueLastCombo = newSelection;
            }
            if (oldSelection.equals(propertyText[SortCriterion.SortKey.NONE.ordinal()]))
            {
              ascendingButtons[index].setEnabled(true);
              descendingButtons[index].setEnabled(true);
              if (index + 1 < SortCriterion.kindCount)
              {
                priorityCombos[(index + 1)].setEnabled(true);
                ArrayList<String> availablePriorities = new ArrayList(
                  Arrays.asList(priorityCombos[index].getItems()));
                availablePriorities.remove(newSelection);
                for (int k = index + 1; k < SortCriterion.kindCount; k++)
                {
                  priorityCombos[k].removeAll();
                  for (int j = 0; j < availablePriorities.size(); j++) {
                    priorityCombos[k].add((String)availablePriorities.get(j));
                  }
                  priorityCombos[k].select(priorityCombos[k].indexOf(propertyText[SortCriterion.SortKey.NONE.ordinal()]));
                }
              }
            }
            else if (newSelection.equals(propertyText[SortCriterion.SortKey.NONE.ordinal()]))
            {
              ascendingButtons[index].setEnabled(false);
              descendingButtons[index].setEnabled(false);
              if (index + 1 < SortCriterion.kindCount)
              {
                ArrayList<String> availablePriorities = new ArrayList(
                  Arrays.asList(priorityCombos[index].getItems()));
                for (int k = index + 1; k < SortCriterion.kindCount; k++)
                {
                  priorityCombos[k].setEnabled(true);
                  priorityCombos[k].removeAll();
                  for (int j = 0; j < availablePriorities.size(); j++) {
                    priorityCombos[k].add((String)availablePriorities.get(j));
                  }
                  priorityCombos[k].select(priorityCombos[k].indexOf(propertyText[SortCriterion.SortKey.NONE.ordinal()]));
                  priorityCombos[k].setEnabled(false);
                  ascendingButtons[k].setEnabled(false);
                  descendingButtons[k].setEnabled(false);
                }
              }
            }
            else
            {
              for (int j = index + 1; j < priorityCombos.length; j++)
              {
                int newSelectionIndex = priorityCombos[j].indexOf(newSelection);
                if (priorityCombos[j].getSelectionIndex() == newSelectionIndex)
                {
                  priorityCombos[j].remove(newSelection);
                  int insertionPoint = -1 - 
                    Arrays.binarySearch(priorityCombos[j].getItems(), oldSelection, 
                    columnComparator);
                  if ((insertionPoint >= 0) && (insertionPoint <= priorityCombos[j].getItemCount())) {
                    priorityCombos[j].add(oldSelection, insertionPoint);
                  } else {
                    priorityCombos[j].add(oldSelection);
                  }
                  priorityCombos[j].select(priorityCombos[j].indexOf(oldSelection));
                }
                else if (newSelectionIndex >= 0)
                {
                  String currentText = priorityCombos[j].getText();
                  priorityCombos[j].remove(newSelection);
                  int insertionPoint = -1 - 
                    Arrays.binarySearch(priorityCombos[j].getItems(), oldSelection, 
                    columnComparator);
                  if ((insertionPoint >= 0) && (insertionPoint <= priorityCombos[j].getItemCount()))
                  {
                    priorityCombos[j].add(oldSelection, insertionPoint);
                    priorityCombos[j].select(priorityCombos[j].indexOf(currentText));
                  }
                  else
                  {
                    priorityCombos[j].add(oldSelection);
                  }
                }
              }
            }
            markDirty();
          }
        });
      } else {
        priorityCombos[i].addSelectionListener(new SelectionAdapter()
        {
          public void widgetSelected(SelectionEvent e)
          {
            markDirty();
          }
        });
      }
    }
    updateUI();
    return prioritiesArea;
  }
  
  protected void okPressed()
  {
    if (isDirty()) {
      for (int i = 0; i < SortCriterion.kindCount; i++)
      {
        SortCriterion keyEntries = taskComparator.getSortCriterion(i);
        keyEntries.setKey(SortCriterion.SortKey.valueOfLabel(priorityCombos[i].getText()));
        if (descendingButtons[i].getSelection()) {
          keyEntries.setDirection(-1);
        } else {
          keyEntries.setDirection(1);
        }
      }
    }
    super.okPressed();
  }
  
  protected boolean isDirty()
  {
    return dirty;
  }
  
  protected void markDirty()
  {
    dirty = true;
  }
  
  private final Comparator<String> columnComparator = new Comparator()
  {
    public int compare(String arg0, String arg1)
    {
      int index0 = -1;
      int index1 = -1;
      for (int i = 0; i < propertyText.length; i++)
      {
        if (propertyText[i].equals(arg0)) {
          index0 = i;
        }
        if (propertyText[i].equals(arg1)) {
          index1 = i;
        }
      }
      return index0 - index1;
    }
  };
  
  protected void updateUI()
  {
    ArrayList<String> availablePriorities = new ArrayList(Arrays.asList(propertyText));
    for (int i = 0; i < TaskComparator.CRITERIA_COUNT; i++)
    {
      SortCriterion criterion = taskComparator.getSortCriterion(i);
      priorityCombos[i].removeAll();
      for (int j = 0; j < availablePriorities.size(); j++) {
        priorityCombos[i].add((String)availablePriorities.get(j));
      }
      priorityCombos[i].select(priorityCombos[i].indexOf(propertyText[criterion.getKey().ordinal()]));
      ascendingButtons[i].setSelection(criterion.getDirection() == 1);
      descendingButtons[i].setSelection(criterion.getDirection() == -1);
      if (i == TaskComparator.CRITERIA_COUNT - 1) {
        selectedValueLastCombo = propertyText[criterion.getKey().ordinal()];
      }
      if (criterion.getKey() != SortCriterion.SortKey.NONE)
      {
        availablePriorities.remove(propertyText[criterion.getKey().ordinal()]);
      }
      else
      {
        ascendingButtons[i].setEnabled(false);
        descendingButtons[i].setEnabled(false);
        for (int k = i + 1; k < TaskComparator.CRITERIA_COUNT; k++)
        {
          for (int j = 0; j < availablePriorities.size(); j++) {
            priorityCombos[k].add((String)availablePriorities.get(j));
          }
          priorityCombos[k].select(priorityCombos[k].indexOf(propertyText[SortCriterion.SortKey.NONE.ordinal()]));
          if (k == TaskComparator.CRITERIA_COUNT - 1) {
            selectedValueLastCombo = propertyText[SortCriterion.SortKey.NONE.ordinal()];
          }
          ascendingButtons[k].setSelection(taskComparator.getSortCriterion(k).getDirection() == 1);
          descendingButtons[k].setSelection(taskComparator.getSortCriterion(k).getDirection() == -1);
          priorityCombos[k].setEnabled(false);
          ascendingButtons[k].setEnabled(false);
          descendingButtons[k].setEnabled(false);
        }
        break;
      }
    }
  }
}

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

import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.widgets.Text;

class TaskRepositoryCredentialsDialog$4
  implements ModifyListener
{
  TaskRepositoryCredentialsDialog$4(TaskRepositoryCredentialsDialog paramTaskRepositoryCredentialsDialog, Text paramText) {}
  
  public void modifyText(ModifyEvent e)
  {
    TaskRepositoryCredentialsDialog.access$3(this$0, val$passwordField.getText());
  }
}

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

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class AbstractWorkingSetDialogCOPY$1
  extends SelectionAdapter
{
  AbstractWorkingSetDialogCOPY$1(AbstractWorkingSetDialogCOPY paramAbstractWorkingSetDialogCOPY) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    this$0.createWorkingSet();
  }
}

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

import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.dialogs.PopupDialog;
import org.eclipse.mylyn.commons.ui.CommonImages;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.forms.widgets.TableWrapLayout;

public class UiLegendDialog
  extends PopupDialog
{
  private FormToolkit toolkit;
  private ScrolledForm form;
  private UiLegendControl content;
  
  public UiLegendDialog(Shell parent)
  {
    super(parent, 16388, false, false, false, false, false, null, null);
  }
  
  protected Control createContents(Composite parent)
  {
    getShell().setBackground(getShell().getDisplay().getSystemColor(16));
    return createDialogArea(parent);
  }
  
  public int open()
  {
    int open = super.open();
    
    getShell().setFocus();
    return open;
  }
  
  public boolean close()
  {
    if (toolkit != null) {
      toolkit.dispose();
    }
    return super.close();
  }
  
  protected Control createDialogArea(Composite parent)
  {
    toolkit = new FormToolkit(TasksUiPlugin.getDefault().getFormColors(parent.getDisplay()));
    
    form = toolkit.createScrolledForm(parent);
    form.setText(Messages.UiLegendControl_Tasks_UI_Legend);
    form.getToolBarManager().add(new CloseDialogAction(null));
    form.getToolBarManager().update(true);
    form.getBody().setLayout(new TableWrapLayout());
    toolkit.decorateFormHeading(form.getForm());
    
    content = new UiLegendControl(form.getBody(), toolkit);
    content.setWindow(this);
    
    return parent;
  }
  
  private class CloseDialogAction
    extends Action
  {
    private CloseDialogAction()
    {
      setImageDescriptor(CommonImages.NOTIFICATION_CLOSE);
      setText(Messages.UiLegendDialog_Close_Dialog);
    }
    
    public void run()
    {
      close();
    }
  }
}

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

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;

class TaskRepositoryCredentialsDialog$5
  extends SelectionAdapter
{
  TaskRepositoryCredentialsDialog$5(TaskRepositoryCredentialsDialog paramTaskRepositoryCredentialsDialog, Button paramButton) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    TaskRepositoryCredentialsDialog.access$4(this$0, val$savePasswordButton.getSelection());
  }
}

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

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class AbstractWorkingSetDialogCOPY$2
  extends SelectionAdapter
{
  AbstractWorkingSetDialogCOPY$2(AbstractWorkingSetDialogCOPY paramAbstractWorkingSetDialogCOPY) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    this$0.editSelectedWorkingSet();
  }
}

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

import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;

class UiLegendControl$1
  implements DisposeListener
{
  UiLegendControl$1(UiLegendControl paramUiLegendControl) {}
  
  public void widgetDisposed(DisposeEvent e)
  {
    UiLegendControl.access$0(this$0);
  }
}

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

import org.eclipse.jface.action.Action;
import org.eclipse.mylyn.commons.ui.CommonImages;

class UiLegendDialog$CloseDialogAction
  extends Action
{
  private UiLegendDialog$CloseDialogAction(UiLegendDialog paramUiLegendDialog)
  {
    setImageDescriptor(CommonImages.NOTIFICATION_CLOSE);
    setText(Messages.UiLegendDialog_Close_Dialog);
  }
  
  public void run()
  {
    this$0.close();
  }
}

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

import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.resource.ImageDescriptor;
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.TaskRepository;
import org.eclipse.mylyn.tasks.ui.TasksUi;
import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
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.FileDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Link;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.plugin.AbstractUIPlugin;

public class TaskRepositoryCredentialsDialog
  extends TitleAreaDialog
{
  private static final String DIALOG_TITLE = Messages.TaskRepositoryCredentialsDialog_Enter_Credentials;
  private static final String IMAGE_FILE_KEYLOCK = "icons/wizban/secur_role_wiz.gif";
  public static final int TASK_REPOSITORY_CHANGED = 1000;
  private static final String MESSAGE = Messages.TaskRepositoryCredentialsDialog_Enter_repository_credentials;
  private static final String TITLE = Messages.TaskRepositoryCredentialsDialog_Repository_Authentication;
  private Image keyLockImage;
  private String message;
  
  public static TaskRepositoryCredentialsDialog createDialog(Shell shell)
  {
    return new TaskRepositoryCredentialsDialog(shell);
  }
  
  private String password = "";
  private boolean savePassword;
  private TaskRepository taskRepository;
  private String username = "";
  private Button certBrowseButton;
  private boolean isFileDialog;
  
  private TaskRepositoryCredentialsDialog(Shell parentShell)
  {
    super(parentShell);
  }
  
  public boolean close()
  {
    if (keyLockImage != null) {
      keyLockImage.dispose();
    }
    return super.close();
  }
  
  private void createLinkArea(Composite parent)
  {
    Composite composite = new Composite(parent, 0);
    composite.setLayout(new GridLayout(1, false));
    composite.setLayoutData(new GridData(768));
    
    Link link = new Link(composite, 64);
    link.setText(Messages.TaskRepositoryCredentialsDialog_HTML_Open_Repository_Properties);
    link.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        close();
        int returnCode = TasksUiUtil.openEditRepositoryWizard(taskRepository);
        if (returnCode == 0) {
          setReturnCode(1000);
        } else {
          setReturnCode(returnCode);
        }
      }
    });GridDataFactory.fillDefaults().align(4, 16777216).hint(convertHorizontalDLUsToPixels(300), -1).grab(true, false)
      .applyTo(link);
  }
  
  private void createCenterArea(Composite parent)
  {
    Composite composite = new Composite(parent, 0);
    composite.setLayout(new GridLayout(3, false));
    composite.setLayoutData(new GridData(768));
    if (taskRepository != null)
    {
      Composite labelComposite = new Composite(composite, 0);
      GridLayout layout = new GridLayout(3, false);
      marginHeight = 0;
      marginWidth = 0;
      labelComposite.setLayout(layout);
      GridDataFactory.fillDefaults()
        .align(4, 16777216)
        .grab(true, false)
        .span(3, 1)
        .applyTo(labelComposite);
      
      Label label = new Label(labelComposite, 0);
      label.setImage(TasksUiPlugin.getDefault().getBrandingIcon(taskRepository.getConnectorKind()));
      
      label = new Label(labelComposite, 0);
      label.setText(Messages.TaskRepositoryCredentialsDialog_Task_Repository);
      
      label = new Label(labelComposite, 0);
      label.setText(taskRepository.getRepositoryLabel());
    }
    if (isFileDialog) {
      new Label(composite, 0).setText(Messages.TaskRepositoryCredentialsDialog_Filename);
    } else {
      new Label(composite, 0).setText(Messages.TaskRepositoryCredentialsDialog_User_ID);
    }
    final Text usernameField = new Text(composite, 2048);
    usernameField.addModifyListener(new ModifyListener()
    {
      public void modifyText(ModifyEvent e)
      {
        username = usernameField.getText();
      }
    });
    usernameField.setText(username);
    if (username.length() == 0) {
      usernameField.setFocus();
    }
    GridDataFactory.fillDefaults().align(4, 16777216).hint(convertHorizontalDLUsToPixels(200), -1).grab(true, false).applyTo(usernameField);
    if (isFileDialog)
    {
      certBrowseButton = new Button(composite, 8);
      certBrowseButton.setText(Messages.TaskRepositoryCredentialsDialog_ChooseCertificateFile);
      certBrowseButton.addSelectionListener(new SelectionAdapter()
      {
        public void widgetSelected(SelectionEvent e)
        {
          FileDialog fileDialog = new FileDialog(getShell(), 4096);
          fileDialog.setFilterPath(System.getProperty("user.home", "."));
          String returnFile = fileDialog.open();
          if (returnFile != null)
          {
            username = returnFile;
            usernameField.setText(returnFile);
          }
        }
      });
    }
    else
    {
      new Label(composite, 0).setText(" ");
    }
    new Label(composite, 0).setText(Messages.TaskRepositoryCredentialsDialog_Password);
    
    final Text passwordField = new Text(composite, 4196352);
    passwordField.addModifyListener(new ModifyListener()
    {
      public void modifyText(ModifyEvent e)
      {
        password = passwordField.getText();
      }
    });
    passwordField.setText(password);
    if (username.length() > 0) {
      passwordField.setFocus();
    }
    GridDataFactory.fillDefaults().align(4, 16777216).hint(convertHorizontalDLUsToPixels(200), -1).grab(true, false).applyTo(passwordField);
    
    final Button savePasswordButton = new Button(composite, 32);
    savePasswordButton.setText(Messages.TaskRepositoryCredentialsDialog_Save_Password);
    savePasswordButton.setSelection(savePassword);
    savePasswordButton.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        savePassword = savePasswordButton.getSelection();
      }
    });
    GridDataFactory.fillDefaults().span(3, 1).applyTo(savePasswordButton);
    
    createWarningMessage(composite);
  }
  
  protected Control createContents(Composite parent)
  {
    getShell().setText(DIALOG_TITLE);
    
    setTitle(TITLE);
    Control control = super.createContents(parent);
    if (taskRepository != null)
    {
      AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
        taskRepository.getConnectorKind());
      if (connector != null) {
        setTitle(connector.getShortLabel() + " " + TITLE);
      }
    }
    ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.mylyn.tasks.ui", 
      "icons/wizban/secur_role_wiz.gif");
    if (descriptor != null)
    {
      keyLockImage = descriptor.createImage();
      setTitleImage(keyLockImage);
    }
    if (message != null) {
      super.setMessage(message);
    } else {
      super.setMessage(MESSAGE);
    }
    applyDialogFont(control);
    return control;
  }
  
  protected Control createDialogArea(Composite parent)
  {
    Composite parent2 = (Composite)super.createDialogArea(parent);
    
    Composite composite = new Composite(parent2, 0);
    composite.setLayout(new GridLayout(1, false));
    GridDataFactory.fillDefaults().align(4, 1).applyTo(composite);
    
    createCenterArea(composite);
    if (taskRepository != null) {
      createLinkArea(composite);
    }
    composite.pack();
    return parent;
  }
  
  private void createWarningMessage(Composite parent)
  {
    Composite composite = new Composite(parent, 0);
    GridLayout layout = new GridLayout();
    numColumns = 2;
    marginHeight = 0;
    marginWidth = 0;
    composite.setLayout(layout);
    GridDataFactory.fillDefaults().align(4, 16777216).grab(true, false).span(2, 1).applyTo(composite);
    
    Label label = new Label(composite, 0);
    label.setImage(Dialog.getImage("dialog_messasge_warning_image"));
    label.setLayoutData(new GridData(34));
    
    label = new Label(composite, 64);
    label.setText(Messages.TaskRepositoryCredentialsDialog_Saved_passwords_are_stored_that_is_difficult);
    GridDataFactory.fillDefaults()
      .align(4, 16777216)
      .hint(convertHorizontalDLUsToPixels(300), -1)
      .grab(true, false)
      .applyTo(label);
  }
  
  public String getMessage()
  {
    return message;
  }
  
  public String getPassword()
  {
    return password;
  }
  
  public boolean getSavePassword()
  {
    return savePassword;
  }
  
  public TaskRepository getTaskRepository()
  {
    return taskRepository;
  }
  
  public String getUserName()
  {
    return username;
  }
  
  public void setMessage(String message)
  {
    this.message = message;
  }
  
  public void setPassword(String password)
  {
    if (password == null) {
      throw new IllegalArgumentException();
    }
    this.password = password;
  }
  
  public void setSavePassword(boolean savePassword)
  {
    this.savePassword = savePassword;
  }
  
  public void setTaskRepository(TaskRepository taskRepository)
  {
    this.taskRepository = taskRepository;
  }
  
  public void setUsername(String username)
  {
    if (username == null) {
      throw new IllegalArgumentException();
    }
    this.username = username;
  }
  
  public void setFileDialog(boolean isFileDialog)
  {
    this.isFileDialog = isFileDialog;
  }
}

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

import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.window.IShellProvider;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskListSorter;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskListSorter.GroupBy;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;

public class TaskListSortDialog
  extends TaskCompareDialog
{
  private Combo modeCombo;
  private final TaskListView taskListView;
  
  public TaskListSortDialog(IShellProvider parentShell, TaskListView taskListView)
  {
    super(parentShell, taskListView.getSorter().getComparator());
    this.taskListView = taskListView;
    setTitle(Messages.TaskListSortDialog_Title);
  }
  
  protected Control createContentArea(Composite parent)
  {
    Composite container = new Composite(parent, 0);
    container.setLayout(GridLayoutFactory.fillDefaults().create());
    
    Group groupByComposite = new Group(container, 0);
    groupByComposite.setLayout(new GridLayout(2, false));
    groupByComposite.setText(Messages.TaskListSortDialog_Queries_and_Categories);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(groupByComposite);
    
    Label numberLabel = new Label(groupByComposite, 0);
    numberLabel.setText(Messages.TaskListSortDialog_Grouped_by);
    modeCombo = new Combo(groupByComposite, 8);
    modeCombo.setLayoutData(new GridData(768));
    TaskListSorter.GroupBy[] values = TaskListSorter.GroupBy.values();
    TaskListSorter.GroupBy[] arrayOfGroupBy1;
    int j = (arrayOfGroupBy1 = values).length;
    for (int i = 0; i < j; i++)
    {
      TaskListSorter.GroupBy groupBy = arrayOfGroupBy1[i];
      modeCombo.add(groupBy.getLabel());
    }
    modeCombo.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        markDirty();
      }
    });
    modeCombo.select(taskListView.getSorter().getGroupBy().ordinal());
    
    Control child = super.createContentArea(container);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(child);
    
    return container;
  }
  
  protected void okPressed()
  {
    if (isDirty())
    {
      int selectionIndex = modeCombo.getSelectionIndex();
      if (selectionIndex != -1) {
        taskListView.getSorter().setGroupBy(TaskListSorter.GroupBy.values()[selectionIndex]);
      }
    }
    super.okPressed();
  }
}

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

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class AbstractWorkingSetDialogCOPY$3
  extends SelectionAdapter
{
  AbstractWorkingSetDialogCOPY$3(AbstractWorkingSetDialogCOPY paramAbstractWorkingSetDialogCOPY) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    this$0.removeSelectedWorkingSets();
  }
}

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

import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
import org.eclipse.ui.forms.events.HyperlinkEvent;
import org.eclipse.ui.forms.events.IHyperlinkListener;

class UiLegendControl$2
  implements IHyperlinkListener
{
  UiLegendControl$2(UiLegendControl paramUiLegendControl) {}
  
  public void linkActivated(HyperlinkEvent e)
  {
    this$0.close();
    TasksUiUtil.openTasksViewInActivePerspective();
  }
  
  public void linkEntered(HyperlinkEvent e) {}
  
  public void linkExited(HyperlinkEvent e) {}
}

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

import java.util.Comparator;

class TaskCompareDialog$1
  implements Comparator<String>
{
  TaskCompareDialog$1(TaskCompareDialog paramTaskCompareDialog) {}
  
  public int compare(String arg0, String arg1)
  {
    int index0 = -1;
    int index1 = -1;
    for (int i = 0; i < TaskCompareDialog.access$0(this$0).length; i++)
    {
      if (TaskCompareDialog.access$0(this$0)[i].equals(arg0)) {
        index0 = i;
      }
      if (TaskCompareDialog.access$0(this$0)[i].equals(arg1)) {
        index1 = i;
      }
    }
    return index0 - index1;
  }
}

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

import org.eclipse.osgi.util.NLS;

public class Messages
  extends NLS
{
  private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.tasks.ui.dialogs.messages";
  public static String TaskCompareDialog_Ascending;
  public static String TaskCompareDialog_Descending;
  public static String TaskCompareDialog_Sort_by;
  public static String TaskCompareDialog_Sorting;
  public static String TaskCompareDialog_Tasks;
  public static String TaskCompareDialog_Then_by;
  public static String TaskListSortDialog_Queries_and_Categories;
  public static String TaskListSortDialog_Grouped_by;
  public static String TaskListSortDialog_Title;
  public static String TaskRepositoryCredentialsDialog_ChooseCertificateFile;
  public static String TaskRepositoryCredentialsDialog_Enter_Credentials;
  public static String TaskRepositoryCredentialsDialog_Enter_repository_credentials;
  public static String TaskRepositoryCredentialsDialog_HTML_Open_Repository_Properties;
  public static String TaskRepositoryCredentialsDialog_Password;
  public static String TaskRepositoryCredentialsDialog_Repository_Authentication;
  public static String TaskRepo
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