org.eclipse.e4.core.services_1.0.0.v20120521-2346

16:42:57.373 INFO  jd.cli.Main - Decompiling org.eclipse.e4.core.services_1.0.0.v20120521-2346.jar
package org.eclipse.e4.core.internal.services;

import java.net.URI;
import java.net.URISyntaxException;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import org.eclipse.e4.core.services.translation.TranslationService;
import org.eclipse.osgi.service.localization.BundleLocalization;
import org.osgi.framework.Bundle;
import org.osgi.service.log.LogService;
import org.osgi.service.packageadmin.PackageAdmin;

public class BundleTranslationProvider
  extends TranslationService
{
  private static final String PLATFORM_SCHEMA = "platform";
  private static final String PLUGIN_SEGMENT = "/plugin/";
  private static final String FRAGMENT_SEGMENT = "/fragment/";
  private static final String KEY_PREFIX = "%";
  private static final String KEY_DOUBLE_PREFIX = "%%";
  
  public String translate(String key, String contributorURI)
  {
    Bundle bundle = getBundle(contributorURI);
    if (bundle == null) {
      return key;
    }
    BundleLocalization localizationService = ServicesActivator.getDefault()
      .getLocalizationService();
    if (localizationService == null) {
      return key;
    }
    ResourceBundle resourceBundle = localizationService.getLocalization(bundle, locale);
    return getResourceString(key, resourceBundle);
  }
  
  private Bundle getBundle(String contributorURI)
  {
    if (contributorURI == null) {
      return null;
    }
    try
    {
      uri = new URI(contributorURI);
    }
    catch (URISyntaxException localURISyntaxException)
    {
      URI uri;
      LogService logService = ServicesActivator.getDefault().getLogService();
      if (logService != null) {
        logService.log(1, "Invalid contributor URI: " + contributorURI);
      }
      return null;
    }
    URI uri;
    if (!"platform".equals(uri.getScheme())) {
      return null;
    }
    String bundleName = uri.getPath();
    if (bundleName.startsWith("/plugin/")) {
      bundleName = bundleName.substring("/plugin/".length());
    } else if (bundleName.startsWith("/fragment/")) {
      bundleName = bundleName.substring("/fragment/".length());
    }
    PackageAdmin packageAdmin = ServicesActivator.getDefault().getPackageAdmin();
    Bundle[] bundles = packageAdmin.getBundles(bundleName, null);
    if (bundles == null) {
      return null;
    }
    for (int i = 0; i < bundles.length; i++) {
      if ((bundles[i].getState() & 0x3) == 0) {
        return bundles[i];
      }
    }
    return null;
  }
  
  public String getResourceString(String value, ResourceBundle resourceBundle)
  {
    String s = value.trim();
    if (!s.startsWith("%", 0)) {
      return s;
    }
    if (s.startsWith("%%", 0)) {
      return s.substring(1);
    }
    int ix = s.indexOf(' ');
    String key = ix == -1 ? s : s.substring(0, ix);
    String dflt = ix == -1 ? s : s.substring(ix + 1);
    if (resourceBundle == null) {
      return dflt;
    }
    try
    {
      return resourceBundle.getString(key.substring(1));
    }
    catch (MissingResourceException localMissingResourceException) {}
    return dflt;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.core.internal.services.BundleTranslationProvider
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.core.internal.services;

import javax.inject.Inject;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IAdapterManager;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.services.adapter.Adapter;

public class EclipseAdapter
  extends Adapter
{
  private IAdapterManager adapterManager;
  private IEclipseContext context;
  
  @Inject
  public EclipseAdapter(IEclipseContext context)
  {
    this.context = context;
  }
  
  public <T> T adapt(Object element, Class<T> adapterType)
  {
    Assert.isNotNull(adapterType);
    if (element == null) {
      return null;
    }
    if (adapterType.isInstance(element)) {
      return (T)element;
    }
    if ((element instanceof IAdaptable))
    {
      IAdaptable adaptable = (IAdaptable)element;
      Object result = adaptable.getAdapter(adapterType);
      if (result != null)
      {
        Assert.isTrue(adapterType.isInstance(result));
        return (T)result;
      }
    }
    if (adapterManager == null) {
      adapterManager = lookupAdapterManager();
    }
    if (adapterManager == null) {
      return null;
    }
    Object result = adapterManager.loadAdapter(element, adapterType.getName());
    if (result != null)
    {
      Assert.isTrue(adapterType.isInstance(result));
      return (T)result;
    }
    return null;
  }
  
  private IAdapterManager lookupAdapterManager()
  {
    return (IAdapterManager)context.get(IAdapterManager.class.getName());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.core.internal.services.EclipseAdapter
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.core.internal.services;

import org.eclipse.e4.core.services.work.AsyncFuture;
import org.eclipse.e4.core.services.work.WorkRunnable;

public class EclipseWorkScheduler
{
  public <T> AsyncFuture<T> schedule(WorkRunnable<T> r, int flags, long delay)
  {
    return new AsyncFuture();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.core.internal.services.EclipseWorkScheduler
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.core.internal.services;

import org.eclipse.osgi.service.localization.BundleLocalization;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.service.log.LogService;
import org.osgi.service.packageadmin.PackageAdmin;
import org.osgi.util.tracker.ServiceTracker;

public class ServicesActivator
  implements BundleActivator
{
  private static ServicesActivator defaultInstance;
  private BundleContext bundleContext;
  private ServiceTracker<PackageAdmin, PackageAdmin> pkgAdminTracker;
  private ServiceTracker<LogService, LogService> logTracker;
  private ServiceTracker<BundleLocalization, BundleLocalization> localizationTracker = null;
  
  public ServicesActivator()
  {
    defaultInstance = this;
  }
  
  public static ServicesActivator getDefault()
  {
    return defaultInstance;
  }
  
  public void start(BundleContext context)
    throws Exception
  {
    bundleContext = context;
  }
  
  public void stop(BundleContext context)
    throws Exception
  {
    if (pkgAdminTracker != null)
    {
      pkgAdminTracker.close();
      pkgAdminTracker = null;
    }
    if (localizationTracker != null)
    {
      localizationTracker.close();
      localizationTracker = null;
    }
    if (logTracker != null)
    {
      logTracker.close();
      logTracker = null;
    }
    bundleContext = null;
  }
  
  public PackageAdmin getPackageAdmin()
  {
    if (pkgAdminTracker == null)
    {
      if (bundleContext == null) {
        return null;
      }
      pkgAdminTracker = new ServiceTracker(bundleContext, 
        PackageAdmin.class, null);
      pkgAdminTracker.open();
    }
    return (PackageAdmin)pkgAdminTracker.getService();
  }
  
  public LogService getLogService()
  {
    if (logTracker == null)
    {
      if (bundleContext == null) {
        return null;
      }
      logTracker = new ServiceTracker(bundleContext, 
        LogService.class, null);
      logTracker.open();
    }
    return (LogService)logTracker.getService();
  }
  
  public BundleLocalization getLocalizationService()
  {
    if (localizationTracker == null)
    {
      if (bundleContext == null) {
        return null;
      }
      localizationTracker = new ServiceTracker(
        bundleContext, BundleLocalization.class, null);
      localizationTracker.open();
    }
    return (BundleLocalization)localizationTracker.getService();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.core.internal.services.ServicesActivator
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.core.services.adapter;

public abstract class Adapter
{
  public abstract <T> T adapt(Object paramObject, Class<T> paramClass);
}

/* Location:
 * Qualified Name:     org.eclipse.e4.core.services.adapter.Adapter
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.core.services.contributions;

import org.eclipse.e4.core.contexts.IEclipseContext;
import org.osgi.framework.Bundle;

public abstract interface IContributionFactory
{
  public abstract Object create(String paramString, IEclipseContext paramIEclipseContext);
  
  public abstract Object create(String paramString, IEclipseContext paramIEclipseContext1, IEclipseContext paramIEclipseContext2);
  
  public abstract Bundle getBundle(String paramString);
}

/* Location:
 * Qualified Name:     org.eclipse.e4.core.services.contributions.IContributionFactory
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.core.services.contributions;

import org.eclipse.e4.core.contexts.IEclipseContext;
import org.osgi.framework.Bundle;

public abstract interface IContributionFactorySpi
{
  public abstract Object create(Bundle paramBundle, String paramString, IEclipseContext paramIEclipseContext);
  
  public abstract Object call(Object paramObject1, String paramString, IEclipseContext paramIEclipseContext, Object paramObject2);
}

/* Location:
 * Qualified Name:     org.eclipse.e4.core.services.contributions.IContributionFactorySpi
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.core.services.events;

import org.osgi.service.event.EventHandler;

public abstract interface IEventBroker
{
  public static final String DATA = "org.eclipse.e4.data";
  
  public abstract boolean send(String paramString, Object paramObject);
  
  public abstract boolean post(String paramString, Object paramObject);
  
  public abstract boolean subscribe(String paramString, EventHandler paramEventHandler);
  
  public abstract boolean subscribe(String paramString1, String paramString2, EventHandler paramEventHandler, boolean paramBoolean);
  
  public abstract boolean unsubscribe(EventHandler paramEventHandler);
}

/* Location:
 * Qualified Name:     org.eclipse.e4.core.services.events.IEventBroker
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.core.services.log;

public abstract interface ILoggerProvider
{
  public abstract Logger getClassLogger(Class<?> paramClass);
}

/* Location:
 * Qualified Name:     org.eclipse.e4.core.services.log.ILoggerProvider
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.core.services.log;

public abstract class Logger
{
  public abstract boolean isErrorEnabled();
  
  public abstract void error(Throwable paramThrowable, String paramString);
  
  public abstract boolean isWarnEnabled();
  
  public abstract void warn(Throwable paramThrowable, String paramString);
  
  public abstract boolean isInfoEnabled();
  
  public abstract void info(Throwable paramThrowable, String paramString);
  
  public abstract boolean isTraceEnabled();
  
  public abstract void trace(Throwable paramThrowable, String paramString);
  
  public abstract boolean isDebugEnabled();
  
  public abstract void debug(Throwable paramThrowable);
  
  public abstract void debug(Throwable paramThrowable, String paramString);
  
  public void debug(String message)
  {
    debug(null, message);
  }
  
  public void debug(String format, Object arg)
  {
    debug(internalBind(format, null, String.valueOf(arg), null));
  }
  
  public void debug(String format, Object arg1, Object arg2)
  {
    debug(internalBind(format, null, String.valueOf(arg1), String.valueOf(arg2)));
  }
  
  public void debug(String format, Object[] args)
  {
    debug(internalBind(format, args, null, null));
  }
  
  public void error(Throwable t)
  {
    error(t, null);
  }
  
  public void error(String message)
  {
    error(null, message);
  }
  
  public void error(String format, Object arg)
  {
    error(internalBind(format, null, String.valueOf(arg), null));
  }
  
  public void error(String format, Object arg1, Object arg2)
  {
    error(internalBind(format, null, String.valueOf(arg1), String.valueOf(arg2)));
  }
  
  public void error(String format, Object[] args)
  {
    error(internalBind(format, args, null, null));
  }
  
  public void info(Throwable t)
  {
    info(t, null);
  }
  
  public void info(String message)
  {
    info(null, message);
  }
  
  public void info(String format, Object arg)
  {
    info(internalBind(format, null, String.valueOf(arg), null));
  }
  
  public void info(String format, Object arg1, Object arg2)
  {
    info(internalBind(format, null, String.valueOf(arg1), String.valueOf(arg2)));
  }
  
  public void info(String format, Object[] args)
  {
    info(internalBind(format, args, null, null));
  }
  
  public void trace(Throwable t)
  {
    trace(t, null);
  }
  
  public void trace(String message)
  {
    trace(null, message);
  }
  
  public void trace(String format, Object arg)
  {
    trace(internalBind(format, null, String.valueOf(arg), null));
  }
  
  public void trace(String format, Object arg1, Object arg2)
  {
    trace(internalBind(format, null, String.valueOf(arg1), String.valueOf(arg2)));
  }
  
  public void trace(String format, Object[] args)
  {
    trace(internalBind(format, args, null, null));
  }
  
  public void warn(Throwable t)
  {
    warn(t, null);
  }
  
  public void warn(String message)
  {
    warn(null, message);
  }
  
  public void warn(String format, Object arg)
  {
    warn(internalBind(format, null, String.valueOf(arg), null));
  }
  
  public void warn(String format, Object arg1, Object arg2)
  {
    warn(internalBind(format, null, String.valueOf(arg1), String.valueOf(arg2)));
  }
  
  public void warn(String format, Object[] args)
  {
    warn(internalBind(format, args, null, null));
  }
  
  private static final Object[] EMPTY_ARGS = new Object[0];
  
  private static String internalBind(String message, Object[] args, String argZero, String argOne)
  {
    if (message == null) {
      return "No message available.";
    }
    if ((args == null) || (args.length == 0)) {
      args = EMPTY_ARGS;
    }
    int length = message.length();
    
    int bufLen = length + args.length * 5;
    if (argZero != null) {
      bufLen += argZero.length() - 3;
    }
    if (argOne != null) {
      bufLen += argOne.length() - 3;
    }
    StringBuffer buffer = new StringBuffer(bufLen < 0 ? 0 : bufLen);
    for (int i = 0; i < length; i++)
    {
      char c = message.charAt(i);
      switch (c)
      {
      case '{': 
        int index = message.indexOf('}', i);
        if (index == -1)
        {
          buffer.append(c);
        }
        else
        {
          i++;
          if (i >= length)
          {
            buffer.append(c);
          }
          else
          {
            int number = -1;
            try
            {
              number = Integer.parseInt(message.substring(i, index));
            }
            catch (NumberFormatException localNumberFormatException)
            {
              throw new IllegalArgumentException();
            }
            if ((number == 0) && (argZero != null))
            {
              buffer.append(argZero);
            }
            else if ((number == 1) && (argOne != null))
            {
              buffer.append(argOne);
            }
            else
            {
              if ((number >= args.length) || (number < 0))
              {
                buffer.append("<missing argument>");
                i = index;
                continue;
              }
              buffer.append(args[number]);
            }
            i = index;
          }
        }
        break;
      case '\'': 
        int nextIndex = i + 1;
        if (nextIndex >= length)
        {
          buffer.append(c);
        }
        else
        {
          char next = message.charAt(nextIndex);
          if (next == '\'')
          {
            i++;
            buffer.append(c);
          }
          else
          {
            int index = message.indexOf('\'', nextIndex);
            if (index == -1)
            {
              buffer.append(c);
            }
            else
            {
              buffer.append(message.substring(nextIndex, index));
              i = index;
            }
          }
        }
        break;
      default: 
        buffer.append(c);
      }
    }
    return buffer.toString();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.core.services.log.Logger
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.core.services.statusreporter;

import org.eclipse.core.runtime.IStatus;

public abstract class StatusReporter
{
  public static final int OK = 0;
  public static final int INFO = 1;
  public static final int WARNING = 2;
  public static final int ERROR = 4;
  public static final int IGNORE = 16;
  public static final int LOG = 32;
  public static final int SHOW = 64;
  public static final int BLOCK = 128;
  
  public abstract void report(IStatus paramIStatus, int paramInt, Object... paramVarArgs);
  
  public abstract IStatus newStatus(int paramInt, String paramString, Throwable paramThrowable);
  
  public final void show(int severity, String message, Throwable exception, Object... information)
  {
    report(newStatus(severity, message, exception), 64, information);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.core.services.statusreporter.StatusReporter
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.core.services.translation;

import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.internal.services.BundleTranslationProvider;

public final class TranslationProviderFactory
{
  public static TranslationService bundleTranslationService(IEclipseContext context)
  {
    return (TranslationService)ContextInjectionFactory.make(BundleTranslationProvider.class, context);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.core.services.translation.TranslationProviderFactory
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.core.services.translation;

import javax.inject.Inject;
import javax.inject.Named;

public abstract class TranslationService
{
  public static final String LOCALE = "org.eclipse.e4.core.locale";
  @Inject
  @Named("org.eclipse.e4.core.locale")
  protected String locale;
  
  public String translate(String key, String contributorURI)
  {
    return key;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.core.services.translation.TranslationService
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.core.services.util;

import java.math.BigDecimal;
import java.text.CharacterIterator;
import java.text.StringCharacterIterator;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

public final class JSONObject
{
  Map map = new HashMap();
  private static final String EMPTY_STRING = "";
  private static final String NULL = "null";
  
  public void set(String name, JSONObject value)
  {
    map.put(name, map);
  }
  
  public void set(String name, JSONObject[] values)
  {
    List maps = new ArrayList();
    for (int i = 0; i < values.length; i++) {
      maps.add(map);
    }
    map.put(name, maps);
  }
  
  public void set(String name, String value)
  {
    map.put(name, value);
  }
  
  public void set(String name, String[] values)
  {
    map.put(name, Arrays.asList(values));
  }
  
  public JSONObject getObject(String name)
  {
    Map resultMap = (Map)map.get(name);
    JSONObject result = asJSONObject(resultMap);
    return result;
  }
  
  private JSONObject asJSONObject(Map m)
  {
    JSONObject result = new JSONObject();
    map = m;
    return result;
  }
  
  public JSONObject[] getObjects(String name)
  {
    Collection collection = (Collection)map.get(name);
    JSONObject[] result = new JSONObject[collection.size()];
    int i = 0;
    for (Iterator it = collection.iterator(); it.hasNext();)
    {
      Map m = (Map)it.next();
      result[(i++)] = asJSONObject(m);
    }
    return result;
  }
  
  public String getString(String name)
  {
    return (String)map.get(name);
  }
  
  public String[] getStrings(String name)
  {
    List result = (List)map.get(name);
    if (result == null) {
      return null;
    }
    return (String[])result.toArray(new String[result.size()]);
  }
  
  public static JSONObject deserialize(String jsonString)
  {
    Object result = parse(new StringCharacterIterator(jsonString));
    if (!(result instanceof Map)) {
      throw new IllegalArgumentException("not an object");
    }
    JSONObject jsonObject = new JSONObject();
    map = ((Map)result);
    return jsonObject;
  }
  
  public String serialize()
  {
    StringBuffer buffer = new StringBuffer();
    writeValue(map, buffer);
    return buffer.toString();
  }
  
  private static RuntimeException error(String message, CharacterIterator it)
  {
    return new IllegalStateException("[" + it.getIndex() + "] " + message);
  }
  
  private static RuntimeException error(String message)
  {
    return new IllegalStateException(message);
  }
  
  private static Object parse(CharacterIterator it)
  {
    parseWhitespace(it);
    Object result = parseValue(it);
    parseWhitespace(it);
    if (it.current() != 65535) {
      throw error("should be done", it);
    }
    return result;
  }
  
  private static void parseWhitespace(CharacterIterator it)
  {
    char c = it.current();
    while (Character.isWhitespace(c)) {
      c = it.next();
    }
  }
  
  private static Object parseValue(CharacterIterator it)
  {
    switch (it.current())
    {
    case '{': 
      return parseObject(it);
    case '[': 
      return parseArray(it);
    case '"': 
      return parseString(it);
    case '-': 
    case '0': 
    case '1': 
    case '2': 
    case '3': 
    case '4': 
    case '5': 
    case '6': 
    case '7': 
    case '8': 
    case '9': 
      return parseNumber(it);
    case 't': 
      parseText(Boolean.TRUE.toString(), it);
      return Boolean.TRUE;
    case 'f': 
      parseText(Boolean.FALSE.toString(), it);
      return Boolean.FALSE;
    case 'n': 
      parseText("null", it);
      return null;
    }
    throw error("Bad JSON starting character '" + it.current() + "'", it);
  }
  
  private static Map parseObject(CharacterIterator it)
  {
    it.next();
    parseWhitespace(it);
    if (it.current() == '}')
    {
      it.next();
      return Collections.EMPTY_MAP;
    }
    Map map = new HashMap();
    for (;;)
    {
      if (it.current() != '"') {
        throw error("expected a string start '\"' but was '" + it.current() + "'", it);
      }
      String key = parseString(it);
      if (map.containsKey(key)) {
        throw error("' already definedkey '" + key, it);
      }
      parseWhitespace(it);
      if (it.current() != ':') {
        throw error("expected a pair separator ':' but was '" + it.current() + "'", it);
      }
      it.next();
      parseWhitespace(it);
      Object value = parseValue(it);
      map.put(key, value);
      parseWhitespace(it);
      if (it.current() != ',') {
        break;
      }
      it.next();
      parseWhitespace(it);
    }
    if (it.current() != '}') {
      throw error("expected an object close '}' but was '" + it.current() + "'", it);
    }
    it.next();
    return map;
  }
  
  private static List parseArray(CharacterIterator it)
  {
    it.next();
    parseWhitespace(it);
    if (it.current() == ']')
    {
      it.next();
      return Collections.EMPTY_LIST;
    }
    List list = new ArrayList();
    for (;;)
    {
      Object value = parseValue(it);
      list.add(value);
      parseWhitespace(it);
      if (it.current() != ',') {
        break;
      }
      it.next();
      parseWhitespace(it);
    }
    if (it.current() != ']') {
      throw error("expected an array close ']' but was '" + it.current() + "'", it);
    }
    it.next();
    return list;
  }
  
  private static void parseText(String string, CharacterIterator it)
  {
    int length = string.length();
    char c = it.current();
    for (int i = 0; i < length; i++)
    {
      if (c != string.charAt(i)) {
        throw error(
          "expected to parse '" + string + "' but character " + (i + 1) + " was '" + c + "'", it);
      }
      c = it.next();
    }
  }
  
  private static Object parseNumber(CharacterIterator it)
  {
    StringBuffer buffer = new StringBuffer();
    char c = it.current();
    while ((Character.isDigit(c)) || (c == '-') || (c == '+') || (c == '.') || (c == 'e') || (c == 'E'))
    {
      buffer.append(c);
      c = it.next();
    }
    try
    {
      return new BigDecimal(buffer.toString());
    }
    catch (NumberFormatException localNumberFormatException)
    {
      throw error("expected a number but was '" + buffer.toString() + "'", it);
    }
  }
  
  private static String parseString(CharacterIterator it)
  {
    char c = it.next();
    if (c == '"')
    {
      it.next();
      return "";
    }
    StringBuffer buffer = new StringBuffer();
    while (c != '"')
    {
      if (Character.isISOControl(c)) {
        throw error("illegal iso control character: '" + Integer.toHexString(c) + "'", it);
      }
      if (c == '\\')
      {
        c = it.next();
        switch (c)
        {
        case '"': 
        case '/': 
        case '\\': 
          buffer.append(c);
          break;
        case 'b': 
          buffer.append('\b');
          break;
        case 'f': 
          buffer.append('\f');
          break;
        case 'n': 
          buffer.append('\n');
          break;
        case 'r': 
          buffer.append('\r');
          break;
        case 't': 
          buffer.append('\t');
          break;
        case 'u': 
          StringBuffer unicode = new StringBuffer(4);
          for (int i = 0; i < 4; i++) {
            unicode.append(it.next());
          }
          try
          {
            buffer.append((char)Integer.parseInt(unicode.toString(), 16));
          }
          catch (NumberFormatException localNumberFormatException)
          {
            throw error(
              "expected a unicode hex number but was '" + unicode.toString() + "'", it);
          }
        default: 
          throw error("illegal escape character '" + c + "'", it);break;
        }
      }
      else
      {
        buffer.append(c);
      }
      c = it.next();
    }
    c = it.next();
    return buffer.toString();
  }
  
  private static void writeValue(Object value, StringBuffer buffer)
  {
    if (value == null) {
      buffer.append("null");
    } else if (((value instanceof Boolean)) || ((value instanceof Number))) {
      buffer.append(value.toString());
    } else if ((value instanceof String)) {
      writeString((String)value, buffer);
    } else if ((value instanceof Collection)) {
      writeArray((Collection)value, buffer);
    } else if ((value instanceof Map)) {
      writeObject((Map)value, buffer);
    } else {
      throw error("Unexpected object instance type was '" + value.getClass().getName() + "'");
    }
  }
  
  private static void writeObject(Map map, StringBuffer buffer)
  {
    buffer.append('{');
    for (Iterator iterator = map.keySet().iterator(); iterator.hasNext();)
    {
      Object key = iterator.next();
      if (!(key instanceof String)) {
        throw error("Map keys must be an instance of String but was '" + key.getClass().getName() + "'");
      }
      writeString((String)key, buffer);
      buffer.append(':');
      writeValue(map.get(key), buffer);
      buffer.append(',');
    }
    if (buffer.charAt(buffer.length() - 1) == ',') {
      buffer.setCharAt(buffer.length() - 1, '}');
    } else {
      buffer.append('}');
    }
  }
  
  private static void writeArray(Collection collection, StringBuffer buffer)
  {
    buffer.append('[');
    for (Iterator iterator = collection.iterator(); iterator.hasNext();)
    {
      writeValue(iterator.next(), buffer);
      buffer.append(',');
    }
    if (buffer.charAt(buffer.length() - 1) == ',') {
      buffer.setCharAt(buffer.length() - 1, ']');
    } else {
      buffer.append(']');
    }
  }
  
  private static void writeString(String string, StringBuffer buffer)
  {
    buffer.append('"');
    int length = string.length();
    for (int i = 0; i < length; i++)
    {
      char c = string.charAt(i);
      switch (c)
      {
      case '"': 
      case '/': 
      case '\\': 
        buffer.append('\\');
        buffer.append(c);
        break;
      case '\b': 
        buffer.append("\\b");
        break;
      case '\f': 
        buffer.append("\\f");
        break;
      case '\n': 
        buffer.append("\\n");
        break;
      case '\r': 
        buffer.append("\\r");
        break;
      case '\t': 
        buffer.append("\\t");
        break;
      default: 
        if (Character.isISOControl(c))
        {
          buffer.append("\\u");
          String hexString = Integer.toHexString(c);
          for (int j = hexString.length(); j < 4; j++) {
            buffer.append('0');
          }
          buffer.append(hexString);
        }
        else
        {
          buffer.append(c);
        }
        break;
      }
    }
    buffer.append('"');
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.core.services.util.JSONObject
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.core.services.work;

public class AsyncFuture<T>
{
  public boolean done()
  {
    return false;
  }
  
  public T getResult()
  {
    if (!done()) {
      throw new IllegalStateException();
    }
    return null;
  }
  
  public void onDone(WorkRunnable<Object> runnable) {}
}

/* Location:
 * Qualified Name:     org.eclipse.e4.core.services.work.AsyncFuture
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.core.services.work;

import org.eclipse.core.runtime.IStatus;

public abstract class WorkContext
  extends WorkScheduler
{
  public static final int INITIAL_WORK_REMAINING = 1000;
  
  public abstract void setWorkRemaining(int paramInt, String... paramVarArgs);
  
  public abstract void worked(int paramInt);
  
  public abstract WorkContext newChild(int paramInt, String... paramVarArgs);
  
  public abstract WorkContext asyncChild(int paramInt, String... paramVarArgs);
  
  public abstract boolean isCanceled();
  
  public abstract void setBlocked(IStatus paramIStatus);
  
  public abstract void clearBlocked();
  
  public abstract void onCancel(Runnable paramRunnable);
}

/* Location:
 * Qualified Name:     org.eclipse.e4.core.services.work.WorkContext
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.core.services.work;

public class WorkListener {}

/* Location:
 * Qualified Name:     org.eclipse.e4.core.services.work.WorkListener
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.core.services.work;

public abstract class WorkRunnable<T>
{
  public abstract T run(WorkContext paramWorkContext);
}

/* Location:
 * Qualified Name:     org.eclipse.e4.core.services.work.WorkRunnable
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.core.services.work;

public abstract class WorkScheduler
{
  public abstract <T> AsyncFuture<T> schedule(WorkRunnable<T> paramWorkRunnable, int paramInt, long paramLong);
}

/* Location:
 * Qualified Name:     org.eclipse.e4.core.services.work.WorkScheduler
 * 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