Closed marisademeglio closed 8 years ago
Hi! Sorry for the late response, i totally missed that... :see_no_evil: Do you still have that issue? What java version do you use?
Yes, I am still getting this error: org.osgi.framework.BundleException: Unresolved constraint in bundle org.daisy.pipeline.gui [116]: Unable to resolve 116.0: missing requirement [116.0] osgi.wiring.package; (osgi.wiring.package=de.codecentric.centerdevice.platform.osx)
Java version is 1.8.0_45
Thanks for the clarification. I'm no export on osgi, but is it possible that this is not an issue with NSMenuFX but with the maven configuration? E.g. http://stackoverflow.com/questions/30480508/karaf-maven-unable-to-resolve-missing-requirement-osgi-wiring-package
I think it probably is a configuration issue. So there are no other bundles required to use NSMenuFX other than this?
<dependency>
<groupId>de.codecentric.centerdevice</groupId>
<artifactId>centerdevice-nsmenufx</artifactId>
<version>1.0.0</version>
</dependency>
it actually has one additional dependency
<dependency>
<groupId>org.eclipse.swt.org.eclipse.swt.cocoa.macosx.x86_64.4.3.swt</groupId>
<artifactId>org.eclipse.swt.cocoa.macosx.x86_64</artifactId>
<version>4.3</version>
</dependency>
that is referenced in the pom.xml
. Maven resolves this automatically but maybe you need to explicitly need to define this somewhere for osgi.
I've tried adding that as a dependency but I still get the same error. What's interesting is that I only get the error when I try to use your library. I can reference it as a dependency with no errors, but when I try to run the code below, I get the osgi.wiring.package error.
NSMenuBarAdapter adapter = new NSMenuBarAdapter();
// Get the default menu bar as JavaFX object
MenuBar menuBar = adapter.getMenuBar();
// Change the name of the first menu item
menuBar.getMenus().get(0).setText("Hello World");
// Update the menu bar
adapter.setMenuBar(menuBar);
Hmm, maybe org.eclipse.swt.cocoa.macosx.x86_64
has additional dependencies that are not included?
I created #4 to solve this issue by generating a valid manifest. This however might not help you with your dependencies as you need the imported packages as dependencies as well.
PR is merged, thx @CodingFabian ! I hope this fixes the issue
I now also pushed a pure JavaFX version that doesn't require any other dependencies on a branch: https://github.com/codecentric/NSMenuFX/tree/pure-javafx Maybe this helps!
Thanks! I'd love to try out the javafx branch. Is it an OSGi bundle?
I got a build error when I tried to build it (mvn clean install):
Generating /Users/marisa/Projects/NSMenuFX/target/apidocs/help-doc.html... [INFO] Building jar: /Users/marisa/Projects/NSMenuFX/target/centerdevice-nsmenufx-javadoc.jar [INFO] [INFO] --- maven-gpg-plugin:1.5:sign (sign-artifacts) @ centerdevice-nsmenufx --- /bin/sh: gpg: command not found [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 43.105 s [INFO] Finished at: 2015-12-09T17:51:39-08:00 [INFO] Final Memory: 29M/268M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-gpg-plugin:1.5:sign (sign-artifacts) on project centerdevice-nsmenufx: Exit code: 127 -> [Help 1]
Yes, it should also be an OSGi bundle. Currently maven signs created artefacts using gpg, but if you don't have gpg installed, you can skip that by using:
mvn install -Dgpg.skip=true
Thanks! That worked. So now I am able to build and integrate it. Attached are 2 screenshots, one without the MenuToolkit and one with. I just need to change the word "java" to my application name. Here is my code snippet:
this.setUseSystemMenuBar(true);
MenuToolkit toolkit = MenuToolkit.toolkit();
Menu toolkitMenu = toolkit.createDefaultApplicationMenu("DAISY Pipeline 2");
toolkit.setApplicationMenu(toolkitMenu);
toolkitMenu.setText("DAISY Pipeline 2");
Changing the application name in the menu is something that has always been a bit hacky. Strictly speaking, it never really worked... What was possible in the SWT version was to remove the application menu and replace it with some regular menu. As a result, the application name was no longer bold-faced but looked like any other menu...
There is however a clean solution to change the app name by bundling the application to an app.You can find some more details about that here: http://docs.oracle.com/javafx/2/deployment/self-contained-packaging.htm
The most important thing is to create an .app
bundle with an Info.plist
file that sets the CFBundleName
to whatever you want to see as you applications name in the menu bar.
I've added a reference to your maven bundle from my OSGi project but I'm getting this error when I run it. Are there other dependencies that I'm missing? The error only shows up when I try to instantiate a menu bar adapter.