Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Provide library from Eclipse plugin to workspace

JUnit does the same, and I just can't figure out how...

Eclipse junit quick fix

I guess thats because of this entry in the Properties > Java Build Path > Libraries > Add Library wizard:

Eclipse junit add library

How can I do the same and include my library in this wizard from my plugin, i.e. make it available to a user in workspace?

like image 577
Cedric Reichenbach Avatar asked Mar 07 '26 11:03

Cedric Reichenbach


1 Answers

OK, there are three different extension points you need to look at. The easiest way is to look at the JUnit plugin itself (there are four)

org.eclipse.jdt.junit: git://dev.eclipse.org/org.eclipse.jdt/org.eclipse.jdt.junit.git
org.eclipse.jdt.junit.core: git://dev.eclipse.org/org.eclipse.jdt/org.eclipse.jdt.junit.core.git
org.eclipse.jdt.junit.runtime: git://dev.eclipse.org/org.eclipse.jdt/org.eclipse.jdt.junit.runtime.git
org.eclipse.jdt.junit4.runtime: git://dev.eclipse.org/org.eclipse.jdt/org.eclipse.jdt.junit4.runtime.git

So, you can investigate the JUnit plugins, but these are the extension points you'll need:

For the Add Library, look at the extension point org.eclipse.jdt.ui.classpathContainerPage. From the JUnit plugin.xml:

<extension point="org.eclipse.jdt.ui.classpathContainerPage">
  <classpathContainerPage
        name="%JUnitContainerName"
        class="org.eclipse.jdt.internal.junit.buildpath.JUnitContainerWizardPage"
        id="org.eclipse.jdt.junit.JUNIT_CONTAINER">
  </classpathContainerPage>
</extension>

So this is implemented as JUnitContainerWizardPage. This extends IClasspathContainerPage and IClasspathContainerPageExtension.

For the quickfix and classpathfix see the extension points org.eclipse.jdt.ui.quickFixProcessors and org.eclipse.jdt.ui.classpathFixProcessors. From the JUnit plugin.xml again:

<extension point="org.eclipse.jdt.ui.quickFixProcessors">
  <quickFixProcessor
        name="%junitQuickFixProcessor"
        class="org.eclipse.jdt.internal.junit.ui.JUnitQuickFixProcessor"
        id="org.eclipse.jdt.junit.JUnitQuickFixProcessor">
  </quickFixProcessor>
</extension>

<extension point="org.eclipse.jdt.ui.classpathFixProcessors">
  <classpathFixProcessor
        name="%junitClasspathFixProcessor"
        class="org.eclipse.jdt.internal.junit.ui.JUnitClasspathFixProcessor"
        id="org.eclipse.jdt.junit.JUnitClasspathFixProcessor">
        <overrides id="org.eclipse.jdt.ui.text.correction.DefaultClasspathFixProcessor">
        </overrides>
  </classpathFixProcessor>
</extension>
like image 169
Matthew Farwell Avatar answered Mar 10 '26 02:03

Matthew Farwell



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!