/**
  * This gets the selection processor which in this case is a composite selection processor that
  * consists of all the extension point providers.
  *
  * @return a selection processor.
  */
 public static ISelectionProcessor getSelectionProcessor() {
   final CompositeSelectionProcessor processors = new CompositeSelectionProcessor();
   final IExtension[] extensions =
       Platform.getExtensionRegistry()
           .getExtensionPoint(SELECTION_PROCESSOR_EXTENSION_POINT_ID)
           .getExtensions();
   for (final IExtension extension : extensions) {
     final IConfigurationElement[] configurationElements = extension.getConfigurationElements();
     try {
       for (final IConfigurationElement configurationElement : configurationElements) {
         if (configurationElement.getName().equals(SELECTION_PROCESSOR)) {
           processors.addProcessor(
               (ISelectionProcessor) configurationElement.createExecutableExtension(CLASS));
         }
       }
     } catch (final CoreException e) {
       OpenInActivator.getDefault()
           .getLog()
           .log(
               Messages.error(
                   "selectionprocessor.error.message", new Object[] {}, e)); // $NON-NLS-1$
     }
   }
   return processors;
 }
Exemplo n.º 2
0
 public static MetaSearchImpl getUniqueInstance() {
   if (uniqueInstance_ == null)
     try {
       uniqueInstance_ = new MetaSearchImpl();
     } catch (Exception e) {
       Messages.error(TFA02_, e);
     }
   return uniqueInstance_;
 }
Exemplo n.º 3
0
  public List search(Hashtable h, MetaSearchRequest r) {
    // create tasks
    List taskList = null;
    String dateString = (String) h.get("DATETIME");
    Date date = null;
    long waitTime = MSR_DEFAULT_DURATION_;
    try {
      waitTime = Long.valueOf((String) h.get("WAIT_TIME")).longValue() * 1000;
    } catch (Exception e) {
    }
    if (dateString != null)
      try {
        Messages.debug(-1, "MetaSearch::search before parse");
        date = RandomDate.parse(dateString);
        Messages.debug(-1, "MetaSearch::search after parse date=%1", date);
      } catch (Exception e) {
        Messages.error(TFA01_, dateString);
      }
    else Messages.error(TFA01_, dateString);

    if (date != null) {
      Thread t = Thread.currentThread();
      taskList = taskFac_.makeTasks(h, date, r);
      // take precaution that the issueing Thread is interrupted when all tasks are done
      r.registerInterrupt(t, taskList.size());
      try {
        for (Iterator e = taskList.iterator(); e.hasNext(); ) executor_.execute((Task) e.next());
        // sleep
        t.sleep(waitTime);
      } catch (InterruptedException e) {
        // if all tasks have been done, before waitTime was over
      }

      // invalidate all tasks and interrupt the corresponding threads
      for (Iterator e = taskList.iterator(); e.hasNext(); ) ((Task) e.next()).cancel();
    }
    return taskList;
  }
Exemplo n.º 4
0
 @Override
 public void uncaughtException(Thread thread, Throwable t) {
   Log.e(TAG, "uncaughtException: " + t.toString(), t);
   Messages.error(this, t);
 }