ClassPathContainer enhancement suggestion [message #51587] |
Fri, 06 June 2003 09:34  |
Eclipse User |
|
|
|
I have implemented an IClasspathContainer that mimics the behaviour of a
'lib' folder, i.e. it adds jars to the project classpath that are placed
in designated folder. In the Java Perspective, Package Explorer view I had
hoped to use the standard import wizard to import jars into the designated
folder by right-clicking the classpath container icon, however this is not
currently possible, for two reasons:
1. The Import Wizard expects the selection passed to it, to be either an
IResource or to be Iadapatable and return an IResource obeject.
2. The Pacakage Explorer visually represents an IClasspathContainer using
the org.eclipse.jdt.internal.ui.packageview.ClassPathContainer object,
which does implement IAdaptable but does not return an IResource object.
Can I suggest a simple change to ClassPathContainer.getAdapter() to return
the IResource object of the underlying IClassspathContainer as follows:
public Object getAdapter(Class adapter) {
if (adapter == IWorkbenchAdapter.class) {
return this;
}
else if ((adapter == IResource.class) && this.fContainer instanceof
IAdaptable) {
return this.fContainer.getAdapter(IResource.class);
} else {
return null;
}
}
Where fContainer is a reference to the underlying IClasspathContainer
object.
Regards,
Joss
|
|
|
Re: ClassPathContainer enhancement suggestion [message #52105 is a reply to message #51587] |
Fri, 06 June 2003 18:47  |
Eclipse User |
|
|
|
This makes sense. Once you adapt to IResource you will also get
corresponding object contributions, but this might be desirable anyways.
Filed bug# 38618
--erich
"Joss Wright" <joss.wright@talk21.com> wrote in message
news:bbq598$4rq$1@rogue.oti.com...
> I have implemented an IClasspathContainer that mimics the behaviour of a
> 'lib' folder, i.e. it adds jars to the project classpath that are placed
> in designated folder. In the Java Perspective, Package Explorer view I had
> hoped to use the standard import wizard to import jars into the designated
> folder by right-clicking the classpath container icon, however this is not
> currently possible, for two reasons:
>
> 1. The Import Wizard expects the selection passed to it, to be either an
> IResource or to be Iadapatable and return an IResource obeject.
>
> 2. The Pacakage Explorer visually represents an IClasspathContainer using
> the org.eclipse.jdt.internal.ui.packageview.ClassPathContainer object,
> which does implement IAdaptable but does not return an IResource object.
>
> Can I suggest a simple change to ClassPathContainer.getAdapter() to return
> the IResource object of the underlying IClassspathContainer as follows:
>
> public Object getAdapter(Class adapter) {
> if (adapter == IWorkbenchAdapter.class) {
> return this;
> }
> else if ((adapter == IResource.class) && this.fContainer instanceof
> IAdaptable) {
> return this.fContainer.getAdapter(IResource.class);
> } else {
> return null;
> }
> }
>
> Where fContainer is a reference to the underlying IClasspathContainer
> object.
>
> Regards,
>
> Joss
>
|
|
|
Powered by
FUDForum. Page generated in 0.15953 seconds