1

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

  • \org.eclipse.equinox.p2.core\
  • \pool\features\org.eclipse.nebula.widgets.oscilloscope.feature_1.4.0.201711021145\

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 !

tarik
  • 73
  • 2
  • 10
  • Do you want to use the widget in a plain Java application or in an OSGi application? In case of a plain Java application, you have to add the Nebula JAR and all required JARs to the Java classpath. After installing it, you will find the JARs in the `plugins` subdirectory of your Eclipse installation directory. In case of an OSGi application, create a new plug-in project and add a dependency to the Nebular plug-in/bundle. – howlger Nov 19 '17 at 14:36
  • Hello @tarik! I'd like to remind you that if it solved your problem, then you should accept the answer by howlger below. See the [help pages](https://stackoverflow.com/help/someone-answers) for more information. – Lii May 03 '18 at 11:04

1 Answers1

2

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

howlger
  • 31,050
  • 11
  • 59
  • 99
  • Hello howlger, Thanks a lot. Seems, you spent some time for testing it locally on your your platform. I followed your advice and several error disappeared. 3 are still there - The
    import org.eclipse.core.runtime.Platform;
    import org.eclipse.nebula.examples.AbstractExampleTab;
    can not be resloved and probably for that reason the
    – tarik Nov 20 '17 at 13:56
  • Just remove these imports, there are not required anymore after removing `extends AbstractExampleTab` and changing `final String path = ...`. – howlger Nov 20 '17 at 14:05
  • Hello howlger, Thanks a lot. Seems, you spent some time for testing it locally on your your platform. So I feel sorry not coming back with a success story, but new questions: I followed your advice and several error disappeared. These are still there - The
    import org.eclipse.core.runtime.Platform; import org.eclipse.nebula.examples.AbstractExampleTab; can not be resolved and probably for that reason e.g. the Display display = new Display (); Shell shell = new Shell (display); are failing. The type org.osgi.framework.bundle .... can not be resolved. Thanks! - Tarik
    – tarik Nov 20 '17 at 14:07
  • If you do _Source > Organize Imports_ in `OscilloscopeExampleTab`, there should be no compile errors anymore. Otherwise, make sure you have only the class `OscilloscopeExampleTab` in your plain Java project – howlger Nov 20 '17 at 14:13
  • Ok, done. Display and shell additionally imported. Just for final String path = FileLocator.getBundleFile(Platform.getBundle(BUNDLE)).getPath(); seem there is no import. If i use the proposal: import org.eclipse.swt.internal.Platform; But it comes back ... "There is no method getBundle". If OK, I just rewrite the statement? – tarik Nov 20 '17 at 14:18
  • Change the whole line `final String path = FileLocator.getBundleFile(Platform.getBundle(BUNDLE)).getPath();` to `final String path = "wavs";` and do again _Source > Organize Imports_. – howlger Nov 20 '17 at 14:22
  • 1
    Runs fine. Thanks! – tarik Nov 20 '17 at 14:28