org.eclipse.ui.views.tasklist.ITaskListResourceAdapter Java Examples

The following examples show how to use org.eclipse.ui.views.tasklist.ITaskListResourceAdapter. 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: BugGroup.java    From spotbugs with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
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;
}
 
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: AbstractDebugTarget.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@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) FindWorkspaceFiles.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);
}
 
Example #4
Source File: PyVariable.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@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);
}
 
Example #5
Source File: PyThread.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@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);
}
 
Example #6
Source File: PyStackFrame.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@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);
}
 
Example #7
Source File: JavaElementAdapterFactory.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private static ITaskListResourceAdapter getTaskListAdapter() {
	if (fgTaskListAdapter == null)
		fgTaskListAdapter= new JavaTaskListAdapter();
	return fgTaskListAdapter;
}