Java 类org.eclipse.ui.views.tasklist.ITaskListResourceAdapter 实例源码

项目:datahierarchy    文件:TreeElement.java   
@Override
public Object getAdapter(Class key) {
    if (ITaskListResourceAdapter.class == key) {
        // java.lang.ClassCastException:
        // de.loskutov.bfields.views.DelayedFieldElement
        // cannot be cast to org.eclipse.jdt.core.IJavaElement
        // at
        //org.eclipse.jdt.internal.ui.JavaTaskListAdapter.getAffectedResource
        // (JavaTaskListAdapter.java:28)
        return null;
    }
    if (key == IResource.class && data instanceof IResource) {
        return data;
    }
    if (IContributorResourceAdapter.class == key) {
        return ElementAdapterFactory.instance();
    }
    if (data instanceof IJavaElement) {
        Object adapter = ElementAdapterFactory.instance().getAdapter(data, key);
        if (adapter == null && key == IJavaElement.class) {
            return data;
        }
        return adapter;
    }
    return (data instanceof IAdaptable) ? ((IAdaptable) data).getAdapter(key) : null;
}
项目:FindBug-for-Domino-Designer    文件:BugGroup.java   
public Object getAdapter(Class adapter) {
    if (identifier != null && adapter.isAssignableFrom(identifier.getClass())) {
        return identifier;
    }
    if (BugGroup.class == adapter) {
        return this;
    }
    if (ITaskListResourceAdapter.class == adapter) {
        // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=246409
        return null;
    }
    // followed caused more troubles then uses.
    // if(self instanceof IAdaptable){
    // IAdaptable adaptable = (IAdaptable) self;
    // return adaptable.getAdapter(adapter);
    // }
    return null;
}
项目:Eclipse-Postfix-Code-Completion    文件:JavaElementAdapterFactory.java   
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;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavaElementAdapterFactory.java   
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;
}
项目:Pydev    文件:AbstractDebugTarget.java   
@SuppressWarnings("unchecked")
@Override
public <T> T getAdapter(Class<T> adapter) {
    AdapterDebug.print(this, adapter);

    // Not really sure what to do here, but I am trying
    if (adapter.equals(ILaunch.class)) {
        return (T) launch;

    } else if (adapter.equals(IResource.class)) {
        // used by Variable ContextManager, and Project:Properties menu item
        if (file != null && file.length > 0) {
            return (T) new PySourceLocatorBase().getFileForLocation(file[0], null);
        } else {
            return null;
        }

    } else if (adapter.equals(org.eclipse.debug.ui.actions.IRunToLineTarget.class)) {
        return (T) this.getRunToLineTarget();

    } else if (adapter.equals(IPropertySource.class)) {
        return launch.getAdapter(adapter);

    } else if (adapter.equals(ITaskListResourceAdapter.class)
            || adapter.equals(org.eclipse.debug.ui.actions.IToggleBreakpointsTarget.class)) {
        return super.getAdapter(adapter);
    }

    AdapterDebug.printDontKnow(this, adapter);
    return super.getAdapter(adapter);
}
项目:Pydev    文件:PyVariable.java   
@SuppressWarnings("unchecked")
@Override
public <T> T getAdapter(Class<T> adapter) {
    AdapterDebug.print(this, adapter);

    if (adapter.equals(ILaunch.class)) {
        return target.getAdapter(adapter);

    } else if (adapter.equals(org.eclipse.debug.ui.actions.IRunToLineTarget.class)) {
        return (T) this.target.getRunToLineTarget();

    } else if (adapter.equals(IScriptConsoleCodeGenerator.class)) {
        return (T) new PyConsoleCodeGeneratorVariable(this);

    } else if (adapter.equals(IPropertySource.class) || adapter.equals(ITaskListResourceAdapter.class)
            || adapter.equals(org.eclipse.ui.IContributorResourceAdapter.class)
            || adapter.equals(org.eclipse.ui.IActionFilter.class)
            || adapter.equals(org.eclipse.ui.model.IWorkbenchAdapter.class)
            || adapter.equals(org.eclipse.debug.ui.actions.IToggleBreakpointsTarget.class)
            || adapter.equals(IResource.class) || adapter.equals(org.eclipse.core.resources.IFile.class)) {
        return super.getAdapter(adapter);
    }

    //cannot check for the actual interface because it may not be available on eclipse 3.2 (it's only available
    //from 3.3 onwards... and this is only a hack for it to work with eclipse 3.4)
    if (adapter.toString().endsWith(
            "org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider")) {
        return (T) new PyVariableContentProviderHack();
    }
    AdapterDebug.printDontKnow(this, adapter);
    return super.getAdapter(adapter);
}
项目:Pydev    文件:PyThread.java   
@SuppressWarnings("unchecked")
@Override
public <T> T getAdapter(Class<T> adapter) {
    AdapterDebug.print(this, adapter);

    if (adapter.equals(ILaunch.class) || adapter.equals(IResource.class)) {
        return target.getAdapter(adapter);

    } else if (adapter.equals(ITaskListResourceAdapter.class)) {
        return null;

    } else if (adapter.equals(IDebugTarget.class)) {
        return (T) target;

    } else if (adapter.equals(org.eclipse.debug.ui.actions.IRunToLineTarget.class)) {
        return (T) this.target.getRunToLineTarget();

    } else if (adapter.equals(IPropertySource.class) || adapter.equals(ITaskListResourceAdapter.class)
            || adapter.equals(org.eclipse.debug.ui.actions.IToggleBreakpointsTarget.class)
            || adapter.equals(org.eclipse.ui.IContributorResourceAdapter.class)
            || adapter.equals(org.eclipse.ui.model.IWorkbenchAdapter.class)
            || adapter.equals(org.eclipse.ui.IActionFilter.class)) {
        return super.getAdapter(adapter);
    }
    //Platform.getAdapterManager().getAdapter(this, adapter);
    AdapterDebug.printDontKnow(this, adapter);
    // ongoing, I do not fully understand all the interfaces they'd like me to support
    return super.getAdapter(adapter);
}
项目:Pydev    文件:PyStackFrame.java   
@SuppressWarnings("unchecked")
@Override
public <T> T getAdapter(Class<T> adapter) {
    AdapterDebug.print(this, adapter);

    if (adapter.equals(ILaunch.class) || adapter.equals(IResource.class)) {
        return thread.getAdapter(adapter);
    }

    if (adapter.equals(ITaskListResourceAdapter.class)) {
        return null;
    }

    if (adapter.equals(IDebugTarget.class)) {
        return (T) thread.getDebugTarget();
    }

    if (adapter.equals(org.eclipse.debug.ui.actions.IRunToLineTarget.class)) {
        return (T) this.target.getRunToLineTarget();
    }

    if (adapter.equals(IPropertySource.class) || adapter.equals(ITaskListResourceAdapter.class)
            || adapter.equals(org.eclipse.debug.ui.actions.IToggleBreakpointsTarget.class)) {
        return super.getAdapter(adapter);
    }

    AdapterDebug.printDontKnow(this, adapter);
    // ongoing, I do not fully understand all the interfaces they'd like me to support
    return super.getAdapter(adapter);
}
项目:Eclipse-Postfix-Code-Completion    文件:JavaElementAdapterFactory.java   
private static ITaskListResourceAdapter getTaskListAdapter() {
    if (fgTaskListAdapter == null)
        fgTaskListAdapter= new JavaTaskListAdapter();
    return fgTaskListAdapter;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavaElementAdapterFactory.java   
private static ITaskListResourceAdapter getTaskListAdapter() {
    if (fgTaskListAdapter == null)
        fgTaskListAdapter= new JavaTaskListAdapter();
    return fgTaskListAdapter;
}