Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » ClassPathContainer enhancement suggestion
ClassPathContainer enhancement suggestion [message #51587] Fri, 06 June 2003 13:34 Go to next message
Joss Wright is currently offline Joss WrightFriend
Messages: 32
Registered: July 2009
Member
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 22:47 Go to previous message
Erich Gamma is currently offline Erich GammaFriend
Messages: 20
Registered: July 2009
Junior Member
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: Sat Jul 27 16:47:15 GMT 2024

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

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

Back to the top