Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » ClassPathContainer enhancement suggestion
ClassPathContainer enhancement suggestion [message #51587] Fri, 06 June 2003 09:34 Go to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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
>
Previous Topic:debugger can't find Applet.class source - how to ignore this
Next Topic:-> JFace and SWT component testing
Goto Forum:
  


Current Time: Thu Jul 17 15:26:50 EDT 2025

Powered by FUDForum. Page generated in 0.15953 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top