Package org.eclipse.core.runtime

Examples of org.eclipse.core.runtime.IAdapterManager


            if( adapter != null ){
                return type.cast( adapter);
            }
        }
        // last ditch attempt!
        IAdapterManager manager = Platform.getAdapterManager();
        return manager.getAdapter( element, type );
    }
View Full Code Here


   *            the adaptable to adapt
   * @return the resultant adaptable. May be the same adaptable, a new
   *         adaptable, or <code>null</code>.
   */
  private IAdaptable adapt(Type type, IAdaptable adaptable) {
    IAdapterManager adapterManager = Platform.getAdapterManager();
    Class[] directClasses = adapterManager.computeClassOrder(adaptable
        .getClass());
    for (int i = 0; i < directClasses.length; i++) {
      Class clazz = directClasses[i];
      if (clazz.getName().equals(type.className))
        return adaptable;
    }

    if ((type.flags & Type.ADAPT) != 0) {
      Object adapted = adapterManager.getAdapter(adaptable,
          type.className);
      if (adapted instanceof IAdaptable)
        return (IAdaptable) adapted;

      PackageAdmin admin = getPackageAdmin();
View Full Code Here

  public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
    if (fTypeName == null)
      return EvaluationResult.FALSE;
    Object var= context.getDefaultVariable();
    Object adapted= null;
    IAdapterManager manager= Platform.getAdapterManager();
    if (Expressions.isInstanceOf(var, fTypeName)) {
      adapted= var;
    } else {
      if (!manager.hasAdapter(var, fTypeName))
        return EvaluationResult.FALSE;
   
      adapted= manager.getAdapter(var, fTypeName);
    }
    // the adapted result is null but hasAdapter returned true check
    // if the adapter is loaded.
    if (adapted == null) {
      if (manager.queryAdapter(var, fTypeName) == IAdapterManager.NOT_LOADED) {
        return EvaluationResult.NOT_LOADED;
      } else {
        return EvaluationResult.FALSE;
      }
    }
View Full Code Here

   */
  public static IIterable getAsIIterable(Object var, Expression expression) throws CoreException {
    if (var instanceof IIterable) {
      return (IIterable)var;
    } else {
      IAdapterManager manager= Platform.getAdapterManager();
      IIterable result= (IIterable)manager.getAdapter(var, IIterable.class);
      if (result != null)
        return result;
     
      if (manager.queryAdapter(var, IIterable.class.getName()) == IAdapterManager.NOT_LOADED)
        return null;
     
      throw new CoreException(new ExpressionStatus(
        ExpressionStatus.VARIABLE_IS_NOT_A_COLLECTION,
        Messages.format(ExpressionMessages.Expression_variable_not_iterable, expression.toString())));
View Full Code Here

   */
  public static ICountable getAsICountable(Object var, Expression expression) throws CoreException {
    if (var instanceof ICountable) {
      return (ICountable)var;
    } else {
      IAdapterManager manager= Platform.getAdapterManager();
      ICountable result= (ICountable)manager.getAdapter(var, ICountable.class);
      if (result != null)
        return result;
     
      if (manager.queryAdapter(var, ICountable.class.getName()) == IAdapterManager.NOT_LOADED)
        return null;
     
      throw new CoreException(new ExpressionStatus(
        ExpressionStatus.VARIABLE_IS_NOT_A_COLLECTION,
        Messages.format(ExpressionMessages.Expression_variable_not_countable, expression.toString())));
View Full Code Here

  }

  @Override
  public void start(BundleContext context) throws Exception {
    super.start(context);
    IAdapterManager manager = Platform.getAdapterManager();
    breakpointWorkbenchAdapterFactory = new ChromiumBreakpointWBAFactory();
    manager.registerAdapters(breakpointWorkbenchAdapterFactory, ChromiumLineBreakpoint.class);
    plugin = this;

    JavascriptVmFactory.getRootLogger().addHandler(SDK_LOG_HANDLER);
  }
View Full Code Here

  @Override
  public void stop(BundleContext context) throws Exception {
    JavascriptVmFactory.getRootLogger().removeHandler(SDK_LOG_HANDLER);
    plugin = null;
    IAdapterManager manager = Platform.getAdapterManager();
    manager.unregisterAdapters(breakpointWorkbenchAdapterFactory);
    super.stop(context);
  }
View Full Code Here

        }
    }

    private List computeAdapterOrder(List classList) {
        Set result = new HashSet(4);
        IAdapterManager adapterMgr = Platform.getAdapterManager();
        for (Iterator list = classList.iterator(); list.hasNext();) {
            Class clazz = ((Class) list.next());
            String[] adapters = adapterMgr.computeAdapterTypes(clazz);
            for (int i = 0; i < adapters.length; i++) {
                String adapter = adapters[i];
                if (!result.contains(adapter)) {
                    result.add(adapter);
                }
View Full Code Here

      }
    });
  }

  private ChromiumLineBreakpoint getBreakpoint() {
    IAdapterManager manager= Platform.getAdapterManager();
    IAdaptable adaptable = getElement();
    ChromiumLineBreakpoint adapted =
        (ChromiumLineBreakpoint) manager.getAdapter(adaptable, ChromiumLineBreakpoint.class);
    return adapted;
  }
View Full Code Here

  }

  @Override
  public void start(BundleContext context) throws Exception {
    super.start(context);
    IAdapterManager manager = Platform.getAdapterManager();
    breakpointWorkbenchAdapterFactory = new ChromiumBreakpointWBAFactory();
    manager.registerAdapters(breakpointWorkbenchAdapterFactory, ChromiumLineBreakpoint.class);
    plugin = this;

    BrowserFactory.getRootLogger().addHandler(SDK_LOG_HANDLER);
  }
View Full Code Here

TOP

Related Classes of org.eclipse.core.runtime.IAdapterManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.