org.eclipse.wst.common.core_1.2.0.v200908252030

16:48:47.772 INFO  jd.cli.Main - Decompiling org.eclipse.wst.common.core_1.2.0.v200908252030.jar
package org.eclipse.wst.common.core.search;

public abstract interface ISearchOptions
{
  public static final String PRIORITY_OPTION = "org.eclipse.wst.common.core.search.PRIORITY";
  public static final String PRIORITY_VALUE_TIMELINESS = "FAST_SEARCH";
  public static final String PRIORITY_VALUE_COMPLETENESS = "COMPLETE_SEARCH";
  public static final String PRIORITY_VALUE_DEFAULT = "FAST_SEARCH";
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.core.search.ISearchOptions
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.core.search;

import java.util.Map;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.wst.common.core.search.document.SearchDocumentSet;
import org.eclipse.wst.common.core.search.internal.Messages;
import org.eclipse.wst.common.core.search.internal.SearchDocumentSetImpl;
import org.eclipse.wst.common.core.search.pattern.SearchPattern;
import org.eclipse.wst.common.core.search.scope.SearchScope;

public class SearchEngine
  implements ISearchOptions
{
  public void search(SearchPattern pattern, SearchRequestor requestor, SearchParticipant[] participants, SearchScope scope, Map searchOptions, IProgressMonitor monitor)
    throws CoreException
  {
    if ((monitor != null) && (monitor.isCanceled())) {
      throw new OperationCanceledException();
    }
    if (monitor != null) {
      monitor.beginTask(Messages.engine_searching, 100);
    }
    SearchDocumentSet set = new SearchDocumentSetImpl();
    try
    {
      SearchScope[] scopeArray = new SearchScope[participants.length];
      int i = 0;
      SearchScope newScope;
      for (int l = participants == null ? 0 : participants.length; i < l; i++)
      {
        if ((monitor != null) && (monitor.isCanceled())) {
          throw new OperationCanceledException();
        }
        SearchParticipant participant = participants[i];
        SubProgressMonitor subMonitor = monitor == null ? null : 
          new SubProgressMonitor(monitor, 1000);
        if (subMonitor != null) {
          subMonitor.beginTask("", 1000);
        }
        try
        {
          if (subMonitor != null) {
            subMonitor.subTask(Messages.bind(
              Messages.engine_searching_locatingDocuments, 
              
              new String[] { participant.getDescription() }));
          }
          participant.beginSearching(pattern, searchOptions);
          
          newScope = 
            participant.selectDocumentLocations(pattern, scope, searchOptions, monitor);
          scopeArray[i] = newScope;
          
          participant.createSearchDocuments(set, pattern, newScope, searchOptions, subMonitor);
        }
        catch (Exception localException1) {}
      }
      int i = 0;
      for (int l = participants == null ? 0 : participants.length; i < l; i++)
      {
        if ((monitor != null) && (monitor.isCanceled())) {
          throw new OperationCanceledException();
        }
        SearchParticipant participant = participants[i];
        SubProgressMonitor subMonitor = monitor == null ? null : 
          new SubProgressMonitor(monitor, 1000);
        if ((subMonitor != null) && (subMonitor.isCanceled())) {
          throw new OperationCanceledException();
        }
        try
        {
          if (subMonitor != null) {
            subMonitor.subTask(Messages.bind(
              Messages.engine_searching_matching, 
              
              new String[] { participant.getDescription() }));
          }
          if (scopeArray[i] != null) {
            participant.locateMatches(set, pattern, scopeArray[i], requestor, searchOptions, subMonitor);
          }
        }
        catch (Exception localException2) {}finally
        {
          participant.doneSearching(pattern, searchOptions);
        }
      }
    }
    finally
    {
      set.dispose();
      if (monitor != null) {
        monitor.done();
      }
    }
  }
  
  public void search(SearchPattern pattern, SearchRequestor requestor, SearchScope scope, Map searchOptions, IProgressMonitor monitor)
    throws CoreException
  {
    SearchParticipant[] participants = 
      getApplicableParticipants(pattern, searchOptions);
    
    search(pattern, requestor, participants, scope, searchOptions, monitor);
  }
  
  public SearchParticipant[] getApplicableParticipants(SearchPattern pattern, Map searchOptions)
  {
    return SearchPlugin.getDefault().loadSearchParticipants(pattern, searchOptions);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.core.search.SearchEngine
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.core.search;

import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IAdapterManager;
import org.eclipse.core.runtime.Platform;

public class SearchMatch
  implements IAdaptable
{
  IFile file;
  int offset;
  int length;
  Object object;
  
  public SearchMatch(Object element, int offset, int length, IFile resource)
  {
    object = element;
    this.offset = offset;
    this.length = length;
    file = resource;
  }
  
  public IFile getFile()
  {
    return file;
  }
  
  public void setFile(IFile file)
  {
    this.file = file;
  }
  
  public int getLength()
  {
    return length;
  }
  
  public void setLength(int length)
  {
    this.length = length;
  }
  
  public Object getObject()
  {
    return object;
  }
  
  public void setObject(Object object)
  {
    this.object = object;
  }
  
  public int getOffset()
  {
    return offset;
  }
  
  public void setOffset(int offset)
  {
    this.offset = offset;
  }
  
  public Object getAdapter(Class adapter)
  {
    return Platform.getAdapterManager().getAdapter(this, adapter);
  }
  
  public Map map = new HashMap();
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.core.search.SearchMatch
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.core.search;

import java.util.Map;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.wst.common.core.search.document.SearchDocument;
import org.eclipse.wst.common.core.search.document.SearchDocumentSet;
import org.eclipse.wst.common.core.search.pattern.SearchPattern;
import org.eclipse.wst.common.core.search.scope.SearchScope;

public abstract class SearchParticipant
  implements ISearchOptions
{
  protected static final boolean debugPerf = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.common.core/perf"));
  protected String id;
  
  public abstract boolean isApplicable(SearchPattern paramSearchPattern, Map paramMap);
  
  public void beginSearching(SearchPattern pattern, Map searchOptions) {}
  
  public void doneSearching(SearchPattern pattern, Map searchOptions) {}
  
  public String getDescription()
  {
    return "Search participant";
  }
  
  public abstract SearchDocument createSearchDocument(String paramString);
  
  public abstract void locateMatches(SearchDocumentSet paramSearchDocumentSet, SearchPattern paramSearchPattern, SearchScope paramSearchScope, SearchRequestor paramSearchRequestor, Map paramMap, IProgressMonitor paramIProgressMonitor)
    throws CoreException;
  
  public abstract void populateSearchDocument(SearchDocument paramSearchDocument, SearchPattern paramSearchPattern);
  
  public SearchScope selectDocumentLocations(SearchPattern pattern, SearchScope scope, Map searchOptions, IProgressMonitor monitor)
  {
    return scope;
  }
  
  public void createSearchDocuments(SearchDocumentSet documentSet, SearchPattern pattern, SearchScope scope, Map searchOptions, IProgressMonitor monitor)
  {
    Assert.isNotNull(id, "The SearchPartipants id has not been initalized");
    IFile[] files = scope.enclosingFiles();
    for (int i = 0; i < files.length; i++)
    {
      String location = files[i].getLocation().toString();
      SearchDocument document = documentSet.getSearchDocument(location, id);
      if ((document == null) && (id != null)) {
        documentSet.putSearchDocument(id, document = createSearchDocument(location));
      }
      populateSearchDocument(document, pattern);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.core.search.SearchParticipant
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.core.search;

import java.util.Map;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
import org.eclipse.wst.common.core.search.internal.SearchParticipantRegistry;
import org.eclipse.wst.common.core.search.internal.SearchParticipantRegistryReader;
import org.eclipse.wst.common.core.search.pattern.SearchPattern;
import org.osgi.framework.BundleContext;

public class SearchPlugin
  extends Plugin
  implements ISearchOptions
{
  public static final String PLUGIN_ID = "org.eclipse.wst.common.core";
  public static final String UI_CONTEXT_EXTENSION_POINT = "uiContextSensitiveClass";
  public static final String UI_TESTER_EXTENSION_POINT = "uiTester";
  private SearchParticipantRegistry searchParticipantRegistry;
  private static SearchPlugin plugin;
  
  public SearchPlugin()
  {
    plugin = this;
  }
  
  public void start(BundleContext context)
    throws Exception
  {
    super.start(context);
  }
  
  public void stop(BundleContext context)
    throws Exception
  {
    super.stop(context);
    plugin = null;
  }
  
  public static SearchPlugin getDefault()
  {
    return plugin;
  }
  
  private SearchParticipantRegistry getSearchParticipantRegistry()
  {
    if (searchParticipantRegistry == null)
    {
      searchParticipantRegistry = new SearchParticipantRegistry();
      new SearchParticipantRegistryReader(searchParticipantRegistry)
        .readRegistry();
    }
    return searchParticipantRegistry;
  }
  
  public SearchParticipant getSearchParticipant(String id)
  {
    return getSearchParticipantRegistry().getSearchParticipant(id);
  }
  
  SearchParticipant[] loadSearchParticipants(SearchPattern pattern, Map searchOptions)
  {
    return getSearchParticipantRegistry().getParticipants(pattern, searchOptions);
  }
  
  public static IStatus createStatus(int severity, String message, Throwable exception)
  {
    return new Status(severity, "org.eclipse.wst.common.core", message, exception);
  }
  
  public static IStatus createStatus(int severity, String message)
  {
    return createStatus(severity, message, null);
  }
  
  public static void logError(Throwable exception)
  {
    Platform.getLog(Platform.getBundle("org.eclipse.wst.common.core")).log(createStatus(4, exception.getMessage(), exception));
  }
  
  public static void logError(CoreException exception)
  {
    Platform.getLog(Platform.getBundle("org.eclipse.wst.common.core")).log(exception.getStatus());
  }
  
  public static void logWarning(String message)
  {
    Platform.getLog(Platform.getBundle("org.eclipse.wst.common.core")).log(createStatus(2, message));
  }
  
  public static void logWarning(Throwable exception)
  {
    Platform.getLog(Platform.getBundle("org.eclipse.wst.common.core")).log(createStatus(2, exception.getMessage(), exception));
  }
  
  public static void logError(String message)
  {
    Platform.getLog(Platform.getBundle("org.eclipse.wst.common.core")).log(createStatus(4, message));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.core.search.SearchPlugin
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.core.search;

import org.eclipse.core.runtime.CoreException;

public abstract class SearchRequestor
{
  public abstract void acceptSearchMatch(SearchMatch paramSearchMatch)
    throws CoreException;
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.core.search.SearchRequestor
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.core.search.document;

import org.eclipse.wst.common.core.search.pattern.QualifiedName;

public class ComponentDeclarationEntry
  extends Entry
{
  QualifiedName metaName;
  QualifiedName name;
  
  public QualifiedName getName()
  {
    return name;
  }
  
  public void setName(QualifiedName name)
  {
    this.name = name;
  }
  
  public QualifiedName getMetaName()
  {
    return metaName;
  }
  
  public void setMetaName(QualifiedName metaName)
  {
    this.metaName = metaName;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.core.search.document.ComponentDeclarationEntry
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.core.search.document;

import org.eclipse.wst.common.core.search.pattern.QualifiedName;

public class ComponentReferenceEntry
  extends Entry
{
  QualifiedName name;
  
  public QualifiedName getName()
  {
    return name;
  }
  
  public void setName(QualifiedName name)
  {
    this.name = name;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.core.search.document.ComponentReferenceEntry
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.core.search.document;

public class Entry
{
  String key;
  String category;
  
  public String getCategory()
  {
    return category;
  }
  
  public String getKey()
  {
    return key;
  }
  
  public void setCategory(String category)
  {
    this.category = category;
  }
  
  public void setKey(String key)
  {
    this.key = key;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.core.search.document.Entry
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.core.search.document;

public class FileReferenceEntry
  extends Entry
{
  String relativeFilePath;
  String resolvedURI;
  String publicIdentifier;
  
  public String getPublicIdentifier()
  {
    return publicIdentifier;
  }
  
  public void setPublicIdentifier(String publicIdentifier)
  {
    this.publicIdentifier = publicIdentifier;
  }
  
  public String getRelativeFilePath()
  {
    return relativeFilePath;
  }
  
  public void setRelativeFilePath(String relativeFilePath)
  {
    this.relativeFilePath = relativeFilePath;
  }
  
  public String getResolvedURI()
  {
    return resolvedURI;
  }
  
  public void setResolvedURI(String resolvedURI)
  {
    this.resolvedURI = resolvedURI;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.core.search.document.FileReferenceEntry
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.core.search.document;

import org.eclipse.wst.common.core.search.SearchParticipant;

public abstract class SearchDocument
{
  private String documentPath;
  private SearchParticipant participant;
  
  protected SearchDocument(String documentPath, SearchParticipant participant)
  {
    this.documentPath = documentPath;
    this.participant = participant;
  }
  
  public abstract Entry[] getEntries(String paramString1, String paramString2, int paramInt);
  
  public abstract Object getModel();
  
  public final SearchParticipant getParticipant()
  {
    return participant;
  }
  
  public final String getPath()
  {
    return documentPath;
  }
  
  public abstract void putEntry(Entry paramEntry);
  
  public void dispose() {}
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.core.search.document.SearchDocument
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.core.search.document;

public abstract class SearchDocumentSet
{
  public abstract SearchDocument getSearchDocument(String paramString1, String paramString2);
  
  public abstract SearchDocument[] getSearchDocuments(String paramString);
  
  public abstract void putSearchDocument(String paramString, SearchDocument paramSearchDocument);
  
  public abstract SearchDocument _tempGetSearchDocumetn(String paramString);
  
  public abstract void dispose();
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.core.search.document.SearchDocumentSet
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.core.search.internal;

import org.eclipse.osgi.util.NLS;

public class Messages
  extends NLS
{
  private static final String BUNDLE_NAME = "org.eclipse.wst.common.core.search.internal.messages";
  public static String engine_searching;
  public static String engine_searching_locatingDocuments;
  public static String engine_searching_matching;
  
  static
  {
    NLS.initializeMessages("org.eclipse.wst.common.core.search.internal.messages", Messages.class);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.core.search.internal.Messages
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.core.search.internal;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.eclipse.wst.common.core.search.document.SearchDocument;
import org.eclipse.wst.common.core.search.document.SearchDocumentSet;

public class SearchDocumentSetImpl
  extends SearchDocumentSet
{
  public Map documentPathMap = new HashMap();
  Map documentMap = new HashMap();
  
  public SearchDocument _tempGetSearchDocumetn(String resourcePath)
  {
    return (SearchDocument)documentPathMap.get(resourcePath);
  }
  
  public SearchDocument getSearchDocument(String resourcePath, String participantId)
  {
    if (resourcePath == null) {
      return null;
    }
    SearchDocument[] documents = getSearchDocuments(participantId);
    for (int i = 0; i < documents.length; i++)
    {
      SearchDocument document = documents[i];
      if (resourcePath.equals(document.getPath())) {
        return document;
      }
    }
    return null;
  }
  
  public SearchDocument[] getSearchDocuments(String participantId)
  {
    Object object = documentMap.get(participantId);
    List documentList = null;
    if ((object instanceof List)) {
      documentList = (List)object;
    } else {
      documentMap.put(participantId, documentList = new ArrayList());
    }
    return (SearchDocument[])documentList.toArray(new SearchDocument[documentList.size()]);
  }
  
  public void putSearchDocument(String participantId, SearchDocument document)
  {
    Object object = documentMap.get(participantId);
    List documentList = null;
    if ((object instanceof List)) {
      documentList = (List)object;
    } else {
      documentMap.put(participantId, documentList = new ArrayList());
    }
    documentList.add(document);
    documentPathMap.put(document.getPath(), document);
  }
  
  public void dispose()
  {
    try
    {
      for (Iterator i = documentMap.values().iterator(); i.hasNext();)
      {
        Object o = i.next();
        if ((o instanceof List)) {
          for (Iterator j = ((List)o).iterator(); j.hasNext();)
          {
            Object o2 = j.next();
            if ((o2 instanceof SearchDocument))
            {
              SearchDocument searchDocument = (SearchDocument)o2;
              searchDocument.dispose();
            }
          }
        }
      }
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.core.search.internal.SearchDocumentSetImpl
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.core.search.internal;

import org.eclipse.core.expressions.EvaluationResult;
import org.eclipse.core.expressions.Expression;
import org.eclipse.core.expressions.ExpressionConverter;
import org.eclipse.core.expressions.IEvaluationContext;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.wst.common.core.search.SearchParticipant;

public class SearchParticipantDescriptor
{
  private IConfigurationElement fElement;
  private SearchParticipant participant;
  
  public SearchParticipantDescriptor(IConfigurationElement element)
  {
    fElement = element;
  }
  
  public SearchParticipant getSearchParticipant()
  {
    if (participant == null) {
      try
      {
        participant = 
          ((SearchParticipant)fElement.createExecutableExtension("class"));
      }
      catch (Exception localException) {}
    }
    return participant;
  }
  
  public boolean matches(IEvaluationContext context)
    throws CoreException
  {
    IConfigurationElement[] elements = fElement
      .getChildren("enablement");
    if (elements.length == 0) {
      return false;
    }
    Assert.isTrue(elements.length == 1);
    Expression exp = ExpressionConverter.getDefault().perform(elements[0]);
    return convert(exp.evaluate(context));
  }
  
  private boolean convert(EvaluationResult eval)
  {
    if (eval == EvaluationResult.FALSE) {
      return false;
    }
    return true;
  }
  
  /**
   * @deprecated
   */
  public String[] getSupportedContentTypes()
  {
    return new String[0];
  }
  
  /**
   * @deprecated
   */
  public void addSupportedContentTypeId(String contentTypeId) {}
  
  public String getElementId()
  {
    return fElement.getAttribute("id");
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.core.search.internal.SearchParticipantDescriptor
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.core.search.internal;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.core.expressions.EvaluationContext;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.wst.common.core.search.SearchParticipant;
import org.eclipse.wst.common.core.search.pattern.SearchPattern;

public class SearchParticipantRegistry
{
  protected Map idMap = new HashMap();
  
  public void putSearchParticipant(String id, SearchParticipantDescriptor searchParticipantDescriptor)
  {
    idMap.put(id, searchParticipantDescriptor);
  }
  
  public String[] getSearchParticipantIds()
  {
    Set ids = idMap.keySet();
    return (String[])ids.toArray(new String[ids.size()]);
  }
  
  public Collection getSearchParticipants()
  {
    return idMap.values();
  }
  
  public SearchParticipant getSearchParticipant(String id)
  {
    SearchParticipantDescriptor searchParticipantDescriptor = null;
    if (id != null) {
      searchParticipantDescriptor = (SearchParticipantDescriptor)idMap
        .get(id);
    }
    return searchParticipantDescriptor != null ? searchParticipantDescriptor
      .getSearchParticipant() : 
      null;
  }
  
  public SearchParticipant[] getParticipants(SearchPattern pattern, Map searchOptions)
  {
    EvaluationContext evalContext = createEvaluationContext(pattern);
    List result = new ArrayList();
    Iterator iter = getSearchParticipants().iterator();
    break label146;
    for (;;)
    {
      SearchParticipantDescriptor descriptor = (SearchParticipantDescriptor)iter
        .next();
      try
      {
        if (descriptor.matches(evalContext)) {
          try
          {
            SearchParticipant participant = descriptor
              .getSearchParticipant();
            if (!SearchParticipant.class.isInstance(participant)) {
              throw new ClassCastException();
            }
            if (participant.isApplicable(pattern, searchOptions)) {
              result.add(participant);
            }
          }
          catch (ClassCastException localClassCastException)
          {
            iter.remove();
          }
        }
        if (iter.hasNext()) {}
      }
      catch (CoreException localCoreException)
      {
        iter.remove();
      }
    }
    label146:
    return (SearchParticipant[])result
      .toArray(new SearchParticipant[result.size()]);
  }
  
  private static EvaluationContext createEvaluationContext(SearchPattern pattern)
  {
    EvaluationContext result = new EvaluationContext(null, pattern);
    result.addVariable("pattern", pattern);
    return result;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.core.search.internal.SearchParticipantRegistry
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.core.search.internal;

import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;

public class SearchParticipantRegistryReader
{
  protected static final String EXTENSION_POINT_ID = "searchParticipants";
  protected static final String TAG_NAME = "searchParticipant";
  protected static final String ATT_CLASS = "class";
  protected static final String ATT_ID = "id";
  protected String pluginId;
  protected String extensionPointId;
  protected SearchParticipantRegistry registry;
  
  public SearchParticipantRegistryReader(SearchParticipantRegistry registry)
  {
    this.registry = registry;
  }
  
  public void readRegistry()
  {
    String bundleid = "org.eclipse.wst.common.core";
    IExtensionPoint point = Platform.getExtensionRegistry()
      .getExtensionPoint(bundleid, "searchParticipants");
    if (point != null)
    {
      IConfigurationElement[] elements = point.getConfigurationElements();
      for (int i = 0; i < elements.length; i++) {
        readElement(elements[i]);
      }
    }
  }
  
  protected void readElement(IConfigurationElement element)
  {
    if (element.getName().equals("searchParticipant"))
    {
      String contributorClass = element.getAttribute("class");
      String id = element.getAttribute("id");
      if (id != null) {
        if (contributorClass != null)
        {
          SearchParticipantDescriptor descriptor = new SearchParticipantDescriptor(
            element);
          registry.putSearchParticipant(id, descriptor);
        }
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.core.search.internal.SearchParticipantRegistryReader
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.core.search.pattern;

public class ComponentDeclarationPattern
  extends ComponentSearchPattern
{
  public ComponentDeclarationPattern(QualifiedName name, QualifiedName metaName, int matchRule)
  {
    super(null, name, metaName, matchRule);
  }
  
  public ComponentDeclarationPattern(QualifiedName name, QualifiedName metaName)
  {
    super(null, name, metaName);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.core.search.pattern.ComponentDeclarationPattern
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.core.search.pattern;

import org.eclipse.core.resources.IFile;

public class ComponentReferencePattern
  extends ComponentSearchPattern
{
  public ComponentReferencePattern(IFile file, QualifiedName elementQName, QualifiedName typeQName, int matchRule)
  {
    super(file, elementQName, typeQName, matchRule);
  }
  
  public ComponentReferencePattern(IFile file, QualifiedName elementQName, QualifiedName typeQName)
  {
    super(file, elementQName, typeQName);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.core.search.pattern.ComponentReferencePattern
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.core.search.pattern;

import org.eclipse.core.resources.IFile;

public abstract class ComponentSearchPattern
  extends SearchPattern
{
  QualifiedName name;
  QualifiedName metaName;
  IFile file;
  
  public ComponentSearchPattern(IFile file, QualifiedName elementQName, QualifiedName typeQName, int matchRule)
  {
    super(matchRule);
    this.file = file;
    name = elementQName;
    metaName = typeQName;
  }
  
  public ComponentSearchPattern(IFile file, QualifiedName elementQName, QualifiedName typeQName)
  {
    this.file = file;
    name = elementQName;
    metaName = typeQName;
  }
  
  public IFile getFile()
  {
    return file;
  }
  
  public QualifiedName getMetaName()
  {
    return metaName;
  }
  
  public QualifiedName getName()
  {
    return name;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.core.search.pattern.ComponentSearchPattern
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.core.search.pattern;

import org.eclipse.core.resources.IFile;

public class FileReferencePattern
  extends SearchPattern
{
  IFile file;
  
  public FileReferencePattern(IFile file)
  {
    this.file = file;
  }
  
  public FileReferencePattern(IFile file, int matchRule)
  {
    super(matchRule);
    this.file = file;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.core.search.pattern.FileReferencePattern
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.core.search.pattern;

public class QualifiedName
{
  private String qualifier;
  private String name;
  private static final String NS_DELIM_1 = "{";
  private static final String NS_DELIM_2 = "}";
  
  public QualifiedName(String namespace, String localName)
  {
    qualifier = namespace;
    if ((namespace != null) && (namespace.length() == 0)) {
      qualifier = null;
    }
    if ((qualifier != null) && (qualifier.length() == 0)) {
      qualifier = null;
    }
    name = localName;
    if ((localName != null) && (localName.length() == 0)) {
      name = null;
    }
  }
  
  public String getNamespace()
  {
    return qualifier;
  }
  
  public String getLocalName()
  {
    return name;
  }
  
  public boolean equals(Object obj)
  {
    boolean isEqual = false;
    if (this == obj)
    {
      isEqual = true;
    }
    else if ((obj instanceof QualifiedName))
    {
      QualifiedName that = (QualifiedName)obj;
      isEqual = (isMatch(getNamespace(), that.getNamespace())) && 
        (isMatch(getLocalName(), that.getLocalName()));
    }
    return isEqual;
  }
  
  protected boolean isMatch(String a, String b)
  {
    return a == b ? true : a != null ? a.equals(b) : false;
  }
  
  public int hashCode()
  {
    int hash = 0;
    if (qualifier != null) {
      hash += qualifier.hashCode();
    }
    if (name != null) {
      hash += name.hashCode();
    }
    return hash;
  }
  
  public String toString()
  {
    return appendStrings(
      new String[] { "{", 
      qualifier, "}", 
      name });
  }
  
  public static QualifiedName valueOf(String qnameString)
    throws IllegalArgumentException
  {
    String namespace = null;
    String localName = null;
    if ((qnameString != null) && (qnameString.length() != 0)) {
      if (qnameString.startsWith("{"))
      {
        int index = qnameString.indexOf("}");
        if (index == -1) {
          throw new IllegalArgumentException(
            "qnameString = " + qnameString);
        }
        namespace = qnameString.substring(1, index);
        localName = qnameString.substring(index + 1);
      }
      else
      {
        localName = qnameString;
      }
    }
    return new QualifiedName(namespace, localName);
  }
  
  public static String appendStrings(String[] strings)
  {
    String result = null;
    if (strings != null)
    {
      StringBuffer tokenBuffer = new StringBuffer();
      int maxCount = strings.length;
      for (int i = 0; i < maxCount; i++)
      {
        String string = strings[i];
        if ((string != null) && (string.length() > 0)) {
          tokenBuffer.append(string);
        }
      }
      result = tokenBuffer.toString();
    }
    return result;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.core.search.pattern.QualifiedName
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.core.search.pattern;

import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IAdapterManager;
import org.eclipse.core.runtime.Platform;

public abstract class SearchPattern
  implements IAdaptable
{
  public static final int R_CASE_SENSITIVE = 8;
  public static final int R_EXACT_MATCH = 0;
  public static final int R_PATTERN_MATCH = 2;
  public static final int R_PREFIX_MATCH = 1;
  public static final int R_REGEXP_MATCH = 4;
  private int matchRule;
  
  public SearchPattern()
  {
    matchRule = 8;
  }
  
  public SearchPattern(int matchRule)
  {
    this.matchRule = matchRule;
  }
  
  public final int getMatchRule()
  {
    return matchRule;
  }
  
  public Object getAdapter(Class adapter)
  {
    return Platform.getAdapterManager().getAdapter(this, adapter);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.core.search.pattern.SearchPattern
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.core.search.scope;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.content.IContentDescription;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.core.runtime.content.IContentTypeManager;

public class ContentTypeSearchScope
  extends SearchScopeImpl
{
  private List validContentIds = new ArrayList();
  
  public ContentTypeSearchScope(SearchScope scope, String[] validContentTypes)
  {
    if (validContentTypes != null) {
      for (int i = 0; i < validContentTypes.length; i++) {
        validContentIds.add(validContentTypes[i]);
      }
    }
    if (scope.enclosingFiles() != null) {
      for (int i = 0; i < scope.enclosingFiles().length; i++)
      {
        IFile file = scope.enclosingFiles()[i];
        acceptFile(file);
      }
    }
  }
  
  protected boolean acceptFile(IFile file)
  {
    if (file == null) {
      return false;
    }
    try
    {
      IContentDescription description = file.getContentDescription();
      if (description != null)
      {
        IContentType contentType = description.getContentType();
        if (contentType != null) {
          for (Iterator iter = validContentIds.iterator(); iter
                .hasNext();)
          {
            String contentId = (String)iter.next();
            IContentTypeManager contentTypeManager = Platform.getContentTypeManager();
            IContentType supportedContentType = contentTypeManager.getContentType(contentId);
            if (supportedContentType != null) {
              if (contentType.isKindOf(supportedContentType))
              {
                files.add(file);
                projects.add(file.getProject());
                return true;
              }
            }
          }
        }
      }
    }
    catch (CoreException localCoreException) {}
    return false;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.core.search.scope.ContentTypeSearchScope
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.core.search.scope;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;

public class ProjectSearchScope
  extends SearchScopeImpl
{
  public ProjectSearchScope(IPath workspacePath)
  {
    initialize(workspacePath);
  }
  
  protected void initialize(IPath workspacePath)
  {
    IResource resource = ResourcesPlugin.getWorkspace().getRoot()
      .findMember(workspacePath);
    if (resource != null)
    {
      IProject project = resource.getProject();
      traverseContainer(project);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.core.search.scope.ProjectSearchScope
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.core.search.scope;

import org.eclipse.core.resources.IFile;

public abstract class SearchScope
{
  public abstract IFile[] enclosingFiles();
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.core.search.scope.SearchScope
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.core.search.scope;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceVisitor;

class SearchScopeImpl$1
  implements IResourceVisitor
{
  final SearchScopeImpl this$0;
  
  SearchScopeImpl$1(SearchScopeImpl paramSearchScopeImpl)
  {
    this$0 = paramSearchScopeImpl;
  }
  
  public boolean visit(IResource resource)
  {
    if (resource.getType() == 1) {
      this$0.acceptFile((IFile)resource);
    }
    return true;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.core.search.scope.SearchScopeImpl.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.core.search.scope;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceVisitor;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;

public class SearchScopeImpl
  extends SearchScope
{
  protected List files = new ArrayList();
  protected HashSet projects = new HashSet();
  
  protected boolean acceptFile(IFile file)
  {
    if (file == null) {
      return false;
    }
    files.add(file);
    projects.add(file.getProject());
    return true;
  }
  
  protected boolean encloses(String resourcePath)
  {
    IResource resource = ResourcesPlugin.getWorkspace().getRoot()
      .findMember(resourcePath);
    if (resource == null) {
      return false;
    }
    return files.contains(resource);
  }
  
  public IFile[] enclosingFiles()
  {
    if (files == null) {
      return new IFile[0];
    }
    return (IFile[])files.toArray(new IFile[files.size()]);
  }
  
  protected IProject[] enclosingProjects()
  {
    return (IProject[])projects.toArray(new IProject[projects.size()]);
  }
  
  protected void traverseContainer(IContainer container)
  {
    IResourceVisitor visitor = new IResourceVisitor()
    {
      public boolean visit(IResource resource)
      {
        if (resource.getType() == 1) {
          acceptFile((IFile)resource);
        }
        return true;
      }
    };
    try
    {
      container.accept(visitor);
    }
    catch (CoreException localCoreException) {}
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.core.search.scope.SearchScopeImpl
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.core.search.scope;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IResource;

public class SelectionSearchScope
  extends SearchScopeImpl
{
  protected IResource[] resources;
  
  public SelectionSearchScope(IResource
1 2

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