1

I am trying to extend a third-party Eclipse plug-in by using a fragment project. The major reason is that the third party plug-in contains classes having the default (package) modifier and I need to extend them.

Thus, my extensions class must be located in exactly the same package. I create a fragment project containing the same package and put my class into it. Everything works fine when I am using a runtime workspace.

However, if I try to deploy my fragment (e.g., deploying it into the dropins folder of my Eclipse distribution), I am not able to execute the code. Extensions and stuff like that work fine (e.g., I use extensions for a new Run Configuration. However, if I try to instantiate this run configuration I get an error message that the third-party root plug-in was unable to load the class to display my configuration tab group.

Any experience with this kind of problems?

Claas Wilke
  • 1,951
  • 1
  • 18
  • 29

3 Answers3

1

Sorry, but that does not work. Unless the host bundle has been crafted specially for it, you cannot override a class in the host from a fragment. The reason is that resources - including classes - are retrieved from the host before any fragment.

See org.eclipse.osgi.baseadaptor.loader.ClasspathManager for the implementation..

Tonny Madsen
  • 12,628
  • 4
  • 31
  • 70
  • Actually, I do not want to override a class, I just want to add further classes to the plugin's classpath. I thought, this should be possible by using fragments. As I said, it actually does work as long as I not try to deploy my fragment as a JAR and run the fragment in the runtime workspace. – Claas Wilke Jun 06 '12 at 12:23
  • And that is actually possible! And one of the major uses of fragments :-) – Tonny Madsen Jun 06 '12 at 18:16
  • Okay, so why in my case do I get a ClassNotFoundException? The bad thing about it is that I do not even get a stack trace for my problem. I just get an ErrorDialog with the message and the error log remains empty. What I exactly do is that I register a new run configuration via an Eclipse extension and the problem occurs once I try to instantiate this run configuration. Is this probably a problem within the extension point's implementation or did I overlook something? – Claas Wilke Jun 07 '12 at 07:17
0

Actually, this is the extension code I am using:

<extension point="org.eclipse.debug.ui.launchConfigurationTabGroups">
  <launchConfigurationTabGroup
    class="com.android.ide.eclipse.adt.internal.launch.jouleunit.AndroidJouleUnitTabGroup"
    id="com.android.ide.eclipse.adt.jouleunit.AndroidJouleUnitLaunchConfigTabGroup"
    type="com.android.ide.eclipse.adt.jouleunit.launchConfigurationType">
  </launchConfigurationTabGroup>

Of course, there are further extensions definig the launch configuration type etc. but this is the one leading to the class which Eclipse can not find.

Claas Wilke
  • 1,951
  • 1
  • 18
  • 29
0

Actually I found the problem now for myself. The problem was a wrong configured build properties file which excluded the Java byte code from my fragment JAR. Very itchy, as the classes were in the JAR but in a wrong subdirectory.

Claas Wilke
  • 1,951
  • 1
  • 18
  • 29