当前位置: 首页>>代码示例>>Java>>正文


Java IAdapterManager类代码示例

本文整理汇总了Java中org.eclipse.core.runtime.IAdapterManager的典型用法代码示例。如果您正苦于以下问题:Java IAdapterManager类的具体用法?Java IAdapterManager怎么用?Java IAdapterManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IAdapterManager类属于org.eclipse.core.runtime包,在下文中一共展示了IAdapterManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: stop

import org.eclipse.core.runtime.IAdapterManager; //导入依赖的package包/类
@Override
public void stop(BundleContext context) throws Exception {
	remoteBookmarksTreeChangeEventHandler.unsubscribe();
	bookmarksSaver.close();
	IAdapterManager adapterManager = Platform.getAdapterManager();
	adapterManager.unregisterAdapters(bookmarkAdapterFactory);

	bookmarkProblemsAutoUpdater.close();
	pathPlaceholdersStore.close();
	bookmarksMarkers.close();
	mostVisitedBookmarks.close();
	numberedBookmarks.close();
	recentBookmarks.close();
	bookmarkProblems.close();

	plugin = null;
	super.stop(context);
}
 
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:19,代码来源:BookmarksPlugin.java

示例2: getAdapter

import org.eclipse.core.runtime.IAdapterManager; //导入依赖的package包/类
/**
 * Returns an instance of the adaptable object with type of adapterType, or
 * null if the given object could not be adapted to that type. See
 * {@link IAdapterManager#getAdapter(Object, Class)}.
 */
@SuppressWarnings("unchecked")
public static <T> T getAdapter(Object adaptable,
    Class<? extends T> adapterType) {

  /*
   * Try a simple instanceof check. This also safeguards against a misuse of
   * getAdapter. For example, ISelection is adaptable (there is a
   * SelectionAdapterFactory), so the user may incorrectly try adapting it to
   * IStructuredSelection. However, in this case, the implementation of
   * SelectionAdapterFactory would return null.
   */
  if (adapterType.isInstance(adaptable)) {
    return (T) adaptable;
  }
  
  IAdapterManager adapterManager = Platform.getAdapterManager();
  assert (adapterManager != null);
  return (T) adapterManager.getAdapter(adaptable, adapterType);
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:25,代码来源:AdapterUtilities.java

示例3: execute

import org.eclipse.core.runtime.IAdapterManager; //导入依赖的package包/类
@Override
public final Object execute(final ExecutionEvent event)
{
  final List<String> arguments = new ArrayList<String>();
  final String command = Activator.getDefault().getPreferenceStore().getString(this.getMergeCommandPathName());

  final TreeSelection selection = (TreeSelection) HandlerUtil.getCurrentSelection(event);
  if (selection.isEmpty() == false)
  {
    final IAdapterManager adapterManager = Platform.getAdapterManager();
    final IResource resource = adapterManager.getAdapter(selection.getFirstElement(), IResource.class);
    if (resource != null)
    {
      arguments.add("/patchpath:" + resource.getLocation().toString());
      ProcessWrapper.executeCommand(command, arguments);
    }
  }

  return null;
}
 
开发者ID:ContextQuickie,项目名称:ContextQuickie,代码行数:21,代码来源:AbstractTortoiseMergeCommand.java

示例4: buildController

import org.eclipse.core.runtime.IAdapterManager; //导入依赖的package包/类
private static SaveToServerActionController buildController(final IStructuredSelection selection) {
    final IAdapterManager adapterManager = Platform.getAdapterManager();

    final List<IResource> selectedResources = new ArrayList<>();
    for (Iterator<?> iterator = selection.iterator(); iterator.hasNext();) {
        final IResource selectedResource = (IResource) adapterManager.getAdapter(iterator.next(), IResource.class);
        if (null != selectedResource) {
            selectedResources.add(selectedResource);
        }
    }

    final List<IResource> filteredResources = filter(selectedResources);
    if (filteredResources.isEmpty())
        return null;

    final IProject project = filteredResources.get(0).getProject();
    for (final IResource resource : filteredResources) {
        if (!project.equals(resource.getProject())) {
            logger.warn("Unable to save resources from multiple projects at the same time. Only saving resources from "
                    + project.getName());
            break;
        }
    }

    return buildController(selection, filteredResources, project);
}
 
开发者ID:forcedotcom,项目名称:idecore,代码行数:27,代码来源:SaveToServerHandler.java

示例5: start

import org.eclipse.core.runtime.IAdapterManager; //导入依赖的package包/类
@Override
public void start(final BundleContext context) throws Exception {
    super.start(context);
    plugin = this;
    teamBuildAdapterFactory = new TeamBuildAdapterFactory();
    final IAdapterManager manager = Platform.getAdapterManager();
    manager.registerAdapters(teamBuildAdapterFactory, IQueuedBuild.class);
    manager.registerAdapters(teamBuildAdapterFactory, IBuildDetail.class);
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:10,代码来源:TFSTeamBuildPlugin.java

示例6: startup

import org.eclipse.core.runtime.IAdapterManager; //导入依赖的package包/类
public void startup(IProgressMonitor monitor) throws CoreException {
	IAdapterManager mgr = Platform.getAdapterManager();
	
	// adapterFactory to translate IResource to ISVNResource
	localResourceAdapterFactory = new LocalResourceAdapterFactory();
	mgr.registerAdapters(localResourceAdapterFactory,IResource.class);
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:8,代码来源:SVNAdapterFactories.java

示例7: getAdapter

import org.eclipse.core.runtime.IAdapterManager; //导入依赖的package包/类
/**
    * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
    */
public <T> T getAdapter(Class<T> adapter) {
       // lookup the IAdapterManager service
       final IAdapterManager manager = Platform.getAdapterManager();
       // forward the request to IAdapterManager service
       return manager.getAdapter(this, adapter);
   }
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:10,代码来源:Spec.java

示例8: start

import org.eclipse.core.runtime.IAdapterManager; //导入依赖的package包/类
/**
 * This method is called upon plug-in activation.
 * 
 * @param context
 *          the context
 * 
 * @throws Exception
 *           the exception
 */
@Override
public void start(BundleContext context) throws Exception {
  super.start(context);

  IAdapterManager manager = Platform.getAdapterManager();
  manager.registerAdapters(new ContentOutlinePageAdapterFactory(), DiagramEditor.class);

  // Initialize the image cache
  imageCache = new ImageCache();
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:20,代码来源:ActivitiPlugin.java

示例9: start

import org.eclipse.core.runtime.IAdapterManager; //导入依赖的package包/类
@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);
}
 
开发者ID:jbosstools,项目名称:chromedevtools,代码行数:11,代码来源:ChromiumDebugPlugin.java

示例10: stop

import org.eclipse.core.runtime.IAdapterManager; //导入依赖的package包/类
@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);
}
 
开发者ID:jbosstools,项目名称:chromedevtools,代码行数:9,代码来源:ChromiumDebugPlugin.java

示例11: getBreakpoint

import org.eclipse.core.runtime.IAdapterManager; //导入依赖的package包/类
private ChromiumLineBreakpoint getBreakpoint() {
  IAdapterManager manager= Platform.getAdapterManager();
  IAdaptable adaptable = getElement();
  ChromiumLineBreakpoint adapted =
      (ChromiumLineBreakpoint) manager.getAdapter(adaptable, ChromiumLineBreakpoint.class);
  return adapted;
}
 
开发者ID:jbosstools,项目名称:chromedevtools,代码行数:8,代码来源:BreakpointTechnicalInfoPage.java

示例12: test

import org.eclipse.core.runtime.IAdapterManager; //导入依赖的package包/类
@Override
public boolean test(final Object receiver, final String property, final Object[] args, final Object expectedValue)
{
  boolean result = false;
  if ((receiver != null) && (expectedValue != null))
  {
    int expectedType = IResource.NONE;
    if (expectedValue.toString().toUpperCase().equals("IResource.FILE".toUpperCase()))
    {
      expectedType = IResource.FILE;
    }
    else if (expectedValue.toString().toUpperCase().equals("IResource.FOLDER".toUpperCase()))
    {
      expectedType = IResource.FOLDER;
    }
    else if (expectedValue.toString().toUpperCase().equals("IResource.PROJECT".toUpperCase()))
    {
      expectedType = IResource.PROJECT;
    }
    else
    {
      // Invalid or unknown expected value
      return false;
    }

    final IAdapterManager adapterManager = Platform.getAdapterManager();
    if (adapterManager != null)
    {
      // Check if selected item is of expected type
      final IResource resource = adapterManager.getAdapter(receiver, IResource.class);
      if ((resource != null) && ((resource.getType() & expectedType) != IResource.NONE))
      {
        result = true;
      }
    }
  }
  return result;
}
 
开发者ID:ContextQuickie,项目名称:ContextQuickie,代码行数:39,代码来源:SelectedResourceTester.java

示例13: execute

import org.eclipse.core.runtime.IAdapterManager; //导入依赖的package包/类
@Override
public final Object execute(final ExecutionEvent event) throws ExecutionException
{
  final ISelection selection = HandlerUtil.getCurrentSelection(event);
  IResource resource = null;
  if (selection instanceof TreeSelection)
  {
    final IAdapterManager adapterManager = Platform.getAdapterManager();
    final TreeSelection treeSelection = (TreeSelection) selection;
    resource = adapterManager.getAdapter(treeSelection.getFirstElement(), IResource.class);
  }
  else if (selection instanceof TextSelection)
  {
    resource = WorkbenchUtil.getCurrentDocument();
  }
  if (resource != null)
  {
    final BeyondCompare bc = new BeyondCompare();
    final int resourceType = resource.getType();
    if ((resourceType == IResource.FOLDER) || (resourceType == IResource.PROJECT))
    {
      bc.setSavedLeft(resource.getLocation().toString());
      bc.setSavedLeftType(BeyondCompareSavedLeft.Directory);
      bc.writeRegistry();
    }
    else if (resourceType == IResource.FILE)
    {
      bc.setSavedLeft(resource.getLocation().toString());
      bc.setSavedLeftType(BeyondCompareSavedLeft.File);
      bc.writeRegistry();
    }
  }
  return null;
}
 
开发者ID:ContextQuickie,项目名称:ContextQuickie,代码行数:35,代码来源:SelectLeftSide.java

示例14: execute

import org.eclipse.core.runtime.IAdapterManager; //导入依赖的package包/类
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException
{
  final TreeSelection selection = (TreeSelection) HandlerUtil.getCurrentSelection(event);
  final Object[] paths = selection.toArray();
  final IAdapterManager adapterManager = Platform.getAdapterManager();
  final IResource leftResource = adapterManager.getAdapter(paths[0], IResource.class);
  final IResource rightResource = adapterManager.getAdapter(paths[1], IResource.class);
  if ((leftResource != null) && (rightResource != null))
  {
    BeyondCompare.compare(leftResource.getLocation().toString(), rightResource.getLocation().toString());
  }

  return null;
}
 
开发者ID:ContextQuickie,项目名称:ContextQuickie,代码行数:16,代码来源:Compare.java

示例15: execute

import org.eclipse.core.runtime.IAdapterManager; //导入依赖的package包/类
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException
{

  final ISelection selection = HandlerUtil.getCurrentSelection(event);
  if (selection != null)
  {

    final IAdapterManager adapterManager = Platform.getAdapterManager();
    if ((selection != null) && (selection.isEmpty() == false))
    {
      Object receiver = null;
      // Context menu has been opened in a tree view
      if (selection instanceof IStructuredSelection)
      {
        final IStructuredSelection structuredSelection = (IStructuredSelection) selection;
        receiver = structuredSelection.getFirstElement();
      }
      else if (selection instanceof TextSelection)
      {
        receiver = WorkbenchUtil.getCurrentDocument();
      }

      final IResource rightResource;
      rightResource = adapterManager.getAdapter(receiver, IResource.class);
      if (rightResource != null)
      {
        final BeyondCompare bc = new BeyondCompare();
        bc.readRegistry();
        final String savedLeft = bc.getSavedLeft();
        BeyondCompare.compare(savedLeft, rightResource.getLocation().toString());
      }
    }
  }

  return null;
}
 
开发者ID:ContextQuickie,项目名称:ContextQuickie,代码行数:38,代码来源:CompareToRight.java


注:本文中的org.eclipse.core.runtime.IAdapterManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。