org.eclipse.ui.IContributorResourceAdapter Java Examples

The following examples show how to use org.eclipse.ui.IContributorResourceAdapter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XdsElementAdapterFactory.java    From xds-ide with Eclipse Public License 1.0 6 votes vote down vote up
@Override
  public Object getAdapter(Object element, @SuppressWarnings("rawtypes") Class key) {
IXdsElement e = (IXdsElement)element;
  	if (IResource.class.isAssignableFrom(key)) {
  		return XdsElementUtils.adaptToResource(e, key);
  	}
  	
      if (IPropertySource.class.equals(key)) {
          return getProperties(XdsElementUtils.adaptToResource(e, IResource.class));
      }
      else if (IWorkbenchAdapter.class.equals(key)) {
          if (xdsWorkbenchAdapter == null) {
              xdsWorkbenchAdapter = new XdsWorkbenchAdapter();
          }
          return xdsWorkbenchAdapter;
      }
      else if (IContributorResourceAdapter.class.equals(key)) {
          return this;
      }
      
      return null;
  }
 
Example #2
Source File: JavaElementAdapterFactory.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public Object getAdapter(Object element, Class key) {
	updateLazyLoadedAdapters();
	IJavaElement java= getJavaElement(element);

	if (IPropertySource.class.equals(key)) {
		return getProperties(java);
	} if (IResource.class.equals(key)) {
		return getResource(java);
	} if (fSearchPageScoreComputer != null && ISearchPageScoreComputer.class.equals(key)) {
		return fSearchPageScoreComputer;
	} if (IWorkbenchAdapter.class.equals(key)) {
		return getJavaWorkbenchAdapter();
	} if (IResourceLocator.class.equals(key)) {
		return getResourceLocator();
	} if (IPersistableElement.class.equals(key)) {
		return new PersistableJavaElementFactory(java);
	} if (IContributorResourceAdapter.class.equals(key)) {
		return this;
	} if (IContributorResourceAdapter2.class.equals(key)) {
		return this;
	} if (ITaskListResourceAdapter.class.equals(key)) {
		return getTaskListAdapter();
	} if (IContainmentAdapter.class.equals(key)) {
		return getJavaElementContainmentAdapter();
	} if (fIsTeamUILoaded && IHistoryPageSource.class.equals(key) && JavaElementHistoryPageSource.hasEdition(java)) {
		return JavaElementHistoryPageSource.getInstance();
	}
	return null;
}
 
Example #3
Source File: PythonSourceFolder.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public <T> T getAdapter(Class<T> adapter) {
    if (adapter == IActionFilter.class) {
        IActionFilter platformActionFilter = (IActionFilter) this.getActualObject().getAdapter(adapter);
        return (T) new PythonSourceFolderActionFilter(platformActionFilter);
    }
    if (adapter == IContributorResourceAdapter.class) {
        return (T) this;
    }
    return WrappedResource.getAdapterFromActualObject(this.getActualObject(), adapter);
}
 
Example #4
Source File: WrappedResource.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public <T> T getAdapter(Class<T> adapter) {
    if (adapter == IContributorResourceAdapter.class) {
        return (T) this;
    }
    return WrappedResource.getAdapterFromActualObject(this.getActualObject(), adapter);
}
 
Example #5
Source File: ModelAdapter.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public Class<?>[] getAdapterList() {
    return new Class[] { IWrappedResource.class, ResourceMapping.class, IResource.class, IFolder.class,
            IFile.class, IContainer.class, IContributorResourceAdapter.class, IProject.class };
}