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

ns.net.AuthenticationCredentials;
import org.eclipse.mylyn.commons.net.AuthenticationType;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.internal.tasks.core.TaskList;
import org.eclipse.mylyn.tasks.core.IRepositoryManager;
import org.eclipse.mylyn.tasks.core.IRepositoryPerson;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.core.data.TaskAttachmentMapper;
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper;
import org.eclipse.mylyn.tasks.core.data.TaskAttributeMetaData;
import org.eclipse.mylyn.tasks.core.data.TaskCommentMapper;
import org.eclipse.mylyn.tasks.core.data.TaskData;
import org.eclipse.mylyn.tasks.ui.TasksUi;
import org.eclipse.osgi.util.NLS;

public class PersonProposalProvider
  implements IContentProposalProvider
{
  private final AbstractTask currentTask;
  private String currentUser;
  private SortedSet<String> addressSet;
  private String repositoryUrl;
  private String connectorKind;
  private TaskData currentTaskData;
  private final Map<String, String> proposals;
  private Map<String, String> errorProposals;
  
  public PersonProposalProvider(AbstractTask task, TaskData taskData)
  {
    this(task, taskData, new HashMap(0));
  }
  
  public PersonProposalProvider(AbstractTask task, TaskData taskData, Map<String, String> proposals)
  {
    currentTask = task;
    currentTaskData = taskData;
    if (task != null)
    {
      repositoryUrl = task.getRepositoryUrl();
      connectorKind = task.getConnectorKind();
    }
    else if (taskData != null)
    {
      repositoryUrl = taskData.getRepositoryUrl();
      connectorKind = taskData.getConnectorKind();
    }
    this.proposals = new HashMap(proposals);
  }
  
  public PersonProposalProvider(String repositoryUrl, String repositoryKind)
  {
    this(repositoryUrl, repositoryKind, new HashMap(0));
  }
  
  public PersonProposalProvider(String repositoryUrl, String repositoryKind, Map<String, String> proposals)
  {
    currentTask = null;
    this.repositoryUrl = repositoryUrl;
    connectorKind = repositoryKind;
    this.proposals = new HashMap(proposals);
  }
  
  protected String getRepositoryUrl()
  {
    return repositoryUrl;
  }
  
  protected String getConnectorKind()
  {
    return connectorKind;
  }
  
  public IContentProposal[] getProposals(String contents, int position)
  {
    if (contents == null) {
      throw new IllegalArgumentException();
    }
    int leftSeparator = getIndexOfLeftSeparator(contents, position);
    int rightSeparator = getIndexOfRightSeparator(contents, position);
    
    assert (leftSeparator <= position);
    assert (position <= rightSeparator);
    
    String searchText = contents.substring(leftSeparator + 1, position);
    String resultPrefix = contents.substring(0, leftSeparator + 1);
    String resultPostfix = contents.substring(rightSeparator);
    
    SortedSet<String> addressSet = getAddressSet();
    if (((errorProposals == null) || (errorProposals.isEmpty())) && 
      (!searchText.equals("")))
    {
      searchText = searchText.toLowerCase();
      
      char[] nextWord = searchText.toCharArray(); int 
        tmp152_151 = (searchText.length() - 1); char[] tmp152_143 = nextWord;tmp152_143[tmp152_151] = ((char)(tmp152_143[tmp152_151] + '\001'));
      
      addressSet = new TreeSet(addressSet.subSet(searchText, new String(nextWord)));
      
      addMatchingProposalsByPrettyName(addressSet, searchText);
    }
    IContentProposal[] result = new IContentProposal[addressSet.size()];
    int i = 0;
    for (String address : addressSet) {
      result[(i++)] = createPersonProposal(address, address.equalsIgnoreCase(currentUser), resultPrefix + address + 
        resultPostfix, resultPrefix.length() + address.length());
    }
    Arrays.sort(result);
    return result;
  }
  
  private void addMatchingProposalsByPrettyName(SortedSet<String> addressSet, String searchText)
  {
    if (proposals.size() > 0) {
      for (Map.Entry<String, String> entry : proposals.entrySet()) {
        if (matchesSubstring((String)entry.getValue(), searchText)) {
          addressSet.add((String)entry.getKey());
        }
      }
    }
  }
  
  private boolean matchesSubstring(String value, String searchText)
  {
    if (value != null)
    {
      String[] tokens = value.split("\\s");
      String[] arrayOfString1;
      int j = (arrayOfString1 = tokens).length;
      for (int i = 0; i < j; i++)
      {
        String token = arrayOfString1[i];
        if (token.toLowerCase().startsWith(searchText)) {
          return true;
        }
      }
    }
    return false;
  }
  
  protected PersonContentProposal createPersonProposal(String address, boolean isCurrentUser, String replacementText, int cursorPosition)
  {
    return new PersonContentProposal(getPrettyName(address), isCurrentUser, replacementText, cursorPosition);
  }
  
  protected String getPrettyName(String address)
  {
    String value = (String)proposals.get(address);
    if (value != null) {
      return NLS.bind("{0} <{1}>", value, address);
    }
    return address;
  }
  
  private int getIndexOfLeftSeparator(String contents, int position)
  {
    int i = contents.lastIndexOf(' ', position - 1);
    i = Math.max(contents.lastIndexOf(',', position - 1), i);
    return i;
  }
  
  private int getIndexOfRightSeparator(String contents, int position)
  {
    int index = contents.length();
    int i = contents.indexOf(' ', position);
    if (i != -1) {
      index = Math.min(i, index);
    }
    i = contents.indexOf(',', position);
    if (i != -1) {
      index = Math.min(i, index);
    }
    return index;
  }
  
  private SortedSet<String> getAddressSet()
  {
    if (addressSet != null) {
      return addressSet;
    }
    addressSet = new TreeSet(new Comparator()
    {
      public int compare(String s1, String s2)
      {
        return s1.compareToIgnoreCase(s2);
      }
    });
    if ((errorProposals != null) && (!errorProposals.isEmpty()))
    {
      for (String proposal : errorProposals.keySet()) {
        addAddress(addressSet, proposal);
      }
      return addressSet;
    }
    if (proposals.size() > 0)
    {
      if ((repositoryUrl != null) && (connectorKind != null)) {
        currentUser = getCurrentUser(repositoryUrl, connectorKind);
      }
      for (String proposal : proposals.keySet()) {
        addAddress(addressSet, proposal);
      }
      return addressSet;
    }
    if (currentTask != null) {
      addAddress(addressSet, currentTask.getOwner());
    }
    if (currentTaskData != null) {
      addAddresses(currentTaskData, addressSet);
    }
    if ((repositoryUrl != null) && (connectorKind != null))
    {
      Set<AbstractTask> tasks = new HashSet();
      if (currentTask != null) {
        tasks.add(currentTask);
      }
      currentUser = getCurrentUser(repositoryUrl, connectorKind);
      if (currentUser != null) {
        addressSet.add(currentUser);
      }
      Object allTasks = TasksUiPlugin.getTaskList().getAllTasks();
      for (AbstractTask task : (Collection)allTasks) {
        if (repositoryUrl.equals(task.getRepositoryUrl())) {
          tasks.add(task);
        }
      }
      for (ITask task : tasks) {
        addAddresses(task, addressSet);
      }
    }
    return addressSet;
  }
  
  private String getCurrentUser(String repositoryUrl, String connectorKind)
  {
    TaskRepository repository = TasksUi.getRepositoryManager().getRepository(connectorKind, repositoryUrl);
    if (repository != null)
    {
      AuthenticationCredentials credentials = repository.getCredentials(AuthenticationType.REPOSITORY);
      if ((credentials != null) && (credentials.getUserName().length() > 0)) {
        return credentials.getUserName();
      }
    }
    return null;
  }
  
  private void addAddresses(ITask task, Set<String> addressSet)
  {
    addAddress(addressSet, task.getOwner());
  }
  
  private void addAddresses(TaskData data, Set<String> addressSet)
  {
    addPerson(data, addressSet, "task.common.user.reporter");
    addPerson(data, addressSet, "task.common.user.assigned");
    addPerson(data, addressSet, "task.common.user.cc");
    List<TaskAttribute> comments = data.getAttributeMapper().getAttributesByType(data, "comment");
    for (TaskAttribute commentAttribute : comments) {
      addPerson(data, addressSet, commentAttribute);
    }
    List<TaskAttribute> attachments = data.getAttributeMapper().getAttributesByType(data, 
      "attachment");
    for (TaskAttribute attachmentAttribute : attachments) {
      addPerson(data, addressSet, attachmentAttribute);
    }
  }
  
  private void addPerson(TaskData data, Set<String> addresses, String key)
  {
    TaskAttribute attribute = data.getRoot().getMappedAttribute(key);
    if ((attribute != null) && (attribute.getMetaData().isReadOnly())) {
      addPerson(data, addresses, attribute);
    }
  }
  
  private void addPerson(TaskData data, Set<String> addresses, TaskAttribute attribute)
  {
    TaskAttributeMetaData metaData = attribute.getMetaData();
    if ("comment".equals(metaData.getType()))
    {
      TaskCommentMapper mapper = TaskCommentMapper.createFrom(attribute);
      addPerson(addresses, mapper.getAuthor());
    }
    else if ("attachment".equals(metaData.getType()))
    {
      TaskAttachmentMapper mapper = TaskAttachmentMapper.createFrom(attribute);
      addPerson(addresses, mapper.getAuthor());
    }
    else if ("person".equals(metaData.getType()))
    {
      addPerson(addresses, data.getAttributeMapper().getRepositoryPerson(attribute));
    }
    else
    {
      List<String> values = attribute.getValues();
      for (String value : values) {
        addAddress(addresses, value);
      }
    }
  }
  
  private void addPerson(Set<String> addresses, IRepositoryPerson repositoryPerson)
  {
    if (repositoryPerson != null)
    {
      addresses.add(repositoryPerson.getPersonId());
      if (repositoryPerson.getName() != null) {
        proposals.put(repositoryPerson.getPersonId(), repositoryPerson.getName());
      }
    }
  }
  
  private void addAddress(Set<String> addresses, String address)
  {
    if ((address != null) && (address.trim().length() > 0)) {
      addresses.add(address.trim());
    }
  }
  
  public Map<String, String> getProposals()
  {
    return proposals;
  }
  
  public Map<String, String> getErrorProposals()
  {
    return errorProposals;
  }
  
  public void setErrorProposals(Map<String, String> errorProposals)
  {
    this.errorProposals = errorProposals;
    addressSet = null;
  }
}

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

import org.eclipse.jface.wizard.IWizard;
import org.eclipse.mylyn.internal.tasks.core.ITaskRepositoryFilter;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;

public class NewQueryWizard
  extends MultiRepositoryAwareWizard
{
  public NewQueryWizard()
  {
    super(new SelectRepositoryPageForNewQuery(), Messages.NewQueryWizard_New_Repository_Query);
  }
  
  private static final class SelectRepositoryPageForNewQuery
    extends SelectRepositoryPage
  {
    public SelectRepositoryPageForNewQuery()
    {
      super();
    }
    
    protected IWizard createWizard(TaskRepository taskRepository)
    {
      AbstractRepositoryConnectorUi repositoryUi = TasksUiPlugin.getConnectorUi(taskRepository.getConnectorKind());
      return repositoryUi.getQueryWizard(taskRepository, null);
    }
  }
}

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

import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.mylyn.commons.ui.CommonImages;
import org.eclipse.mylyn.internal.tasks.ui.TaskListBackupManager;
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.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;

public class TaskDataExportWizardPage
  extends WizardPage
{
  private static final String PAGE_ID = "org.eclipse.mylyn.tasklist.exportPage";
  private Button browseButton = null;
  private Text destDirText = null;
  private static final String SETTINGS_SAVED = "Settings saved";
  private static final String DEST_DIR_SETTING = "Destination directory setting";
  
  public TaskDataExportWizardPage()
  {
    super("org.eclipse.mylyn.tasklist.exportPage");
    setPageComplete(false);
    setImageDescriptor(CommonImages.BANNER_EXPORT);
    setTitle(Messages.TaskDataExportWizardPage_Export_Mylyn_Task_Data);
  }
  
  public void createControl(Composite parent)
  {
    Composite container = new Composite(parent, 0);
    GridLayout layout = new GridLayout(1, false);
    container.setLayout(layout);
    createExportDirectoryControl(container);
    
    initSettings();
    
    Dialog.applyDialogFont(container);
    setControl(container);
    setPageComplete(validate());
  }
  
  private void createExportDirectoryControl(Composite parent)
  {
    parent.setLayout(new GridLayout(3, false));
    parent.setLayoutData(new GridData(768));
    new Label(parent, 0).setText(Messages.TaskDataExportWizardPage_File);
    Label l = new Label(parent, 0);
    l.setText(TaskListBackupManager.getBackupFileName());
    GridData gd = new GridData(768);
    horizontalSpan = 2;
    l.setLayoutData(gd);
    new Label(parent, 0).setText(Messages.TaskDataExportWizardPage_Folder);
    
    destDirText = new Text(parent, 2048);
    destDirText.setEditable(false);
    destDirText.setLayoutData(new GridData(768));
    destDirText.addModifyListener(new ModifyListener()
    {
      public void modifyText(ModifyEvent e)
      {
        controlChanged();
      }
    });
    browseButton = new Button(parent, 8);
    browseButton.setText(Messages.TaskDataExportWizardPage_Browse_);
    browseButton.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        DirectoryDialog dialog = new DirectoryDialog(getShell());
        dialog.setText(Messages.TaskDataExportWizardPage_Folder_Selection);
        dialog.setMessage(Messages.TaskDataExportWizardPage_Specify_the_destination_folder_for_task_data);
        String dir = destDirText.getText();
        dialog.setFilterPath(dir);
        dir = dialog.open();
        if ((dir == null) || (dir.equals(""))) {
          return;
        }
        destDirText.setText(dir);
        controlChanged();
      }
    });
  }
  
  protected void initSettings()
  {
    IDialogSettings settings = getDialogSettings();
    if (settings.get("Settings saved") == null)
    {
      destDirText.setText("");
    }
    else
    {
      String directory = settings.get("Destination directory setting");
      if (directory != null) {
        destDirText.setText(settings.get("Destination directory setting"));
      }
    }
  }
  
  public void saveSettings()
  {
    IDialogSettings settings = getDialogSettings();
    settings.put("Destination directory setting", destDirText.getText());
    settings.put("Settings saved", "Settings saved");
  }
  
  public void controlChanged()
  {
    setPageComplete(validate());
  }
  
  protected boolean validate()
  {
    setMessage(null);
    if (destDirText.getText().equals(""))
    {
      setMessage(Messages.TaskDataExportWizardPage_Please_choose_an_export_destination, 2);
      return false;
    }
    return true;
  }
  
  public String getDestinationDirectory()
  {
    return destDirText.getText();
  }
  
  public void setDestinationDirectory(String destinationDir)
  {
    destDirText.setText(destinationDir);
  }
}

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

import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.mylyn.internal.tasks.core.LocalTask;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
import org.eclipse.mylyn.tasks.core.ITaskMapping;
import org.eclipse.mylyn.tasks.ui.TasksUiImages;
import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;

public class NewLocalTaskWizard
  extends Wizard
  implements INewWizard
{
  private final ITaskMapping taskSelection;
  
  public NewLocalTaskWizard(ITaskMapping taskSelection)
  {
    this.taskSelection = taskSelection;
    setDefaultPageImageDescriptor(TasksUiImages.BANNER_REPOSITORY);
    setNeedsProgressMonitor(true);
  }
  
  public NewLocalTaskWizard()
  {
    this(null);
  }
  
  public void init(IWorkbench workbench, IStructuredSelection selection)
  {
    setForcePreviousAndNextButtons(false);
  }
  
  public void addPages() {}
  
  public boolean canFinish()
  {
    return true;
  }
  
  public boolean performFinish()
  {
    LocalTask task = TasksUiInternal.createNewLocalTask(null);
    if (taskSelection != null)
    {
      if (taskSelection.getSummary() != null) {
        task.setSummary(taskSelection.getSummary());
      }
      if (taskSelection.getDescription() != null) {
        task.setNotes(taskSelection.getDescription());
      }
    }
    TasksUiUtil.openTask(task);
    return true;
  }
}

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

import org.eclipse.jface.wizard.IWizardContainer;
import org.eclipse.mylyn.tasks.core.sync.SubmitJob;
import org.eclipse.swt.widgets.Shell;

class TaskAttachmentWizard$3$1
  implements Runnable
{
  TaskAttachmentWizard$3$1(TaskAttachmentWizard.3 param3, SubmitJob paramSubmitJob) {}
  
  public void run()
  {
    if (val$job.getStatus() != null) {
      TaskAttachmentWizard.3.access$0(this$1).getContainer().getShell().setVisible(true);
    }
    TaskAttachmentWizard.access$2(TaskAttachmentWizard.3.access$0(this$1), val$job);
    if (val$job.getStatus() == null) {
      TaskAttachmentWizard.3.access$0(this$1).getContainer().getShell().close();
    }
  }
}

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

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

class AttachmentSourcePage$1
  extends SelectionAdapter
{
  AttachmentSourcePage$1(AttachmentSourcePage paramAttachmentSourcePage) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    if (!AttachmentSourcePage.access$0(this$0).getSelection()) {
      return;
    }
    AttachmentSourcePage.access$1(this$0);
    AttachmentSourcePage.access$2(this$0, true);
    AttachmentSourcePage.access$3(this$0);
    AttachmentSourcePage.access$4(this$0);
  }
}

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

import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.mylyn.commons.ui.wizard.ScreenshotCreationPage;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;

class TaskAttachmentWizard$1
  extends ScreenshotCreationPage
{
  TaskAttachmentWizard$1(TaskAttachmentWizard paramTaskAttachmentWizard) {}
  
  protected IDialogSettings getDialogSettings()
  {
    TasksUiPlugin plugin = TasksUiPlugin.getDefault();
    IDialogSettings settings = plugin.getDialogSettings();
    String DIALOG_SETTINGS = ScreenshotCreationPage.class.getCanonicalName();
    IDialogSettings section = settings.getSection(DIALOG_SETTINGS);
    if (section == null) {
      section = settings.addNewSection(DIALOG_SETTINGS);
    }
    return section;
  }
}

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

import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.graphics.Rectangle;

class AttachmentPreviewPage$3
  extends ControlAdapter
{
  AttachmentPreviewPage$3(AttachmentPreviewPage paramAttachmentPreviewPage, Rectangle paramRectangle) {}
  
  public void controlResized(ControlEvent event)
  {
    AttachmentPreviewPage.access$0(this$0, val$imgSize);
  }
}

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

import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.wizard.IWizardContainer;

class AttachmentSourcePage$8
  implements IDoubleClickListener
{
  AttachmentSourcePage$8(AttachmentSourcePage paramAttachmentSourcePage) {}
  
  public void doubleClick(DoubleClickEvent event)
  {
    ISelection selection = event.getSelection();
    if ((selection instanceof TreeSelection))
    {
      TreeSelection treeSel = (TreeSelection)selection;
      Object res = treeSel.getFirstElement();
      if (res != null) {
        if (((res instanceof IProject)) || ((res instanceof IFolder)))
        {
          if (AttachmentSourcePage.access$10(this$0).getExpandedState(res)) {
            AttachmentSourcePage.access$10(this$0).collapseToLevel(res, 1);
          } else {
            AttachmentSourcePage.access$10(this$0).expandToLevel(res, 1);
          }
        }
        else if ((res instanceof IFile)) {
          AttachmentSourcePage.access$11(this$0).showPage(this$0.getNextPage());
        }
      }
    }
  }
}

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

import java.util.List;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;

class SelectRepositoryPage$RepositoryContentProvider
  implements ITreeContentProvider
{
  SelectRepositoryPage$RepositoryContentProvider(SelectRepositoryPage paramSelectRepositoryPage) {}
  
  public Object[] getChildren(Object parentElement)
  {
    return null;
  }
  
  public Object getParent(Object element)
  {
    return null;
  }
  
  public boolean hasChildren(Object element)
  {
    return false;
  }
  
  public Object[] getElements(Object inputElement)
  {
    return SelectRepositoryPage.access$0(this$0).toArray();
  }
  
  public void dispose() {}
  
  public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
}

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

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.mylyn.tasks.core.data.AbstractTaskAttachmentSource;
import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.dnd.TransferData;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.ImageLoader;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;

class TaskAttachmentWizard$ClipboardTaskAttachmentSource
  extends AbstractTaskAttachmentSource
{
  private byte[] data;
  private static List<Transfer> transfers;
  private Object contents;
  
  public static boolean isSupportedType(Display display)
  {
    Clipboard clipboard = new Clipboard(display);
    TransferData[] types = clipboard.getAvailableTypes();
    TransferData[] arrayOfTransferData1;
    int j = (arrayOfTransferData1 = types).length;
    for (int i = 0; i < j; i++)
    {
      TransferData transferData = arrayOfTransferData1[i];
      List<Transfer> transfers = getTransfers();
      for (Transfer transfer : transfers) {
        if (transfer.isSupportedType(transferData)) {
          return true;
        }
      }
    }
    return false;
  }
  
  private static List<Transfer> getTransfers()
  {
    if (transfers != null) {
      return transfers;
    }
    transfers = new ArrayList();
    try
    {
      Class<?> clazz = Class.forName("org.eclipse.swt.dnd.ImageTransfer");
      Method method = clazz.getMethod("getInstance", new Class[0]);
      if (method != null) {
        transfers.add((Transfer)method.invoke(null, new Object[0]));
      }
    }
    catch (Exception localException) {}catch (LinkageError localLinkageError) {}
    transfers.add(TextTransfer.getInstance());
    return transfers;
  }
  
  public TaskAttachmentWizard$ClipboardTaskAttachmentSource()
  {
    BusyIndicator.showWhile(PlatformUI.getWorkbench().getDisplay(), new Runnable()
    {
      public void run()
      {
        Clipboard clipboard = new Clipboard(PlatformUI.getWorkbench().getDisplay());
        List<Transfer> transfers = TaskAttachmentWizard.ClipboardTaskAttachmentSource.access$0();
        for (Transfer transfer : transfers)
        {
          contents = clipboard.getContents(transfer);
          if (contents != null) {
            break;
          }
        }
        clipboard.dispose();
      }
    });
  }
  
  public InputStream createInputStream(IProgressMonitor monitor)
    throws CoreException
  {
    byte[] bytes = getData();
    if (bytes != null) {
      return new ByteArrayInputStream(data);
    }
    throw new CoreException(new Status(4, "org.eclipse.mylyn.tasks.ui", "Invalid content type."));
  }
  
  public String getContentType()
  {
    if ((contents instanceof String)) {
      return "text/plain";
    }
    if ((contents instanceof ImageData)) {
      return "image/png";
    }
    return "application/octet-stream";
  }
  
  public String getDescription()
  {
    return null;
  }
  
  public long getLength()
  {
    byte[] bytes = getData();
    return bytes != null ? bytes.length : -1;
  }
  
  private byte[] getData()
  {
    if (data == null) {
      if ((contents instanceof String))
      {
        data = ((String)contents).getBytes();
      }
      else if ((contents instanceof ImageData))
      {
        ImageLoader loader = new ImageLoader();
        data = new ImageData[] { (ImageData)contents };
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        loader.save(out, 5);
        data = out.toByteArray();
      }
    }
    return data;
  }
  
  public String getName()
  {
    if ((contents instanceof String)) {
      return "clipboard.txt";
    }
    if ((contents instanceof ImageData)) {
      return "clipboard.png";
    }
    return "";
  }
  
  public boolean isLocal()
  {
    return true;
  }
}

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

import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.mylyn.tasks.ui.TasksUiImages;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;

public class MultiRepositoryAwareWizard
  extends Wizard
  implements INewWizard
{
  private final SelectRepositoryPage selectRepositoryPage;
  
  public MultiRepositoryAwareWizard(SelectRepositoryPage page, String title)
  {
    selectRepositoryPage = page;
    setForcePreviousAndNextButtons(true);
    setNeedsProgressMonitor(true);
    setWindowTitle(title);
    setDefaultPageImageDescriptor(TasksUiImages.BANNER_REPOSITORY);
  }
  
  public void init(IWorkbench workbench, IStructuredSelection selection) {}
  
  public void addPages()
  {
    addPage(selectRepositoryPage);
  }
  
  public boolean canFinish()
  {
    return selectRepositoryPage.canFinish();
  }
  
  public boolean performFinish()
  {
    return selectRepositoryPage.performFinish();
  }
}

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

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

class AttachmentSourcePage$2
  extends SelectionAdapter
{
  AttachmentSourcePage$2(AttachmentSourcePage paramAttachmentSourcePage) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    if (!AttachmentSourcePage.access$5(this$0).getSelection()) {
      return;
    }
    AttachmentSourcePage.access$1(this$0);
    AttachmentSourcePage.access$2(this$0, AttachmentSourcePage.access$6(this$0).getText() != "");
    AttachmentSourcePage.access$4(this$0);
  }
}

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

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.mylyn.internal.tasks.ui.util.AttachmentUtil;
import org.eclipse.mylyn.tasks.core.data.TaskAttachmentModel;
import org.eclipse.mylyn.tasks.core.sync.SubmitJobEvent;
import org.eclipse.mylyn.tasks.core.sync.SubmitJobListener;

class TaskAttachmentWizard$2
  extends SubmitJobListener
{
  TaskAttachmentWizard$2(TaskAttachmentWizard paramTaskAttachmentWizard, boolean paramBoolean) {}
  
  public void done(SubmitJobEvent event) {}
  
  public void taskSubmitted(SubmitJobEvent event, IProgressMonitor monitor)
    throws CoreException
  {
    if (val$attachContext)
    {
      monitor.subTask(Messages.TaskAttachmentWizard_Attaching_context);
      AttachmentUtil.postContext(TaskAttachmentWizard.access$0(this$0), TaskAttachmentWizard.access$1(this$0).getTaskRepository(), TaskAttachmentWizard.access$1(this$0).getTask(), null, null, 
        monitor);
    }
  }
  
  public void taskSynchronized(SubmitJobEvent event, IProgressMonitor monitor)
    throws CoreException
  {}
}

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

import java.io.InputStream;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;

class AttachmentPreviewPage$4
  implements IRunnableWithProgress
{
  AttachmentPreviewPage$4(AttachmentPreviewPage paramAttachmentPreviewPage, Object[] paramArrayOfObject, Composite paramComposite) {}
  
  /* Error */
  public void run(org.eclipse.core.runtime.IProgressMonitor monitor)
    throws java.lang.reflect.InvocationTargetException, java.lang.InterruptedException
  {
    // Byte code:
    //   0: aload_1
    //   1: getstatic 142	org/eclipse/mylyn/internal/tasks/ui/wizards/Messages:AttachmentPreviewPage_Preparing_preview	Ljava/lang/String;
    //   4: iconst_m1
    //   5: invokeinterface 165 3 0
    //   10: aload_0
    //   11: getfield 140	org/eclipse/mylyn/internal/tasks/ui/wizards/AttachmentPreviewPage$4:this$0	Lorg/eclipse/mylyn/internal/tasks/ui/wizards/AttachmentPreviewPage;
    //   14: invokestatic 157	org/eclipse/mylyn/internal/tasks/ui/wizards/AttachmentPreviewPage:access$1	(Lorg/eclipse/mylyn/internal/tasks/ui/wizards/AttachmentPreviewPage;)Lorg/eclipse/mylyn/tasks/core/data/TaskAttachmentModel;
    //   17: invokevirtual 160	org/eclipse/mylyn/tasks/core/data/TaskAttachmentModel:getSource	()Lorg/eclipse/mylyn/tasks/core/data/AbstractTaskAttachmentSource;
    //   20: aload_1
    //   21: invokevirtual 159	org/eclipse/mylyn/tasks/core/data/AbstractTaskAttachmentSource:createInputStream	(Lorg/eclipse/core/runtime/IProgressMonitor;)Ljava/io/InputStream;
    //   24: astore_2
    //   25: aload_0
    //   26: getfield 140	org/eclipse/mylyn/internal/tasks/ui/wizards/AttachmentPreviewPage$4:this$0	Lorg/eclipse/mylyn/internal/tasks/ui/wizards/AttachmentPreviewPage;
    //   29: invokestatic 155	org/eclipse/mylyn/internal/tasks/ui/wizards/AttachmentPreviewPage:access$2	(Lorg/eclipse/mylyn/internal/tasks/ui/wizards/AttachmentPreviewPage;)Z
    //   32: ifeq +87 -> 119
    //   35: new 68	java/lang/StringBuilder
    //   38: dup
    //   39: invokespecial 149	java/lang/StringBuilder:<init>	()V
    //   42: astore_3
    //   43: new 62	java/io/BufferedReader
    //   46: dup
    //   47: new 65	java/io/InputStreamReader
    //   50: dup
    //   51: aload_2
    //   52: invokespecial 146	java/io/InputStreamReader:<init>	(Ljava/io/InputStream;)V
    //   55: invokespecial 143	java/io/BufferedReader:<init>	(Ljava/io/Reader;)V
    //   58: astore 4
    //   60: goto +17 -> 77
    //   63: aload_3
    //   64: aload 5
    //   66: invokevirtual 151	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   69: pop
    //   70: aload_3
    //   71: ldc 2
    //   73: invokevirtual 151	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   76: pop
    //   77: aload 4
    //   79: invokevirtual 144	java/io/BufferedReader:readLine	()Ljava/lang/String;
    //   82: dup
    //   83: astore 5
    //   85: ifnull +21 -> 106
    //   88: aload_3
    //   89: invokevirtual 148	java/lang/StringBuilder:length	()I
    //   92: ldc 1
    //   94: if_icmpge +12 -> 106
    //   97: aload_1
    //   98: invokeinterface 164 1 0
    //   103: ifeq -40 -> 63
    //   106: aload_0
    //   107: getfield 139	org/eclipse/mylyn/internal/tasks/ui/wizards/AttachmentPreviewPage$4:val$result	[Ljava/lang/Object;
    //   110: iconst_0
    //   111: aload_3
    //   112: invokevirtual 150	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   115: aastore
    //   116: goto +80 -> 196
    //   119: aload_0
    //   120: getfield 140	org/eclipse/mylyn/internal/tasks/ui/wizards/AttachmentPreviewPage$4:this$0	Lorg/eclipse/mylyn/internal/tasks/ui/wizards/AttachmentPreviewPage;
    //   123: invokestatic 156	org/eclipse/mylyn/internal/tasks/ui/wizards/AttachmentPreviewPage:access$3	(Lorg/eclipse/mylyn/internal/tasks/ui/wizards/AttachmentPreviewPage;)Z
    //   126: ifeq +70 -> 196
    //   129: invokestatic 162	org/eclipse/swt/widgets/Display:getDefault	()Lorg/eclipse/swt/widgets/Display;
    //   132: new 77	org/eclipse/mylyn/internal/tasks/ui/wizards/AttachmentPreviewPage$4$1
    //   135: dup
    //   136: aload_0
    //   137: aload_2
    //   138: aload_0
    //   139: getfield 141	org/eclipse/mylyn/internal/tasks/ui/wizards/AttachmentPreviewPage$4:val$composite	Lorg/eclipse/swt/widgets/Composite;
    //   142: aload_0
    //   143: getfield 139	org/eclipse/mylyn/internal/tasks/ui/wizards/AttachmentPreviewPage$4:val$result	[Ljava/lang/Object;
    //   146: invokespecial 158	org/eclipse/mylyn/internal/tasks/ui/wizards/AttachmentPreviewPage$4$1:<init>	(Lorg/eclipse/mylyn/internal/tasks/ui/wizards/AttachmentPreviewPage$4;Ljava/io/InputStream;Lorg/eclipse/swt/widgets/Composite;[Ljava/lang/Object;)V
    //   149: invokevirtual 161	org/eclipse/swt/widgets/Display:syncExec	(Ljava/lang/Runnable;)V
    //   152: goto +44 -> 196
    //   155: astore_3
    //   156: new 69	java/lang/reflect/InvocationTargetException
    //   159: dup
    //   160: aload_3
    //   161: invokespecial 152	java/lang/reflect/InvocationTargetException:<init>	(Ljava/lang/Throwable;)V
    //   164: athrow
    //   165: astore 6
    //   167: aload_2
    //   168: invokevirtual 145	java/io/InputStream:close	()V
    //   171: goto +22 -> 193
    //   174: astore 7
    //   176: new 72	org/eclipse/core/runtime/Status
    //   179: dup
    //   180: iconst_4
    //   181: ldc 4
    //   183: ldc 3
    //   185: aload 7
    //   187: invokespecial 153	org/eclipse/core/runtime/Status:<init>	(ILjava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V
    //   190: invokestatic 154	org/eclipse/mylyn/commons/core/StatusHandler:log	(Lorg/eclipse/core/runtime/IStatus;)V
    //   193: aload 6
    //   195: athrow
    //   196: aload_2
    //   197: invokevirtual 145	java/io/InputStream:close	()V
    //   200: goto +46 -> 246
    //   203: astore 7
    //   205: new 72	org/eclipse/core/runtime/Status
    //   208: dup
    //   209: iconst_4
    //   210: ldc 4
    //   212: ldc 3
    //   214: aload 7
    //   216: invokespecial 153	org/eclipse/core/runtime/Status:<init>	(ILjava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V
    //   219: invokestatic 154	org/eclipse/mylyn/commons/core/StatusHandler:log	(Lorg/eclipse/core/runtime/IStatus;)V
    //   222: goto +24 -> 246
    //   225: astore_2
    //   226: new 69	java/lang/reflect/InvocationTargetException
    //   229: dup
    //   230: aload_2
    //   231: invokespecial 152	java/lang/reflect/InvocationTargetException:<init>	(Ljava/lang/Throwable;)V
    //   234: athrow
    //   235: astore 8
    //   237: aload_1
    //   238: invokeinterface 163 1 0
    //   243: aload 8
    //   245: athrow
    //   246: aload_1
    //   247: invokeinterface 163 1 0
    //   252: return
    // Line number table:
    //   Java source line #250	-> byte code offset #0
    //   Java source line #251	-> byte code offset #10
    //   Java source line #253	-> byte code offset #25
    //   Java source line #254	-> byte code offset #35
    //   Java source line #255	-> byte code offset #43
    //   Java source line #257	-> byte code offset #60
    //   Java source line #259	-> byte code offset #63
    //   Java source line #260	-> byte code offset #70
    //   Java source line #257	-> byte code offset #77
    //   Java source line #258	-> byte code offset #97
    //   Java source line #257	-> byte code offset #103
    //   Java source line #262	-> byte code offset #106
    //   Java source line #263	-> byte code offset #119
    //   Java source line #264	-> byte code offset #129
    //   Java source line #281	-> byte code offset #155
    //   Java source line #282	-> byte code offset #156
    //   Java source line #283	-> byte code offset #165
    //   Java source line #285	-> byte code offset #167
    //   Java source line #286	-> byte code offset #174
    //   Java sou
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