org.eclipse.core.runtime.Platform.getAdapterManager()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(136)

本文整理了Java中org.eclipse.core.runtime.Platform.getAdapterManager()方法的一些代码示例,展示了Platform.getAdapterManager()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Platform.getAdapterManager()方法的具体详情如下:
包路径:org.eclipse.core.runtime.Platform
类名称:Platform
方法名:getAdapterManager

Platform.getAdapterManager介绍

[英]Returns the adapter manager used for extending IAdaptable objects.
[中]返回用于扩展IAdaptable对象的适配器管理器。

代码示例

代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee

public Object getAdapter(Class adapter) {
  if (adapter == IRESOURCE_CLASS || adapter == IFILE_CLASS)
    return null; //return getAssociatedFile();
  return Platform.getAdapterManager().getAdapter(this, adapter);
}

代码示例来源:origin: org.eclipse.emf/cdo

/**
 * @since 4.2
 */
public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter)
{
 return Platform.getAdapterManager().getAdapter(this, adapter);
}

代码示例来源:origin: org.eclipse/org.eclipse.ui.editors

public Object getAdapter(Class adapter) {
  if (ILocationProvider.class.equals(adapter))
    return this;
  return Platform.getAdapterManager().getAdapter(this, adapter);
}

代码示例来源:origin: org.eclipse/org.eclipse.datatools.connectivity.ui

public Object getAdapter(Class adapter) {
  if (adapter.isInstance(this)) {
    return this;
  }
  return Platform.getAdapterManager().getAdapter(this, adapter);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.compare

@Override
  public <T> T getAdapter(Class<T> adapter) {
    return Platform.getAdapterManager().getAdapter(this, adapter);
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench

/**
 * This implementation of the method declared by <code>IAdaptable</code>
 * passes the request along to the platform's adapter manager; roughly
 * <code>Platform.getAdapterManager().getAdapter(this, adapter)</code>.
 * Subclasses may override this method (however, if they do so, they should
 * invoke the method on their superclass to ensure that the Platform's
 * adapter manager is consulted).
 */
@Override
public <T> T getAdapter(Class<T> adapter) {
  return Platform.getAdapterManager().getAdapter(this, adapter);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.team.ui

@SuppressWarnings("unchecked")
@Override
public <T> T getAdapter(Class<T> adapter) {
  if (adapter == IWorkbenchAdapter.class) {
    return (T) this;
  }
  return Platform.getAdapterManager().getAdapter(this, adapter);
}
/**

代码示例来源:origin: org.eclipse.egit/ui

public Object getAdapter(Class adapter) {
    if (RevCommit.class == adapter)
      return commit;
    return Platform.getAdapterManager().getAdapter(this, adapter);
  }
}

代码示例来源:origin: pulse00/Twig-Eclipse-Plugin

@Override
@SuppressWarnings("rawtypes")
public Object getAdapter(Class adapter) {
  if (adapter != null && adapter.getName().equals(WORKBENCH_ADAPTER)) {
    return null;
  }
  return Platform.getAdapterManager().getAdapter(this, adapter);
}

代码示例来源:origin: org.eclipse.xtext/ui

/**
   * @since 2.3
   */
  @SuppressWarnings("rawtypes")
  public Object getAdapter(Class adapter) {
    if (IReconciler.class.isAssignableFrom(adapter)) {
      return fReconciler;
    }
    return Platform.getAdapterManager().getAdapter(this, adapter);
  }
}

代码示例来源:origin: org.eclipse/org.eclipse.compare

public Object getAdapter(Class adapter) {
  if (adapter == IHunk.class)
    return fHunkResult;
  return Platform.getAdapterManager().getAdapter(this, adapter);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench

/**
 * Returns an object which is an instance of the given class associated
 * with this object. Returns <code>null</code> if no such object can be
 * found.
 */
@Override
public <T> T getAdapter(Class<T> adapter) {
  if (adapter == IWorkbenchAdapter.class) {
    return adapter.cast(this);
  }
  return Platform.getAdapterManager().getAdapter(this, adapter);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.team.ui

@Override
  public <T> T getAdapter(Class<T> adapter) {
    return Platform.getAdapterManager().getAdapter(this, adapter);
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.compare

@Override
  @SuppressWarnings("unchecked")
  public <T> T getAdapter(Class<T> adapter) {
    if (adapter == IHunk.class)
      return (T) fHunkResult.getHunk();
    if (adapter == HunkResult.class)
      return (T) fHunkResult;
    return Platform.getAdapterManager().getAdapter(this, adapter);
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ltk.core.refactoring

@Override
  public <T> T getAdapter(Class<T> adapter) {
    T result= Platform.getAdapterManager().getAdapter(this, adapter);
    if (result != null)
      return result;
    if (fParent != null)
      return fParent.getAdapter(adapter);
    return null;
  }
}

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.api.tools.ui

@Override
  public void stop(BundleContext context) throws Exception {
    // dispose composite images
    for (Image image : fCompositeImages.values()) {
      image.dispose();
    }
    fCompositeImages.clear();
    ApiPlugin.getDefault().getSessionManager().removeSessionListener(this.sessionListener);
    Platform.getAdapterManager().unregisterAdapters(fActionFilterAdapterFactory, IJavaElement.class);
    super.stop(context);
  }
}

代码示例来源:origin: org.eclipse/org.eclipse.jdt.debug.ui

public Object getAdapter(Class adapter) {
  if(adapter == IDebugTarget.class) {
    return getDebugTarget();
  }
  //CONTEXTLAUNCHING
  if(adapter.equals(ILaunchConfiguration.class)) {
    return getLaunch().getLaunchConfiguration();
  }
  return Platform.getAdapterManager().getAdapter(this, adapter);
}

代码示例来源:origin: org.eclipse.egit/ui

public Object getAdapter(Class adapter) {
  if (adapter == ISharedDocumentAdapter.class) {
    if (isSharedDocumentsEnable())
      return getSharedDocumentAdapter();
    else
      return null;
  }
  return Platform.getAdapterManager().getAdapter(this, adapter);
}

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

private IProject getProject(IEditorInput input) {
    IAdapterManager adapterManager = Platform.getAdapterManager();
    Object o;
    if ((o = input.getAdapter(IResource.class)) != null || (o = adapterManager.getAdapter(input, IResource.class)) != null) {
      return ((IFile) o).getProject();
    }
    if ((o = input.getAdapter(IProject.class)) != null || (o = adapterManager.getAdapter(input, IProject.class)) != null) {
      return (IProject) o;
    }
    return null;
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.workbench.texteditor

@Override
protected PageRec doCreatePage(IWorkbenchPart part) {
  // Try to get template page.
  ITemplatesPage page= part.getAdapter(ITemplatesPage.class);
  if (page == null)
    page= Platform.getAdapterManager().getAdapter(part, ITemplatesPage.class);
  if (page == null)
    return null; // There is no template page
  initPage(page);
  page.createControl(getPageBook());
  return new PageRec(part, page);
}

相关文章