tarik
tarik

Reputation: 83

How to Install "Nebula" Project into Eclipse

I’m trying to install the Nebula-Software from Eclipse. It seems, I miss a may be little, but very relevant point.
My main aim is to test and work with the “Nebula Oscilloscope Widget”.
So I did as I got told at:
https://www.eclipse.org/nebula/downloads.php
and used:
Releases - Release 1.4.0 And there:
Downloads - Update site: http://download.eclipse.org/nebula/releases/1.4.0
I managed to get this into eclipse install and got some directories and files in .p2, like

And there
the META-INF directory
an files epl-v10.html
feature.properties
feature.xml
license.html

I do not see, how it could help. Unfortunately, Eclipse does not see it as well.
Java import statements like
import org.eclipse.nebula.widgets.oscilloscope.multichannel.OscilloscopeDispatcher;
import org.eclipse.swt.SWT;
are still unresolved.

Next try: There is an zip file at the page, titled
"Update site repo zipped: repository.zip"
http://download.eclipse.org/nebula/releases/1.4.0/repository-nebula-1.4.0.zip
Loading it, a lot of jar files are in – but where to place it?

Next try, there is of course the git link:
https://github.com/eclipse/nebula
where one can get a "nebula-master.zip"

I imported it as “from archive”. As result I finally got a project
"org.eclipse.swt.nebula" containing several subfolders. My love interest, oszilloscope is in
Project "org.eclipse.swt.nebula"
...Folder widgets,
...Folder oszilloskope,
...Folder org.eclipse.nebula.widgets.oscilloscope.snippets
...folder src
...Folder org
...Folder eclipse
...Folder nebula
...Folder widgets
...Folder oscilloscope
...Folder snippets.
I do not think, that structure is intended. Trying to run the demo, I get errors like
"Launch configuration GridAllTests references non-existing project org.eclipse.nebula.widgets.grid.test." What is right.

The “org.eclipse.nebula.widgets.grid.test” is part of the
folder grid,
of folder widgtes,
of Project org.eclipse.swt.nebula

Something went terribly wrong, probably at import time. How to get it right?

Thanks !

Upvotes: 1

Views: 2051

Answers (1)

howlger
howlger

Reputation: 34255

If you want to use the Nebula Oscilloscope widget in a plain Java application (instead of in an OSGi application) you have to add the following JARs to your Java build path (Project > Properties: Java Build Path) which can be found in the plugins supdirectory of your Eclipse installation directory after the installation (use Add External JARs... button):

  • org.eclipse.swt_<version>.jar (e. g. org.eclipse.swt_3.106.1.v20170926-0519.jar)
  • org.eclipse.swt.<platform>_<version>.jar (e. g. org.eclipse.swt.win32.win32.x86_64_3.106.1.v20170926-0519.jar)
  • org.eclipse.equinox.common_<version>.jar (e. g. org.eclipse.equinox.common_3.9.0.v20170207-1454.jar)
  • org.eclipse.nebula.widgets.oscilloscope_<version>.jar (e. g. org.eclipse.nebula.widgets.oscilloscope_1.4.0.201711021145.jar)

OscilloscopeExampleTab.java requires also adaption to use it in a plain Java project:

  • remove extends AbstractExampleTab
  • remove all @Overrides
  • change the line final String path = FileLocator.getBundleFile(Platform.getBundle(BUNDLE)).getPath(); to final String path = "wavs"; (if using sounds, you have to create a folder wavs that contains the *.wav files of the example)
  • change the line } catch (IOException e) { to } catch (Throwable e) {
  • Source > Organize Imports to remove not required imports that can not be resolved

With these adaptions you can run the example via the following main method:

public static void main (String [] args) {
    Display display = new Display ();
    Shell shell = new Shell (display);
    shell.setSize(600, 800);

    RowLayout layout = new RowLayout(SWT.HORIZONTAL);
    layout.wrap = true;
    layout.fill = true;
    layout.justify = false;
    shell.setLayout(layout);

    Composite mainArea = new Composite(shell, SWT.None);
    mainArea.setLayout(new RowLayout());

    Composite settings = new Composite(shell, SWT.None);
    settings.setLayout(new RowLayout(SWT.HORIZONTAL));

    OscilloscopeExampleTab osci = new OscilloscopeExampleTab();
    osci.createParameters(settings);
    osci.createControl(mainArea);

    shell.open ();
    while (!shell.isDisposed ()) {
        if (!display.readAndDispatch ()) display.sleep ();
    }
    display.dispose ();
}

Resulting Nebula Oscilloscope widget example as plain Java application:

enter image description here

Upvotes: 2

Related Questions