Alternative to extending an 'internal' class [message #871445] |
Sun, 13 May 2012 19:50 |
Chris Ainsley Messages: 78 Registered: March 2010 Location: UK |
Member |
|
|
Hi,
I'm currently writing my first Eclipse plug-in, and its going slowly, but I'm excited to be making progress.
I'm having a trivial problem but not sure what is the correct way forward so I'm posting here.
I'm writing a launcher to launch certain types of files via a JVM (but the launching dialogs are completely customised). Think of it as similar to the difference between a regular java app, an applet and a remote java app.
Bearing that in mind, I looked to the org.eclipse.jdt.debug.ui.launchConfigurations.AppletMainTab for inspiration on how to modify a main tab. This class extends the 'org.eclipse.jdt.internal.debug.ui.launcher.SharedJavaMainTab' and as such, there is very little code in the actual AppletMainTab class itself.
My question is, why is the 'org.eclipse.jdt.internal.debug.ui.launcher.SharedJavaMainTab' internal, and is it ok for me to extend this class even though its internal?
Of course, if I don't extend this class, then I can only think of copying and pasting from the internal classes into my own class as I need 90% of the same behaviour.
Can anyone recommend what is the corrent solution here?
Regards,
Chris
|
|
|
Re: Alternative to extending an 'internal' class [message #871609 is a reply to message #871445] |
Mon, 14 May 2012 14:16 |
Dani Megert Messages: 3802 Registered: July 2009 |
Senior Member |
|
|
On 13.05.2012 21:50, Chris Ainsley wrote:
> Hi,
>
> I'm currently writing my first Eclipse plug-in, and its going slowly,
> but I'm excited to be making progress.
>
> I'm having a trivial problem but not sure what is the correct way
> forward so I'm posting here.
>
> I'm writing a launcher to launch certain types of files via a JVM (but
> the launching dialogs are completely customised). Think of it as
> similar to the difference between a regular java app, an applet and a
> remote java app.
> Bearing that in mind, I looked to the
> org.eclipse.jdt.debug.ui.launchConfigurations.AppletMainTab for
> inspiration on how to modify a main tab. This class extends the
> 'org.eclipse.jdt.internal.debug.ui.launcher.SharedJavaMainTab' and as
> such, there is very little code in the actual AppletMainTab class itself.
>
> My question is, why is the
> 'org.eclipse.jdt.internal.debug.ui.launcher.SharedJavaMainTab' internal,
Providing an API is expensive in the sense that it locks in the product.
Therefore those are often only provided on request.
> and is it ok for me to extend this class even though its internal?
You can use it but in the next Eclipse version this class might not be
there anymore or work differently. You might have to adjust your code then.
> Of course, if I don't extend this class, then I can only think of
> copying and pasting from the internal classes into my own class as I
> need 90% of the same behaviour.
>
> Can anyone recommend what is the corrent solution here?
The correct solution is to only use official API, especially if you
intend to ship a product.
Dani
>
> Regards,
>
> Chris
|
|
|
Powered by
FUDForum. Page generated in 0.03830 seconds