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

16:46:54.824 INFO  jd.cli.Main - Decompiling org.eclipse.mylyn.tasks.search_3.7.1.v20120425-0100.jar
package org.eclipse.mylyn.internal.tasks.ui;

import org.eclipse.core.runtime.Status;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositoryQueryPage;
import org.eclipse.mylyn.tasks.ui.wizards.ITaskSearchPageContainer;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.forms.events.HyperlinkAdapter;
import org.eclipse.ui.forms.events.HyperlinkEvent;
import org.eclipse.ui.forms.widgets.Hyperlink;

class TaskSearchPage$DeadSearchPage
  extends AbstractRepositoryQueryPage
{
  public TaskSearchPage$DeadSearchPage(TaskSearchPage paramTaskSearchPage, TaskRepository rep, Status status)
  {
    super("Search page error", rep);
  }
  
  public void createControl(Composite parent)
  {
    Hyperlink hyperlink = new Hyperlink(parent, 0);
    hyperlink.setText(Messages.TaskSearchPage_ERROR_Unable_to_present_query_page);
    hyperlink.setUnderlined(true);
    hyperlink.addHyperlinkListener(new HyperlinkAdapter()
    {
      public void linkActivated(HyperlinkEvent e)
      {
        this$0.getControl().getShell().close();
        TasksUiUtil.openEditRepositoryWizard(getTaskRepository());
      }
    });
    GridDataFactory.fillDefaults().grab(true, true).applyTo(hyperlink);
    setControl(hyperlink);
  }
  
  public IRepositoryQuery getQuery()
  {
    return null;
  }
  
  public boolean isPageComplete()
  {
    return false;
  }
  
  public void setVisible(boolean visible)
  {
    super.setVisible(visible);
    if (visible) {
      getSearchContainer().setPerformActionEnabled(false);
    }
  }
  
  public String getQueryTitle()
  {
    return null;
  }
  
  public void applyTo(IRepositoryQuery query) {}
}

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

import org.eclipse.jface.operation.IRunnableContext;
import org.eclipse.mylyn.tasks.ui.wizards.ITaskSearchPageContainer;
import org.eclipse.search.ui.ISearchPageContainer;

class TaskSearchPage$1
  implements ITaskSearchPageContainer
{
  TaskSearchPage$1(TaskSearchPage paramTaskSearchPage) {}
  
  public IRunnableContext getRunnableContext()
  {
    return TaskSearchPage.access$0(this$0).getRunnableContext();
  }
  
  public void setPerformActionEnabled(boolean enabled)
  {
    TaskSearchPage.access$0(this$0).setPerformActionEnabled(enabled);
  }
}

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

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.DialogPage;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.operation.IRunnableContext;
import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.commons.ui.CommonImages;
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryManager;
import org.eclipse.mylyn.internal.tasks.ui.search.SearchHitCollector;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskListFilteredTree;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
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.AbstractRepositoryConnectorUi;
import org.eclipse.mylyn.tasks.ui.TasksUi;
import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositoryQueryPage;
import org.eclipse.mylyn.tasks.ui.wizards.ITaskSearchPage;
import org.eclipse.mylyn.tasks.ui.wizards.ITaskSearchPageContainer;
import org.eclipse.search.internal.ui.SearchPlugin;
import org.eclipse.search.ui.ISearchPage;
import org.eclipse.search.ui.ISearchPageContainer;
import org.eclipse.search.ui.ISearchQuery;
import org.eclipse.search.ui.ISearchResultViewPart;
import org.eclipse.search.ui.NewSearchUI;
import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.KeyListener;
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.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.forms.events.HyperlinkAdapter;
import org.eclipse.ui.forms.events.HyperlinkEvent;
import org.eclipse.ui.forms.widgets.Hyperlink;
import org.eclipse.ui.forms.widgets.ImageHyperlink;

public class TaskSearchPage
  extends DialogPage
  implements ISearchPage
{
  public static final String ID = "org.eclipse.mylyn.tasks.ui.search.page";
  private static final String PAGE_KEY = "page";
  private static final String PAGE_NAME = "TaskSearchPage";
  private static final String STORE_REPO_ID = "TaskSearchPage.REPO";
  private Combo repositoryCombo;
  private Text keyText;
  private TaskRepository repository;
  private Composite fParentComposite;
  private IDialogSettings fDialogSettings;
  private int currentPageIndex = -1;
  private boolean firstView = true;
  private Control[] queryPages;
  private ISearchPageContainer pageContainer;
  private ITaskSearchPageContainer taskSearchPageContainer;
  
  public boolean performAction()
  {
    saveDialogSettings();
    String key = keyText.getText();
    if ((key != null) && (key.trim().length() > 0))
    {
      key = key.trim();
      boolean openSuccessful = TasksUiUtil.openTask(repository, key);
      if (!openSuccessful) {
        MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), 
          Messages.TaskSearchPage_Task_Search, Messages.TaskSearchPage_No_task_found_matching_key_ + key);
      }
      return openSuccessful;
    }
    ITaskSearchPage page = (ITaskSearchPage)queryPages[currentPageIndex].getData("page");
    return page.performSearch();
  }
  
  public void setContainer(ISearchPageContainer container)
  {
    pageContainer = container;
    taskSearchPageContainer = new ITaskSearchPageContainer()
    {
      public IRunnableContext getRunnableContext()
      {
        return pageContainer.getRunnableContext();
      }
      
      public void setPerformActionEnabled(boolean enabled)
      {
        pageContainer.setPerformActionEnabled(enabled);
      }
    };
  }
  
  public void createControl(Composite parent)
  {
    fParentComposite = new Composite(parent, 0);
    GridLayout layout = new GridLayout(1, false);
    
    fParentComposite.setLayout(layout);
    GridData gd = new GridData(1808);
    fParentComposite.setLayoutData(gd);
    
    createRepositoryGroup(fParentComposite);
    
    setControl(fParentComposite);
    Dialog.applyDialogFont(fParentComposite);
  }
  
  private void createRepositoryGroup(Composite control)
  {
    Composite group = new Composite(control, 0);
    GridLayout layout = new GridLayout(6, false);
    marginWidth = 0;
    marginHeight = 0;
    group.setLayout(layout);
    GridData gd = new GridData(768);
    group.setLayoutData(gd);
    
    Label label = new Label(group, 0);
    label.setText(Messages.TaskSearchPage_Repository);
    
    repositoryCombo = new Combo(group, 2060);
    repositoryCombo.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        TaskSearchPage.this.displayQueryPage(repositoryCombo.getSelectionIndex());
      }
    });
    label = new Label(group, 0);
    label.setText("  ");
    
    Label labelKey = new Label(group, 0);
    labelKey.setText(Messages.TaskSearchPage_Task_Key_ID);
    keyText = new Text(group, 2048);
    keyText.setLayoutData(new GridData(768));
    
    String findText = null;
    TaskListView taskListView = TaskListView.getFromActivePerspective();
    if (taskListView != null)
    {
      findText = taskListView.getFilteredTree().getFilterControl().getText();
      if ((findText != null) && (findText.trim().length() > 0) && (isTaskKeyCandidate(findText.trim())))
      {
        pageContainer.setPerformActionEnabled(true);
        keyText.setText(findText.trim());
        keyText.setFocus();
      }
    }
    keyText.addKeyListener(new KeyListener()
    {
      public void keyPressed(KeyEvent e) {}
      
      public void keyReleased(KeyEvent e)
      {
        TaskSearchPage.this.updatePageEnablement();
      }
    });
    ImageHyperlink clearKey = new ImageHyperlink(group, 0);
    clearKey.setImage(CommonImages.getImage(CommonImages.REMOVE));
    clearKey.addHyperlinkListener(new HyperlinkAdapter()
    {
      public void linkActivated(HyperlinkEvent e)
      {
        keyText.setText("");
        TaskSearchPage.this.updatePageEnablement();
      }
    });
  }
  
  private void updatePageEnablement()
  {
    if ((keyText.getText() != null) && (keyText.getText().trim().length() > 0))
    {
      if ((queryPages != null) && (queryPages[currentPageIndex] != null) && 
        ((queryPages[currentPageIndex].getData("page") instanceof AbstractRepositoryQueryPage))) {
        ((AbstractRepositoryQueryPage)queryPages[currentPageIndex].getData("page")).setControlsEnabled(false);
      }
      if (repositoryCombo.getSelectionIndex() > -1) {
        pageContainer.setPerformActionEnabled(true);
      }
    }
    else if ((queryPages != null) && (queryPages[currentPageIndex] != null) && 
      ((queryPages[currentPageIndex].getData("page") instanceof AbstractRepositoryQueryPage)))
    {
      ((AbstractRepositoryQueryPage)queryPages[currentPageIndex].getData("page")).setControlsEnabled(true);
    }
  }
  
  private Control createPage(TaskRepository repository, ITaskSearchPage searchPage)
  {
    Composite pageWrapper = new Composite(fParentComposite, 0);
    pageWrapper.setLayoutData(new GridData(4, 4, true, true));
    
    GridLayout layout = new GridLayout();
    marginWidth = 0;
    marginHeight = 0;
    pageWrapper.setLayout(layout);
    try
    {
      searchPage.setContainer(taskSearchPageContainer);
      searchPage.createControl(pageWrapper);
    }
    catch (Exception e)
    {
      pageWrapper.dispose();
      searchPage.dispose();
      
      searchPage = createErrorPage(repository, e);
      return searchPage.getControl();
    }
    IDialogSettings searchDialogSettings = SearchPlugin.getDefault().getDialogSettingsSection(
      "DialogBounds_SearchDialog");
    if (searchDialogSettings.get("DIALOG_WIDTH") == null) {
      fParentComposite.getParent().getShell().pack();
    }
    pageWrapper.setData("page", searchPage);
    return pageWrapper;
  }
  
  private ITaskSearchPage createErrorPage(TaskRepository repository, Throwable e)
  {
    Status status = new Status(4, "org.eclipse.mylyn.tasks.ui", 
      "Error occurred while constructing search page for " + repository.getRepositoryUrl() + " [" + 
      repository.getConnectorKind() + "]", e);
    StatusHandler.log(status);
    
    ITaskSearchPage searchPage = new DeadSearchPage(repository, status);
    searchPage.setContainer(taskSearchPageContainer);
    searchPage.createControl(fParentComposite);
    searchPage.getControl().setData("page", searchPage);
    return searchPage;
  }
  
  private void displayQueryPage(final int pageIndex)
  {
    if ((currentPageIndex == pageIndex) || (pageIndex < 0)) {
      return;
    }
    if ((currentPageIndex != -1) && (queryPages[currentPageIndex] != null))
    {
      queryPages[currentPageIndex].setVisible(false);
      ITaskSearchPage page = (ITaskSearchPage)queryPages[currentPageIndex].getData("page");
      page.setVisible(false);
      GridData data = (GridData)queryPages[currentPageIndex].getLayoutData();
      exclude = true;
      queryPages[currentPageIndex].setLayoutData(data);
    }
    String repositoryLabel = repositoryCombo.getItem(pageIndex);
    repository = ((TaskRepository)repositoryCombo.getData(repositoryLabel));
    if ((queryPages[pageIndex] == null) && 
      (repository != null))
    {
      final AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(repository.getConnectorKind());
      if (connectorUi != null) {
        SafeRunner.run(new ISafeRunnable()
        {
          public void run()
            throws Exception
          {
            ITaskSearchPage searchPage = TaskSearchPage.this.getSearchPage(connectorUi);
            if (searchPage != null)
            {
              queryPages[pageIndex] = TaskSearchPage.this.createPage(repository, searchPage);
            }
            else
            {
              AbstractRepositoryConnector connector = TasksUi.getRepositoryManager()
                .getRepositoryConnector(repository.getConnectorKind());
              if (connector.canCreateTaskFromKey(repository)) {
                queryPages[pageIndex] = TaskSearchPage.this.createPage(repository, new TaskSearchPage.NoSearchPage(TaskSearchPage.this, repository));
              }
            }
          }
          
          public void handleException(Throwable e)
          {
            ITaskSearchPage page = TaskSearchPage.this.createErrorPage(repository, e);
            queryPages[pageIndex] = page.getControl();
          }
        });
      }
    }
    if (repository != null)
    {
      AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
        repository.getConnectorKind());
      if (connector.canCreateTaskFromKey(repository)) {
        keyText.setEnabled(true);
      } else {
        keyText.setEnabled(false);
      }
    }
    if (queryPages[pageIndex] != null)
    {
      GridData data = (GridData)queryPages[pageIndex].getLayoutData();
      if (data == null) {
        data = new GridData();
      }
      exclude = false;
      queryPages[pageIndex].setLayoutData(data);
      queryPages[pageIndex].setVisible(true);
      ITaskSearchPage page = (ITaskSearchPage)queryPages[pageIndex].getData("page");
      page.setVisible(true);
    }
    currentPageIndex = pageIndex;
    fParentComposite.getParent().layout(true, true);
    updatePageEnablement();
  }
  
  private ITaskSearchPage getSearchPage(AbstractRepositoryConnectorUi connectorUi)
  {
    if (connectorUi.hasSearchPage()) {
      return connectorUi.getSearchPage(repository, null);
    }
    return null;
  }
  
  public void setVisible(boolean visible)
  {
    if (firstView)
    {
      firstView = false;
      getControl().setLayoutData(new GridData(4, 4, true, true));
      
      List<TaskRepository> repositories = TasksUi.getRepositoryManager().getAllRepositories();
      List<TaskRepository> searchableRepositories = new ArrayList();
      for (TaskRepository repository : repositories)
      {
        AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(repository.getConnectorKind());
        AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
          repository.getConnectorKind());
        if (((connectorUi != null) && (connectorUi.hasSearchPage()) && (!repository.isOffline())) || 
          (connector.canCreateTaskFromKey(repository))) {
          searchableRepositories.add(repository);
        }
      }
      Collections.sort(searchableRepositories, new TaskRepositoryComparator());
      
      String[] repositoryUrls = new String[searchableRepositories.size()];
      int i = 0;
      int indexToSelect = 0;
      for (TaskRepository currRepsitory : searchableRepositories)
      {
        if ((this.repository != null) && (this.repository.equals(currRepsitory))) {
          indexToSelect = i;
        }
        repositoryUrls[i] = currRepsitory.getRepositoryUrl();
        i++;
      }
      IDialogSettings settings = getDialogSettings();
      if (repositoryCombo != null)
      {
        for (int x = 0; x < searchableRepositories.size(); x++)
        {
          repositoryCombo.add(((TaskRepository)searchableRepositories.get(x)).getRepositoryLabel());
          repositoryCombo.setData(((TaskRepository)searchableRepositories.get(x)).getRepositoryLabel(), 
            searchableRepositories.get(x));
        }
        if (repositoryUrls.length == 0)
        {
          MessageDialog.openInformation(Display.getCurrent().getActiveShell(), 
            Messages.TaskSearchPage_Repository_Search, TaskRepositoryManager.MESSAGE_NO_REPOSITORY);
        }
        else
        {
          String selectRepo = settings.get("TaskSearchPage.REPO");
          if ((selectRepo != null) && (repositoryCombo.indexOf(selectRepo) > -1))
          {
            repositoryCombo.select(repositoryCombo.indexOf(selectRepo));
            this.repository = ((TaskRepository)repositoryCombo.getData(selectRepo));
          }
          else
          {
            repositoryCombo.select(indexToSelect);
          }
          queryPages = new Control[repositoryUrls.length];
          displayQueryPage(repositoryCombo.getSelectionIndex());
        }
      }
    }
    if (queryPages == null) {
      pageContainer.setPerformActionEnabled(false);
    }
    super.setVisible(visible);
    
    setDefaultValuesAndFocus();
  }
  
  private void setDefaultValuesAndFocus()
  {
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (window != null)
    {
      IWorkbenchPage page = window.getActivePage();
      if (page != null)
      {
        String repositoryUrl = null;
        IWorkbenchPart part = page.getActivePart();
        if ((part instanceof ISearchResultViewPart))
        {
          ISearchQuery[] queries = NewSearchUI.getQueries();
          if ((queries.length > 0) && 
            ((queries[0] instanceof SearchHitCollector))) {
            repositoryUrl = ((SearchHitCollector)queries[0]).getRepositoryQuery().getRepositoryUrl();
          }
        }
        if (repositoryUrl != null)
        {
          TaskRepository repository = TasksUiPlugin.getRepositoryManager().getRepository(repositoryUrl);
          if (repository != null)
          {
            int index = 0;
            String[] arrayOfString;
            int j = (arrayOfString = repositoryCombo.getItems()).length;
            for (int i = 0; i < j; i++)
            {
              String repositoryLabel = arrayOfString[i];
              if (repositoryLabel.equals(repository.getRepositoryLabel())) {
                repositoryCombo.select(index);
              }
              index++;
            }
            displayQueryPage(repositoryCombo.getSelectionIndex());
          }
        }
      }
    }
    if ((keyText.getText() != null) && (keyText.getText().trim().length() > 0))
    {
      keyText.setFocus();
      keyText.setSelection(0, keyText.getText().length());
    }
    else
    {
      Clipboard clipboard = new Clipboard(Display.getDefault());
      TextTransfer transfer = TextTransfer.getInstance();
      String contents = (String)clipboard.getContents(transfer);
      if ((contents != null) && 
        (isTaskKeyCandidate(contents.trim())))
      {
        keyText.setText(contents.trim());
        keyText.setFocus();
        keyText.setSelection(0, keyText.getText().length());
      }
    }
    updatePageEnablement();
  }
  
  private boolean isTaskKeyCandidate(String contents)
  {
    boolean looksLikeKey = false;
    try
    {
      Integer.parseInt(contents);
      looksLikeKey = true;
    }
    catch (NumberFormatException localNumberFormatException) {}
    if (!looksLikeKey) {
      try
      {
        Integer.parseInt(contents.substring(contents.lastIndexOf('-')));
        looksLikeKey = true;
      }
      catch (Exception localException) {}
    }
    return looksLikeKey;
  }
  
  public IDialogSettings getDialogSettings()
  {
    IDialogSettings settings = TasksUiPlugin.getDefault().getDialogSettings();
    fDialogSettings = settings.getSection("TaskSearchPage");
    if (fDialogSettings == null) {
      fDialogSettings = settings.addNewSection("TaskSearchPage");
    }
    return fDialogSettings;
  }
  
  private void saveDialogSettings()
  {
    IDialogSettings settings = getDialogSettings();
    settings.put("TaskSearchPage.REPO", repositoryCombo.getText());
  }
  
  public void dispose()
  {
    if (queryPages != null)
    {
      Control[] arrayOfControl;
      int j = (arrayOfControl = queryPages).length;
      for (int i = 0; i < j; i++)
      {
        Control control = arrayOfControl[i];
        if (control != null)
        {
          ITaskSearchPage page = (ITaskSearchPage)control.getData("page");
          page.dispose();
        }
      }
    }
    super.dispose();
  }
  
  private class DeadSearchPage
    extends AbstractRepositoryQueryPage
  {
    public DeadSearchPage(TaskRepository rep, Status status)
    {
      super(rep);
    }
    
    public void createControl(Composite parent)
    {
      Hyperlink hyperlink = new Hyperlink(parent, 0);
      hyperlink.setText(Messages.TaskSearchPage_ERROR_Unable_to_present_query_page);
      hyperlink.setUnderlined(true);
      hyperlink.addHyperlinkListener(new HyperlinkAdapter()
      {
        public void linkActivated(HyperlinkEvent e)
        {
          getControl().getShell().close();
          TasksUiUtil.openEditRepositoryWizard(getTaskRepository());
        }
      });
      GridDataFactory.fillDefaults().grab(true, true).applyTo(hyperlink);
      setControl(hyperlink);
    }
    
    public IRepositoryQuery getQuery()
    {
      return null;
    }
    
    public boolean isPageComplete()
    {
      return false;
    }
    
    public void setVisible(boolean visible)
    {
      super.setVisible(visible);
      if (visible) {
        getSearchContainer().setPerformActionEnabled(false);
      }
    }
    
    public String getQueryTitle()
    {
      return null;
    }
    
    public void applyTo(IRepositoryQuery query) {}
  }
  
  private class NoSearchPage
    extends AbstractRepositoryQueryPage
  {
    public NoSearchPage(TaskRepository rep)
    {
      super(rep);
    }
    
    public void createControl(Composite parent)
    {
      Composite composite = new Composite(parent, 0);
      composite.setLayout(new GridLayout());
      Dialog.applyDialogFont(composite);
      setControl(composite);
    }
    
    public IRepositoryQuery getQuery()
    {
      return null;
    }
    
    public boolean isPageComplete()
    {
      return false;
    }
    
    public void setVisible(boolean visible)
    {
      super.setVisible(visible);
      if (visible) {
        getSearchContainer().setPerformActionEnabled(false);
      }
    }
    
    public String getQueryTitle()
    {
      return null;
    }
    
    public void applyTo(IRepositoryQuery query) {}
  }
}

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

import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositoryQueryPage;
import org.eclipse.mylyn.tasks.ui.wizards.ITaskSearchPageContainer;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;

class TaskSearchPage$NoSearchPage
  extends AbstractRepositoryQueryPage
{
  public TaskSearchPage$NoSearchPage(TaskSearchPage paramTaskSearchPage, TaskRepository rep)
  {
    super("No search page", rep);
  }
  
  public void createControl(Composite parent)
  {
    Composite composite = new Composite(parent, 0);
    composite.setLayout(new GridLayout());
    Dialog.applyDialogFont(composite);
    setControl(composite);
  }
  
  public IRepositoryQuery getQuery()
  {
    return null;
  }
  
  public boolean isPageComplete()
  {
    return false;
  }
  
  public void setVisible(boolean visible)
  {
    super.setVisible(visible);
    if (visible) {
      getSearchContainer().setPerformActionEnabled(false);
    }
  }
  
  public String getQueryTitle()
  {
    return null;
  }
  
  public void applyTo(IRepositoryQuery query) {}
}

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

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

class TaskSearchPage$2
  extends SelectionAdapter
{
  TaskSearchPage$2(TaskSearchPage paramTaskSearchPage) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    TaskSearchPage.access$2(this$0, TaskSearchPage.access$1(this$0).getSelectionIndex());
  }
}

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

import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.KeyListener;

class TaskSearchPage$3
  implements KeyListener
{
  TaskSearchPage$3(TaskSearchPage paramTaskSearchPage) {}
  
  public void keyPressed(KeyEvent e) {}
  
  public void keyReleased(KeyEvent e)
  {
    TaskSearchPage.access$3(this$0);
  }
}

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

import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.search.ui.NewSearchUI;
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;

public class OpenTaskSearchAction
  extends Action
  implements IViewActionDelegate
{
  public void init(IViewPart view) {}
  
  public void run()
  {
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (window != null) {
      NewSearchUI.openSearchDialog(window, "org.eclipse.mylyn.tasks.ui.search.page");
    }
  }
  
  public void run(IAction action)
  {
    run();
  }
  
  public void selectionChanged(IAction action, ISelection selection) {}
}

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

import org.eclipse.jface.action.Action;
import org.eclipse.mylyn.internal.tasks.core.AbstractTaskCategory;

class RepositorySearchResultView$4
  extends Action
{
  RepositorySearchResultView$4(RepositorySearchResultView paramRepositorySearchResultView, AbstractTaskCategory paramAbstractTaskCategory) {}
  
  public void run()
  {
    RepositorySearchResultView.access$4(this$0, val$category);
  }
}

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

import java.text.MessageFormat;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.mylyn.internal.tasks.core.ITaskList;
import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.IRepositoryManager;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.ui.TasksUi;
import org.eclipse.mylyn.tasks.ui.TasksUiImages;
import org.eclipse.search.ui.ISearchQuery;
import org.eclipse.search.ui.NewSearchUI;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;

public class CreateQueryFromSearchAction
  extends Action
{
  private final RepositorySearchResultView resultView;
  
  public CreateQueryFromSearchAction(String text, RepositorySearchResultView resultView)
  {
    setText(text);
    setImageDescriptor(TasksUiImages.QUERY_NEW);
    this.resultView = resultView;
  }
  
  public void run()
  {
    ISelection selection = resultView.getViewer().getSelection();
    if ((selection instanceof IStructuredSelection))
    {
      IStructuredSelection structuredSelection = (IStructuredSelection)selection;
      if ((structuredSelection.getFirstElement() instanceof ITask))
      {
        ISearchQuery[] queries = NewSearchUI.getQueries();
        ITask task = (ITask)structuredSelection.getFirstElement();
        AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
          task.getConnectorKind());
        if ((queries.length != 0) && (connector != null))
        {
          SearchHitCollector searchHitCollector = (SearchHitCollector)queries[0];
          IRepositoryQuery query = searchHitCollector.getRepositoryQuery();
          InputDialog dialog = new InputDialog(PlatformUI.getWorkbench()
            .getActiveWorkbenchWindow()
            .getShell(), Messages.CreateQueryFromSearchAction_CLEAR_QUERY, MessageFormat.format(
            Messages.CreateQueryFromSearchAction_Name_of_query_to_be_added_to_the_X, new Object[] {
            TaskListView.LABEL_VIEW }) + 
            ": ", "", null);
          int dialogResult = dialog.open();
          if (dialogResult == 0)
          {
            query.setSummary(dialog.getValue());
            TasksUiInternal.getTaskList().addQuery((RepositoryQuery)query);
            TasksUiInternal.synchronizeQuery(connector, (RepositoryQuery)query, null, true);
          }
        }
      }
    }
  }
}

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

import java.util.Iterator;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.tasks.ui.TasksUiUtil;

public class OpenSearchResultAction
  extends Action
{
  private final RepositorySearchResultView resultView;
  
  public OpenSearchResultAction(String text, RepositorySearchResultView resultView)
  {
    setText(text);
    this.resultView = resultView;
  }
  
  public void run()
  {
    ISelection s = resultView.getViewer().getSelection();
    if ((s instanceof IStructuredSelection))
    {
      IStructuredSelection selection = (IStructuredSelection)s;
      for (Iterator<AbstractTask> it = selection.iterator(); it.hasNext();)
      {
        AbstractTask repositoryHit = (AbstractTask)it.next();
        TasksUiUtil.openTask(repositoryHit.getRepositoryUrl(), repositoryHit.getTaskId(), 
          repositoryHit.getUrl());
      }
    }
  }
}

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

import org.eclipse.mylyn.internal.tasks.core.ITaskList;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.search.ui.NewSearchUI;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;

public class DefaultSearchProvider
  extends AbstractSearchProvider
{
  public void openSearchDialog(IWorkbenchWindow window)
  {
    NewSearchUI.openSearchDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow(), "org.eclipse.mylyn.tasks.ui.search.page");
  }
  
  public void runSearchQuery(ITaskList tasklist, TaskRepository repository, IRepositoryQuery repositoryQuery, boolean activateResultView)
  {
    if (activateResultView) {
      NewSearchUI.activateSearchResultView();
    }
    SearchHitCollector collector = new SearchHitCollector(tasklist, repository, repositoryQuery);
    NewSearchUI.runQueryInBackground(collector);
  }
}

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

public enum SearchResultTreeContentProvider$GroupBy
{
  NONE,  OWNER,  COMPLETION;
}

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

import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.mylyn.internal.tasks.ui.dialogs.TaskCompareDialog;

public class SearchResultSortAction
  extends Action
{
  private final RepositorySearchResultView view;
  
  public SearchResultSortAction(RepositorySearchResultView view)
  {
    super(Messages.SearchResultSortAction_Sort_Label);
    this.view = view;
    setEnabled(true);
  }
  
  public void run()
  {
    TaskCompareDialog dialog = new TaskCompareDialog(view.getSite(), view.getSorter().getTaskComparator());
    if (dialog.open() == 0) {
      view.getViewer().refresh();
    }
  }
}

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

import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.internal.tasks.core.Person;
import org.eclipse.mylyn.internal.tasks.core.TaskGroup;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.ITaskContainer;

public class SearchResultTreeContentProvider
  extends SearchResultContentProvider
{
  private final Set<Object> elements = new LinkedHashSet();
  private final Map<String, Person> owners = new HashMap();
  private final Map<String, TaskGroup> completeState = new HashMap();
  private GroupBy selectedGroup;
  
  public static enum GroupBy
  {
    NONE,  OWNER,  COMPLETION;
  }
  
  public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
  {
    if ((newInput instanceof RepositorySearchResult))
    {
      searchResult = ((RepositorySearchResult)newInput);
      clear();
      elementsChanged(searchResult.getElements());
    }
    else
    {
      searchResult = null;
      clear();
    }
  }
  
  public Object[] getElements(Object inputElement)
  {
    if (inputElement == searchResult)
    {
      if (selectedGroup == GroupBy.OWNER) {
        return owners.values().toArray();
      }
      if (selectedGroup == GroupBy.COMPLETION) {
        return completeState.values().toArray();
      }
      return elements.toArray();
    }
    return EMPTY_ARR;
  }
  
  public Object[] getChildren(Object parent)
  {
    if (((parent instanceof TaskGroup)) || ((parent instanceof Person))) {
      return ((ITaskContainer)parent).getChildren().toArray();
    }
    return EMPTY_ARR;
  }
  
  public Object getParent(Object element)
  {
    return null;
  }
  
  public boolean hasChildren(Object element)
  {
    return getChildren(element).length > 0;
  }
  
  public void elementsChanged(Object[] updatedElements)
  {
    Object[] arrayOfObject1;
    int j = (arrayOfObject1 = updatedElements).length;
    for (int i = 0; i < j; i++)
    {
      Object object = arrayOfObject1[i];
      boolean inResult = false;
      Object[] resultElements = searchResult.getElements();
      Object[] arrayOfObject2;
      int m = (arrayOfObject2 = resultElements).length;
      for (int k = 0; k < m; k++)
      {
        Object resultObject = arrayOfObject2[k];
        if (resultObject.equals(object)) {
          inResult = true;
        }
      }
      if (inResult)
      {
        boolean added = elements.add(object);
        if ((added) && ((object instanceof ITask)))
        {
          AbstractTask task = (AbstractTask)object;
          String owner = task.getOwner();
          if (owner == null) {
            owner = Messages.SearchResultTreeContentProvider__unknown_;
          }
          Person person = (Person)owners.get(owner);
          if (person == null)
          {
            person = new Person(owner, task.getConnectorKind(), task.getRepositoryUrl());
            owners.put(owner, person);
          }
          person.internalAddChild(task);
          
          TaskGroup completeIncomplete = null;
          if (task.isCompleted())
          {
            completeIncomplete = (TaskGroup)completeState.get(Messages.SearchResultTreeContentProvider_Complete);
            if (completeIncomplete == null)
            {
              completeIncomplete = new TaskGroup(
                "group-complete", Messages.SearchResultTreeContentProvider_Complete, GroupBy.COMPLETION.name());
              completeState.put(Messages.SearchResultTreeContentProvider_Complete, completeIncomplete);
            }
          }
          else
          {
            completeIncomplete = (TaskGroup)completeState.get(Messages.SearchResultTreeContentProvider_Incomplete);
            if (completeIncomplete == null)
            {
              completeIncomplete = new TaskGroup(
                "group-incomplete", Messages.SearchResultTreeContentProvider_Incomplete, GroupBy.COMPLETION.name());
              completeState.put(Messages.SearchResultTreeContentProvider_Incomplete, completeIncomplete);
            }
          }
          completeIncomplete.internalAddChild(task);
        }
      }
      else if ((object instanceof ITask))
      {
        AbstractTask task = (AbstractTask)object;
        elements.remove(task);
        String owner = task.getOwner();
        if (owner == null) {
          owner = Messages.SearchResultTreeContentProvider__unknown_;
        }
        Person person = (Person)owners.get(owner);
        person.internalRemoveChild(task);
        
        TaskGroup completeIncomplete = null;
        if (task.isCompleted()) {
          completeIncomplete = (TaskGroup)completeState.get(Messages.SearchResultTreeContentProvider_Complete);
        } else {
          completeIncomplete = (TaskGroup)completeState.get(Messages.SearchResultTreeContentProvider_Incomplete);
        }
        completeIncomplete.internalRemoveChild(task);
      }
    }
  }
  
  pu
1 2 3

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-2017. Infinite Loop Ltd