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

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

public class TasksIndexUi
{
  public static final String ID_PLUGIN = "org.eclipse.mylyn.tasks.index.ui";
}

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

import org.eclipse.jface.fieldassist.IContentProposal;

class ContentProposal
  implements IContentProposal
{
  private final String content;
  private final int cursorPosition;
  private final String label;
  private final String description;
  
  public ContentProposal(String content, String label, String description)
  {
    this(content, label, description, content.length());
  }
  
  public ContentProposal(String content, String contentSuffix, String label, String description)
  {
    this(content + contentSuffix, label, description, content.length());
  }
  
  public ContentProposal(String content, String label, String description, int cursorPosition)
  {
    this.content = content;
    this.cursorPosition = cursorPosition;
    this.label = label;
    this.description = description;
  }
  
  public String getContent()
  {
    return content;
  }
  
  public int getCursorPosition()
  {
    return cursorPosition;
  }
  
  public String getLabel()
  {
    return label;
  }
  
  public String getDescription()
  {
    return description;
  }
}

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

import org.eclipse.jface.viewers.Viewer;
import org.eclipse.mylyn.commons.workbench.SubstringPatternFilter;
import org.eclipse.mylyn.internal.tasks.index.core.TaskListIndex;
import org.eclipse.mylyn.tasks.core.ITask;

public class IndexedSubstringPatternFilter
  extends SubstringPatternFilter
{
  private final TaskListIndex index;
  private String patternString;
  
  public IndexedSubstringPatternFilter(TaskListIndex index)
  {
    this.index = index;
  }
  
  public void setPattern(String patternString)
  {
    if (patternString != null) {
      patternString = patternString.trim();
    }
    this.patternString = patternString;
    super.setPattern(patternString);
  }
  
  protected boolean isLeafMatch(Viewer viewer, Object element)
  {
    if ((patternString != null) && (patternString.length() > 0) && 
      ((element instanceof ITask)))
    {
      ITask task = (ITask)element;
      if (index.matches(task, patternString)) {
        return true;
      }
    }
    return super.isLeafMatch(viewer, element);
  }
}

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

import org.eclipse.mylyn.internal.tasks.index.core.TaskListIndex;
import org.eclipse.mylyn.tasks.core.data.AbstractTaskSchema.Field;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;

class IndexSearchHandler$1
  extends SelectionAdapter
{
  IndexSearchHandler$1(IndexSearchHandler paramIndexSearchHandler, Button paramButton) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    AbstractTaskSchema.Field newDefaultField = val$button.getSelection() ? 
      TaskListIndex.FIELD_SUMMARY : 
      TaskListIndex.FIELD_CONTENT;
    IndexSearchHandler.access$0(this$0).index().setDefaultField(newDefaultField);
    IndexSearchHandler.access$1(this$0);
  }
}

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

import org.eclipse.core.runtime.jobs.Job;

class ResetIndexHandler$1
  extends Job
{
  ResetIndexHandler$1(ResetIndexHandler paramResetIndexHandler, String $anonymous0)
  {
    super($anonymous0);
  }
  
  /* Error */
  protected org.eclipse.core.runtime.IStatus run(org.eclipse.core.runtime.IProgressMonitor monitor)
  {
    // Byte code:
    //   0: new 33	org/eclipse/mylyn/internal/tasks/index/ui/IndexReference
    //   3: dup
    //   4: invokespecial 70	org/eclipse/mylyn/internal/tasks/index/ui/IndexReference:<init>	()V
    //   7: astore_2
    //   8: aload_1
    //   9: getstatic 65	org/eclipse/mylyn/internal/tasks/index/ui/commands/Messages:ResetIndexHandler_Rebuilding_Index_Progress_Label	Ljava/lang/String;
    //   12: iconst_m1
    //   13: invokeinterface 74 3 0
    //   18: aload_2
    //   19: invokevirtual 72	org/eclipse/mylyn/internal/tasks/index/ui/IndexReference:index	()Lorg/eclipse/mylyn/internal/tasks/index/core/TaskListIndex;
    //   22: astore_3
    //   23: aload_3
    //   24: invokevirtual 68	org/eclipse/mylyn/internal/tasks/index/core/TaskListIndex:reindex	()V
    //   27: aload_3
    //   28: invokevirtual 69	org/eclipse/mylyn/internal/tasks/index/core/TaskListIndex:waitUntilIdle	()V
    //   31: goto +37 -> 68
    //   34: pop
    //   35: getstatic 63	org/eclipse/core/runtime/Status:CANCEL_STATUS	Lorg/eclipse/core/runtime/IStatus;
    //   38: astore 5
    //   40: aload_2
    //   41: invokevirtual 71	org/eclipse/mylyn/internal/tasks/index/ui/IndexReference:dispose	()V
    //   44: aload_1
    //   45: invokeinterface 73 1 0
    //   50: aload 5
    //   52: areturn
    //   53: astore 4
    //   55: aload_2
    //   56: invokevirtual 71	org/eclipse/mylyn/internal/tasks/index/ui/IndexReference:dispose	()V
    //   59: aload_1
    //   60: invokeinterface 73 1 0
    //   65: aload 4
    //   67: athrow
    //   68: aload_2
    //   69: invokevirtual 71	org/eclipse/mylyn/internal/tasks/index/ui/IndexReference:dispose	()V
    //   72: aload_1
    //   73: invokeinterface 73 1 0
    //   78: getstatic 64	org/eclipse/core/runtime/Status:OK_STATUS	Lorg/eclipse/core/runtime/IStatus;
    //   81: areturn
    // Line number table:
    //   Java source line #33	-> byte code offset #0
    //   Java source line #35	-> byte code offset #8
    //   Java source line #36	-> byte code offset #12
    //   Java source line #35	-> byte code offset #13
    //   Java source line #37	-> byte code offset #18
    //   Java source line #38	-> byte code offset #23
    //   Java source line #40	-> byte code offset #27
    //   Java source line #41	-> byte code offset #34
    //   Java source line #42	-> byte code offset #35
    //   Java source line #44	-> byte code offset #40
    //   Java source line #45	-> byte code offset #44
    //   Java source line #42	-> byte code offset #50
    //   Java source line #43	-> byte code offset #53
    //   Java source line #44	-> byte code offset #55
    //   Java source line #45	-> byte code offset #59
    //   Java source line #46	-> byte code offset #65
    //   Java source line #44	-> byte code offset #68
    //   Java source line #45	-> byte code offset #72
    //   Java source line #47	-> byte code offset #78
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	82	0	this	1
    //   0	82	1	monitor	org.eclipse.core.runtime.IProgressMonitor
    //   7	62	2	reference	org.eclipse.mylyn.internal.tasks.index.ui.IndexReference
    //   22	6	3	index	org.eclipse.mylyn.internal.tasks.index.core.TaskListIndex
    //   53	13	4	localObject	Object
    //   38	13	5	localIStatus	org.eclipse.core.runtime.IStatus
    //   34	1	6	localInterruptedException	InterruptedException
    // Exception table:
    //   from	to	target	type
    //   8	31	34	java/lang/InterruptedException
    //   8	40	53	finally
  }
}

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

import org.eclipse.osgi.util.NLS;

class Messages
  extends NLS
{
  private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.tasks.index.ui.commands.messages";
  public static String ResetIndexHandler_Rebuilding_Index_Progress_Label;
  public static String ResetIndexHandler_Refresh_Index_Job_Name;
  
  static
  {
    NLS.initializeMessages("org.eclipse.mylyn.internal.tasks.index.ui.commands.messages", Messages.class);
  }
}

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

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.jobs.Job;

public class ResetIndexHandler
  extends AbstractHandler
{
  public Object execute(ExecutionEvent event)
    throws ExecutionException
  {
    Job job = new Job(Messages.ResetIndexHandler_Refresh_Index_Job_Name)
    {
      /* Error */
      protected org.eclipse.core.runtime.IStatus run(org.eclipse.core.runtime.IProgressMonitor monitor)
      {
        // Byte code:
        //   0: new 33	org/eclipse/mylyn/internal/tasks/index/ui/IndexReference
        //   3: dup
        //   4: invokespecial 70	org/eclipse/mylyn/internal/tasks/index/ui/IndexReference:<init>	()V
        //   7: astore_2
        //   8: aload_1
        //   9: getstatic 65	org/eclipse/mylyn/internal/tasks/index/ui/commands/Messages:ResetIndexHandler_Rebuilding_Index_Progress_Label	Ljava/lang/String;
        //   12: iconst_m1
        //   13: invokeinterface 74 3 0
        //   18: aload_2
        //   19: invokevirtual 72	org/eclipse/mylyn/internal/tasks/index/ui/IndexReference:index	()Lorg/eclipse/mylyn/internal/tasks/index/core/TaskListIndex;
        //   22: astore_3
        //   23: aload_3
        //   24: invokevirtual 68	org/eclipse/mylyn/internal/tasks/index/core/TaskListIndex:reindex	()V
        //   27: aload_3
        //   28: invokevirtual 69	org/eclipse/mylyn/internal/tasks/index/core/TaskListIndex:waitUntilIdle	()V
        //   31: goto +37 -> 68
        //   34: pop
        //   35: getstatic 63	org/eclipse/core/runtime/Status:CANCEL_STATUS	Lorg/eclipse/core/runtime/IStatus;
        //   38: astore 5
        //   40: aload_2
        //   41: invokevirtual 71	org/eclipse/mylyn/internal/tasks/index/ui/IndexReference:dispose	()V
        //   44: aload_1
        //   45: invokeinterface 73 1 0
        //   50: aload 5
        //   52: areturn
        //   53: astore 4
        //   55: aload_2
        //   56: invokevirtual 71	org/eclipse/mylyn/internal/tasks/index/ui/IndexReference:dispose	()V
        //   59: aload_1
        //   60: invokeinterface 73 1 0
        //   65: aload 4
        //   67: athrow
        //   68: aload_2
        //   69: invokevirtual 71	org/eclipse/mylyn/internal/tasks/index/ui/IndexReference:dispose	()V
        //   72: aload_1
        //   73: invokeinterface 73 1 0
        //   78: getstatic 64	org/eclipse/core/runtime/Status:OK_STATUS	Lorg/eclipse/core/runtime/IStatus;
        //   81: areturn
        // Line number table:
        //   Java source line #33	-> byte code offset #0
        //   Java source line #35	-> byte code offset #8
        //   Java source line #36	-> byte code offset #12
        //   Java source line #35	-> byte code offset #13
        //   Java source line #37	-> byte code offset #18
        //   Java source line #38	-> byte code offset #23
        //   Java source line #40	-> byte code offset #27
        //   Java source line #41	-> byte code offset #34
        //   Java source line #42	-> byte code offset #35
        //   Java source line #44	-> byte code offset #40
        //   Java source line #45	-> byte code offset #44
        //   Java source line #42	-> byte code offset #50
        //   Java source line #43	-> byte code offset #53
        //   Java source line #44	-> byte code offset #55
        //   Java source line #45	-> byte code offset #59
        //   Java source line #46	-> byte code offset #65
        //   Java source line #44	-> byte code offset #68
        //   Java source line #45	-> byte code offset #72
        //   Java source line #47	-> byte code offset #78
        // Local variable table:
        //   start	length	slot	name	signature
        //   0	82	0	this	1
        //   0	82	1	monitor	org.eclipse.core.runtime.IProgressMonitor
        //   7	62	2	reference	org.eclipse.mylyn.internal.tasks.index.ui.IndexReference
        //   22	6	3	index	org.eclipse.mylyn.internal.tasks.index.core.TaskListIndex
        //   53	13	4	localObject	Object
        //   38	13	5	localIStatus	org.eclipse.core.runtime.IStatus
        //   34	1	6	localInterruptedException	InterruptedException
        // Exception table:
        //   from	to	target	type
        //   8	31	34	java/lang/InterruptedException
        //   8	40	53	finally
      }
    };
    job.setSystem(true);
    job.setUser(false);
    job.setPriority(30);
    job.schedule();
    return null;
  }
}

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

import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.eclipse.jface.fieldassist.IContentProposal;
import org.eclipse.jface.fieldassist.IContentProposalProvider;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.internal.tasks.core.TaskList;
import org.eclipse.mylyn.internal.tasks.index.core.TaskListIndex;
import org.eclipse.mylyn.tasks.core.data.AbstractTaskSchema.Field;
import org.eclipse.osgi.util.NLS;

public class ContentProposalProvider
  implements IContentProposalProvider
{
  private static final Pattern PATTERN_WHITESPACE = Pattern.compile("\\s");
  private static final Pattern PATTERN_SPECIAL_CHARACTERS = Pattern.compile("([+&\\|!\\(\\)\\{\\}\\[\\]^\"~\\*\\?:\\\\-])");
  private final AbstractIndexReference reference;
  private final TaskList taskList;
  
  public ContentProposalProvider(TaskList taskList, AbstractIndexReference reference)
  {
    this.taskList = taskList;
    this.reference = reference;
  }
  
  public static class ProposalContentState
  {
    public String beforePrefixContent;
    public String fieldPrefix = "";
    public String prefix = "";
    public String suffix = "";
    
    public ProposalContentState(String contents)
    {
      beforePrefixContent = contents;
    }
  }
  
  public IContentProposal[] getProposals(String contents, int position)
  {
    List<IContentProposal> proposals = new ArrayList(10);
    
    ProposalContentState contentState = computeProposalContentState(contents, position);
    if (fieldPrefix.length() > 0)
    {
      AbstractTaskSchema.Field indexField = computeIndexField(fieldPrefix);
      if ((indexField != null) && ("person".equals(indexField.getType()))) {
        computePersonProposals(proposals, contentState);
      }
    }
    else
    {
      for (AbstractTaskSchema.Field field : reference.index().getIndexedFields()) {
        if (!field.equals(TaskListIndex.FIELD_IDENTIFIER))
        {
          String indexKey = field.getIndexKey();
          if (indexKey.startsWith(prefix))
          {
            String description;
            String description;
            if (TaskListIndex.FIELD_CONTENT.equals(field))
            {
              description = Messages.IndexSearchHandler_hint_content;
            }
            else
            {
              String description;
              if (TaskListIndex.FIELD_PERSON.equals(field)) {
                description = Messages.IndexSearchHandler_hint_person;
              } else {
                description = NLS.bind(Messages.IndexSearchHandler_hint_generic, field.getLabel());
              }
            }
            proposals.add(new ContentProposal(beforePrefixContent + indexKey + ":", 
              suffix, indexKey, description));
            if (("date".equals(field.getType())) || 
              ("dateTime".equals(field.getType()))) {
              computeDateRangeProposals(proposals, contentState, field);
            }
          }
        }
      }
    }
    return (IContentProposal[])proposals.toArray(new IContentProposal[proposals.size()]);
  }
  
  public ProposalContentState computeProposalContentState(String contents, int position)
  {
    ProposalContentState contentState = new ProposalContentState(contents);
    if ((position >= 0) && (position <= contents.length()))
    {
      int i = position;
      while ((i > 0) && (!Character.isWhitespace(contents.charAt(i - 1))) && (contents.charAt(i - 1) != ':')) {
        i--;
      }
      if ((i > 0) && (contents.charAt(i - 1) == ':'))
      {
        int fieldEnd = i - 1;
        int fieldStart = i - 1;
        while ((fieldStart > 0) && (Character.isLetter(contents.charAt(fieldStart - 1)))) {
          fieldStart--;
        }
        fieldPrefix = contents.substring(fieldStart, fieldEnd);
      }
      prefix = contents.substring(i, position);
      beforePrefixContent = contents.substring(0, i);
      if (position < contents.length())
      {
        i = position;
        while (i < contents.length())
        {
          if (Character.isWhitespace(contents.charAt(i))) {
            break;
          }
          i++;
        }
        suffix = contents.substring(i);
      }
    }
    return contentState;
  }
  
  public AbstractTaskSchema.Field computeIndexField(String fieldPrefix)
  {
    for (AbstractTaskSchema.Field field : reference.index().getIndexedFields()) {
      if (field.getIndexKey().equals(fieldPrefix)) {
        return field;
      }
    }
    return null;
  }
  
  public void computeDateRangeProposals(List<IContentProposal> proposals, ProposalContentState contentState, AbstractTaskSchema.Field field)
  {
    Date now = new Date();
    
    GregorianCalendar calendar = new GregorianCalendar();
    
    calendar.setTime(now);
    calendar.add(7, 1);
    Date dateSearchUpperBound = calendar.getTime();
    
    calendar.setTime(now);
    calendar.add(7, -7);
    Date dateSearchOneWeekLowerBound = calendar.getTime();
    
    String description = NLS.bind(Messages.IndexSearchHandler_Generic_date_range_search_1_week, field.getLabel());
    
    String label = NLS.bind(Messages.IndexSearchHandler_Past_week_date_range_label, field.getIndexKey());
    
    String queryText = reference.index().computeQueryFieldDateRange(field, dateSearchOneWeekLowerBound, 
      dateSearchUpperBound);
    if (queryText.startsWith(prefix)) {
      proposals.add(new ContentProposal(beforePrefixContent + queryText, suffix, label, 
        description));
    }
  }
  
  public void computePersonProposals(List<IContentProposal> proposals, ProposalContentState contentState)
  {
    Set<String> addresses = new TreeSet();
    
    Collection<AbstractTask> allTasks = taskList.getAllTasks();
    for (AbstractTask task : allTasks) {
      addAddresses(addresses, task);
    }
    for (String address : addresses) {
      if (address.startsWith(prefix))
      {
        String proposalContent = address;
        proposalContent = PATTERN_SPECIAL_CHARACTERS.matcher(proposalContent).replaceAll("\\\\$1");
        if (PATTERN_WHITESPACE.matcher(proposalContent).find()) {
          proposalContent = "\"" + proposalContent + "\"";
        }
        proposals.add(new ContentProposal(beforePrefixContent + proposalContent, 
          suffix, address, null));
      }
    }
  }
  
  private void addAddresses(Set<String> addresses, AbstractTask task)
  {
    String name = task.getOwner();
    if ((name != null) && (name.trim().length() > 0)) {
      addresses.add(name.trim());
    }
  }
}

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

import java.io.File;
import java.util.concurrent.atomic.AtomicInteger;
import org.eclipse.mylyn.internal.tasks.core.IRepositoryModelListener;
import org.eclipse.mylyn.internal.tasks.index.core.TaskListIndex;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.tasks.core.IRepositoryManager;

public class IndexReference
  extends AbstractIndexReference
{
  private static TaskListIndex theIndex;
  private static AtomicInteger referenceCount = new AtomicInteger();
  private static IRepositoryModelListener listener = new IRepositoryModelListener()
  {
    public void loaded()
    {
      synchronized (IndexReference.class)
      {
        if (IndexReference.theIndex != null) {
          IndexReference.theIndex.setLocation(IndexReference.getDefaultIndexLocation());
        }
      }
    }
  };
  private TaskListIndex index;
  
  static File getDefaultIndexLocation()
  {
    return new File(TasksUiPlugin.getDefault().getDataDirectory(), ".taskListIndex");
  }
  
  public TaskListIndex index()
  {
    synchronized (IndexReference.class)
    {
      if (index == null)
      {
        if (theIndex == null)
        {
          IRepositoryManager repositoryManager = TasksUiPlugin.getRepositoryManager();
          theIndex = new TaskListIndex(TasksUiPlugin.getTaskList(), TasksUiPlugin.getTaskDataManager(), 
            repositoryManager, getDefaultIndexLocation());
          TasksUiPlugin.getDefault().addModelListener(listener);
        }
        index = theIndex;
        referenceCount.incrementAndGet();
      }
    }
    return index;
  }
  
  public void dispose()
  {
    synchronized (IndexReference.class)
    {
      if (index != null)
      {
        index = null;
        if (referenceCount.decrementAndGet() == 0)
        {
          TasksUiPlugin.getDefault().removeModelListener(listener);
          theIndex.close();
          theIndex = null;
        }
      }
    }
  }
}

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

import org.eclipse.swt.widgets.Text;

class IndexSearchHandler$2
  implements Runnable
{
  IndexSearchHandler$2(IndexSearchHandler paramIndexSearchHandler, Text paramText) {}
  
  public void run()
  {
    if (!val$textControl.isDisposed()) {
      IndexSearchHandler.access$2(this$0, val$textControl);
    }
  }
}

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

import java.lang.reflect.Method;
import org.eclipse.jface.fieldassist.ContentProposalAdapter;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.ui.fieldassist.ContentAssistCommandAdapter;

class IndexSearchHandler$3
  implements Listener
{
  IndexSearchHandler$3(IndexSearchHandler paramIndexSearchHandler, ContentAssistCommandAdapter paramContentAssistCommandAdapter, Listener paramListener) {}
  
  public void handleEvent(Event event)
  {
    boolean popupOpen = false;
    try
    {
      Method method = ContentProposalAdapter.class.getDeclaredMethod("isProposalPopupOpen", new Class[0]);
      popupOpen = ((Boolean)method.invoke(val$adapter, new Object[0])).booleanValue();
    }
    catch (Exception localException) {}
    if (!popupOpen) {
      val$listener.handleEvent(event);
    }
  }
}

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

import org.eclipse.mylyn.internal.tasks.index.core.TaskListIndex;

public abstract class AbstractIndexReference
{
  public abstract TaskListIndex index();
}

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

import org.eclipse.mylyn.internal.tasks.core.IRepositoryModelListener;
import org.eclipse.mylyn.internal.tasks.index.core.TaskListIndex;

class IndexReference$1
  implements IRepositoryModelListener
{
  public void loaded()
  {
    synchronized (IndexReference.class)
    {
      if (IndexReference.access$0() != null) {
        IndexReference.access$0().setLocation(IndexReference.getDefaultIndexLocation());
      }
    }
  }
}

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

import org.eclipse.osgi.util.NLS;

class Messages
  extends NLS
{
  private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.tasks.index.ui.messages";
  public static String IndexSearchHandler_Generic_date_range_search_1_week;
  public static String IndexSearchHandler_hint_content;
  public static String IndexSearchHandler_hint_generic;
  public static String IndexSearchHandler_hint_person;
  public static String IndexSearchHandler_Past_week_date_range_label;
  public static String IndexSearchHandler_summaryOnly;
  public static String IndexSearchHandler_summaryOnly_tooltip;
  
  static
  {
    NLS.initializeMessages("org.eclipse.mylyn.internal.tasks.index.ui.messages", Messages.class);
  }
}

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

public class ContentProposalProvider$ProposalContentState
{
  public String beforePrefixContent;
  public String fieldPrefix = "";
  public String prefix = "";
  public String suffix = "";
  
  public ContentProposalProvider$ProposalContentState(String contents)
  {
    beforePrefixContent = contents;
  }
}

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

import java.lang.reflect.Method;
import org.eclipse.jface.fieldassist.ContentProposalAdapter;
import org.eclipse.jface.fieldassist.IContentProposalProvider;
import org.eclipse.jface.fieldassist.TextContentAdapter;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.mylyn.internal.tasks.index.core.TaskListIndex;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.search.AbstractSearchHandler;
import org.eclipse.mylyn.tasks.core.data.AbstractTaskSchema.Field;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.TypedListener;
import org.eclipse.ui.dialogs.PatternFilter;
import org.eclipse.ui.fieldassist.ContentAssistCommandAdapter;

public class IndexSearchHandler
  extends AbstractSearchHandler
{
  private IndexReference reference;
  
  public IndexSearchHandler()
  {
    reference = new IndexReference();
  }
  
  public Composite createSearchComposite(Composite parent)
  {
    Composite container = new Composite(parent, 0);
    GridLayoutFactory.swtDefaults().applyTo(container);
    
    final Button button = new Button(container, 32);
    button.setText(Messages.IndexSearchHandler_summaryOnly);
    button.setToolTipText(Messages.IndexSearchHandler_summaryOnly_tooltip);
    button.setSelection(true);
    
    button.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        AbstractTaskSchema.Field newDefaultField = button.getSelection() ? 
          TaskListIndex.FIELD_SUMMARY : 
          TaskListIndex.FIELD_CONTENT;
        reference.index().setDefaultField(newDefaultField);
        fireFilterChanged();
      }
    });
    return container;
  }
  
  public PatternFilter createFilter()
  {
    return new IndexedSubstringPatternFilter(reference.index());
  }
  
  public void adaptTextSearchControl(final Text textControl)
  {
    if ((textControl.getParent().getLayout() instanceof GridLayout)) {
      getParentgetLayoutmarginLeft = 6;
    }
    textControl.getDisplay().asyncExec(new Runnable()
    {
      public void run()
      {
        if (!textControl.isDisposed()) {
          IndexSearchHandler.this.adaptTextSearchControlInternal(textControl);
        }
      }
    });
  }
  
  private void adaptTextSearchControlInternal(Text textControl)
  {
    IContentProposalProvider proposalProvider = new ContentProposalProvider(TasksUiPlugin.getTaskList(), reference);
    final ContentAssistCommandAdapter adapter = new ContentAssistCommandAdapter(textControl, 
      new TextContentAdapter(), proposalProvider, null, new char[0], true);
    adapter.setProposalAcceptanceStyle(2);
    
    Listener[] traverseListeners = textControl.getListeners(31);
    Listener[] arrayOfListener1;
    int j = (arrayOfListener1 = traverseListeners).length;
    for (int i = 0; i < j; i++)
    {
      final Listener listener = arrayOfListener1[i];
      if (listener.getClass() == TypedListener.class)
      {
        textControl.removeListener(31, listener);
        textControl.addListener(31, new Listener()
        {
          public void handleEvent(Event event)
          {
            boolean popupOpen = false;
            try
            {
              Method method = ContentProposalAdapter.class.getDeclaredMethod("isProposalPopupOpen", new Class[0]);
              popupOpen = ((Boolean)method.invoke(adapter, new Object[0])).booleanValue();
            }
            catch (Exception localException) {}
            if (!popupOpen) {
              listener.handleEvent(event);
            }
          }
        });
      }
    }
  }
  
  public void dispose()
  {
    reference.dispose();
    reference = null;
  }
}

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

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